/r/CodingHelp

Photograph via //r/CodingHelp

Welcome! Feel free to ask any questions regarding coding you have!

Our Rules

1. FLAIR YOUR POSTS! Don't put tags in post titles!

2. Do not ask us to do all the coding for you unless you have money to spend. (If you have got money to spend, make that clear and the amount in question).

3. Do not post spam and/or misleading titles.

4. Do not be abusive to other coders.

5. Please format code properly, or use a site such as Gist or Pastebin. If possible please provide a live example of your issue.

6. Do not downvote people because you think they asked a dumb question. Just because you think that someone has a dumb question, doesn't mean that it is dumb to them.

7. Do not have a misleading user flair. Keep them sensible, describing your level of coding ability and/or languages you know and/or your profession.

8. Please do not ask unethical questions, such as asking for homework to be written by someone else, or asking someone to copy another project directly.

9. Make sure to follow the Reddit Rules.


How to start coding:

Check our website https://codinghelp.site we have all the information you need there!


Related subreddits:


Suggest a post flair

If you have any suggestions for flairs (programming languages or generic coding topics) that we should add, please use the button below to message the mods with your suggestion.

If approved as a sensible flair for the community to use, it will be added to our bot for automated suggestions and to the flair list for everyone to use!

Anyone who abuses this by spamming mods will be banned.


Current supported flairs

  • HTML
  • CSS
  • Javascript
  • PHP
  • SQL
  • Ruby
  • Java
  • Python
  • C++
  • C#
  • C (Not in Bot)
  • Open Source
  • Other Code
  • Random
  • Meta

Flair colors

  • Green

Web Related Languages (Eg HTML, CSS)

 

  • Blue

App Related Languages (Eg Python, C#)

 

  • Red

Generic Coding Topics (Eg Open Source)

 

  • Yellow

Other Flairs (Eg Random, Meta)


/r/CodingHelp

78,801 Subscribers

0

How would I go about making a search bar similar to trivagos?

I want to make a search bar that's pretty much exactly like it. What would I need to manipulate?

0 Comments
2024/09/25
22:39 UTC

1

Building A Compiler

So for context a current project I’m working on is building a compiler. A suggestion is to use Jasmin and the JVM to actually compile the code. Why is that the case? I’m building the compiler in C so I don’t really understand the purpose of Jasmin?

0 Comments
2024/09/25
21:32 UTC

1

how to buy dsa course by abdul bari?

Im trying to buy the course from his website but my card keeps getting declined and on udemy its too expensive

0 Comments
2024/09/25
20:32 UTC

2

I'm looking for a package to replace WiX with Python

Basically, I'm find WiX Toolset (Windows Installer XML) is so unpleasant to work with that I'd much rather to do those with another installer library. I've looked briefly at InnoSetup and Advanced Installer, but our install is quite complex and needs us to check variables, files existence and a bunch of other things that would be trivial in python.

I'm not opposed to using another recognized programming language, and it would be absolutely fantastic if it worked cross-platform but not required. I will write it myself if I need to but I want to make sure I'm not re-inventing the wheel first.

Note that I am NOT looking for PyInstaller or Nuika, I need to be able to register with the OS so packages can properly be upgraded and removed.

0 Comments
2024/09/25
19:59 UTC

1

Problem integration deploy React/Node Nginx

I cannot connect my front with my back everytime it gets this error, i can acess my back alone but those two do not integrate. I can just connect my front if i use localhost, otherway not

Failed to load resource: net::ERR_SSL_PROTOCOL_ERROR

this is my server config and my front

server {
    listen 443 ssl;
    server_name example.com.br www.example.com.br;

    # Frontend setup
    location / {
        root /var/www/example/client;
        index index.html;
        try_files $uri $uri/ /index.html;
    }

    # API setup (connects to Node.js backend)
    location /api/ {
        proxy_pass http://localhost:8800;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

        # Allow CORS
        add_header 'Access-Control-Allow-Origin' '*' always;
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT' always;
        add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization' always;
        add_header 'Access-Control-Allow-Credentials' 'true' always;
    }

    # SSL setup (managed by Certbot)
    ssl_certificate /etc/letsencrypt/live/www.example.com.br/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/www.example.com.br/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}

front

      try {
        const response = await fetch(
          "https://example.com.br:8800/api/chatgpt",
          {
            mode: 'no-cors',
            method: "POST",
            headers: {
              "Content-Type": "application/json",
            },
            body: JSON.stringify({ message: input, userUID }),
          }
        );
0 Comments
2024/09/25
19:54 UTC

0

Coding Suggestion Suggest a career path to become a software developer with elite skills!

Suggest a career path to become a software developer with elite skills!

1 Comment
2024/09/25
18:28 UTC

0

Open source API for meetings

I am looking for an opensource API that will get a timestamp of a meeting for user X and will return X timestamps that are before that time to send reminders to the user based on working week/hours.

Ideally , weekend day and working hours can be sent as params (weekend day can be Friday or Sunday and working hours can be 9-5 or 10-13 )

Any free apis ? Can also be a node package

Thanks

0 Comments
2024/09/25
17:33 UTC

1

help!

hello all,

I am so confused please help me with my coding HW. Currently stuck trying to figure out the assignments and if statements. Here is what my assignment is asking of me.

Task 2 Write the rest of the program using assignment statements and if statements as appropriate. The output statements are written for you.

// HouseSign.java - This program calculates prices for custom house signs.


public class HouseSign 
{
    public static void main(String args[])
    {
        // Declare and initialize variables here.
        // Charge for this sign.
        double charge = 0.0;
        // Number of characters.
        int numChars = 8;
        // Color of characters.
        String color = "gold";
        // Type of wood.
        String woodType = "oak";
        // Write assignment and if statements here as appropriate.  
         

        // Output Charge for this sign.
        System.out.println("The charge for this sign is $" + charge);
    }
}   
1 Comment
2024/09/25
16:07 UTC

1

Help with writing a script

In unity:

Could somebody write me a script so if i assign a prefab into this script, it makes the assigned prefab spawn with a distance of 100-150 and on eye-level looking at the player (facing the player aswell) every 5-10 minutes and if you look at it, it jumpscares you for 1.5 seconds and plays an audio

0 Comments
2024/09/25
15:14 UTC

1

Websocket api to keypress

Been told it is simple, but I have no clue how to code at all, I'm looking to have a program that looks at a webapi on a localhost to output a F24 key press when a specific part is "true" and not when "false"

At http://localhost:14564/api/path?path=$.mixers.01002FV0803AAI.button_down, I find a list of things that looks like
[{"Bleep":false,"Cough":false,"EffectFx":false,"EffectHardTune":false,"EffectMegaphone":false,"EffectRobot":false,"EffectSelect1":false,"EffectSelect2":false,"EffectSelect3":false,"EffectSelect4":false,"EffectSelect5":false,"EffectSelect6":false,"Fader1Mute":false,"Fader2Mute":false,"Fader3Mute":false,"Fader4Mute":false,"SamplerBottomLeft":false,"SamplerBottomRight":false,"SamplerClear":false,"SamplerSelectA":false,"SamplerSelectB":false,"SamplerSelectC":false,"SamplerTopLeft":false,"SamplerTopRight":false}]

It's specifically Bleep, when bleep is true I want the program to output F24 (or any F# key really)

I was told {"id":18446744073709551615,"data":{"Patch":[{"op":"replace","path":"/mixers/S200601828CQK/button_down/Bleep","value":false}]}} would work to find this too, but I don't know I found it in the first place and I am not proficient at all.

This is an api that is for a usb device that outputs a true when a specific button that is usually not remap-able is pressed, was hoping to get it to do something extra on top of what it usually does when I press the button, that is why I come to you all, please help if you would! Willing to pay a little if anyone does have a working version of code for this!

0 Comments
2024/09/25
14:58 UTC

5

what code language do i learn?

i want to develop my own games and also have a job as a game programmer. what code is the best to learn first? also where can i learn these and what apps/ websites will i use for them

13 Comments
2024/09/25
14:56 UTC

2

pip install not working

i have been trying to install something using pip but it has just decided that it doesn't want to work, i have tried to run it in the python shell, cmd prompt and powershell (all on administrator) but it doesn't want to work. Can someone please send advice on what i should try?

3 Comments
2024/09/25
14:51 UTC

1

Looking for a website that search for exisiting diagrams of programming concepts on the web

Good day friends, does anyone know the name of the site that searches for a specific topic and loads image results with links to the author website.

I used to have it on my browser and it helped me grasp coding concepts because of the visualsbut sadly I can't remember it anymore. Most search results give me AI diagram generator which I don't need, because I want existing authored diagrams with reference links that redirects to the image's author website.

I'm really desperate to know the name of this website.

I can't recall if this website is AI powered or not, all I know is it's like a google image search engine but for programmers and it loads a bunch of diagrams/roadmaps/mindmaps any sort of visuals

PS. I am not a natural english writer, if there's anything confusing about my grammar I apologize.

0 Comments
2024/09/25
13:22 UTC

1

Any Idea

If I am creating a backend that involves real-time IoT data and I don't have actual devices, is there a way to simulate the data?

3 Comments
2024/09/25
11:56 UTC

1

Where can I start with algorithms?

In college I have a course thats about algorithms but they don’t explain it really well so I’m thinking about learning on my own too. What are some good places to learn? Right now we are at the Shortest Path Length algorithm and the Manhattan Distance algorithm

1 Comment
2024/09/24
21:47 UTC

1

Weird Error

weird error going on in my code

(code calculates Armstrong numbers)

Error

main.c: In function ‘main’:

main.c:7:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]

scanf("%d", &number); // Removed the extra space after %d

^~~~~~~~~~~~~~~~~~~~

unitTest1.c: In function ‘test_1’:

unitTest1.c:19:15: error: void value not ignored as it ought to be

int result = sumDigitCube(12345);

^~~~~~~~~~~~

make: *** [unitTest1] Error 1

Original code

#include <stdio.h>
#include "main.h"

int main() {
    int number;
    printf("Enter a number: ");
    scanf("%d", &number);  // Removed the extra space after %d
    sumDigitCube(number);
    return 0;
}

void sumDigitCube(int number) {
    printf("\nThe Armstrong numbers are:\n");
    for (int n = 1; n <= number; n++) { //makes n = 1, basically while(n <= inpted number), adds 1 to n at the end of each loop
        int temp = n; //makes temp number = n so it doesnt change directly
        int temp2 = 0; //makes temp2 equal to 0 after every loop
        
        while (temp > 0) { //this loop does the calculations
            int digit = temp % 10;
            temp2 += digit * digit * digit;
            temp /= 10;
        }

        if (temp2 == n) { //this if statement checks it its an armstrong number
            printf("%d\n", n); 
        }
    }
}
3 Comments
2024/09/24
21:15 UTC

0

I'm about to start coding

I want to know how should I start training coding and I heard that AI will replace programmers

I want some discussion on whether this will actually happen.

10 Comments
2024/09/24
17:16 UTC

1

Started with Java!

Hey everyone, I’ve recently embarked on my journey into the world of Java and I’m looking for some guidance to get started! I’m eager to dive deep into the language and gain a strong foundation. Could you recommend some solid resources (books, websites, tutorials, etc.) that would be perfect for a beginner like me?

Also, I’m curious about how much Java I need to master before I can comfortably transition into learning Spring Boot. I want to ensure I’m well-prepared before taking that next step. Any advice on the core concepts or areas I should focus on would be greatly appreciated!

0 Comments
2024/09/24
12:49 UTC

1

Set is not in order

I am just trying to output the square number of all even numbers in my list.
Somehow my Output is not in order. 
I am using VScode with Jupyter Notebook support. 

Code:

my_list = list(range(11))
my_set = set()
for item in my_list:
    if item%2 == 0:
        my_set.add(item**2)
print(my_set)

OUTPUT:

{0, 64, 4, 36, 100, 16}
3 Comments
2024/09/24
11:06 UTC

1

O(1) random access

I'm trying to make a queue where people can be added either in the front, after K people (K changes) or at the back, depending on their status. The queue should also return the ID of the person at any position that is queried. All operations have to take O(1) time.

I used 3 deques to make the add operations O(1), but my find operation is still O(n) due to traversal. I probably have to use an ArrayList but I'm not sure how since the order of people in the queue keeps changing. Any ideas?

6 Comments
2024/09/24
08:11 UTC

1

Trying to make 2 people talk over discord with an app

I want to make two people talk to each other over discord over a single message. Think me as a user. I will open the chat. I will type "A" to write a message or ask a question, others will type "B" to read messages and write a reply, and I will forward the answers to the writer.

Any ideas how can I do it?

I am just starting to the project and don't even know if it is possible.

1 Comment
2024/09/24
04:42 UTC

1

HTML and CSS website help

Hello I am building a website a bit at a time and am currently stuck on my About me page in which I would like to have my centered photo w/ border and then below it the same but the text section. I tried creating a section and a container in the section called selfie to use just one style sheet but it only recognizes the hero section. Then I tried just using the hero section Do I need separate style sheets for each page in the website or can I fix this with a few lines of code? I have the index.html fully working and the repository is located at https://github.com/JBelk625/Dogsitting-Website. Thank you so much in advance!

4 Comments
2024/09/24
04:08 UTC

1

Updating niches to reflect “user” posts.

Hi! I’m working on what i hope will be a simple project on neocities and I need some help with the basic framework.

I’m a writer and I want to create a fun unfiction project. My story takes place on a website sort of like reddit, with multiple niches.

the reader is meant to explore this website, with the ability to click on posts, investigate individual users’ profiles and post history. that sort of thing.

obviously these aren’t real “users,” they’re sock accounts. it’s not real social media. i’m trying to keep the coding as simple as possible, sticking as much to basic html as i can.

basically, i’m looking to create some sort of “post generator” program. a menu much like the one i’m writing in currently— with the option to choose the “user” i’m writing as, and the niche i’m posting in.

when i write a post, i would like to just hit “submit” and watch it appear inside of the post history of the relevant sock user profile, the niche i’m posting in, and the front page which includes posts from ALL niches.

down the line i would like to integrate a real account system so that real users can bookmark their progress and “play” the story in a more game-like way. but right now, i stress: i don’t need the ability to create real accounts. i just want a way to generate posts and automatically sort them into the right pages.

i’m sorry if this is complicated or vague. i haven’t gotten ANYWHERE with the site yet, and i figured this was likely the best place to start, seeing as it is the foundation of the entire project. thank you for any help you can offer, i will try to answer questions without wasting anybody’s time.

0 Comments
2024/09/24
00:32 UTC

1

Perfect numbers

Perfect numbers

I have been looking for the fastest perfect number program for Java to see if mine compares at all. I can find the first 20 really fast I think but I wanna see what else is out there and if there are any unusual ways people make theirs faster. If the program is in python or c I would also be interested to see it.

0 Comments
2024/09/24
00:30 UTC

1

Coding help

Hey y’all so I want to make a messages sorter to sort all messages from a specific server on discord and I was wondering how I might start doing that and what code should I learn to make a sorting bot of some kind(I knew HTML and could probably relearn it fairly easily, so if possible would I be able to make it using that?)

0 Comments
2024/09/24
00:14 UTC

1

is there any way to make these driver training interactive slideshows/videos have a playback speed slider or smt?

ive tried a few older methods nothing worked

https://imgur.com/a/4Uuxbjp

0 Comments
2024/09/23
22:19 UTC

1

Trying to center Google Calendar embed on Shopify template page

Hi! I built a custom liquid template for an events page. I've embedded a public Google Calendar and it looks like crap. It is all the way to the left, no padding. And is a bad mobile experience. Anyone know how to center this on the page? And make responsive for mobile?

This is the code I'm using:

<iframe src="https://calendar.google.com/calendar/embed?src=etudesocialmedia%40gmail.com&ctz=America%2FNew\\\_York" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>

I tried this, too (to center) and didn't work:

<div align="center">

<iframe src="https://calendar.google.com/calendar/embed?src=etudesocialmedia%40gmail.com&ctz=America%2FNew\\\_York" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe></div>
4 Comments
2024/09/23
20:54 UTC

2

Perfect numbers

I have been looking for the fastest perfect number program for Java to see if mine compares at all. I can find the first 20 really fast I think but I wanna see what else is out there and if there are any unusual ways people make theirs faster. If the program is in python or c I would also be interested to see it.

0 Comments
2024/09/23
20:24 UTC

1

Help with slot machine

Hi everybody doing a slot machine project but I'm struggling to make 5 reels of 3 symbols and making the winning line horizontal across the reels instead of vertical

<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Slot Machine</title> <style> body { font-family: Arial, sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; background-color: #282c34; color: #fff; } .slot-machine { display: grid; grid-template-columns: repeat(5,80px); grid-gap: 10px; margin-bottom: 20px; background: #444; padding: 20px; border-radius: 10px; } .slot { width: 80px; height: 80px; border: 2px solid #333; display: flex; align-items: center; justify-content: center; font-size: 1.5em; background: #fff; border-radius: 10px; position: relative; } .line { position: absolute; width: 100%; height: 2px; background: red; top: 50%; left: 0; transform: translateY(-50%); } button { padding: 10px 20px; font-size: 1.2em; cursor: pointer; background: #61dafb; border: none; border-radius: 5px; color: #282c34; } button:hover { background: #21a1f1; } #result, #points { font-size: 1.5em; margin-top: 20px; } </style> </head> <body> <h1>Slot Machine</h1> <div class="slot-machine"> <script> const symbols = ['🍒', '🍋', '🍊', '🍉', '🍇', '🔔', '🍀', '⭐']; const slots = Array.from({ length: 15 }, (_, i) => `<div class="slot" id="slot${i + 1}">${symbols[0]}</div>`).join(''); document.write(slots); </script> </div> <button id="spinButton">Spin</button> <h2 id="result" aria-live="polite"></h2> <div id="points">Points: 100</div>
<script>
    const spinButton = document.getElementById('spinButton');
    const result = document.getElementById('result');
    const pointsDisplay = document.getElementById('points');
    let points = 100;

    spinButton.onclick = () => {
        const slots = document.getElementsByClassName('slot');
        const spinResults = Array.from(slots).map(slot => symbols[Math.floor(Math.random() * symbols.length)]);
        spinResults.forEach((symbol, i) => slots[i].textContent = symbol);

        const reels = [[], [], [], [], []];
        for (let i = 0; i < spinResults.length; i++) {
            reels[i % 5].push(spinResults[i]);
        }

        let totalWin = 0;

        reels.forEach((reel, reelIndex) => {
            for (let i = 0; i <= reel.length - 3; i++) {
                if (reel[i] === reel[i + 1] && reel[i] === reel[i + 2]) {
                    totalWin += 30; // 3 matching symbols in a row
                    for (let j = 0; j < 3; j++) {
                        slots[reelIndex + (i + j) * 5].innerHTML += '<div class="line"></div>';
                    }
                }
            }
        });

        points += totalWin ? totalWin : -10; // Increment or decrement points based on results
        result.textContent = totalWin ? `You won ${totalWin} points!` : 'Try again!';
        pointsDisplay.textContent = `Points: ${points}`;
    };
</script>
</body> </html>
4 Comments
2024/09/23
17:01 UTC

4

i need some help

Is there any legit courses i can take from A to Z in java? I looked for courses but I do not know which to take and which is from scratch, free courses or paid, does not matter how much they cost, i took java in the university but i was not good at it and the professor was not the best.

Thank you for reading and i wish you all a great day.

5 Comments
2024/09/23
15:01 UTC

Back To Top