|
Skandranon posted:I'd break everything down into smaller parts until the 'super controller' had no actual code left in it. This is really want I want to do. It's just not the easiest to sell in corporate environment because "everything works". My opinion (and agreed upon) is that the current implementation is completely wrong. Everything they did was in an init or return block that was just a clusterfuck.
|
# ? Oct 7, 2015 04:15 |
|
|
# ? Jun 13, 2024 06:02 |
|
I know IŽḿ a javascript idiot but how exactly does if (myVariable) { } evaluate for non-booleans? for null, empty string, undefined, int = 0, etc
|
# ? Oct 8, 2015 17:19 |
|
Withnail posted:I know IŽḿ a javascript idiot but how exactly does Here's a MDN article on falsy values in js: https://developer.mozilla.org/en-US/docs/Glossary/Falsy It explains it better than I would, so read that.
|
# ? Oct 8, 2015 17:38 |
|
Perfect thanks
|
# ? Oct 8, 2015 17:48 |
|
Knockout question: How should I display hierarchical data? I'm trying to put up a catalog of my music, sorted by artist/album/file. I can display the artist name just fine, but showing a list of their albums is proving difficult. I suppose I can just do a list of artists that, when clicked, sends an AJAX call for a list of their albums, but I'd rather at least find out what's going wrong here. HTML: code:
code:
code:
darthbob88 fucked around with this message at 19:08 on Oct 11, 2015 |
# ? Oct 11, 2015 19:05 |
|
Node development question. In the past on my home (Windows) machine I have utilized XAMPP and just done PHP style websites. For work now I am writing in Node and I absolutely love it, but I am writing in a very specific parallels enviornment for product deployment on its own linux OS. However I am curious about two things, what would be the best place to go for hosting a website that uses a node backend? And is there anything equivalent to xamp but for node, something easy to setup on my windows machine which would let me start prototyping stuff with ease? edit: Nevermind, I can see that setting up node is quite easy for windows, but I still am curious about where to go for web server stuff. Also should I stick to v0.12 or should I bite the bullet and go V4.2? Knifegrab fucked around with this message at 00:52 on Oct 14, 2015 |
# ? Oct 14, 2015 00:48 |
|
Knifegrab posted:edit: Nevermind, I can see that setting up node is quite easy for windows, but I still am curious about where to go for web server stuff. Also should I stick to v0.12 or should I bite the bullet and go V4.2? I've never used PHP/XAMPP so I'm not sure exactly what you're looking for. As for Node versions, 90% of the stuff I use doesn't have support for 4.xx yet. But for the discerning gentleman or lady interested in experiencing all life has to offer might I suggest: https://github.com/OiNutter/nodenv
|
# ? Oct 14, 2015 02:39 |
|
Knifegrab posted:edit: Nevermind, I can see that setting up node is quite easy for windows, but I still am curious about where to go for web server stuff. Also should I stick to v0.12 or should I bite the bullet and go V4.2? I switched from v0.10.x to v4.x the other week and nothing broke, you should be fine.
|
# ? Oct 14, 2015 16:23 |
|
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 |
|
three posted:So wasn't sure whether to put this in this thread or the Web Dev thread (which seems to be mostly JS), but... I've been trying to learn JavaScript, and I have a few thoughts. Was hoping to bounce them off you JS Gurus. 1. Yes and no they often seek to stream line the development process and get through the hurdles of developing large applications on the client side. 2. I dislike JSX from years and years working with jsp's but some people seem to really like it, the cool thing about react is that it doesnt force either on you and both are equally viable either js or jsx. 3. People love mongo because its a database that uses json so it meshes incredibly well with javascript and i highly recommend it for learning how to make apps. Do not however use it for anything production or if you care about the integrity of the data. 4. Express is a framework for building api's so you will only see tutorials for creating api's. express is a framework for node enhancing node's normal operations to allow for easy creation of api's. 5. Atom was terrible for a long time but it seems more or less pretty ok now, sublime is still the king of the hill for text editing and webstorm if you want a more robust editor.
|
# ? Oct 14, 2015 16:27 |
|
Zasze posted:4. Express is a framework for building api's so you will only see tutorials for creating api's.
|
# ? Oct 14, 2015 17:16 |
|
necrotic 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. 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.
|
# ? Oct 14, 2015 17:55 |
|
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. It depends which service tier or whatever your 1and1 is on. Node.js also needs to be run as a self-serving long-running application or somehow has to be setup like PHP is with Apache. If you want help you'll have to figure out whether or not 1and1's hosting will allow you to run long-running node processes.
|
# ? Oct 14, 2015 18:11 |
|
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. Most shared hosts run Apache, not node. You need to use something else.
|
# ? Oct 14, 2015 18:24 |
|
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 |
|
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? Is there a better way to run a node server than that? In all my test development when I want to run my server I just do "node expressServer.js" and my express server starts listening on the appropriate port. However if anything goes wrong my expressServer crashes and exits, when I am in development obviously I can just restart the process but how the heck do I handle an exception like that when running production. Obviously proper error handling should prevent such a thing from happening but even best case scenario there is always something that could go wrong! edit: Thanks Heroku looks really cool, I will take a peak!
|
# ? Oct 14, 2015 18:45 |
|
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?
|
# ? Oct 14, 2015 18:51 |
|
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 |
|
necrotic posted: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! 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. Also Heroku seems very cool but I am worried about pricing/performance. I pay very little for my current hosting (less than a hundred a year), my current project gets about 100,000 visits a month and the servers hold up just fine, never have any loss of perforamnce or anything. However with Heroku it seems like their base minimum plan, which would still cost me well over a hundred a year, isn't that great. Downtime on my Database every month, and what seems like a very limited number of works. And to just get a database that does not have downtime, I would have to pay an extra 50 a month, which is very excessive. Maybe I am misunderstanding but would Heroku's "Hobby" level tier even perform for 100k visits a month?
|
# ? Oct 14, 2015 18:59 |
|
Is MongoDB pretty much a bad choice for ~99% of applications? I'm trying to decide between MEAN or Rails for tabletop gaming app I'm building. It'll probably be high-write/read, if that makes a difference. I am leaning towards ActiveRecord (Rails) and PostgreSQL but I am kind of itching to try MEAN out but it's tough to get unbiased, up-to-date information about MongoDB half the time. I'm not sure if Mongo's schemaless design will benefit something that's basically a DB for D&D-like characters and all the things that entails.
|
# ? Oct 14, 2015 19:49 |
|
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 |
|
Noam Chomsky posted:Is MongoDB pretty much a bad choice for ~99% of applications?
|
# ? Oct 14, 2015 22:27 |
|
Noam Chomsky posted:Is MongoDB pretty much a bad choice for ~99% of applications? yes.
|
# ? Oct 15, 2015 00:55 |
|
Noam Chomsky posted:Is MongoDB pretty much a bad choice for ~99% of applications? If you aren't 100% sure that MongoDB is perfect for your situation, don't use it.
|
# ? Oct 15, 2015 01:10 |
|
If your data is relational, you almost certainly want to use a relational database instead of trying to build one on top of a key-value store. Your data is probably relational. If it's not relational, you'll probably find a different key-value store fits your specific use case better.
|
# ? Oct 15, 2015 01:13 |
|
99% of applications matter so little in terms of data management that ease of developer use trumps everything else. If you're in the other 1% you know it and you're not asking about storage architectures in a JS thread.
|
# ? Oct 15, 2015 02:01 |
|
Subjunctive posted:99% of applications matter so little in terms of data management that ease of developer use trumps everything else. If you're in the other 1% you know it and you're not asking about storage architectures in a JS thread. A RDBMS provides a lot of ease of developer use most sometimes...
|
# ? Oct 15, 2015 03:11 |
|
Sure does, if your data's tabular and your queries relational. If you have data of other shapes, like graphs, then sometimes less so. RDBMS are fine to use, I'm not arguing against them, or for any specific storage tech. I just think that if people feel like a tech is going to be comfortable for them, then " what about ill-times network partition" pearl-clutching isn't helpful. More likely to lose because nobody's testing the backup tools than because you lost consistency between shards.
|
# ? Oct 15, 2015 03:28 |
|
I am looking to get acquainted with supervisor stuff for javascript files that need to keep running even if they crash, was wondering if anyone had any tips for that since googling javascript supervisor is giving me mixed results. I found a package called forever but it appears to only be as far as 0.15 so I'm not sure if its a good bet anymore.
Knifegrab fucked around with this message at 09:47 on Oct 15, 2015 |
# ? Oct 15, 2015 09:07 |
|
Why not use something a bit more mature if you want a userspace process manager, like supervisord (http://supervisord.org) There's absolutely no reason you need to use JavaScript written programs to manage node processes.
|
# ? Oct 15, 2015 10:33 |
|
PM2 is a really robust Node process manager with Keymetrics integration. We use it all over the place.
|
# ? Oct 15, 2015 16:57 |
|
Vulture Culture posted:PM2 is a really robust Node process manager with Keymetrics integration. We use it all over the place. THis seems really cool but testing it, it only seems to restart my script after it crashes four times then it never restarts again...
|
# ? Oct 15, 2015 17:33 |
|
What would the 'smart' way to handle determining whether or not a 'touchmove' event originated within a specific div be? i tried a recursive 'isDescendent' type function but it didn't seem good. nevermind i just used target.parents(*parent*).length no_funeral fucked around with this message at 21:41 on Oct 15, 2015 |
# ? Oct 15, 2015 19:51 |
|
Noam Chomsky posted:Is MongoDB pretty much a bad choice for ~99% of applications? I'm going to be doing a project with node and mySQL soon, so it's not like it's MEAN or nothing if you want to use the crunchy goodness of npm and server side javascript. But yeah, if you already know both I would guess you can get up and running sooner with Rails.
|
# ? Oct 16, 2015 07:26 |
|
my effigy burns posted:I'm going to be doing a project with node and mySQL soon, so it's not like it's MEAN or nothing if you want to use the crunchy goodness of npm and server side javascript. But yeah, if you already know both I would guess you can get up and running sooner with Rails. Yeah, I know Rails fairly well and Ruby fairly well and I'm currently learning more about the intricacies of Ruby as a language, outside the context of Rails. I also know some SQL. The language I know best if JavaScript, though, and I know AngularJS very well, and I'm fairly familiar with Node and Express. So, deciding on which stack to use is fairly tough, since I know two of trendy stacks well enough to create some apps. I really enjoy Rails and as well as I know and as much as I enjoy JavaScript, it does make me want to shoot myself at times. So, I'm probably looking at a Rails JSON API and an AngularJS front-end.
|
# ? Oct 16, 2015 15:42 |
|
I have a script I need to essentially run forever (its not an express server its a web api scraper) but it just seems to stop randomly all the time and I cannot pinpoint why that is. At the end of my promise loop (which was a pain to write) it has a then, fail, and finally, however it never outputs any of the logs in those parts of the code so it would seem it never actually "ends" but it would also seem it never explicitly fails or crashes anywhere, it just sort of ... hangs!
|
# ? Oct 19, 2015 17:14 |
|
Knifegrab posted:I have a script I need to essentially run forever (its not an express server its a web api scraper) but it just seems to stop randomly all the time and I cannot pinpoint why that is. At the end of my promise loop (which was a pain to write) it has a then, fail, and finally, however it never outputs any of the logs in those parts of the code so it would seem it never actually "ends" but it would also seem it never explicitly fails or crashes anywhere, it just sort of ... hangs! Sounds like you forgot to call a callback somewhere prior to that final section you mentioned. Can we see the code?
|
# ? Oct 19, 2015 18:09 |
|
qntm posted:Sounds like you forgot to call a callback somewhere prior to that final section you mentioned. Can we see the code? Unfortunately its not something I can paste here, I have verified that all of the end points do continue with the process, I added a ton of logging tools so hopefully I can narrow down where the hang occurs.
|
# ? Oct 19, 2015 18:57 |
|
Could be a GC pause. Try running it in verbose mode and looking for 'mark-sweep' in the logs to see if the timing coincides.
|
# ? Oct 19, 2015 19:14 |
|
|
# ? Jun 13, 2024 06:02 |
|
Munkeymon posted:Could be a GC pause. Try running it in verbose mode and looking for 'mark-sweep' in the logs to see if the timing coincides. Would such a pause be indefinite though? The script doesn't just hiccup, it straight up fails to continue.
|
# ? Oct 19, 2015 19:22 |