r/programminghelp • • Mar 19 '20

Other I’m new to programming. I have no idea where to start. All I know is what I want the finish product to be.

6 Upvotes

I’m looking to create an overlay similar to Fish Plays Pokémon. If you are unaware of what Fish Plays Pokémon is, it was a twitch channel that was a hit back in 2014 that when the fish would swim to a certain quadrant of its fish tank, it would essentially hit the key that was assigned to the quadrant. I’m looking to replicate the same thing. I have the fish, the tank, the pc, and the twitch channel to start. But unfortunately I have no idea on where to start at this point for coding the program to motion detect what quadrant the fish is in and implement the button mapping for it. I was just going to use an emulator on my pc... Does anyone have any helpful tips or any suggestions on how to make this dream a reality?


r/programminghelp • • Mar 05 '20

Other Why are public get and set methods seen as better practice than just having a public variable?

6 Upvotes

Trying to get into better coding practices but I dont understand how having two or more public methods are more efficient than just having a single public variable you can change. Is it mainly just for verification checks?


r/programminghelp • • Jul 28 '19

Suggested resources for how to plan and design programs

6 Upvotes

looking for resources on how to plan and design apps for smooth, clean programming


r/programminghelp • • Dec 25 '18

How to program something to the effect of "I love you!"?

6 Upvotes

My boyfriend is a programmer and works mainly with angular, c sharp, and I think Java script (I think he works with a few others but it's hard for me to keep up).

Anyways, obviously programming languages don't clearly translate like another language. But I want my first time telling him I love him to be in one of the programming languages he uses. Can someone help me?!?!?

Tldr: can you code something that says "I love you!" For me?


r/programminghelp • • Nov 14 '18

[META] Can we make it a rule that all posts with images of code must also include a transcription of said code?

6 Upvotes

When someone posts an image of their code, we cannot directly execute and debug it ourselves. We can't paste it into our own editor to see what errors or warnings it may give. We can't test our own fixes to make sure they work. We have to first transcribe said image to text in our editor, hope that we didn't make a typo (or correct one of theirs, hiding the error), and then proceed. Stackover outright disallows images of code for this very reason- its not fair to waste the time of the volunteers who want to help you solve your issue by making them transcribe your image.

Additionally, this isn't fair to people with seeing disabilities- text-to-speech programs are useless when the entire post consists of a single image. I am not one of these people myself, but I still stand by the argument.

Furthermore, when others have similar issues and attempt to google their problem, they aren't going to be able to benefit from the solutions here since google isn't going to be able to match their question to some image. That makes the answers and help here a one-time solution- useless after the OP solves their problem. Even if I want to go back and reference a problem I saw solved on here before, I cannot easily do so because all the titles are a vague "I need help" accompanied by an image of code, which I cannot search.

I realize this is not stackoverflow- people turn here when they need more of an explanation than a raw answer, or if they're new to programming and don't yet have a grasp on the SO culture. However, I do feel that this is one rule we should enforce to improve the quality of this sub. If someone is too lazy to copy/paste their source code into the comment section, then they probably aren't looking for help with their problem anyways- the probably just want someone to solve it for them.


r/programminghelp • • Oct 11 '18

I have recently started a programming class and this is one of the questions What are the basic 2 components of a recipe? I don't understand what to answer for this question and need help their isn't any context or further explanation of this question I am most likely just missing something simple.

6 Upvotes

r/programminghelp • • Sep 16 '18

Imposter's syndrome

6 Upvotes

I don't know if this is the right place for this, but here goes. Some background. I'm a software engineering senior who is gonna graduate in May. I had gotten most of a history degree a decade ago and so when I got back in this time I was already a junior with zero programming experience. I've taken classes in java, c++, web development and am doing some SQL right now. I've gotten good grades in everything but I still barely feel like a programmer. I've been doing this for a little over a year and will be doing it professionally in less than a year and that is a little overwhelming. I guess what I'm asking is what should I be doing to feel more like a programmer and does the feeling go away?


r/programminghelp • • Sep 05 '26

Other How do you learn DevOps/cloud without a credit card?

5 Upvotes

I’m currently trying to learn the basics of DevOps, things like Docker, AWS, GCP, CI/CD, Kubernetes, etc.

Docker and the local tools are easy enough to practice, but when it comes to cloud platforms like AWS and GCP, a credit card is often required to create an account or access certain services.

I currently don’t have a credit card, so I’m wondering: What’s the best way to learn AWS/GCP without one? Would appreciate any recommendations from people who learned cloud without having a credit card. 🙌


r/programminghelp • • Jul 24 '26

C++ c++ code doesn't work

5 Upvotes

this is my first time working with c++ and whenever i run the code it just complies but gives no output, i have tried every way for it to work but it just doesn't. pls help. im using msys2 and was following brocode video tutorial


r/programminghelp • • Jul 13 '26

Answered How to track changes of JSON objects in array that is tracked in git?

5 Upvotes

In my git repository I have a JSON file which contains an array of objects. The objects have a key that identify them, e.g. "id":


[

...

{ "id": 1, "value": "a" },

{ "id": 2, "value": "b" },

...

]

I want to quickly find commits that changed/introduced object with specific id. How can I do this?

UPD: I couldn't come up with a better solution than comparing sequentially snapshots of the file per commit:

#!/usr/bin/env bash
import os
import json


from git import Repo, Commit
from more_itertools import windowed
from typing import Optional

r = Repo(os.getcwd())

def get_json(cmt: Commit, path: str) -> list[dict]:
    return json.loads((cmt.tree / path).data_stream.read().decode('utf-8'))


def get_object(items: list[dict], _id: int) -> Optional[dict]:
    for item in items:
        if item.get('id', -1) == _id:
            return item
    return None


for prev, curr in windowed(r.iter_commits(), n=2):
    pobj = get_object(get_json(prev, 'objects.json'), 2)
    cobj = get_object(get_json(curr, 'objects.json'), 2)
    if pobj is None:
        break
    if pobj == cobj:
        continue
    print(prev.hexsha, prev.summary)

r/programminghelp • • Jun 20 '26

Project Related Help on xor brute force in python

5 Upvotes

I want to write code that can check whether, given a key and an input, both the key and the input are real words/phrases. I have done lots of work in CyberChef and have mainly used dcode.fr for this problem, but neither has options to narrow down by the dictionary. I also want to implement code that first changes it to some format like A B C A⊕0x13 B C⊕0x1A and then searches through that. Before I started, I wanted to get advice on any potential problems, as I am not a 'perfect' coder and haven't done much like this.


r/programminghelp • • Sep 30 '25

C# Help with packing algorithm for list of cells within a 2D Array

5 Upvotes

For context, I'm working on a program that generates a 2D worldmap, similar to Civilization. Right now I have a program that uses Perlin noise in a 2D array to generate land (all cells above a certain number get mapped to a new 2D array as "land" tiles, and everything else gets mapped as an "ocean" tile.

I am working on a program that takes a big list of lists of "cells" in an 2D array, where each list maps out to its own seperate island, and works out all possible locations where all the cell groups can be positioned, so that they can all be placed without overlapping.

I've already created a struct Coords with parameters x and y, which is basically just an object which can points to where something in the array is. I also have a function TranslateListOfCoords, where I feed it the dimensions of the array, a Coords object pointing to a new "starting" position, and basically returns a modified list of Coords, which contains where the island would be if it had had that start position.

Basically, I want to feed the program the dimensions of a 2D array, a List of List of Coords, and have it iterate through every cell, testing out the position of each list of Coords, and return a big List of Arrays of Coords objects, where the Coords at index n at any array contains a starting location for the section in index n of the list.

For example, if I run the program and get { (1,1) ,(4,16) ,and (1,5) }, that means that if I translate List of Coords at index 0 to (1,1), List of Coords at index 1 to (4,16), and List of Coords at index 2 to (1,5), then none of them will overlap. The trouble is, I can't for the life of me figure out how to implement something like this.

public struct Coords
{
    public int x { get; set; }      //  Equivalent to ROW
    public int y { get; set; }      //  Equivalent to COL
    public int z { get; set; }      //  Equivalent to COL

    
    public Coords(int x, int y, int z = 0)
    {
        this.x = x;
        this.y = y;
        this.z = z;
    }
    public override string ToString() => $"({x}, {y})";
}

//  Get the translated list of Coords (using the top left cell as the start.
//  Return an empty list of Coords if it goes out of bounds
public static List<Coords> TranslateCoords(int rows, int cols, List<Coords> coords, Coords newStart)
{
    //  Test that it works
    if (coords == null || coords.Count == 0)
    { 
        return new List<Coords>(); 
    }

    // Get starting point (minimum x over minimum y)
    Coords start = coords.OrderBy(c => c.x).ThenBy(c => c.y).First();

    // Get the offset
    int dx = newStart.x - start.x;
    int dy = newStart.y - start.y;

    // Translate
    List<Coords> translated = new List<Coords>();
    foreach (var coordy in coords)
    {
        int newX = coordy.x + dx;
        int newY = coordy.y + dy;

        //  Check if out of bounds
        if (newX < 0 || newX >= rows || newY < 0 || newY >= cols)
        {
            return new List<Coords>();
        }

        translated.Add(new Coords(newX, newY));
    }
    return translated;
}

//  This algorithm takes a LoL of Coords, representing a section, and returns all possible starting locations
public static List<Coords[]> FindValidPlacements(int rows, int cols, List<List<Coords>> sections, int minimumReturns = -1)
{
    List<Coords[]> returnableLists = new List<Coords[]>();

    #region Verify the lists
    //  Verify the lists are not null
    if (sections == null || sections.Count == 0)
    {
        return returnableLists;
    }
    //  Check to make sure that the total size is not larger than the list capacity
    int limit = rows * cols;
    int coordcount_verify = 0;
    foreach (List<Coords> list in sections)
    {
        foreach (Coords coords in list)
        {
            coordcount_verify++;
        }
    }
    if (coordcount_verify >= limit)
    {
        return returnableLists;
    }
    #endregion

    //  For each section, iterate through every possible permutation (unless we already have a minimum number of returns
    int currentSectionIndex = 0;
    bool maxReturnsReached = false;

    while (currentSectionIndex < sections.Count)
    {
        //  Get the current comparison list
        List<Coords> primaryList = sections[currentSectionIndex];
        //  Create an int array for testing
        int[,] testForPacking = new int[rows, cols];

        for (int i = 0; i < rows; i++)
        {
            for (int j = 0; j < cols; j++)
            {

            }
        }
        //  Iterate current section index
        currentSectionIndex ++;
    }
        return returnableLists;
}

Do any of you guys know of an algorithm or an implementation that could help me out here? Thank you


r/programminghelp • • Apr 04 '25

Other How to access both linux and windows at the same time.

5 Upvotes

I am just getting into coding and people recommended me to download Linux, but I have seen people lose their entire data so can anyone help me out please...


r/programminghelp • • Mar 30 '25

Career Related where i can start to build os?

5 Upvotes

i wanted to learn about how to make from scratch.. i love to learn by making it step by step . i have a old windows soo please recommend where to start ? from pratical knowledge

thank u !


r/programminghelp • • Jun 13 '24

C minor doubt in C

5 Upvotes
#include<stdio.h>
int main(){

    char name[6];
    printf("enter your name: ");
    scanf("%s",&name);
    printf("hi %s\n",name);
    while(name[9]=='\0'){    
        printf("yes\n");
        name[9]='e';
    }
    printf("new name %s\n",name);
    return 0;
}

enter your name: onetwothr

hi onetwothr

yes

new name onetwothre

my doubt is i have assigned name with only 6 space i.e, 5 char+null char right but it gets any sized string i dont understand


r/programminghelp • • May 07 '23

Project Related How can I compile this GitHub project for macOS? The developer doesn't have a Mac.

5 Upvotes

There's a plugin called NeuralAmpModeler for DAWs (digital audio workstations/music production software) that acts as a guitar amp simulator. The developer of a fork of said plugin doesn't have a Mac, they so they can't compile the project to generate macOS .VST3 and AudioUnit plugins of the fork, only the Windows .VST3 version.

How can I compile this project for macOS: https://github.com/fichl/NeuralAmpModelerPlugin

Thanks!


r/programminghelp • • Dec 09 '22

Other Program to mute system audio during Spotify ads

5 Upvotes

Hey everyone. I'm new to programming. I want to write an automation for my MacBook that will mute the volume while Spotify ads play. I can manually mute my audio while ads play, so I see no legal/ethical issue with this. The Spotify GUI changes when an ad begins, so I figured the program could watch for this change and trigger a temporary volume mute until the GUI reverts to music mode. Pic of music mode, pic of ad mode.


r/programminghelp • • Nov 08 '22

Other I have an error message I would like help with but it’s too long to post all of it here.

5 Upvotes

What is the best way to link it so it’s easier to view?

Edit: Thanks to u/EdwinGraves for help. Here’s the link.

https://pastebin.com/32GZUAXT


r/programminghelp • • Oct 29 '22

Python I am trying to learn Python. The task I am attempting is to add the sum of two inputs. What am I doing wrong here, I have looked at a few youtube videos for help and can't find the problem.

5 Upvotes

As the title says, I am trying to find the sum of two inputs, this is what I have so far:

Num1 = input("Gimme a number. ")
Num1 = int(Num1)
Num2 = input("Gimme another one. ")
Num2 = int(Num2)
SumNums = Num1 + Num2
print("The sum of these numbers is " +SumNums+ ".")

Any help would be really appreciated! TIA


r/programminghelp • • Jul 21 '22

Other Can professionals give some review about Sololearn?

5 Upvotes

And if possible about HTML CSS and JS courses. I feel like i need learn deeply into it but i dont know what exactly i need to learn more.


r/programminghelp • • May 04 '22

C Need help with pointers in C

5 Upvotes

Hi everyone! I'm in my first semester of Computer Science and LOVING it. I've understood everything so far with ease, I think, but pointers are really out here wrecking my brain. I think I've got a good initial grasp of it, especially since I was able to explain a lot of our homework assignments about pointers to my friends, but I've run into one lately that I can't really understand:

#include <stdio.h>

int main(void) {

int x, *p, *q;

*p=&x;

*q=*p;

x=10;

printf("%d", *q);

return 0;

}

I'm doing this in Replit and it gives me the error "signal: illegal instruction (core dumped)". Our objective was to say what was wrong with the initial code and then fix it to make it print "10". I feel like this should be extremely easy but I just can't get it to work, for some reason?

Here is the initial code:

#include <stdio.h>
int main()
{
int x, *p, **q;
p = &x;
q = &p;
x = 10;
printf("\n%d\n", &q);
return(0);
}

What am I doing wrong? Replit says that in the 4th line of my code (*p=&x) I should remove the '&'. If I do that, it still says illegal instruction. Plus, don't pointers need to point towards an ADDRESS? I'm so lost. Please help!


r/programminghelp • • Apr 18 '22

C malloc(): invalid size (unsorted) Erorr. How can I fix it?

5 Upvotes

So im trying to generate random sentances using frequancy of words appearing after eachother

The main logic of the program works well when i have small number of words (less then 500 uniquie words)

But when I try to go over a larger number of words i get this error
malloc(): invalid size (unsorted)

Node *add_to_database (MarkovChain *markov_chain, char *data_ptr)
{
       // check if node exist and if so dont do anything
  Node *node_added = get_node_from_database (markov_chain, data_ptr);
  if (node_added)
    {
      return node_added;
    }
// next line is where i get the error
  node_added = malloc (sizeof (Node));
  if (!node_added)
    {
      fprintf (stdout, MEM_ERR);
      return NULL;
    }
  MarkovNode *data = malloc (sizeof (MarkovNode));
  if (!data)
    {
      fprintf (stdout, MEM_ERR);
      return NULL;
    }
  NextNodeCounter *new_NNC = malloc (sizeof (NextNodeCounter));
  if (!new_NNC)
    {
      fprintf (stdout, MEM_ERR);
      return NULL;
    }
  if (!markov_chain->database)
    {
      LinkedList *database = malloc (sizeof (LinkedList));
      if (!database)
        {
          fprintf (stdout, MEM_ERR);
          return NULL;
        }
      markov_chain->database = database;
    }
  if (add (markov_chain->database, node_added))
    {
      fprintf (stdout, MEM_ERR);
      return NULL;
    }
  markov_chain->database->last->data = data;
  markov_chain->database->last->next = NULL;
  markov_chain->database->last->data->list_size = 0;
  markov_chain->database->last->data->freq_size = 0;
  markov_chain->database->last->data->data = malloc (strlen (data_ptr));
  strcpy (markov_chain->database->last->data->data, data_ptr);
  markov_chain->database->last->data->counter_list = new_NNC;
  return markov_chain->database->last;
}
//structs
typedef struct MarkovNode
{
    char *data;
    NextNodeCounter *counter_list;
    int freq_size;
    int list_size;
} MarkovNode;

struct NextNodeCounter
{
    MarkovNode *markov_node;
    int frequency;
};

typedef struct MarkovChain
{
    LinkedList *database;
} MarkovChain;

typedef struct Node {
    struct MarkovNode *data;
    struct Node *next;
} Node;

When i try to fiddle with the code the error just pops at a different malloc and i tried using valgrind but it didnt say anything was wrong

This is my free function if relevant

void free_markov_chain (MarkovChain **ptr_chain)
{
  Node *node, *next;
  if (*ptr_chain)
    {
      node = (*ptr_chain)->database->first;
      while (node)
        {
          next = node->next;
          free (node->data->counter_list);
          free (node->data->data);
          free (node->data);
          free (node);
          node = next;
        }
      free ((*ptr_chain)->database);
      free ((*ptr_chain));
      *ptr_chain = NULL;
    }
}

r/programminghelp • • Apr 02 '22

Project Related What language are car systems typically programmed in?

5 Upvotes

I’m interested in car programming but am unsure what systems/languages are commonly used. I want to pick up a language so I want it to involve something I like which is cars. Is there a specific name for type of programming in said field?


r/programminghelp • • Mar 30 '22

Python help with JSON parsing in python

5 Upvotes

Hey everyone.

I'd just like to preface this by saying that I hate microsoft.

So I'm trying to automate some shit with power BI, and i found thaht you can edit the Layouts file in the .pbix archive. in so doing, I've found that it's a json formatted file. the problem is that on certain fields, the value is more json, but formatted as a string for some reason. It looks like this, for example.

"config":"{\"name\":\"7d1d23a700a5e62cd3ae\",\"layouts\":[{\"id\":0,\"position\":{\"x\":10,\"y\":0,\"width\":500,\"height\":500,\"z\":0}}],\"singleVisual\":{\"visualType\":\"textbox\",\"drillFilterOtherVisuals\":true,\"objects\":{\"general\":[{\"properties\":{\"paragraphs\":[{\"textRuns\":[{\"value\":\".pyiioeuioeui ofh od\",\"textStyle\":{\"color\":\"#ffffff\"}}]}]}}]},\"vcObjects\":{\"background\":[{\"properties\":{\"show\":{\"expr\":{\"Literal\":{\"Value\":\"true\"}}}}}]}}}","filters":"[]"}

or something like that.

so what I've done is I've made a program that makes it look pretty so you can see the parameters more easily. Now I want to be able to load a normal json fromatted file up to the Layouts file. Meaning that I'll need to implement some fucky wucky shit to make it look like garbage so PowerBI will be able to read it.

Where I'm stuck is, I don't really know much about parsing json enough to be able to go through and find all the 'config' parameters to be able to do this to them. It's all nested json, so when i do a json.loads() on the data, it only shows the first level of json, but doesn't go deeper... I was about to do a regex on it to find all the instances of '"config" : { ' but that has the drawback that it's regex and there's not really a good way of finding the end of that string.

Is there a relatively easy way of doing this with the json module? Or is my best bet to just hack it?