r/programminghelp • • Jun 15 '22

Other Guarantee that older user will pay to use app

4 Upvotes

Currently, my app is free. For now, I'm testing it and adding new functionalities. In some type, I'm planning to have restricted usage of the app if the users status is "free" and not "paid". This status would be inside the user document in the database. But, if the user have a older version of the app, without the proper code to make this filter, he would have unlimited access to everything, right? Is there a way to prevent it? I was thinking about making the user only use the app if its the latest version, but don't know if its a good approach.


r/programminghelp • • May 26 '22

C Pelles C where?

4 Upvotes

Im learning C and am searching for an authentic Pelles C download but cant find any. Do i really need to use these 3rd party download websites or is there an official download?


r/programminghelp • • May 19 '22

Project Related I feel like this should exist already but I’m struggling to find it.

4 Upvotes

I work at a civil engineering firm and we use file explorer on a central network to store all the work we do. When I put in a survey request to get new data from the field sometimes they forget to tell me that the data is available. So I would like to be able to enter a key phrase so if anything with that in the title gets put into the folder I get some kind of notification (email, teams im, whatever) so I do not have to search a list every day for new files. I talked to a friend in programming and he said I should ask “I'm looking for some software that will notify me when a file is placed into a directory where the filename matches a specific pattern.”

With my limited knowledge it sounds like it would be an easy if not already existing software. The key phrases I would like to use would be project codes ie 18036, 19074, 20027.

Thanks for your time!


r/programminghelp • • Apr 21 '22

Project Related Web Dev Project Advice

4 Upvotes

I was wondering if I could get some general advice for a final year project. It’s also something I would like to keep building up on my own time too.

The project idea is to display information about elected representatives Their voting record, questions and contributions to debates. I also would like to have a dynamic search bar that throws up possible reps, political parties or electoral constituencies. Aswell as also display some other data, individual words used by certain reps, give them individual ranking by attendance, contributions, length etc.

I can get this from an api which returns this in json and xml format. https://api.oireachtas.ie/v1/

I am currently fetching this directly from the api through javascript. I had planned to write java code to parse a sample TD html page to put in some key ids to call the right info in the js. Though I think templates or get functions might be better. Though I don’t know if this would make it harder to find on web searches.

I am planning to use firebase to host it and bootstrap for the layout and ui design.

I did a brief web dev course and I have been doing an online web dev course. I also have done java and some sql etc.

There are so many options and I have about two weeks to put it together, so I am wondering the best options. Would not using a database and calling directly from the api and doing more complex functions on the responses be bad performance wise and a database better to use. The debate information updates pretty much every day, so I think some of the functions should only be called when ran once or twice a day, though not sure how to do that. Would it be worth learning and using react and would there be enough time?

Any advice on best tools, frameworks, libraries etc. or pointers on my best way forward would be much appreciated! I find I have learned a lot, but trying to put together an overall plan and what to use is hard as there are so many options and approaches as well as forgetting things along the way.


r/programminghelp • • Apr 11 '22

Python Perform an action only one time in a loop - until state resets

4 Upvotes

I have to video record tests at work for clients. All the cameras are fixed and pointed at the machines doing the testing. The video feeds are sent directly to recorders.

We can use free software - Bitfocus Companion to create virtual "buttons" are programmable and act as macros automating your actions into a single click.

You can call these buttons virtually via an http request. I have two choices on the back of the machine. One output will send a 3.3v signal high when it starts and go low when finished. The other is the exact opposite. I can use this signal to trigger when recording stops and starts.

I am using a raspberry pi for the triggering and another pi next to the recorders and video switcher that receives the commands and executes the actions.

My problem is the commands are repeated consistently because it is in a loop and tests run about 30 minutes.

How can I make so that when the signal changes state (HIGH to LOW -- LOW to HIGH), the command executes once until the state changes again.

I will have a pi protoboard hat. I can adjust the physical configuration as need.

Thanks in advance,

My entire code---

(the "--delete-after" comment prevents the script from storing a log every time a command is given)

import RPi.GPIO as GPIO
import os
import time

#setup GPIO pins
GPIO.setmode(GPIO.BCM)

GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP)   #machine running == HIGH; machine off == LOW
GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_UP)   #machine running == LOW; machine off == HIGH
GPIO.setup(25, GPIO.IN, pull_up_down=GPIO.PUD_UP)   #exits the program to get ready for pi shutdown

	while :
		if GPIO.input(23) == GPIO.HIGH:
			os.system('wget --delete-after http://165.91.75.168:8000/press/bank/7/2 -q')   #starts recording
			
		else:
			os.system('wget --delete-after http://165.91.75.168:8000/press/bank/7/5 -q')   #stop recording
		
		if GPIO.input(25) == GPIO.LOW:
			exit()

r/programminghelp • • Apr 10 '22

React Can React State or Context be hacked?

4 Upvotes

chop deserve sort knee squeal cooing makeshift attraction physical sharp

This post was mass deleted and anonymized with Redact


r/programminghelp • • Mar 03 '22

C Is there a difference between sdl in c and sdl in c++?

4 Upvotes

Will sdl c code be the same as sdl c++ code?


r/programminghelp • • Feb 25 '22

C Need homework help

4 Upvotes

Question:

Create a function called power. The function will calculate the value of the number

raised to the power given. It will receive two integers, number and pow and will return

the value of integer number raised to the power pow.

I made this source code:

#include <stdio.h>

int main()

{

int number, pow, x = 1, y;

printf("This program will raise an integer to a power\n");

printf("Enter an integer\n");

scanf("%d",&number);

printf("Enter an integer which will be the power the integer will be raised too\n");

scanf("%d",&pow);

y = pow;

if(pow>0) {

while (pow!=0) {

x = x*number;

pow--;

}

}

printf("%d to the power of %d is %d", number, y, x);

return x;

}

Everything worked and is good now I have 0 idea what this one means.

Question:

Using the functions that you wrote in section B (the question above) do the following.

  1. Write a statement that will assign to the already declared integer variable powa the value

returned by the function power. The base value and the power are in the base and exp

Variables.

Can someone please explain what this means? Thanks


r/programminghelp • • Feb 06 '22

Project Related Best language for a instrument cluster

4 Upvotes

So for one of my projects I want to make a instrument cluster with a screen for my motorcycle. My motivation is is help teach myself a bit of Electrical engineering, programming, and get a better understanding and basic skills on how to design and build programs and things that may use programming. I know it's a huge project and definitely not a beginners project, but I'm just gonna jump in head first and hope I if I surface surface I have learned a lot. Anyways, my question is, what would be a good language to use for a project like this? Im assuming a low level language but which language I've got no clue.


r/programminghelp • • Jan 19 '22

Answered Combined sort and search algorithm: what would the time complexity be?

4 Upvotes

I have this sort and search algorithm where the first half is an insertion sort, while the second half is a binary search. The time complexity of the insertion sort is O(n2) while the binary search has O(log2 n). What would the time complexity be? I would also appreciate it if you could tell me the space complexity because I have a difficult time understanding that.

I think it's to going to be either:

  1. O(n2log_2 n), I combined them?

  2. O(n2), because as n grows sufficiently large, the runtime of the insertion sort eventually shadows that of the binary search.

ETA: the answer's O(n2 )

Thank you!


r/programminghelp • • Jan 09 '22

C Getting this error. How do I resolve it?

4 Upvotes

'gcc' is not recognized as an internal or external command,
operable program or batch file.
[Done] exited with code=1 in 0.08 seconds


r/programminghelp • • Dec 15 '21

Java Issue creating a function on Java

4 Upvotes

I'm doing a Java assignment for a programming class, and in it I plan to use a bit of code repeatedly so I tried to make a function, but for some reason it won't work. I've made and used functions before, but for some reason I can't seem to do it now. Can anyone tell me what I'm doing wrong?

/*
 * Activity 1.3.8 (late)
 */
import java.util.Scanner;

public class main
{
  public static void main(String[] args)
  {
    //Scanner sc = new Scanner(System.in);
    public static String test() {
    System.out.println("test");
  }
  }
}

r/programminghelp • • Nov 23 '21

Python Please i dont know whats wrong

4 Upvotes

code:

from tkinter import *
tk=Tk()
l=Label(tk,text="hehehehe")
l.pack()
tk.mainloop()

error:

Exception has occurred: NameError

name 'Tk' is not defined

Please tell me whats wrong... Im using python 3.10.0 and have installed Tkinter... but i cant move beyond the tk=Tk() error.


r/programminghelp • • Nov 20 '21

Other What's the most efficient isEven function?

4 Upvotes

I'm mostly just curious, but what's the fastest one?

You have the obligatory x % 2 == 0, as well as x & 1 == 0.

Which one of those is faster, and is there an even faster way to determine whether a number is even?

I mostly use rust, but I'm also curious about whether this extends to other languages.

Thanks!


r/programminghelp • • Nov 16 '21

Python I really need help with this calendar project I have to make for college, plzzz help!!! (Python)

4 Upvotes

So I have to make this project and present it in class. The program should take a given schedule and save it in a file for a specific date. Every time I try to see a date I just put a schedule in, it will not show that anything was created for the date and says "You don't have a schedule on mm/dd/year" when I just made schedule for that date. Help plz!!!

Code: https://pastebin.com/gpVvRkzW


r/programminghelp • • Nov 05 '21

Other How do I get better at remembering what work I've done/discussions I've had regarding Merge Requests.

4 Upvotes

So I've been working as a Junior Software developer for a few months now. All is going well but something that my line manager has noticed is that I often fail to answer questions regarding changes in my code. I always try to write clear commit messages and ensure that I update the relevant tickets with the notes they need but sometimes, I might be asked about some work I've done and I often struggle to quickly provide a clear and confident answer.

This might probably just be a me problem but I was wondering if anyone else may also have difficulties remembering the code they've previously worked on or discussed.


r/programminghelp • • Oct 31 '21

C# Modifying a Game

4 Upvotes

I've been trying to use dnSpy to change code in the Assembly-CSharp.dll. I'm able to understand the code somewhat and change the values of Speed, Jumpheight etc.. I'm just not able to compile. In the tutorial he said this was common but I've looked at the errors for a little bit and cant figure out a fix.
https://imgur.com/a/neMbrsN
I have fixed the last Error on line 368.


r/programminghelp • • Oct 31 '21

Other laptop problemo

4 Upvotes

so im on a laptop and it overheats rn its at 70 degrees C and im trying to make a program to run that if it exceeds over 90 degrees C then to set fan power to max and if it goes under 75 or 80 degrees c set fan speed to automatic


r/programminghelp • • Oct 29 '21

C++ How can I split a string by space into an int array?

4 Upvotes

Basically the title, I want to split a string based on the spaces in it. For example, if I have a string “1 4 2 3”, I want to split it into an array [1, 4, 2, 3]. I know that I probably have to use atoi somewhere, but I’m not sure how to split the string. Any help is appreciated!


r/programminghelp • • Oct 25 '21

Java How to add variables once to new array in double for loop

4 Upvotes
/**
	 * Returns the resolvents of the two clauses. Take out the terms that negate and new SimpProp is remaining terms
	 * resolves on the first term
	 * @param one
	 * @param two
	 * @return
	 */
	public SimpProp resolve(SimpProp one, SimpProp two){
		ArrayList<String> oneTerm = one.getTerms();
		ArrayList<String> twoTerm = two.getTerms();
		ArrayList<String> newTerm = new ArrayList<String>();
		for (String i: oneTerm) {
			boolean negate = false;  //if its true dont add it at the end
			for(String j: twoTerm) {
				if(!j.contains(i)) {
					newTerm.add(j);
				}else if(i.equals(j)) {
					newTerm.add(j);
				}else if(i.contains(j) && !i.equals(j)) {
					negate = true;
				}
					
			}
			if(negate == false) {
				newTerm.add(i);
			}
		}
		SimpProp endTerm = new SimpProp(newTerm);
		return endTerm;
	}

So the basis of this method is to look at two phrases that look like B11 V !S21 V B34 and seeing if theres any negation and to return a final array of all the proposition terms that werent negated. So for example (B11 V !S21 V B23)*one* and (!B11 V b32 V S44) *two*, In my code I look at ones terms first and compare it will all terms in two. Im trying to make it so I only add the terms in two once, instead of every iteration of one but im not sure how I would go about it.


r/programminghelp • • Oct 25 '21

Other Updating data stored in DynamoDB using typescript

4 Upvotes

Greetings,

Forgive me as I am new to using AWS-SDK, Dynamo DB, and typescript and a novice at best. I am receiving data as a POST request in form of JSON as shown

{

"username": "xyz",

"token": "bitcoin",

"quantity": 2

}

which is being passed and handled by the handler and is stored in the event. body parameter, I have a database that has the username, email, and password already stored. I get the data based on the username using the dynamo DB get method and put new data into the dynamo DB using this format.

{

"username": "xyz",

"email": "[email protected]",

"password": "MyPassword",

"assets": {

"bitcoin": {

"quantity": 2

}

}

}

Now here is the problem I am facing using the put method overwrites the entire assets property when a new POST request is made. 2nd I am using the update method to update the assets property but I am facing the same overwrite issue I have searched for a decent example in writing the update expression but to no avail.

What I am trying to achieve is when a new POST request is made for the same username the assets property needs to add the token with quantity in assets property and in case a request is made of the same token with a different quantity then update just the quantity.

My code is provided in Pastebin for reviewing purposes.

https://pastebin.com/Zf3baYNh

TIA


r/programminghelp • • Oct 25 '21

Other Having Image locations in JSON dataset

4 Upvotes

I'm making a data sets for game which is suppose to hold the default information for monsters and items. (which when acquired by the user would be copied to their own dataset and able to change) But I want to include the picture with the data set. I though I could do so via file location as the json file in in the same file of the images or shares a file with the file the pictures are in.

I'm only finding ways to do this via urls


r/programminghelp • • Oct 07 '21

Python Need assistance writing code that converts cm into mm, inches, or feet

4 Upvotes

Hello,

This is my first post here, so apologies if this post isn't rule friendly.

My assignment for Computer Science is to write a program that converts cm into mm, inches, or feet based on the users choice. We're required to use if statements.

I'm very new to this, so I apologize if my coding is amateurish.

Here is what I have so far:

 cm=float(input("How many cm do you want to convert?"))
choice=input("Choose (m)m, (i)nches, (f)eet:")
if choice=='m' :
    print(cm*10)

When I run the program, it accepts the inputs, but doesn't print cm*10. What am I doing wrong?


r/programminghelp • • Sep 21 '21

Python ELI5. what comes after "return" when your done with the function?

4 Upvotes

I get that the return function is to close up the def function up, however I'm confused what joins along with return, so let's say "return (what comes here?)". I'm new at python and codecademy can be pretty confusing. I can probably find it in the FAQ but there's so many different results I can't find what I want