Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 19 2021 12:31
    @texas2010 banned @therichaverma
  • Jun 19 2020 20:05
    @krisb1220 banned @Gastony
  • May 14 2020 22:39
    @bjorno43 banned @minitechtips_twitter
  • May 14 2020 22:38
    @bjorno43 banned @real-action
  • Feb 01 2020 00:26
    @bjorno43 banned @Ndoua
  • Jan 07 2020 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:32
    User @bjorno43 unbanned @linkin-park
  • Aug 17 2019 01:43
    @bjorno43 banned @linkin-park
  • Jun 20 2019 21:20
    @bjorno43 banned @shenerd140
  • May 10 2019 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 27 2019 19:47
    @mstellaluna banned @zhonghuacx
  • Apr 25 2019 17:12
    @mstellaluna banned @cmal
  • Jan 08 2019 22:00
    @mstellaluna banned @dertiuss323
  • Dec 15 2018 23:36
    @mstellaluna banned @18835579411
  • Dec 13 2018 23:57
    @mstellaluna banned @brandon6190
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:13
    User @bjorno43 unbanned @androuino
Evan Kalvis
@evan17gr
@proquibas so im confused what am i supposed to change?
proquibas
@proquibas
I mean the "var source = url + "lat=" +getLatitude + "&" + "lon=" + getLongitude;" in your code, maybe it's wrong
Evan Kalvis
@evan17gr
i dont see what could be wrong with it though tbh @proquibas
proquibas
@proquibas
@evan17gr honestly I don't know where is the problem, check it https://repl.it/@jtejedera/CriticalFortunateQuadrant
Evan Kalvis
@evan17gr
that's so weird
thanks for the help @proquibas
proquibas
@proquibas
I think that is something about the format of the "source" string, the error message is about the lat/lon format
Evan Kalvis
@evan17gr
@proquibas i ve tried changing the format
like putting lon first and then lat
but still the same thing
proquibas
@proquibas
did you tried to hardcode the values in the "source" string?
Evan Kalvis
@evan17gr
just to test whether the coordinates are working?
proquibas
@proquibas
yes
like I did in the repl.it
try to know the type of the values given in the getUserPosition function using console.log(typeof getLatitude);
Evan Kalvis
@evan17gr
image.png
i tried to hard code it and the same error
@proquibas
proquibas
@proquibas

@evan17gr try this one:
//variables
var getLongtitude;
var getLatitude;
var api;
var url = "https://fcc-weather-api.glitch.me/api/current?";

//ask for users permission
window.onload = function getUsersPosition(){
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(getLatitudeAndLongtitude);
}
else{
alert("Your browser doesn't support geolocation");
}
}

//get the user's longtitude and latitude
function getLatitudeAndLongtitude(position){
getLatitude = position.coords.latitude;
getLongtitude = position.coords.longitude;
api = url + "lat=" +getLatitude + "&" + "lon=" + getLongtitude;
getObjs();
}

//new xmlhttprequest
function getObjs(){
var req = new XMLHttpRequest();
req.open("GET", api,true);
req.onload = function(){
const getText = JSON.parse(req.responseText);
console.log(getText);
}
req.send();
}

image.png
Evan Kalvis
@evan17gr
@proquibas im not getting any response in the console
actually now its working
thank you
Evan Kalvis
@evan17gr
would you be able to explain what the problem was because I'm still not sure what i was doing wrong? @proquibas
proquibas
@proquibas
@evan17gr your code is executing the http request before the user accept the popup, so you are sending "undefined" long/lat to the weather api
Evan Kalvis
@evan17gr
oh okay thank you now it makes sense @proquibas
proquibas
@proquibas
be welcome!
Caleb David
@microworlds
Hello guys, I have been getting a mongoose error "Can't save() doc multiple times". I posted the question on stackoverflow. Any assistance would be appreciated, thank you. Here's the link: https://stackoverflow.com/questions/61607900/updating-a-user-concurrently-in-mongoose-using-model-save-throws-error
linkin-park
@linkin-park
unable to start nodemon via npm run dev
linkin-park
@linkin-park
node v12.13.0
npm version 6.13.1
package.json https://pastebin.com/Crcm0Y53
gives
sh: 1: nodemon: not found :(
Kris Baillargeon
@krisb1220
@linkin-park did you run npm update ?
@linkin-park Sometimes I have to install a module multiple times before it takes
I haven't tested it yet, but I believe it's because I never included the --save flag
Jason Luboff
@JLuboff
You don't need the --save flag, just running npm i module_Name will add it as a dependency. Generally though, one would use nodemon as a global dependency instead of a local/dev dependency
linkin-park
@linkin-park
Well it fails to do PATH hook , just checked the PATH env. (ill write a bash hook for this now :( )
The node_modules/.bin/ hook is not been added to PATH (as mentioned in the man page).
Using Ubuntu 16.04 LTS.
Will also do npm update as mentioned by @krisb1220
still the same after npm update
Kris Baillargeon
@krisb1220
@linkin-park try this
sudo npm install -g --force nodemon
wait
you tried to start it using npm run dev ?
why not nodemon myServer.js ?
I've never used anything else besides that command to interact with Nodemon
linkin-park
@linkin-park
Don't do global install.
Make it local and Dev-dependency aka --save-dev and try @krisb1220
Kris Baillargeon
@krisb1220
@linkin-park I run on windows
I've never had a problem :P
instead of doing --save-dev try using --only=dev
--dev and --save dev were being deprecated -- that might be the issue
What error are you gettig @linkin-park ?
When I tried running npm run dev it threw an error