/r/learnprogramming

Photograph via snooOG

A subreddit for all questions related to programming in any language.

Welcome to LearnProgramming!


New? READ ME FIRST!

Posting guidelines

Frequently asked questions

Subreddit rules

Message the moderators


Asking debugging questions

If you need help debugging, you must include:

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

See debugging question guidelines for more info.

Asking conceptual questions

Many conceptual questions have already been asked and answered. Read our FAQ and search old posts before asking your question. If your question is similar to one in the FAQ, explain how it's different.

See conceptual questions guidelines for more info.

Other guidelines and links

  1. Frequently asked questions
  2. Asking homework questions
  3. Asking for code review
  4. Answering questions
  5. Learning resources
  6. Other communities

Subreddit rules

1. No unprofessional/derogatory speech

  • Follow reddiquette: behave professionally and civilly at all times. Communicate to others the same way you would at your workplace. Disagreement and technical critiques are ok, but personal attacks are not.

Abusive, racist, or derogatory comments are absolutely not tolerated.

See our policies on acceptable speech and conduct for more details.

2. No spam or tasteless self-promotion

In short, your posting history should not be predominantly self-promotional and your resource should be high-quality and complete. Your post should not "feel spammy".

Distinguishing between tasteless and tasteful self-promotion is inherently subjective. When in doubt, message the mods and ask them to review your post.

Self promotion from first time posters without prior participation in the subreddit is explicitly forbidden.

3. No off-topic posts

  • Do not post questions that are completely unrelated to programming, software engineering, and related fields. Tech support and hardware recommendation questions count as "completely unrelated".

Questions that straddle the line between learning programming and learning other tech topics are ok: we don't expect beginners to know how exactly to categorize their question.

See our policies on allowed topics for more details.

4. Do not ask exact duplicates of FAQ questions

  • Do not post questions that are an exact duplicate of something already answered in the FAQ.

If your question is similar to an existing FAQ question, you MUST cite which part of the FAQ you looked at and what exactly you want clarification on.

5. Do not delete posts

  • Do not delete your post! Your problem may be solved, but others who have similar problems in the future could benefit from the solution/discussion in the thread.

Use the "solved" flair instead.

6. No app/website review requests or showcases

  • Do not request reviews for, promote, or showcase some app or website you've written. This is a subreddit for learning programming, not a "critique my project" or "advertise my project" subreddit.

Asking for code reviews is ok as long as you follow the relevant policies. In short, link to only your code and be specific about what you want feedback on. Do not include a link to a final product or to a demo in your post.

7. No rewards

  • You may not ask for or offer payment of any kind (monetary or otherwise) when giving or receiving help.

In particular, it is not appropriate to offer a reward, bounty, or bribe to try and expedite answers to your question, nor is it appropriate to offer to pay somebody to do your work or homework for you.

8. No indirect links

  • All links must link directly to the destination page. Do not use URL shorteners, referral links or click-trackers. Do not link to some intermediary page that contains mostly only a link to the actual page and no additional value.

For example, linking to some tweet or some half-hearted blog post which links to the page is not ok; but linking to a tweet with interesting replies or to a blog post that does some extra analysis is.

Udemy coupon links are ok: the discount adds "additional value".

9. Do not promote illegal or unethical practices

  • Do not ask for help doing anything illegal or unethical. Do not suggest or help somebody do something illegal or unethical.

This includes piracy: asking for or posting links to pirated material is strictly forbidden and can result in an instant and permanent ban.

Trying to circumvent the terms of services of a website also counts as unethical behavior.

10. No complete solutions

  • Do not ask for or post a complete solution to a problem.

When working on a problem, try solving it on your own first and ask for help on specific parts you're stuck with.

If you're helping someone, focus on helping OP make forward progress: link to docs, unblock misconceptions, give examples, teach general techniques, ask leading questions, give hints, but no direct solutions.

See our guidelines on offering help for more details.

11. Don't ask to ask.

  • Ask your questions right here in the open subreddit. Show what you have tried and tell us exactly where you got stuck.

We want to keep all discussion inside the open subreddit so that more people can chime in and help as well as benefit from the help given.

We also do not encourage help via DM for the same reasons - that more people can benefit

12. Low Effort Questions

  • Do not ask easily googleable questions or questions that are covered in the documentation.

This subreddit is not a proxy for documentation or google.

We do require effort and demonstration of effort.

This includes "how do I?" questions

13. No AI (chatGPT etc.) generated messages/comments. No questions about chatGPT/AI generated code.

  • Such posts/comments will be removed without warning and the poster of ai generated content will be instantly banned.

/r/learnprogramming

4,128,892 Subscribers

1

Please help with wrapping my blog post section

I want 3 blog post in a row, if more it should go to a new row. What I am experiencing while trying to implement this, the other blog post get hidden from the website and it only shows the 3 items. I am using handlebars and bootstrap for this section.

<section id="blog">
  <div class="container">
    <h1 class="title text-center">Blog Posts</h1>
    <div class="row">
      {{#each blogPosts}}
        {{#isMultipleOf @index 3}} 
          <div class="row">
        {{/isMultipleOf}}

        <div class="col-12 col-sm-6 col-md-4 mb-4">
          <div class="card h-100">
            {{#if this.images}}
              <img src="{{this.images.[0].image_path}}" class="card-img-top" alt="Blog Image" style="object-fit: cover; height: 200px;">
            {{/if}}
            <div class="card-body text-center">
              <h3 class="card-title">
                <a href="/home/{{this.id}}">{{this.title}}</a>
              </h3>
            </div>
          </div>
        </div>

        {{#if @last}} 
          </div>
        {{/if}}

        {{#if (isMultipleOf @index 2)}}
          </div>
        {{/if}}
      {{/each}}
    </div>
  </div>
</section>

I also added a helper on my backend but I can't figure what I am doing wrong

handlebars.registerHelper('isMultipleOf', function (index, divisor, options) {
    console.log(index, divisor, options)
 if (index % divisor === 0) {
      return options.fn(this);
    } else {
      return options.inverse(this);
    }
  });

I am now getting

options.fn is not a function
3 Comments
2024/09/20
06:49 UTC

2

I built a website to track company-specific ( DSA and System Design ) interview questions (and more) - https://algorush.io/careerhub/company-search/

Hey everyone,

I've been a long-time lurker here, and I wanted to share a project I've been working on. It's a tool I built to help with tech interview prep, and I hope it might be useful to others in this community.

The Problem:

Like many of you, I've spent countless hours preparing for coding interviews. One challenge I always faced was knowing which questions to focus on for specific companies. I found myself constantly digging through online discussions, trying to piece together what questions were recently asked where.

The Solution:

To solve this problem, I built a tool that:

  1. Parses recent online discussions about tech interviews
  2. Aggregates mentions of interview questions for different companies
  3. Presents this data in an easy-to-use format

You can check it out here: AlgoRush

How It Works:

  • Select a company you're interested in
  • View a list of recently mentioned interview questions for that company
  • See details like question frequency, difficulty, and relevant topics

Additional Features:

  1. Practice Section: Curated questions for DSA, LLD, Concurrency, and HLD.
  2. Tech Bytes: Latest tech news and trends.

Limitations:

  • This tool only aggregates publicly shared information
  • The data might not be 100% accurate or representative
  • It's meant to supplement your prep, not replace thorough studying

I'd love your feedback:

  • Is this something you find useful?
  • What features would make it more helpful?
  • Which section do you find most valuable?

I'm not here to promote anything - I genuinely want to give back to this community that has helped me so much. If you find it useful, please consider upvoting this post so others can discover it too.

Happy coding, everyone!

0 Comments
2024/09/20
06:39 UTC

1

How to improve logic building

Well i am Learning JavaScript right now, & I find it really hard to Build logics even for simple problems, So give some tips to improve logic building.. Am a beginner Still logic building seems Very Complicated to me.

10 Comments
2024/09/20
06:20 UTC

1

Certificates For a First year

Hey Guys , I am looking for courses which are free and i can get certificates from which potentialy could help me build my resume up by the end of my university days , i hope for getting more internships by the end if i had more real world skill development , i heard cicso certificates are regarded highly but i know nothing about them , and for reference i can do basic programming in C , C++ , Python and a little web development , i am able to build basic projects not high end stuff anyway . Any help from you guys on what path should i go through so that by the end of my curriculum i have an edge over the rest of my class , and i dont mind paying for the certificates if they are truly worth it , any guide or roadmap on what a fresher should do so that he can ace his university and the IT world would be really helpful because all i know are my freecodecamp lectures and youtube projects that i tried building on my own ,and in advance thank you if you choose to guide me in any way possible

4 Comments
2024/09/20
06:19 UTC

1

Is there like a leetcode but for cisco networks?

Is there like a leetcode but for cisco networks? i really want to practice networks.

0 Comments
2024/09/20
06:06 UTC

1

Where do I start to be able to follow this video?

https://youtu.be/1MrDnLBc-wQ?si=dmir2EfjBDdg0t7v

I watched this video by SchizoDev and I want to be able to create something like this. I'm intermediate with Python but have never made an app or a webpage. No idea with API and stuff either. The amount of stuff I need to know seems excessive. I can't tell where I should start to finally be able to make something like the video.

3 Comments
2024/09/20
06:00 UTC

0

Best resource for learning C#

Trying to find the best places to easily learn C# for programming video games on Unity thank you

0 Comments
2024/09/20
05:50 UTC

5

Could you tell me what 'those' refers to in this sentence?

The OneRowNim class has some obvious shortcomings that are a result of our decision to limit methods to those without parameters or return values.

2 Comments
2024/09/20
05:15 UTC

2

C function help

Hello, I am trying to find and print e^n , n=1-5 without using the exp() function.

I have created a function for the factorial part of the Taylor expansion that approximates e, but am struggling to write a function that addresses the x^n part(at least I think that’s the issue).

Any advice on writing such a program?

1 Comment
2024/09/20
04:51 UTC

2

what kind of jobs can i apply for while i am in school that will help me get a job after i graduate?

my current job is closing down. a year and a half through school so far. I want my next job to help me with my future, i am 31 years old and i dont want to waste more time as a stocker or a line cook etc. I am sure there are IT roles at these companies they need people for that are not really code based, but i imagine working in a place like this would help me network or even get a job. what roles should i be googling or applying for?

0 Comments
2024/09/20
04:37 UTC

2

Git permission problem

Whenever i try launching Github desktop or setup git for vs code and girhub it says permission denied. I tried doing something in vs code and when i try to save it i get the same message. I have tried reinstalling everything and i'm not sure what the problem is. Can someone help me with this? I forgot to say that i have vs code and everything on my school pc too, could that be the problem?

This is a link to the error messages i get, first one is From git and second is vs code, the third is from github desktop when i try to clone one of my repositories from github.

https://imgur.com/a/nc2yUL6

1 Comment
2024/09/20
04:28 UTC

1

Completed Basic SQL Tutorial - Now Moving to Advanced Topics! 🚀

We've just wrapped up the basic SQL tutorial series, covering essential concepts like database environment setup, SELECT statements, data modification, joins, subqueries, and data filtering. Now, we’re diving into more advanced topics such as window functions, CTEs, and complex query optimization.

We would love to hear your feedback on the content we’ve shared so far! Feel free to check out the tutorials, and let us know your thoughts or suggestions on what you'd like to see next. Your input is invaluable as we continue to refine and expand the series.

https://youtube.com/playlist?list=PLXJazT4YpAH_PoCoLAbHWu111mn4L6Az7&si=X9x__FaLMR0Rq72U

0 Comments
2024/09/20
04:14 UTC

1

How to make Calendar or Clock .exe application?

Hello! Sorry for this kind of question, but I really cannot seem to find any tutorials on the kind of calendar coding I'm trying to do. Clocks are a little easier, but they all leave out the GUI aspect which is what I'm looking for (at the very least, just being borderless/no minimize or X buttons, would be good.) And you can right click it to choose whether it stays on top of everything, or not.

Preferably, I would like to create an entire program similar to these anime DTA packs that came with desktop mascots, calendars, cursors, windows user icons, wallpapers, and clocks, that you could browse and use all within a handy little program. Just click the button, and it applies it to windows. I will try to link an image example below if mods allow. The standalone program part isn't super necessary though.. just the functioning clocks and calendars. Good ol ZIP files can do the trick too. Everything else there is the easy part, it's just functioning calendars and clocks I'm unsure about

I'm not looking for the entire answer here (Unless it's that simple) But if anyone knows what coding language I should use, or like.. what I should more specifically search for to find an answer, would help. Or tutorial suggestions. I don't know if theres a good general "How to make desktop applications" tutorial anywhere, or if something like that WOULD put me right on the track to being able to figure this out myself with just some basics. Googling it isn't giving the kind of results I'm looking for, I'm actually just finding physical calendars for your desk.

If anyone can prescribe me tutorials to set me in a good direction, I'd appreciate it! Or even just helping me figure out what I need to do/look for to get where I want. I don't know what I need to learn to get here. I'm even considering getting japanese coding books on the matter, since they're more themed around making cute artsy applications or mascots, which is what I want. Not just basic font in an opaque window sorta thing.

I did see about this rainmeter thing that changes people's icons and has some audio visualizers and whanot. Would it just be more worthwhile to look into fiddling with making skins and stuff for that?

I hope this doesn't sound too much like I'm looking to be spoon-fed info, but I'm genuinly not finding anything on google and feel like I'd need to just sign up for a course on something and spend 293580 years learning before I get to the thing I want to make.

I took coding classes in highschool and have made a couple basic games, but I have no idea what language or way to go about making a little .exe that won't accidentally eat up way too much memory to be worth using. I feel like this is actually a simpler project to start coding with, but it's just getting started and knowing where to look for help is the hard part. Thank you for any help at all. If you're more curious about this program itself I'm referring to, you can probably find it searching K-On DTA. If anyone wants to work together on it too, I'd be happy to! I'd like to make a template of this kind of program for people to make digital fan projects with. Like fanzines, but full of digital goodies. So in the future, everyone only needs to worry about the art part.

1 Comment
2024/09/20
03:55 UTC

1

HELP NEEDED

How do I take local host off my school issued computer? I did it before, but the computer broke and so I have a new one snd I cant remember how I did it.

2 Comments
2024/09/20
03:55 UTC

2

Seeking Input: Developing a Browser Extension for Searchable Select Dropdowns

Hello everyone,

I'm learning browser extension development and want to create a plugin to solve an occasional issue I face:

Sometimes we encounter web forms with large select dropdowns containing many options. If the webpage is outdated or poorly designed, these dropdowns may lack search functionality, forcing us to visually scan through numerous options.

I'm developing a browser extension to enhance such select elements by adding a search feature for quick option selection.

I have two questions and would greatly appreciate your help:

  1. Have you encountered similar situations? Would such a plugin be useful to you?
  2. Can you share examples of webpages with large, searchless select dropdowns? This would help me test and debug the extension.

Your insights and examples would be invaluable for this project. Thank you in advance for your assistance!

0 Comments
2024/09/20
03:45 UTC

0

how to Learn Artificial Intelligence (AI) and machine learning ?

HI? I want to learn AI and machine Learning as it is related to my field career
can someone suggest me where to start and where to learn complete
As am student and currently started a mechanical engineering degree
i want to learn artificial intelligence PLEASE help me out anyone who is expert out there

3 Comments
2024/09/20
02:07 UTC

0

Learn Artificial Intelligence (AI) and machine learning

HI? I want to learn AI and machine Learning as it is related to my field career
can someone suggest me where to start and where to learn complete
As am student and currently started a mechanical engineering degree
i want to learn artificial intelligence PLEASE help me out anyone who is expert out there

0 Comments
2024/09/20
02:00 UTC

1

Where is this variable going?

I'm using Flask & Jinja in a programming course. I'm a little confused on what exactly is happening in terms of where a variable goes first.

In my index.html page I have an anchor tag:

<a href="{{ url_for('post', blog_id=blog['id']) }}">Read </a>

And then back in my main.py

@app.route('/post/int:blog_id')

Def post(blog_id):

rest of code...

Okay, so my confusion is does this url_for method give that blog_id variable to the post function first, which then passes it on to the decorator route function as a parameter ('post/<int:blog_id). Or is it passing it to the route function which then passes that to the parameter within the post function (def post(blog_id)?

I like to be able to follow my code line by line to make sure I understand it. I think it's going to the route decorator first but I'm just not entirely confident.

3 Comments
2024/09/20
01:33 UTC

1

Passing data from Spring Rest Controller to React JS frontend returns random HTML instead of JSON

As the title says, I am trying to pass data from Spring Rest Controller to React JS front end. For some reason, it will not return in JSON format, it returns some random HTML. When I test the server by itself, it shows my data in JSON. I'm not sure exactly what is going on. My database is MySQL and I am using axios to call my spring server.

1 Comment
2024/09/20
01:32 UTC

0

How many months for a beginner to be able to make quiz?

How many months of 1 hour of study a day would it take to make a quiz along the lines those in the links. A voice says the name of a country and you have to click on it and I think the country outline turns white if you get it right, yellow if you guess it in under 4 tries, and red if it takes 5 tries. There's also a timer, a score being tallied, the score updates as you're playing... Of course I'd supply the text-to-speech wav file and graphics.

Try one for 15 seconds if you want to get a feel for the complexity. There's no sign-in:

https://www.geoguessr.com/vgp/3375

https://www.geoguessr.com/vgp/3007

4 Comments
2024/09/20
01:22 UTC

11

Question for professionals (especially webdevs) What Operating System do you use?

Is it Windows or Linux?

I'm trying to follow an online course, and the material insist that I use Ubuntu because that's supposedly that majority of webdevs use.

I still heavily prefer Windows, mainly for having a mainstream OS instead of dualbooting and I have managed to recreate the setup the course provides with Linux on Windows (ex: setting up git).

I was wondering if I really do actually have to use Linux because it actually is the industry standard? I wouldn't want to be the special snowflake using Windows when everyone else is working on Linux. Or is Windows actually more widely used than the course says it is?

Thanks

56 Comments
2024/09/20
01:17 UTC

0

I want to learn how to make websites for Realtors and I am in High School

I was just wondering what was the best language or program to make good looking professional websites. I am currently in High School and have some free time I could use for this skill, the reason why is because my dad currently pays someone to do it for him but has always encouraged me to do them. If I am able to learn some of his friends that do the same thing could be interested in one and I could make some money too.

I asked some people and they told me that if I learned WordPress that would be enough and could do a good job, I also heard HTML with CSS can do the same thing and would be a better skill to have so I was just wondering what you guys recommend? also where would be the best place to learn? i know about YouTube and the odin project!

I am deciding still between majors but CS is an option so maybe also if this could help me later on!

10 Comments
2024/09/20
01:11 UTC

1

How hard is it to learn CSS, html and Javascript for shopify

I’m looking at learning the basics of e-commerce web development, and looking to avoid paying a shopify developer. But how hard would it be to learn these three languages + liquid?

More than a year?

3 Comments
2024/09/20
01:05 UTC

3

How do I capture and record window pixel information for an app running on my computer

I want to create a program that can record data about pixels for a window of my choosing on my computer. But idk how to start or what I need to do. I tried looking on the internet for anything but I'm at a loss.

2 Comments
2024/09/19
23:54 UTC

2

[C#] Having troubles with StreamWriter

I've been working on this program that'll help track my hours for my remote job because I got bored in between tasks for said job. At first its only function was to read each entry of a certain day (entered manually) and calculate the total hours worked. I have since tried to completely automate it to write the entries too using clock in/clock out methods to take the times and enter them in the correct format. The main problem areas are in WriteData and the while loop of Main(). My first issue is that I can't figure out how to set StreamWriter's initial position to be at the end of the file. You can see I tried to save the last line in the file using lastline in order for StreamWriter to find the right position but this obviously didn't work the way I hoped. My next issue is likely connected to the first, but I also can't seem to keep StreamWriter from erasing everything that's already in the file. Currently the method only partially works by writing in the time interval but will keep replacing it each time a new one is written as well as the other issues above. Any advice is appreciated (I know I need try/catches I just haven't gotten around to it).

3 Comments
2024/09/19
23:36 UTC

2

Need help with this task

So, I'm new to java and but have some knowledge in c, and I'm struggling to finish this task. I need some fixes to the code if possible.

The task is

Write a function toIPv4, which allows the caller to pass 4 String values and returns a valid IP Address as a
String.
In your solution, you must do the following:

  1. Use either arguments or a Rest Parameter to accept multiple values to your function
  2. Make sure the caller passes exactly 4 parameters, error if not
  3. Make sure all 4 values are Strings, error if not
  4. Convert each string value to a number (Integer) and make sure it is in the range 0-255, error if not
  5. If all of the above checks pass, use a Template Literal to return the IP Address as a String
  6. Use the functions from questions 1 and 2 to help you solve 1-5 above For example, toIPv4(“192”, “127”, “50”, “1”) should return “192.127.50.1”

This is my code.

function IPv4(...args) {

// Check if exactly 4 arguments are passed

if (args.length !== 4) {

throw new Error("Exactly 4 arguments are required");

}

// Check if all arguments are strings

for (const arg of args) {

if (typeof arg !== "string") {

throw new Error("All arguments must be strings");

}

}

// Convert each string to an integer and check if it's in the range 0-255

const nums = args.map((arg) => {

const num = parseInt(arg, 10);

if (isNaN(num) || num < 0 || num > 255) {

throw new Error(`Invalid IP address component: ${arg}`);

}

return num;

});

// Return the IP address as a string using a template literal

return `${nums[0]}.${nums[1]}.${nums[2]}.${nums[3]}`;

}

1 Comment
2024/09/19
23:35 UTC

2

book or website for javascript modern syntax

Is there a good book or website where I can learn javascript quickly? I have some basic knowledge in javascript but ES6 is a bit confusing if I don't continue to use it.

I bought frontend book series written by Jon Duckett. But it was a long time ago and I feel like it's outdated.

Most javascript books are either too surface level study without enough context of modern syntax i.e., ES6, or too complicated like c++.

Websites with cheatsheet for ES6 or tutorials would be also great but I couldn't find a good one. Or, there are just too many, so I cannot tell which one is good.

I'm 10+ yoe software engineer, so I'd prefer the resource that deals with javascript modern syntax, rather than focus on the basic programming and data structure through javascript.

4 Comments
2024/09/19
23:25 UTC

1

Free Scholership / Mentorship question

Hello, I'm from a third world country and was accepted recently into an Udacity scholarship program for Front End development after trying (and failing) to get into the field for a year. This made me realize I have no accountability and following along a set program and rubric helped me make progress. So I was wondering, is there any other free programs like this for people like me I know free courses exist but I was looking for like free bootcamps or at least affordable programs that have parity for people in countries like mine. Thanks.

2 Comments
2024/09/19
21:52 UTC

0

error: expected expression before ‘)’ token for c programming

What is an 'expression' ? The error occurred after the comma? can someone go into detail? and is ' ) ' called a token parentheses or?

I'm willing to study errors to get a better hang of it:

int a = 10;
printf("Value: %d\n",);
3 Comments
2024/09/19
21:02 UTC

1

Need to learn virtual threading for Java

My work requires me to learn this to prepare. All I know is these two words, what course is best so that I can learn and prepare ahead of time?

3 Comments
2024/09/19
20:31 UTC

Back To Top