Click here to Skip to main content
15,891,136 members
Everything / General Programming

General Programming

programming

Great Reads

by OriginalGriff
Marking code you need to return to later
by jurhas
A small simulator for a 6 axis articulated robot
by super
A rough guide for developers how to approach development of software for Internal use especially in Engineering companies, where shorter turnaround is more important
by Colin Vella
This article presents an algorithm and data structures to implement auto-tiling as seen in RPG Maker, the Starcraft level editor, etc.

Latest Articles

by Henrik Vestermark
The steps needed to build an Interval Arithmetic class in C++
by Jackson Jiang
Introduction to and development journey of a real-time transcription function
by Shun Huang
Use Python to build atomic binary trees
by Andreas "PAX" Lück
Investigation of PE file modifications performed by Microsoft Detours

All Articles

Sort by Updated

General Programming 

N 30 Apr 2024 by Richard Deeming
Assuming you're trying to replicate the list shown on the Windows lock screen, it's not as simple as passing a filter to the list. By default, Windows will show all enabled local user accounts on the lock screen, assuming the computer is not...
N 30 Apr 2024 by Dave Kreskowiak
There is no procedure for filtering the users based on what you don't recognize. User accounts are user accounts. In a corporate domain environment, you can have other users you don't recognize, but you don't have any way of filtering them out...
U 29 Apr 2024 by samtoad
I'm again attempting to obtain a list of all users on a windows platform. I already obtained a general user list using the netuserenum function. I think you do the same with other functions, like NetQueryDisplayInformation. But my question...
U 29 Apr 2024 by k5054
Without some code examples, it's not clear where the issue is. In particular, how are you getting your data? For example char buff[10]; scanf("%s", buff); will overflow your input buffer. You can tell scanf how long your input buffer is...
N 29 Apr 2024 by Rick York
When I must use fixed-sized text buffers I make sure to use the size-limited library functions since they are much safer. Here is an example with your data : #define DATE_LENGTH 11 typedef char DateStr[ DATE_LENGTH + 1 ]; // plus one for the...
N 29 Apr 2024 by samtoad
In an application that I'm working on, I use dates, with size of the 'char' being declared as datestr[12], with the max length of 11 -> thru out the whole program... While testing all possible situations, I entered a date greater than size of 11...
16 Apr 2024 by Pete O'Hanlon
There is a possibility that you could answer this question for yourself using something like ChatGPT. What you need to do is create a prompt that provides as much detail as possible; far more than you did with the question. So, you might write...
28 Mar 2024 by KarstenK
Verify that your new dll function has the same export macro signature as the other dll function. Mostly some DLL_EXPORT or similar macro stuff. Another common issue is that, your new dll isnt used by the calling program but a stale version in...
27 Mar 2024 by Rick York
Firstly, there are no limits to DLL sizes or capacities. Secondly, it is important to note what is emitting that error message. It could be the compiler or the linker. If it is from the compiler then you have not defined a prototype for the...
27 Mar 2024 by samtoad
Currently, I'm trying to add another "C" routine into a DLL file. I've made the routine inside a DLL source file. I've declared the routine, and also indicated the intentions as it will be exported. The function name is also included in a DEF...
19 Mar 2024 by steveb
Your function declared as taking 3 arguments. But you call it passing only 2 arguments. Hence you get an error during compilation. 3rd argument is not optional as declared.
19 Mar 2024 by samtoad
I have a question that may tax you, but it may also embarrass me at the same time, but here goes. Let's have some programming examples with which to work with first: Declaration of a "C" routine int RetIntDayNum(char * datestrg, int *...
19 Mar 2024 by CPallini
I could not believe that. So I tried the following piece of code #include int RetIntDayNum(char * datestrg, int * intdaynum, int * iostat); int main() { char foo[] = "foo"; int daynum = 42; int iostat = 10; ...
18 Mar 2024 by merano99
First of all, a distinction must be made between the declaration in the implementation and the call of a function. The following line is not a declaration but an assignment: iretv = RetIntDayNum(cdatestring, &idaynum, &iostat); VS2019 usually...
18 Mar 2024 by OriginalGriff
It depends on the compiler: most will give you an error "too few arguments to function" when you try to call it with two parameters. Other than that, it will probably blow up when you try to use iostat within the function as it's value will be...
16 Mar 2024 by Henrik Vestermark
The steps needed to build an Interval Arithmetic class in C++
14 Feb 2024 by Hailu Worku Obsse
Your script looks good for the most part. However, there are a few things to consider and potentially improve: Input System Integration: You're currently using the legacy Input.GetKeyDown(KeyCode.E) and Gamepad.current to detect input. It's...
12 Feb 2024 by Andrew Akram
I have this code here that displays a game object when I press E on the keyboard the only issue is it works with the host and nothing happens when the client interacts with it when he presses E. what is the solution or what I'm doing wrong and...
10 Feb 2024 by merano99
You should rather ask yourself why you use a C array instead of a container in C++. You can use the size() method on containers and get the desired size, which you could also adjust at runtime. There are also many other advantages to using the...
9 Feb 2024 by Rick York
One small addition: the expression you wrote, sizeof( x ) / sizeof( x[0] ) is used to calculate the number of items in an array. This is the same as what the _countof macro does in VisualStudio C++. To summarize the three expressions and their...
9 Feb 2024 by OriginalGriff
sizeof returns the number of bytes used by the parameter: for an array, that the size of each element multiplied by the number of elements. Try this:#include int main() { int arr[10]; printf("%lu:%lu\n", sizeof(arr),...
9 Feb 2024 by Charu Lata 2024
how does sizeof() operator calculates the size of array What I have tried: I wrote sizeof(x) to calculate the size of array but I didn't get the expected output.
18 Dec 2023 by pasztorpisti
Have some balls and don't be afraid to choose your destiny for yourself. Do you want us to tell you what to do with your life??? (Hmmm, a few tips from me: go and try working as a makeup artist or a ballet dancer...) If you have no clue about any...
1 Nov 2023 by codeingguru
I don't want alert message. I just want to show my own custom popup on page reload and not allow page to refresh until I select leave or cancel from popup. What I have tried:
31 Oct 2023 by Richard Deeming
No. Window: beforeunload event - Web APIs | MDN[^]: You should note that modern implementations: ... Only show a generic browser-specified string in the displayed dialog. This cannot be controlled by the webpage code. This has been the case...
24 Oct 2023 by samthelab
What does this mean and how do I fix it?? 1>C:\dllmain.cpp : warning C4747: Calling managed '_DllMain@12': Managed code may not be run under loader lock, including the DLL entrypoint and calls reached from the DLL entrypoint...
14 Oct 2023 by Gerry Schmitz
Learn and tutor with "Scratch" (free). C# is an abstraction for your average "10-11 year old". You'll even be able to create your own "demo". Scratch - Educators[^] Scratch - Starter Projects[^]
12 Oct 2023 by Member 16112906
I am asking this question from a quite specific situation, so allow me to elaborate a bit. Recently, I decided to make a job change to be a teacher (primary school btw, likely 10-11yr olds) - one of the subjects I have now is 'ICT in education'....
11 Oct 2023 by M Imran Ansari
Learning C# or another programming language can be a meaningful and valuable use of your 20 hours, as it aligns with your goals of gaining insight into programming logic and potentially creating engaging projects. Ultimately, the choice of...
17 Jul 2023 by Smoker_Avi
Print the following pattern in python for the given number of rows. * * * * * * * * * * i am not getting * at the row 6 and 10 What I have tried: for i in range(10): for j in range(3): if (i + j) % 4 == 0 or (i...
17 Jul 2023 by Gulshan Negi
Hello this is Gulshan Negi Well, you need to run below code what you are looking for. for i in range(11): for j in range(3): if (i + j) % 4 == 0 or (i + j) % 4 == 3: print("*", end=" ") else: print("...
7 Jul 2023 by Richard MacCutchan
Alll the information you require can be found at Bjarne Stroustrup's Homepage[^]. He is the man that created C++.
7 Jul 2023 by Lâm Đán
What are common challenges encountered when working with C++ programming language? What I have tried: Describe the problem
7 Jul 2023 by CPallini
C++ is a powerful and complex language. Dealing with complexity is, you know, complex. The good news is you could teach it yourself in just 21 days![^].
6 Jul 2023 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
7 Jun 2023 by Anime Insolite
Here is my dilemma: I want to translate a video from English to French using an artificial intelligence-generated voice. Therefore, I search for an English video on YouTube, download it, and extract its subtitles. Then, I translate these...
10 May 2023 by Patrice T
Quote: How can I write this pattern in Python First of all, your code is too complicated! No matter what, each output line ends with a '*' This makes this code: for i in range(10): # here you just need to tell how many spaces Spaces= i ...
10 May 2023 by CPallini
Let's have a variable r that counts the rows, starting from zero, so that at first row r = 0 at second row r = 1 ... Now let's have another variable c that contains the column of the '*', so that at 1st row r = 0, c = 0 at 2nd row r = 1, c...
10 May 2023 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
7 Apr 2023 by Gulshan Negi
Hello this is Gulshan Negi Well, I am writing a program for password generation in Python but it shows some error while executing. Source Code: import secrets import string def create_pw(pw_length=12): letters = string.ascii_letters ...
6 Apr 2023 by Richard MacCutchan
You are getting an infinitie loop because of the following lines: for i in range(pw_length): pwd = ''.join(secrets.choice(alphabet)) # you replace pwd with a single character each time So the code at ... if (any(char in...
6 Apr 2023 by OriginalGriff
Try this: for i in range(pw_length): pwd = pwd + secrets.choice(alphabet) But ... that's a very inefficient way to generate it - there is no guarantee that the random sequences generated will ever meet the criteria which...
21 Mar 2023 by Alessandro Terzi
I have a web application done in c#, when I start it from visual studio, it works without problems, however when I try to upload it to IIS and open it via localhost it gives me this problem. https://imgur.com/Eij19uo What I have tried: ...
21 Mar 2023 by Alessandro Terzi
In reality it gives me the impression that the error says nothing, also because starting the web app from visual studio it works perfectly, however I went to the "Event Viewer", "Windows Logs", "Application" setting and you should find the error...
20 Mar 2023 by OriginalGriff
Read the error message: it gives you explicit instructions on what to do to get the actual error information. You cannot solve this problem from that error message - nobody can - you need the actual error information that caused the system to...
13 Mar 2023 by Yor Gurt
I have n sets of two items: ["a", "b"] ["c", "d"] ["d", "a"] ["b", "c"] And I want to find at least one item from this set (if it exists), that passes the following constraints: The first constraints is a sort of exclusion check (= we are...
7 Mar 2023 by speed blaze
Nidhi has created an alternate version of Subway Surfer game. Her new version is not on a train track unlimited length, rather limited to a track of length N + 1. Just like the original game, this alternate version also has three lanes. The track...
7 Mar 2023 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
3 Mar 2023 by merano99
Quote: I haven't tried anything because im lost The question for me is why this is so. The task is really simple and it should be solvable even for absolute beginners. If you start from a "Hello World" program, which is probably presented first...
3 Mar 2023 by Elijah McKenzie
A construction company determines its charges as a percentage of the cost of a building. The charges are made up as follows: 10% of the first $10 000.00 of the cost of a building and 5% on the remainder if the remainder is less than or equal to...
3 Mar 2023 by CPallini
Quote: Im new and don't know anything about programming Then is time to get a bit older and learning about. See, for instance Basic Input and Output in C - GeeksforGeeks[^]. Arithmetic Operators in C - GeeksforGeeks[^].
3 Mar 2023 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
16 Jan 2023 by Heather J Coleman
C program to give user 3 tries to enter correct code number use a while loop and if else statements #include //header int main() //start { int pass, num =3; printf("You have 3 tries to enter the correct passcode!\n"); ...
16 Jan 2023 by merano99
1. obviously the while loop terminates directly because the condition is not fulfilled.The condition should be the maximum number of passes. To count the runs you need another variable. int pass, num=1, maxnum = 3; while (num
16 Jan 2023 by AIMAD EDDINE
#include int main() { int n, i = 3, pass = 1234; printf("You have 3 tries to enter the correct passcode!\n"); while (i-- > 0) { printf("Please enter the passcode: "); scanf("%d", &n); ...
15 Jan 2023 by Dakush
I have created a program which that takes as input an array of positive and negative numbers (0 excluded) and return those items from the array whose sum is 0. If no such items exist return, then return “No Elements found”. Here I have written...
15 Jan 2023 by merano99
With a recursive call, the search for a suitable combination could be done with a few lines. void Combination_int(std::vector& input, std::vector& combination, int start, int end, int index, int r) { if (index == r) { // TODO:...
15 Jan 2023 by Patrice T
First analyze the problem, play with it. For any array of size N, there is 2^N possible subarrays, minus 1 because you want to use at least 1 element of the array. It is a brute force attack because you need to check all combinations. You have...
14 Jan 2023 by OriginalGriff
This is basically a combinations problem: you need to check every possible "group" of numbers from a set util the sum of those numbers is zero. So if you have a group of numbers a,b, and c, the combinations are a b c a, b a, c b, c a, b, c...
4 Jan 2023 by HarrySto
Quote: How to start code refactoring? How to do it correctly and is it worth doing code analysis before refactoring? What I have tried: Quote: I tried to refactor the code, but I don't understand how to start
24 Dec 2022 by Member 15874031
A character and number are given as input ally correct If the number is between 1 to 10 and character is between A to C then print ALPHA If the number is between 11 to 30 and character is between D to R then print BETA rked out of る Flag question...
24 Dec 2022 by KarstenK
Please start with some Learn C tutorial to write and understand the language. What you have written isnt good in anyway. Take the advice from a seasoned coder: You will needs some hours to learn the basics or you will fail if you dont do it.
23 Dec 2022 by OriginalGriff
In C, "=" is an assignment operator, not a comparison. To compare values, you need to us "==" instead:if((a=1 && ac-10 && b='A' &&bes'C')) Becomes: if((a==1 && ac-10 && b=='A' &&bes'C')) ????? ?????? Quite what you meant...
21 Dec 2022 by dumbprogrammer00
A couple of days into OCaml and programming in general and I have faced a very difficult problem (at least for me) and it is about finding the largest digit of an integer. What I have tried: I tried the following: let rec maxi' x a = if x
21 Dec 2022 by Mr jaxån
You don't need a accumulator to collect your largest digit. But you still need to have the largest digit so far. So this can be done like this. You can create a local function max_digit' : int -> int -> int which is the recursive one. And you...
19 Dec 2022 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
18 Dec 2022 by Ranjit Roy 2022
Q.1- Write an algorithm each for TCP client and TCP server according to the following specification. .TCP server can handle maximum 3 clients concurrently. .TCP client will send a list of numbers to the server, after establishment of connection....
18 Dec 2022 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
8 Dec 2022 by Member 15753667
This is the error Main.java:1: error: class, interface, or enum expected Crytpo.java ^ 1 error This is the code Crytpo.java package encryptions; import java.io.IOException; import java.io.UnsupportedEncodingException; import...
8 Dec 2022 by OriginalGriff
Comment out the first line of your code. Change this: Crytpo.java package encryptions; To this: // Crytpo.java package encryptions;
8 Dec 2022 by Graeme_Grant
I did a quick Google Search and found a number of answers for you: java error: class, interface, or enum expected - Google Search[^] This looked like a good answer for you: How to resolve the "class interface or enum expected" error[^]
6 Nov 2022 by OriginalGriff
Think about how you would do it manually: you would look at each digit in turn and check it against the "Current largest value". If it was smaller, you would ignore it and move on to the next. Otherwise, it would become the "Current largest...
30 Oct 2022 by Gafar Edin
i have to write a program that i give a number of years and it to tell me how many months , days and hours are in that number of years. So i try this : #include int main() { float years , months, days , hours; scanf("%f", &years);...
30 Oct 2022 by Richard MacCutchan
This is the same issue as your previous question at Pls help I m new to C and I can t figure it out[^], and you were given the solution. Try to make more effort to read the error message and look carefully at your code. You are using a format...
30 Oct 2022 by Gafar Edin
so i have to write a program in C for my info class with 2 variables a and b that are lets say 1 and 5 and i must interchanged them in 5 and 1. so i wrote this program : int main() { double a, b; a = a - b; b = a + b; a = b - a; ...
30 Oct 2022 by OriginalGriff
The more normal way to swap them is to use a temporary variable: int a = 1; int b = 5; int tmp = a; a = b; b = tmp; This is a little safer when using floating point values as you can get distorted results due to imprecise arithmetic caused by the...
30 Oct 2022 by Richard MacCutchan
Yes because you have declared both a and b, but you have not given them any values. So change that line to: double a = 1; double b = 5;
27 Oct 2022 by Thaw Zin 2022
Write a Python program to read the name from Q2.txt(shorturl.at/BFZ25)and create email using domain 'gmail.com' and save the results as dictionary : {'name': 'name@gmail.com'}. Take note that your email should not include space or any special...
27 Oct 2022 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
27 Oct 2022 by Richard MacCutchan
Without seeing your code we cannot help you to correct it. So please use the Improve question link above, and add complete details of what is not working. You may also like to study 5. Data Structures — Python 3.10.8 documentation[^] for...
15 Oct 2022 by salam_verdim_alana_panyatkasi_olana
I'm new to programming language and when I share my problem on any website where people type comment to solution the problem, they were say that please share your stack trace and we can tell anything about your problem. I wonder how to read stack...
15 Oct 2022 by Greg Utas
A stack trace records what is currently on a thread's stack. The raw version of this just a hex dump. But if the required symbol information is available in the executable, the hex dump can be decrypted to show the function calls that lead from...
15 Oct 2022 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
15 Oct 2022 by merano99
Quote: How do I code the below C program? As you probably already know, all C programs always look the same at the beginning. #include int main() { return 0; } So the first half sentence "question is main function" is already done....
15 Oct 2022 by Richard MacCutchan
Sorry, this site does not provide code to order. You can ask your teacher for extra tuition, or re-read your course notes to get started.
6 Oct 2022 by Member 15784866
good evening! I have brushed up my old knowledge of assembly and I am close to the solution of this problem. I am going to sum two numbers. It works with one digit but it fails with two. I got lost again..if someone could help, I would really...
6 Oct 2022 by Member 15784866
Hi Dave! many thanks! unfortunately I couldn't see your code, is it somewhere here in this site? I saw your hint, MOV AX,@DATAMOV DS, AX, but my problem is in the loop..I am pretty sure but I still don't understand where exactly..
3 Oct 2022 by XPixxeliaGamingX
The project directions are as follows: USE INPUT.TXT FILE (#fstream) Implement the Merge Sort algorithm in C++. Requirement Input of the program: Unsorted list of integers separated by spaces; your program must read input file...
3 Oct 2022 by merano99
Variable dynamic arrays are not supported in C++. It would be more convenient and flexible to use a std::vector instead of the araay anyway, as CPallini had already pointed out. //First row having size of array //int arr[size]; std::vector...
3 Oct 2022 by CPallini
Quote: fin>>size; int arr[size]; You cannot do that in C++ (while, you can do that in C...). So you either dynamically allocate the array, e.g. int * arr = new int[size]; (then you MUST: check for memory allocation failure release the...
3 Oct 2022 by Michael Haephrati
Here are some problems I can see int arr[size]; 'size' isn't initilized and also must be a const. This line seems to be corrupted ="" fin="">>arr[i];
2 Oct 2022 by Member 15784866
Hello again, I am trying to read 2 one digit numbers and then sum them thorugh an assembly program. Thanks to you I am close to the end, but I still need to convert the chars into binary numbers..for this last reason , I found this code...can it...
2 Oct 2022 by Member 15784866
.MODEL SMALL .STACK 100H .DATA NUM1 DW ? NUM2 DW ? DOM1 DB 'digit the number: ',13, 10 , '$' DOM2 DB 'digit the other one: ',13, 10 , '$' RIS1 DB 'the sum: ', 13,10, '$' SOMMA DW ? .CODE .STARTUP MOV AX, @DATA MOV DS, AX MOV AH, 09H MOV DX,...
2 Oct 2022 by Richard MacCutchan
How many times must I point out: MOV AL, NUM1 MOV AL, NUM2 MOV SOMMA, AL Please read your code and think what it is supposed to be doing. The above code does not add two numbers together. And what follows is just random instructions.
2 Oct 2022 by Dave Kreskowiak
You're doing this all wrong. You're searching the internet for code that you think will do what you want when you should be thinking about the problem and looking at the data you're getting. Hint: What are the ASCII values of the characters...
2 Oct 2022 by Richard MacCutchan
Do you see something wrong here? MOV AL, NUM1 MOV AL, NUM2 MOV SOMMA, AL And at that point both NUM1 and NUM2 are characters, and not numeric values. So the first thing you need to do is convert each number to its integer equivalent. So...
2 Oct 2022 by Member 15784866
Good evening! thanks for reading. I wrote this short code, it should read and sum two one digit numbers and I used the simulator emu8086 but it doesn't work at all, would you tell me why? I would appreciate it a lot. Thanks in advance. What I...
1 Oct 2022 by Patrice T
Quote: How can I correct this code? Not a direct solutin, but advices: - use comments in code, it ease others to understand what you intend to do. And 1 year, it will ease your understanding of your own code. - Use debugger, it will show you...
20 Sep 2022 by Rick York
That scaling factor really doesn't help so I would drop it. You should use "%.5f" for a format string to get five decimal places. You used "%f" and that will give the default value of six. I would use doubles everywhere because it is more...
20 Sep 2022 by omar geda
Hello I have code from an assignment shady park. I have to find a binary search for an angle triangle in C. 4 10 25 0 1 2 3 8 3 10 1 70.346170 109.653830 Process returned 0 (0x0) execution time : 15.147 s Press any key to continue. 3 5 50 0 1...