Click here to Skip to main content
15,170,331 members

Comments by JackDingler (Top 200 by date)

JackDingler 29-Mar-15 13:05pm View
Thank you for that link Richard.
JackDingler 29-Mar-15 12:51pm View
I was able to get past that error with a bit more code. I have updated the example.

Poco's exception handling could use a bit more information. Throwing generic exceptions on bad pointers in their own code, isn't very helpful.
JackDingler 10-Oct-13 10:43am View
You might want to look into the ZModem Protocol. It was designed for slow connection speeds. Source code should be available on the net with a bit of searching. It should be possible to modify it to be a streaming protocol.
JackDingler 10-Oct-13 10:26am View
You might want to look into the ZModem Protocol.

It was designed for slow connection speeds.
Source code should be available on the net with a bit of searching.

It should be possible to modify it to be a streaming protocol.
JackDingler 9-Oct-13 15:52pm View
This is correct.

Further wave files have a number of settings that effect the number of channels, and quality of the data. The higher the quality, the larger the byte size of the wave file.

The encoding of the wav file makes a difference also. PCM files tend to be the largest, but are also lossless.

Lossy encodings, like mp3 files, sacrifice fidelity for file size.

So before you can even begin answer your question, you need to define what level of fidelity you need.
JackDingler 14-Aug-13 11:39am View
You won't learn anything if we do it for you.
JackDingler 14-Aug-13 11:01am View
JackDingler 26-Jul-13 16:04pm View
BitBlt is well documented. you just need a DC and a bitmap.

MFC sits on top of the SDK and simply provide a class structure to manipulate the SDK. The SDK isn't going away. If people want to use it, everything they need is there, so long as it's something that Microsoft thought to support.
JackDingler 25-Jul-13 16:41pm View
Alpha Blitting might work also.
JackDingler 25-Jul-13 16:40pm View
That does sound right though.
JackDingler 25-Jul-13 16:36pm View
It's been too long since I've done straight SDK programming in windows.
I've only been doing MFC these past eight years or so.
I'm probably not the one to be asking.
JackDingler 25-Jul-13 15:47pm View
My suggestion on MFC is to see if you can find an example that does something close to what you want, then follow the code path for that draw code and implement your version of it.

Professionals Steal
Amateurs Borrow
JackDingler 25-Jul-13 15:45pm View
I honestly don't know if what you want, is possible with the Microsoft Tree Control.

But yes, the custom draw is likely the way to go. I've had difficulties in overriding the tree control behavior in the past and came close to just writing my own control.
JackDingler 25-Jul-13 11:56am View
Microsoft has a MS Office SDK for this purpose. It's a free download.

I have never used it though....
JackDingler 25-Jul-13 9:59am View
You'll probably have to deconstruct an MFC solution then.

Developers who do this kind of work for a living, mostly avoid raw SDK programming for controls. It's costly, in that it takes more time to develop, and is difficult to maintain. I'm sure there are exceptions to this rule, but I haven't met anyone who chooses to develop overloaded controls at the SDK level in many years.
JackDingler 18-Jul-13 15:44pm View
Have you tried Google? There are many excellent examples on the web. Far better than anything I have time to write for you.

You're stuck on a very basic problem. You have quite a bit research and education ahead of you.
If you're in school and this is a homework assignment, go back over the material your instructor has provided. Ask questions of your instructor and teacher's aides.
JackDingler 15-Jul-13 14:00pm View
Thank you very much. My 5. :)
JackDingler 11-Jul-13 10:36am View
I think I solved the mystery, what likely happened is that I had changed the class to a virtual, and then reverted the change, but the project make didn't update the library on the revert.
JackDingler 11-Jul-13 9:17am View
No there is a destructor.

The class definition says it's non-virtual. The exported function in the DLL is clearly marked as non-virtual.

But the calling application is looking for a virtual destructor and not finding it.

What surprised me is that it didn't produce a link time error. I'll check the lib file and see if it differs from the DLL.
JackDingler 10-Jul-13 16:47pm View
I may try a code sample this evening. Should be easy to reproduce.

I'm in the habit of making destructors virtual by default.
In this case I'm porting legacy code.
JackDingler 3-Jul-13 16:25pm View
Good advice.

If you can break the problem down into chunks, then you'll see fewer problems and a large speed increase. Also, if the data set grows larger, then your code is likely to break down again.
JackDingler 2-Jul-13 15:48pm View
What did you learn?

Where does the exception occur?
Have you turned on all run-time checks?
JackDingler 2-Jul-13 15:18pm View
Have you tried stepping through the code with the debugger?
JackDingler 2-Jul-13 15:11pm View
A fundamental skill of development is being proficient in using a debugger.

Those pop commands are suspect BTW. What happens when you call pop and you have no data?
What happens when you call pop() and top is -1?
JackDingler 2-Jul-13 12:31pm View
memcpy() doesn't care what the data means.

It simply copies a range of bytes from one location to another.
JackDingler 1-Jul-13 22:09pm View
Another way to write my formula is:

auto newSize = ((((size - 1) / 16) + 1) * 16);
JackDingler 1-Jul-13 22:06pm View
Slower though with a multiply and a divide.
Memory pools tend to be about speed.
JackDingler 1-Jul-13 16:56pm View

Look at CP/M or DOS. Both are valid examples of operating systems, and they are teensy tiny compared to today's mainstream OS's.
JackDingler 1-Jul-13 16:37pm View
BTW, you'll see multiple object pools in a lot of gaming code.
It's a common strategy.
JackDingler 1-Jul-13 15:50pm View
Would the person who voted '1' on this solution provide a reason please, so that I can improve my responses in the future?
JackDingler 27-Jun-13 14:58pm View
It's shorthand for the power function.
JackDingler 26-Jun-13 16:47pm View
msxml6.dll is not a source file. It shouldn't be in your project.

Include the proper lib file that goes with it in your linker settings.
JackDingler 25-Jun-13 16:03pm View
Don't use values that cause crashes or produce painting artifacts.

If you want to use values that the Microsoft Developers didn't write supporting code for, then you may have to enhance the CSplitterWnd class. Microsoft provides source code for the MFC library so that you may create your own custom versions of the MFC classes.
JackDingler 24-Jun-13 8:43am View
That's only a megabyte. So this solution is fine, as is using std::string as mentioned by others.

IF you have some big hardware and need many of these strings, then go 64bit.
JackDingler 24-Jun-13 8:38am View
Is there no chance that your co can put the server on a local VM for you for testing? Is that possible in your environment?
JackDingler 24-Jun-13 8:38am View
Time to start adding try/catch blocks and attempt to log where the exception is raised?

What do your event logs look like? Any clues there?
JackDingler 24-Jun-13 8:36am View
Your database structure and your tree structure don't have to be the same.

In memory when I have many kinds of data to display in a tree, I create a common base class that has a typedef to tell which derived class type it is. Then I can have a different set of data referenced each item in the tree.

Your database layout is going to be determined by the kind of records you need to store and look up.

In both case, make your records and your field names represent what kind of data they contain. Try not to use terms like 'SubItem'. If SubItem refers to Salary, name it Salary.

Finally, don't do direct look ups into the database by table names. Create views, and have all of the look ups use views. If you do this, you don't paint yourself into a corner with your table structures. You'll be able to change them as your understanding of the data improves, without breaking code that you have no control over. You'll simply need to adjust the view to reference the new location for the data.
JackDingler 21-Jun-13 16:21pm View
You might consider piggybacking a more rudimentary logging system to watch your logger. At least until you isolate the issue. Create one that uses only simple file services to log info to a file. This should function no matter the state of initialization of the app, as the base C library is initialized before main().

As I think you know, you're probably getting an exception thrown at some point. Create a macro that calls your logging function with __FILE__, __LINE__, __FUNCTION__ and place this at the start of every function in your logger.

Then after it's run and failed, you should see the last successful function to run. This may give you a clue as to what's going on.

you should be able to use fopen and fprintf but be sure and call fflush after each entry is logged.
JackDingler 21-Jun-13 15:21pm View
Have you tried
JackDingler 21-Jun-13 15:15pm View
I rarely ever find a source example on the internet, is already a complete solution to a problem I have.

Actually I'm not sure it's ever happened...

I don't know what you mean by 'not completely re-usable code'. Do you mean there's a licensing issue?

If you have the time, writing one from scratch is a great way to learn how to put such controls together. I think you'll enjoy the challenge. :)
JackDingler 21-Jun-13 10:40am View
That was my point. During initialization, your service may not have the libraries needed to support this call.

I don't know what's in you log class, what dependencies it has. But it sounds like it might be failing because it's trying to make a call to a service that isn't available yet.

You could try a two tiered initialization. Have it log using basic WIN32 functions until your app is fully initialized, then initialize and use your more complex logging functions.

Is there no way to use your logging functions in a simpler application that you can test and debug?
JackDingler 20-Jun-13 15:07pm View
When does your first call to the class occur?

Perhaps it is being called before dependent libraries are loaded?
JackDingler 20-Jun-13 14:38pm View
That explanation helps me understand what you're asking.

To create or a destroy a class from code that isn't a friend or member of a class, you need a public constructor and destructor.

You can create and destroy a class with private or protected constructors and destructor from a static method in the class. In the case of a protected constructor / destructor, a freiend of the class or a derived class can instantiate it.
JackDingler 20-Jun-13 13:48pm View
Your question is so broad, that you need long winded explanation to answer it.
JackDingler 20-Jun-13 11:58am View
I did a bit of googling on glReadPixels() and that seems to be the way to go.

I also saw that GL_BGR(A) tends to be faster on windows machines than GL_(A)RGB...

When you call glReadPixels() you're asking the CPU to copy memory from the graphics card to your machine's RAM. This will take time.

A suggestion I saw a number of times for applications needing a high framerate is to double buffer so that you're rendering on one FBO and copying to the CPU from another. With each operation you swap FBOs.

If you need even faster performance, perhaps using NVidia Hardware and CUDA could be your solution. In CUDA, your CPU and Graphics card share memory, so there's no need to copy across the bus, to another memory region on read.

JackDingler 20-Jun-13 10:12am View
Take a look at glFramebufferTexture()

This should allow you to map a texture in memory to the framebuffer. This eliminates the need for glReadPixels()

I haven't done this in a while, but I believe this is the right approach.
JackDingler 19-Jun-13 13:20pm View
I updated the solution for you.
JackDingler 18-Jun-13 10:34am View
Right. Your error is that you're using windows.

If you must use an obsolete compiler and libraries, then use the proper obsolete environment.

Try DOSBox
JackDingler 13-Jun-13 16:59pm View
That's good performance for GDI.
JackDingler 11-Jun-13 15:04pm View
You have to be sure that your code draws after each frame, before the frame is blitted to the DC. i don't know specifically how to do this in DirectX, but there should be a call that allows you to hook into the frame for post processing.
JackDingler 11-Jun-13 10:57am View
Alas I don't have any samples at this time. They all stayed with previous employers...

I suggest you try for #2, I believe it's the better solution.
Code for displaying objects on a memory DC with a bitmap selected are common.
You'll want to make your drawing functions a bit configurable so that they go to the DC you specify. This will allow you to get a visual representation of your ID map for testing. It's useful to see the map on demand, to determine if there are artifacts that are being drawn, that you don't want to select.

You may pass a renderoptions class (you define it) to your draw functions so that they can change behavior according to what sort of surface they are drawing to.
JackDingler 11-Jun-13 9:48am View
But you're right, I posted in haste, didn't read your response carefully.

I see more coffee in my immediate future.
JackDingler 11-Jun-13 9:48am View
That's what I said.
JackDingler 11-Jun-13 9:37am View
I agree. If it's a requirement, then you're stuck with it...

Otherwise, there are other open source solutions that fit the bill.

pugixml has done the job for me.
JackDingler 11-Jun-13 9:28am View
No, the first step is to research the API between the two systems and determine how the two can and should be connected.

The language is a just a tool for performing this operation. The APIs or lack thereof, can help determine what language or languages will suit your solution best.
JackDingler 6-Jun-13 10:37am View
It works with domain users.

I've used this to access and modify remote registry settings, for computers on a domain.
JackDingler 24-May-13 15:15pm View
Somewhere, some code has to do some looping to do what you want.

You can move the code around, but it will still be there.

Depending on your compiler and environment, you could do a for_each or BOOST_FOR_EACH. This is another way to loop...
JackDingler 24-May-13 15:10pm View
Your comment fits the symptoms. I was going to suggest something similar...
JackDingler 24-May-13 14:13pm View
There is more than one way to do this.

Some vendors may modify the RC file and then link the exe.

Others may provide a configuration file with that data.
This could be a resource DLL that is built specifically for this purpose, or simply a data file.
This is the most common way to do this.

Then the one we don't see much....
Finally, in theory you can modify the resources in an EXE after it's been linked, but you'll need to recalculate the checksum, so that the OS doesn't think it's corrupted.

I don't know how to modify the exe in this manner. No one has yet paid me to figure it out. It's rare than anyone bothers. Google may be your best bet.
JackDingler 24-May-13 13:38pm View
A running application can't modify it's own executable.
It's not allowed. You can't do what you want. It's not gonna happen.

Why not modify data files or the registry instead?
Or as part of your build process, modify the the resources loaded by your exe?
JackDingler 24-May-13 12:28pm View
You can't open a running executable.

Here's a good place to start if your goal is to update the taskbar icon.
JackDingler 23-May-13 15:12pm View
They never change until requirements change...
Then they change. But until they change, they don't change....

This is why the Microsoft API contains fixed length structures with a size member for versioning, because the the API needs to be backwards compatible with older applications.
JackDingler 23-May-13 12:10pm View
Never change their size? Like fixed length DBF records?

I've been down the rabbit hole of maintaining fixed length records in file formats. Adding additional fields and playing games with fitting multiple structure types into the same record length, leads to difficult to maintain code.

So my advice is the same, don't use them unless you have a good reason to.

DBF files are a good implementation of fixed length records, that are defined in a file header.
JackDingler 23-May-13 11:44am View
They could start as fixed length, then be difficult to maintain later.
JackDingler 23-May-13 11:14am View
These days you may never need to worry about other compiler implementations. Hardware and software is becoming increasingly standardized and converging into common paths.

The two dominant compilers adhere well to the standards, and work with a wide variety of platforms. There's little need now to roll out odd flavors of compilers.
JackDingler 23-May-13 11:09am View
It doesn't work that way though. There are no secret or hidden members in a class that you have to worry about. Links per instantiation of the class are unnecessary.

Any virtual tables will likely get a decorated name, and be accessible behind the scenes as globals.
JackDingler 23-May-13 10:50am View
You mentioned that if the record length is variable, to do this.
I think it's a good idea regardless, because even fixed length records may need updating later.
JackDingler 22-May-13 17:02pm View
It's a good idea to mark the beginning of the record with the size, and some code to describe the record type.

A header record at the beginning with some basic info and a padded reserved area is a good idea too.

You'll be glad later that you did these things.
JackDingler 21-May-13 13:42pm View
Though some flavor of C++ may be an exception....
Virtual function tables aren't cloned with every instantiation of the class. they exist outside of the class, so modifying the class contents will not destroy these tables.

That said, don't use memset to initialize objects...
JackDingler 21-May-13 13:34pm View
You can do this as was described in Solution 1. And it looks cool and nifty on the surface.

But it can lead to difficult to debug problems down the line. Especially if you start adding additional typecast operators.

You're better off writing descriptive methods to get those values, rather than using overloaded operators.
JackDingler 15-Apr-13 17:38pm View
White Hats don't do this.

This is anti-White Hat.
JackDingler 24-Jan-13 13:53pm View
What do you get when you call GetWindowText, afterwards?
JackDingler 24-Jan-13 13:52pm View
So does your dialog get a paint message after you set the window text?

If it doesn't, your change may be taking place. You just can't see it.
JackDingler 24-Jan-13 13:46pm View
Are you invalidating and repainting the dialog at any time?
JackDingler 15-Jan-13 13:05pm View
My expertise is in C++ and OpenGL...

What I can tell you is that the old GDI and GDI+ has performance issues Window Vista, 7 and 8. The drawing code was elevated to the application level, resulting in a significant performance loss.

DirectX and OpenGL are hardware accelerated will not suffer from these issues.

I recommend that you check out DirectX2D for your application.
JackDingler 15-Jan-13 12:23pm View
From a performance standpoint, there's little difference in performance between the languages when it comes to graphics. It's the graphics engine that you connect to that tends to be the constraining factor.

Which are you more comfortable with?
JackDingler 15-Jan-13 12:19pm View
You're updating your question as a solution to your question....
JackDingler 14-Jan-13 13:36pm View
CPallini is right. There are too many pieces involved to provide any quick answers.

From my perspective, it appears that you've decided how you're going to architect a solution, before you've identified the problem you are solving.

Digital communication over analog channels is certainly possible, but you're adding complexity and overhead for no good reason.
JackDingler 14-Jan-13 13:23pm View
Good luck, let us know if you get stuck on any particular programming issue.
JackDingler 10-Jan-13 17:23pm View
A char is simply an 8 bit int.
Or one byte...
JackDingler 10-Jan-13 11:07am View
That questions has been answered.

Not all of them do. But those that contain COM objects or .Net assemblies do, because they publish object GUIDs into the registry so that applications can find them w/o knowing beforehand, the DLL file name or path.
JackDingler 9-Jan-13 17:20pm View
Research 'decals'. Its a technique for overlaying one texture on top of another. It has been developed to do exactly what you want.

There's no quick answer for this, but it's a common technique and many articles have been written on it.
JackDingler 9-Jan-13 15:14pm View
That's essentially it.

the technology you're looking for is called, 'decals'.
JackDingler 8-Jan-13 15:36pm View
The work around is easy. Delete the junk code...
JackDingler 8-Jan-13 15:18pm View
It'll likely be a service pack.

Version one of each Visual Studio edition has always been a bit buggy. they iron these out with a SP quickly enough.
JackDingler 8-Jan-13 15:16pm View
That should work.
JackDingler 8-Jan-13 14:42pm View
Jochen is right. These devices are controlled by multiple drivers. A different driver for each function.

You'll need to iterate these different driver types separately.
JackDingler 8-Jan-13 14:37pm View
The class wizard does a lot more than just generate simple class definitions. It's a real time saver in Windows GUI projects.
JackDingler 11-Dec-12 11:19am View
I think the constructor has been covered well.

You have a problem with the destructor though. You need to make it virtual if you want it to get called.

Constructors are effectively virtual by default...
JackDingler 11-Dec-12 11:10am View
Your question is unclear, but I think you're looking for Windows Shell Extensions.

It's an advanced topic, you'll need to do some studying.
JackDingler 10-Dec-12 16:06pm View
you don't need t he CArchive to keep a runtime copy of your data. You simply need to have your data in your doc class.

In your view, access the doc, and display the data it stores.

The serialization method is used to save and load your drawing from a file.
JackDingler 10-Dec-12 12:53pm View
You keep making the same comments over and over, and the answers will be the same.

You need to keep a list of the lines you wish to draw. There is no magic going on in the background that reads your mind to figure out what to draw and what not to draw.

When you call an Invalidate(FALSE), you're simply triggering a paint w/o a background erase. When you resize, a background erase occurs automatically.

In your OnDraw / OnPaint, you need to walk through your list of lines and draw each one. Your mouse functions should simply update your list of lines.
JackDingler 4-Dec-12 16:23pm View
Which line is it failing on?

Are you crossing DLL boundaries?
JackDingler 3-Dec-12 12:57pm View
Another way to approach this is to disable the OK button on start up and evaluate the values with every key entry. When the values satisfy the condition enable the button, when they don't, disable it.
JackDingler 3-Dec-12 11:41am View
What have you tried?
JackDingler 28-Nov-12 17:03pm View
The print preview, is just a viewer that shows the user what the final print will resemble.

Viewing, print previewing and printing are operations with a number of common steps.
JackDingler 28-Nov-12 16:53pm View
Good to know.
JackDingler 22-Nov-12 11:26am View
Can't you just add your offsets to x,y?
JackDingler 22-Nov-12 11:24am View
Glut redraws the window completely with every pass.

So anything you want displayed in the mainWin needs to be drawn in mainDisplay().
JackDingler 21-Nov-12 18:04pm View
Perhaps you're right and the text is on the window for 0.0000msecs before being erased to call your drawing functions.

Are you watching very carefully?

Or are you expecting the text to remain after Glut erases the window?
JackDingler 21-Nov-12 16:51pm View
I wonder if he's asking for program code or protein coding?
JackDingler 21-Nov-12 16:18pm View
You've cued up the creation.

Glut does additional initialization in glutMainLoop().

One of the first things it will do is erase the window. and if your text was displayed, it's gone when you make that call.
JackDingler 21-Nov-12 15:45pm View
You're doing it wrong.

You're trying to send stuff to the window, before glut has created the window.
JackDingler 21-Nov-12 15:43pm View
Yes, you want to use it in an unsupported manner.

You'll have to get the source code for glut. Modify it to support what you're doing and provide your special modification to anyone who wishes to use your code.

It's going to take a bit of work and effort on your part, to make glut work this way.
JackDingler 21-Nov-12 15:28pm View
I see what rswapna28531 was getting at.

You shouldn't be writing to the OpenGL in main() when you're specifying display functions.
JackDingler 21-Nov-12 15:16pm View
Right. In your code, you check to see if the they guessed the right letter. If they got a letter correct, you tell them that this letter has already been used.

You need a separate buffer for used letters.

Walk through this with the debugger, and see what is going on with your program flow. the debugger is your best friend in figuring out any logical flaws in your code.

I am about to become unavailable. I may or may not respond to further questions during the T-Day Holiday.
JackDingler 21-Nov-12 14:44pm View
Experiment with the code. You'll learn from it.
JackDingler 21-Nov-12 14:43pm View
Give it a try. :)
JackDingler 21-Nov-12 14:39pm View
Yes, and 'spaces' remains unchanged.
JackDingler 21-Nov-12 14:34pm View
Further, you're incrementing 'i' inside the loop, when the for statement also has an increment.

Take out the inner increment.
JackDingler 21-Nov-12 14:33pm View
See this snippet?

if(symb == word[i])
word[i] = symb;

Do see what's wrong with it?
JackDingler 21-Nov-12 14:21pm View
Also, create a separate array for used letters. Try not to reuse variables for multiple purposes. It makes the code muddied and hard to understand.
JackDingler 21-Nov-12 14:19pm View
You're still defining 'letters' as 5, and 'length' as 6, meaning you're writing to a mystery memory location when you do this,'word[length] = 0;'

Make 'letters' bigger. Perhaps 80 is a good value?
JackDingler 21-Nov-12 14:10pm View
That seems like an advanced topic for a beginning/student programmer...

Are there only 26 ways to do this? :)
JackDingler 21-Nov-12 14:06pm View
You can use 'Improve Question' to update your original question and add formatted code there.

I have some suggestions.
1. Make your buffers bigger. I don't know what the value for 'length' is, but I suspect it's writing past the end of the buffer that you allocated.
2. Create a third buffer for the results. Don't change the values of your static data.
3. Though you are trying to null terminate your output, you're assigning the terminating character to the wrong array, 'word[length] = 0;'
JackDingler 21-Nov-12 13:39pm View
Please show your relevant code.
JackDingler 21-Nov-12 13:26pm View

I assumed he was referring to the 22 standard amino acids and has an assignment to compare arrays with these values coded in some form.

Clearly we need more information.
JackDingler 21-Nov-12 13:14pm View
There is no specification for coding proteins in the C language.

This question does not have enough information to form an answer from.
JackDingler 21-Nov-12 13:11pm View
Right, you told it not to display text in the main window when you called glutSetWindow.

It's doing exactly what you told it to do.
JackDingler 21-Nov-12 11:16am View
Those aren't really distinct data types. Just typedefs to overload the types for compatibility purposes.

The intent is, if you use those types then your code will compile without errors in both 32 bit and 64 bit modes.
JackDingler 21-Nov-12 11:09am View
I don't know what OS you're using. Perhaps windows 98?

Can I assume you're writing code using a 32 bit compiler? By default, 32 bit pointers can address a maximum of 2gb of memory. This leaves one bit for housekeeping. Some linkers have an option to expand this to 4gb.

Still, if you only have 4gb, your program is unlikely to be able to lock it all for one program, as the OS and other services will need memory too.
JackDingler 21-Nov-12 9:42am View
The translation is a matter of specifying where you want the image drawn. It's the X,Y coordinates you specify on the destination DC.

The only rotation I see in the current library, rotates the image in 90 degree increments. Is there another function for this?

JackDingler 20-Nov-12 12:15pm View
Nice misleading title.

You have a future in spam authoring...
JackDingler 20-Nov-12 12:13pm View
My 5!
JackDingler 20-Nov-12 12:13pm View
My 5!
JackDingler 20-Nov-12 11:07am View
That modifies the image. It looked to me like the question was on drawing the image at arbitrary rotations and coordinates.

Is there a way with GDI+ to rotate an image 15 degrees and offset it by (30, 40) for display?
JackDingler 20-Nov-12 8:43am View
The table I looked it up in, and don't have it handy now, explained that strchr() is available in both Java and C++.

I'm not a Java programmer, though I've debugged quite a bit of Java code.

Do you know how to do a google search on strchr? If this isn't a homework assignment, it's the better way to do this.

If this is a homework assignment, then you should consult with your instructor, mentor or teacher's aid for help on this.
JackDingler 19-Nov-12 11:53am View
pthreads tend to be more heavily used in Linux where processes are light and threads are heavy.

In windows, it's the opposite. Processes are heavy and threads are light.

Use CreateThread() in windows.
JackDingler 17-Nov-12 22:38pm View
8 bit could be faster than 24 bit. It does take up a much smaller memory foot print. Graphics cards have long had native support for color palettes.

It's common in applications to build a second 'copy' of data for visual presentation.
JackDingler 12-Nov-12 17:38pm View
The answer is both yes and no, depending on what kind of data is in the file.

Consider this question...
"I'm thinking of an animal. I would like to keep it in a shoebox, can I do this?"

How would you answer such a question?
JackDingler 9-Nov-12 16:07pm View
Are you just having trouble implementing 128 bit integers?
JackDingler 2-Nov-12 10:08am View
If you really, really need to do this processing in memory... Perhaps for real time simulations?

Build in 64 bit mode and run on a 64 bit system with at least 16gigabytes of RAM.

Also you may consider changing you memory structures from a linked list, to to fixed records that have many elements on each record. This will reduce memory usage per element as you won't need one or two pointers for each integer.
JackDingler 1-Nov-12 16:41pm View
See my comment just above to learn how to do it.
JackDingler 1-Nov-12 16:10pm View
The CMainFrame shouldn't be used as a miscellaneous bin to put all of your global variables in.

And you do not want threads directly accessing your CMainFrame. If you don't lock it properly and intercept every message path that may cause a problem, your application will suffer from mystery crashes.

If you enable locking, you run a risk of seeing severe performance problems in message handling and possible freezing up in the case of race conditions.

CMainFrame has plenty to do in maintaining your main window. Don't give it a bunch of unrelated tasks to manage. Build other classes to take on this role.
JackDingler 1-Nov-12 16:05pm View
You can access your CMainFrame from a thread, though it's a bad idea and you shouldn't do it.

You shouldn't be accessing globals at all without a locking mechanism, unless you know for a fact that they will never change.

CMainFrame * pMainFrame = (CMainFrame *) AfxGetMainWnd();
JackDingler 1-Nov-12 14:32pm View
Change your algorithm.

There is nothing wrong with the data types. Your code is not making efficient use of memory.

See this article for an example of a creative way to work with large numbers of integers with very little memory usage.
JackDingler 1-Nov-12 14:06pm View
Nice sock puppet. Did you make it yourself?
JackDingler 1-Nov-12 13:52pm View
Perhaps you want to create a custom font and apply that?
JackDingler 1-Nov-12 13:49pm View
Yes, you should write some code for that algorithm.

Feel free to ask if you have specific questions regarding C/C++.
JackDingler 24-Oct-12 14:26pm View
Try defining better, what you're trying to accomplish.
You might start with...

Are you trying to manage how windows controls the connection?
Are you trying to right code that provides the sharing?
Are you writing a firewall?
Or is it something else?
JackDingler 23-Oct-12 16:48pm View
I don't know what you mean by, "this does not seem to work properly". Stream operators work just fine in threads.

Allocating pthread memory is a bit complicated.
Look up semaphores, events, multithreaded queues, thread locking etc...

When you create a thread, you can pass it a (void *). Pass the class instance here, and you can associate one class for each thread. Then in your thread, cast that (void *) back to the class type and call methods in the class.
JackDingler 23-Oct-12 15:57pm View
You can call Vector.clear() to erase all of the elements.
Vector.reserve(size_t) will attempt to change the allocated size of the vector, without changing the number of elements, unless the number of elements is greater than the new size.
JackDingler 22-Oct-12 15:36pm View
Nice work. :)
JackDingler 19-Oct-12 10:48am View
I have clients who call in almost every day expressing concerned that the CPU utilization remains at about 50% on their servers. I tell them it's because they are working at processing records, which leads to revenue... It's a good thing.

They want to know how to bring the load down... I'm tempted to say, close your doors, don't let clients in.

JackDingler 18-Oct-12 15:26pm View
Reading binary files is not necessarily a CPU intensive task. but in this case the I/O is buffered, so there is some background copying going on.
JackDingler 15-Oct-12 17:32pm View
I agree with Sergey, breaking this down into manageable functions is likely to make it easier to see the error.

Further, put your variables in a class definition, and use methods to instantiate them from the constructor. This is a riff off his question about C/C++.

Refactoring code is a valid way to find logical errors in complex functions. Assuming you're making the code easier to read and understand.
JackDingler 8-Oct-12 16:24pm View
Looks like fun. Thanks for letting us know about the project you're going to do by yourself!

I know my life was improved by looking through all that and trying to find the coding question that wasn't there!

Let us know when you have a coding question!
JackDingler 8-Oct-12 16:13pm View
I registered with a couple of those bid for a job sort of sites to see what was out there. I'm seeing a trend now in requests. It's along the lines of, "My code is too complicated and does not work. I need someone to fix it for me. Max bid $12.00".

Member 9495218 will be making those postings in the near future, if he's able to BS his way past an interview.
JackDingler 5-Oct-12 9:11am View
I'm gonna call BS on this, as the last projects I did this with were huge, complex had many features that never should've gone into a properly written GUI application.

I don't have your code, nor am I familiar with it, so I can't identify what you're doing that is incompatible with the Feature Pack. In the projects I ported, these things only became obvious during the merge, when my newly merged code quit functioning.

The structure of your project files may have some issues, and your manifests. You might compare those against an MFC Wizard produced project.

JackDingler 4-Oct-12 13:34pm View
I've written a couple of chord generators. These are fun projects and can teach you a bit.

This sounds very simple. Have fun.
JackDingler 2-Oct-12 15:23pm View
The Windows Server Active Directory is not a filesystem. You cannot save files there.
JackDingler 2-Oct-12 15:14pm View
I'm not sure what you're saying.

I'm just referring to the fact that Visual Studio does not need add on packs to support multi-threaded GUI apps.

In fact, the wizard that comes standard, produces multi-threaded apps by default.

As to the learning curve, I'm referring to the fact that Jorgman hasn't written GUI or multi-threaded apps before. There are new concepts to learn for both.

JackDingler 1-Oct-12 11:32am View
You don't have to crack the dongle. Just the code doing the protection check.
JackDingler 1-Oct-12 11:27am View
Steinberg is a good example.

They have a complex and error prone licensing scheme. It costs them money and alienates paying customers like myself. For this, they get no benefit, as they get cracked anyway.

It's a waste of money and goodwill for nothing.
JackDingler 28-Sep-12 19:08pm View
Actually, I wasn't joking.

'Files', are simply a traditional container for keeping code organized.
Objects are an abstract idea that is anchored into C++, in files.

These objects could be represented in a different form. Perhaps a system grounded in a database. In this view you could attach more attributes to code and perhaps make a system that is by nature more portable among disparate systems.

We're accustomed to coding being in the form it is, because it's the way it's always been done.
JackDingler 28-Sep-12 17:44pm View
I've thought along similar lines for most of my career.

I have the view that the notion of files is archaic in writing code.

The typical naysayer to this notion often replies, "Oh we tried that and it had problems." As if file systems never suffer from "problems".
JackDingler 24-Sep-12 11:58am View
A picture of a meter, tells us nothing about it's specifications. I'm not sure why you thought we'd be able to guess the technical specifications, protocols supported and that it even has port communications from a picture of cows being milked.

Just FYI, you would've gotten better answers if you had provided details like these from the beginning.
JackDingler 24-Sep-12 8:58am View
You can dynamically load ActiveX DLLs, but there is a lot more pain involved...

JackDingler 21-Sep-12 15:23pm View
I made some corrections. I was fighting the copy and paste mechanism previously...
JackDingler 21-Sep-12 13:55pm View
Add +5, as it's extremely unlikely that Hulak_78 will get a better answer.

The person that voted you a '1', obviously knows the answer is refusing to provide it.

I give that person a '0'.
JackDingler 21-Sep-12 13:53pm View
Don't know why you got one star.

Unless someone can read the language on the website, they won't be able to provide better help. I don't even recognize the language.

The manufacturer is likely to provide products or can suggest products that will allow Haluk_78 to access the data provided by these machines.
JackDingler 20-Sep-12 12:34pm View
This isn't supported on 64 bit platforms.
Microsoft is officially dropping the Jet Engine. Unofficially, it's still in their MS Office Suite.
I recommend that you develop new applications with SQL Express.
JackDingler 20-Sep-12 11:12am View
It sounds like the problem is likely with the web server.

Run netmon or a similar utility to track down where the lag is occurring.
JackDingler 20-Sep-12 11:10am View
I'm not clear on whether your calling a client based Seek() and Read() or host based Seek() and Read().

Please improve your question so that we can understand exactly what is going on.
JackDingler 18-Sep-12 17:07pm View
Looks like it's missing a semicolon between the paths.
JackDingler 7-Sep-12 14:06pm View
Right. It won't work. That compiler and it's libraries are very outdated.
JackDingler 7-Sep-12 14:05pm View
Your errors have to do with ANSI / Unicode issues...

But you're doing it the hard way. Use the CDatabase class to connect.

Use the class wizard to create CRecordset derived classes to access your database records.

This stuff is really simple if you let the tools do the work for you.

right click the project in the project pane and select and choose choose the MFC class option, then ODBC. Or whatever path is proper for the version of Visual Studio you are using.
JackDingler 7-Sep-12 13:27pm View
Hope you get an A on your homework.
JackDingler 7-Sep-12 13:26pm View
JackDingler 7-Sep-12 12:45pm View
Once you compile to a DLL, you're down to the native instruction set.
JackDingler 7-Sep-12 10:49am View
JackDingler 6-Sep-12 15:34pm View
I have no idea.
JackDingler 6-Sep-12 15:02pm View
I use Google.
JackDingler 6-Sep-12 14:57pm View
Windows hooks and detours are an advanced topic, and they require significant effort to implement.

You're unlikely to get the help you need on a quick answers forum.

If you just needed to modify inputs on a program you have the source code to, we could be more help.
JackDingler 5-Sep-12 11:59am View
Is this a program you are writing, or an app for which you don't have source code?
JackDingler 5-Sep-12 10:41am View
Perhaps if you told us what you're trying to accomplish with this, we might be able to point you in a better direction?
JackDingler 4-Sep-12 16:25pm View
I take it that you still haven't even started this assignment?

When you get into the professional world, you'll be unable to get random people on the internet to do your work for you... School is a good time to learn how to these things yourself.

What do you really want to do for a living? What are you willing to work at to get there?
JackDingler 31-Aug-12 11:18am View
Post a new topic. Other folks that contribute know more about com communications on modern systems than I do. I haven't done anything with since dialup modems went out of style.
JackDingler 31-Aug-12 11:17am View
realloc() takes your existing pointer to memory and attempts to resize it. It will copy your data so it isn't lost, and give you a new pointer to your data.

There is lot's of documentation on the web for this.
JackDingler 31-Aug-12 9:13am View
Move the statement int i=0; outside the loop. It's getting created and destroyed with every pass.

Use the debugger to watch your variables and see what they are doing.
JackDingler 30-Aug-12 17:37pm View
You're probably missing an include file.

Read up on std::vector. It's a very useful template. Get to know it.

Be aware it's a C++ template.
JackDingler 30-Aug-12 16:56pm View
You should take some time to Google these functions, templates etc... and read up on them.
JackDingler 30-Aug-12 16:55pm View
I'll continue to answer your questions.

Questions are good.

You can't use std::vector unless you're compiling in C++.

'myint' just represents the number you want to add to the array.

std::vector<int> NumberArray;
JackDingler 30-Aug-12 16:46pm View
If you're going to return the array, you might start by moving your code to a function that is called by main.

What have you done so far to understand what malloc and realloc are good for?

I won't provide an example because I feel it's very important for you to work through this problem. You'll gain some important insights and a sense of accomplishment when you make this work.

To give some context, I would not hire anyone who couldn't whiteboard this problem well enough, to show that they understand what they need to pull together to make this work.
JackDingler 30-Aug-12 16:33pm View
iostream is C++

Save this function in a .c file instead of .cpp

Or make sure your environment is fully set up to build C++ projects.
JackDingler 30-Aug-12 16:26pm View
Good answer.
JackDingler 30-Aug-12 16:03pm View
To do it in 'C' with such small counts, the malloc technique works well.

Start with an initial size that seems like it'll work for most cases.
malloc() an array of that size.
Insert your numbers at those indexes.
if you run out of room, call realloc to create a new array.

I will not post an example this time. These important concepts to learn. The answer will sink in better if you research them yourself and write the code yourself.
JackDingler 30-Aug-12 15:58pm View
But you have to know what 'Count' is :)
JackDingler 30-Aug-12 15:57pm View
Or allocate an array using malloc(sizeof(int) * Count);
JackDingler 30-Aug-12 15:51pm View
Good answer....
JackDingler 30-Aug-12 15:51pm View
Good answer....
JackDingler 30-Aug-12 15:46pm View
I don't understand your question.

You want to put them into array or something?
JackDingler 30-Aug-12 11:33am View
I have a feeling that the worker pictured on the web site, isn't a representative sample.
JackDingler 30-Aug-12 11:18am View
I gave you a five, because it's what Peter needs to learn, rather than what Peter asked for.

Using a variable arguments in function calls should be constrained to a small niche of uses, not a general purpose technique. I typically use it, only in logging code, where I'm essentially using it like a printf...
JackDingler 30-Aug-12 11:14am View
You might be in the running on setting a record on the number of times a question has been reposted.
JackDingler 30-Aug-12 9:43am View
MFC is simply a class library to help you interface with the OS. It's not MFC that is giving you these problems. What you're having trouble with is the C++ language and how it should be used. You would've had the same problems in Linux with C++.

If you call 'new', then somewhere you must call 'delete'.

If you call malloc() or calloc() or strdup() then you must call free().

When you're done with memory you allocate, you must release it.

That's it in a nutshell.
JackDingler 30-Aug-12 8:53am View
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein
JackDingler 30-Aug-12 8:51am View
I wonder how often students turn in code that has someone else's copyright disclaimer still in it?
JackDingler 30-Aug-12 8:46am View
Read the whole line in.

std::vector<std::string> sFieldList;

Find the first element, push it into sFieldList.
Find the second element, push into sFieldList.
Keep going until you run out string.

Then look at the elements to figure out what format you have.

The advantage of this, is that the fields are all stored exactly as the are found in the file. No alpha characters are lost in converting to a double prematurely.
JackDingler 30-Aug-12 8:38am View
I gave you a solution that will tell you exactly which line of code is allocating the memory. We can't guess what your source code looks like, and tell you where the leak is, in code we've never seen.

MFC is pretty solid. It doesn't have any leaks like you describe. This leak comes from something you wrote.