|
Imagine being rude to someone who makes a free thing you find useful
|
# ? Dec 21, 2021 05:14 |
|
|
# ? May 18, 2024 02:50 |
|
Work on your fork and move on. Don't expect the maintainer to merge your stuff. Don't get emotional about it. You had an issue with the lib someone wrote, and made publicly available. You fixed it. Open source is working as intended.
|
# ? Dec 21, 2021 05:25 |
|
CarForumPoster posted:Imagine being rude to someone who makes a free thing you find useful It was and is fundamentally broken, like 'unable to update the position of a model from any code outside the rendering callback' broken. That's like ... a thing you do in game engines, right?
|
# ? Dec 21, 2021 06:27 |
|
rjmccall posted:If you don’t want to work with people, go off and be a lone genius already and stop pretending you’re contributing to their projects.
|
# ? Dec 21, 2021 07:13 |
|
Ranzear posted:It was and is fundamentally broken, like 'unable to update the position of a model from any code outside the rendering callback' broken. That's like ... a thing you do in game engines, right? Without being an rear end in a top hat to OSS contributors, sure.
|
# ? Dec 21, 2021 14:56 |
|
Ranzear posted:It was and is fundamentally broken, like 'unable to update the position of a model from any code outside the rendering callback' broken. That's like ... a thing you do in game engines, right?
|
# ? Dec 21, 2021 15:04 |
|
Hey gang! In my Introduction to Python course I'm going over exception handling, and I'm writing a small game using PyCharm alongside my studies. I wrote a few ValueError exceptions to out-of-range integer inputs, but when I ran it in PyCharm, it just ignored it and returned "none". So I copied and pasted the code into https://replit.com/languages/python3 and the exception handling works as intended. I can post the code if you need it, but it's messy and has a lot of other problems going on with it, but my main concern is... why would PyCharm not see it, but Replit does? Is this a common thing, is this something obvious, or... I'm just not sure how I'm supposed to approach this obstacle ha. Edit: Found out what the problem was. Uhhh PyCharm was running an earlier version of the program? Well, I feel like I'm stumbling around blind but I guess I'm happy to learn I'm misunderstanding how the client works and not the language. credburn fucked around with this message at 00:10 on Dec 22, 2021 |
# ? Dec 21, 2021 22:18 |
|
Ranzear posted:It was and is fundamentally broken, like 'unable to update the position of a model from any code outside the rendering callback' broken. That's like ... a thing you do in game engines, right? You're confusing being correct on the merits of your technical argument with being entitled to demand the time and attention of the project maintainer. You can be one of those things without the other.
|
# ? Dec 22, 2021 14:04 |
|
Odd question perhaps but I was looking to make a website that has the same structure as http://cachemonet.com I am someone who has very minimal coding experience but the basics of it do not seem very complex.
|
# ? Dec 23, 2021 18:02 |
|
That's actually web 4.0, it's not cleared for public use yet Delete it from your history and move to a non extradition country
|
# ? Dec 23, 2021 19:17 |
|
Are you asking how it works? Because it's most likely a bunch of gifs with the URLs of those gifs stored in two JS arrays and a timer to swap them out. Edit: That's exactly what it is. code:
KillHour fucked around with this message at 19:55 on Dec 23, 2021 |
# ? Dec 23, 2021 19:51 |
|
Don't forget the jquery include. It's a stretch to call it 'just javascript' at that point.
|
# ? Dec 23, 2021 20:43 |
|
Ranzear posted:Don't forget the jquery include. It's a stretch to call it 'just javascript' at that point. As someone who used to write ye olde jovascrypte, there's absolutely nothing interesting jQuery does he, unless that's your point in which case whoosh.
|
# ? Dec 23, 2021 22:18 |
|
Yeah that's all trivially replaced with vanilla.js.
|
# ? Dec 24, 2021 00:19 |
|
Volmarias posted:As someone who used to write ye olde jovascrypte, there's absolutely nothing interesting jQuery does he, unless that's your point in which case whoosh. Yeah, that, sorta. jQuery is overkill here if not plainly bloat, and this code doesn't work without it, and including it might not be obvious to someone asking about this. I meant it as a direct caveat for the posted code. It's trivial without jq, but still different enough to matter. There is nothing that rustles my jimmies like early programming courses teaching with jQuery.
|
# ? Dec 24, 2021 05:09 |
|
Ranzear posted:Yeah, that, sorta. jQuery is overkill here if not plainly bloat, and this code doesn't work without it, and including it might not be obvious to someone asking about this. I meant it as a direct caveat for the posted code. It's trivial without jq, but still different enough to matter. I mean, the first programming course I did taught us PHP 4. That may still have been the lesser sin, mind you. (And then we had the "socket programming on linux with C" course shortly after, in parallel with "Flash and ActionScript", IIRC. Fun few years.)
|
# ? Dec 25, 2021 00:45 |
|
Hey all, this hotel I’m trying to book with their reward points makes it so it’s like trying to get a PS5 or 3080. Basically I need to constantly check this page to see if the specific date I’m looking for switches to the 120k price point. Ideally this would be automated and I’d receive an alert if it becomes available. I see there are services and scripts geared towards finding things like graphics card stock but they don’t appear to work on this site. https://bit.ly/3Jmfrxg Any suggestions on where to start? I’m a total beginner but figure this could be at least an easy project.
|
# ? Dec 28, 2021 03:29 |
|
Oh that's kind of an ugly document - the nesting to get in to the value you want is what, fifteen levels deep? Anyway. I'd suggest using something like Greasemonkey, which is a tool for managing and writing custom javascript that runs on a page. You can then write some JS to check the value, sleep for a while, reload, and check again - and then alert you if it drops below your threshold. I've never used greasemonkey, though - I have no idea what sort of notifications are available, or how it handles page reloads. It's a decade old by now, so presumably there are some tools available? The actual scripting to pull out and compare the value is easy enough, if ugly. I'm using Firefox, but presumably you can do something similar in Chrome. First, get the xpath to the value you want to monitor: - Right click, inspect. This should pop up the inspector panel. - Press the box+arrow in the top left of the inspector panel, or press ctrl+shift+C. This should put you in item selector mode, where hovering over things will highlight them. Click the price on the day you're interested in. - This should highlight a line in the page source in the inspector panel - hopefully a line that ends with " 1,310,000</div>" or something like it. - Right click that line, then copy/XPath in the popup. This should copy an XPath selector for that element on the page - something like /html/body/div[1]/div/div/div/main/div/div/div[7]/div[2]/div[2]/div[1]/div. This is effectively the directions for how to get to that element, starting from the document root. With that, the code is effectively "get the element at that path, strip out the commas, and see if that number is small enough". I'm terrible at javascript, but something like this - though you obviously want to replace the path: code:
You can test that the above works by pasting it into the Console tab of the inspector. (You'll have to convince it that you're not just blindly pasting code from random people on the internet first - but it should be self-explanatory.) Computer viking fucked around with this message at 05:16 on Dec 28, 2021 |
# ? Dec 28, 2021 05:14 |
|
birds posted:Hey all, this hotel I’m trying to book with their reward points makes it so it’s like trying to get a PS5 or 3080. Are there any langs you're comfortable with? This would be a reasonably easy selenium + python that you could make a little task on your computer to run on login or something...each time you login it fires up a browser to check prices then does something to notify you if it finds what you want. This is basically the same as Computer viking's solution except python focused. Windows has a built in task manager for the running of the code that's straightforward. Could prob also make it auto open a chrome window too.
|
# ? Dec 28, 2021 05:29 |
|
I also quickly checked with my BF, who is the web person here. His suggestions: - Use violentMonkey, it's the still-opensource replacement for greasemonkey - Each day is a Button element. Those button elements contain both "which date is this about" (in a field called "data-testid") and a screen reader hint that contains the points value (aria-label) - This means you can use a querySelector to ask for "a button where the data-testid is a given date". Putting it all together, this mess pulls out the points value for the 6th: code:
He also insisted that you use a long refresh timer, like 30 minutes, just to be polite. And that you put in a sanity check of the type "if it's 2022, stop" - so it doesn't accidentally keep running forever. Computer viking fucked around with this message at 05:46 on Dec 28, 2021 |
# ? Dec 28, 2021 05:43 |
|
Can anyone recommend a really good primer/tutorial on creating a SQL database and linking it to a webapp? I've been working on web-based a board game using JS/React, and I think I have my core game and its mechanics all programmatically established, but I want to store a huge array of trivia questions/answers in a database that can be called from my javascript functions.
|
# ? Dec 29, 2021 23:24 |
|
I'm almost positive your idea of "huge" isn't too large for a JSON file.
|
# ? Dec 29, 2021 23:51 |
|
There are a lot of "better" ways to solve that problem but, since you asked specifically, the way to hook your webapp up to a database usually depends on the web server. It's abnormal to have client side javascript executing DB queries directly. In something like Flask, you follow the steps outlined in the documentation section labeled define and access the database. Rails has a similar pattern. How are you currently running server side code?
|
# ? Dec 29, 2021 23:58 |
|
KillHour posted:I'm almost positive your idea of "huge" isn't too large for a JSON file. AWS Lambda + a json file and some quick code to look poo poo up = an API made in 1 hour to return answers, infinitely scalable, costs nothing at the start. Then you dont have to learn anything about databases! AND NOT LEARNING IS HALF THE BATTLE!!!!! (I am no good at databases so I don't have a good answer, I use python/django + sqlalchemy/pandas for all my poo poo because I am a crappy coder.)
|
# ? Dec 29, 2021 23:59 |
|
Gin_Rummy posted:Can anyone recommend a really good primer/tutorial on creating a SQL database and linking it to a webapp? If you do want to go that way, you can piece it together yourself by looking at the python+database code separate from the Flask part: It's not hard to query a database from python. There's also a json package that makes it trivial to create json text from a python object, so the complete flow would be something like this: - receive a GET request on /question/ - Use SQL to get one or more rows from the database - Put the results in a suitable python object - probably a list where each entry is a dictionary that represents a question - Convert that to JSON text - return a HTTP response with the JSON as the body I'd use PostgreSQL as the database and the psycopg package in python to talk to it, but that is probably wildly overkill in this case - you may be better off with sqlite. It's also very common to use SQLAlchemy - it's a python package that abstracts away which specific database you're using, which is useful if you ever want to migrate. It also does ORM - basically, you create python classes that represent the database tables, and it generates the SQL queries for you in the background. It seems nice, but it is one more thing to learn. Then again, so is SQL. e: Django fills some of the same niche as Flask here, but it does a lot more for you, for good or bad. Which could be a good thing. Computer viking fucked around with this message at 00:26 on Dec 30, 2021 |
# ? Dec 30, 2021 00:21 |
|
Computer viking posted:I'd use python and Flask, which is a fairly simple framework for handling HTTP requests. Basically, you set up a python function to handle requests to a specific URL, use python code to talk to the database, and return JSON. However, it's hard to find a clean tutorial for that - they are all "how to orchestrate a docker image in the cloud while using this ORM layer to avoid writing SQL". This sounds like exactly what I am looking for. I guess I’ll just flip to the next CS50x video that covers Flask and see where that gets me, unless you know a better/quicker overview of the framework? In response to the rest, it’s probably true that a database is overkill for my application, but I’d rather learn this side of it now so I can flip right around apply that knowledge to bigger and better things.
|
# ? Dec 30, 2021 00:59 |
|
Try the quickstart, tutorial, and documentation from the flask project itself, it's not bad.
|
# ? Dec 30, 2021 01:08 |
|
Gin_Rummy posted:This sounds like exactly what I am looking for. I guess I’ll just flip to the next CS50x video that covers Flask and see where that gets me, unless you know a better/quicker overview of the framework? Go with sqllite for now. Trivial to setup (none to do) and you still have to learn SQL. Later you can go to bigger and more capable databases.
|
# ? Dec 30, 2021 01:31 |
|
Yeah, sqlite is great for this sort of thing. Postgres is a lot more work to set up, but also has some clear advantages - none of which matter at all for what you're doing.
|
# ? Dec 30, 2021 02:08 |
|
Computer viking posted:Yeah, sqlite is great for this sort of thing. Postgres is a lot more work to set up, but also has some clear advantages - none of which matter at all for what you're doing. What if I want to try a frinkiac-esque application as my next project? Would it be better to learn something like Postgres now on the easier/smaller scale concept to apply to that?
|
# ? Dec 30, 2021 03:11 |
|
Gin_Rummy posted:What if I want to try a frinkiac-esque application as my next project? Would it be better to learn something like Postgres now on the easier/smaller scale concept to apply to that? Unless you want to specialize as a DBA, you should stick to standard SQL and avoid the platform specific extensions. SQLite and Postgres both conform to standards. Just use SQLite until you have a measured reason to migrate to anything else.
|
# ? Dec 30, 2021 03:22 |
|
leper khan posted:Just use SQLite until you have a measured reason to migrate to anything else. This is excellent advice.
|
# ? Dec 30, 2021 08:50 |
|
Thanks all! I went with the Flask/SQLite approach and got a simple little database set up... but now I've hit a bit of a brick wall in how I actually link the React front end to my backend. I can't really find a good guide that doesn't seem to just jump right into all sorts of post/get/fetch request type stuff without really explaining what is going on. Anyone know a good starting point I could try to take a look at?
|
# ? Dec 31, 2021 03:11 |
|
Gin_Rummy posted:Thanks all! I went with the Flask/SQLite approach and got a simple little database set up... but now I've hit a bit of a brick wall in how I actually link the React front end to my backend. I can't really find a good guide that doesn't seem to just jump right into all sorts of post/get/fetch request type stuff without really explaining what is going on. Anyone know a good starting point I could try to take a look at? Flask is a web framework. You are using flask to expose web apis that return the data that your react app that they would want. Single page applications (e.g. react) communicate with the web server by making ajax requests to web apis. Say that say you have a react app that's intended to display a list of cars. In flask, you would make a web api that returns the data (maybe something like GET cars.) The react app would make an ajax request to GET the cars from this api, and display it on the page. Ask a question about the above and I might be able to direct you to a more appropriate resource.
|
# ? Dec 31, 2021 06:16 |
|
Bruegels Fuckbooks posted:Flask is a web framework. You are using flask to expose web apis that return the data that your react app that they would want. Single page applications (e.g. react) communicate with the web server by making ajax requests to web apis. So my Flask app creates a “template” page, which I assume is basically what my API would be, right? Right now I just have it listing everything one after the other, but I could give it some sort of JSON structure or something if I need to. Unrelated to that, I am also totally green on the “Ajax requests” bit of your post, if you have a good resource for that. Gin_Rummy fucked around with this message at 18:29 on Dec 31, 2021 |
# ? Dec 31, 2021 18:22 |
Your application would consist of two parts: 1) A client-side user interface (frontend), written in HTML and JavaScript, probably using some JS framework to make it all easier to manage. This part is how the user interacts with your app/game. 2) A server-side web service (backend), in your case written with Flask and more. This part has various functions, exposed via a web API, to get various data involved in your game, and maybe hold game state and verify the players are making valid plays. For example, it could have one endpoint that returns a random question to the client, and another endpoint where the client sends the question-id and player's answer and gets a response whether the answer was correct or not. If your game has players move via a dice roll, you might also want to put the dice rolling on the backend, to make sure the player can't influence the dice roll by modifying the client (and cheat that way). The backend might also hold a canonical version of the game state, which could be shared between multiple clients on multiple devices to allow remote multiplayer. When the client sends a "answer question" call, the backend could then not just tell the client whether it was correct, but also update the players' scores and update the client on the new scores or positions on the playing board.
|
|
# ? Dec 31, 2021 19:27 |
|
Gin_Rummy posted:So my Flask app creates a “template” page, which I assume is basically what my API would be, right? Right now I just have it listing everything one after the other, but I could give it some sort of JSON structure or something if I need to. Ok so let's start with the react side and ajax requests. This goes over the background of the ajax request and how javascript running in the browser uses ajax requests to get information. https://en.wikipedia.org/wiki/Ajax_(programming) Now we need understand how react is related to this concept: React is a framework for creating singe page applications https://en.wikipedia.org/wiki/Single-page_application So now that we know what react is, how do we use ajax with it? https://reactjs.org/docs/faq-ajax.html https://www.pluralsight.com/guides/how-to-handle-ajax-with-react Now let's go back to flask. The flask template page is basically "hey, I access this url, and it gives me back an entire website." That's sort of the web 1.0 way of doing things (like a cgi script) - flask exposes a url, you access it in the browser, flask makes the page, gives it back. React is different in that react isn't being served by the template page, it's a single page application living wherever it might go. You could think of it even as a different site. To communicate with flask, you as the developer write apis (just urls that expose the data, you could put [url]http://[/url][server]/[route] and see this list in the browser if you were so inclined) https://towardsdatascience.com/creating-restful-apis-using-flask-and-python-655bad51b24 So going back to the car example, if your react app wants to list the cars, you need an api that has a list of the cars in json. In flask, you make an api that if you access website/cars, it returns a json list of the cars (this would be accessible by going to a url on the webserver.) This list would come from code you wrote using flask querying the database and serializing the returned results. So summary - with flask, you're writing code that lists out the data that's accessible through a url. React (which is running in the browser) gets this data by accessing these urls using ajax requests.
|
# ? Dec 31, 2021 19:33 |
|
I never understood the micro framework thing. Eg Flask, its "blazingly-fast" alternatives that are now mostly unmaintained or any of its clones in Rust etc. To get it to do stuff most websites use, you need to bolt together third party components, and hope they all work together. Compatibility/depdendency-hell, and/or wheel reinvention. Django is much smoother once you get past the learning curve.
|
# ? Dec 31, 2021 19:42 |
|
Flask is great if you just want to write a layer that makes a database available over http - django feels like overkill if you're not doing much beyond that. Besides, I don't like ORMs, but that's more of a personal falling.
|
# ? Dec 31, 2021 20:23 |
|
|
# ? May 18, 2024 02:50 |
|
Flask makes sense for that case. My concern is geared towards websites. I also completely understand the not liking ORMs: They're DSLs. (Why not use and get good at the universal lang they all wrap?) And can do expensive queries if you're not careful. On the other hand, automatic migrations are sublime.
|
# ? Dec 31, 2021 20:26 |