|
LifeLynx posted:Could I use WordPress for the same effect? I know PHP is kind of disdained here, but I know it well. I know I can read from the API, but post to? You probably could but I've never heard of anyone using wordpress just as a backend before. Heres a rails tutorial that goes over exactly what you're trying to do https://scotch.io/tutorials/build-a-restful-json-api-with-rails-5-part-one Probably should have read your initial question before responding ahaha. TBH if you're just starting out in actual http request stuff in react, it might be overkill to learn rails right now. Firestore or firebase (two different real time db google offers) is a good starting point to get used to requesting and saving data from the front end, and their inadequacies in relational data will help you in knowing what you want something like rails or django to do (theres more than those two in the relational db world as well). I would take a look at that tutorial and see if its interesting to you, learning even the basics of an actual production ready backend system will help even if you dont plan on going into the backend world. ddiddles fucked around with this message at 17:05 on Apr 26, 2019 |
# ? Apr 26, 2019 17:01 |
|
|
# ? Jun 6, 2024 08:26 |
|
ddiddles posted:Firestore or firebase (two different real time db google offers) So Google.
|
# ? Apr 26, 2019 18:23 |
|
Lumpy posted:The JSON fields on PostGRE make it so good that unless there is a compelling reason *not* to use it, you should use it. Gives you the "just throw unstructured data in there" ability of NoSQL things, but it's easily searchable and you have all the good stuff you want a relational DB for as well. You should always prefer to use the relational DB as a relational DB, don't just throw crap into JSON columns. Use JSON if and when you need to, consciously and with great care.
|
# ? Apr 26, 2019 18:24 |
|
ddiddles posted:You probably could but I've never heard of anyone using wordpress just as a backend before. It came up in... one of the five webdev threads. Apparently it has either a built-in JSON API or a plugin that does that.
|
# ? Apr 26, 2019 18:48 |
|
Thermopyle posted:So Google. AWS also has one but I would never willingly point someone towards that UI.
|
# ? Apr 26, 2019 20:35 |
|
Volguus posted:You should always prefer to use the relational DB as a relational DB, don't just throw crap into JSON columns. Use JSON if and when you need to, consciously and with great care. Correct. I was pointing out that the ability to handle unstructured data in a sane(r) manner should you need it was a selling point of PostGRE vs MySQL.
|
# ? Apr 26, 2019 22:50 |
|
Wordpress ends up being pretty slow as an API backend. Each request fires all the same hooks as a full pageload. I've heard of better experiences doing headless Drupal, but I don't really like using CMSes in general myself.
|
# ? Apr 26, 2019 23:10 |
|
Lots of talk about postgres and mysql but sqlite is quite alright for most websites. I tend to use it because it's one less server process to worry about / configure and the db itself being just a file that can be versioned and easily moved around is extremely good, to me.
|
# ? Apr 28, 2019 07:47 |
|
Yeah, sqlite is great for small sites, especially read heavy.
|
# ? Apr 28, 2019 17:27 |
|
Question about firebase. I'm trying to make a multiplayer rock paper scissors game. There is a form and when the user enters their user name it saves it in this users folder. How do I have it so once the user enters their name, it locks their client into that name so when they click on a button it registers that user1 clicked it, and saves it into that same users's folder? https://github.com/Royal-Crown-Cola/Pokefite-Multiplayer This is what I have so far. I have it saving usernames but I can't pull the names that are entered. Any advice would be appreciated. I'm just learning firebase and its my first time really working with a database
|
# ? Apr 29, 2019 19:09 |
|
Not being able to use traditional if/else statements inside a return in React is throwing me. How do I make it so .price-usd just says "N/A" if cardName.prices.usd is undefined?code:
|
# ? Apr 29, 2019 21:46 |
|
LifeLynx posted:Not being able to use traditional if/else statements inside a return in React is throwing me. How do I make it so .price-usd just says "N/A" if cardName.prices.usd is undefined? JavaScript code:
|
# ? Apr 29, 2019 21:55 |
|
Why double $$ ?
|
# ? Apr 29, 2019 22:01 |
|
Lumpy posted:
Or you derived the rendered value before the return as another var and just render that.
|
# ? Apr 29, 2019 22:02 |
|
Lumpy posted:
Thanks, that worked! I'm having trouble parsing it though, like I'm not sure what that statement is doing in plain English. Is there another way to write it? Ahz posted:Or you derived the rendered value before the return as another var and just render that. I thought about doing that before the return, but since it's in a map I'm not sure if that's even possible, because whatever function I'm writing above the return to check would have to sync up somehow?
|
# ? Apr 29, 2019 22:06 |
|
The Fool posted:Why double $$ ? The first one is a dollar sign, the second one is the "Hey, this is a variable" flag in the template string.
|
# ? Apr 29, 2019 22:26 |
|
LifeLynx posted:Thanks, that worked! I'm having trouble parsing it though, like I'm not sure what that statement is doing in plain English. Is there another way to write it? JavaScript code:
JavaScript code:
|
# ? Apr 29, 2019 22:33 |
|
Lumpy posted:The first one is a dollar sign, the second one is the "Hey, this is a variable" flag in the template string. I thought that was what the curly braces indicated. edit: nm, it's because of the backtick. otherwise you would need to do something like this: code:
The Fool fucked around with this message at 22:48 on Apr 29, 2019 |
# ? Apr 29, 2019 22:37 |
|
ddiddles posted:Just use rails and enjoy your life... ...while you can because you will put knives to your wrists within a year that you didn't choose Kotlin.
|
# ? Apr 30, 2019 03:35 |
Lumpy posted:
If you really like the look of classic if/else, you can use a self-executing function: JavaScript code:
You can easily add nested conditions, switch statements and stuff like that in this way.
|
|
# ? Apr 30, 2019 10:27 |
|
geeves posted:...while you can because you will put knives to your wrists within a year that you didn't choose Kotlin. This may be the first time I've ever heard anyone advocate for using Kotlin to develop web application servers.
|
# ? Apr 30, 2019 17:39 |
|
code:
|
# ? May 1, 2019 01:16 |
|
huhu posted:
Could be since you aren’t clearing your event handlers in useEffect it’s calling ones from the first render so it’s still the initial value. Then again it’s late and I’m phone posting.
|
# ? May 1, 2019 01:27 |
|
Lumpy posted:Could be since you aren’t clearing your event handlers in useEffect it’s calling ones from the first render so it’s still the initial value. Then again it’s late and I’m phone posting. I tried the following and got the same result: code:
|
# ? May 1, 2019 01:51 |
|
JS will probably also have do expressions eventually do make that ternary stuff easier in React-like contexts, though I imagine it'll take a while to get there.
|
# ? May 1, 2019 02:00 |
|
huhu posted:
code:
code:
|
# ? May 1, 2019 09:15 |
|
I'm trying to create a webscraper that fetches my hand history from a poker web app, using the selenium module with python. I'm passing js code to the selenium module to execute, but im getting kind of stuck. so far i have been able to log in and navigate to the history page. But for some reason i can't seem navigate through the dates. The snippet below works fine and takes me to the history page shown below: code:
trying click() on the arrow classes. I have checked that the correct object/class was selected before trying the click() method. Any help is appreciated.
|
# ? May 1, 2019 14:19 |
|
Anyone know why I'm having some issues with the flow of this code?JavaScript code:
"Begin processing data for 0" "theThing" "Finish Processing data for 0" But instead Begin and Finish go through, followed by "theThing". As soon as I get to "getMoreApiData(id)" in the last function, node seems to jump to the next iteration of the forEach loop. Is there any way to get it to not do that and have a more linear program flow? I've tried moving/removing/adding async and await where needed but to no success. I also tried getting rid of the await/async in doStuffWithData1 but then this.getMoreData returns a promise. If I try to await that promise, I get moved to the next iteration in the forEach and the rest of the logic doesn't run until the rest of the program has finished executing, seemingly putting it on the event loop.
|
# ? May 2, 2019 18:47 |
|
Using async/await in a forEach will not do what you expect. You need to use a for loop, as forEach is not promise/async aware.
|
# ? May 2, 2019 18:53 |
The Dark Wind posted:Anyone know why I'm having some issues with the flow of this code? Replace forEach with for( let ... of .... ) JavaScript code:
|
|
# ? May 2, 2019 18:55 |
|
Y'all are amazing, thank you! Edit: So is it standard practice that if you have awaited something in a child of a child of a child, it's pretty much async/awaits up the tree? reversefungi fucked around with this message at 19:08 on May 2, 2019 |
# ? May 2, 2019 19:04 |
|
Async is contagious, yeah
|
# ? May 2, 2019 19:28 |
|
Yeah, and that's not really exclusive to Javascript. In other languages, if you need to you can put all your async stuff in another thread or process, but otherwise it's async all the way down.
|
# ? May 2, 2019 19:50 |
|
The Dark Wind posted:Edit: So is it standard practice that if you have awaited something in a child of a child of a child, it's pretty much async/awaits up the tree? code:
|
# ? May 3, 2019 04:08 |
Nakedyoghurt posted:I'm trying to create a webscraper that fetches my hand history from a poker web app, using the selenium module with python. I'm passing js code to the selenium module to execute, but im getting kind of stuck. I don't see any event handlers on either of those elements so it seems to me that whatever javascript is causing mouse clicks to trigger date changes is hidden somewhere else. Maybe have a look in their script code?
|
|
# ? May 3, 2019 09:22 |
|
Edit: decided to go with jwt instead.
huhu fucked around with this message at 22:22 on May 4, 2019 |
# ? May 4, 2019 01:51 |
|
"Do not block the main thread" is a thing in javascript for the web. I assume it's also the case for an express app that handles client requests. Is this as simple as making sure that all of the stuff I do is via methods marked async? Can anyone describe or link to an auditing process to ensure that code is non-blocking? Are there tools (in the TS ecosystem, maybe?) that can lint for it?
|
# ? May 4, 2019 07:31 |
|
Newf posted:"Do not block the main thread" is a thing in javascript for the web. I assume it's also the case for an express app that handles client requests. It's actually as simple as making sure all of the stuff you do doesn't have an infinite or long-running loop (I guess this is why I think it was Airbnb has a style guide that forbids loop style flow control entirely, only allowing forEach style iterator loops). There are basically no blocking functions in the ecosystem, so the only way to block is to not come out of a loop. There is no linting for this, because it's basically the Halting problem. But you can do like Airbnb and forbid all flow control if you're a nutcase. Edit: unit testing with 100% coverage is fairly good for ensuring no infinite loops too, but there are ways you could trick it. Edit2: vvvv I didn't want to address actual threads in JS, because the question was fundamentally misled enough that it clearly wasn't about advanced concepts like WebWorkers. roomforthetuna fucked around with this message at 23:08 on May 4, 2019 |
# ? May 4, 2019 15:29 |
|
Newf posted:"Do not block the main thread" is a thing in javascript for the web. I assume it's also the case for an express app that handles client requests. Easiest way to think of it is that JS has processes, via WebWorker, not threads. There is no sharing between processes and you must use message passing of some flavour. In browsers the Worker model is quite limited as you cannot spawn sub-workers outside of Firefox and worker-to-worker communication has to manually route through the main renderer thread.
|
# ? May 4, 2019 22:42 |
|
|
# ? Jun 6, 2024 08:26 |
|
I just converted my project to Typescript. Almost done playing whack-a-mole but I'm stumped by the following errors:code:
1. My tsconfig.json file contains "exclude": ["node_modules", "build", "scripts"] 2. I'm doing a React project and I'm not really sure where react-native stuff came from. What should I be Googling because I'm pretty sure I'm searching in the wrong direction. And a second issue. I've got the following: code:
huhu fucked around with this message at 22:09 on May 5, 2019 |
# ? May 5, 2019 22:00 |