Programming thread

Bootleggers use copy protection? Seems kind of hypocritical.
I imagine after disassembling and reverse engineering enough games, they'd come up with all these ideas in their head like "man, it'd be so much harder if you just did XYZ". So when it came time for them to do something they actually did all those things.

That said the game doesn't run at 60 FPS and would have probably ran faster if they didn't do all this round-about stuff.
 
Intellectual property isn't real. God bless these Taiwanese heros for bringing the CLASSIC Earthworm Jim 2 to the NES :semperfidelis:
 
  • Semper Fidelis
  • Agree
Reactions: Safir and FuckedUp
Am I retarded or does Rust have a pretty steep learning curve? My first language was Java and my workplace uses mostly Python and R. Maybe it's because I don't have a C/C++ background, but Rust seems unusually difficult compared to the most common "modern" languages.
 
Am I exceptional or does Rust have a pretty steep learning curve? My first language was Java and my workplace uses mostly Python and R. Maybe it's because I don't have a C/C++ background, but Rust seems unusually difficult compared to the most common "modern" languages.
Nah, I've used all those languages except R and Rust is definitely harder. It requires a bunch of extra rules to ensure the code is as foolproof as possible.
 
Nah, I've used all those languages except R and Rust is definitely harder. It requires a bunch of extra rules to ensure the code is as foolproof as possible.
Glad it's not just me. I've been applying new jobs and I thought learning Rust would help because it's a new and slightly difficult language. I'll probably just brush up on my Java skills or dive deeper into Python.
 
What framework or library would you recommend? I've used vanilla JavaScript and JQuery to build websites before, but that seems like old hat at this point.
Vanilla's probably fine. It's faster than any framework so I can't see why it wouldn't still be used.
 
  • Informative
Reactions: Angry Shoes
I've been working on learning Python for a project but I'm having a hard time finding exercises that aren't basic shit like "reverse this string", anyone have any ideas for shit I can practice with?
Edit: The most I've thought off for myself is web scraping a website for weather reports that are sent to my phone
 
  • Like
Reactions: Yotsubaaa
I've been working on learning Python for a project but I'm having a hard time finding exercises that aren't basic shit like "reverse this string", anyone have any ideas for shit I can practice with?
Edit: The most I've thought off for myself is web scraping a website for weather reports that are sent to my phone
Make a calculator. For added fun give it a web front-end.
 
I've been working on learning Python for a project but I'm having a hard time finding exercises that aren't basic shit like "reverse this string", anyone have any ideas for shit I can practice with?
Have you had a look at codecademy? Admittedly a lot of their Python code exercises start really basic, but they've got a whole lot of more of them there now for more advanced topics like working with statistics/machine learning, working with data structures and algorithms, and so on:
python_courses.png

Now it says 'Pro' and they'll try to charge for these. But here's the pro-tip (if you'll pardon the pun): when you create a (free!) account for the first time, they give you 7 days free access to any of the pro courses, and most of those advanced topics only have the Python/Python3 course as their prerequisite. So there's nothing stopping you from creating as many new accounts as you want with dummy email addresses, speedrunning the basic Python course, and then you've got a whole week to work through one of the other, more advanced courses.

Alternatively, and depending on how deep you want to go with it, a lot of the computer science courses on MIT OpenCourseWare use Python as their programming language. For instance, here's their Intro to Computer Science and Programming 6.0001 course that includes freely-available lecture videos, notes, and walk-through problem sets, e.g.
mit_pset.png

More advanced is their Introduction to Computational Thinking and Data Science 6.0002 course, with free video lectures, psets, etc that assumes a solid grasp of Python (as you would have by the end of 6.0001 for instance) and looks at some basic optimization and machine learning stuff. Or their Introduction to Algorithms 6.006 course, again with video lectures, psets, etc that uses Python to explore some more advanced algorithms/data structures. So all of those would give you plenty of interesting exercises and challenge problems to do, and at the same time doubles as an introduction/refresher on various useful algorithms/data structures.

However, all of that said:
Edit: The most I've thought off for myself is web scraping a website for weather reports that are sent to my phone
Make a calculator. For added fun give it a web front-end.
Really, and in my experience, the best way to exercise your skills with a language is to just pick a project and dive right in! @Angry Shoes' calculator suggestion is a classically great idea, particularly since you can easily break it up into well-defined steps that exercise various 'muscles' in your Python repertoire, e.g.
  1. First step: can we construct like a Calculator class (and properly document it, and write test cases, etc) and write a small command-line app that lets a user input numbers and operators and correctly returns the right result?
  2. Then when that's working, can we—using that same tried-and-tested Calculator class—extend and develop a simple GUI interface (e.g. using Tkinter) that lets a user press buttons and perform the same arithmetic operations that they could in the CLI program? (For bonus exercise, don't use a form editor like pygubu or anything: do it all programmatically! It's fun and not too hard: draw out on paper what this Calculator window has to look like, and then it's actually quite straightforward to work out exactly how you need to layout each of the graphical widgets. Then you just code that.)
  3. Then when that's good and working, can we use that same well tried-and-tested Calculator class and make a web app that runs on a (local) web server, that looks similar to the GUI one, and that also lets a user press buttons and perform the same arithmetic operations that they could in the CLI and GUI programs? (e.g. this gives you a perfect excuse to play with the Django framework in a low-stress, toy-application setting, but you could use something like Flask too).
The benefit of this sort of a structure is that each of those steps is totally self-contained. In Step 1 you work with the classes and data structures and functions that form the working backend of your program. Then in Step 2 you just need to focus on working with GUI widgets and event callbacks, since you (ideally) hammered out all of the arithmetic/logic/IO related issues in Step 1. Then in Step 3 you can focus all your attention on the web-dev side of things, since you would've (ideally) nailed down all the nuances of getting the buttons/viewing window working the way you want with the GUI stuff in Step 2.

So yeah, go for it! For your weather report scraper, perhaps break it up into the same sort of manageable, self-contained chunks that you build up into the final software app that you want. For example,
  1. Write a CLI program that can scrape data from a relatively well-behaved website and echo it to the command line (e.g. write a program that retrieves and regurgitates all this text that I've written in this Kiwi Farms post!)
  2. Then extend and write a CLI program/script that scrapes the specific weather report data that you want from your chosen weather site (which may or may not be straightforward depending on how much of a pain in the ass the weather website wants to be, which is why Step 1 is a more useful starting point for nailing down using Python to send/read http/database messages).
  3. Then once you've got a CLI script that you run and it goes and scrapes the correct weather report data, then extend the script so that instead of echoing it back, it sends it to you in a text/email/whatever.
  4. Then once you've got this script that you run and it blows up your phone with the current weather report, then look into automating running that script so it runs every morning or so.
 
What framework or library would you recommend? I've used vanilla JavaScript and JQuery to build websites before, but that seems like old hat at this point.
Angular. Sure it's actually in TypeScript, but that forces you to code better anyway and actually think about what you're doing.
 
Have you had a look at codecademy? Admittedly a lot of their Python code exercises start really basic, but they've got a whole lot of more of them there now for more advanced topics like working with statistics/machine learning, working with data structures and algorithms, and so on:
View attachment 1011849
Now it says 'Pro' and they'll try to charge for these. But here's the pro-tip (if you'll pardon the pun): when you create a (free!) account for the first time, they give you 7 days free access to any of the pro courses, and most of those advanced topics only have the Python/Python3 course as their prerequisite. So there's nothing stopping you from creating as many new accounts as you want with dummy email addresses, speedrunning the basic Python course, and then you've got a whole week to work through one of the other, more advanced courses.

Alternatively, and depending on how deep you want to go with it, a lot of the computer science courses on MIT OpenCourseWare use Python as their programming language. For instance, here's their Intro to Computer Science and Programming 6.0001 course that includes freely-available lecture videos, notes, and walk-through problem sets, e.g.
View attachment 1011851
More advanced is their Introduction to Computational Thinking and Data Science 6.0002 course, with free video lectures, psets, etc that assumes a solid grasp of Python (as you would have by the end of 6.0001 for instance) and looks at some basic optimization and machine learning stuff. Or their Introduction to Algorithms 6.006 course, again with video lectures, psets, etc that uses Python to explore some more advanced algorithms/data structures. So all of those would give you plenty of interesting exercises and challenge problems to do, and at the same time doubles as an introduction/refresher on various useful algorithms/data structures.

However, all of that said:


Really, and in my experience, the best way to exercise your skills with a language is to just pick a project and dive right in! @Angry Shoes' calculator suggestion is a classically great idea, particularly since you can easily break it up into well-defined steps that exercise various 'muscles' in your Python repertoire, e.g.
  1. First step: can we construct like a Calculator class (and properly document it, and write test cases, etc) and write a small command-line app that lets a user input numbers and operators and correctly returns the right result?
  2. Then when that's working, can we—using that same tried-and-tested Calculator class—extend and develop a simple GUI interface (e.g. using Tkinter) that lets a user press buttons and perform the same arithmetic operations that they could in the CLI program? (For bonus exercise, don't use a form editor like pygubu or anything: do it all programmatically! It's fun and not too hard: draw out on paper what this Calculator window has to look like, and then it's actually quite straightforward to work out exactly how you need to layout each of the graphical widgets. Then you just code that.)
  3. Then when that's good and working, can we use that same well tried-and-tested Calculator class and make a web app that runs on a (local) web server, that looks similar to the GUI one, and that also lets a user press buttons and perform the same arithmetic operations that they could in the CLI and GUI programs? (e.g. this gives you a perfect excuse to play with the Django framework in a low-stress, toy-application setting, but you could use something like Flask too).
The benefit of this sort of a structure is that each of those steps is totally self-contained. In Step 1 you work with the classes and data structures and functions that form the working backend of your program. Then in Step 2 you just need to focus on working with GUI widgets and event callbacks, since you (ideally) hammered out all of the arithmetic/logic/IO related issues in Step 1. Then in Step 3 you can focus all your attention on the web-dev side of things, since you would've (ideally) nailed down all the nuances of getting the buttons/viewing window working the way you want with the GUI stuff in Step 2.

So yeah, go for it! For your weather report scraper, perhaps break it up into the same sort of manageable, self-contained chunks that you build up into the final software app that you want. For example,
  1. Write a CLI program that can scrape data from a relatively well-behaved website and echo it to the command line (e.g. write a program that retrieves and regurgitates all this text that I've written in this Kiwi Farms post!)
  2. Then extend and write a CLI program/script that scrapes the specific weather report data that you want from your chosen weather site (which may or may not be straightforward depending on how much of a pain in the ass the weather website wants to be, which is why Step 1 is a more useful starting point for nailing down using Python to send/read http/database messages).
  3. Then once you've got a CLI script that you run and it goes and scrapes the correct weather report data, then extend the script so that instead of echoing it back, it sends it to you in a text/email/whatever.
  4. Then once you've got this script that you run and it blows up your phone with the current weather report, then look into automating running that script so it runs every morning or so.
Thanks, I really appreciate it. This gives me a great head start.
 
  • Like
Reactions: Yotsubaaa
I've been working on learning Python for a project but I'm having a hard time finding exercises that aren't basic shit like "reverse this string", anyone have any ideas for shit I can practice with?
Edit: The most I've thought off for myself is web scraping a website for weather reports that are sent to my phone
Write a HTTP REST API using Flask, maybe something that scrapes and allows you to query it. It's a pretty "real-life" exercise.
 
Write a HTTP REST API using Flask, maybe something that scrapes and allows you to query it. It's a pretty "real-life" exercise.
So basically your ERA ban bot? I remember you posting work-in-progress Python code for that in the thread.
 
Back