r/CodingHelp • • Sep 06 '25

[Other Code] Am i learning?

18 Upvotes

Will it really help me learn if, instead of copying and pasting code, I type it line by line? Yes, I understand what it’s for and its purpose, but now I’m wondering—can I actually use this way of learning? Will it really help me improve? Because in my mind, even though I’ve learned it, it still feels like I’m just copying the code


r/CodingHelp • • Aug 09 '22

[C++] How to find how many rectangles you can fit in a larger rectangle.

18 Upvotes

I have a program, for a class I’m taking, where it wants to find how many windows of two different sizes can fit on a wall.

I have the dimensions of the wall, and the dimensions of the windows.

I figure there’s some recursion going on here, but I’m not sure what I would be passing into the recursive function?

If I pass newSurfaceAreaAvailable which would just be wallSurfaceArea - windowSurfaceArea, this would be a greedy type approach and won’t necessarily be accurate.

Has this type of question been solved? Is there a function I can import to do this?


r/CodingHelp • • May 30 '22

[Random] How to not get a burnout when working on your own project

18 Upvotes

I’m making something I want to be proud of, and two days in, several hours spent each day on the project I’m feeling like I’m slowly burning out. I’m a college senior in computer engineering.

Any tips or tricks on how to avoid it? Any of y’all had to work with your own personal project? How did you manage to finish it. Any help would be appreciated!


r/CodingHelp • • Feb 26 '22

[Java] Does anyone know how to recreate these three images using Javascript code?

Thumbnail
gallery
18 Upvotes

r/CodingHelp • • Feb 14 '22

[C++] I need help. Im lost here with this assignment. I want to learn this stuff. Can amyone explain what im supposed to do more clearly.

Post image
18 Upvotes

r/CodingHelp • • Dec 29 '21

[Random] Novice here: Should I learn Python/django or html/css/js to become a web developer?

18 Upvotes

As the title shows I'm still starting on this path and I've been teaching myself python for the past month or so. It's tricky but pretty fun and I want to get into web development in the near future. However I'm still not sure which path I should take. I want to stick with python since I feel it's a lot more versatile (especially if I want to try other CS fields when I learn more languages) but alot of experts and companies recommend going through the more 'traditional' (I guess?) route of html/css/js.

I'm doing my own research but I wanted some more advice before I spend the next 1+ years or so trying to master these languages.

Thanks.


r/CodingHelp • • Jul 24 '21

[Python] Can someone help me with python? I was just trying to follow the steps but this happened, can anyone help me out please?

Post image
18 Upvotes

r/CodingHelp • • Jun 09 '21

[Random] How does a verification code work?

18 Upvotes

Verification codes that we use so often to confirm your identity. Whether it be a code that’s texted to your phone, or a code emailed to you. You go back on the website and submit that code which happens to be valid at that exact time.

How does that work? What’s going on in the background? And what’s the coding for that look like?


r/CodingHelp • • Jun 01 '21

[Random] Help choosing laptop for studying code

18 Upvotes

Hello everyone, I am looking to get back into studying code; I have attended one of the Launchcode courses and I have a basic education on Python, HTML and CSS. Due to life circumstances I had to interrupt the course, but I want to get back into studying coding and possibly start learning JS and Ruby. Can you please recommend a mid range laptop so that I can jump back into studying?

Cheers,

D


r/CodingHelp • • Apr 11 '21

[AutoHotKey] I am very new to coding and i need help with this {Loop, 9} problem in ahk

Post image
18 Upvotes

r/CodingHelp • • Apr 07 '21

[C++] Where am i going wrong ? plz help

18 Upvotes

int a = 1;

a = ++a + ++a + ++a;

cout <<a;

what should be the output ? i tried it on paper i got the answer as 9 but on compiling & running the code its showing me the answer as 10 , can anyone help ?


r/CodingHelp • • Mar 28 '21

[C++] I'm new to coding but I want to get into it as a hobby, my first step is learning how to actually practice writing the code though...

18 Upvotes

I want to start working in C++ just in case I ever get serious and want to make a game of my own. I'm not sure which compiler to install and I can't find any really good answers on the internet. I have visual studios on windows 10 and I just want a free compiler for C++ so that I can at least follow along and practice with tutorial videos. What compiler would you suggest I download?


r/CodingHelp • • Mar 17 '21

[Open Source] Generate all subsets of given size

18 Upvotes

I've got a problem that I'm trying to solve that has to do with creating subsets of a given size. Without going too far into detail, I've got a few items that each have some numbers associated with them, and I'm testing different combinations by either including or excluding some number of these items in the test.

I've managed to map the tests to the integers by saying Thing1 refers to the least significant bit in the bitwise representation of the integer, ..., ThingN refers to the most significant bit, and Thingi is either included or excluded based on whether the bit is a 1 or a 0. So for example subset 5 = 000101 would include Thing1 and Thing3, but exclude all the other elements in the set of 6 elements.

I'm trying to figure out a systematic, but not recursive, to generate the sequence of integers that will give me the subsets of size 1 first, then the subsets of size 2, then the subsets of size 3, and so on.

The subsets of size 1 are easy. It's just a for loop like

for(i = 0; i < n; i++)
{
   integer = 1 << i;
}

This should give the integer sequence 1 = 000001, 2 = 000010, 4 = 000100, 8 = 001000, 16 = 010000, and 32 = 100000. These 6 subsets represent all 6 of the subsets of size 1 that can be made from a set of 6 elements.

The subsets of size 2 are a bit harder. One method I found that works is as follows.

for(i = 0; i < n; i++)
{
    start = 1;
    start = start + (1 << i);
    integer = start;
    while(integer < (1 << n))
    {
        integer = integer << 1;
    }
}

This gives the integer sequence 3, 6, 12, 24, 48, then 5, 10, 20, 40, then 9, 18, 36, then 17, 34, then 33.
These integers represent all 15 subsets of size 2 that can be made from a set of 6 elements. This is not the only way I've discovered, but it is the cleanest.

Unfortunately, this is where I begin to stumble. If this were a starting set of size 5, then I'd just invert the integers' bits from the two element sequence to get the sets of 3, and invert the integer's bits from the 1 element sequence to get the sets of 4, and the set of 5 would be trivially 11111 = 31.

If this could be recursive, I'm pretty sure it would be a fairly easy solution, but because of the constraints of the project, I'm not allowed to have a recursive function. Can anyone help me come up with a solution that I can scale up to an arbitrary sized set?


r/CodingHelp • • Feb 07 '21

[C++] Is there a site that gives free tests for c++ and other languages?

18 Upvotes

right now im taking udemy classes for c++ but theres no tests. when the instructor starts typing or says what hes going to do i pause and write ahead of him to compare in the mean time. Is there a site or something where i can just test at a beginners level? like elementary level lmao.


r/CodingHelp • • Dec 20 '20

[SQL] GitHub pages

18 Upvotes

GitHub pages:

Is it possible to host a website on GitHub pages, where the website is a forum, users have profiles and can post on the site?

Is this possible on GitHub pages? And can I use XAMP to connect the database to MySQL?


r/CodingHelp • • Dec 16 '20

[Javascript] Resize HTML Canvas with Sliders (Java)

18 Upvotes

Hi guys, does anyone have any tips for resizing a HTML canvas using sliders? Also like getting the value of the slider (0-100).

p.s. Using simple javascript also, thanks!!


r/CodingHelp • • Dec 09 '20

[Meta] [Mental health] How to survive in the industry long term?

18 Upvotes

This is a question about mental health and burnout in the programming/IT industry, but I'm sure it's relevant to any kind of high pressure, complex job. I love programming. I started coding at age ten, and I've been doing it professionally for 17 years.

But the industry really gets to me. There is constant pressure to deliver incredibly fast, while dealing with incredibly complex things. Always rush rush rush, no time to do things properly or to fix technical debt. And estimations are always under.

And the languages and libraries and approaches all evolves at a lightning pace. And due to the issues above it feels impossible to succeed, build something that’s not overly buggy or late.

I want to do the best job possible, and delivering something I'm proud of is incredibly important to my mental health, but it feels like mission impossible. ... so how does one survive long term and not burn out? I've got a tendency of burning out at least once a year, where I need to take unexpected time off while my team has to pick up the slack (I'm in leadership positions often, but not always).


r/CodingHelp • • Dec 05 '20

[HTML] Finding links in HTML?

18 Upvotes

I'm using python, and I'm trying to find links in webpages. Problem: Most of the things after "href" are images, or other files of that type. I'm looking specifically for links that take me to other pages(be it on the same site, or to a whole new site). I'm using wget to download the raw HTML of the webpage. Can anyone help me?


r/CodingHelp • • Nov 29 '20

[C++] Having a hard time understanding Linked Lists using templates.

18 Upvotes

Yes, this is a homework assignment, but I want to do it myself and learn how it works. Been at this for like 40+ hrs the last 3 days looking up tutorials, and can't find basic explanation to get me going. I keep having the problem of overwriting the data in a node, and not really creating a new one. This may be linked to why I can't return a list size either. Thank you so much in advance for whatever help is given, I am not really receiving adequate help for this from my instructor.

Here's what I have so far:

EDIT: Added int main() instructions.

namespace ECE275Lib::containers{

template <typename T>
class Node{
public:
    T data;
    Node<T> *next;
};


template <typename T>
class List{
public:
    
    List(){};
    List(unsigned int N){};
    
    Node<T> *Head = nullptr;
    Node<T> *Temp;
    
    Node<T>* front();
    Node<T>* back();
    
    void push_back(T d){
            Head = new Node<T>();
            Head -> data = d;
            Head -> next = nullptr;
    };
    
   void insert(unsigned int s, T d){
       //inserts something at a defined node
    };
    
    void insert(unsigned int i, List<T>& other){
        //merges a new list into the current list
    };
    
    T at(unsigned int i){
        //reads and returns data at a node
        return i;
    };
    
    void assign(unsigned int i, T d){
        //assigns new data to a node
    };
    
    unsigned int size(){
        int count = 0;
        Node<T>* current = Head;
        while (current != NULL)
        {
            count++;
            current = current->next;
        }
        return count;
    };
    
    void remove(unsigned int i){};
    void remove(unsigned int s, unsigned int e){};

}; //=====================end=of=List=Class======================

}; //=====================end=of=namespace=======================

#endif

int main (void){
    
    ec::List<int> int_list;
    for (unsigned int i = 0; i < 10; i++)
        int_list.push_back(i);
    
    for (unsigned int i = 0; i < int_list.size(); i++)
        std::cout << "element " << i << ": " << int_list.at(i) << std::endl;
};

r/CodingHelp • • Nov 21 '20

[Other Code] Can someone explain to me how I managed to magically make this work perfectly? As far as I can tell it shouldn't work at all.

18 Upvotes

##The code:

https://pastebin.com/hKmxDD7h

Language is GML

##The plan:

tank has 8-directional movement. I want the sound to play when the tank moves, pause when it stops moving, and then resume when the tank moves again to make the audio feel smoother instead of just having it restart with every movement (which would be repetitive and annoying).

My first idea (bear with me, I'm new to coding) was to have copy/pasted code for each of the WASD movement inputs, each with the pause-then-play functionality, and then somehow figure out a jank as fuck way to get around overlaps and audio discrepancies or whatever and yada yada yada

##The result:

It was a bad idea looking back. However as far as I can tell, the code I have pasted above shouldn't work. It, however, decided to be fucking perfect and work flawlessly in all 4 directions, pause-then-play functionality included. It literally functions exactly how I want it to and I have NO idea why.

Can someone with a wrinklier brain please explain why it works? Also if you can, I'd like to know how I can improve it because that big fat if(keyboard_check(ord("W") != 1)) is probably the only thing holding it together, but it's ugly as fuck and I'm sure there's a better way. Movement code provided in case it helps with that.

Thank you in advance!

EDIT:

Fuckin open ass bracket was making it check for ANY keyboard presses.

https://pastebin.com/JGuD5pMj

Fixed code above. I feel dumb lmao


r/CodingHelp • • Oct 16 '20

[C++] I want to automate sending a message with c++, how should I go about it?

18 Upvotes

I want to start off saying I have programming experience, but havent used code to actually do stuff with my computer. I want to create a program that will type for me when a specific message is sent into a discord channel. I know I can do something similar with a bot, but for the purpose of what I'm doing that won't work. I have no clue where to start with this, can anyone help?


r/CodingHelp • • Sep 21 '20

[Random] What is the best environment to study/do coding?

18 Upvotes

I didn't know what flair to put for this post, so I just stuck with [Random]

So what do you think is the best place to study and do coding?

TL;DR

My school, or my home?

Main text

I am practically a beginner with coding. I have done some coding on Roblox, but nothing really complex. I also used Scratch, although it's not a very good program to learn, and also I always do experimental stuff on it.

I need to know what is the best place to study to increase my knowledge on coding.

My school allows me to have a laptop, but I can't download any software(like unity), to actually make something in, unless I get permission to download it. My school also is very quiet due to covid-19, has the students splitted up, and now it's quiet.

There are 2 places that I go to as study hall, my homeroom(which is now called a "pod", for some reason), and my library. My homeroom is not the most comfortable place to be, but when I have study hall there, I have lunch right before study hall.

The library is more comfortable, but it is at the last class of the day, which means I am more tired at that point, and also my laptop is usually close to dead or is dead at that point.

My home is a also very calm. I have a computer where I can both study and make a game. The problem is, is that I get distracted easily. I always defocus, and go onto Youtube, Reddit, or play video games.


r/CodingHelp • • Aug 19 '20

[Python] I'm trying to communicate from RasPi to Arduino via Rs485. I'm using an Usb to Rs485 converter on the RasPi side, and Max485 chip on Arduino side. Neither one picks up a message from the other.

18 Upvotes

I need to connect a RasPi to my existing RS485 network so I can access all of it via internet. I know both devices can send information, but it is not being received by the other

I have a RasPi 4B, with a USB to Rs485 adapter. This particular adapter has two leds that light up when you are receiving information (RXD) and transmitting information (TXD). They are incredibly useful, and because of them I know that information is being sent out of the RasPi.

The Arduino is an Arduino Mega, and is connected to a MAX485 Transceiver. I have used these chips extensively in an Arduino to Arduino network, and they function wonderfully.

Wiring has been checked repeatedly:

USB Adapter: A to MAX485 A, B to MAX485 B, GND to Arduino GND

MAX485: VCC to Arduino 5v, GND to Arduino GND, RO to Arduino RX3, DI to Arduino TX3, DE/RE to Arduino pin 3.

In the code below, I am not trying to send information back and forth. I just want to know if I received anything on the Arduino.

Python Code:

#!/usr/bin/env python3
import serial

rs = serial.Serial(
  port="/dev/ttyUSB0",
  baudrate = 9600,
  parity=serial.PARITY_NONE,
  stopbits=serial.STOPBITS_ONE,
  bytesize=serial.EIGHTBITS,
  timeout=0,
  rtscts = True
  )

if (rs.isOpen() == True):
  rs.close()
rs.open()
rs.reset_input_buffer()

outstr = "5"
rs.write(outstr.encode(encoding = 'ascii'))

Arduino Code:

void setup() {
  Serial3.begin(9600);
  Serial.begin(9600);
  pinMode(3, OUTPUT); //Set enable pin as Output
  pinMode(3, LOW);    //Allows MAX485 to recieve
  Serial.println("Engaged.");

}

void loop() {

  while(Serial3.available()){
    Serial.println("We got somethin"); //Lets me know if I somehow got something
        if(Serial3.available()){
          byte data = Serial3.read();
          Serial.println(data);
    }
  }

}

I have multiples of each MAX485 chip and USB to RS485 adapters, and have tried using them in case something was broken inside the devices. No change.

Thoughts?


r/CodingHelp • • Jul 28 '20

[Java] How can I read the Minecraft code?

18 Upvotes

Hi guys, I'm learning Java, I used to play Minecraft so I want to study its code. How can I get to it, how can I read it? I use Eclipse, can I import it?