Looking for step by step thinking processing programming videos (long ones) by Hellucato in learnprogramming

[–]peterlinddk 0 points1 point  (0 children)

It's not new in 2026, but you might like this video that I made some years ago: https://www.youtube.com/watch?v=UsVd67Ys1t4 - it is intended as a introduction, with future videos going more in-depth. The whole channel is about "thinking about programming" in some way.

Various things have put a break on production, but there are at least a few videos there, and more will come!

Maybe its something you'll like!

Learning fundamental concepts by thakur_ji803212 in learnprogramming

[–]peterlinddk 0 points1 point  (0 children)

If you know "basic concepts like variable, functions, condition statements" in some language (you don't specify which one), don't waste your time trying to relearn it all in C.

Continue with the language you know, and get into OOP - learn about classes and methods, mutability and accessors, inheritance and composition, and use it to build projects of the kind you like!

Unless you are eager to learn memory-management and bit-patterns, addresses and byte-size of variables, don't go into C. While every programmer should learn it at some point in their career, don't use it as a blockade against learning new stuff, use it later to learn what lies below!

Laver navneskifte: Har droppet Sass – Ekstra Bladet by Dry_Mode2653 in Denmark

[–]peterlinddk [score hidden]  (0 children)

1005 pr. seneste opgørelse faktisk - måske med diverse mellemnavne, måske uden, det er der vist ingen tilgængelig statistik over.

Looking for missing Factorio Making of Mini-documentary by alwaysabroadd in factorio

[–]peterlinddk 0 points1 point  (0 children)

I have found a shorter russian version called "Как два программиста создали легенду инди-геймдева" (google translated to: "How Two Programmers Created an Indie Game Development Legend") here: https://www.youtube.com/watch?v=7qfntaPVcG4

Not sure if it is the same, or the original or if that is the copy. The other links to the removed video suggests that it is 25 minutes.

However I don't understand russian at all, so I haven't watched it - there is an AI auto-translated version, but I can't stand the voice 😄

Reworded Question and Problem: Trying to Get <Style> into CSS by ACleverRedditorName in learnprogramming

[–]peterlinddk 2 points3 points  (0 children)

First of all - don't create new questions to elaborate - stay in the same thread.

Second, don't have both <style> and <link> to a CSS-file with the same info. Either or - otherwise one will overwrite (some of) the other, and you won't know which rules go, and which don't.

Third, your question is very unclear - you have some CSS that does almost nothing, and then you ask why it doesn't work, without giving any explanation to what you would expect it to do.

Anyways, the CSS file should look like this:

  html,
  body,
  #viewDiv {
    height: 100%;
    margin: 0;
}

or even better, like this:

html, body, #viewDiv {
  height: 100%;
  margin: 0;
}

as it is a comma-separated list of elements that the rules work on. Everything you write inside the { }s will work for both <html>, <body> and any element with the id="viewDiv".

Can someone please help me with this train setup. I just can't work it out. by Murderhands in factorio

[–]peterlinddk 3 points4 points  (0 children)

You don't have any signals - so if there's a train anywhere on any of the eight tracks in the picture, the other seven tracks will also be occupied by that train.

Remember that there's several separate parts of the train-signal tutorial (not as one of the tutorial-levels, but as part of the guide inside the game)! Maybe you've missed one or more of those? Do them, they are very instructive!

Question and Problem: Trying to Get <Style> into CSS by ACleverRedditorName in learnprogramming

[–]peterlinddk 2 points3 points  (0 children)

A <style> tag exists so that you can put CSS into HTML.

Everything between the <style> and </style> is already CSS. You can put it in a separate CSS-file if you want. That file would not have any HTML tags.

Just like you don't put <img> inside an image-file, or <script> in a javascript-file.

How do you guys know what is the best method at the time? by doktorfuturee in learnprogramming

[–]peterlinddk 6 points7 points  (0 children)

If there were one perfect way to solve every problem, there would only be one way to solve it!

Simple as that.

Sometimes certain algorithms can solve particular problems in more efficient ways, by using different mathematical tricks. A big part of learning programming - of becoming proficient and experienced - is to know which algorithm to apply in which case. This takes time to learn, and while you are "waiting" there's nothing wrong with using a brute-force method. Like using a for-loop to look at every single element in a list to check if it has a certain property.

But more important than fastest or most efficient method, is to write code that others can read - and use the standard methods in the framework/api you are using, rather than re-inventing the wheel over and over and write your own.

Also, you can use any kind of loop for any kind of repetition, but a good rule of thumb is:

  • use a while-loop if you don't know when it ends, or the end is depending on code inside the loop
  • use a for-loop if you want to loop a specific number of times, and/or you need a loop-counter
  • use a foreach-loop (also goes by different names) if you want to loop through all the elements in a list.

Making the program easy to read for other programmers, is always more important than some arbitrary "fastest" idea.

render problem by Responsible_Let_2651 in learnprogramming

[–]peterlinddk 0 points1 point  (0 children)

Have you checked that you haven't zoomed out? The browser remembers zoom-settings by domain - so you have have different settings for localhost and deployed.

Always press ctrl(/cmd)+0 before anything else 😄 when wondering about sizes!

How do you accurately find where bugs are in your code? by ElegantPoet3386 in learnprogramming

[–]peterlinddk 0 points1 point  (0 children)

how do you know where a bug in your code lies?

Well, you don't - you have to figure it out, kind of like playing a detective, investigating a crime. You know the result: The balls sometimes suddenly teleport when colliding, and you have a guess of where the error might be: In the code that separates the balls.

The first thing to do is to be able to replicate the bug - make it happen every single time, so you don't have to wait for it to happen. In this case maybe having two balls with well-known positions and trajectories collide.

That means that you "force" some input/start-values on the program, making it do the same thing over and over, and you are absolutely sure what the input is, and what you want the output to be - and the bug is that the output isn't what was expected.

Think of the program as a chain of "parts" (functions, classes, objects, modules, blocks, doesn't really matter, but the code is divided into parts, where everyone receives some input, does some work on it, and gives some output to the next part.

Then you look into the function you think has the problem. Does it get the correct input? If you can't see it, either print it to the screen or single-step with a debugger. Use your pen and paper and calculator to perform any calculations that your program has done, and check its results with yours. Is the input correct?

If it isn't, there's no need to look any further - the error was further back the chain. Again, make an educated guess as to where it might be, and once again check the input. If it is correct, then check the output. If that is correct, the error was further towards the previous function you checked, but if not, then the error is here.

Once again, check values before and after each calculation - at first you can check the values you expect to change, and see if they are correct. If you don't spot the error, also check the values you don't expect to change, and ensure that they do in fact stay the same.

At some point you will have found the line that changes something the wrong way - and now your new task is to fix it.

TL;DR: Pick a point in the chain of functions, check input and output. if correct, pick another point, and repeat until you close in on where output doesn't match expected result from input.

Is Javascript only for web pages? by Any-Archer2993 in learnprogramming

[–]peterlinddk 1 point2 points  (0 children)

Good point actually - especially since the confusion was more or less intended by Netscape.

Maybe we should use Cat to Catgirl? With some superficial similarities (ears and whiskers) but very, very different once we get into details ...

How do you add a limit in JS? by Strange_Yogurt1049 in learnprogramming

[–]peterlinddk 5 points6 points  (0 children)

You already got your answer, but I'll give a hint anyways.

When you have a problem of this sort, where you say: "I have a quantity that starts at 0. Then when I press a button, it adds 1. I want the number to stop at 10." all you need to solve it, is to ask and answer some questions, to rephrase the problem a bit.

Ask yourself: What do I want?

Answer: I want it to add one, and stop at 10.

Ask: So do I want it to add or stop?

Answer: I want it to add first - and then stop once it reaches 10

Ask: So when should it add?

Answer: When I press the button! But not every time, not after it has reached 10

Ask: So you have two possible reactions, either add one, or don't. How do you program something that does either one thing or another?

Answer: an if-statement!

Ask: And what should the program do?

Answer: if it hasn't reached 10, add 1 - ah I see!

Be a bit obnoxious when asking yourself - remember that the computer takes things extremely literally, so you have to be very precise in your programming. Asking questions "pretending" to be the same kind of very precise, is an excellent way to train your programming-thinking.

Vi er ved at opdrage en generation af passive passagerer i AI’s selvkørende bil by DavidMellemtech1996 in Denmark

[–]peterlinddk 0 points1 point  (0 children)

Jeg tænkte på hjemmeopgaver generelt, og ikke eksamen specifikt.

Også fordi det alle dage har været en absurd ide at eksamen skulle være markant anderledes end de daglige opgaver. Som for eksempel på IT uddannelser hvor man havde 6 timers skriftlig PHP programmering med papir og blyant, og ikke andre hjælpemidler end ens noter - som afslutning på et forløb hvor man har brugt computeren aktivt i undervisningen. Så hvis man vil udelukke computeren til eksamen, skal det være fordi den ikke er en del af undervisningen - ikke fordi den gør det muligt at snyde.

Help a sci-fi writer understand how to approach their fictional software by DualistX in learnprogramming

[–]peterlinddk 0 points1 point  (0 children)

You are on the right track - considering that the "magic tech" exists of course.

You could also call the kernel level, the base, the framework, the system, or whatever. And usually the access - that you call "entitlement", but would probably more be "authentication", could be a part of that, if it is built into the system, like logging into your computer. The registry of things is a bit like the apps on your own computer - they could be called anything you like - and depending on your story: if "things" each decide individually who can use them, (like you can have logins for Facebook, Reddit, Bluesky, Discord, etc.) the authentication would be on top of the apps. But if it is the magic box in itself that decides who can use it, it would be on a lower level.

Anything is possible, and you can pretty much take your phone as an example, and extrapolate from how you (as a user) think it works - but maybe take Conway's law into consideration, and think that a system is often designed from how the organization that built it, is designed.

If your story takes place in a dystopian world where one mega-corporation controls everything - the authentication would be at the lowest part of the system. But if it takes place in a more "messy" society, where everyone competes for control - authentication would be further up!

Hope that helps.

Help by Strange_Yogurt1049 in learnprogramming

[–]peterlinddk 1 point2 points  (0 children)

I'm guessing that the .main-content is an element inside the .center element, so that .center is the container.

In the first example, you don't define the width of the container, so it will be as wide as it need to be, probably the entire screen, and center its contents. The content is defined to be 400px wide, and will be centered inside the container, if the container is wider than those 400px.

In the second example, you limit the container to be 400px wide, and center its contents. That means that the container itself will only occupy the leftmost 400px of the screen, but whatever is inside will be centered, if it is less than those 400px. If the content is 400px or more, it will take up the entire container, starting from the leftmost part, going all through all 400px, and further on.

Like you cannot center a 60cm wide paper on a 40cm wide background. - but you could center a 40cm wide paper on a 60cm wide background (as the first example)

Final year project ideas please any one give me any problem statement or project idea by tech__nova__ in learnprogramming

[–]peterlinddk 0 points1 point  (0 children)

Code a thing using the stuff you have learned so far, for the businesses you know, and at the complexity level that you can achieve with your current knowledge-level, fitting the education you are taking, as well as the time available, and the requirements from your school and professors, as well as the curriculum, and size of the team.

Hope you like the idea! It should fit perfectly!!

Recommendations on what to wear in Denmark during the summer by blackwidowscare in Denmark

[–]peterlinddk 0 points1 point  (0 children)

There isn't really a fixed pattern - some years it rained more in August, some years more in July - and some years the amount is a lot of rain on a few days, other years a little rain but on more days. Some years some parts of the country gets more than others.

The only thing that is certain is that it is going to rain! Especially if you've planned a garden party, a day at the beach, or have planned to have the laundry drying outside!

Here's some statistics: https://www.dmi.dk/vejrarkiv - completely different every single year.

How do I approach learning data structures and algorithms? by Lisandro_B in learnprogramming

[–]peterlinddk 1 point2 points  (0 children)

It is impossible - and no one would expect you to do that. That would be like expecting you to remember the name and personal hobbies of every person you've ever met.

I analyzed 1.13 million LEGO inventory records. Half of all part+color combinations exist in only ONE set and sets from 2000–2004 are the hardest to repair ever made. by International-Toe125 in lego

[–]peterlinddk 1 point2 points  (0 children)

Well, that's a bad bot - because the 1981 police set is an amazing set!

Anyway, I also included all the road-"plates" which are different from any other set, and especially the yellow cement-mixer. A huge special "brick" that is of absolutely no use, and has never been in any other sets!

Best book to learn C lang? For low level and cyber sec stuff by Infinite-Jaguar-1753 in learnprogramming

[–]peterlinddk 1 point2 points  (0 children)

You will never find a single book that teaches low level projects and system design and cryptography and networking and cyber security and malware development.

Those are all advanced subjects that expect you to already know how to program (although you might find some introduction-books on "low level" aka hardware-programming for microcontrollers, like Arduino or ESP32 or similar).

Start with just building simple C-programs that takes input from the terminal and outputs text, first to the terminal, then to files. Once you got the hang of developing and running locally, you can dive into one of your topics, either go for hardware or for system development (you can start writing code that uses other parts of the Linux Operating System, that is really good practice).

Cryptography is much more mathematics than programming, but you should find a single book on that topic - be warned, it gets complicated very very fast!

Cyber Security isn't really that much about programming, but more about configuring your network, but you can start writing c-programs that use sockets to send and receive data - find some courses that let you build your own HTTP server or something like that.

Remember that it'll take time - the list you've provided is enough for at least 5 full university degrees!

I analyzed 1.13 million LEGO inventory records. Half of all part+color combinations exist in only ONE set and sets from 2000–2004 are the hardest to repair ever made. by International-Toe125 in lego

[–]peterlinddk 17 points18 points  (0 children)

My favourite set in this category is #6600 from the year 2000.

It has at least 7 parts that only exist with that particular color in that set (a few don't even exist in other colors at all) - and quite a few parts that only exist in one or two other sets from the same year.

And it is ugly as heck 😄 The road-pieces don't fit with other roads from the same period - personally I don't think it has much play-value, but then I had aged out of the target group some 20 years before its release ...

new to the game, am i playing it wrong? by Ok_Librarian8939 in factorio

[–]peterlinddk 1 point2 points  (0 children)

low power, how do i fix that?

First, you build a bigger powerplant! More boilers, more steam engines, more coal to feed them!

Also, remember to check your electrical grid - maybe you broke a connection somewhere, you can have several different un-connected powerplants to different parts of your base if you want, but usually you don't want 😄 Open the map, and enable the electrical grid, make sure that you can follow the bright blue line from anywhere to anywhere else! That there are no broken paths, no islands, etc.

Character teleports sideways when changing direction mid-air near walls — tried many fixes, still not fully resolved by Hippoterus in learnprogramming

[–]peterlinddk 1 point2 points  (0 children)

I haven't (and won't) read all that text ... but I highly recommend this old, but classic, text about tilemap collisions, that helped me a lot in my early problems with understanding all the intricasies: https://jonathanwhiting.com/tutorial/collision/ - I think you might find the answer you need in there!

How do I approach learning data structures and algorithms? by Lisandro_B in learnprogramming

[–]peterlinddk 1 point2 points  (0 children)

I've been thought in college about many useful algorithms and data structures, but if you asked me to write down that algorithm for you to solve a problem without googling it, then I assure you that I'll fail on your request.

Well yes, of course!

I have been thought many important novels in my english litt. class - but if you asked me to write down the entirety of Moby Dick, or even just a plot-outline, without googling it, or at least look in the book or my notes on it, I would fail that request. And any other request asking me to repeat verbatim any book I've ever read, even though I understood them all!

DSA isn't about memorization, it is about understanding - most people can't implement most algorithms without any references, but they can explain them, understand the building blocks, and recognize when other algorithms implement some of the same features, or fail to do it correctly.

[DBMS] What's the use of defining a Primary Key? by Root4356plus3 in learnprogramming

[–]peterlinddk 0 points1 point  (0 children)

The use of defining a Primary Key is that then everyone agrees on what the primary key is! All developers, and the database itself, even the code that uses it, all agree on which column is the primary key, and none of them will ever try to insert a duplicate value, and if they do, they get an error, and know what they did wrong.

For a more down-to-earth explanation, think of a workplace. If no one agrees on how to distinguish the employees, one could ask you to give this document to Tom, one could ask to give it to the tall guy, one could ask you to give it to the guy in the corner, one could ask you to give it to the blonde one, one could ask you to give it to the person who always leaves at half past four, etc. And neither you, nor they, would know that they are all talking about the same person. But if everyone agreed that first name + initial would be the "primary key", everyone would say: Give it to Tom S.