The Joys Of Programming

Malor wrote:
tuffalobuffalo wrote:
Malor wrote:
Stele wrote:

Tuffalo has books? :drool:

He may be the world's first literate buffalo.

I try! :)

Well, we know why the books are damaged.

muraii wrote:

I also did that RU Coursera Python course and still have links to my code. It was wonderful.

This is the latest version of the code I've got a link to. The course was a treat and I enjoyed seeing others' approaches, which as someone mentioned is now more of a premium feature than when I took the course. The instructors provided licensed assets for the Asteroids clone. Great experience.

Rice Rocks (Asteroids clone).

blackanchor wrote:

I am interested in learning Python with no experience in programming. There is an endless amount of information on the web and sites to learn programming (Codecademy, Dataquest, etc). I have considered joining one of these sites to learn but reviews on them vary from great to don't bother. I have also considered buying a book to learn the basics and then move on from there. Any advise for someone looking to learn Python.

Hi, blackanchor

I've recently completed a couple of basic courses, and I'm happy to share my experience. I've taken 'Python for Everybody' on Coursera and 'Learn Python 3' on Codeacademy. I've also picked up a book of coding hints and tips.

I'd recommend 'Python for Everybody'. It's well-taught and uses video lectures, video worked examples, quizzes and graded assignments. There's also an e-book that accompanies the course.

'Learn Python 3' is essentially a series of worked examples, quizzes and assignments. There's no real teaching. The course feels less well-designed (e.g it throws in a section on 'classes' near the end that is poorly explained and comes out of nowhere). The worked examples are not given a proper context, which makes it hard sometimes to understand what you're doing and why?

However, I found it useful as a way of building my understanding through repetition, following PY4E. I wouldn't do that course on its own though.

In terms of cost, PY4E costs me £20 per month. I can quit any time. Access to Learn Python 3 is via Code Academy £200 per year.

Picking up on Malor's point about keeping local copies of your code, PY4E encourages you to do just this by advising you to download text editors and some basic SQL database software. There's also a fair amount of sample code on the tutor's website.

What I'm currently struggling with is my next step. I think that I'll be best served by another slightly more advance course, and then a few hobby projects of my own to practice with. My first little project is to pull some NFL-related html data off a website, clean it, then store it in a database then visualize it.

Does anyone have any advice on a follow-up course? And what other small projects might I consider at this novice stage?

My first little project is to pull some NFL-related html data off a website, clean it, then store it in a database then visualize it.

This is a good project. It's already broken a big project into medium parts, which is sometimes half the battle. If it was my brain on the line, I'd avoid looking for a next next project until the first one is complete. Your brain my vary.

At some point you want to pick up the basics of git. It's pretty much mandatory for collaborative projects, and even if you're sticking to solo stuff having a basic git proficiency helps perusing other peoples code efficiently.

A resource I found very valuable early on was Euler Project. It's just a lot of hard, mathy problems, sorted in difficulty by percentage of users who succeeded. I figure a part of learning programming is building mental callouses. Might as well do so with overt masochism. Dig deep enough and you're "learning" datastructures by needing and inventing them - best kind of learning.

Danjo Olivaw wrote:

A resource I found very valuable early on was Euler Project. It's just a lot of hard, mathy problems, sorted in difficulty by percentage of users who succeeded. I figure a part of learning programming is building mental callouses. Might as well do so with overt masochism. Dig deep enough and you're "learning" datastructures by needing and inventing them - best kind of learning.

If - like me - you like to solve problems, this is great website! Having dipped into a bunch of the problems I can already see the onion rings:

- how to solve the problem using brute force
- are there a better algorithms that will cut computing time down?
- even if there are, is it worth the time to finesse them or will that take longer than the brute force method anyway?

Not to mention what's the best tool to use...

I've made an account and may start to tick a few off...

IMAGE(https://imgs.xkcd.com/comics/old_days_2_2x.png)

The Pragmatic Bookshelf is looking for technical reviewers for an upcoming book: Native Apple Game Development with Swift.

More details here: https://forum.devtalk.com/t/technical-reviewers-needed-game-dev-book/1019

If we have a thread dedicated to game-dev then please kindly point the way and I'll cross-post there.

I've got an actual programming question, and hopefully it doesn't make me sound like a crazy person, because it's somewhat unusual I think. I'm using Unity (the game engine) in part, but that's not super important to the question. I'll try to keep it short.

Essentially what I'm trying to do is run a Python script from C# code, and get feedback as the script is going. It is not a short-running Python script - I'm performing a training on a neural network, so execution time could range anywhere from a few minutes to multiple hours.

There are a couple ways to do this and I've managed to get both to work, in the sense that the Python script runs and does what it is supposed to do. The problem is the feedback. If I just run the script as a Process and literally execute "python.exe" the C# of course stops completely until the script is done, after which all the things the script prints to the console pop out at the same time. If I run the Process in a separate thread, the C# code (the UI) keeps working, but I still don't get the console output until the script has completed. I can't know what is happening with the Python script until it's done.

I'm almost positive my problem is thread related. The script is being run on its own thread, and the UI thread can't know what's happening until the script thread is totally done. I've tried various things like Unity's event system, but that doesn't work. In fact, I can't even print anything to the console from the Python thread - it just shows nothing until the Python script is completely done, then dumps it all at once. Is it even possible to know what's happening in a separate thread as its running and before it completes?

Is https://stackoverflow.com/questions/... much help?

There is also https://docs.unity3d.com/2020.2/Docu..., though I'm not sure if that is directly relevant.

Never used Python or Unity so this is a shot in the dark, but maybe you need to flush the output on Python side? If so, then this might do the trick.

That's assuming that Unity is getting the python log output via stdout; if something more complicated is going on then maybe there's a similar but Unity-specific thing to be done.

I had actually found that async interface for Python post myself, or actually a very similar one that did the same thing, and that did not work. The Process OutputDataReceived didn't do anything while the script was running, either to print to the Unity console or even just to send an event. Everything that would have been printed or sent via an event just dumped all at once when the script ended.

I have tried running it async similar to the Unity docs there, but not exactly the same, so I'll try that too and see what happens.

I didn't know about the Python flush argument to print. I'll give that a shot. I hope it's something that simple!

I've tried doing all this with the Unity Job system, which is something fairly new and is their sort of special safe multithreading solution, but it does the same thing as everything else. Thanks for the suggestions absurddoctor and fenomas!

fenomas you beautiful genius! Just the simple output flush solved it. I can't believe it was so simple. I've spent literally hours trying to figure out a way to get that to work, and all it took was an extra little option set to true on the Python print command. What even is programming?

Haha! My secret is that I'm old, and I've banged my head on that wall a time or two ✌

Danjo Olivaw wrote:

A resource I found very valuable early on was Euler Project. It's just a lot of hard, mathy problems, sorted in difficulty by percentage of users who succeeded. I figure a part of learning programming is building mental callouses. Might as well do so with overt masochism. Dig deep enough and you're "learning" datastructures by needing and inventing them - best kind of learning.

Similarly I love to shill for codingame.com. It is a similar idea to Euler Project, but also has multi player programming games and a really cool visualizer built in. Great community, too.

As for home projects, I tend to write things that help organize my computer files, like photos or backups.

In other news I'm trying to get better about actually telling anyone about the projects I make, so:

wafxr - sound effects for the web

It got five whole upvotes on hacker news so you know it's good.

Pretty neat! It's fun to hit the button over and over to get random sounds. Ended up with one that sounded almost exactly like the Mario get-a-coin sound.

fenomas wrote:

Haha! My secret is that I'm old, and I've banged my head on that wall a time or two ✌

Yep. When I get stuck and ask the senior devs on my team, they always seem to have an idea. 10 more years and maybe I'll know some stuff too.

Mixolyde wrote:

Similarly I love to shill for codingame.com. It is a similar idea to Euler Project, but also has multi player programming games and a really cool visualizer built in. Great community, too.

Yes, very cool. Not sure I like the locked in IDE (though I get why it's like that), but I really like the "write bots to fight other people's bots" along with the leagues. I think I may dip my toes into Ruby using the site.

d4m0 wrote:

Pretty neat! It's fun to hit the button over and over to get random sounds. Ended up with one that sounded almost exactly like the Mario get-a-coin sound.

Yeah, when I got started with programmatic audio i quickly realized how simple game sound effects from that era were. If you take the simplest possible ingredients and combine them in the simplest ways, you usually wind up recreating an iconic sound from one classic game or another.

Moggy wrote:
Mixolyde wrote:

Similarly I love to shill for codingame.com. It is a similar idea to Euler Project, but also has multi player programming games and a really cool visualizer built in. Great community, too.

Yes, very cool. Not sure I like the locked in IDE (though I get why it's like that), but I really like the "write bots to fight other people's bots" along with the leagues. I think I may dip my toes into Ruby using the site.

Lots of people use plugins to sync the IDE with some local file they work on in their own IDE. I make do with the VIM style keyboard controls.

Yesterday I learned from HN that the "My" in "MySQL" is the name of the creator's daughter, and has no connection to the English possessive.

Then I tweeted that (in Japanese), and for whatever random reason I got retweeted 1.5K times over the rest of the day.

Anyway I'm famous now. AMA about the experience and I'll have one of my assistants send you a personalized reply.

Wait til you read up on MariaDB!!

I think part of why my tweet went viral was (A) the large number of people who replied to say that MariaDB is named after the guy's other kid, and (B) the large number of people who replied to them to say that MaxDB is named after the guy's other other kid.

And ThatCheatingDB was named after his ex-wife.

PS, kidding.

astralplaydoh wrote:

And ThatCheatingDB was named after his ex-wife.

PS, kidding.

And NotMySQL...

fenomas wrote:

Yesterday I learned from HN that the "My" in "MySQL" is the name of the creator's daughter, and has no connection to the English possessive.

Then I tweeted that (in Japanese), and for whatever random reason I got retweeted 1.5K times over the rest of the day.

Anyway I'm famous now. AMA about the experience and I'll have one of my assistants send you a personalized reply.

Don't forget to advertise your SoundCloud.

(I don't really know what that is, but it's what you're supposed to do when a tweet goes viral.)

fenomas wrote:

Yesterday I learned from HN that the "My" in "MySQL" is the name of the creator's daughter

How cruel. Imagine your dad telling the world that your memory silently corrupts.

Quintin_Stone wrote:

Don't forget to advertise your SoundCloud.

I added a reply like: "I don't have the customary soundcloud, but instead check out my voxel game engine!", and folks were polite enough not to ask what the hell I was talking about.

It's over 2K retweets now, which is weird. And a whopping... 6 replies. That's Japanese twitter for ya

Hey, voxels were pretty nice before everyone went nuts over triangles. The original Comanche was one of my favorites.

From JP twitter:

"Please use a mask."
"How many bits?"
"..what?"
"..what?"