/r/CodingHelp

Photograph via //r/CodingHelp

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

Our Rules

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

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

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

4. Do not be abusive to other coders.

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

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

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

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

9. Make sure to follow the Reddit Rules.


How to start coding:

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


Related subreddits:


Suggest a post flair

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

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

Anyone who abuses this by spamming mods will be banned.


Current supported flairs

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

Flair colors

  • Green

Web Related Languages (Eg HTML, CSS)

 

  • Blue

App Related Languages (Eg Python, C#)

 

  • Red

Generic Coding Topics (Eg Open Source)

 

  • Yellow

Other Flairs (Eg Random, Meta)


/r/CodingHelp

74,272 Subscribers

1

Hello i need advice i am learning about html, css, js, and php

how can i do these in real time without paying for an actual server

1 Comment
2024/04/24
16:43 UTC

0

What is the most simplest (example of) web-based AI product to make as a first self project for beginner?

I just learned the basics of AI development and I can't really find any simple product example to implement the stuff that I've learned, any suggestions?

1 Comment
2024/04/24
16:42 UTC

1

What should I use to design a mobile app that can export to Excel?

I've been going over Power Apps tutorials for the past few days and couldn't find the right tutorial to do what I was looking for, or at least give me insight as to how to build it. I've coded in Java, Python, and a few other languages for classes in the past, so I wouldn't be in the dark if I had to use something outside of power apps.

What I've been trying to do is create a mobile app that allows the user to write an item from an existing list, write the count, and then add another line to that list. Then, this list could be exported to Excel. For example:

The list of items to choose from would be like

DescriptionCost
Wood Fence$3 / Length Feet
Vinyl Floor$20 / Square Foot
Etc.Etc.

In this app, the user should be able to select from a dropdown for a single line, and use buttons or have the option to write in the quantity of the item. Then, they can add an extra line. Finally, export the list, with cost and quantity, to Excel.

If anyone has suggestions as to where I should start or what programs I should use that would be great. I feel like I have been getting nowhere with trying to learn and use Power Apps for this simple purpose.

0 Comments
2024/04/24
14:03 UTC

1

[Non-Coding Advice] - Do you think I’m being asked to do too much as a graduate developer?

Hey guys,

So in 7 months in as my job as a graduate developer and it’s gone mostly ok, I however have come to a crossroads as I feel I am being provided work that is way too much for me to handle, I have mostly focused on front end development, working with Web API’s, domain models, Controllers and Services ect but have been tasked with creating EDI Processors and API Wrappers and I just have no clue. I have to state I have had no in-house training for this and have worked more off a buddy system and just to ask for help but is this what a graduate developer should be expected to do as it feels very complex for my level.

Thanks guys

0 Comments
2024/04/24
13:14 UTC

1

Help With Beginner Game Code

private State getState() {    
	// returns the state of Mario    
	//if velocity is greater than 0, Mario is jumping or if he was jumping in the previous state while falling    
	if (body.getLinearVelocity().y > 0 || ((body.getLinearVelocity().y < 0 && previousState == State.JUMPING))) {    
		return State.JUMPING;    
	} else if (body.getLinearVelocity().y < 0) {    
		return State.FALLING;    
	} else if (body.getLinearVelocity().x != 0) {    
		return State.RUNNING;    
	} else {    
		return State.STANDING;    
	}    
}

I got this code from Brent Aureli, however, I'd like to know what's causing a problem:

first i know that:
when mario jumps and falls from that jump, he will be continuously in that jump state.

when mario falls off a cliff, instead of going into a jump state, he will go into a falling state.

however, when mario hits his head on a ceiling, his jump state is cut short abruptly?

I've tried setting conditions for whenever y velocity hits 0 which i assume is what happens when his head hits the ceiling, however doesnt velocity hit 0 at the top of a jump as well?

I'm trying to find out if there's a way to keep the jumping state after hitting a ceiling from the jump

0 Comments
2024/04/24
08:29 UTC

1

Need help on getting my project to work on code.org

I’m not too great at coding, so I need some help in getting this project to work, but also to learn about what the issue was.

It revolves around choosing a random bird based on a color chosen by the user, in which it shows its name, picture and diet. It takes info from a data list, and is supposed to filter the birds to be the ones that fit the criteria.

When I try to run the project, the name and diet end up as undefined and no picture is shown.

I’m pretty sure the problem is in the if statements, but I’m not sure what to do. I would really appreciate any and all help.

This is the project and its code

1 Comment
2024/04/24
05:05 UTC

1

Plaid alternatives

Hi,

I’m looking for some help/ guidance on how difficult it would be to create a software program that would use plaid or another alternative to connect to a business bank account and look for specific withdraws and deposits within that account?

Then it would do some basic calculations/ math and that would be used for push notifications. Etc..

I know plaid is pretty popular, but curious if there’s anything better and how expensive this would be to build out.

1 Comment
2024/04/24
04:15 UTC

1

VBA code for excel - FlipSign

So ive been trying to add a macro that will flip the sign of a formula or value in excel. It does this by multiplying to cell by -1. However this does work by flipping the sign, it does not remove the parentheses its added surrounding the cell if i run it again to flip the sign again and they just continue to build up if I keep running the macro.

If it keep running the code the formula ends up looking sometihng like this =((((20*2))))

Heres the code

"Sub FlipSign()

Dim rng As Range

Dim cell As Range

' Check if any cells are selected

If Not Selection Is Nothing Then

Set rng = Selection

For Each cell In rng

' Check if the cell contains a numeric value

If IsNumeric(cell.Value) And Not cell.HasFormula Then

cell.Value = cell.Value * -1

' Check if the cell contains a formula

ElseIf cell.HasFormula Then

' If the formula is already multiplied by -1, remove this multiplication

If Left(cell.formula, 4) = "=(-1" And Right(cell.formula, 1) = ")" Then

cell.formula = "=" & Mid(cell.formula, 6, Len(cell.formula) - 6)

Else

' Multiply the entire formula by -1

cell.formula = "=(-1*(" & Mid(cell.formula, 2) & "))"

End If

End If

Next cell

End If

End Sub"

I created another macro that can remove these parentheses

"Sub RemoveParenthesisAndNegativeSign()

Dim cell As Range

Dim formula As String

' Loop through each selected cell

For Each cell In Selection

' Check if the cell contains a formula

If cell.HasFormula Then

' Get the formula in the cell

formula = cell.formula

' Check if the formula starts with "=" and contains a negative sign and parentheses

If Left(formula, 1) = "=" And InStr(formula, "-(") > 0 Then

' Remove negative sign and parentheses

cell.formula = "=" & Mid(formula, 4, Len(formula) - 4)

End If

End If

Next cell

End Sub"

however I would like to combine it into the first macro so it does this

Ex: When macro is run the cell will look like this =(-1*(20*2)). When I run it again I want it to look like this =20*2

Any help? Thanks!

Also anyone feel free to use this code if you would like a FlipSign Macro!

1 Comment
2024/04/23
23:18 UTC

1

SQL Server compatible XQuery function to remove the white space and specialised characters from a XML node

Hey guys so I’m working with XQuery and need a function to remove white space and specialised characters (E.g £@!-?) from the value of a specific XML node such as:

(/… [1]/…. [1]/….[1]/Example) [1]

I need this to be done using SQL Server compatible XQuery functions(I previously tried XPath “replace” but that was not compatible with SQL Server), these include:

https://learn.microsoft.com/en-us/sql/xquery/xquery-functions-against-the-xml-data-type?view=sql-server-ver16

Any help would be greatly appreciated,

Thanks guys

0 Comments
2024/04/23
20:21 UTC

1

Hi im trying to get a login form that displays the users imput to webage and inputs are coming in undefined

‹!DOCTYPE html>

<html > <head> <title> JavaUser1</title> <script lang="JavaScript"> function reveal(){ var magic =document.ITLoginform.elements[0].value; document.write("firstname"+magic+"lastname"+ kagic+"password" + jagic+"Email"+ dagic); var kagic = document.Iname.elements|0].value; var jagic = document.Email.elements[0].value; var dagic = document.Pword.elements[0].value; } </script> </head> ‹body> <h2> Login Form</h2> <form name = "ITLoginform"> <label for="fname" >First name:</label><br> <input type="text" id="fname" name="fname"> <br> <label for="Iname"> Last name:</label><br> < input type="text" id="Iname" name="Iname" ><br> < label for="pass"> Password:</label ><br> <input type="text" id="Pword" name="Pword"> <br> <label for="email"> Email Address:</label > <br> <input type="text" id="email" name="email"> <br><br> <input type="button" value="Submit" onClick="reveal()"> </form> </body> </html>
3 Comments
2024/04/23
18:44 UTC

1

Unable to import workspace/package monorepo within gatsby-config.ts

I have a monorepo, with private packages. There is MAIN, and a package-mini.

Main package is widely using package-mini across the components this with no error as:

import { foo } from "@workspace/package-mini";

But, when I do the same within gatsby-config.ts I get build errors like: ReferenceError: Cannot access 'A' before initialization.

The ugly workaround is just to use a relative path since my packages are private are in the same repo:

import { foo } from "../package-mini";

I'm reading in Gatsby Docs that workspaces are not supported. Is that referring to the config so there is basically no other choices? I tried setting alias but no difference.

0 Comments
2024/04/23
17:27 UTC

1

BCS The Charted Institute for IT

Hi, I have an up coming BCS exam for Principles in Coding Level 3.

Just wondering if there's anyone out there that has done this exam and can provide me with any past papers or answer sheets?

Thanks

0 Comments
2024/04/23
10:46 UTC

1

A code to see the most liked Instagram posts?

Hi, I would like to have a code that allows me, just by entering the name of an Instagram account, to obtain its 50 most liked photos, to be able to download them all at once as well as their descriptions. THANKS !

4 Comments
2024/04/23
09:43 UTC

1

Support for a physics Project. Quadratic Function of a jet stream of a bottle

Hello dear community.

So me and a few friends are doing a project in physics class in which we created a quadratic function of a jet stream of a hole made in a plastic bottle.

As the code is created by Chatgpt on Python, due to me having not competence in coding, I can't post it on here. Additional Information, im able to edit the parameters as im understanding some basics. I'd share the Github with anyone who is interested.

But as right now, I have the function displayed as a rocket wich lands on the y axis on the moon. I think the theme is kind of off from the original topic. So im looking for cool ideas to display our function.

Maybe some of you have some cool ideas which are more related to our ''problem''.

1 Comment
2024/04/23
07:41 UTC

1

undefined reference error

My friend gave me a cpp project running perfectly fine in visual studio with run button both in release and debug mode (not using cmake), however i want to run in vscode. There i am facing "undefined reference to " errors, he is using tinycbor, the problem is coming from functions of tinycbor. I think it is a linker problem but it sucks i want to get rid of it as soon as possible i dont know what should i do. I think

  1. Is there any way to check or have the same configuration as visual studio for vscode

  2. I tried using cmake but i am not understanding which files to link.

0 Comments
2024/04/23
03:14 UTC

0

Code for Hire

Hey 👋, I have my own agency which helps in all kinds of coding assignments or projects for students like you. If you are facing any challenges with your assignments or projects, do reach out to me, my developer can help for sure.

We have developers for almost all coding languages and all tech stacks. But it is mandatory to add one flair so I am adding Java for now.

Thanks!

1 Comment
2024/04/23
03:02 UTC

1

[R] Error when trying to convert a character column to dummy variables, not sure what to do.

Hello, first here is my code

install.packages("fastDummies")
library(class)
library(caret)
library(fastDummies)


# Read data
business_data <- read.csv("C:/Comp sci 
stuff/yelp_academic_dataset_business_converted.csv")
review_data <- read.csv("C:/Comp sci stuff/541 
Proj/yelp_academic_dataset_reviews_modified_true1.csv")

# Sample reviews
num_rows <- nrow(review_data)
num_rows_to_keep <- floor(num_rows / 10)
sampled_reviews <- review_data[sample(num_rows, 
num_rows_to_keep), ]

# Merge data
combined_data <- merge(business_data, sampled_reviews, by 
= "business_id")
selected_data <- combined_data[, c("user_id", "business_id", 
"user_rating", "rest_overall_rating", "categories")]

# Check unique values and data types
print(unique(selected_data$rest_overall_rating))
print(class(selected_data$categories))
head(selected_data)

View(selected_data)
class(selected_data$categories)


remove_u <- function(category_string) {
# Replace 'u' with an empty string
  cleaned_category <- gsub("u'", "", category_string)
  return(cleaned_category)
}

# Remove 'u' character from categories

selected_data$cleaned_categories <- 
sapply(selected_data$categories, remove_u)
selected_data$categories <- NULL

clean_category <- function(category_string) {
  # Check if the category string is in dictionary-like format
  if (grepl("^'?[a-zA-Z]+': ?[a-zA-Z]+$", category_string)) {
    # Extract the category name from the string (remove single 
quotes and ': True')
    category_name <- gsub("^'([a-zA-Z]+)':.*", "\\1", 
category_string)
    # Capitalize the first letter of the category name
    category_name <- paste0(toupper(substr(category_name, 
1, 
1)), substr(category_name, 2, nchar(category_name)))
  } else {
    # If not in dictionary-like format, use the original category 
name
    category_name <- category_string
  }
  return(category_name)
}
# Clean category names in the cleaned_categories column
selected_data$cleaned_categories_2 <- 
sapply(selected_data$cleaned_categories, clean_category)



View(selected_data)
# View the updated dataframe
print(selected_data)



View(selected_data)


is.na(selected_data)
dummy_cols(selected_data, select_columns = 
c("cleaned_categories_2"))



# Create train-test split
set.seed(255)
trainIndex <- 
createDataPartition(selected_data$rest_overall_rating, 
                              times = 1, 
                              p = 0.8, 
                              list = FALSE)
train <- selected_data[trainIndex, ]
test <- selected_data[-trainIndex, ]
print("-----------------")
nrow(train)
ncol(train)
dim(train)
length(train)

nrow(test)
ncol(test)
dim(test)
length(test)

View(train)
View(test)

# Train the model
model <- knn(train = train[, c("rest_overall_rating", 
"categories")], 
         test = test[, c("rest_overall_rating", "categories")], 
         cl = train$user_rating, 
         k = 5)

# Make predictions
predictions <- model

# Evaluate the model
accuracy <- sum(predictions == test$user_rating) / 
   length(test$user_rating)
   cat("Accuracy of K-NN model:", accuracy, "\n")

The problem occurs on this line

dummy_cols(selected_data, select_columns = 
c("cleaned_categories_2"))

where I get this error

Error in if (m < n * p && (m == 0L || (n * p)%%m)) stop(sprintf(ngettext(m, : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In n * p : NAs produced by integer overflow 2: In n * p : NAs produced by integer overflow

The column I am trying to convert is a character column according to the class(selected_data$categories) line

Here is a look at the df if it helps: https://imgur.com/a/594u602 I don't have much other info to give as I am lost even after searching online so any help would be appreciated.

0 Comments
2024/04/23
02:58 UTC

3

Need helping saving images to a website after adding

am creating a small little website that allows you to add pictures and stuff to it, a lil gallery basically. I want to make it so once an image is added to an image slot, it is saved there even if you refresh or exit the page, please help!

3 Comments
2024/04/23
02:25 UTC

2

Can I use CLOB safely?

so im currently doing a college work and generative ai just gave me a code where it uses CLOB instead of Varchar, is it going to put my college's connection in any danger? (I really need to write paragraphs inside serveral lines so...)

EDIT: I didnt have a perfect answer yet but apparently its better to use VARCHAR2 cause it can store up to 4000 characters and my text is 1000 wide, so yeah, almost sure varchar2 is better then clob.

0 Comments
2024/04/23
02:08 UTC

0

I’ve never coded and i need help for an assignment

I am in dire need of help to do what’s honestly a simple assignment but I don’t know where to even start.

7 Comments
2024/04/23
01:00 UTC

0

Organizing pictures with css

I'm bad at explaining, sorry if it's messy.

I have a section on the left side of my site designated for text, and I'd like to put a picture next to each article on my site. No matter what I tried, the picture gets placed directly next to the article, rather than having some space in between the article and pictures.

Imagine: Article|picture

But I would like it to be: Article picture

Basically to have all pictures in a line on the right, next to their corresponding articles, rather than having them squeezed in.

3 Comments
2024/04/22
20:58 UTC

0

Do while loop issue in C

When I input "s" or "S" instead of stopping, the loop continues infinetly without any user input. This image explains everything

https://imgur.com/a/XoLKyF2

1 Comment
2024/04/22
19:37 UTC

1

How hard is it to learn coding

I want to develop an app that generates recipes for peoples food they have left over. It would be a free app with adverts and possibly the option to pay for higher tier accounts unlocking more things.

What would I need to learn to be able to create this?

This would be a side project and happy with it taking some time

Many thanks

3 Comments
2024/04/22
17:42 UTC

1

Need some opinions

Can i get a good paid internship if I have solved like 300-500 problems on leeycode in C++ language and nothing else

3 Comments
2024/04/22
11:41 UTC

0

AI CODER/ ENTHUSIAST LOOKING FOR MONEY

I’m in search of someone who has some knowledge on AI and is interested and handy at coding/ APIs. If you fit the description and are after some big money contact me! IG: levgorbo

0 Comments
2024/04/22
11:35 UTC

0

Give solution

Want to start my coding carrier. I am in college first year ( not even started ) I want to do 4 things from beginner to advance level in my 4 yrs of college life. I am from lower middle class family want to earn in lacs to make my parents proud.

Front end Back end Devops Full-satck

Can you suggest the best website to learn coding for free and practice beginner to advance level

And suggest me shall I do this 4 things yes or no

13 Comments
2024/04/22
10:13 UTC

1

Seeking Help with Coding for GPS-Tracked Drone Lighting Project

Hey everyone,

I'm working on a coding project where I want to create a drone that can track GPS coordinates and provide lighting for outdoor activities like running, biking, and events. I'm looking for advice on how to approach the coding aspect of this project.

Specifically, I want to:

  • Reprogram a drone to track GPS coordinates transmitted from a GPS transmitter attached to a person (e.g., on their head or wrist).
  • Control the drone's lighting equipment based on the person's movement and GPS location.
  • Ensure the drone can carry and control lighting equipment for extended periods (15-20 minutes).

I have been researching various websites and watching videos on how to code a drone using different programs and software, but it all seems too overwhelming for me. If anyone has experience with similar projects or can offer guidance on:

  • How to program a drone to receive and interpret GPS coordinates from a transmitter.
  • Coding techniques for controlling lighting equipment based on GPS location and movement.
  • Resources or tutorials for getting started with drone programming and GPS integration.

I would greatly appreciate any help or advice you can provide. Thanks in advance for your assistance!

1 Comment
2024/04/22
07:28 UTC

1

How to make a background image (this is on fandom)

This is what I've gotten so far, and it satisfies me except the background part:

<div style="background: #FFFFFF;border:3px solid #11111c; border-radius: 50px">
<div style="color:#01010c; font-size:25px; margin-left: 10px; margin-bottom: 2px; margin-top: 2px">
<div style="text-align:center"> <big> '''[[Dream 0]]''' </big> </div>
<div style="border:2px solid #11111c; margin-right: 10px"></div>

</div> </div>

How would I make a background image instead of a plain color background? This is on Fandom, so url function isn't allowed.

3 Comments
2024/04/22
01:43 UTC

1

Coding a macro

I don't know if this is the right subreddit for this, but I cannot find any better one. Basically my primary goal of this project is to get a program that, when I press down one button, will run two separate button inputs to the computer, and keep these inputs active until I release the initial button. The thing is I need one button to be pressed down slightly before the other. I also don't want the program to interfere with any other inputs I have going on while I am holding down this button. I have absolutely no idea what system library I should use to get this kind of interaction with my system. I would prefer to code in python, but if anyone knows any third party applications that could do this without any code, that would be much appreciated. The reason I am even looking to code this is that every macro software I have looked at so far does not have the option to run a separate command on release of the button. I also have some experience in python, and the reason I am not just learning exactly how to do this is I just want this one program and care minimally about my coding skills after this. If you guys don't want to answer this, Could you direct me to a better subreddit?

1 Comment
2024/04/22
00:59 UTC

6

Coding on an iPad?

I was looking into getting a cheap laptop for coding while im away from my PC but an iPad would be nice for other things too. Is there a way to code on an iPad?

7 Comments
2024/04/21
23:26 UTC

Back To Top