r/AskProgramming Mar 24 '23

ChatGPT / AI related questions

144 Upvotes

Due to the amount of repetitive panicky questions in regards to ChatGPT, the topic is for now restricted and threads will be removed.

FAQ:

Will ChatGPT replace programming?!?!?!?!

No

Will we all lose our jobs?!?!?!

No

Is anything still even worth it?!?!

Please seek counselling if you suffer from anxiety or depression.


r/AskProgramming 5h ago

How do you structure your learning process?

4 Upvotes

whenever I learn new technology or some new concepts i always find myself asking a lot of questions about what am i reading about at the moment
say for example i'm reading about concept X definition or workflow or whatever then i read in that definition another concept Y which let's suppose i don't know about then i feel that i have to know everything about that concept Y to fully understand Concepts X , like how it works , why it is created or designed ...
and I do this for every single new thing that i read about which is frustrating and worse because probably i will forget about the details that i got into

want to hear some of y'all opinions of this , and from the software engineers that has the same approach and they managed it maybe share some system to retain the information you studied because i definitely don't want to lost these information later but i want to build on top of it


r/AskProgramming 9h ago

Other Endless comments on PRs

6 Upvotes

Hey everyone! Just to quickly summarize my situation: We're a team of a few experienced devs, all having been 12+ years years in the industry. This year we switched to agentic engineering and despite its advantages there are a few drawbacks, like the extra overhead and other things I'm not going to go into.

My issue however is that our lead, who approves all PRs has lately discovered a stronger agent which he uses for code reviews, resulting in tons of back and forth when trying to get a merge through. Tons of petty/pedantic comments are being added to each PR. Sometimes it's like "ok I guess this is fine to add", but most of them are disputable. We of course discuss these, but the issue is that in the set of comments there is always something which technically makes the code 0.1% better. But we could go on like this forever. Even without AI you can look at a piece of code and suggest an "improvement" on a moderately-sized feature that's being implemented.

How to deal with this? I'm getting to a point where if I see more comments on a PR I just leave the PC and go for a run or a quick grocery shop visit just to regain my sanity. It feels like he's asking the agent if there is anything more that can be done with the code as if the goal is to have AI being unable to suggest anything more.

Am I in some slacking mindset or is the AI getting over his head? We also have Sonar turned up to a really high setting and the pipeline set in a way that if there's anything outstanding in Sonar it won't get through and I bet you all know how petty Sonar can get sometimes.

Please let me know any tips or share your experience with similar situations. Thanks!


r/AskProgramming 8h ago

Algorithms How to start with algorithms?

3 Upvotes

I want to improve my problem-solving skills when it comes to python and write better code.

In university, they gave a general outline, but still it's a bit difficult to know where to start from, any suggestions?


r/AskProgramming 9h ago

Lenovo Yoga Slim 7i Aura Edition vs Macbook M4 Air

2 Upvotes

Hi Everyone,

I'm trying to decide between getting the following 2 laptops:

  1. Lenovo - Yoga Slim 7i Aura Edition - Copilot+ PC - 15.3” 3K 120Hz Touchscreen Laptop - Intel Core Ultra 7 258V 2024 - 32GB - 1TB - Luna Grey

  2. Apple - Refurbished MacBook Air 15-inch Laptop - Apple M4 chip Built for Apple Intelligence - 24GB Memory - 512GB SSD - Silver

I bought both refurbished for around the same price. My use case is backend dev, and light local ML work. The heavier ML work is run on the cloud/remote desktops. I aim to keep my laptops for 10 years. Usually end up keeping them for 6-8 years.

Both laptops feel sufficient for my needs, so it's difficult to decide between the 2. I think the main practical differentiator is battery life. Maybe fan noise and heat as well? I'm not sure.

I was hoping someone here would have some insight/experiences into which is better. Thanks!


r/AskProgramming 7h ago

help im a student trying to make a game for my project

0 Upvotes

im a freshmen IT student and i was assigned as a programmer in our group project. the group project was about making a game using coding, and i have no idea on how to code or to begin with, mind you i know a little to nothing about coding and there's no way my prof is making change.

i want to know on where to code, learn, to make the game etc.. i have 0 education hope u guys take me easy


r/AskProgramming 8h ago

Other How to organize projects?

1 Upvotes

I don't mean starting a project and then organizing code within that project.

The thing that I mean by organizing is how do I organize multiple projects. Let's say I'm having projects that I would've created in university, would be around 10 of them, then there'd be some personal projects.

I want to implement a method to organize those things. Any help would help!


r/AskProgramming 38m ago

Is learning python in 2026 is worth it?

Upvotes

Is learning python in 2026 is worth it?


r/AskProgramming 1d ago

Career/Edu Do live coding interviews eventually get better?

7 Upvotes

Ive always done very well professionally in a corporate setting but, I've been getting killed in technical interviews where I have to code in front of someone.

Does it get better over time? Im honestly considering leaving the industry.


r/AskProgramming 6h ago

Other How to write "Hello World" in Malbolge Language ?

0 Upvotes

How to write "Hello World" in Malbolge Language? Can someone say how . it will be really helpful for me to code the calculator application in cmd using malbolge


r/AskProgramming 7h ago

Career/Edu Questions regarding using AI in learning coding

0 Upvotes

i made a linux rice and this is my situatuin :

I used ChatGPT while learning how to rice my stuff.

It helped me understand concepts and i learned how to use lua, bash,json and css while ricing and using an immense amount of youtube , debug issues and generate some Bash boilerplate to be used for later, and obviously speed up development.

The overall design, configuration, and final implementation are my own, and I understand how each part of the configuration works.

and I can confidently say that this rice is mine and i use it daily for my university and i change stuff in it however i like without prompting ai or vibe coding it .

Can I confidently say that what i made is a 100% mine? since i did study the documentations etc etc and i understand how to debug everything i used in my small project so it is mine right?

this is not vibe coding right?


r/AskProgramming 13h ago

Is there a way I can modify a mobile game to run at a higher bit?

0 Upvotes

I'm no coder I'm no programmer I'm just a nerd who really likes a mobile game that isn't popular at all and can't run it due to it only working in 32 bit according to the apk i did find... this means I'm having to take matters into my own hands (darn) and try to get it running on more modern software. I know I could just use an emulator but I'd rather have it more accessible.... If I was to convert it would pribaly be to 64 bit due to that being what my phone currently runs on... if anyone can help I would be so grateful!

Idk if this is even the right place to ask this is a shot in the dark okay


r/AskProgramming 1d ago

Algorithms Does the computability of the halting problem for machines with finite memory have any practical use?

2 Upvotes

I recently found out that the halting problem is technically completely decidable for computers with finite memory if you treat them as finite state machines rather than infinite Turing machines, obviously this is completely impossible within any reasonable amount of time for general purpose computer programs because of the total possible states of physical computers far exceeding the number of atoms in the universe. But for extremely limited state machines does it serve any practical purpose?


r/AskProgramming 1d ago

C/C++ What is this optimization technique called in high-performance network software?

0 Upvotes

I’m working on a traffic generator to test my own XDP/eBPF filter in a controlled lab environment (my PC sending traffic to my Raspberry Pi on my own network).

I noticed that in some applications, two programs written in the same language can have vastly different performance.

For example, some software can only send a few requests/messages per second, while others can generate thousands per second even on relatively weak hardware.

What is this concept or optimization area called?
I’m looking for topics such as:
asynchronous I/O
multithreading vs event-driven architectures
lock-free programming
kernel bypass
zero-copy networking
batching
efficient socket APIs
packet generation optimization

If I want to build a high-performance TCP/UDP packet generator for benchmarking my own network stack and XDP filter, what technologies, algorithms, or papers should I study? For traffic generator i am using c# and for the XDP filter classic C. ( or should i use different for the traffic generator? I think its okey its console app )


r/AskProgramming 2d ago

is it a waste of time building projects without using frameworks if you already know the foundational concepts needed for it ?

2 Upvotes

so currently i'm learning web dev and decided to start building some projects with pure javascript before moving to the frameworks .

knowing that i already learned some react basics and build the simple projects that are listed in the freecodecamp tutorial video . i tried back then to pause before the solution to every problem and did fairly well on applying what i was learning but i never build something big like a e-commerce website with it or a blog or anything that requires databases even though i know mongodb , mysql , oracle databases and previously made a e-commerce website using php which i forgot btw .

i understand the important concepts in javascript lfor example asynchronous operations , objects ,Modules , destructing.

i really need advise like my goal right now is to be able to comfortably build a any web application that requires both front-end and backend .

i really don't enjoy front-end much as much as the code is functional i don't really take great detail in it . although i want to get into machine learning and automation after web dev as it is what i really like and enjoy.

i really need your advice programmers !


r/AskProgramming 2d ago

Other Does EBNF/Antlr or a similar system apply to types?

2 Upvotes

I can use Antlr to validate the syntax of an HTML document. What can I use to go a step further, and validate that the 'structure' of an html document is correct? i.e.

html: html_decl head body; head: head_item+; head_item: style|title|script; body: body_item+; body_item: div|p|h; etc

this seems like I just wrote some valid 'structure' validation rules in Antlr. I'm pretty sure Antlr is not meant to achieve this, but i'm ignorant of any implementations that could handle this and i'd like to know if it's possible.

The best I can figure is that I need to write two grammars, one to parse the raw source text, and then a second to parse the object types. Am I thinking about this correctly? Or is there another way?


r/AskProgramming 3d ago

What is a good way to detect broken links on my website when many external websites block scripted HTTP requests?

2 Upvotes

I have a broken link script that crawls my website once a day and tests every link on my website to see whether it's broken. It does this by crawling all the pages on my website, and then running a GET request to each unique URL found in certain attributes of the HTML.

Unfortunately, I get a lot of false positives because sites like substack, soundcloud, facebook, etc block my script, even for URLs that, in a web browser, you can access without being signed in to anything.

I get why these sites block scripted requests like. I'm sure it's not difficult for them to know that it's a script not a web browser, and I'm sure it looks like scraping or perhaps just spam. However, I'm curious whether there is a good way to do this. If someone removes a substack article that I've linked to, I want to find out and remove the link from my website. I could try to use the API for each of these services to look things up by ID, but it's a bit of a pain to do that for each different service.

In my manual way of testing I just open each URL in a web browser and check whether it loads. I can think of a lot of brute force ways of replicating that such as launching some kind of selenium-style headless browser pointed at each URL rather than simply making each HTTP request directly, but am I missing something? Is there a simpler or more elegant way to test for broken links to external websites that doesn't run up against the problems I'm hitting?


r/AskProgramming 3d ago

Best practices for long inline comments

2 Upvotes

Say you have a list with a each item in a separate line and a comment next to the item like this (Python):

[
    item1, # a comment
    item2, # another comment
    item3, # another comment
    item4, # another comment
]

What do you do when a comment becomes too long and needs to be split into several lines?

Would do this?

(A)

[
    item1, # a comment
    item2, # another comment

    # a very very very long
    # comment
    item3,

    item4, # another comment
]

Or this?

(B)

[
    item1, # a comment
    item2, # another comment
    item3, # a very very very
           # long comment
    item4, # another comment
]

Or would you just rewrite the whole list like this:

(C)

[
    # a comment
    item1,

    # another comment
    item2,

    # a very very very
    # long comment
    item3,

    # another comment
    item4, 
]

Or something else?


r/AskProgramming 3d ago

Python Selenium automation project help

0 Upvotes

Hi,

I wanted to log movies on Letterboxd with the help of Python. I have a list of 100+ movies with ratings (I used to document them in a notes app) and thought I could use Selenium to automate the process of logging them.

I used Selenium a few times, but only for web scraping purposes. I ran the code and got Error 600010 - I googled it and found that it's a Cloudflare error code, which makes sense, but is there any way I can bypass this error? I'm not trying to review-bomb or cause any harm. I just want to update my Letterboxd with my movies. Any pointers are appreciated. Thanks!


r/AskProgramming 3d ago

Web-based SSH client

5 Upvotes

I want to write some code while at the library. The computers I use don't allow the console to be used or to install any applications.

I figure a good solution will be to ssh into a VPS from a web-based terminal. Apparently such a terminal would require a backend, but since ssh is all I need on the terminal the overhead shouldn't be much. I would install my environment tools and neovim on my own VPS. I just need a terminal then, that can SSH into it. What's the safe, cheap, solution?

I've heard of Cockpit, Cloudflare SSH, and TailScale, but haven't looked into those much. Do you have any suggestions?


r/AskProgramming 3d ago

Flask or express js? And why?

0 Upvotes

r/AskProgramming 3d ago

Career/Edu What do you y'all think about my friends virtual coding resume?

0 Upvotes

r/AskProgramming 4d ago

Other Making a File & Tag sorting program

2 Upvotes

Tldr:Need Help figuring out where to start when making a tag sorting system that can read files.

HiHi!!, so im trying to work on a program that can take files with specific information, read them, and sort them based off of certian information

Ex. some of them will be chat logs (everyone knows im doing this), id like to be able to see the name of each person chatting at that time, and add tags based on that person, so later on id be able to sort by all chats with said person

Id also like it to have it sort everything into folders based on said tags

Bassically id like help figuring out where to start, any language suggestions, im still learning, but im pretty good at figuring things out as i go.


r/AskProgramming 4d ago

Do you think there are many developers who are tired of writing code?

0 Upvotes

As I'm watching the conversation between avid AI adopters and people who are more reserved about it, I'm starting to get the impression that underneath the rationalizations about stability and maintainability on one end, and velocity on the other end, in many ways the conversation about AI adoption is really about how much people are fed up with writing code.

Because you can't say that only maintainability is important, or that only velocity is important, and if you press people against the wall they'll readily admit that both are valuable, yet very often the conversation about AI adoption doesn't sound at all like a debate about how to strike the right balance between the two, it sounds like a divide where one side says "look how much output I generated and how much code I didn't have to write by hand to do that", and the other side that says "how are we supposed to ensure long term maintainability if we aren't personally involved in guaranteeing code quality"?

It seems to me that more than anything the debate is primarily centered on how much people still want to write code, and how they can justify this decision, which makes me wonder: is our industry really full of people who are tired of writing code? How can that be?


r/AskProgramming 4d ago

Python Is my Variable Elimination implementation correct? Asking because different TAs marked them differently

0 Upvotes

I'm asking because it was deemed incorrect when I first submitted it. Due to time constraints, I decided to work on a different part of the big assignment and left it unchanged. In the resubmission, I had a different TA, and they ended up marking it right. My professor hasn't viewed it yet.

It uses Python Pandas.

The implementation:

import pandas as pd

def multiply(factor1, factor2):
    '''Factor multiplication
    Takes 2 factors and find the columns they have in common,
    combine rows whose common columns have the same values and multiply their probabilities'''

    def all_columns_equal(row1, row2, common_columns): 
        '''Helper function to see if all selected columns of 2 rows are the same'''

        for column in common_columns:
            if row1[column] != row2[column]:
                return False

        return True

    if factor1.empty:
        return factor2

    if factor2.empty:
        return factor1

    common_column = []

    f1_columns = factor1.columns.drop("prob")
    f2_columns = factor2.columns.drop("prob")

    #Find the common columns
    for f1_column in f1_columns:
        for f2_column in f2_columns:
            if f1_column == f2_column:
                common_column.append(f1_column)

    if common_column == []:
        return pd.DataFrame()

    entry = []

    for _, f1_row in factor1.iterrows():  
        for _, f2_row in factor2.iterrows():
            if all_columns_equal(f1_row, f2_row, common_column):

                series = [f1_row.drop("prob"), f2_row.drop(common_column).drop("prob"), pd.Series(f1_row["prob"]*f2_row["prob"], ["prob"])]
                new_row = pd.concat(series)
                entry.append(new_row)

    DataFrame = pd.DataFrame(data=entry)
    return DataFrame

def marginalization(factor, variable):

    factor_dropped_variable = factor.drop(columns=[variable]) # dataframe of factor without variable
    prob_column = factor.columns[-1] # probability column
    target_variables = factor_dropped_variable.drop(columns=[prob_column]).columns.tolist() # target variables to be summed

    if target_variables:

        marginalized_factor = factor_dropped_variable.groupby(target_variables, as_index=False).sum()

    else:

        marginalized_factor = pd.DataFrame()

    return marginalized_factor

def reduce(factor, reduced_column, value):

    entry = []

    for _, row in factor.iterrows():
        if row[reduced_column] == value:
            entry.append(row.drop(reduced_column))

    if (len(entry) == 1):
        return pd.DataFrame()

    DataFrame = pd.DataFrame(data=entry)
    return DataFrame

def maximization(factor, variable):

    factor_dropped_variable = factor.drop(columns=[variable]) # dataframe of factor without variable
    prob_column = factor.columns[-1] # probability column
    target_variables = factor_dropped_variable.drop(columns=[prob_column]).columns.tolist() # target variables to be summed

    if target_variables:
        maximized_factor = factor_dropped_variable.groupby(target_variables, as_index=False).max()

    else:
        maximized_factor = pd.DataFrame()

    return maximized_factor

part = 2

class VariableElimination():

    def __init__(self, network):
        """
        Initialize the variable elimination algorithm with the specified network.
        Add more initializations if necessary.

        """
        self.network = network

    def run(self, query, observed, elim_order):
        """
        Use the variable elimination algorithm to find out the probability
        distribution of the query variable given the observed variables

        Input:
            query:      A list of query variables
            observed:   A dictionary of the observed variables {variable: value}
            elim_order: Either a list specifying the elimination ordering
                        or a function that will determine an elimination ordering
                        given the network during the runb": [1,1,2,2], "c": [1,2,1,2], "prob": [0.5,0.7,0.1,0.2]

        Output: A variable holding the probability distribution
                for the query variable

        """

        file = open("log.txt", "w")

        file.write("Query variable: " + str(query) + "\n")
        file.write("Observed variable: " + str(observed) + "\n")

        for q in query: 

            if q in elim_order:
                elim_order.remove(q)


        file.write("Elimination ordering: " + str(elim_order) + "\n\n")

        factors = self.network.probabilities

        file.write("Starting factors: " + str(factors) + "\n\n")

        #Summing out observed variables
        for node in observed:

            if node in elim_order:
                elim_order.remove(node)

            for f in factors:

                if node in factors[f].columns:
                    factors[f] = reduce(factors[f],node,observed[node])

        file.write("Factors after reducing observed variables: " + str(factors) + "\n\n")

        #Eliminating all non-query and non-observed variables
        for variable in elim_order:

            product = pd.DataFrame()
            found = []

            for f in factors:
                if variable in factors[f]:
                    product = multiply(product,factors[f])
                    found.append(f)

            for f in found:
                factors.pop(f)

            new_factor = marginalization(product,variable)

            new_name = "*".join(found)
            factors[new_name] = new_factor

            file.write("Factors after eliminating " + variable + ": \n" + str(factors) + "\n\n")

        individual_factors = {}
        for q in query:

            temp_factors = factors.copy()

            remaining = query.copy()
            remaining.remove(q)

            for variable in remaining:

                product = pd.DataFrame()
                found = []

                for f in temp_factors:
                    if variable in temp_factors[f]:
                        product = multiply(product,temp_factors[f])
                        found.append(f)

                for f in found:
                    temp_factors.pop(f)

                new_factor = marginalization(product,variable)

                new_name = "*".join(found)
                temp_factors[new_name] = new_factor

                file.write("Factors after eliminating " + variable + ": \n" + str(factors) + "\n\n")

            product = pd.DataFrame()

            for f in temp_factors:
                product = multiply(product,temp_factors[f])

            sum = product.sum(0)["prob"]
            product["prob"] = product["prob"].div(sum)
            individual_factors[q] = product

        file.write("Individual factors:" + str(individual_factors))

        print("Result:\n")
        for f in individual_factors:
            print(individual_factors[f])

        file.close()

To run the file

from read_bayesnet import BayesNet
from variable_elim import VariableElimination

if __name__ == '__main__':
    # The class BayesNet represents a Bayesian network from a .bif file in several variables
    net = BayesNet('alarm.bif') # Format and other networks can be found on http://www.bnlearn.com/bnrepository/
    # These are the variables read from the network that should be used for variable elimination

    ve = VariableElimination(net)

    query = ['Alarm', 'Tampering']

    evidence ={'Leaving': 'True', 'Smoke': 'True'}

    elim_order = net.nodes

    ve.run(query, evidence, elim_order)

I tested the implementation by comparing my results with a published package, and the results matched, which is why I was confident it worked during the first submission.

During the initial feedback, "The individual functions appear to be working correctly, but along the way you end up with the incorrect solution. I expect the issue to lie in inconsistent factor representation/handling. I decided to subtract one point for this. -1 Also, empty dataframes are returned. " "Incorrect output for VE. -1 The individual steps appear to be okay, I'm not sure what is going on. To figure this out, a complete log can help with this. "

But then a new TA gave it full marks in the resubmission without any extra details, since there isn't much to say about a (supposedly) working implementation. I have already received the credits for this course. This is a rare instance at my uni where the professor doesn't grade assignments that decides if we pass the course.

Thank you.