|
Newf posted:Where can I read about js variable declarations that look like this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
|
# ? Apr 12, 2021 20:39 |
|
|
# ? Jun 5, 2024 06:33 |
|
Newf posted:Where can I read about js variable declarations that look like this: the first line is an array, not an object. a and b are the first 2 values in the array. the second line is destructuring an object that looks like code:
|
# ? Apr 12, 2021 20:42 |
|
Grump posted:the first line is an array, not an object. a and b are the first 2 values in the array. Whoops, I knew that! But thanks, both, for the reference and explanation.
|
# ? Apr 12, 2021 23:35 |
|
Dumb React question time: I have this code: code:
code:
|
# ? Apr 15, 2021 01:04 |
|
It's an array of objects, I think you want theWeather.weather[0].main
|
# ? Apr 15, 2021 01:14 |
|
Yeah weather is an array within an array so that should work. Tbh I would just map over it because that means at some point you're going to run into multiple weather's, so something like'JavaScript code:
Should get you what you want I believe
|
# ? Apr 15, 2021 10:53 |
Empress Brosephine posted:Yeah weather is an array within an array so that should work. Tbh I would just map over it because that means at some point you're going to run into multiple weather's, so something like' Yeah, just remember to set a key on each li. In general, you can't just plonk any old object into a react jsx with curlies, it needs to be a primitive or an element itself.
|
|
# ? Apr 15, 2021 12:46 |
|
xtal posted:It's an array of objects, I think you want theWeather.weather[0].main this but you've also got a few other problems here. You're initializing theWeather as an array, and setting it with axios' data property, which is an object, so you keep the primitives the same across the board. Also when you're rendering your html, you're trying to access a property that only exists after the network request finishes, so you need to add some check to first see if the data actually exists first.
|
# ? Apr 15, 2021 14:25 |
|
I'm making a very simple app, its a SPA and I am hoping to have it all delivered in basically one big bundle. What is the best hosting package to use for this? I'm used express in the past but that feels like extreme overkill. I just want, if people hit my url, to be given this big ol' bundle. All the routing is local so there is really only one serverside end point. I am planning on hosting this on a cheap digital ocean droplet at some point.
|
# ? Apr 18, 2021 05:05 |
|
Netlify, if it doesn't require backend. Free tier allows hosting React apps created with CRA with ease. Integrates with github. Offers more advanced stuff if you need it.
|
# ? Apr 18, 2021 05:24 |
|
gbut posted:Netlify, if it doesn't require backend. Free tier allows hosting React apps created with CRA with ease. Integrates with github. Offers more advanced stuff if you need it. I appreciate this post, but I was control over my server solution. So I am going with a digital ocean droplet, I am just not sure what framework to use to act as a server, probably leaning towards nginx but not sure.
|
# ? Apr 18, 2021 05:41 |
|
anything works. nginx, apache 2.4+ is decent (don't go below 2.4), you're effectively serving static files
|
# ? Apr 18, 2021 06:54 |
|
Anyone used NX? I actually love it. It takes a bit to configure it how you like it but I'm using it with NestJS/Angular & SSR and its a really loving solid full stack mono-repo solution. It feels like it was basically made to marry NestJS & Angular together (in fairness the whole thing is a heavily modified Angular webpack config) though it can be used with React/Vue/Express, etc.
|
# ? Apr 21, 2021 21:59 |
|
Any of you have experience with apollo and wpgraphql? Or I guess NextJs in general. I have a odd question that no one's answered on stack overflow yet and goons usually know their stuff. Thanks https://stackoverflow.com/questions/67291378/nextjs-apollo-wpgraphql-combining-or-retrieving-more-than-100-records
|
# ? Apr 28, 2021 00:36 |
|
Ape Fist posted:Anyone used NX? I actually love it. It takes a bit to configure it how you like it but I'm using it with NestJS/Angular & SSR and its a really loving solid full stack mono-repo solution. It feels like it was basically made to marry NestJS & Angular together (in fairness the whole thing is a heavily modified Angular webpack config) though it can be used with React/Vue/Express, etc. Using it with React and Koa and I like it. The library organisation and commands are solid.
|
# ? Apr 28, 2021 00:44 |
|
Empress Brosephine posted:Any of you have experience with apollo and wpgraphql? Or I guess NextJs in general. I have a odd question that no one's answered on stack overflow yet and goons usually know their stuff. Thanks dataset2 is undefined because dataset2 isn't a property you get back from calling client.query(). I think you meant to rename the data property instead? JavaScript code:
Ima Computer fucked around with this message at 04:28 on Apr 28, 2021 |
# ? Apr 28, 2021 04:26 |
|
You are a genius thank you so much.
|
# ? Apr 28, 2021 12:39 |
|
Quick second question because I apparently can't figure it out...how do I join the two pieces of data? I tried:code:
code:
|
# ? Apr 28, 2021 14:38 |
|
What are you hoping for the results to be? The spread operator should work for joining objects, but it's going to overwrite keys if there are duplicates. Do you want to merge the values inside the keys like a deep merge?
|
# ? Apr 28, 2021 15:06 |
|
Yeah, essentially just concat dataset2.campgrounds.edges onto data so I end up with code:
code:
Thank you all for the help! edit: I've gotten a little closer. Using code:
code:
Empress Brosephine fucked around with this message at 15:21 on Apr 28, 2021 |
# ? Apr 28, 2021 15:11 |
|
I figured it out code:
|
# ? Apr 28, 2021 15:23 |
|
I have a dev dependency that requires java to run (its used to generate code). However on my pipeline servers java isn't installed. Instead of changing how those pipeline machines are configured, would installing java as a dev dependency actually work?
|
# ? Apr 29, 2021 03:40 |
|
Skyarb posted:I have a dev dependency that requires java to run (its used to generate code). However on my pipeline servers java isn't installed. Instead of changing how those pipeline machines are configured, would installing java as a dev dependency actually work? What do you even mean by "installing java as a dev dependency", specifically?
|
# ? Apr 29, 2021 03:54 |
|
Roadie posted:What do you even mean by "installing java as a dev dependency", specifically? npm install --save-dev java
|
# ? Apr 29, 2021 05:30 |
|
Skyarb posted:npm install --save-dev java That's not a Java installation, it's a library to invoke a JDK installation from JS.
|
# ? Apr 29, 2021 06:07 |
|
Yeah that was my assumption as well. Its annoying to setup an environment with npm (whcih really isn't its purpose so I get it). Guess I gotta gently caress with doicker.
|
# ? Apr 29, 2021 08:15 |
|
Anyone know of any good extensions or anything to make typescript errors in vscode any more legible. If I have a type conflict trying to parse those errors can be incredibly difficult.
|
# ? May 1, 2021 10:49 |
|
Any of you handy with jQuery and might know the answer to this question? https://stackoverflow.com/questions/67541201/jquery-wordpress-redirect-to-a-page-and-attach-html-data-to-div-on-new-page I'd post it here but the forums don't like jQuery being posted
|
# ? May 15, 2021 00:31 |
|
Empress Brosephine posted:Any of you handy with jQuery and might know the answer to this question? Assuming you can edit it: (2) Querying the data on the page you want to display it on is the idiomatic approach (3) You could probably set url parameters, a cookie, or a local data store with the inputs and then perform the query on the second page by reading the inputs from where you stored them. Maybe there's some other approach I am overlooking because I am a caveman who always uses #2, #3, or some solution involving the backend. Khorne fucked around with this message at 02:10 on May 15, 2021 |
# ? May 15, 2021 02:07 |
|
Nah those both sound like better approaches. I'll do that, thank you very much.
|
# ? May 15, 2021 13:59 |
Hey, two questions I guess: 1) Is there by any chance a dedicated Three.JS/WebGL thread I'm not seeing, or is this as good a place as any? 2) Are there any Three.js gurus in the house? I'm trying to create what I think should be an extremely simple and computationally inexpensive scene (a six-sided box made of planes, each ultimately with a different image mapped onto the surface, with an OrbitControls so I can spin it around and loooook at it), and it makes my fans spin up to MAX POWER and never spin down and I can't even type smoothly in my IDE anymore. I've simplified it as much as possible and used all the tricks I think are applicable from https://discoverthreejs.com/tips-and-tricks/, and this loving thing runs as cool as a cucumber compared to my stupid green cube.
|
|
# ? May 30, 2021 18:01 |
|
Data Graham posted:I'm trying to create what I think should be an extremely simple and computationally inexpensive scene (a six-sided box made of planes, each ultimately with a different image mapped onto the surface, with an OrbitControls so I can spin it around and loooook at it)
|
# ? May 30, 2021 18:55 |
|
That's the first place I'd look too. You're doing something computationally intensive somewhere by accident, as once you have the mesh and materials set up, it should be able to run a huge number of triangles (compared to a simple cube).
|
# ? May 30, 2021 19:14 |
Thanks, yeah, I didn't want to code-dump as step one before I knew this was the right place to post. Here's what I'm doing (this is Vue):code:
I can't really see where I might be calling anything recursively or anything like that, but I could well be going about this the entirely wrong way. I haven't done 3D stuff since POVRAY on a 386 in high school Data Graham fucked around with this message at 22:32 on May 30, 2021 |
|
# ? May 30, 2021 22:23 |
|
I might be wrong here, but aren't you introducing another recursive requestAnimationFrame on each mount?
|
# ? May 30, 2021 22:28 |
|
gbut posted:I might be wrong here, but aren't you introducing another recursive requestAnimationFrame on each mount? I'd also be concerned that refreshFaces might be getting called more than you expect, but I would think you'd have seen that already if that was the issue since you have a console.log for it. (Making a canvas into a dataUrl every frame does seem like the sort of thing that would be a heavy load though.) roomforthetuna fucked around with this message at 23:37 on May 30, 2021 |
# ? May 30, 2021 23:33 |
Interesting idea, thanks ... I just tried that and it mostly pegs at 60, and I can get it to drop down to like 43 by grabbing and spinning the box a lot, but it never goes above 60 (well I saw 62 once). Maybe it's okay, I'm not sure. This is on a 2014 MBP that otherwise gets like 20 FPS on that "Littlest Tokyo" thing, whereas I also have a 2019 MBP that gets 30 FPS on the same scene, but I haven't tried it on my box scene. Maybe this is more just a "modern hardware won't ever notice an issue" thing? After more experimentation it seems the fans do spin down eventually if I leave the scene untouched, but the CPU stays hot and scrolling the forums in another window is choppy. This doesn't feel like something I ought to be yeeting into production without understanding it better in any case.
|
|
# ? May 30, 2021 23:47 |
|
Another possibility is this.canvas being something surprising (it seems to be defined outside of what we can see). I don't know if it's still typically problematic to have textures that aren't squares with sides that are a power of two long, or maybe that canvas is just huge. (The code there seems weird too, clearing the background image before calling toDataUrl then setting it to something afterwards? But I don't even know what that canvas object is; HTMLCanvasElement has toDataUrl but doesn't have setBackgroundImage, so I guess it's some kind of wrapper, maybe Fabric?)
|
# ? May 31, 2021 02:43 |
Yeah, it's Fabric. What I'm trying to do there is composite some images together to use as the mapping texture, because apparently I can't layer multiple textures together in Three itself? It's an editable canvas where you can place images and text elements on a guide which then get mapped onto the box in the inner Three component. So I'm taking the canvas (which is in the outer component, as you deduced), which has a backgroundImage set already as a guide for the box faces, and then to make the mapping I'm experimenting with various approaches where currently I'm trying to swap in another backgroundImage which is an underlying texture tile pattern, and then dump the canvas to a data URL so I can map it in Three. And then reset the canvas back to the original backgroundImage before the UI notices ... I guess. Still doing a bunch of floundering and tinkering there. It seems to involve stuff like using setBackgroundImage() which takes a callback function which executes when the image is loaded, and then doing the dataURL/mapping stuff in that callback; but right now I'm still wrestling with making the canvas aware that the backgroundImage has been updated in the callback function (it still seems to dump out with the original backgroundImage at that point). I've been trying to experiment with stuff like maintaining a separate shadow canvas with the other (texture) backgroundImage already set, but that creates further issues and dumping that out is even wronger, because the canvas in question has to be displayed and at full-size in order to work, and maintaining state on that shadow canvas seems like a lot of background processing anyway, so that's probably a dead end. Not sure if I'm explaining it clearly here, but I'll probably figure it out eventually. Unless of course someone knows an obvious path forward that I have yet to discover e: hell yeah I got it, turns out I didn't understand how .bind works on callback functions, so I needed to do that and then manually renderAll() the canvas within the callback Data Graham fucked around with this message at 03:57 on May 31, 2021 |
|
# ? May 31, 2021 03:24 |
|
|
# ? Jun 5, 2024 06:33 |
|
Data Graham posted:It's an editable canvas where you can place images and text elements on a guide which then get mapped onto the box in the inner Three component. So I'm taking the canvas (which is in the outer component, as you deduced), which has a backgroundImage set already as a guide for the box faces, and then to make the mapping I'm experimenting with various approaches where currently I'm trying to swap in another backgroundImage which is an underlying texture tile pattern, and then dump the canvas to a data URL so I can map it in Three. And then reset the canvas back to the original backgroundImage before the UI notices ... I guess. code:
(For your user-drawn on-screen canvas you'd want to put the background image below the canvas the user actually draws on, then on the off-screen canvas draw your other background and drawImage(onScreenCanvas, ...) onto it.) roomforthetuna fucked around with this message at 12:26 on May 31, 2021 |
# ? May 31, 2021 12:22 |