/r/AskProgramming
Ask questions about programming.
All questions related to programming welcome. Wonder how things work? Have a bug you can't figure out? Just read about something on the news and need more insights? We got you covered! (probably)
You can find out more about our (preliminary) rules in this wiki article. If you have any suggestions please feel free to contact the mod team.
Have a nice time, and remember to always be excellent to each other :)
/r/AskProgramming
I need to build a web app that can search multiple pdf files by file name. Or ,if it's possible, by it's content, like in Adobe Acrobat. And also add/upload and delete pdf files through the web app itself. Can I use MERN Stack? or is there an alternative where I do not have to use database and just grant direct access to the files on my pc.
I also need this to work on a local server where multiple PC's can have access to it.
Please any suggestion can greatly help..
I use this https://json-formatter.cc to format JSON and I love it, and I'm looking for a similar one for XML.
I have bought a Orange Pi 5 to play a little with mini computers, and after playing with it a little, I decided to turn it on a home server
I've been using it a couple of months now, eveyrhing running ok so far, but lately I've been trying to go to the next step, using it outside my house
To be able to use it without risking on opening ports I wanted to install a vpn, my option was hamachi, but after downloading the ARM version it still gave me problems to install, and after searching a lot I couldn't find a solution
Are there other good alternatives for free vpn like hamachi that could work with it?
Or any other options? maybe something that is not a VPN or even forwarding ports, but making it safer?
Thanks!
Hello All I am currently making a web app for my swe class and the idea is to allow user to sign up and upload music in .wav files. I plan on using react for the front end. What is the best cloud DB to use for storing this type of data?
I know design patterns but what about file to file? Sometimes my code can gets way too messy cause of the amount I add to a file.
More in terms of when to use a new function, when to much code is added to a function, best way to separate
Any suggestions on how to improve this? Any steps, tricks, tactics?
Iv'e seen exclusive getters and setters in some cases (in files with the functions), what else?
In short, how small / large should functions be, how precise and how many to a file?
Hope that makes sence.
Thanks
I'm looking for advice on what programming language(s) to learn to fulfill a vision I have for a project I'm hoping to develop myself.
My project: a historical (not current/google maps) overhead/plat map that I can host as a web page, which has the following features:
This might be simple for many of you, but will be an interesting learning experience for me.
What language(s) should I consider learning in order to bring this project to life? Or, is there a course online that I should just take that would help me develop the skills for this kind of project?
I have very little experience in programming (BASIC in the early 80's, Pascal in the early 90's, M/Cache in the late 90's), but I'm eager to take the next 1-3 years to learn what I need.
Sorry if this question is not well-formed -- I'm an old looking to keep my brain young with this project, but clearly I'm just starting out. Please let me know what other information would be helpful if your answer is "it depends."
Thank you
Is using AI really cheating if it’s helping me understand basic concepts? I had a professor even encourage the use of AI so I was just curious. I use it as a last resort if I’m really stuck on a problem but still feel guilty for some reason. Thoughts ?
I'm making a program that takes inputs direction, street number, and street type and basically outputs the location relevant to other streets in the town. How does it look overall, including the notes?
I also need help on lines 67 & 91. I created ordinalSuffixes to go with 1's, 2's, and 3's on lines 37-47, but it doesn't change with the stNum on 66 & 90. I'm pretty sure it's from placement within the program, but to make it readable can I add lines 37-47 under lines 66 & 90?
Thanks.
import java.util.Scanner;
public class MainProgram {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scnr = new Scanner(System.in);
String direction; //declare variables
int stNum;
String stType;
String ordinalSuffix;
System.out.println("direction: "); //getting inputs
direction = scnr.nextLine();
while (!(direction.equalsIgnoreCase("north")
|| direction.equalsIgnoreCase("south"))) {
System.out.println("invalid direction. Please try again: ");
direction = scnr.nextLine();
}
System.out.println("Street number: ");
stNum = scnr.nextInt();
while (stNum <= 0) {
System.out.println("Invalid street number. Please try again: ");
stNum = scnr.nextInt();
}
System.out.println("Street type: ");
stType = scnr.nextLine();
while (!(stType.equalsIgnoreCase("Avenue") || stType.equalsIgnoreCase("drive")
|| stType.equalsIgnoreCase("lane") || stType.equalsIgnoreCase("street")
|| stType.equalsIgnoreCase("place") || stType.equalsIgnoreCase("way"))) {
System.out.println("Invalid street type. Please try again: ");
stType = scnr.nextLine();
}
if (stNum % 10 == 1) { // cycling through street number suffixes
ordinalSuffix = "st"; //using modulo
} else if (stNum % 10 == 2) {
ordinalSuffix = "nd";
} else if (stNum % 10 == 3) {
ordinalSuffix = "rd";
} else {
ordinalSuffix = "th";
}
if (stType.equalsIgnoreCase("Avenue") //print first part of 1st line
|| stType.equalsIgnoreCase("Drive") //based on street type
|| stType.equalsIgnoreCase("Lane")) {
System.out.print(direction + " " + stNum + ordinalSuffix + " " + stType);
System.out.print(" is " + stNum + " blocks west of Central Avenue and is ");
if (direction.equalsIgnoreCase("north")) { //nested if-else that tells direction
System.out.println("north of Washington Street."); //from washington st
System.out.print("The preceding street is ");
} else if (direction.equalsIgnoreCase("south")) {
System.out.println("south of Washington Street.");
System.out.print("The preceding street is ");
}
if (stType.equalsIgnoreCase("avenue")) { //print 2nd part of 2nd line
stNum -= 1;
System.out.println(direction + " " + stNum + ordinalSuffix + " lane.");
} else if (stType.equalsIgnoreCase("drive")) {
System.out.println(direction + " " + stNum + ordinalSuffix + " avenue.");
} else {//don't have to specify lane-already specified on line 50
System.out.println(direction + " " + stNum + ordinalSuffix + " drive.");//it's the last available option.
}
} else if (stType.equalsIgnoreCase("Street") //print second part of 1st line
|| stType.equalsIgnoreCase("Place")//based on street type
|| stType.equalsIgnoreCase("Way")) {
System.out.print(direction + " " + stNum + ordinalSuffix + " " + stType);
System.out.print(" is " + stNum + " blocks east of Central Avenue and is ");
if (direction.equalsIgnoreCase("north")) { //nested if-else that tells direction
System.out.println("north of Washington Street."); //from washington st
System.out.print("The preceding street is ");
} else if (direction.equalsIgnoreCase("south")) {
System.out.println("south of Washington Street.");
System.out.print("The preceding street is ");
}
if (stType.equalsIgnoreCase("street")) { //print 2nd part of 2nd line
stNum -= 1;
System.out.println(direction + " " + stNum + ordinalSuffix + " way.");
} else if (stType.equalsIgnoreCase("place")) {
System.out.println(direction + " " + stNum + ordinalSuffix + " street.");
} else { //don't have to specify way-already specified on line 74
System.out.println(direction + " " + stNum + ordinalSuffix + " place.");//it's the last available option.
}
}
}
}
I was doing some research and came across a new set of variable length prefix codes that are on average half a short as Huffman codes and I wanted to modify the DEFLATE algorithm to use my codes instead to better the compression ratio of the DEFLATE algorithm which uses Huffman codes and is a gold standard in computer science. How would I be able to modify the DEFLATE algorithm to use my codes instead?
Hi everyone,
I have a job interview at Docker as a Senior Enterprise Customer Success Manager (CSM).
I have 5 years of professional experience as a Senior Enterprise CSM which I gained at another, non-technical SaaS company.
However, I'm a beginner with technical SaaS such as Docker.
Can you please share some free-of-charge online learning resources focusing on Docker for non-technical beginners?
I prefer video tutorials and bullet-pointed texts that are easily readible and understandeable.
I already conducted some research on YouTube. But since I have no Docker experience I find it challenging to identify which resources are accurate, up-to-date and suited for beginners. Also, the amount of options is overwhelming.
Thank you in advance.
Hello beautiful people, I want to learn java and I don't know where to start (I'm not new to programming I have an idea about oo languages I've already worked with c++) so any advice(maybe a course or somthings I should focus on)
I'm a developer at a software company that offers B2B solutions using 2-3 core products. Recently, the CEO has jumped on the AI bandwagon and is eager to integrate AI into our workflows. They’ve even purchased company-wide subscriptions to GPT-4 and GitHub Copilot.
Now, they’re pushing us developers to come up with ideas on how to use AI in our development processes. One idea that’s been floated is using Cursor AI because it can analyze the entire codebase. The CEO has made it clear that our suggestions will factor into our performance evaluations.
Honestly, I’m frustrated with this approach and am already looking for other job opportunities. But in the meantime, I need to pitch something by next week. So, I’m turning to the community for any ideas. For context, our codebase is fully integrated into Azure DevOps, which we use for bug reports, PRs, user stories, sprints, etc. Any suggestions?
Hey I’m jumping into a new framework. The documentation is sparse and it’s a large code base so I’m spending lots of time reading code trying to figure out what does what and which classes are useful for my project.
Does anyone have recommendations on Ai tools that could analyze the repo and give me summaries of how the various pieces fit together?
Hello guys,
I am currently working on a Decision Support System for a Wordpress Website. Do you got any recommendations for Plug ins for Wordpress to fullfill this purpose?
It should just answer questions with yes/no.
Kind regards
I'd appreicate it if someone could show me the best way they have heard or know of or done on how to learn a language, framework and tool. All 3 of them , thank you
I wanted to become a developer but due to some circumstances, I couldn't pursue that path. I know some of the basics of programming. And still I want to become a programmer. Is it really possible to become a self taught programmer? If yes, then which field should be good: front-end, backend, data analysis, data science, or something else. I know that I am dreaming big but still I wanna try.
Hi all,
I hear people say that great programmers learn from books and I as wondering if it was true and maybe try it my self. But I have some questions
How do you structure your learning from a book—cover-to-cover or selective?
How do you practice? Do you follow examples or work on side projects?
Any must-read book recommendations for beginners/intermediate learners?
How do you keep up with new tech when books can get outdated?
Would love any tips or advice. Thanks!
Odd question I know and may not be for this sub, but I've started getting pain in my right wrist which I think is from consistently moving from typing, to using the arrow keys, to using the mouse.
I've been coding for just over a year and in the last 2 months been coding almost every day, so maybe it's something il get used to overtime, but wondered if I am doing something wrong? I.e. should I not be using the arrow keys as much? Or maybe it's the type of keyboard.
I already use a vertical ergonomic mouse and my setup feels pretty comfortable with wrist supports etc.
From a search on keyboards I can't really see anything different to my current one. But maybe there is?
Am i alone on this issue or has others experienced this in the past? If so, how have you overcome it?
I wanna start coding but DK the path to follow like which language would be the best to start with nd whom shall I follow nd other imp factors. I am a beginner in coding and need to start from scratch.
Would appreciate if someone could share all this!
Hi, Reddit community!
I’m preparing for a low-level design interview and would appreciate your expertise in reviewing a UML diagram I created for my project.
Project Overview:
UML Diagram: here
Requirements:
I’ve attached a PDF that outlines the requirements I’ve gathered.
What I’m Looking For:
I appreciate any insights you can share! Thank you for taking the time to help me improve my work.
When diving into a new language or framework, do you use any specific tools or methods to compare different boilerplates and libraries?
If not, what's your process for selecting these? What are the key factors you consider that might not be immediately obvious?
I'm particularly interested in hearing about approaches that work across different domains
Hello, I'm aware of swagger, which is useful for dev teams to communicate work to other teams. Then there are pages like this:
https://docs.fiserv.dev/public/reference/createpaymenturl
That have curl, request, response, language variations etc. How are these provided? This setup looks 90% identical to two other pages I had to implement, so I assume this is some kind of framework? What do you call it.
Hi everyone!
As the title says, I can't decide on my niche in programming and it gives me pain.
I am a CS graduate with some experience in DSA, Python, PHP and Databases, but I want to deep dive a language/niche and I can't find one.
I want something interesting, that will have a future in this industry.
To me, cybersecurity sounds interesting... but from what I heard, it's kind of hard to get into...
I know that I don't really like web/mobile development and Machine Learning/AI.
If you have more questions, feel free to ask!
And please help me, I need to make a decision.
Thank you guys!
I’d love to hear from people who have actually used AI for programming assistance or code reviews.
In teams of all sizes, code reviews can be time-consuming and disruptive to workflow. When mandated as a strict process, like in many large companies, it can slow down iteration speed. But skipping reviews altogether feels risky, as it’s easy to miss your own mistakes or overlook issues.
So, what’s been your experience? Is AI a viable solution for making this process more efficient without compromising quality? If used any,what's your recommended product?
I am wanting to write a program to show text or symbols on the screen to show information stored at a position in three dimensions. Such as the name of a planet at a certain point in time in it's orbit.
With quick basic I wrote a two dimensional pacman-like game, but I did not know how to program in the third dimension.
I have read books on C, and Python but have not found what I was looking for.
I'm trying to automatically generate using AI documents similar to the ones linked below and was wondering if anyone could recommend a tool that might support this (if any). DeepWriter for instance can generate long narrative documents. Any suggestions are welcome!
Thanks in advance for your help!
Hello everyone! I'm a freshman Computer Science student from Brazil. I'm currently studying Angular and Java. If anyone is interested, I'd love to have a programming study partner. I think sharing ideas and progress is a very engaging way to learn, and we can also do some projects together. If you're interested, please contact me, it'll be a pleasure to meet you.
To put it clearly, watching undubbed american movies while reading the provided english subtitles did't quite help me to succeed in my attempt to improve my English listening skills. This got me an idea for some alternative way to use those subtitles for the aimed goal:
The subs should only appear when the video is paused.
Going backward/forward in playback after hitting pause should work in terms of subtitle blocks, not in terms of seconds.
Is this already possible or do I have to code some shit to get it done? Does it have to be a whole new video player to be coded or just some mod/script on any exising software?
Hi everyone, I want to fetch a large CSV file streamed from the backend using the Fetch API on the frontend. I'm using Angular and Spring Boot technologies in the project. Below you can see an example of the request and response. When I send the request this way, I get a 401 error. How can I fix it? (checked security config and cors config) Please help.
Back end:
@GetMapping( "/getRowsForExport")
public ResponseEntity<StreamingResponseBody> getExportData() {
StreamingResponseBody responseBody = outputStream -> {
StringBuilder csvBuilder = new StringBuilder();
byte[] data = new byte[0];
for (int i = 0; i < 10000000; i++) {
csvBuilder.append(i).append("\n");
data = csvBuilder.toString().getBytes(StandardCharsets.UTF_8);
if (i % 1000 == 0) {
outputStream.write(data);
outputStream.flush();
csvBuilder.setLength(0);
}
}
outputStream.write(data);
outputStream.flush();
csvBuilder.setLength(0);
};
HttpHeaders headers = formHeaders();
return ResponseEntity.ok().headers(headers).body(responseBody);
}
private HttpHeaders formHeaders() {
HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_OCTET_STREAM_VALUE);
headers.add(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, CONTENT_DISPOSITION);
headers.add(CONTENT_DISPOSITION, String.format("attachment; filename=segment.csv"));
return headers;
}
Front end:
const response = await fetch(ENV_CONFIG.backendUrl + 'xdr/getRowsForExport', {
method: 'GET',
allowHTTP1ForStreamingUpload: true,
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
responseType: 'blob',
Authorization: `Bearer ${token}`,
},
} as any);