|
Cyril Sneer posted:Hey guys. To what extend can these various web frameworks be used to control local hardware? If Python code can run the hardware, you can very easily call whatever function you’ve already written. Computer hardware is cheap compared to technician time so I’m assuming you’re putting a dedicated laptop on the hardware. There’s a gotcha to this if you’re new which is timeout. You can make long running calls, but they should return something before the timeout. Typical timeouts are 10s-30s. Obvs then you can poll for status or push when the long running action is complete. Dash is basically tailor made for this. It has some long running process functionality built in CarForumPoster fucked around with this message at 22:23 on Jul 5, 2023 |
# ¿ Jul 5, 2023 22:17 |
|
|
# ¿ May 14, 2024 13:06 |
|
Cyril Sneer posted:No, there aren't dedicated laptops attached to each machine. Yes, it would be easy if that was the case - hence the question. Could you draw a use diagram that has these components and some idea of what scripts are where? It sounds like the current state of affairs is this: And what you want is...??this?? IDGI, provide the specifics. What problem you tryin to solve, what does success look like?
|
# ¿ Jul 5, 2023 23:57 |
|
pmchem posted:what's the easiest way to plot county-by-county geographic data in python these days along with some good data sources? I haven’t looked in three years but back then county by county was a bitch. I think I ended up doing it by zip assigning certain zip codes to certain counties based on a spreadsheet I found of that. IIRC some zips spam multiple counties but it was good enough for the problem I had then.
|
# ¿ Jul 10, 2023 23:20 |
|
Falcon2001 posted:I haven't used PyCharm in a while but in general, I'll at least reassure you that sometimes debugger setups are kind of weird and not well explained and cause more consternation than most new devs are expecting. Seems like all Python IDEs debugging of .py files are so bad that it inspired someone to make jupyter
|
# ¿ Aug 17, 2023 04:05 |
|
Falcon2001 posted:Ehhhh Jupiter is a very different beast and has a lot more to do with cached cell by cell execution, etc.
|
# ¿ Aug 17, 2023 04:15 |
|
StumblyWumbly posted:Just today, I put in the most basic rear end updates into some code I wrote like a year ago. The file already had the most basic testing possible in it, and I saw it and said "sure, I guess I'll check my work" and found like 3 errors. At what point in the coding journey do you transition from "there no coder worse than me, 6 months ago" to "old me was my hero"
|
# ¿ Sep 1, 2023 04:18 |
|
Falcon2001 posted:This implies a one way path when in reality Previous Me is the best and worst of all possible futures; a superstate composed upon itself and containing all dread and terror and wonder at once. But mostly, he's just a jerk. Schrodinger's code its only once the code is deployed to prod do you know whether previous you is good or bad
|
# ¿ Sep 1, 2023 04:55 |
|
Generic Monk posted:Good point lmao @ being a dude with the github name "poison womb"
|
# ¿ Sep 2, 2023 21:18 |
|
Chillmatic posted:That's amazing idk what you're talkin about Im talking about how good of a github user name it is a lot to very
|
# ¿ Sep 2, 2023 21:39 |
|
Selenium raises whenever an element isn’t present in a web page so try except NoSuchElementException is basically if/then. It’s normal to verify something ISNT there by passing or suppressing.
|
# ¿ Oct 3, 2023 14:01 |
|
Jose Cuervo posted:I want to make sure that a string that is passed in has the year-month format 'yyyy-mm'. So for example, '2022-09' would work or even '2022-9', but not '2022 09' or '22-09' etc. Should I be trying to use a regular expression for this? This seemed like a fun thing to pass to ChatGPT, so I asked for three ways it could be done because two seemed obvious: regex and datetime. It found a third and that other way ended up being the fastest (according to ChatGPT Advanced Data Analytics Plugin, I didnt test it) code:
code:
|
# ¿ Oct 6, 2023 03:56 |
|
Zugzwang posted:I might check it out, thanks. ChatGPT with GPT4 does decent with very tailored matplotlib made over several prompts if you end up in that edge case where seaborn and plotly don’t let you customize quite how you want. I’ve done this when making specifically shaped and annotate histograms for example.
|
# ¿ Oct 19, 2023 12:10 |
|
StumblyWumbly posted:Also it seems like the kind of thing chatgpt would be good at, but I have not tested that Its better than me, but thats not hard.
|
# ¿ Oct 21, 2023 13:14 |
|
TasogareNoKagi posted:Guess I won't be using Django then. Why would you use composite keys (idk poo poo about DBs)
|
# ¿ Nov 4, 2023 11:58 |
|
His Divine Shadow posted:Well I wrote my first small python app. I almost broke my brain with Oauth2, problem was microsofts backend, god I hate MS. In the end it was not possible to get imap/smtp working so I had to use microsoft.graph and that worked. As someone who has hated themselves for this: if you have to rotate your app's credentials in Azure AD PUT THAT ON YOUR CALENDAR RIGHT NOW.
|
# ¿ Nov 22, 2023 05:59 |
|
onionradish posted:Speaking of OAuth, is there an easy way or recommended module that will allow a Windows PC to respond to the callback to get a token after passing in the initial key to an arbitrary service? Im not 100% sure I understand the ? If you need to refresh tokens on some interval on windows just schedule a task to run every n minutes. If this is a PC that is intermittently on such that tokens may expire in that time, you'll need to have some scheduled or always on thing handle that, such as a AWS Lambda and/or a Zapier task. Lambda + Zapier make easy work of this if you dont wanna gently caress with configuring a Lambda to be able to reach the public internet. Or is the callback you're referring to in this case requesting a user browse to a web page and log in? EDIT: I forgot that you prob have to register a URL to make this request, and I am assuming that they won't let you register localhost. Yea, try Zapier they might have something for this use case. Otherwise AWS lambda set up with Zappa should give you an API Gateway that you can register and would cost nothing for infrequent use. CarForumPoster fucked around with this message at 04:52 on Nov 23, 2023 |
# ¿ Nov 23, 2023 04:47 |
|
It looks like zapier might already have a pocket integration in which case you don’t need to worry about any of this. https://zapier.com/apps/pocket/integrations Send your stuff wherever you want like a Google sheet, MS Teams, or use webhooks to make your own api.
|
# ¿ Nov 24, 2023 16:44 |
|
The Fool posted:tangentially related, is there a good way to generate a requirements.txt that only has what is being imported in my working directory and not everything in my entire environment Requirements.txt is usually made by pip freeze or by hand as you install stuff so you can maintain orders and versions. What’s being imported doesn’t necessarily have 1:1 naming with the package name on pip. So maybe, but there’s likely going to be a lot of issues with that a year or two from now if the environment needs to get reinstalled.
|
# ¿ Jan 22, 2024 19:48 |
|
StumblyWumbly posted:Is using docker to do builds with pyinstaller a dumb idea or a great idea? Ive only ever pip installed my requirements in the container's dockerfile but is always for AWS Lambda.
|
# ¿ Feb 13, 2024 21:31 |
|
Oysters Autobio posted:Any pandas experts here? Stupid simple option if they’re grouped in order Get list of your categories Save it as a CSV Use the category list to break it into chunks for each category. Make each chunk df, adding a column for the category pd.concat Otherwise I’d try to read the excel spreadsheet such that the index is ordered numerically and get the indexes that contain the categories (eg by filtering to where the other columns have nans) then just map the category to its applicable data rows between each category
|
# ¿ Feb 22, 2024 05:47 |
|
Oysters Autobio posted:Just getting into learning flask and my only real question is how people generally start on their HTML templates. Are folks just handwriting these? Or am I missing something here with flask? If your goal is to make dashboards or web apps with a few pages for internal tools I highly recommend Dash. No HTML, Python objects only including a Markdown object which makes things more readable than templates imo. Theres a well supported Bootstrap package called dash bootstrap components which gives you pretty bootstrap things and has a Bootstap navbar. I wouldn’t consider it any more opinionated than Flask, which doesn’t mean none, certainly no where near Django. No need for Jinja because again, Python only. CarForumPoster fucked around with this message at 22:11 on Mar 19, 2024 |
# ¿ Mar 19, 2024 22:08 |
|
Oysters Autobio posted:Would it be odd to use data frames (pandas, polars etc) for non dataset/table related functions? Like I'm making a generic Flask app and I move and manipulate the data around with pandas data frames, transforms with map-apply style functions etc? Or would this really make it an unreadable mess for others? That’s fine
|
# ¿ Mar 23, 2024 23:15 |
|
Fender posted:Chiming in about how someone gets wormy brains to the point where they use lxml. In short, fintech startup-land. I use lxml when needing to iterate over huge lists via xPaths from scraped data. Seems to be the fastest and it ain’t that hard. Selenium is slow at finding elements via xpath when you start needing to find hundreds of individual elements. Also if you’re using selenium, lxml code can kinda look similar. I spent multiple years writing and maintaining web scrapers and basically never used BS4. CarForumPoster fucked around with this message at 10:13 on Apr 5, 2024 |
# ¿ Apr 5, 2024 10:10 |
|
Falcon2001 posted:Data classes rule. Use them everywhere. I’ve met like three functions that should be a class.
|
# ¿ Apr 26, 2024 20:35 |
|
|
# ¿ May 14, 2024 13:06 |
|
Chillmatic posted:I wrote a script to get all the xml files from the show in question, and then iterate through them using the intro marker data in those xml files to decide where to make the edits using ffmpeg, except now I'm running into losing the subtitles from the original files, and converting them is a whole thing because they're PGS format. Comedy option: Send the edited files to OpenAIs whisper API and let them create new transcripts for you!
|
# ¿ May 1, 2024 04:14 |