|
I don't see any element with the ID "leftSide". I only see an element with a class of "leftSide". You either need to add an ID or use document.querySelector(".leftSide")
|
# ? Feb 4, 2016 17:21 |
|
|
# ? May 15, 2024 16:44 |
|
Suspicious Dish posted:I don't see any element with the ID "leftSide". I only see an element with a class of "leftSide". You either need to add an ID or use document.querySelector(".leftSide") Doh! Thank you so much, that makes perfect sense. I'm completely new to javascript and I really appreciate your help. ModeSix fucked around with this message at 17:25 on Feb 4, 2016 |
# ? Feb 4, 2016 17:22 |
|
ModeSix posted:Doh! Thank you so much, that makes perfect sense. I am pretty new to js (and coding) and I run into problems like this all the time. One of the easiest ways to check what's going on in this situation is to call console.log(); on anything/everything involved in creating that variable so's you know where in the chain you're slipping up.
|
# ? Feb 4, 2016 17:31 |
|
Well you have class="leftSide" but you're searching for ID, so probably change that. e: dang you guys work fast
|
# ? Feb 4, 2016 17:31 |
|
ModeSix posted:Doh! Thank you so much, that makes perfect sense. Just to clarify in case it isn't obvious, since getElementById couldn't find the element it returned null, and that caused your error later when you tried to call appendChild on it. Also since you're new to javascript, I strongly recommend you put "use strict"; at the beginning of your scripts. While it wouldn't have helped you out here, strict mode makes many common bugs easier to track down.
|
# ? Feb 4, 2016 17:46 |
|
ModeSix posted:So I am doing an online course learning javascript, and one of the assignments is using DOM to add elements to a page.
|
# ? Feb 4, 2016 18:01 |
|
Obliterati posted:I am pretty new to js (and coding) and I run into problems like this all the time. One of the easiest ways to check what's going on in this situation is to call console.log(); on anything/everything involved in creating that variable so's you know where in the chain you're slipping up. Sometimes, yes. But since the developer tools are already open, I would put a breakpoint there and just step through the code. In a loop it's a pain in the rear end, but in a simple case like that, it is very useful.
|
# ? Feb 4, 2016 18:13 |
|
Wheany posted:In a loop it's a pain in the rear end
|
# ? Feb 4, 2016 18:36 |
|
Vulture Culture posted:Other people have already answered this, but in general, JSFiddle or Plunker or Codepen are a better place to put your JS code samples when you're asking for help because people can play with them right there without any extra work Thanks, these will be infinitely useful.
|
# ? Feb 4, 2016 23:38 |
|
So I've got a site that's got an intermittent issue - scrolling gets disabled by a piece of javascript adding "overflow: hidden;" to the body in a style attribute. Unfortunately, the code base is huge, and we have a dozen+ third party scripts coming in. (It's a nightmare.) Does anyone have a way, purely programmatically, that I could monitor a node and note the file and line number (or even just the code or function name) that's modifying it? MutationObservers can watch, but they don't seem to be able to identify the function that actually changed it. I know I can do this with DOM breakpoints locally, but I'm having trouble reproducing it myself locally, so I'd rather have something I can put out and get reports back on.
|
# ? Feb 8, 2016 17:34 |
|
EVGA Longoria posted:So I've got a site that's got an intermittent issue - scrolling gets disabled by a piece of javascript adding "overflow: hidden;" to the body in a style attribute. Unfortunately, the code base is huge, and we have a dozen+ third party scripts coming in. (It's a nightmare.) Could you use Chrome Dev Tools 'Break on..' on the body? I think this breaks on the line of code causing the issue. It should be highlighted in the Sources tab.
|
# ? Feb 8, 2016 19:42 |
|
Heskie posted:Could you use Chrome Dev Tools 'Break on..' on the body? Unfortunately, that then requires me to be able to reproduce it locally. It's an intermittent/rare issue, and I've yet to reproduce it myself. I'm toying with the idea of using a phantomjs script to do reload the pages a few thousand times with a breakpoint until I can reproduce it, but I'm holding out hope there's something I can hook into.
|
# ? Feb 8, 2016 21:06 |
|
EVGA Longoria posted:Unfortunately, that then requires me to be able to reproduce it locally. It's an intermittent/rare issue, and I've yet to reproduce it myself. Are you sure it's a random fluke from your code, or is it possibly environmental?
|
# ? Feb 8, 2016 21:11 |
|
Skandranon posted:Are you sure it's a random fluke from your code, or is it possibly environmental? Doubt it's environmental - we have seen it with pretty much every browser/os combo under the sun. The problem is it's mostly coming through from feedback left by users, so we're not sure exactly how often it's happening. It's also on our legacy platform, so people have been reluctant to actually add real tracking on the issue. I'm going to look into setting up a mutation tracker that can report when it occurs for us to get a true idea of how often it happens - but while I'm doing that, I figured I'd try to find something that could solve the issue. Since breaking on dom manipulation is possible, I was hoping there was a simple bit of code I could put out there that would at least give me a trace of modifying code.
|
# ? Feb 8, 2016 23:24 |
|
You can get a stack trace programmatically by calling Error().stack, but I assume a mutation tracker runs asynchronously to the actual mutation code.
|
# ? Feb 8, 2016 23:50 |
|
Is there a way to remove all event listeners from a page using the console? Specifically I'm thinking of lovely streaming sites that are filled with all kinds of onclick bullshit.
|
# ? Feb 9, 2016 04:10 |
|
Sedro posted:You can get a stack trace programmatically by calling Error().stack, but I assume a mutation tracker runs asynchronously to the actual mutation code. code:
Oh well, was a long shot. Thanks for the help.
|
# ? Feb 9, 2016 15:47 |
|
Sorry if this is super-obvious but have you used Chrome/FF dev tools to do a global search through loaded JS files for the string 'body'?
|
# ? Feb 9, 2016 16:09 |
|
Vulture Culture posted:Sorry if this is super-obvious but have you used Chrome/FF dev tools to do a global search through loaded JS files for the string 'body'? I've tried, but the problem comes in that there's 94 line results in the JS for 'body' on any given page, at a minimum, and most of that is 3rd party code that's coming through minified. I'm kind of bashing my head against it, but I'm not making headway.
|
# ? Feb 9, 2016 16:36 |
|
EVGA Longoria posted:I've tried, but the problem comes in that there's 94 line results in the JS for 'body' on any given page, at a minimum, and most of that is 3rd party code that's coming through minified. I'm kind of bashing my head against it, but I'm not making headway. Enable pretty printing Firefox, lower left corner Chrome, middle-ish of the window, lower left corner of the source view (e: actually, that depends on whether you have the console visible in the debugger and how high it is)
|
# ? Feb 9, 2016 18:41 |
|
Wheany posted:Enable pretty printing Cripies, that's the least discoverable option I've ever seen. Thank you for pointing it out.
|
# ? Feb 9, 2016 19:37 |
|
So what's the best way to extract binary data from XML and pass it on to an API? My application is basically functioning as a bridge between two APIs, I make a call to the first, and the response is along these lines: code:
I need to pull the contents of the data element and then pass it along to the email manager API, which will include it as an attachment. E: I figured it out. I was having issues because the base64 string I was pulling out was too big for the default limit for my other API. Increased the parser size limit and worked like a charm aBagorn fucked around with this message at 21:22 on Feb 14, 2016 |
# ? Feb 12, 2016 23:44 |
|
I'm making multiple API calls inside of a Promise.all (thank you bluebird). Currently I'm saving the response objects to separate JSON files. I need to clean up the data some before it's ready for postgres. It feels really dumb and bulky to write to the separate JSON files with FS, only to turn around and gently caress with them immediately after. Is there a node module or best practice that would allow me to perform simple filter/maps operations on the response objects I get back as I get them so I can skip the writing with FileSystem step? I mean I guess I could just try to parse it inside of the promise but it seems messy.
|
# ? Feb 15, 2016 01:04 |
|
Raskolnikov2089 posted:I'm making multiple API calls inside of a Promise.all (thank you bluebird). Currently I'm saving the response objects to separate JSON files. I need to clean up the data some before it's ready for postgres. It feels really dumb and bulky to write to the separate JSON files with FS, only to turn around and gently caress with them immediately after. I wouldn't process them inline, but you can easily break the processing out to a separate function. You can also have the promises aggregated by bluebird broken out to separate functions to further make things pretty. There isn't really any other way to do what you want, any node module you could be imagining is just going to provide wrappers that essentially process the data in the promises.
|
# ? Feb 15, 2016 01:31 |
|
Skandranon posted:I wouldn't process them inline, but you can easily break the processing out to a separate function. You can also have the promises aggregated by bluebird broken out to separate functions to further make things pretty. There isn't really any other way to do what you want, any node module you could be imagining is just going to provide wrappers that essentially process the data in the promises. I made a small website parser that demonstrates this functionality. What you want to look at is getStory in fictionpress-scraper.js.
|
# ? Feb 15, 2016 02:01 |
|
Skandranon posted:I wouldn't process them inline, but you can easily break the processing out to a separate function. You can also have the promises aggregated by bluebird broken out to separate functions to further make things pretty. There isn't really any other way to do what you want, any node module you could be imagining is just going to provide wrappers that essentially process the data in the promises. The more experience I get with back-end, the more I realize how inelegant and ugly it all is. It's kind of reassuring in a way. I keep feeling like my approach is super hacky and amateurish and then I see other implementations and realize I wasn't far off the mark.
|
# ? Feb 15, 2016 20:40 |
|
Working with API rate limits, is wrapping my requests in a setTimeout a bad way to go about it?
|
# ? Feb 19, 2016 04:13 |
|
Raskolnikov2089 posted:Working with API rate limits, is wrapping my requests in a setTimeout a bad way to go about it? Depends how you are doing it? It doesn't magically solve your problems, it depends how you are using them.
|
# ? Feb 19, 2016 04:22 |
|
Raskolnikov2089 posted:Working with API rate limits, is wrapping my requests in a setTimeout a bad way to go about it? Not many APIs available, one can add requestIdleCallback to better integrate with animation if you are not calling in a service worker.
|
# ? Feb 19, 2016 15:21 |
|
Angular is a whore. So I am trying to do form validation and take the form data and use push() to an array. It appears to work fine, but two problems. 1) The form doesn't get cleared (this isn't really important yet so I'm not even going to focus on it in this question) 2) When I hit submit it appears to append the data to the array, because it can be sorted, filtered etc. But if I modify what is in the form, it changes the data in the array. I tried to set up a jsfiddle but I really don't get it, so here's my HTML. http://pastebin.com/c4N6s0xh Now here's the script. http://pastebin.com/gC4KRSRg The console log shows the form data correctly, and it actually moves the data up into the array (or so it appears). If I modify any data that is in the form the corresponding array data is changed for the new entry. I also cannot submit a second additional entry, just one submission and that's it. I really am stumped because this should work based off of everything I've read.
|
# ? Feb 19, 2016 16:11 |
|
You have to reset the model of the newcomment object after the submit, like so:code:
See my changes here: http://codepen.io/jowang/pen/jWoKPm?editors=1111 I believe in JSFiddle you have to bootstrap the Angular app to get it to work: https://docs.angularjs.org/guide/bootstrap IronDoge fucked around with this message at 16:57 on Feb 19, 2016 |
# ? Feb 19, 2016 16:39 |
|
IronDoge posted:I believe in JSFiddle you have to bootstrap the Angular app to get it to work: Nah, you just have to set Load Type to nowrap https://jsfiddle.net/v1adfpj1/
|
# ? Feb 19, 2016 17:38 |
|
IronDoge posted:You have to reset the model of the newcomment object after the submit, like so: Oh wow, thank you so much! I was originally trying to do what you've shown me, but I couldn't figure out the syntax for it, but now that I see what you've written it's really clear and makes a lot of sense. Also, thanks for showing me codepen, seems more intuitive than jsfiddle. ModeSix fucked around with this message at 17:43 on Feb 19, 2016 |
# ? Feb 19, 2016 17:38 |
|
Edit nevermind but I do have anohter question. I am using node to spawn a child process that is creating an ssh tunnel. However it needs a password (no keys cannot be used in this system). How do I tell node to supply ssh with a password (since there is no additonal command line parameters for passing a password), and I cannot get any additional packages like sshpass. Knifegrab fucked around with this message at 03:35 on Feb 25, 2016 |
# ? Feb 25, 2016 00:23 |
|
Knifegrab posted:Edit nevermind but I do have anohter question. You would have to re-implement what SSHPass does: "Sshpass utilizes the pty(7) interface to control the TTY for ssh" There is no other way.
|
# ? Feb 25, 2016 21:34 |
|
Why the OpenSSH guys don't bother creating a usable SSH library, I don't know.
|
# ? Feb 25, 2016 22:46 |
|
Suspicious Dish posted:Why the OpenSSH guys don't bother creating a usable SSH library, I don't know. Well, it turns out that may have been a very good thing.
|
# ? Feb 26, 2016 00:09 |
|
MALE SHOEGAZE posted:Well, it turns out that may have been a very good thing. why
|
# ? Feb 26, 2016 04:26 |
|
http://heartbleed.com/
|
# ? Feb 27, 2016 06:38 |
|
|
# ? May 15, 2024 16:44 |
|
what does an unrelated library have to do with anything
|
# ? Feb 27, 2016 06:43 |