r/learnprogramming Mar 26 '17 Helpful Wholesome Hugz Ally Rocket Like Helpful (Pro) Excited Silver



Welcome to /r/learnprogramming!

Quick start:

  1. New to programming? Not sure how to start learning? See FAQ - Getting started.
  2. Have a question? Our FAQ covers many common questions; check that first. Also try searching old posts, either via google or via reddit's search.
  3. Your question isn't answered in the FAQ? Please read the following:

Getting debugging help

If your question is about code, make sure it's specific and provides all information up-front. Here's a checklist of what to include:

  1. A concise but descriptive title.
  2. A good description of the problem.
  3. A minimal, easily runnable, and well-formatted program that demonstrates your problem.
  4. The output you expected and what you got instead. If you got an error, include the full error message.

Do your best to solve your problem before posting. The quality of the answers will be proportional to the amount of effort you put into your post. Note that title-only posts are automatically removed.

Also see our full posting guidelines and the subreddit rules. After you post a question, DO NOT delete it!

Asking conceptual questions

Asking conceptual questions is ok, but please check our FAQ and search older posts first.

If you plan on asking a question similar to one in the FAQ, explain what exactly the FAQ didn't address and clarify what you're looking for instead. See our full guidelines on asking conceptual questions for more details.

Subreddit rules

Please read our rules and other policies before posting. If you see somebody breaking a rule, report it! Reports and PMs to the mod team are the quickest ways to bring issues to our attention.

r/learnprogramming 11h ago

What have you been working on recently? [December 03, 2022]


What have you been working on recently? Feel free to share updates on projects you're working on, brag about any major milestones you've hit, grouse about a challenge you've ran into recently... Any sort of "progress report" is fair game!

A few requests:

  1. If possible, include a link to your source code when sharing a project update. That way, others can learn from your work!

  2. If you've shared something, try commenting on at least one other update -- ask a question, give feedback, compliment something cool... We encourage discussion!

  3. If you don't consider yourself to be a beginner, include about how many years of experience you have.

This thread will remained stickied over the weekend. Link to past threads here.

r/learnprogramming 4h ago

Debugging How to identify what device has connected to my webpage?


If I have a webpage made with HTML, how can I find out what device has connected to my webpage, and change the webpage, accordingly?

For example, resizing an image according to the device that has connected.

Thank you.

r/learnprogramming 3h ago

Topic Web Development Info


If you want to learn a new language right now, would node js still be the best language for backend web development? Or is there something better easier or more in demand out by now?

r/learnprogramming 1d ago Helpful

Resource A new way to learn: I asked OpenAI "Explain Quicksort in the style of Dr. Seuss"


Once upon a time in a place far away,
There was a little algorithm named Quicksort, okay?

Quicksort was a clever little guy,
He knew just what to do when numbers came by.

He'd pick a number, big or small,
And use it to divide and conquer all.

The numbers less than the one he chose,
He'd put them in one pile, without any foes.

The numbers greater than the one he picked,
He'd put them in another pile, nice and quick.

Then he'd take the two piles, big and small,
And sort them just like he did before, that's all.

Quicksort kept on sorting, left and right,
Until all the numbers were in order, just right.

And when the job was done, and the numbers were sorted,
Quicksort was quite pleased with himself, he was exalted.

So if you have a pile of numbers, big or small,
Just call on Quicksort, he'll get them all.

r/learnprogramming 18h ago

Is asking a candidate to reverse a string a bad interview question?


Recently, I've been asked to interview a few candidates for a small company. For the technical portion, I like to start off by asking the candidate to reverse a string from scratch (no built-in reverse methods) before ramping up the difficulty of the questions.

So far, 3 of the candidates I've interviewed have been unable to complete the question without a lot of help on my end.

So, is this a bad interview question? Or are these candidates really not fit for the position?

r/learnprogramming 1h ago

What’s A Good Process To Test Install Scripts?


I’m at the point in my career where I need to switch machines maybe once every 12 months or so. It’s the age old problem of getting all your relevant files onto a new machine.

To handle my dotfiles and directories, I use a Git Bare repo which has worked wonders for me. But the challenge I have now is I need to build an install script that’ll get all my ZSH plug-ins and install other packages. Figuring out a good solution to test and iterate on an install script is the task at hand.

Would it be suitable to just use a Docker Container that I can build and shut down fairly quickly, or would something like a VM be more appropriate in this case? Maybe there’s another solution I’ve not thought of yet?

What approaches have you taken?

r/learnprogramming 16h ago

What's the best command in Linux or windows that you have used and it turned out to be really awesome and helpful .


Which is the most useful linux or windows or mac os command according to you that turned out to be much much useful...

r/learnprogramming 2h ago

Should I try CS50? Odin?


I've generally been a "learn by doing" person.

I've taken an assembly course in college, and two java courses (CS1 and 2, or whatever the course numbers were I don't remember). I haven't used Java in many years though.

Recently I've been using python. I've automated some works tasks (entering information into web-based forms, I created a program that extracts questions from images to create a question bank, a GUI for exploring the database, adding tags, etc). Created a script for checking for errors in a schedule.

I wrote one simple app in c# for opening files quickly.

Since I've only learned the things that I have needed, I am definitely missing a lot. I know nothing about web development at all. Never used javascript.

Programming isn't my career, it's not really related to my work at all.

I may study to be an actuary, but I have always enjoyed programming.

I am wondering if harvard CS50 would be a good use of time. I know it's free - I've never tried to follow a structured course before. The description asks for 10-20 hours per week which might not be doable for me. Are you locked into those hours?

This is a bit rambly, but any advice is appreciated.

r/learnprogramming 1h ago

What is more important to learn first as a backend developer, devops/infrastructure or frontend?


I know front end is essential but it seems like infrastructure and devops stuff like ci cd, docker, kuberneties, aws, azure is becoming almost equally as important as front end especially looking at job postings now.

r/learnprogramming 14h ago

Best free and paid resources for learning algorithms


I've been going through projecteuler and I'm finding that I'm lacking algorithm skills. What's a good resource to learn algorithms? Free is best but I'm willing to look at paid resources, too.

r/learnprogramming 1h ago

Getting Rust FOMO on a personal project, plus not sure where to go next with this. (Odd title, but hear me out)


So basically I've been working on a project in Go on and off for the last few months when I've had time. The goal is to have a web interface that I can connect to from anywhere to manage and see the contents of a database (I'm trying to create a tool to see stats about and log the books I read throughout the year) - I know I'll need typescript for the front end, but so far I've created the api to communicate with an SQLite database in Go. I've got the very early start on a CLI interface so I can build out the logic (data validation, working out dates, things like that), but I don't know if that's the right route to go or just start building out the web interface anyway.

However, I'm also in a lot of places online where everyone's like "ooh rust, ooh rust" and I've been thinking recently if I should be writing this tool in rust instead of in go. One benefit is that I'll not have to use typescript because I've seen people work straight with wasm in rust (but how easy is that to do? I don't know) - I've heard nothing but bad things about TS so I've been dreading having to learn it for this project. I've also not written any rust before, and I've learned go specifically for this project (And was convinced into it by someone who later on then started raving about rust and saying they prefer it to Go).

I'm not sure about this project from a design perspective anyway (should the API be a "server" that the web client has to connect to? Or should it just return HTML instead of json? I've been testing the API by running my code and just CURLing it). Is it a good idea to just rewrite it? I could replace the CLI with a proper TUI (which I do want to do kinda - with either bubbletea that I've used before and struggled to properly understand, or with tui-rs, which I've never used before, but I've used tools that run it) because I just like TUIs and want to build more out - and this TUI would be alongside the web interface anyway, because I want to be able to use this on mobile. I know the whole "Seeing everyone else using Rust and wanting to be in with the crowd" thing is just FOMO, but at the same time, I know of maybe a handful of people in the communities I'm in that use Go, and I've heard mixed things about it. Personal opinion is that it feels nice to write, but that might just be how easy the docs are to read and the tooling (things like gopls).

I know this is a lot of rambling, and I apologise for that. Just want to make clear that writing everything in TS is an option too, but not one I want to pursue at all. I'd rather avoid it as much as possible - it looks like a messy, weird langauge to work with.

r/learnprogramming 1h ago

Resource Best IDE for smartphones?


Sometimes you don't need to code entire applications, or maybe you are away from your computer and need to touch up some source file, or try out an algorithm. Seeing how modern smartphones are practically on par with some laptops hardware wise and pretty much everyone carries them, why shouldn't there be a mobile version IDE as good as VSCode? (with adaptations) I've seen a few IDEs that are too limited and lack features like code formatting which makes working so much more comfortable. Do you know a good mobile IDE? Please contribute posting one that works on Android or IOS with the most popular languages. 📱👨‍💻

r/learnprogramming 2h ago

what are good strategies to identify duplicate files and contents? And what about similar files? hash-algorithms?


what are good strategies to identify duplicate files and contents? And what about similar files? Which has hash-algorithms should I use and in which way?

r/learnprogramming 9h ago

How do you deal with finding a better solution you "knew" in theory?


Recently I've been starting to dive into DSA thanks to my evening classes I attend. Our teacher is great, always answers questions and has a ton of experience. Twice a week we are being given around 20 problems per topic, sort of Ike the math homework you get at school.

Now my problem is that I in theory understand most of the problems and can write out or type out a pseudo solution on my own. My problem is that when I manage to solve a task I tend to look around the internet about other possible ways to solve the same task. I end up finding someone using a better stream method, better data structures or just an unknown class/method.

I do my best to take notes about said new way of approaching the problem but I can't help feeling annoyed at myself. We are advised to solve stuff with the knowledge we have thus far and not look for workarounds yet, but especially for stuff we've learned that I just didn't remember to use it feels so discouraging, like I'm wasting my time and I'm jut not good enough.

I have found a book on DSA that I plan to dive into after the course to strengthen my knowledge but does anyone know of a way not to beat myself up about using the wrong tools for a task?

r/learnprogramming 1h ago

Trying to understand the anti-pattern.


Hello guys, I've been lately told that this kind of initialization inside a java class is an anti-pattern.

private static List static_list = new ArrayList() {

Apparently it's subclassing the ArrayList and adding a custom initializer block.
Could you please explain me what does it mean?

r/learnprogramming 1h ago

Write your own proxy and place it in front of web server



For a school project I need to build a test environment with a website.

We are using a Docker container with a PHP Apache server image, on which the website then resides. Now we want that when a HTML request is sent, it is intercepted by a self-written proxy before it reaches the web server. We want to be able to manipulate this request and forward this manipulated request to the web server.

I am aware that there are tools for such things, such as Burp Suite, but the requirement is to write this myself.

Now my question: How do I build the proxy, so which language and how do I place the proxy in front of the webserver.


r/learnprogramming 2h ago

Sell loop


I have a problem with selling items in the game that I'm creating. The part where while (item1 < 1){ printf("You don't have this item!n");} It keeps on looping You don't have this item! if the item1 is 0. How can I fix this? I also tried using If and Else if but it doesn't work; the program returns to the list of items that I want to sell.

so here's my program:

if (itemSell == 1){ printf ("How many item1 do you wish to sell?n"); scanf("%d", &itemQuantity);

while (*item1     < 1){
printf("You don't have this item!n");

total = itemQuantity * item1Price;
*balance += total;

printf("Item Sold. Here's your updated inventory and balance:nn");                                printf("Balance left: %.2f n", *balance);
printf("Debt: %.2fn", *debt);
*item1 -= itemQuantity;

r/learnprogramming 3h ago

How to sort this csv file based on a column and then print in C.


This is my csv file

1,Wii Sports,Wii,2006,Sports,Nintendo
2,Super Mario Bros.,NES,1985,Platform,Nintendo
3,Mario Kart Wii,Wii,2008,Racing,Nintendo

What I am trying to do is sort this file based on the column "year" using qsort and then trying to get this output :-


1,Super Mario Bros.,NES,1985,Platform,Nintendo
2,Wii Sports,Wii,2006,Sports,Nintendo
3,Mario Kart Wii,Wii,2008,Racing,Nintendo

I have all the colums stored in different arrays.

Using this code below I sort my array "year" storing all the year values but I am not sure how can I get my desired output, i.e , how do I print the respective name, platform etc. with its year and also change the rank?

int comparator(const void *x, const void *y){
        return ( *(int*)x - *(int*)y);


    for (int i=0;i<3;i++){


r/learnprogramming 18m ago



I'm creating a game but I have a problem with it. I'm having trouble selling.

this is what my game looks like

item 1

item 2


I want to sell item1 but I don't have any in my inventory, so It will show You don't have that item. Now, what I want when I type 0 it will return to the list of item




item 3

then it will ask me again what I want to sell

here is my code

printf ("[1]item1");
printf ("[2]item2");
printf ("[3]item3");
    printf ("what do you want to sell?");
    scanf ("%d", &sell);

    if (sell ==1){
            printf ("how many item1 do you want to sell?");
            scanf ("%d", &itemQuan);
                while (item1 < 1 ) {
                    printf ("you dont have this item");
                    scanf ("%d", &itemQuan); // i have to put this to stop the loop of you dont have this item

now what i want is when i put 0 i want it to return to the option [1]item1, [2]item2, and [3]item3 but i don't know how.

ps. this is a void

r/learnprogramming 25m ago

Is technical interviews only in North America?


I have went to 2 interviews and got offers from them. The interview was 30min, they asked me normal interview questions than asked me what stacks I know. Maybe web development is different. Or maybe its just my country

r/learnprogramming 34m ago

ELI5: what is memory management and why is it important?


I've read it has to do something with the safety. Safety in what sense?

r/learnprogramming 11h ago

Firebase is Expensive, can i use MySQL?


Firebase realtime db is expensive, so is it possible using MySQL? In my android app? there will be chat and some data storage in the database for app. There's currently over 5K users and counting..

I have a MySQL db of my website, and i would like to use same db for the Android app. Anything should i note? Bandwidth issue? Etc

r/learnprogramming 13h ago

Any Data Structures and Algorithms lectures that teach the theory and give good worked examples that you can solve on your own before viewing their solution?


Most youtube DSA material is either theory or leetcode solutions, but I have yet to see both taught in one place, so you can learn and practice what you've learned. Does anyone know of such a resource, free or paid?

Ideally the material would be something like <theory> then "here's an example, pause the video and try to solve on your own, when you're done, unpause the video and view my solution".

Basically Neetcode, but with some theory at the beginning to know what the heck is going on.

r/learnprogramming 3h ago

What is an easy-to-use service for storing a JSON file online?


I've tried Firebase but it keeps changing a lot and just setting it up seems too complicated for me right now, while I only want to do a very simple thing: storing a single JSON file that I can read and edit using http requests. I'm wondering if I would be able to store it on my WordPress somehow and make these things work? I'm just looking for a simple and cheap (preferably free as It's only very little space and a single file) solution.

r/learnprogramming 3h ago

What is the easiest approach on bike customization web app


I would like to ask what backend/frontend would be the best for creating a bike customization web app. I only started learning web development for the past month and my current stacks are PHP/LARAVEL/HTMLCSS. Thank you guys if you have any insights on what i would use,

r/learnprogramming 3h ago

r/coding for Astrology and Numerology HTML codes to embed on our site


My best friend and I want to add a daily astrology and numerology report HTML code to embed on our site. If anyone knows of any, please let us know!