|
Thermopyle posted:If you use Jetbrains IDE's, they integrate spy.js. That was really cool, thanks for sharing!
|
# ? Sep 12, 2014 08:33 |
|
|
# ? May 16, 2024 17:18 |
|
0zzyRocks posted:That was really cool, thanks for sharing! It's worth noting that this works if you're using any (that I'm aware of) of their IDE's. So, for example, I use PyCharm, which lets me work on my backend code as well as frontend code in the same IDE and I can use spyjs on the JS frontend code. I know for a fact that this holds for IntelliJ & RubyMine. I'm sure it must be the same for others. Now, everything doesn't get updated at the exact same time across their IDE's. Like, I'm waiting on Facebooks React JSX to be supported. It will be implemented in WebStorm 9 first and then come to PyCharm thereafter. I haven't ever had to wait very long for a feature to make its way from one to the other, though.
|
# ? Sep 12, 2014 17:44 |
|
So I'm giving Node a try after making my first ever web app in Django, just for the sake of trying something new. I know all these JS dudes push nosql really hard but I'm just not that into it. How do people normally work with SQL in Node? I see a few ORMs around, but it is tough to get best practices on this stuff because it seems like the Node ecosystem is still really heavily in flux. So, assuming I'd like to work w/ Postgres, should I just manually write all of my SQL or is one of the ORMS (bookshelf, sequelize, etc) in a good state? I'm using express, if that matters in any way at all.
|
# ? Sep 14, 2014 04:58 |
|
peepsalot posted:Any tips, recommended reading, suggested tools to step up my profiling/optimization game? You could take a look at http://google.github.io/tracing-framework/index.html if Chrome's default dev tools aren't extensive enough. And if by "computationally expensive code" you mean numeric code rather than just currently slow code you might want to take a look at typed arrays.
|
# ? Sep 14, 2014 09:26 |
|
The Insect Court posted:You could take a look at http://google.github.io/tracing-framework/index.html if Chrome's default dev tools aren't extensive enough. Nice although appears nothing much more than a search front end to the existing chrome://tracing data. The biggest issue is usually the fault is with GC and there is nothing one can do with that outside of closed environments. There is command line flag to enable an API to manually initiate GC and you can custom build chrome to increase the frequency of GC.
|
# ? Sep 14, 2014 11:59 |
|
The March Hare posted:So I'm giving Node a try after making my first ever web app in Django, just for the sake of trying something new. I know all these JS dudes push nosql really hard but I'm just not that into it. How do people normally work with SQL in Node? I see a few ORMs around, but it is tough to get best practices on this stuff because it seems like the Node ecosystem is still really heavily in flux. So, assuming I'd like to work w/ Postgres, should I just manually write all of my SQL or is one of the ORMS (bookshelf, sequelize, etc) in a good state? I'm using express, if that matters in any way at all. I'm using Node with SQL Server and doing a mix of manually writing queries and calling stored procedures. There's also this but I'm not sure how stable it is yet and also not sure how tied to mysql (vs pgsql) it is.
|
# ? Sep 14, 2014 14:56 |
|
MrMoo posted:Nice although appears nothing much more than a search front end to the existing chrome://tracing data. The biggest issue is usually the fault is with GC and there is nothing one can do with that outside of closed environments. There is command line flag to enable an API to manually initiate GC and you can custom build chrome to increase the frequency of GC. GC will make things stutter, but shouldn't hurt throughput that much unless you're triggering full collections all the time via huge numbers of allocations (and you have a huge live graph). If that's the case, then doing your own object pooling can help, but can be pretty complex.
|
# ? Sep 14, 2014 21:08 |
|
Is there any way of an img tag with a src attribute coming into existence without the browser immediately downloading the image? I've tried document.createElement('img') and then setting the src attribute, without first adding the img tag to the DOM tree. I also tried creating a DocumentFragment, appending a div into it and then setting the div's innerHTML to an img tag. Both methods immediately send a request to the host and downloaded the image. I want to replace the images on some image-heavy pages with links, using greasemonkey, but that is pointless if the images start to download regardless of if they're ever visible, or even part of the DOM tree. I'm not going to make an HTML parser in Javascript just to do it.
|
# ? Sep 16, 2014 12:54 |
|
You could just not make an img tag with a src attribute until you actually want the browser to start loading whatever src points to.
|
# ? Sep 16, 2014 15:46 |
|
I think he's dealing with an existing page. If you fire at document.ready then most images will still be queued, so you can swap out their src before they start clogging the network. There's a disabled thing in Awful.app's post view that does something similar, if you want to dig into that source a bit.
|
# ? Sep 16, 2014 15:50 |
|
Wheany posted:Is there any way of an img tag with a src attribute coming into existence without the browser immediately downloading the image? No, but you can catch document.ready and call window.stop, which will stop page subresources from loading if they haven't already. edit: Setting src to about :blank gives a broken image icon(as least in the version of Chrome I'm using). The best solution is probably using a data URI, a quick search indicates that "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" is a 1 pixel transparent gif, which seems to work for me. The Insect Court fucked around with this message at 02:36 on Sep 17, 2014 |
# ? Sep 16, 2014 23:06 |
|
The Insect Court posted:No, but you can catch document.ready and call window.stop, which will stop page subresources from loading if they haven't already. That's a good way to gently caress up your deferred script loading. Just walk the collection of image tags and remove their sources or set them to about :blank or a placeholder, don't mess with the rest of the connection state.
|
# ? Sep 17, 2014 00:01 |
|
Subjunctive posted:That's a good way to gently caress up your deferred script loading. Just walk the collection of image tags and remove their sources or set them to about :blank or a placeholder, don't mess with the rest of the connection state. From what I can tell, once an image has been queued for downloading, it cannot be unqueued, so changing the src attributes is useless if the intention is never to download the images, or only download a certain subset of them.
|
# ? Sep 17, 2014 04:25 |
|
Wheany posted:From what I can tell, once an image has been queued for downloading, it cannot be unqueued, so changing the src attributes is useless if the intention is never to download the images, or only download a certain subset of them. You can stop an image (or anything else) download by doing something like: code:
|
# ? Sep 17, 2014 04:43 |
|
Bruegels Fuckbooks posted:You can stop an image (or anything else) download by doing something like: This is exactly what was suggested 3 posts up (and what Subjunctive was responding to).
|
# ? Sep 17, 2014 08:21 |
|
Hmm, since I would be receiving HTML with Xmlhttprequest, I guess I could just replace img src with img data-src or something before using innerhtml to create a DOM tree, then set the src attribute only on the images I actually want loaded.
|
# ? Sep 17, 2014 08:54 |
Wheany posted:Hmm, since I would be receiving HTML with Xmlhttprequest, I guess I could just replace img src with img data-src or something before using innerhtml to create a DOM tree, then set the src attribute only on the images I actually want loaded. I've done this, it worked out pretty well
|
|
# ? Sep 17, 2014 10:17 |
|
Is there some animosity/drama between Lo-Dash and Underscore.js? Lo-Dash's website seems like it's taking swipes at Underscore.
|
# ? Sep 18, 2014 09:15 |
|
jdalton, the main contributor to lodash (creator?) opens a shitload of issues on underscores repo, but has almost no commits there. Go on the open issue list and cmd-F his name. poo poo like this
|
# ? Sep 18, 2014 16:46 |
|
The whole point of lodash is to be underscore but better, so I'm not sure what could be surprising about the website focusing on how it's better than underscore.
|
# ? Sep 18, 2014 17:07 |
|
JDalton stated in a video that basically he submitted a PR for Underscore aiming to improve cross-browser compatibility, which got merged and then reverted because of concerns regarding file size. He then decided to go ahead and fork Underscore, make sure it would behave properly from a browser to another AND add the custom build feature which would address the file size issues.
|
# ? Sep 18, 2014 17:11 |
Skiant posted:JDalton stated in a video that basically he submitted a PR for Underscore aiming to improve cross-browser compatibility, which got merged and then reverted because of concerns regarding file size. https://github.com/jashkenas/underscore/commit/4e4bc194c0a0e06aa8f7633695ad10030d871a2b comments here im with jdalton on this one
|
|
# ? Sep 18, 2014 17:51 |
down with slavery posted:https://github.com/jashkenas/underscore/commit/4e4bc194c0a0e06aa8f7633695ad10030d871a2b comments here drat, jashkenas acts like a child in that thread. I mean, who "bans" someone who is actively trying to help?
|
|
# ? Sep 18, 2014 18:03 |
|
down with slavery posted:https://github.com/jashkenas/underscore/commit/4e4bc194c0a0e06aa8f7633695ad10030d871a2b Oh.
|
# ? Sep 18, 2014 18:22 |
|
The concern isn't about file size (although they do mention it), it is more because jashkenas does not believe that sparse arrays will ever be used, and therefore its okay to break that part of JS for a miniscule speed boost. jdalton's counter is that the way underscore is written makes it slow and that accounting for sparse arrays 1) keeps compatibility and 2) not that bad to check. The tickets I've submitted for jashkenas related projects are always a pain. For one, he thinks its fine to spit out rewritten tokens in the lexer (instead of you know in the rewriter) for CoffeeScript. So you're not guaranteed that the position of the code you've written in CoffeeScript will be represented the same internally. This doesn't matter to 99% of the people who don't care as long as the output is correct javascript, but it causes headaches for the remaining 1% who need CoffeeScript's parser/lexer to be accurate. Then there was the whole semver brouhaha.
|
# ? Sep 18, 2014 18:24 |
|
Speaking as someone who broke them in various ways a couple of times, sparse arrays happen. Combining reduce and reduceRight is dumb.
|
# ? Sep 18, 2014 18:26 |
|
I sometimes wish that jashkenas was the sort of person to get bored with projects and move on to other things once other people are contributing. He has a pretty solid track record at creating useful new things, but is much worse as a maintainer of things people depend on.
|
# ? Sep 18, 2014 19:07 |
|
Plorkyeran posted:I sometimes wish that jashkenas was the sort of person to get bored with projects and move on to other things once other people are contributing. He has a pretty solid track record at creating useful new things, but is much worse as a maintainer of things people depend on. Honestly, this is about 80% of devs I work with. Creating a brand new thing that solves an unsolved problem is fun and cool. Responding to bug reports and requests for minor tweaks is boring and people complaining about your unique vision. Guys like that see themselves as visionaries and creators and if anyone has a problem with what they've made (even if that problem is "it doesn't work right"), it's because they just don't understand how brilliant your code is.
|
# ? Sep 19, 2014 18:27 |
|
LeftistMuslimObama posted:Honestly, this is about 80% of devs I work with. Creating a brand new thing that solves an unsolved problem is fun and cool. Responding to bug reports and requests for minor tweaks is boring and people complaining about your unique vision. Guys like that see themselves as visionaries and creators and if anyone has a problem with what they've made (even if that problem is "it doesn't work right"), it's because they just don't understand how brilliant your code is. That sounds exactly like the two assholes that got fired a few months ago when I could demonstrate to the boss how using an open-source framework like Angular could be an improvement over their own home-made thing.
|
# ? Sep 21, 2014 12:36 |
|
Any knockout gurus in the house? I am having no luck getting a simple computed observable to work. I've got a table bound to a VM, and within that chunk, I'm trying to use a computed observable.code:
code:
code:
edit: the answer turned out to be moving the ko.computed from the ViewModel to the object. That way, I can access the object's properties and do the dumb logic crap that I need. I have no idea why most of the knockout documentation seems to suggest putting ko.computed methods in the ViewModel. My Rhythmic Crotch fucked around with this message at 17:00 on Sep 23, 2014 |
# ? Sep 23, 2014 05:59 |
|
Question: is there a way to reload files from within JS? As in, one script finds that another file is too old, and sends back to the server for an updated version of that script. The files are all external, but semantic versioning is not an option, the old and new files must have the same filename. I suspect that either there's a simple one-line solution, or it's impossible. Not my idea, but I don't understand the problem well enough to tell my boss his idea is impossible.
|
# ? Sep 24, 2014 21:09 |
|
darthbob88 posted:Question: is there a way to reload files from within JS? As in, one script finds that another file is too old, and sends back to the server for an updated version of that script. The files are all external, but semantic versioning is not an option, the old and new files must have the same filename. I suspect that either there's a simple one-line solution, or it's impossible. Maybe with some fuckery like this: JavaScript code:
|
# ? Sep 24, 2014 21:16 |
|
Wheany posted:Maybe with some fuckery like this: Yeah, something like this should work. You'll want to make sure you are handling "unloading" the old script (unhooking events, stopping timers, etc...) though.
|
# ? Sep 24, 2014 21:43 |
|
necrotic posted:Yeah, something like this should work. You'll want to make sure you are handling "unloading" the old script (unhooking events, stopping timers, etc...) though. That was the second or third best possible solution I could come up with apart from "don't do it, it'll all end in tears". I can probably integrate it with the existing file loading methods, and assuming things go the way I expect them to, any file reloading should come before event hooking and timers.
|
# ? Sep 25, 2014 01:02 |
|
darthbob88 posted:Question: is there a way to reload files from within JS? As in, one script finds that another file is too old, and sends back to the server for an updated version of that script. The files are all external, but semantic versioning is not an option, the old and new files must have the same filename. I suspect that either there's a simple one-line solution, or it's impossible. This sounds like exactly the sort of thing you should be handling at the HTTP layer which already has cache control mechanisms. Of course, HTTP automatically handles cached resources to see if a new version of a resource needs to be fetched, so I'm not quite certain what you're trying to accomplish here. If the idea is to fetch a resource from server A, but ignore it if it's too old and instead fetch resource from server B, the obvious question is why not just fetch the resource from server B in the first place. If you really have to do it in Javascript, then I'd say construct a GET request with the If-Modified-Since header set to the appropriate time, and check to see if you get a 304 back. If the idea is to update, without page reload, a script file used on a SPA when a newer version becomes available on the server then that sounds like a disaster in the making. The Insect Court fucked around with this message at 00:21 on Sep 30, 2014 |
# ? Sep 30, 2014 00:19 |
|
The Insect Court posted:This sounds like exactly the sort of thing you should be handling at the HTTP layer which already has cache control mechanisms. Of course, HTTP automatically handles cached resources to see if a new version of a resource needs to be fetched, so I'm not quite certain what you're trying to accomplish here. If the idea is to fetch a resource from server A, but ignore it if it's too old and instead fetch resource from server B, the obvious question is why not just fetch the resource from server B in the first place. If you really have to do it in Javascript, then I'd say construct a GET request with the If-Modified-Since header set to the appropriate time, and check to see if you get a 304 back. I don't entirely understand it either; it's my boss's idea, and he also doesn't understand enough JS to know why it's impossible. It's actually not just age, it's more like "in response to certain conditions, which will change by the time I actually implement them, and which will also probably include a flag in the script loaded from server A, be prepared to replace those files with ones from server B". So just relying on HTTP's built-in caching won't help, but Wheany's solution would probably do the trick. I would appreciate some elaboration on how exactly this is going to turn out badly, if only so I can explain to my boss why this is the worst idea since Sriracha-brand sex lube.
|
# ? Sep 30, 2014 22:27 |
|
darthbob88 posted:"in response to certain conditions, which will change by the time I actually implement them, and which will also probably include a flag in the script loaded from server A, be prepared to replace those files with ones from server B". Your description is too vague to really say anything. What files? What do they do? Just replacing an image with another is no big deal. Replacing a bit of Javascript could be a big deal, depending on what it does. If it is just a simple one-off script that runs without context and doesn't have side-effects, replacing it won't be a problem. If a script creates global variables or registers event handlers, cleaning those up before replacing the script can be a pain in the rear end. If you have no idea what I'm talking about, it will be a pain in the rear end.
|
# ? Oct 1, 2014 06:03 |
|
You already answered my question above, but the resources I need are two JS files, and if things work the way I think they will, the files would be replaced before they could create any event handlers. So, shouldn't be a problem, assuming I understand what the boss wants. If it does turn out to be a problem, I'll just bounce it back to him.
|
# ? Oct 1, 2014 09:01 |
|
So, browser downloads old JS file by making an HTTP request, the JS file itself checks if it's the newest version, and if not... downloads a new JS file by making an HTTP request? Why not just provide the new JS file in step 1?
|
# ? Oct 1, 2014 14:15 |
|
|
# ? May 16, 2024 17:18 |
|
nevermind. ios webview issue
DholmbladRU fucked around with this message at 20:30 on Oct 1, 2014 |
# ? Oct 1, 2014 19:27 |