Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 02 06:16
    @ljharb banned @frank-dspeed
  • Apr 27 2018 01:23
    @MylesBorins banned @fjeddy
  • Feb 24 2016 08:26
    @rvagg banned @jonathanenbe
Corey Lewis
@cursiv3
Too many projects have unrealistic time tables due to scope creep, bad spec, team members leaving, budgets getting adjusted, etc
Cheap, fast, good; pick two xD
Cheap and fast? Wont be good; cheap and good? Won't be done quickly. Fast and good? Not cheap
Roman Kushyn
@romeerez
@cursiv3 with cheap and fast approach you won't find well-paid project, isn't it so? Cheap and fast niche is already taken by our indian friends
Roman Kushyn
@romeerez

Maybe it's me being lucky, I have 3 different projects in parallel, different clients and domains and specifics, and don't feel like any of them is pushing me with time limits or like one of them has too bad conditions.

I'm a freelancer, maybe it's the key, I can exit bad projects and find comfortable ones. When I was working in the office it was different: as client pays money you have to work on it regardless of anything

Siddharath Bhardwaj
@sobhardwaj

app.get('/testing', (req, res) => {
let access_token = EwCAA8l6BAAUO9chh8cJscQLmU+LSWpbnr0vmwwAAePeHhdgSjTzw7GRsv 9kceCximodkMcH47SYSrNDjqjJ2Zbi4aSQzQfP1F8v4dzHy50BD+7LNWw1 OYNuQgU8Bw5el29DOoIhRcH6Ure7LpDCTS8FPSGzCX/HrZIf7SbaZFM9jk fsGV5YU5Se97LsVafG8S9N/+AfBg+USZiXVodREdyg08VwEP2tylwWROsM oGKiQV8Uup2jPMNET5TAV9N2Cw7PFwX/sk46ACUy+YIoLagw+FzI0Moauww SwGTsSwuHsyV2OoRqVA+VkbIREHDt/M19wSUeIaQs25GhM5d9MU3jWKNK3C mIN6a2r1wBXvuKKvPtUChi3SVMOFvi5RQDZgAACA+qyRF1VzWBUAIt4MTyl fXayBsK/YHDE3KQaD+eCkyvLVMP1PH3br2OoXgkDDMLRL+Lu3jmwW3kGGOB 0Tf06ynnWT0+9WdSe1VHa0PpkBj8WCnmVDLMKW+PwwDW59Qbn/J5aVzb/4/ OXkwPHwrre67PIZIcsaP6GHW4UixDsYvIaxeJ6mx1MppjYqO9sGEnfB2UzF kK54Emc8oi6M3/xY9AiPA4Bcbf0hVRDZql2rT8DsxfoRBgJWc2gpfKubhL5 Cd6QaRzQUOCxiPc/tWQap0gCq1sCvYMYBNdwBWpUoLuj5vVlkoewKQlXDvY yUjV9z+64v97u4F0iA5ZqXoy39lzCEuJHr74SE9tN8T4QgdF3KFRQjk+jgt HCAuwXEXkl1AwU5DwE1lUmpnBWv0XuFaofzOjFh7CgOejgFTxK0i6n9XyId WV0O4RCm6czSxFH2NZ3rZXGKCf0VtBna6dbzQnJJ7nnUMalbLiqUNCE+RqX khajxfazjJdAdn5F7561Jw9/tgYJtq/qoGWSITFOGKRdGodNWbCk0I9irOk GfYkdjKkP3DMLYcPu3Z4S64Hjc55MX5wQeOiK6tJrGvpzUXx3OEZjdIWB0Y zaRZJCEikaIOyIw12en0ox6zhEbfa1okSg0FJqRTBCD3oL8bXVnRDsdyWsi NYsmUjNZyXtJ7fANwdqmrysUleYVpPPvPOoWVMbN99Ms0FLq/RcFB3D8WVB 8fI6t5Rglg+aQwZ/5bgy1LPvO5ZLjmFn9ciTbNrKWkqASyvJuom4VTi45DU9oaE/hUgrHSYs678rgI=;
let DriveEndPoint = 'https://graph.microsoft.com/v1.0/me/drive/root/children';
// let access_token = JSON.parse(req.body.token).access_token;
log.info(access_token);

return new Promise((resolve, reject) => { 
    let data = []; 
    fetch(DriveEndPoint, {
        headers: {
            'Authorization': `Bearer ${access_token}`
        }
    }).then(async response => {
        if(response.status === 200) {
            try {     
               data = await response.json();
               console.log(data);
            // res.send({ response: JSON.stringify(json, undefined, 2) })
            res.send({ response: data })

            } catch (error) {
                console.log(err);
                reject(err);
            }
            resolve(data);
        } else {
            reject(err);
        }
    });
});

})

this try catch block not working ? unhandled promise rejection error? what is the issue??
Siddharath Bhardwaj
@sobhardwaj
I want to upload file on one drive with wrapper api in node js how to do that??
raghanag
@raghanag
Hi I have an index.html which is getting served by express server thru https, now if I need to access other API's with different domain, I see cors issues, even though the API has the Access-Control-Allow-Origin as * and coming as "https://localhost:3000" in the OPTIONS request, but the main POST is failing with
Access to fetch at 'https://blahblah/Api/search/v1/describe?resources=order' from origin 'https://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
this is my start server script
const startServer = function() {

  var privateKey  = fse.readFileSync('build-config/ssl/key.pem', 'utf8');
  var certificate = fse.readFileSync('build-config/ssl/cert.pem', 'utf8');

  var credentials = {key: privateKey, cert: certificate};

  const PORT = BUILD_CONFIG.deploy.port;

  const HOST = '0.0.0.0';

  const app = express();

  // const corsOptions = {
  //   origin: function(origin, callback) {
  //     callback(null, true);
  //   },
  //   credentials: true,
  // };

  app.use(cors());

  app.use(function(req, res, next) {
    const indexHtml = 'index.html';
    let { url } = req;
    // console.log(url);
    const queryIndex = url.indexOf('?');
    if (queryIndex > 0) {
      url = url.substring(0, queryIndex);
    }

    if (url.endsWith(indexHtml) || url.endsWith('/')) {
      if (!url.endsWith(indexHtml)) {
        url += indexHtml;
      }
      sendIndex(url, req, res, next);
    } else {
      next();
    }
  });

  app.use(express.static(SRC));
  // const server =
  // app.listen(PORT, () => {
  //   open(`http://localhost:${PORT}`);
  // });
  var httpsServer = https.createServer(credentials, app);

  httpsServer.listen(PORT, HOST, function() {
    console.log(`app listening on localhost port: ${PORT}`);
  });
};
startServer();
Divine C
@Divine1
i have a doubt in nodejs docker container. posted the question here. please look into this one nodejs/help#3010
delphi
@johndeguerto

Just need help how I can return the results once all promises are done.

```

 try{

            async function getSeats(domain){
                const seat = await asyncGetSeats(domain, user_filters, token ) 
                return seat
            }

            let results = []

            domains.forEach( async domain => {
                results.push( await getSeats(domain))
            })

            console.log(results)

            res.json(results)

        }catch(e){ 
            console.log(e.message)
            res.status(500).send(e.message)
        }
delphi
@johndeguerto
nvm, I found my old code which I wrote 3 years ago. So fixed this code using
Async function getSeats(domain){
    const seatP = domains.map( domain => {
        return await asyncGetSeats( domain, user_filters, token )
    })

    const seats = await Promise.all(seatP)
    console.log(seats)
    return seats
}
Yerrapotu Manojkiran
@nani554
Hello
Sourabh Grover
@sourabhgrover
Is there any way to get number of sheets in excel file in xlsx(https://www.npmjs.com/package/xlsx) package ?
delphi
@johndeguerto
@sourabhgrover I think you need to read the file and read the output
Cell address objects are stored as {c:C, r:R} where C and R are 0-indexed column and row numbers, respectively. For example, the cell address B5 is represented by the object {c:1, r:4}.

Cell range objects are stored as {s:S, e:E} where S is the first cell and E is the last cell in the range. The ranges are inclusive. For example, the range A3:B7 is represented by the object {s:{c:0, r:2}, e:{c:1, r:6}}. Utility functions perform a row-major order walk traversal of a sheet range:
David Heredia Tartajo
@dherediat97
hello, someone here is experts in apis and specifically in riot api?
Siemienik Paweł
@Siemienik

@sourabhgrover

Is there any way to get number of sheets in excel file in xlsx(https://www.npmjs.com/package/xlsx) package ?

workbook.SheetNames.lenght

Doni Yafi
@yafiwebdev
Anyone looking for a partner to collaborate on their project PM me
I can help with MERN/MEVN stacks and Laravel
Devin
@demitchell14
So odd question.. but I'm going to start development using two separate operating systems. Windows 10 and Ubuntu 20.04 LTS.
They're both going to be used in development of multiple projects, so I'm curious if there are/would be any problems with node_modules if I were to, lets say, use the same hard drive in both environments. I know there is some functionality that exists in linux that I can't do in Windows, and vice versa, but generally, what I've found is that in those cases, there are windows workarounds and binaries. -- I'm just curious if anyone has ran into problems using the exact same physical file structure in both environments.
Ashwin
@ashwinsoni
Hello.... would like to know, is it a good practice to store the mongo query result(30 documents in my case) in a global variable or not? and reuse that global variable whenever that result data is required... TIA :pray:
Siemienik Paweł
@Siemienik

@demitchell14

So odd question.. but I'm going to start development using two separate operating systems. Windows 10 and Ubuntu 20.04 LTS.
They're both going to be used in development of multiple projects, so I'm curious if there are/would be any problems with node_modules if I were to, lets say, use the same hard drive in both environments. I know there is some functionality that exists in linux that I can't do in Windows, and vice versa, but generally, what I've found is that in those cases, there are windows workarounds and binaries. -- I'm just curious if anyone has ran into problems using the exact same physical file structure in both environments.

I was working on windows with installed cmder, I didn't feel larger difference :)

Ghost
@ghost~5f8727ebd73408ce4ff18786
Hello, just getting started on Javascript language track and I have followed all the set up instructions and still having trouble getting the test to run. Here is what it says in the terminal when I try to run a test: ! enoent This is related to npm not being able to find a file.
Neil Duffy
@skiv71
@StephLSohns good choice :smile:
harisvreto
@harisvreto
Hey everyone, just need some guidance with the feature I am working on
It is the following thing:
I am making a website that supports real time game player vs player
When new game is made it is in status "open"
Game starts when all slots are filled (2 to 4 players) and gets status "progress"
it consists of number of rounds creator picked (eg. 10)
I am using socket io to make that happen
Whenever user on client application enters the url of the room, I emit "join_room" message to the backend and using socket io I join that particular user to that room by room uuid so I can emit details about that game to just that particular group of users
The thing is that the user does not take any actions in order to start the round but that rounds should be executed one by one every 5 seconds for example (or when some data are calculated on the backend for a specific round, and saved to the database server emits the current round to all users in the group with all neccesary data and moves to the next until it reaches the last round)
The thing is that I need some way (intervals) to always check the game status, and to start emmiting the rounds by intervals when status is "progress"
What would be the best way to achieve this?
Any ideas?
I am using socket io, if anyone did anything like this, I am listening
Jordan Harband
@ljharb
recursive setTimeout.
harisvreto
@harisvreto
@ljharb thanks man
Romil Lodaya
@theRomie_twitter
I have deploy API on another server and redis on another server and connect each server for redis but after some time if I try to access redis data from API its giving me AbortError: Redis connection lost and command aborted. It might have been processed
Eric
@calidion
don't use socket.io
harisvreto
@harisvreto
Why is that?
Eric
@calidion
use websocket instead. polling is not persistent.
Jordan Harband
@ljharb
socket.io is fine, and uses websockets when available
Fedor Pasynkov
@pefbrute
Hi everyone!
Fedor Pasynkov
@pefbrute
Guys, does someone want to collabarate with me on project for portfolio?
Steins Gate
@satomitakashi_gitlab
Is there a way to npm install a package globally and have its dependencies to be installed on the same level as the package? For example, if I npm install <my_package> into my personal project, all of my_package's dependencies are installed on the same level. But if I npm install -g <my_package>, its dependencies are installed into my_package's node_module folder.
Jordan Harband
@ljharb
no, and you wouldn't want that
that would make global modules conflict with each other
also, you shouldn't install anything globally.
Steins Gate
@satomitakashi_gitlab
@ljharb thanks!
Sourabh Grover
@sourabhgrover

@sourabhgrover

Is there any way to get number of sheets in excel file in xlsx(https://www.npmjs.com/package/xlsx) package ?

workbook.SheetNames.lenght

Thanks @Siemienik it worked

@sourabhgrover I think you need to read the file and read the output

Thanks @johndeguerto it was resolved

Orton Chukwuwemeka
@ortoncee
@pefbrute hi
Abu Syeed Sajid Ahmed
@Sajid576

'''
const puppeteer = require('puppeteer');
const request=require('request');
const cheerio=require('cheerio')
var newsModel=require('./NewsModel')
var EventEmitter = require('events')
var ee = new EventEmitter()

class ScrapModel
{
static websiteURL='https://www.nytimes.com';
static options={};
static browser;
static posts;
constructor()
{
ScrapModel.listenNewsUpdate();
/*ee.on('message', function (text) {

  });

  //10 sec interval
  setInterval(()=>{
      ee.emit('message', 'hello world');
  },30000);*/
}  

static async proxyGenerator()
{
    let ip_addresses = [];
    let port_numbers = [];
    let proxy;
     request("https://sslproxies.org/", function(error, response, html) {
      if (!error && response.statusCode == 200) {
        const $ = cheerio.load(html);

        $("td:nth-child(1)").each(function(index, value) {
          ip_addresses[index] = $(this).text();
        });

        $("td:nth-child(2)").each(function(index, value) {
          port_numbers[index] = $(this).text();
        });
      } else {
        console.log("Error loading proxy, please try again");
      }

      ip_addresses.join(", ");
      port_numbers.join(", ");

      //console.log("IP Addresses:", ip_addresses);
      //console.log("Port Numbers:", port_numbers);
      let random_number = Math.floor(Math.random() * 100);
      proxy = 'http://'+ip_addresses[random_number]+':'+port_numbers[random_number];
      console.log(proxy);
      return proxy;
    });
}

static async listenNewsUpdate()
{
    var proxy= await ScrapModel.proxyGenerator();
    ScrapModel.browser = await puppeteer.launch({
      headless: false,
      //args: [ '--proxy-server='+proxy ],
    });
    const page = await ScrapModel.browser.newPage();

    await page.goto(ScrapModel.websiteURL);


    var posts= await page.evaluate(() => new Promise((resolve) => {

      var scrollTop = -1;
      const interval = setInterval(() => {
        window.scrollBy(0, 500);
        if(document.documentElement.scrollTop !== scrollTop) {
          scrollTop = document.documentElement.scrollTop;
          return;
        }

        var posts=document.body.querySelectorAll('article')
        clearInterval(interval);
        resolve();
        return posts;

      }, 10);




    }).
    then())








    var postItems=[];    
    posts.forEach((item)=>{

        try{
          title=item.querySelector('h2').innerText;
          link=item.querySelector('a').href;
          summery=item.querySelector('p').innerText;
          postItems.push({
            'title': title,
            'links': link,
            'summery': summery
          })
        }catch(e){

        }
    })

    await ScrapModel.browser.close();

    //ScrapModel.preprocess();

    var news=new newsModel.NewsModel();
    news.setNewsData(postItems);
    console.log(postItems.length);

}


static preprocess()
{

    //adding website url to the links in which website url are missing
    ScrapModel.articles.forEach(element => {
          var link=element['links'];
          if(link!=null)
          {
            if(!link.includes('https'))
            {
              element['links']= ScrapModel.websiteURL+link;
            }
          }




    });

}

}
module.exports={
ScrapModel
}

'''

I am try to scrap all of the data of this site using above code.But I am getting undefined error on posts.foreach() line.Can anyone help me plzz :(

Bon Discaya
@bsdiscaya
Hi :)
whats a good dynamic nodejs + mysql or nosql web app project
Shekhar Ramola
@shekharramola

Hi guys, I have a set of products which I am trying to filter. I have a multi select dropdown through which user can select multiple filters. there is a group filter and if group filter is selected then it will select all the filters associated with that group filter.

Now the problem is I am trying to find the result of filterA(filterA1 OR filterA2..) AND filterB(filterB1 OR filterB2) AND filterC(filterC1 OR filterC2 OR filterC3..) and so on ..

I have a filterKey through which I will identify if they belongs to the same group.

my expected result was 2 filtered products since I have two products which have type gift card and region either France or Austria But my actual result which I got from my code is 3 filtered products.

I have tried to clone the scenerio in this plunker link here

https://jsfiddle.net/936knvux/41/

Eric
@calidion
import { Aex, Router, http } from "@aex/core";

class HelloAex {
  @http("*", "*")
  public all(_req: any, res: any, _scope: any) {
    res.end("Hello Aex!");
  }
}

const aex = new Aex();
const hello = new HelloAex();
aex
  .prepare()
  .start(8080)
  .then();
import { http } from "@aex/core";

class User {
  @http("get", ["/profile", "/home"])
  profile(req, res, scope) {}

  @http(["get", "post"], "/user/login")
  login(req, res, scope) {}

  @http("post", "/user/logout")
  logout(req, res, scope) {}
}