site banner

Wellness Wednesday for July 5, 2023

The Wednesday Wellness threads are meant to encourage users to ask for and provide advice and motivation to improve their lives. It isn't intended as a 'containment thread' and any content which could go here could instead be posted in its own thread. You could post:

  • Requests for advice and / or encouragement. On basically any topic and for any scale of problem.

  • Updates to let us know how you are doing. This provides valuable feedback on past advice / encouragement and will hopefully make people feel a little more motivated to follow through. If you want to be reminded to post your update, see the post titled 'update reminders', below.

  • Advice. This can be in response to a request for advice or just something that you think could be generally useful for many people here.

  • Encouragement. Probably best directed at specific users, but if you feel like just encouraging people in general I don't think anyone is going to object. I don't think I really need to say this, but just to be clear; encouragement should have a generally positive tone and not shame people (if people feel that shame might be an effective tool for motivating people, please discuss this so we can form a group consensus on how to use it rather than just trying it).

1
Jump in the discussion.

No email address required.

Not a wellness question, but I don't want it to get lost in the old small scale question thread:

I've always been mildly interested in programming, but my formal training in it was only in the absolute basics of Javascript in school. We didn't even get to pointers in C, to give you an idea where I bottomed out.

However, my fondness for rat-adjacent spaces makes me probably one of the people who sorta somewhat understand programming concepts as much as possible without actually being able to code well.

I can mostly follow code or pseudocode, but I've noticed that programmers mostly leverage existing functions in libraries or APIs to massively abstract their work.

My issue is that I simply don't know most of the interesting functions that might be relevant if I have a specific concept in mind. I don't know whether there's an existing function I can call, let alone something I can import as a library, like math.js. I know that there's plenty unknown to me, and unknown unknowns I couldn't possibly estimate.

I can definitely ask GPT-4 about such things, but leaving it aside, how do I understand the options available to me as best as I can?

For example, when I look at a little of the code for the few ML models I've learned, it seems simple enough if you can abstract a lot of it. I simply don't know what to abstract.

How do I build this fundamental knowledge? I suspect it involves something I'd find mildly unpleasant like reading documentation, textbooks, or trawling through code on Github. But I'm asking just in case a more interesting alternative exists that I'm not aware of.

I'll pre-emptively tag @DaseindustriesLtd, because of course I will haha. But I know there are plenty of you programmers out there, don't be shy!

If it helps, I have the following concrete interests-

  1. Modding games. I'm aware reading documentation or code is mandatory here. I'm sure @ZorbaTHut would be mildly pleased to hear that I'd like to make small mods for Rimworld, especially if AI makes generating art assets easier.

  2. Small automation tasks on my PC. GPT is helpful here if I know what to ask.

  3. ML, just enough so I could apply it to medicine if I needed to. I'd like to think upskilling myself there might lead to more money if I can leverage my medical degree into a career involving it.

I'm not particularly qualified to answer but my opinion is that if you want to understand programming functions in their relation to ML, the best way would be to quickly get to creating ML artifacts. This means

  • learning python, we have tons of people here who've already commented on that. Introduction to Computation and Programming Using Python might be the best textbook now. Read in parallel with solving problems on Codewars.

  • listening to Karpathy's course Neural Networks: Zero to Hero and going through minGPT repo (or nanoGPT). His guide on building an LLM from scratch is probably the greatest single piece of education on Youtube (excepting, like, 10000 lectures of random Indians).

  • Fleuret's little book also covers the mathematical concepts behind those functions.

His guide on building an LLM from scratch is probably the greatest single piece of education on Youtube

Thank you for this.

Thank you!

Small automation tasks on my PC.

PyAutoGui for automating mouse/keyboard tasks (including browser), Selenium for more involved browser tasks (from Python or any language). A shmidge of bash/terminal/regex goes a very long way.

Thank you!

I'll be honest, I now totally just use GPT-4 for new APIs. It's like an order of magnitude faster than trying to grind my way through invariably-awful documentation.

Silly question, but have you seen anyone try to use GPT-4 to...create documentation? Maybe it'll write something that's better than what exists. (I'm not in programming, so I wouldn't know the limitations.)

I haven't, but it seems difficult; most of the hard part of documentation is capturing subtleties, and I'm not sure you can give GPT enough code for it to figure out what it needs to mention.

Improving documentation, though, that seems really possible, and in fact I think I'm going to try that out next time I rotate around to my library project.

There's awsdocsgpt.com, which is... Not terrible.

Something I've enjoyed recently is asking it for code reviews. You can ask it for basically a PRD for a small project using a new language or library, do an initial implementation asking questions of it along the way, and then have it give you feedback and iterate on your code to make it more idiomatic, catch you when you hit a common pitfall, use more advanced parts of the API, etc.

I would love to get to a point where I can just paste in a Github pull request link and have it review for me. Along with suggested changes.

  1. Learn the basics of python - 6.0.01x MIT Edx is a good fast starter

  2. Ask Chat GPT plus for everything else

The Chat GPT iteration process is:

  • Set up a vscode / python code interpreter

  • preferably setup jupyter notebooks in it

  • ask chat gpt something that has existed before its cut off date (which will be written at the bottom on the chatgpt website)

  • google the exact same thing to see if people are giving similar answers

  • either ways, copy paste the code chatgt gave you into the jupyter notebook

  • string it together with your python 101 knowledge with the other bits

  • run

  • Once it fails, tell chat gpt what you were trying to to and copy the entire ugly user message there

  • It will tell you how to fix it

  • If that fails, then ask google

  • Rinse and repeat until success

Source: non-programmer who switched into a career in CS at around 23.

Thank you, I'm certain this will come in handy! And if not, I've failed your advice through sheer laziness and not vice versa.

I feel you brother. Best of luck.

How do I build this fundamental knowledge? I suspect it involves something I'd find mildly unpleasant like reading documentation, textbooks, or trawling through code on Github.

bingo

I'd rather not take Ritalin to indulge in a new hobby, but it's better to have the delusions knocked out of me early haha.

It's not about knocking down delusions. You are putting the cart before the horse.

You are asking "I want to do X, how do I know about the tool that can do X". Which is always.. a Google search (or chatGPT in simple cases) away. The only difference between the people who know about the tool and those who don't is those who do, just iterated on that process a thousand times. There are cheatsheets out there as well, for the exceptionally impatient. But it sticks with you a 100 times more when you really struggle to do X, then you give up all hope and search for the the tool that does X, and X just works. You will remember till you're 6 feet under, as opposed to reading a cheat sheet.

Focus on doing X and the rest will come. It sounds cliche, but as someone who taught programming to a lot of college students, etc. Wanting to do X is actually the hard part! Don't waste the gift of wanting to do X.

If it helps, I have the following concrete interests-

  1. Modding games

If you're interested, we're working on a mod this very moment. Feel free to join.

I never really got into Starsector, and while I was mildly tempted to volunteer as a writer, I saw that someone was already on board.

For modding games take a look at dnSpy. It lets you open any .net assembly (compiled c# dll) and decompiles it into surprisingly readable code*. Comments and variable names are missing but class structures, method and attribute names are present so it's easy enough to tell what's going on with some digging. You can modify and recompile the code into a new assembly dll file.

This effectively means you can mod most games that use the Unity engine. In all the games I looked, Game_Data/Managed/Assembly-CSharp.dll will contain the game entry point, but larger games may sprawl out into their own assemblies that are referenced by this file. dnSpy should open those automatically.

I used this method to patch the recent Derail Valley update where they introduced a new difficulty system. I picked the "realistic" setting in a new game but found the teleport feature was limited to about two metres ahead, versus the twenty or so metres it used to be before. This feature is meant for VR to avoid motion sickness but I just use it walk faster between the train and track switches. I eventually traced it to a hardcoded class initializer for all the difficulties and modified one attribute (it was easiest to look at the IL assembly and change one instruction). Saved the assembly and now I was happily teleporting from one end of the train to the other in a tenth of the number of hops as before.

This method won't work if you see references to il2cpp as that's an optimization where the original assembly was turned into c++ code and compiled into native machine code. This is much harder to reverse engineer and is effectively impossible to meaningfully decompile as entire class structures and functions can disappear and type information is lost during compilation.

  • Curiously you can even pick between c#, visual basic and f# (iirc), as all three compile into Intermediate Language and can be decompiled back seamlessly, making them interchangeable. You can't even tell what the original source language was.

You can't even tell what the original source language was.

Maybe not if it was VB code, but F# code is obvious when decompiled into C#.

This seems a little advanced to me, especially since Rimworld only uses C# and XML, but I'll keep it in mind if my horizons expand! Thank you.

Rimworld specifically uses a lot of dnSpy, coupled with a tool called Harmony to patch code at runtime. I don't have a link to this, but go hunt down the Rimworld modders discord - I haven't been there in years but they were always a good bunch of people.

If you're doing something of the form "add new stuff to the game" then you won't need dnSpy/Harmony; if you're trying to change existing mechanics, you probably will.

I aim to start small and see if my appetite persists. I can always ask around in the Combat Extended discord server too, they're used to stretching the game's code fat beyond it's initial capabilities.

Obligatory plug, since it's been brought up: the Combat Extended lead developer is working on a standalone game.

(we've been chatting on Discord a ton, good guy)

I'm incredibly hurt that you'd think I haven't long been aware of Ascent of Ashes (I knew what you linked without opening it) ;)

Look, I'm a CE fan, and in our previous debates I've always stated how I feel more simulationist elements would make the game much better in my eyes.

For example, the recent Biotech DLC made my eyes bleed when I saw the implementation of "genetics" in it.

Hell, I even thought of pinging you when I saw this mod come out:

https://steamcommunity.com/sharedfiles/filedetails/?id=2996971119

I didn't, in the end, because I didn't want to unnecessarily disturb you (or I forgot haha), but as a junior doctor whose seniors have had to patch up the mess I've made of a minor procedure, god knows I appreciated it.

(Another thing that drives me up the wall is the inability to have multiple doctors perform procedures in parallel or cooperatively, from a gameplay perspective it would certainly make having more than 1 or 2 or them worth it, or multiple pawns working together at all)

I'm looking forward to AoA, though I have the minor gripes that I don't really like the art style, it's rather ugly even by indie standards. But I play Rimworld, so you can see where my priorities lie. I'd play just to have z-levels as a basic feature!

Hell, I even thought of pinging you when I saw this mod come out:

https://steamcommunity.com/sharedfiles/filedetails/?id=2996971119

Hah, entertaining. Hadn't thought of that one myself :D

From a gameplay standpoint . . . I dunno, one downside to stuff like this is that it makes it much easier to grind specific difficult jobs. It's kind of weird if you have a doctor just waiting for someone to get injured so they can chaintend them for the next three days straight, right? Maybe "xp is granted only for the first tend" but now we're adding weird unintuitive explanations to it. And this still cuts down a lot on the risk factor of choosing who gets tended with what medicine.

I think this might be an example of something that (1) doesn't result in good gameplay, and (2) isn't even necessarily realistic - like, if an apprentice doctor cleans a wound badly, well, it's possible they did damage that cannot be fixed, and if we're diving so deep into this that we're trying to simulate that as well then the question becomes "is this the best use of developer time or can we find something to work on with better bang for buck".

(Another thing that drives me up the wall is the inability to have multiple doctors perform procedures in parallel or cooperatively, from a gameplay perspective it would certainly make having more than 1 or 2 or them worth it, or multiple pawns working together at all)

This sort of thing might just be code complexity; Rimworld's job system doesn't really support "two people working on one project", and it's unclear if it would be worth building it just for something like this. (In this context, "actions on a specific character" is a project - the character is locked until the task is finished, so even "two people working on unrelated surgery jobs" would be hard to implement.)

I strongly suspect that in a counterfactual world where this had been the default implementation (with additional balancing), there would a clamoring crowd of precisely zero people who'd be advocating for the version Rimworld has today.

I can certainly think of trivial solutions, like a critical failure in tending exacerbating the wounds or progressing an infection (the latter is more dubious, but I can suspend my disbelief, if we assume that represents crappy quality of care spreading an infection to other parts of the body)

In this context, "actions on a specific character" is a project - the character is locked until the task is finished, so even "two people working on unrelated surgery jobs" would be hard to implement

From the Ideology DLC, it seems to me that there are mechanisms in place to make pawns gather at one spot and surround it.

I might be wrong, but I can see an implementation that simply has two or more doctor pawns standing at the bedside, throw up an interaction taskbar, and then have the process proceed according to a weighted value of their skills. It should certainly be sublinear and have diminishing returns with added pawns and medical skill, there's a reason we don't usually have 20 surgeons elbowing each other at work on a single patient haha.

The Biotech DLC sort of does this during childbirth with the midwife, and one bystander, usually the spouse, standing close by.

Now I'm no expert, if this thread hadn't revealed that, but unless the code is really spaghetti, it should be a tractable problem.

While I'm on it, I'd much rather diseases be of the communicable sort where possible, since I don't see how an isolated colony in the middle of nowhere can develop the flu or plague all at once. (I'd hate to see their Epidemiologists grapple with social distancing when Covid-5500 hits).

It could be a hidden hediff for visitors or traders, with a small chance of being spread.

But of course if I nitpicked every little detail in Rimworld that drove me up the wall, we'd be here all day. Suffice to say that I have 600+ mods of which I'd call 200+ "must haves", that should illustrate my degree of dissatisfaction with the base game haha.

Every programming language has a "standard library" of helper classes/functions/etc that are included with it, a library of loadable third-party modules that provide more stuff, and a way to specify and load those.

Python is a pretty good general-purpose language, and usually my first suggestion for what to learn for programming newbies. You can find the docs for the standard lib here - Python standard libs are known for being pretty comprehensive. Personally, I have trouble reading large volumes of docs that aren't relevant to anything I'm working on, so I recommend to anyone seeking to learn to just go ahead and install Python locally and start building things. Usually your 2 for local automation tasks and sometimes modding games are a good source of tasks that are simple enough to not overwhelm a newbie but still feel like you're accomplishing something useful.

I would suggest building some stuff using just the standard lib to get used to how to do things. Later on you can learn about how to find third-party packages, install them, and use their functionality.

First I definietly suggest using search enigne over GPT, search enigne most often lead you to existing Stack Overflow questions and people there while mean, often give good suggestions with detiles on why

On your interests, I myself is also a huge friend of 1 and 2, I do think there are hurdles on both, as you sated, modding require huge amount of reading documentation, and somethings even reading decompiled code, I myself make utility mods for my own QoL when playing Minecraft

On automation tasks, learn a common scripting language like Python then just automated the thing you want to be automated, while this xkcd is a very good reference on what not to automate, it is always worth spending extra time to learn how to automate things in general at first

For machine learning in particular and scientific computing more generally, you have the following extremely useful libraries, all in python, because that's the most common language here:

  1. Numpy, short for Numerical Python. This is a very deep library that does everything from numerical derivatives, integrals, matrix multiplication, everything in linear algebra, sorting arrays of numbers, and even simple linear regression. The main workhorse here is the "ndarray" datatype that numpy defines, which allows you to create an object which stores a multi-dimensional array of numbers very efficiently.

  2. Scipy, short for Scientific Python. This is an extension of numpy, which includes optimisation routines, solving differential equations, algebraic equations, etc. Less overwhelmingly used than numpy, but still very common

  3. Scikit-learn. This is the library to use if you want off-the-shelf classical machine learning algorithms, so anything outside of deep-learning stuff. Decision trees, linear/logistic regression, clustering, nearest neighbors, or whatever, this does basically all of it.

  4. matplotlib. This is the most common visualisation library to make graphs or charts. Endlessly customizable, and hence kind of a pain to use, but it's the most common and very useful.

  5. Pytorch. Now we're getting into deep learning and GPU computing. Pytorch essentially does much of the same job as Numpy, but it also automatically interfaces with your GPU, so that all your matrix multiplies are run much, much faster. This is the library you use to define your deep learning models, and the one you use to write your training code.

And so on and so on. There are other libraries like Pandas for data analysis, and all the huggingface libraries for deep learning, which get you even more abstraction, so that you can use transformers without even knowing. I don't think there is any more pleasant way of getting to know these libraries than reading a few textbooks and then inevitably drudging through their documentations when the need arises.

Thank you, I was afraid that was the case, but having the options clearly arrayed before me makes it far less daunting!

I suspect that my usual method of using GPT-4 will run into issues with a lot of newer techniques and functions falling outside the September 2021 knowledge cutoff. It's a fast moving field after all.

Hmm, basically all the libraries I listed except maybe for pytorch haven't changed all that much since 2021, gpt-4 should really still be very useful with all of them. What it will have trouble with is a library like "Transformer" by huggingface, which lets you automatically download and use pretrained deep learning models. But to even use a super-high-abstraction library like that one you still need a bunch of "glue skills" like knowing how to load a .png image from your computer into a format that the high-level functions can understand, and how to interpret and visualise the output of those high-level functions. GPT-4 would be amazing for all of that.

I think Transformers has been around. Langchain on the other hand...

That said, you can use search enabled GPT or bing for this stuff too.

But- I have noticed GPT will mess up when setting up ML models sometimes. Stuff like mixing up the ordering of dimensions. I wound up with a toy transformers model that was trying to learn a string reversal task using positional embeddings that were spread across batches instead of across tokens the other day. And on other tasks it has all sorts of other minor errors. The code usually compiles- but it doesn't always do what you thought you asked for.

It certainly gives you experience doing critical thinking with regards to code debugging though, while also doing a lot to help you learn new libraries. The loop goes from

Read Demos and example code and textbooks -> Write hopefully passable code -> Debug code

to

Have GPT4 write weird, buggy or technically correct but silly code -> Debug Code while asking GPT4/googling/inferring/testing what the functions do.

Which I much prefer.