pseudorandom21 166 Practically a Posting Shark

I heard that it can be done using the algorithm library.

I agree that unless you are supposed to use that you should write it yourself.

pseudorandom21 166 Practically a Posting Shark
pseudorandom21 166 Practically a Posting Shark
pseudorandom21 166 Practically a Posting Shark

I'm liking this Intellij IDEA one for now. Thanks guys.

pseudorandom21 166 Practically a Posting Shark

Once you drag + drop a "control" on your "form" you can select the control and in the properties pane at the top there is an "events" button you will want to click.

Those events are most likely relevant to using your logic with your GUI. Find one, such as the "MouseClick" event, double click the white part of the drop-down to have the editor generate one for you.

pseudorandom21 166 Practically a Posting Shark

Limit on the amount of memory you can use perhaps? Hmm... Maybe the system has a tiny amount of stack space available? Where you submit this code, does it run your program and give it input? Maybe it feeds it erroneous input, and if so you will need to handle those errors. A post on that website says something about the possibility of the website using excessive line breaks.

pseudorandom21 166 Practically a Posting Shark

This is incorrect:

char password;
    char PASSCODE="mypasscode";

Typically you will use for C style strings:

const char *PASSCODE = "mypasscode";

to compare C style strings ( which is an array of characters with a NULL character to signal the end of the string ) you will need to use strcmp().

I'm thinking if you are reading a tutorial it has introduced C style strings in order for you to understand some basics about pointers. It probably also introduced the array, which you will need to use.

Alternatively, there is a C++ "string" class.

pseudorandom21 166 Practically a Posting Shark

Are you using G++ instead of GCC ? That may help.
ex. g++ main.cpp -o palindrome.exe

pseudorandom21 166 Practically a Posting Shark

Hmm I have a version of the palindrome here, I think it would be interesting to see the performance difference between this version and yours (this one uses the STL).

template<class Int_Type>
Int_Type NextPalindromeNumber(Int_Type number)
{
	std::stringstream ss;
	std::string numberString;
	do
	{
		number++;
		ss.clear();
		ss.str("");
		ss << number;
		ss >> numberString;
	}while(!std::equal(numberString.begin(), numberString.begin()+numberString.size()/2, numberString.rbegin()));
	return number;
}
pseudorandom21 166 Practically a Posting Shark

Hello, I would like to use the QT LGPL version with my software, but I'm really not sure what I'm allowed to do with it. The license is very confusing. I'm hoping I can dynamically link to some QT DLLs and use them without too much GNU-tape. What other requirements should I be aware of?

pseudorandom21 166 Practically a Posting Shark

I have had very bad experiences with eclipse and I'm not exactly an IDE noob, I just tend to use better software like Visual Studio or QT Creator. I almost want to smack the guy who made the intellisense for Eclipse with a stack of Visual C++ books.

There has been many a time I wanted to do something with Java and have been turned away from it by a poor IDE.

pseudorandom21 166 Practically a Posting Shark

void __cdecl showArray(char (* const)[4],int)

needs a definition, even if it's empty--then it will compile properly.

Your prototype (declaration) differs in parameter type: void showArray(char [][guess_cols], int );

pseudorandom21 166 Practically a Posting Shark

First of all you must decide how you want your input to be matched with data in your database, such as matching upper/lower etc. Afterward handling the proper event should let you do it.

pseudorandom21 166 Practically a Posting Shark

Using Visual Studio? Press F5 with the project open.

pseudorandom21 166 Practically a Posting Shark

Oh I almost forgot, I would like some opinions on how to write a design for implementing this.

So far I have a few classes in mind, but I don't think it's adequate.

1.
struct MouseMoveInfo
-data members:
unsigned ppsX, ppsY, pixelTimeX, pixelTimeY;
-member function:
void CorrectAcceleration(MouseMoveInfo &previous)

2.
class XInputMouseTranslator
-Prepares a MouseMoveInfo containing a translation of X and Y values to their Pixel-Per-Second values taking into account the aspect ratio of the screen. Also used for relevant time per pixel details.

3.
XInputMouseMapper
-Responsible for acting upon information in a MouseMoveInfo structure, stores the previous MouseMoveInfo and can be set to correct for acceleration.


They will work in the following manner:
[XInputMouseTranslator] -[MouseMoveInfo]-> [XInputMouseMapper]

pseudorandom21 166 Practically a Posting Shark

Never mind this post.

pseudorandom21 166 Practically a Posting Shark

Is there a decent IDE for Java? Meaning, one that you don't think will end up making me rage and have annoying features that get in the way all the time making it unsuitable for development?

What is the best IDE performance wise?

pseudorandom21 166 Practically a Posting Shark

using .NET means making your native C++ project a Mixed Mode assembly that contains both native machine instructions and MSIL. If you have compilation trouble using a mixed mode then you may want to look into using the #pragma managed and #pragma unmanaged.

As far as using it to make a GUI for your C++ project, click on your project name in the solution explorer & select add-> new item : Windows Form.

You can also use QT (which is not free) wxWidgets (I think it's free), MFC, or just native Win32 API calls.

For MFC you may have a little difficulty unless you take a lot of time trying to understand Microsoft's framework and then how to use it for your applications.

If you don't mind distributing your application with a couple of DLLs you can use QT (afaik). You don't have to distribute your source under the LGPL (as far as I know, and I'm NOT a lawyer so don't quote me on this).

QT is very nice IMO.

pseudorandom21 166 Practically a Posting Shark

Chances are it's Operating System specific, if you're using Windows you may want to start with the Windows API functions reference.

http://msdn.microsoft.com/en-us/library/aa383749(v=vs.85).aspx

pseudorandom21 166 Practically a Posting Shark

Well yea. If the user moves the stick from initial position to end position in a fast time, then you would expect the mouse to move in a fast time as well, right? Its like the mac, touch pad; touch the pad at one position, and quickly move it to a destination , then the mouse would have to quickly move to the destination as well right? And if the user slowly moves the the stick then the mouse should move slow as well right?

Yes you are correct, that was a consideration I had forgotten, as well as the aspect ratio correction. Originally I didn't think the quickness of the thumbstick movement would matter.

If you have an xbox 360 controller connected to your PC you can try my previous implementation to get a feel for what it currently is like. http://sourceforge.net/projects/xinmapper/

pseudorandom21 166 Practically a Posting Shark

ok stuff like this might be a little test and trial. But how about saving three states, previous mouse position, post mouse position, and time interval of movement. This way you can derive the rate at which the user locks the stick in a position. Then use that information to transform it into mouse speed.
When your mapping it into the screen, are you using windows for manipulating the mouse or are you using other libraries? How about having a matrix that transforms logical position into pixel position( ex. (0,0) map to pixel (x0,y0) and (1,1) map to pixel(x1,y1) ) but you need to take into account the viewing perspective to differentiate the length between the amount of pixel from x = 0 to x = 1( assuming x is horizontal axis). This is what essentially opengl does.
And there might be libraries out there that takes care of this for you already so check that out as well.

Does that mean my sensitivity settings are a length of time?

>Definitely using Windows SendInput

I'll consider this, because ultimately the implementation doesn't matter as long as the user likes using and it is customizable.

pseudorandom21 166 Practically a Posting Shark

Well I'm mapping from my xbox 360 controller to mouse movement, and I'm not satisfied yet. I've already done it using relative.

The xbox 360 controller thumbstick coordinate system is a pretty standard 4 axis.

32767
| Quadrant One
|
-32768 ---- 32767
|
|
-32768

The strategy I'm considering is retrieving the X and Y values from the controller, and then mapping it to a different coordinate system based on the sensitivity. This coordinate system value will be used to move the cursor--I don't know how yet, could be a number of pixels at a time or by moving 1 pixel at a time in a loop with a high resolution timer. I was considering moving more than one pixel at a time.


Y max
| Quadrant One
|
-X max ---- X max
|
|
-Y max

The basic problem (for me) when simulating mouse movement is determining the measure of mouse movement wrt to time. I have considered Pixels Per Second as the proper unit of measure, but that may mean I need a high resolution timer (moving 1 pixel will boil down to me "sleeping" the loop for less than a millisecond) but it now seems that the count of pixels moved in one millisecond would avoid needing the high resolution timer. I also need to know the expected range of PPS settings, which I don't know.

Another …

pseudorandom21 166 Practically a Posting Shark

For simulating mouse movement on windows would it be better performance-wise to move the cursor to absolute coordinates or to move it relative to it's previous location?

Obviously if moving to an absolute location each pixel in between must also be reached.

pseudorandom21 166 Practically a Posting Shark

Google "Dynamic Memory Allocation C++"

int bufferSize = 512;
char *buffer = new char[bufferSize];
strcpy(buffer,"This fits in my buffer.");

//When finished you must delete the memory
//or it will be a memory "leak"
delete [] buffer;
pseudorandom21 166 Practically a Posting Shark

Hi, I'm starting to do some work with MFC and I was wondering why the design view seems to only work for dialogs? I'm using VS2010, is there a design view you can use with a simple SDI application?

pseudorandom21 166 Practically a Posting Shark

The skeleton of the program is going to be like this, the function definitions are not inside the main function.

#include <iostream>
//Whatever else includes.

int foo();//<-- function prototype or function declaration

int main()
{
//Body of the main function
}

int foo()
{
//Function definition
}
pseudorandom21 166 Practically a Posting Shark

Not using Dev-C++ is a good idea. There are plenty of free compilers available, and if you're using Windows I would recommend Visual Studio 2010 express.

The reason Dev-C++ is bad is because it's old, unsupported, and buggy.

http://www.microsoft.com/express/Downloads/

Basically the problem with your code is that you haven't implemented the functions yet, which I'm sure you're aware of.

In my experience, it's best to keep the program as flexible as possible by abstracting details from the programmer (yourself, which may make it even easier).

So instead of defining an array of times (as a string you will need to parse),
why not make it work for any time by not knowing all the times?
(You'll need to parse the string or the double value because you're using a matrix of double values).

A design decision you will need to make is if you want to read the file multiple times, or store the entire file's contents in memory (which can be a big problem if the file is gigantic).

The algorithm for reading the file's data could simply be:

string day, time;
unsigned distance;
inFile >> day >> time >> distance;
pseudorandom21 166 Practically a Posting Shark

Pure Computation.

pseudorandom21 166 Practically a Posting Shark

Windows API
Can the KEYBDINPUT structure in the INPUT structure be used to send a mouse click? I know there is a different structure for the mouse but I would like to use the KEYBDINPUT structure if possible.

pseudorandom21 166 Practically a Posting Shark

"::" is the scope resolution operator.

namespace::class is the form of std::string.

pseudorandom21 166 Practically a Posting Shark

I'm not extremely familiar with the Gauss-Seidel method, but typically you will want to use a setup like this when working with a matrix:

for(int row = 0; row < rowMax; row++){
   for(int col = 0; col < colMax; col++){
      matrix[row][col] = blah;
   }
}

Most C++ text books have a section on working with matrices, and discuss the row/column and column/row methods of iterating.

pseudorandom21 166 Practically a Posting Shark

http://www.cplusplus.com/reference/string/operator+/

#include <iostream>
#include <string>
using namespace std;

int main()
{
   string first = "www.";
   string second = "daniweb";
   string third = ".com";
   cout << first + second + third << endl;
   first += second + third;
   first += " :" + second + ":";
   cout << first << endl;
   cin.get();
}
pseudorandom21 166 Practically a Posting Shark

Oh and I almost forgot, your application has to have equal or higher "authorization" than the application that receives the simulated input.

I'm not quite sure but you may be able to use a windows low-level keyboard hook to remove the injected flag from the input (I have done this). But I'm not sure that will make administrator mode applications detect it (haven't tried that).


By far the simplest solution is to run your application in administrator mode.

pseudorandom21 166 Practically a Posting Shark

Hmm maybe I misunderstood, I assumed he meant he wanted to show a dialog when pressing the save button but before the savefiledialog exited.

<shrug>

pseudorandom21 166 Practically a Posting Shark

http://msdn.microsoft.com/en-us/library/system.windows.forms.savefiledialog.aspx

I don't think so. There are three events listed, Disposed, FileOk, and HelpRequested.

I'm not real sure this is the best idea, but you could try deriving a class from SaveFileDialog and implement your own behavior. Another opinion on this idea would be good.

pseudorandom21 166 Practically a Posting Shark

You can concatenate the C++ string class with the + operator though.

pseudorandom21 166 Practically a Posting Shark

lol.

You could try making a program to either compress a file, or a program to split a file into pieces. The reason you may want to split a file into pieces could be it needs to fit on a FAT32 file system and is larger than 4 GB.

You could just generate a 4+GB file to work with when testing.

Say perhaps you have a flash drive that you can't store a DVD on, then the file split may be handy. Of course you have to re-assemble the pieces too. Could also be used to overcome some file size limitations like say, a limit of file attachment sizes for emails.

pseudorandom21 166 Practically a Posting Shark

I think it has to do with the way the C++ compiler works. It's all the C programming language's fault (most likely).

pseudorandom21 166 Practically a Posting Shark

I think you may experience link errors with your current setup.

You need to have the code inside the header file for templates (no source file, header only).

Truthfully you can include the .cpp file at the end of the .h file, but if you're using Visual Studio you will need to exclude the .cpp file from the solution to do that, and it's not worth the trouble at all. For G++ I'm not sure how that would work.

pseudorandom21 166 Practically a Posting Shark

Thanks, didn't know that.

pseudorandom21 166 Practically a Posting Shark

Try changing your project options to not use unicode.

LPCSTR = Long Pointer to a C-style STRing
C = char *

Microsoft typedefs their actual types, and if your project options are set to use unicode a different typedef is used for supporting unicode.

(it may be LPCWSTR)

You can read the first few pages of a book on Windows programming and it will probably tell you all about their naming system.

The "Long Pointer" part is outdated, pointers long ago were different.

pseudorandom21 166 Practically a Posting Shark

A pointer is probably the same size as an integer, so you probably won't gain any resources by using pointers when passing simple integers, but take a structure for example.

(C++)

struct SomeType{
int x;
int y;
char name[128];
float delta;
std::string etc;
};

If you use a pointer or reference you won't copy the entire structure's contents.

void foo(SomeType * const st){
	strcpy(st->name,"Bob");
	st->x = 100;
	st->y = 50;
	st->delta = 1.0f;
	//Constant pointer so you don't
	//change what the pointer points to.
	//error:
	//SomeType s;
	//st = &s;
}
pseudorandom21 166 Practically a Posting Shark

The Windows API has SendInput, and you need to send the hardware scan code of the key you wish to press for games to detect it (I know this from experience).

I have a small example in C++ here, I'm assuming you can Pinvoke it with no trouble.

#include "stdafx.h"
#pragma comment(lib,"user32")
using namespace std;

int main()
{
	char ch = 'a';
	INPUT key;
	memset(&key,0,sizeof(INPUT));//Zero the structure.
	key.type = INPUT_KEYBOARD;
	key.ki.dwExtraInfo = GetMessageExtraInfo();//<-- you will need to pinvoke this too.
	key.ki.wScan = 
		static_cast<WORD>(MapVirtualKeyEx(VkKeyScanA(ch), MAPVK_VK_TO_VSC, GetKeyboardLayout(0)));//more pinvoking
	key.ki.dwFlags = KEYEVENTF_SCANCODE;//<-- you will probably have to declare this constant somewhere-
	//in your C# program.

	//Ready to send the key-down event.
	SendInput(1, &key, sizeof(INPUT));
	
	Sleep(1000);//Wait one second before sending key-up.

	//Sending key-up.
	key.ki.dwExtraInfo = GetMessageExtraInfo();
	key.ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP;//Key-up need be defined too, or just use the value.
	SendInput(1, &key, sizeof(INPUT));
}

http://www.pinvoke.net/default.aspx/user32/sendinput.html

http://msdn.microsoft.com/en-us/library/ms646310(v=vs.85).aspx

Overall it seems very tedious to use the raw Winapi w/ C# to do this, there may be a better way that I am not aware of.

It appears as though SendKeys offers the familiar C# level of abstraction, please see here: http://msdn.microsoft.com/en-us/library/ms171548.aspx

--edit--
Actually it sounds as if a windows low-level keyboard hook would be better for your purpose, you can intercept the input before it reaches the application and either prevent it from reaching it or modify it whilst simulating input in response.

There appears to be a C# wrapper hosted on …

pseudorandom21 166 Practically a Posting Shark

Are you sure all those strings fit into 19 characters? (at the beginning where you use strcpy)

You are using C++ so I might suggest a more flexible way of storing a string, specifically the C++ string class.

#include <string>

int main()
{
   std::string input = "Whatever length you want, and some member functions to operate on it.";
}

--edit--

Oh wait you're using Borland C++. Well you may need a newer compiler, your compiler produces 16 bit executables if I'm not mistaken. It probably doesn't have a lot of the newer C++ language features and is extremely outdated by modern standards.

GCC and Visual Studio 2010 Express edition are both free.

#include<string.h>

Bad, bad.

pseudorandom21 166 Practically a Posting Shark

Step 1.
It's a base class because you're going to be deriving other classes from it.

Create a base class called Vehicle that has the manufacturer's name (type string), number of cylinders in the engine (type int.), and owner (type person given below instructions).

Step 2.
Derive a class from the base you just made using C++'s inheritance features.

Then create a class called Truck that is derived from Vehicle and has additional properties, the load capacity in tons (type double since it may contain a fractional part), and towing capacity in pounds (type int.) Be sure your classes have a reasonable complement of constructors and accessor methods, an overloaded assignment operator, and a copy constructor.
It's also probably safe to assume a "property" is a variable.

Step 3.
A driver program is a simple program that tests to make sure everything is working as it should be. Which means you will be testing your class member functions, just make sure they produce the right output. If you made a good driver that provides a description of the test being performed and it's result like "SUCCESS" or "FAILURE" I think you will get good marks.

Write a driver program that tests all your methods.

-----------------------------------------------------------------------------------
If you have any actual questions for us, please do let us know.
http://www.cplusplus.com/

pseudorandom21 166 Practically a Posting Shark

We can't help you unless you tell us the problem. It's entirely up to you to decide how your application works, unless you want me to write it, but then it's not really your application if you get my drift.

I'm not really sure what "stats feed" you really mean either, but I can give you a link that may help with deciding how to write this application.

http://msdn.microsoft.com/en-us/library/4as0wz7t.aspx

http://msdn.microsoft.com/en-us/library/1t38832a.aspx

pseudorandom21 166 Practically a Posting Shark

function definition

void DoSomething(){
  //something
}

Function call

DoSomething();
pseudorandom21 166 Practically a Posting Shark

This isn't a Visual Studio thing, but the home key group is your BEST friend.

Home & end will move to the beginning and end of a line, page up & page down scroll pages at a time.

Shift + (home || end) will highlight an entire line,
Ctrl + (left arrow || right arrow) will move the cursor a word at a time.
Ctrl + Shift + (left arrow || right arrow) will highlight a word at a time.

and the "delete" key I also find very useful, it's like the backspace key except it deletes the character in FRONT of the cursor. When navigating text with my arrow keys the delete key is very close by also.

Unfortunately I haven't found a good use for "insert" mode yet... I don't know that I ever will, I think it is really just useless.

pseudorandom21 166 Practically a Posting Shark

I think the 'object sender' is the control that generated the event, it could be a button on your form or the form it's self.

The event args has more information about the event.

Make a button on your form generate an event when clicked and try this:

Button btn = sender as Button;
btn.Text = "Clicked!";

You can get all this information from MSDN, which if you haven't checked out it's probably important that you do so.
http://msdn.microsoft.com/en-us/library/system.windows.controls.button.aspx
if you scroll down you will see an event named "Click"

pseudorandom21 166 Practically a Posting Shark

If you can share files you can probably do it with two systems & a lan cable, but you will probably want to try it across the internet, if that's how it will be used...

Obviously most internet connections are MUCH slower than the connection between two computers via a LAN cable. Also, I'm not really sure but you may have some problems with your connectivity between LAN and the internet, but I would assume C# would abstract these details from you.