Click here to Skip to main content
14,608,056 members

Comments by Greg Utas (Top 37 by date)

Greg Utas 26-Jul-20 15:58pm View
5 for citing a relevant article.
Greg Utas 26-Jul-20 15:42pm View
You need to pass user_in to your user_input function, the same as you pass it to your length_input function.

EDIT: Most (or all) of the errors that you get when compiling are because user_input is returning a char, which you then try to assign to a char array.
Greg Utas 26-Jul-20 7:17am View
It was actually submitted before the previous response, or at about the same time, and then edited. You've got some serious issues, bud.

EDIT: You didn't like the previous response either, so it makes no difference. I notice you didn't downvote OG's canned response, troll.
Greg Utas 14-Jul-20 14:12pm View
5. You're more observant than me, who failed to notice that those are in the "hello" function!

This would certainly cause it, and anyone doing this probably has lots of other bugs too.
Greg Utas 8-Jul-20 12:54pm View
I know nothing of the framework you're using, but it looks like each of these things being cast as a HWND could be added to a vector when created, so that you could run through the vector and close them later.
Greg Utas 5-Jul-20 16:04pm View
But then how does the _first_ user log in?! :)
Greg Utas 20-Jun-20 18:31pm View
Thus my suggestion :)
Greg Utas 20-Jun-20 14:51pm View
Before doing anything, buy a laxative for whoever wrote these specifications.
Greg Utas 11-Jun-20 7:04am View
I have no experience with C#, but with winsock2.h (C/C++) you have to call WSAStartup before doing any network stuff. Is something similar required in C#?
Greg Utas 7-Jun-20 13:51pm View
Even if it were properly formatted, that code would still be crap. That final printf is a clue, but I'm not sure I believe it. For one thing, j is a write-only variable.
Greg Utas 7-Jun-20 8:40am View
I don't think you've even entered your entire homework assignment. It should start with a specification of what the program is supposed to do, not which C++ language features it's supposed to use. Without a specification, you have to make one up yourself, and no two students will end up even trying to solve the same problem.
Greg Utas 31-May-20 13:11pm View
You're welcome.
Greg Utas 29-May-20 18:42pm View
Maybe someone else can help you with this. I've never used MFC because a console application is more appropriate for what I do. I did make note of an interesting post, however, that mentioned a GUI library that is multi-platform. I have no experience with it, but perhaps it would be of help:

Edit: Unless you're locked into VS2010 for your job or something, I hope you realize that you can download the "Community" edition of VS2019 or VS2017 (which is what I'm using, if you can still find it). It's free and better than VS2010.
Greg Utas 25-May-20 7:58am View
I've never done it. You need to decide which MIDI application is best for you and take it from there. For example, I have Sibelius, which is primarily for sheet music but also handles MIDI. And I have external synthesizers. But I've never felt the need to generate a .wav from MIDI.

Well, I did an online search, and this was the first thing that came up:
Greg Utas 21-May-20 17:12pm View
Sometimes I say things that are too black & white. :)

There are probably servers that use GC, but it can be risky. I would use C++ for a serious server, and it doesn't have GC. There's little difference between clearing a reference and also freeing the underlying memory without waiting for GC. When someone forgets to clear a reference or delete an object, ideally you want to detect the memory leak and correct it. I've written an article, Robust C++: Object Pools, about how to do this in C++. But I don't think what it describes could be done in Java.
Greg Utas 21-May-20 14:54pm View
Yes, GC uses CPU time, and usually more if the system is busy. So you're right, it affects latency. Which is why serious servers don't use it. But there's little you can do about it.
Greg Utas 21-May-20 10:29am View
Right! Not sure what I was thinking.
Greg Utas 20-May-20 20:12pm View
Yes, the heap will look like a sawtooth wave because of garbage collection.

If there is CPU time to spare on the server, then how could there be a bottleneck? The exception would be a server that is, say, disk-bound, waiting for disk reads (of images, for example) to complete.
Greg Utas 20-May-20 10:57am View
while (i < arr.Count)

Or switch to C/C++, which doesn't enforce array boundaries! /sarc
Greg Utas 30-Apr-20 6:25am View
An undertaking of very dubious value. 99% of the time it's more useful to convert C (or poor C++) into good C++.
Greg Utas 25-Apr-20 11:46am View
I don't actually use Java, but it looked enough like C++ that I thought I could answer. If the index is random, then I assume it would sometimes be out of bounds, in which case I believe Java would raise an exception. Is this what happens? Also, if you've changed that line of code, please include the new version.
Greg Utas 24-Apr-20 12:36pm View
Yes, I came back to look at it again after I recalled the 1+ and realized it was fishy. But by that time, OriginalGriff had sorted it out, so I didn't bother to change my solution.
Greg Utas 17-Apr-20 6:57am View
[Deleted and posted as a solution.]
Greg Utas 12-Apr-20 12:00pm View
Greg Utas 11-Apr-20 6:50am View
I forgot to mention making int3 a member of a class, which is another way to fix this. I also added some notes about when to use each approach.
Greg Utas 10-Apr-20 7:35am View
Seriously? You're assigning to my_tree again, even though it's been clearly pointed out that insert returns nothing?
Greg Utas 2-Apr-20 13:53pm View
You just have to flip everything: + becomes - and vice versa, ++ becomes -- and vice versa, -1 becomes SIZE and vice versa...
Greg Utas 31-Mar-20 13:24pm View
I've never used it. I looked at it and closed my browser page while retching.
Greg Utas 27-Mar-20 13:45pm View
I own this book (the first edition, so probably a bit dated) and agree that it's good.
Greg Utas 27-Mar-20 8:55am View
Having only one DLL for this could be a design flaw because it can't support multilingual installations. If you're delivering a single-user application, this may be OK, but even then you've run into a situation where it's causing an issue.
Greg Utas 19-Mar-20 8:57am View
Unfortunately, I have no experience with WinMain and the other Windows-specific stuff in your code. And your code is neither formatted nor commented, so I doubt anyone will want to spend much time looking at it. It seems that both are similar, so I suggest that you step through each of them, line by line, with a debugger, to see where they behave differently.
Greg Utas 16-Mar-20 19:25pm View
I have neither, and I can't help beyond what I've said. You need to find the complete source code for this.
Greg Utas 16-Mar-20 15:44pm View
It won't work *anywhere* until the missing function is provided. There's nothing wrong with VS2017. It's free and I use it for over 200K lines of code.
Greg Utas 4-Mar-20 7:15am View
If it's a server, it will create a socket per client. That's OK until it enters overload, at which point it should start to reject TCP connections. But *one* thread can service *all* of the IP port's sockets, listening for connection requests and polling (WSAPoll on Windows) the client sockets for incoming data.
Greg Utas 4-Mar-20 7:15am View
[Deleted and resubmitted as a reply to the previous comment.]
Greg Utas 3-Mar-20 12:03pm View
I missed that! I just saw the accept() and didn't look further. Goodness, any tutorial that creates a thread per TCP socket knows nothing about building a scalable server.
Greg Utas 9-Nov-19 8:11am View
This isn't a forum for spoon feeding you.