|
I want to build a frontend app which shows various stats from a service pulled from an API. The only endpoint is essentially a Dynamodb dump (JSON object) which is way too big to download to the frontend (30+mb). Given I don't have access over the endpoint (but permission to use it), would the solution here be to create a backend in Node (maybe on a daily basis) and then perform my own operations on the data and serve it to the frontend? I haven't done too much backend work and have never worked with this type of endpoint before (normally I'm just querying RESTful APIs), and so I'm a bit confused as to what I should do here.
|
# ? Sep 11, 2020 02:18 |
|
|
# ? May 16, 2024 18:31 |
|
Supersonic posted:I want to build a frontend app which shows various stats from a service pulled from an API. The only endpoint is essentially a Dynamodb dump (JSON object) which is way too big to download to the frontend (30+mb). Doesn’t need to be a node backend, but yes. It sounds like you need your own server and data store (flat file, db) where you can stuff the data you’ve pulled down so you can feed the relevant / aggregated chunks to the front end.
|
# ? Sep 11, 2020 02:29 |
|
If you have some kind of http caching in front of the endpoint you create, you could chuck a long timeout on it and not bother with any other kind of infrastructure to store your computed state. Downside is some poor sucker is going to have to wait occasionally when the cache misses, but if you don't care or have a good retry policy on the frontend it would greatly simplify your implementation. roomforthetuna posted:(Also it should be noted that actual blockchain stuff, where you're actually doing work, is not a good match for async or Promise, everything will still be blocked by your work, async is not the same as multithreaded.) A dumb question but just to make sure I've got this straight, if your promises are mostly there because they have to wait for http responses there would be no advantage to using actual multithreading because its network-bound not compute-bound? Granite Octopus fucked around with this message at 13:08 on Sep 11, 2020 |
# ? Sep 11, 2020 13:02 |
|
Granite Octopus posted:A dumb question but just to make sure I've got this straight, if your promises are mostly there because they have to wait for http responses there would be no advantage to using actual multithreading because its network-bound not compute-bound?
|
# ? Sep 12, 2020 03:17 |
|
Of note Promise.all() was optimized a while back to actually run in part parallel giving boost over standard chaining. I love abusing the Promise.then() syntax and ignoring the catch(). The chome developers do not agree and love flagging warnings and errors. Kind of silly to force a .catch(e => { throw e; }) when trivial re-throwing was popularly frowned upon. Also a bit rear end that the throw has to be in a block.
|
# ? Sep 13, 2020 19:53 |
|
I was fairly sure a throw expression was on its way through the standards track. .catch(e => { throw e; }) doesn't do anything though? It's frowned upon because it achieves nothing?
|
# ? Sep 13, 2020 20:28 |
|
Randomly copying a console output example:code:
|
# ? Sep 13, 2020 21:52 |
|
I'm trying and failing to get the background color of a page to change when an element is scrolled into view. All of these .fullheight sections have min-height: 100vh.code:
LifeLynx fucked around with this message at 22:30 on Sep 14, 2020 |
# ? Sep 14, 2020 22:28 |
|
LifeLynx posted:I'm trying and failing to get the background color of a page to change when an element is scrolled into view. All of these .fullheight sections have min-height: 100vh. IntersectionObserver is an alternative to using a scroll event handler, so you can get rid of that. Instantiating a new observer on every scroll event sounds like a performance nightmare. You're also setting the background color on every iteration of entries, so only the intersecting status of the last entry will ever change the background color. Without setting a threshold and with 100vh elements, you'll also have different sections competing for who sets the background color, so maybe try 50%? And you can probably save yourself some if statements by storing the color directly in the data attribute. code:
|
# ? Sep 14, 2020 23:59 |
|
fireraiser posted:IntersectionObserver is an alternative to using a scroll event handler, so you can get rid of that. Instantiating a new observer on every scroll event sounds like a performance nightmare. Thanks! You're right, the scroll event was causing it to retry with every scroll event. I eventually figured something out: code:
|
# ? Sep 15, 2020 00:13 |
|
I think that would be much cleaner using native CSS variables and a 'style' property on the elements to store the colours. Unless you need IE support?
|
# ? Sep 15, 2020 08:51 |
|
I'm going through the Odin project and they're making a huge deal about learning prototype, but I'm a little confused, why would you use prototype when you could just use a class and the super function?
|
# ? Sep 16, 2020 22:16 |
|
Empress Brosephine posted:I'm going through the Odin project and they're making a huge deal about learning prototype, but I'm a little confused, why would you use prototype when you could just use a class and the super function? I think its worth understanding how prototypical inheritance works so you know how to avoid some of the less obvious footguns with it. I don't think anyone writes new javascript that way, but if you ever have to deal with legacy poo poo its worth knowing how screwed over you are exactly.
|
# ? Sep 17, 2020 00:15 |
|
Sweet thanks Tanners
|
# ? Sep 17, 2020 00:22 |
|
Empress Brosephine posted:I'm going through the Odin project and they're making a huge deal about learning prototype, but I'm a little confused, why would you use prototype when you could just use a class and the super function? Class and super are essentially syntactic sugar over the normal prototype approach, you're learning the foundation of a system that does not match other languages with "classes".
|
# ? Sep 17, 2020 06:16 |
|
edit: After some convoluted nonsense I got the "variable number and type of columns for DataTables without using logic in the template language" thing working. The ugly part that bugs me is that I'm storing the "first attribute column index" (i.e. the index where the "non-static" column types start) in the "sample" objects (that go into the rows). The column render function can then pull the index out of the data that are passed into the DataTables instance. I'm pretty sure this doesn't actually cause any functional problems, but I don't like it "conceptually" (since "first column index" is not an actual attribute of a mouse/rat/human data sample). Ytlaya fucked around with this message at 23:32 on Sep 17, 2020 |
# ? Sep 17, 2020 21:24 |
|
This is probably a dumb question but I'm learning Javascript and I can't figure out how to search for a answer to this using vanilla JS and not Node but: I have three files Index.js (which imports sixflags.js) SixFlags.js (which exports a class called Attraction) SixFlagsNewEngland.js (which imports SixFlags.js and allows the creation of new Attraction classes for each ride) Is it possible to access the ride classes created in SixFlagsNewEngland in Index.js? If that makes sense? Basically I want to be able to be in Index.js and go like console.log(SixFlagsNewEngland.houdiniRide) and have the created class object in SixFlagsNewEngland show up without exporting each individual item or should I just skip doing a chain of modules like this and just incorporate SixFlagsNewEngland into index? Thanks all Empress Brosephine fucked around with this message at 21:35 on Sep 29, 2020 |
# ? Sep 29, 2020 21:33 |
|
If I'm reading your post correctly, index.js should import SixFlagsNewEngland.js not SixFlags.js and it will be fine.
|
# ? Sep 29, 2020 22:26 |
|
Kinda, I think I might've figured it out. The idea was that SixFlags.Js would contain the Class logic that creates the Object per ride and then each SixFlags park would have its own seperate JS file with new classes only pertaining to that park. But I think I got around that by just adding the new classes to another object titled the name of the park and importing those. If that makes any sense at all lol.
|
# ? Sep 29, 2020 22:54 |
|
I tried to get a css file to work with webpack and typescript, which forced me to update all my things to try to get a css-loader and css-typescript-whatever-the-gently caress that were supposed to play well together, and then it still sucked, generated a .d.ts file in among my source code eventually that stopped the typescript code from complaining about the import some-css file that apparently I was required to do, and also mangled the css names, but the mangled css names weren't matched to the html file that tried to set a class on an element so it basically broke stuff that worked fine before webpack touched it. In the end I came to the conclusion that "gently caress it I'm just going to write my css stuff in typescript functions, applying styles to elements directly from typescript code, because that'll work okay with the thing I'm doing, gently caress webpack and gently caress all of this." I think maybe it's trying to make me use react so I'd have to do like class="{some react style reference to the class name}" rather than class="the_actual_class_name_i_wrote_in_the_css_file"? And then the mangled names are like 15 characters long and unreadable instead of 5 characters long and meaningful. Thanks for your help webpack!
|
# ? Sep 30, 2020 01:08 |
|
Hey, can I get a quick favour: can someone with a decent standalone graphics card post screenshots of their WebGL 1 and 2 reports at https://webglreport.com ? I wanna see something and I only have laptops and tablets for a little while. Don't need to worry about capturing the long list of functions.
|
# ? Oct 2, 2020 03:39 |
|
MikeJF posted:Hey, can I get a quick favour: can someone with a decent standalone graphics card post screenshots of their WebGL 1 and 2 reports at https://webglreport.com ? I wanna see something and I only have laptops and tablets for a little while.
|
# ? Oct 2, 2020 10:54 |
|
Thanks.
|
# ? Oct 2, 2020 11:59 |
i have a Ubuntu server that I'm trying to run a Node project from. It works fine on both my Windows desktop and Raspberry Pi, but I have been trying for loving hours and it refuses to compile on the server. I get an error that the module "@material-ui/core/Checkbox" is not found. It is, though. I've looked in the node_modules folder and it's right there. Things I have tried to fix this include: 1) Force a cache clean and delete the package_lock.json, then run npm install again (tried about 10 times) 2) Delete just the @material-ui/core package and reinstall it (also tried about 10 times) 2) Completely uninstall Node and reinstall it (tried 5 times, both the same and different versions from what is on my own computers) 3) Delete the project from the server and clone it again with git I feel like I'm going loving crazy.
|
|
# ? Oct 12, 2020 11:20 |
|
i vomit kittens posted:I feel like I'm going loving crazy. I've been here and I feel for ya, comrade. Misc first-pass things I would try are running npm shrinkwrap to ensure absolute ; and running npm doctor on each environment to try and determine where the setup deviation lies.
|
# ? Oct 12, 2020 11:37 |
|
i vomit kittens posted:i have a Ubuntu server that I'm trying to run a Node project from. It works fine on both my Windows desktop and Raspberry Pi, but I have been trying for loving hours and it refuses to compile on the server. I get an error that the module "@material-ui/core/Checkbox" is not found. It is, though. I've looked in the node_modules folder and it's right there. Things I have tried to fix this include: If it's under devDependencies in package.json, try moving it to dependencies.
|
# ? Oct 12, 2020 14:05 |
I checked both of the above but nothing stood out/it wasn't in the dev dependencies I found out that I can just build it on one of my computers and transfer the static files to the server to add to my backend, which seems to work fine. A stupid, time-consuming bandaid fix but it's better than nothing. It's just odd because an old version of this project compiled on an older DO droplet I had just fine (~6 months ago). It's a new droplet, but I built it off of the same default image as the last one.
|
|
# ? Oct 12, 2020 22:19 |
|
Do the npm and nodejs versions match between the environments?
|
# ? Oct 12, 2020 23:07 |
|
and do all envs have the same package lock?
|
# ? Oct 13, 2020 14:06 |
|
Edit: Missed the call to start the function, I'm an idiot
LifeLynx fucked around with this message at 21:44 on Oct 13, 2020 |
# ? Oct 13, 2020 21:39 |
|
i vomit kittens posted:i have a Ubuntu server that I'm trying to run a Node project from. It works fine on both my Windows desktop and Raspberry Pi, but I have been trying for loving hours and it refuses to compile on the server. I get an error that the module "@material-ui/core/Checkbox" is not found. It is, though. I've looked in the node_modules folder and it's right there. Things I have tried to fix this include: When you say "compile", do you mean this is a front-end project and you're trying to webpack it? Can you whittle this down to a minimal reproduction?
|
# ? Oct 13, 2020 23:15 |
Doom Mathematic posted:When you say "compile", do you mean this is a front-end project and you're trying to webpack it? Can you whittle this down to a minimal reproduction? Finally had the time to do this to figure out the problem and it is much stupider than I ever could have imagined. I had this in the file that was throwing the error: code:
code:
|
|
# ? Oct 20, 2020 14:43 |
|
i vomit kittens posted:Finally had the time to do this to figure out the problem and it is much stupider than I ever could have imagined. I had this in the file that was throwing the error: Windows runs in case-insensitive mode by default.
|
# ? Oct 20, 2020 15:09 |
|
I went through some basic Javascript lessons and am trying to teach myself react and Gatsby but I'm a little confused as to where you're supposed to put your actual Javascript. Code that isn't jsx. Is it all in modules that gets imported?
|
# ? Oct 20, 2020 15:43 |
|
in your .js or .jsx files
|
# ? Oct 20, 2020 15:56 |
Munkeymon posted:Windows runs in case-insensitive mode by default. yeah I knew it did with filenames but never considered that also applied to import statements. WebStorm auto-imports those components like "import {Checkbox} from '@material-ui/core'" and the Material UI documentation says the other way is preferred, so I've been changing them myself and missed the capital in this one spot i vomit kittens fucked around with this message at 16:36 on Oct 20, 2020 |
|
# ? Oct 20, 2020 16:34 |
|
i vomit kittens posted:Finally had the time to do this to figure out the problem and it is much stupider than I ever could have imagined. I had this in the file that was throwing the error: This kind of stuff is why you always go through the hassle of dumping in strict ESLint presets. For example, eslint-plugin-import will check it by default, and is included in eslint-config-airbnb. Empress Brosephine posted:I went through some basic Javascript lessons and am trying to teach myself react and Gatsby but I'm a little confused as to where you're supposed to put your actual Javascript. Code that isn't jsx. Is it all in modules that gets imported? Generally with React (as well as Node stuff in general) you do this kind of thing: JavaScript code:
JavaScript code:
Roadie fucked around with this message at 19:15 on Oct 20, 2020 |
# ? Oct 20, 2020 19:13 |
|
Okay sweet that was exactly what I was wondering, thanks for the help. I guess a large part of it is dealing with props and such
|
# ? Oct 20, 2020 19:38 |
|
I am back to writing typescript after a long while of NOT doing that. what the does it mean when a function has `<>`? for instance: code:
|
# ? Oct 20, 2020 20:51 |
|
|
# ? May 16, 2024 18:31 |
|
I think that's a generic function and you're providing a type it needs at call time.
|
# ? Oct 20, 2020 20:55 |