r/AskProgramming Mar 24 '23

ChatGPT / AI related questions

145 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 2h ago

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

1 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 16h ago

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

1 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 1d ago

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

3 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 1d 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 1d 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 2d ago

Web-based SSH client

6 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 1d ago

Flask or express js? And why?

0 Upvotes

r/AskProgramming 1d ago

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

0 Upvotes

r/AskProgramming 2d 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 2d 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 2d 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.


r/AskProgramming 3d ago

Algorithm for checking if Advanced Civilization move was legal

3 Upvotes

Not sure if I should post on r/codegolf lol.

Given two states, each consisting of a number of units in each region on a map of connected regions, how can I efficiently (by the metric of your choice: instruction length, memory size, runtime length, even human eyeballing runtime length/accuracy) assert that the second state is possible to achieve purely by moving units 1 space? 2 spaces?

The incomplete intuitive algorithm I came up with was

_1) Each region has units in its own area and all adjacent areas in state 2 greater than or equal to the number of units in its own area in state 1

AND

2) A less restrictive inverse of #1 to ensure we're not teleporting units to the other side of the map

AND

3) the total number of units is the same

but that takes too much time for humans to compute, at least

EDIT: and we only have 1 turn :)


r/AskProgramming 3d ago

Architecture What are you using for authn/authz and payments?

0 Upvotes

I've had a few side project ideas over the years but have never implemented one because I lack knowledge in (but willing to learn):

  • implementing social logins (OAuth), account management, etc.
  • managing backend permissions (RBAC always looks more complicated than it should be). My projects might have three tiers: free, hobbyist, pro
  • handling payments securely while actually monitoring for abuse/intrusion

Which social logins are allowed to tie into your project?

What are you using for authn/authz? My projects would be very low traffic, so I wouldn't want to commit to a big monthly spend. Are you rolling your own or using Auth0/Clerk/Supabase for auth and Stripe for payments? I'm comfortable with AWS, Cloudflare, Go, JS, and Linux. Are there any GitHub repos that I can look at for this?

How well do frontier LLMs (Claude Opus, etc.) do at generating clean, auditable code for this kind of thing? Is anyone actually trusting AI-written auth/payment code and how do you review it?


r/AskProgramming 3d ago

Javascript Why isn't my JavaScript showing up in browser

2 Upvotes

This is probably super obvious, but I just can't figure it out.

Why isn't this code running on browser?

Edit: I put the <script> after the body, and it now works. Thanks everyone!

<html>
  <head>
    <script>
      message = document.getElementById("working");
      message.innerHTML = "It's working";
    </script>
  </head>
  <body>
    <h3 id="working"></h3>
  </body>
</html>

r/AskProgramming 3d ago

Other AI: are there any studies on why some developers claim AI helps them tremendously versus those who say it's only incremental?

8 Upvotes

Some developers swear by AI and others swear at it, saying if one is not careful, it generates too much slop that needs human cleanup. Are there any studies or surveys to see why the answers are so different? Is the difference the domain, the language, the tooling, years of experience, attitude toward AI, or perhaps just ego talking too much? [edited]


r/AskProgramming 3d ago

Other Advice on the structure of my JSON file?

3 Upvotes

Hello! I've been working on a modding framework that makes it easier to make mods for games written in C++. The main idea is that it's storing info about how to reverse engineer/discover game data like function addresses and field offsets.

I've got an example JSON file below that describes how to find the function for giving money to the player, and the field offset for the money variable. Each location style is not required and its just to demonstrate that multiple methods could be stored/used simultaneously. Also in this example, I'm trying to reuse property names ('kind', 'result', 'cached-location', etc) even though they're in slightly different contexts, in order to keep it more consistent and simple for less experienced programmers.

Example JSON:

{
    "header" : {
        "header-version": "1.0.0.0",
        "file-type": "data-locations",
        "module": "NMS.exe",
        "module-last-modified": "Friday, March 10, 2023, 2:04:54 AM",
    },
    "data" : [
        {
            "id": "cGcPlayerState.units",
            "locations" : [
                { "kind": "cached-location", "value": "0x1BC" },
                { "kind": "pattern", "value": "8B 83 ? ? ? ? 48 83 C4 ? 5B C3 CC CC CC CC CC CC CC CC CC 40 53", "result": "memory-displacement" },
                { "kind": "pattern", "value": "44 89 81 ? ? ? ? 4C 8B 15 ? ? ? ? 8B D6", "result": "memory-displacement" },
                {
                    "kind": "pattern",
                    "value": "44 8B 81 ? ? ? ? 48 8D 2D", 
                    "result": {
                        "kind": "memory-displacement",
                        "instruction-offset": 0,
                        "operand-index": 1
                    }
                }
            ]
        },
        {
            "id": "cGcPlayerState.AwardUnits",
            "locations" : [
                { "kind": "cached-location", "value": "0x1403CF8E0" },
                { "kind": "export", "value": "?AwardUnits@cGcPlayerState@@QEAAIH@Z" },
                { "kind": "pattern", "value": "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 44 8B 81 ? ? ? ? 48 8D 2D", "result-kind" : "matched-target-address" },
                { "kind": "pattern", "value": "E8 ? ? ? ? E9 ? ? ? ? 48 8B 0D ? ? ? ? 48 8D 54 24 ? 44 8B 44 24", "result-kind" : "relative-target-address" },
                { "kind": "pattern", "value": "E8 ? ? ? ? 4C 89 64 24 ? 48 8D 15 ? ? ? ? 0F 28 DE F3 0F 11 7C 24 ? 41 B8 ? ? ? ? 48 8D 0D ? ? ? ? E8 ? ? ? ? 84 C0 74 ? 48 8B 0D ? ? ? ? 8B D3", "result-kind" : "relative-target-address" },
                {
                    "kind": "search",
                    "identifiers": [
                        {
                            "target": "function",
                            "operation": "contains",
                            "values": [
                                { "kind": "string", "value": "MONEY" },
                                { "kind": "string", "value": "MONEY_EVER" }
                            ]
                        },
                        {
                            "target": "arg1",
                            "operation": "contains-offset",
                            "values": [
                                "cGcPlayerState.AwardUnits.arg1.offset1",
                                "cGcPlayerState.AwardUnits.arg1.offset2"
                            ]
                        },
                        {
                            "target": "arg2",
                            "operation": "offset-qty",
                            "value": "0"
                        },
                        {
                            "target": "cGcPlayerState.AwardUnits.arg1.offset1",
                            "operation": "add",
                            "value": "cGcPlayerState.AwardUnits.arg2"
                        },
                        {
                            "target": "cGcPlayerState.AwardUnits.arg1.offset2",
                            "operation": "add",
                            "value": "1"
                        },
                        {
                            "target": "function",
                            "operation": "return",
                            "value": "cGcPlayerState.AwardUnits.arg1.offset1"
                        }
                    ]
                }
            ]
        },
        {
            "id": "cGcPlayerState.AwardUnits.arg1.offset1",
            "locations" : [
                { "kind": "cached-location", "value": "0x1BC" },
                { "kind": "pattern", "value": "8B 83 ? ? ? ? 48 83 C4 ? 5B C3 CC CC CC CC CC CC CC CC CC 40 53", "result-kind" : "memory-displacement" }
            ]
        },
        {
            "id": "cGcPlayerState.AwardUnits.arg1.offset2",
            "locations" : [
                { "kind": "cached-location", "value": "0x148" },
                { "kind": "pattern", "value": "48 FF 83 ? ? ? ? 8B 83 ? ? ? ? 48 8B 5C 24 ? 48 8B 6C 24 ? 48 8B 74 24 ? 48 83 C4 ? 5F C3 CC CC CC CC CC", "result-kind" : "memory-displacement" }
            ]
        }
    ]
}

My main design goals are:

  1. Create a long-term solution for mod makers to use to store this kind of data. Must be flexible and capable of expanding to their needs.
  2. To keep the JSON format easy and intuitive for mod makers
  3. Provide multiple methods of locating the same thing. This will also be extensible so mod authors could make their own location kinds.
  4. The structure must be able to grow overtime without causing major breaking changes and is why I'm using a header.
  5. Be compatible with multiple JSON files simultaneously
  6. Allow the header to specify a "file-type" and then have different types of data objects.

I would love to hear any feedback on the structure of this. I've spent years on it, and I really want to make something that makes a difference for people. It's really important to me that its an appealing structure for people to use and is able to meet the technical requirements of the system. Some other things that would be nice to get feedback on are:

  1. Overall structure of the file
  2. Whether its okay to use the property name 'kind' over and over in slightly different contexts.
  3. Supporting multiple files with different 'file-type' values, so everything is very similar with the data object being the only thing that changes.
  4. Allowing properties like "result" to have both compact and expanded forms
  5. using dashes '-' for property-names instead of camelCase
  6. Any long-term concerns or unpleasantness you see

Thank you in advance!


r/AskProgramming 3d ago

Other What would it take to modify a switch cartridge game?

0 Upvotes

I don't know what programming language if would require but it's probably the least complicated part of this question.


r/AskProgramming 3d ago

How do desktop applications implement monthly/yearly subscriptions securely?

0 Upvotes

Hi everyone,

I'm developing a desktop application in Python that I plan to rent out on a monthly, quarterly, and yearly subscription.

I'm trying to figure out the best way to manage license expiration. How can I prevent users from using the software once their subscription has expired? What tools, services, or libraries would you recommend? If possible, I'd prefer free or open-source solutions.

Another concern is piracy. I know it's impossible to make software completely crack-proof, but I'd like to make it as difficult as reasonably possible.

Has anyone here built a subscription-based desktop application before? I'd really appreciate it if you could share how you implemented licensing, subscription validation, and anti-piracy measures, or recommend any good resources or best practices.

Thanks so much for your help!


r/AskProgramming 3d ago

When to use Kubernetes?

7 Upvotes

Hey everyone,
I’ve been working with Docker and standard containerization for a bit now, and I feel comfortable with the basics of spinning up apps. Naturally, Kubernetes (K8s) keeps coming up as the next logical step.

From what I gather, it's designed to manage and orchestrate those containers at scale when a single server or Docker Compose setup isn't enough anymore.
But there is so much hype around it that it's hard to tell where the "cool factor" ends and actual utility begins.

I want to know when it becomes a legitimate necessity rather than just over-engineering a project.


r/AskProgramming 4d ago

Other how do I detect a tap on the desk

8 Upvotes

I have a Vivobook. I saw that my friend's Mac has awareness that can actually detect taps that are not actually happening around the device.
Using the Accelerometer inbulit in the device, I have a project idea using this feature, but unfortunately my device does not have an accelerometer built into the motherboard. I can plug in an external module, but it kinda defeats the purpose of the project that I have in my mind.
What are the other ways I can detect a tap on the desk the laptop is on?
I do not want to use my microphone cause if so then if actually captures a lot of other noises and detects them as taps, and keeping it always on while daily usage would also not be very practical
Can anyone suggest some other ways to get around this problem?


r/AskProgramming 3d ago

Python I want to create an automation with Python to work on my Android (Galaxy A14), but i will create on my computer (obviously, Windows 10) how do i do that?

1 Upvotes

r/AskProgramming 4d ago

How would someone go about creating a port of adobe flash for android or web browser?

0 Upvotes

I just wanna know how to do it if even possibly


r/AskProgramming 4d ago

Architecture Our staging environment is basically unusable because of management decisions. How would you handle this?

9 Upvotes

Hello, I'm a software developer working for a hospital. I'd like to share a bit about my current situation, vent some frustrations, and hopefully get some advice.

As anyone would expect, we have three different environments: DEV, STG, and PRD; the predicament we currently face, however, lies in how the staging environment is managed. Its natural purpose would be to prepare deployments for production, but that's not what's happening. Due to several top-down decisions—including the fact that our clients actually use the STG environment as if it were production—we do not have direct access to it. As a result, we cannot modify the staging database schema ourselves and must go through a ticket process that takes up to 24 hours whenever we need to run a script of our own. This, of course, has significantly delayed our deployments. Since we have a lot—and I mean it—of stored procedures to alter with each new feature we add, some things are bound to go wrong on the first try. Under normal circumstances, fixing them would be as simple as adding missing objects or removing incorrect ones. Instead, every issue our QA team finds can cost us another 24 hours while we wait for the corresponding ticket to be processed. Our deployment scripts are typically huge (10k+ lines of SQL), and we have to manually cherry-pick which changes belong in each release. We have already requested access to the staging environment, and we were outright ignored; we also proposed creating a separate environment where we could properly prepare and validate our deployments, and we were rejected. Upper management has shown little willingness to address our concerns, yet they're starting to put increasing pressure on us to deliver.

We came up with two possible solutions:

- Migrate our entire database from SQL Server to Oracle; this would be a long-term solution, and would cost us hundreds of development hours. As I've already mentioned, our project is huge. Don't ask me why, but if we were using Oracle instead of SQL Server, we'd have write access to the staging database. I've given up trying to understand upper management's reasoning. It's just your typical executive bullshit;

- Get rid of the stored procedures and rewrite everything in code; as it so happens, it's much easier for us to deploy code changes to the staging enviroment, and it can be done in an hour or so. You might then pose a question of your own: "Why did you put everything in stored procedures in the first place?" The answer to that—and to the choice of SQL Server over Oracle—is the same: the people in charge at the time decided that's how it should be. None of those people are even on the project anymore.

I've never been in such an unorthodox position, and I've run out of ideas. I'd love to hear your thoughts on my current ordeal.

Thanks in advance.


r/AskProgramming 4d ago

autostereograms

3 Upvotes

i tried to make autostereograms. i tried to understand the principle / algorithm behind. firstly i came across the asymmetric method. it was simple and very easy to implement but it was not so satisfactory conceptually. you had to reserve a reference region (unit 0) which contained no information of your subject but random noise or base pattern. afterwards you calculated unit 1 based on the subject and unit 0. then you calculated unit 2 based on the subject and unit 1. and so on. it clearly introduced asymmetry and inequality in information. unit 0 had zero information. the last unit contained the most information accumulated. besides, your subject could not be placed at the centre as it had to stay away from unit 0

i discarded this method shortly after successfully constructing a program generating some test images. then i came across the symmetric method. it involved linking pixels and assigning same color to linked pixels. you didn't have to reserve any region as reference or base. you could place your subject at the centre. theoretically it sounded great but practically it still had certain degree of asymmetry. you had to pick orientation when iterating, either from left to right or right to left. different orientation yielded slightly different results as new records always overwrote old records. for example suppose we went left to right and pixel A was linked to pixel B at first and to pixel C later. A would be linked to C ((A,C) overwrote (A,B)). if we went right to left, A would be linked to B instead ((A,B) overwrote (A,C))

i didn't have fool proof algorithm to overcome this yet. i just went both orientations and combined the 2 images by taking average to get one final image. here's the program. function z is the subject (a simple floating sphere, just for testing). function k is the background. i tried random dots and solid pattern. solid pattern looked like some kind of abstract art but not so "3d" at all. i realized we need noise to act as texture so that our brains can align our focus on the "surface" to feel the "3d-ness". finally i got this. is there any method better than stupidly doing both orientations and combining two resulting images?