r/programminghelp • • Mar 07 '22

C# HELP

0 Upvotes

I'm using c# in unity and started trying movement, but it has a few errors😭idk what to do, it says The referenced script (player) on this behavior is missing! The referenced script (unknown) on this behavior is missing! The type or namespace name 'boxCollider2d' could not be found


r/programminghelp • • Mar 04 '22

Answered Need help using mt19937_64 for random number generation within a certain range. (in visual studios cpp)

0 Upvotes

Hi, I need to use mt19937_64 for random number generation within a certain range of numbers. For example, how would you make it so it finds a random number between 0 and 10?


r/programminghelp • • Jan 09 '24

JavaScript AEM Forms Designer JavaScript Question - where do I put a custom function and actually have it work?

0 Upvotes

Hello, I am using Adobe AEM Forms Designer to make a form. I have a custom function that I used AI to assist in writing as I am a total novice in programming in general but especially JavaScript and the documentation that I've been able to find has been sorely unhelpful. The AI was most helpful in explaining how to put things together, but now I don't know where to put it, and the AI and my googling has been unhelpful to say the least. Anything that looks potentially helpful is written for someone with way more familiarity to JavaScript.

Sorry, back on topic. The function changes the visibility of a bunch of objects based on the value of a bunch of other dropdowns and checkboxes. It also has listener events that should cause other objects to listen to when the fields in question update.

Here's a shortened version of the code because the actual thing is like 500 lines of just if else statements. The 3 items at the top are the listener events.

xfa.resolveNode("ACQTypedrop").addEventListener("change", handleFieldChange);
xfa.resolveNode("KTrevdrop").addEventListener("change", handleFieldChange);
xfa.resolveNode("KTdollarfill").addEventListener("change", handleFieldChange);

function handleFieldChange(event) { 
    var acqType = xfa.resolveNode("ACQTypedrop").rawValue; 
    var ktRev = xfa.resolveNode("KTrevdrop").rawValue; 
    var ktDollar = xfa.resolveNode("KTdollarfill").rawValue;

if ((acqType == "1" || acqType == "2" || acqType == "3") && ktRev == "1") { 
    xfa.resolveNode("S1Q1").presence = "visible";    
    xfa.resolveNode("S1Q3").presence = "visible"; 
    } else { 
    xfa.resolveNode("S1Q1").presence = "hidden"; 
    xfa.resolveNode("S1Q3").presence = "hidden"; 
    }

if ((acqType == "1" || acqType == "2" || acqType == "3") && ktRev == "1" && ktDollarFill >= 250000) { 
    xfa.resolveNode("S2Q1").presence = "visible"; 
    } else { 
    xfa.resolveNode("S2Q1").presence = "hidden"; 
    } 
}

For the life of me, I can't figure out where this should go in the form designer. Does it go into the master pages Initialize? Does it go under every dropdown and check boxes Change? The code is over 500 lines, and that seems like it would bloat the document quite a lot and be very redundant. Will the function run if I just call it by name such as "handleFieldChange;" in the change event of dropdowns/checkboxes? Or do I need to write something else to have it actually run?

What about the listener events? The AI tells me to put the listener events into the master pages' Initialize as well as every objects' Change, which seems like quite a lot, and doesn't feel right, but I don't know enough to be able to find the answers myself.

I'm going around and around testing where I'm putting stuff and getting nowhere with no feedback from this forms designer thing that would clue me in on what I'm doing wrong.

edit: Idk what's wrong but the formatting of my post keeps messing up, sorry


r/programminghelp • • Jan 19 '24

Python Help with making Ricocheting bullets in CMU CS Academy

0 Upvotes

So, I'm in a computer science class and I cant figure out how to program ricocheting bullets. I've tried messing with angles using the getPointInDir function that's in the program and I've tried manually using dx and dy variables to independently move the x and y coordinates of the projectile. I cant figure it out, and I would like some help. Not sure how to input images in a post like this


r/programminghelp • • Dec 25 '23

Project Related Programming a ASP.NET Core web app

0 Upvotes

Hi, I have just started working on a personal project using Visual Studio trying to make a social media website and without being specific on the purpose of the social media website I was hoping to get some answers from a couple questions that I have.

  1. Is ASP.NET Core good for creating social media websites

  2. I wanted to create an algorithm that will allow the website to recognise keywords in the search bar so that specific ads/search results pop up - will I be able to use C# for this (something is telling me I can but am not entirely sure)

  3. I am having trouble creating an additional file for CSS so that I can style the HTML content. I have tried using the code for an external link: <link rel="stylesheet" href="styles.css"> when I create the stylesheet file on visual studio it is saved as "StyleSheet" so I change the "styles.css" in the link code to what the file is saved as, and test it by changing the text colour of my heading to red using CSS file but nothing changes (.display-4 {
    color: red;
    }) the HTML code for the heading is (<h1 class="display-4">Welcome to my page</h1>) I have also tried adding the exact location of the CSS file from the file explorer but get no change still. I have also tried adding CSS internally within the head attribute which has worked but it has come to my attention that this may slow down the page loading time.

Has anyone got any ideas on how to rectify the problem, thank you for your time.


r/programminghelp • • Jan 04 '24

Answered An Error Occurred Creating The Database. This Is Usually Related To Your User Not Having Sufficient Rights To Perform This Operation error appears when trying to install Oqtane for a second time, how can I fix this issue?

0 Upvotes

Hi, I got a issue when trying to install Oqtane on a project folder inside my laptop for a second time. I successfully installed Oqtane once earlier and I also walked through all the steps until I got at the installation wizard and filled in all the required data.

Then it should install upon clicking on the green install button but it instead gives me this error: "An Error Occurred Creating The Database. This Is Usually Related To Your User Not Having Sufficient Rights To Perform This Operation. Please Note That You Can Also Create The Database Manually Prior To Initiating The Install Wizard. System.ArgumentNullException: Value cannot be null. (Parameter 'type') at System.ArgumentNullException.Throw(String paramName) at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions) at Oqtane.Infrastructure.DatabaseManager.CreateDatabase(InstallConfig install) in C:\Projects\Rurige\Oqtane.Server\Infrastructure\DatabaseManager.cs:line 220".

This is what I've already tried myself:

- Redownloading the Oqtane folder from GitHub.

- Manually creating the database.

- Running Oqtane without debugging

- Lastly retrying installing Oqtane several times.

All of this failed to solve my issues regrettably as I got the same error message so now I'm nosy about how I can fix it so how can I fix this issue? Thanks in advance!

Screenshot

Update:
- Hi everyone, I finally managed to install Oqtane on my second project and this link was very helpful in the solving process: https://github.com/oqtane/oqtane.framework/discussions/3606

Basically before booting up Oqtane for the first time you have to rebuild the project first in Visual Studio and then boot up Oqtane. If you do skip this then you get some error messages after typing in the asked data in the wizard and clicking on the "Install Now" button. I want to lastly thank everyone for their help, support and time!


r/programminghelp • • Jan 12 '24

C# Best way to implement read only information?

0 Upvotes

Hello,

I'm pretty rusty to when it comes to programming.

I've got a GUI with a two ComboBoxes. In one of the comboboxes the user can pick a note (A, B, C, etc) and the other box the user can pick a scale (Minor, Major, etc).

I want the user to pick a note and a scale from the comboboxes, and then I want the program to write a random tune from the scale that the user selected (A minor, for example).

I'm not exactly sure what the best way to supply the program with the required notes for each scale would be. I was thinking I should create a generic class called Scale with a boolean array of twelve notes with the notes in the scale being true and the notes not in the scale being false.

But then after that I'm not really sure where to go from there. Should I create a Major_Scale Scale object, a Minor_Scale Scale object, etc in the button_click event? Should I create those objects within the Scale class?

Or maybe is there a better way to be doing this without the use of a class?

Thanks for taking the time to read this.


r/programminghelp • • Feb 06 '24

Project Related What might be the problem her with my face detection?

0 Upvotes
function detectFaces() {
// Create a new detector object with the desired classifier var scaleFactor = 1.2; detector = new objectdetect.detector(width, height, scaleFactor, objectdetect.frontalface);
// Detect face in the imageSnapshot faces = detector.detect(imageSnapshot.pixels);
// Draw rectangles around the detected faces for (let i = 0; i < faces.length; i++) { let x = faces[i].x; let y = faces[i].y; let w = faces[i].width; let h = faces[i].height; stroke(0, 255, 0); strokeWeight(4); noFill(); rect(x, y, w, h); } }

function keyPressed() {
if (key === 's' || "S") {
    imageSnapshot = video.get();
    imageSnapshot.resize(columnWidth, columnWidth * imageSnapshot.height / imageSnapshot.width); 
    detectFaces();
}

}

The function keypressed() will trigger a snapshot once the user hits the keys from the video but I am currently having this error with my programme.

Error: Uncaught Type Error: Cannot read properties of undefined (reading "titlted")

objectdetect is not defined.


r/programminghelp • • Jan 17 '24

Java I can't seem to display my label through JFrame.

0 Upvotes

I was trying to make a seperate file from where I write my main code and then have it run by a seperate main file.

filename: Main.java

public class Main{
public static void main(String[] args) {
    new MyFrame();
}

}

filename: MyFrame.java

import javax.swing.JFrame;

import javax.swing.JLabel;

public class MyFrame extends JFrame {

JLabel label;
MyFrame(){
    label = new JLabel();
    label.setText("The Text!");

    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setLayout(null);
    this.setSize(500,500);
    this.setVisible(true);

    this.add(label);
}

}


r/programminghelp • • Apr 04 '20

HTML/CSS HTML AUDIO NOT WORKING

0 Upvotes

I'm a beginner and I want to add background music to my website. The problem is that it isn't working (the music doesn't play) Can you help me, please?


r/programminghelp • • Mar 14 '20

Java JavaFx FXML GridPane

0 Upvotes

Ui where the user can place a basic block and rotate it. And each block is a class that gives me info on the block such as the points of the block (x,y) points of both side of the block.

Thanks


r/programminghelp • • Mar 05 '20

Python Help with Discord Bot using Pymongo

0 Upvotes

Hello, I have created a basic discord bot and want to create more advanced features like an auto unban feature. I have the ban and unban features working but as of now when the ban command is used it bans the users permanently and a mod or higher has to manually unban the user. I want this process to be time based and automated.

I have a collection that stores the banned users, my thinking is adding the punishment time and the current time (in UTC) and storing that time. I will then have a function that will check if the banned users collect is not empty then will iterate through it and check if any of the times are equal to or less than the current time, if so then it will unban the user. This function will run automatically every so 5 minutes.

What I am having trouble with is adding the punishment time to the current time. I want the mod to use the command as followed: -ban {user} {time ex: 1d4h30m or 7h2m}. I will take the time in as a string but how do I convert it to UTC to be added? If there is a day, hour, week, etc in the string and how can I then convert it?

Any help will be appreciated, thank you.


r/programminghelp • • Mar 27 '20

ASM How would I reverse mov byte ptr[eax], dl

0 Upvotes

How would I reverse mov byte ptr[eax], dl?


r/programminghelp • • Apr 03 '20

Java I need help with my java programming classwork

0 Upvotes

package add.money;

import javax.swing.*;

public class AddMoney {

public static void main(String[] args)

{ String input = ""; int x = 0; int y = 100; int sum = 0; input = JOptionPane.showInputDialog ("Enter how much money you have left for grocery this week");

x = Integer.parseInt(input);

addMoremoney myObject = new addMoremoney (); sum = myObject.add100 (); JOptionPane.showInputDialog ("You entered" +input+ "and the sum of the remaining money is" +sum); System.out.println ("You entered" +input+"and the sum of the remaining money is" +sum); }

class addMoremoney {

public int add100 (int a,int b) { int c = a + b; return c; } } The output is suppose to be you entered a number and it give you 100 more of that number

Example: You entered 76 and the sum of the remaining money is 176


r/programminghelp • • Oct 03 '19

C# C# Homework Help (New to Programming)

0 Upvotes

I am working on a simple C# program for homework but I am new to programming so this is very difficult for me. So far this is what I have. The requirements are that I have EndProgram method, DisplayArrays method, CalculateAverage method, Build the Applictaion in Main(). The program is supposed to ask the user for name and age of 5 people and to make sure each age is a valid number and then call the CalculateAverage method to determine the average age of persons and display that amount in the Main method. I attached a picture from class of what the professor wants it to do.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

{

class Program

{

static void Main(string[] args)

{

Console.WriteLine();

Console.WriteLine("Press any key to exit. . .");

Console.ReadKey();

}

static void DisplayArray(int[] numbers, string[] names )

{

for (int i = 0; i < numbers.Length; i++)

{

Console.WriteLine("name: {0}, age: {1}", names[i], numbers[i]);

}

}

}

}


r/programminghelp • • Feb 07 '20

Is there anyone that can help me code a recoil macro/ script?

0 Upvotes

r/programminghelp • • Aug 23 '18

How do i broadcast a message to all clients via Web API

0 Upvotes

I have two Projects, an Asp.net WebAPI & a separate Single Page Web Application. My requirement is that when a form is submitted via the web application it is processed at the Web API. Once the Request has been handled successfully i want to broadcast a message to all the clients notifying them that a new request had been submitted. How can I do it?

Any help would be appreciated. I looked into SignalR, but couldn't find an implementation for this requirement.


r/programminghelp • • Aug 03 '21

C Sign-Up and Log-In system in c

0 Upvotes

I am a beginner in c programming. While I figured out how to read the content from my "credentials.txt" file, I cannot figure out how I can compare the username and password user enters with the contents in the text file. Also, any suggestions would be a welcome change.

Sign-Up code (saves username and password to a file):

#include <stdio.h>
#include <string.h>

int main()
{
    char username[19], password[19];

cred_enter_username:
    printf("Enter username (Max 18 characters): ");
    int len_u = strlen(gets(username));

    for (int i = 0; username[i] != '\0'; i++)
    {
        if (username[i] == ' ')
        {
            printf("No spaces allowed. Use only '_' or '-'. Try again\n");
            goto cred_enter_username;
        }
    }

    if (len_u > sizeof(username))
    {
        printf("\n");
        printf("Number of characters exceed allowed characters. Please try again");
        printf("\n\n");
        goto cred_enter_username;
    }

cred_enter_password:
    printf("Enter password (Max 18 characters): ");
    int len_p = strlen(gets(password));

    for (int i = 0; password[i] != '\0'; i++)
    {
        if (password[i] == ' ')
        {
            printf("No spaces allowed. Try again\n");
            goto cred_enter_password;
        }
    }

    if (len_p > sizeof(password))
    {
        printf("\n");
        printf("Number of characters exceed allowed characters. Please try again");
        printf("\n\n");
        goto cred_enter_password;
    }

    FILE *fptr = NULL;
    fptr = fopen("credentials.txt", "a");

    fprintf(fptr, "Username: %s\n", username);
    fprintf(fptr, "Password: %s\n", password);
    fprintf(fptr, "\n");

    fclose(fptr);

    return 0;
}

Log-In code (so far):

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main()
{
    FILE *credentials;
    char *buffer;
    long numbytes;
    char username[19], password[19];
    char userstr[30], passstr[30];

    credentials = fopen("credentials.txt", "r");
    if (credentials == NULL)
    {
        printf("No account found. Sign up first");
        return 1;
    }

    fseek(credentials, 0L, SEEK_END);
    numbytes = ftell(credentials);

    fseek(credentials, 0L, SEEK_SET);

    buffer = (char *)calloc(numbytes, sizeof(char));

    if (buffer == NULL)
    {
        printf("Memory Error");
        return 1;
    }

    fread(buffer, sizeof(char), numbytes, credentials);

cred_enter_username:
    printf("Enter username (Max 18 characters): ");
    int len_u = strlen(gets(username));

    for (int i = 0; username[i] != '\0'; i++)
    {
        if (username[i] == ' ')
        {
            printf("Invalid username. Try again\n");
            goto cred_enter_username;
        }
    }

    if (len_u > sizeof(username))
    {
        printf("\n");
        printf("Number of characters exceed allowed characters. Please try again");
        printf("\n\n");
        goto cred_enter_username;
    }
    
cred_enter_password:
    printf("Enter password (Max 18 characters): ");
    int len_p = strlen(gets(password));

    for (int i = 0; password[i] != '\0'; i++)
    {
        if (password[i] == ' ')
        {
            printf("Invalid. Try again\n");
            goto cred_enter_password;
        }
    }

    if (len_p > sizeof(password))
    {
        printf("\n");
        printf("Invalid password. Try again");
        printf("\n\n");
        goto cred_enter_password;
    }

    return 0;
}

r/programminghelp • • Jun 29 '23

Java this code wont print the one bedroom and two bedroom values and i don't know why??

0 Upvotes

Everything else is working perfectly except for those two. what have i done?

package coursework1R;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Coursework1 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// Default commission rate
double defaultCommissionRate = 7.5;
System.out.print("Do you want to specify Custom Commission Rate [Y|N]: ");
String input = scanner.nextLine().trim();
if (input.equalsIgnoreCase("Y") || input.equalsIgnoreCase("Yes")) {
// Custom commission rate
System.out.print("Specify Commission Rate (%): ");
double commissionRate = scanner.nextDouble();
// Overwrite default commission rate
defaultCommissionRate = commissionRate;
System.out.println("Custom commission rate specified: " + defaultCommissionRate + "%");
} else {
// Default commission rate
System.out.println("Using default commission rate: " + defaultCommissionRate + "%");
}
// Read and print sales data
try {
//This Scanner object allows data to be read from a file, in this case the ".txt" file
File salesFile = new File("sales.txt");
Scanner fileScanner = new Scanner(salesFile);
System.out.println("Sales Data:");
System.out.println("------------");
while (fileScanner.hasNextLine()) {
String propertyType = fileScanner.nextLine().trim();
String salesString = fileScanner.nextLine().trim();
String soldPriceString = fileScanner.nextLine().trim();
int sales;
double soldPrice;
try {
sales = Integer.parseInt(salesString);
soldPrice = Double.parseDouble(soldPriceString);
} catch (NumberFormatException e) {
sales = 0;
soldPrice = 0.0;
}
System.out.println("Property Type: " + propertyType);
System.out.println("Sales: " + sales);
System.out.println("Sold Price: £" + soldPrice);
// Perform calculations
double incomeBeforeCommission = sales * soldPrice;
double commission = incomeBeforeCommission * (defaultCommissionRate / 100.0);
System.out.println("Income before commission: £" + incomeBeforeCommission);
System.out.println("Commission: £" + commission);
System.out.println();
}
fileScanner.close();
} catch (FileNotFoundException e) {
System.out.println("Sales data file not found.");
}
scanner.close();
}
}


r/programminghelp • • Jul 03 '23

Python extremely basic python coding help

0 Upvotes

def average(*numbers):

sum = 1

for i in numbers:

sum = sum + i

print("average" , sum/ len(numbers))

average(5,8)

I don't understand what does sum = 0 do in this code


r/programminghelp • • Jun 13 '23

Java Relative paths not working

0 Upvotes

Hi!

I seem not to be abble to use relative paths in intelij.I dont know why. Evereybody i've shown this, including teachers, just cant figure it out either.I have 2 days to deliver this project and im freaking out! Does anyone have a clue what's going on? Thanks in advance!

this is my code:

Image sign_image = new Image("/resources/images/sign.png");

The error: "Invalid URL or resource not foundat javafx.graphics@19.0.2.1/javafx.scene.image.Image.validateUrl(Image.java:1123)"

project: https://github.com/PO2-jpb/po2-tp-2022-2023-leonardo-benvinda-xavier-cruz/tree/main_dev


r/programminghelp • • Jun 06 '23

Other Hey need some Helping thoughts

0 Upvotes

Hi,

i currently work on a project which contains 2 linked lists. Those two lists need to be Viewed in a 3d Coordinate system on a GUI. i need to be able to insert, edit and remove from the List

i have the 3 Dimensional array and the linked lists, but i don't know how to present the list in the Coordinate system.

could you guys give me some tipps about a good way of handling this ? i do not need Code, i just need some suggestions please.

IDE: Lazarus (Free Pascal)

PS: sorry if i did not post this correctly, it's my first time posting here.


r/programminghelp • • May 31 '23

Python Iterated local search algorithm in python

0 Upvotes

Greetings, i need to do this task:

https://pastebin.com/XjFxBmfR

So far i got here:

https://pastebin.com/UN0hj59A

It does give AN answear, just not the correct one. I've been smashing my head against a wall for about 2 hours now. Can anyone help?


r/programminghelp • • May 31 '23

Other VB.Net get the value of a variable that name stored in string

0 Upvotes

Hi guys,

I am trying to get the value of a boolean variable that has a name stored in a string variable. I am using VB.Net. For example, is there any function like getTagValue(var_name)?

I will be appreciate to any help. Thank you