|
Knifegrab posted:"rows" in this case can be called anything correct? So the value of rows is determined as what would normally be the result var in callback(result,[err]) that makeNodeResolver takes over correct? Yes, "rows" is just the name of your argument for that function. It can be "iDontGetThisShit" if you want. Also yes to your second question.
|
# ¿ Aug 10, 2015 21:34 |
|
|
# ¿ May 16, 2024 20:39 |
|
Knifegrab posted:Can you expand on this, I don't completely understand what you are saying. JSX is "compiled" into raw-JS like so: code:
|
# ¿ Aug 17, 2015 21:03 |
|
Knifegrab posted:Can you expand on hot reloading, and pretend I am a complete moron (I am). Hot reloading will watch for changes to your JS files and automatically inject the new script into your browser page on the fly. No reload is necessary and you see changes immediately. It's pretty spectacular, but took me some effort to get it working the first couple of times.
|
# ¿ Sep 16, 2015 21:46 |
|
Knifegrab posted:
Node has an HTTP server built-in. There are libraries built on top of it (such as express) to simply routing and middleware. For production you still want something like nginx or apache as the front-end server that proxies to the node process, but for development it doesn't matter.
|
# ¿ Oct 14, 2015 16:23 |
|
Knifegrab posted:Ugh I am lost. When I want to run my test server I have to run my expressServer.js file using node. I am using a 1and1 host and its easy enough to upload a php structure and index.html, but I cannot figure out how to implement a node files on my webhost. I feel pretty dumb right now. Shared hosting will rarely support Node.js apps. Its possible, but not as simple as "upload this js file and it works!". http://stackoverflow.com/questions/17529613/why-node-js-cant-run-on-shared-hosting Heroku is relatively simple (for a non-shared platform): deploying is as simple as a git push, but does require some initial setup which the linked doc outlines.
|
# ¿ Oct 14, 2015 18:42 |
|
Knifegrab posted:I made a post in the web hosting thread, hopefully someone there can help me. I am assuming, when you say long-running application you mean the fact that my express server must be running indefinitely? Running the process indefinitely is literally the only way to use node for web work. As Vulture Culture said, you want to use a supervisor of some kind (systemd/upstart/sysv if you have access, but you can use a user land supervisor if you must) to auto-restart on crashes. Heroku handles this for you!
|
# ¿ Oct 14, 2015 18:53 |
|
Knifegrab posted:So as a follow up, do you work for Heroku? Just curious because you speak very highly of it, not to say it isn't a good service but I just wanted to check. I do not. I've used them a bit in the past, and for something like Node or Ruby they are probably the easiest to get up and running with. Their "Hobby" tier may work, but its not intended for that much traffic. Once you get off of shared hosting things start to get a bit pricier unless you manage everything yourself; which simply shifts the cost to time you spend instead of money you spend. Noam Chomsky posted:Is MongoDB pretty much a bad choice for ~99% of applications? Mongo has a terrible track record. If you want schema-less (which is not as useful as it sounds in most use cases) use Postgres with a JSON column, its highly performant (especially in 9.4+) and you still have all the goodies an RDBMS. edit: Check out the Jepsen review of Mongo. necrotic fucked around with this message at 20:05 on Oct 14, 2015 |
# ¿ Oct 14, 2015 20:03 |
|
kloa posted:I must be missing something, because I can't the following JSON result to output: Err, that doesn't look like valid JS or JSON. What's it supposed to do? Mustache probably does some magical handling of "fields" like that when rendering.
|
# ¿ Oct 20, 2015 17:55 |
|
IronDoge posted:Angular is a javascript framework for web apps. It's has a promise library built in and it is better than using pure jQuery for controlling the UI IMO. It's pretty nifty generating entire components of a page using a few lines of code. jQuery and Angular aren't even comparable. One is a library, with the original goal of making cross-browser JS consistent; Angular is an entire MVC framework.
|
# ¿ Oct 22, 2015 20:25 |
|
Knifegrab posted:I think I will definitely be pursuing React and react routing in my next step of development. Do it. React has been a pleasure to work with.
|
# ¿ Oct 22, 2015 20:51 |
|
Depressing Box posted:Would you still use let (instead of const) if the data isn't mutable? Is there a drawback, performance or otherwise, to using const? I use const for immutable data for clarity. When using Babel to transpile to ES5 the const check is handled while compiling, the actual output is a var (same with let); so for now I'd say there's no performance hit at all! I think its unlikely there would be any performance implications once its hit browsers and we stop transpiling.
|
# ¿ Oct 23, 2015 17:25 |
|
Depressing Box posted:Ah, I didn't realize the checks were just during compilation, that's cool. I wasn't 100% sure either. I find the online REPL useful for figuring out how Babel transpiles things.
|
# ¿ Oct 23, 2015 17:58 |
|
Depressing Box posted:That's pretty handy. Interestingly enough, it looks like Babel has an optional transformer (part of "High compliancy" mode in the REPL) that will add TDZ checks to the compiled code. That could be useful for development!
|
# ¿ Oct 23, 2015 20:11 |
|
Mr. Jive posted:Couldn't the emitter pass basically anything in there? How do I know that something usable is being passed? How does the emitter know that it needs to pass in the data it receives from the socket? How does the emitter know that a 'data' event means it should send something my code can broadcast? Is the event emitter passing a whole truckload of arguments but my code (as written) only cares about the first one? All of the parameters for each event will be documented. Because its JS the only "guarantee" you have on the arguments is the documentation (or reading the code lol).
|
# ¿ Nov 11, 2015 05:46 |
|
Mr. Jive posted:Thanks, this in particular helps. Correct. The format for their documentation of event callbacks is piss poor, but at least it exists I guess...
|
# ¿ Nov 14, 2015 16:02 |
|
That do/while loop doesn't look like it does anything except set some embedded data to the same value 10 times. If you want the difference between two Dates in days I'd use something like:code:
|
# ¿ Nov 18, 2015 20:23 |
|
Will that work with objects that are equivalent but not equal? His array has 2 objects that are duplicated, but that doesn't mean they're the same object.
|
# ¿ Dec 13, 2015 16:51 |
|
no_funeral posted:So far the list of possibilities include React, Reflux with Flux, and Knockout... I don't really have any criteria for what is best, other than ease of use, and performance(which is why I'm leaning towards React). Reflux is a Flux library that sits on top of React, its a way of managing global state at the top level of the React component hierarchy. The general trend seems to be heading towards Redux, which does better at enforcing immutable state. Flux is an Architecture, thats it (though Facebook did release a dispatcher when they described the Flux architecture). Redux is based on this architecture but takes it a step further. I've been very happy working with React + Redux, and while there's no "framework" really built around these libraries yet they are pleasant to work with and have a small enough surface area to piece together on your own.
|
# ¿ Dec 29, 2015 21:42 |
|
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 |
|
Promise.all still runs everything asynchronously doesn't it? It sounds like he wants one to complete before another starts, if I'm understanding his post.
|
# ¿ Mar 8, 2016 04:47 |
|
Skandranon posted:Yes, it does. That is usually how you would want to do things. You'll get your cards, then once all cards come back, you'll get your card details. Why would you want to get card1, then card2, then card3, etc? Are you wanting to simulate properly drawing cards from a deck? If so, I'd create a route that lets you "draw 3 cards", which will let the server properly handle pulling 3 cards from the deck, and then return all 3 at once. I'm not trying to do anything outside of read that guys post, which said Geno posted:I'm trying to figure out a way for the AJAX calls for the card info to only be created after the previous card's AJAX is fully done. For example, card 1 and 2 load but not the card info yet. I don't want the AJAX for card info 2 to be created until the AJAX for card info 1 to be fully done. My intent was to point out that Promise.all does not do what he asked, unless I misread his post (which I didn't).
|
# ¿ Mar 9, 2016 07:34 |
|
That's because its not sugar; The sugar for binding is {object}::{method} and is supposed to come out with ES2017. https://github.com/zenparsing/es-function-bind
|
# ¿ Apr 26, 2016 21:30 |
|
Munkeymon posted:I mean all the class ceremony. Making the language look more familiar to people used to non-prototypal inheritance doesn't do a ton of good if they're just going to run headlong into the prototype complications as soon as they try to do anything remotely interesting with their 'class' but at least now I understand what the bind operator is coming in to fix. Ah, yeah. There's going to be a lot of fun issues that pop up because people assume its not a typical class system. its almost like people should learn the language they use, no matter how piss poor it is.
|
# ¿ Apr 26, 2016 23:23 |
|
Skandranon posted:JavaScript is meant to have semicolons at the end of lines, it is just not strict about it. You should use them. Speaking of, you should 'use strict'; as well.
|
# ¿ May 17, 2016 19:39 |
|
edit: whoops, refreshed and there's more! Yeah, what Depressing Box just posted is the correct way. Your parent should never know about the children state, and vice versa. The idea is to make testing _easier_, not harder.
|
# ¿ Jun 23, 2016 22:47 |
|
Isn't the result of $.csv.toArrays(input) exactly what you want for studentData? I don't think you need to do anything else if you want it as an array of rows and each row is an array of columns.
|
# ¿ Jun 30, 2016 20:10 |
|
stoops posted:That worked, phew. THANK YOU! Yeah, CSV doesn't encode types so everything is a string. I'm surprised whatever graphing lib didn't handle the coercion for you, though the parseInt approach is definitely better. You can also use map so you don't have to loop yourself: code:
|
# ¿ Jun 30, 2016 21:37 |
|
Skandranon posted:Not sure about native ES6 support, but TypeScript turns it into a straight up for() loop without any closures at all when targetting ES5. Yeah, forEach is in most browsers now (all?) and writing a shim is super simple for older ones. If TypeScript is not hoisting the closure when transpiling thats loving dumb, though.
|
# ¿ Jul 11, 2016 18:30 |
|
Skandranon posted:How is that dumb? A closure is not needed, just like you do not need one for a for() loop. forEach takes an anonymous function. Is TypeScript transpiling forEach(function(e) { console.log(e) }) to: code:
code:
code:
However, the best is just to define a forEach shim and not transpile to ES5 at all.
|
# ¿ Jul 11, 2016 18:47 |
|
Skandranon posted:I was not talking about forEach. I was talking about the ES6 for...of(). It translates for...of to a for() loop. There are no closures because there are no passed functions, there is just inline code. My bad, I mixed it in with the forEach talk.
|
# ¿ Jul 11, 2016 20:22 |
|
Which ie? Does ie even support inline functions like that map call?
|
# ¿ Jul 20, 2016 16:24 |
|
Depressing Box posted:When would you want to use reduceRight() instead of reduce()? If you're doing a sum sure, but other mathematical operations would give you different values. Or as you mentioned, gross implicit conversions. Also, javascript has generators now for infinite lists. Though I'm not sure if you can use reduceRight on those? I haven't really touched generators. necrotic fucked around with this message at 21:36 on Jul 26, 2016 |
# ¿ Jul 26, 2016 21:33 |
|
You can also use the actual debugger and break at the entry point and really step through. If you wanted to break in the success callback you'd have to add another one there, too. You can break in code with debugger and the console open. Works pretty well.
|
# ¿ Aug 16, 2016 03:48 |
|
Agreeing with facts is a good way to get ahead in life.
|
# ¿ Aug 19, 2016 17:03 |
|
You can get buy writing a decent amount of modern JS without transpiling. One of the biggest things you'll lack is a proper module system, though. It's unlikely babel will get replaced, at least anytime soon. Hopefully they won't completely rewrite the core again.l and break everything. Lol who an I kidding of course they will.
|
# ¿ Oct 6, 2016 12:32 |
|
Skandranon posted:You can potentially cache 100s of mb if you want to (don't do this, you'll surely upset someone). The spec defines a (suggested) "arbitrary limit of 5 megabytes per origin", and most browsers default to around this. https://html.spec.whatwg.org/multipage/webstorage.html#disk-space-2 I think Opera and FF let users change this limit, but Chrome doesn't.
|
# ¿ Oct 9, 2016 05:37 |
|
Skandranon posted:I did not know this... and this is actually very consequential. Thanks! Imagine the poo poo show if there was no limit. Webdevs endlessly caching dumb data and never purging it, oh poo poo its using 5gb of my HDD for one website!
|
# ¿ Oct 9, 2016 06:46 |
|
That doesn't help if he wants the key enumerable when a value is present.
|
# ¿ Oct 19, 2016 04:14 |
|
Nothing exists in stdlib for that. I'm not familiar with any libraries that do that, but you either need one of those or write your own.
|
# ¿ Oct 23, 2016 03:18 |
|
|
# ¿ May 16, 2024 20:39 |
|
:not([data-expand]) :input? If the parent has the attribute then it needs to come first in the selector. edit: I didn't read the whole question and that probably won't do it either. With the layout you have you cannot really do that, as the "hearing" level is a parent of checkboxes B, C and D. You need to move that attribute so its only a parent to B, or introduce a new one. And then the selector needs to be something like [data-expand="hearing"] :input necrotic fucked around with this message at 17:05 on Nov 14, 2016 |
# ¿ Nov 14, 2016 17:01 |