pseudorandom21 166 Practically a Posting Shark

@Tellalca,

Your logic is terrible.

pseudorandom21 166 Practically a Posting Shark

I like programs that support command line arguments. There, there's my opinion, now I'll just brace for the backlash.....

Narue commented: Me too. :) Console filters aren't common anymore, but they're super useful. +17
pseudorandom21 166 Practically a Posting Shark

Most programmers would use a matrix instead of two arrays, but w/e. bool seatReservations[64][64] = {false}; Etc.

pseudorandom21 166 Practically a Posting Shark

I don't think it's a plugin this guy installed it happens to me too, I'm using chrome.

pseudorandom21 166 Practically a Posting Shark

Fortune favors the bold.

pseudorandom21 166 Practically a Posting Shark

But Annana...

int *buffer = NULL;
//buffer is now empty.
buffer = new int[128];
//buffer now is an array of 128 integers.
delete [] buffer;
buffer = NULL;
//buffer is now empty.
pseudorandom21 166 Practically a Posting Shark

Well... For that type of thing I would use a library. irrklang is free to use for non-commerical stuff: http://www.ambiera.com/irrklang/

I've used it a little, it's a pretty cool library.

--edit--
I'm going to agree and say OpenAL is worth checking out.

pseudorandom21 166 Practically a Posting Shark

I think your idea is great, but you could plaster that statement diagonally across the page in glowing "emergency orange" arial bold (I know, that's not really a web font), and people would still ignore it.


Is there really any other kind? ;)

O rly? What if the user has to successfully complete a demo post using the tags properly?

pseudorandom21 166 Practically a Posting Shark

That doesn't look very C++ish to me, specifically because you're using a C function.

You can more than likely use a C++ std:;string, couldn't you? The c_str() member returns a const char *.

http://www.cplusplus.com/reference/algorithm/
http://www.cplusplus.com/reference/string/string/

A C++ stringstream may fulfill your tokenization needs, http://www.cplusplus.com/reference/iostream/stringstream/

pseudorandom21 166 Practically a Posting Shark

Thank you Vijayan121, that is very helpful.

pseudorandom21 166 Practically a Posting Shark

As I've already told you, using setw will fix your output problems.

pseudorandom21 166 Practically a Posting Shark

You haven't provided an implementation for it.

~dayType();

pseudorandom21 166 Practically a Posting Shark

Well, the idea was for everything between [code] and [/code] to be collapsed, but a more sophisticated system might be good for the users too. I also like twiss's idea, a new tag that goes inside the code tags to denote a problem section sounds like a good idea. As for people using the features, when they make their account a blank page with the text:

"When posting in programming help forums...

Post your code between the code tags like so: /* code tags intro */

To denote a problem section, please place the problem_section tags around the section of code within the code tags
like so: /* problem_section tags intro */

For a full listing of our forum rules and other useful tags, please see: /* Link */ "

will probably work just fine.

pseudorandom21 166 Practically a Posting Shark

Maybe if the pointer to the base of the array is NULL, then it's not an array at all. But it could be, and it's definitely empty.

Ancient Dragon commented: good point :) +17
pseudorandom21 166 Practically a Posting Shark

I also agree that it's too big where it doesn't matter.

For instance, the bottom of the page has a lot of rarely used stuff and takes up a lot of space, I use the "end" key to take me to the bottom then I have to scroll up to see the last post.

Why not get ahead of your time and include a "Take me to last post" link/button.

Also, the header for every post has a gigantic font and they all say the same thing, useless. There is also wasted space everywhere.

I have proposed a site improvement on my thread in the geeks lounge, it includes a poll please give it a look. I think it should at least mitigate some of the space problems.

When brainstorming potential 'site improvements please keep these concerns as well as the one in my thread in mind, it would be much appreciated.

pseudorandom21 166 Practically a Posting Shark

Isn't it called the "Order of Operations" ? Or rather, in a programming language, operator precedence.

pseudorandom21 166 Practically a Posting Shark

So.. I really don't know anything about modern databases at all. How can I learn to work with databases? Is it simple to create one? What should I do?

pseudorandom21 166 Practically a Posting Shark

It will probably work in C# if you take out the function and put it in a C# class.

You REALLY need to look up some proper formatting guidelines, or use an IDE.

pseudorandom21 166 Practically a Posting Shark

Such is also true to pointers. const char * constantData; char * const constantPointer; const char * const constantAll;

pseudorandom21 166 Practically a Posting Shark

I'm sure many of you know how visual studio supports "outlining", it's where a block of code becomes collapsible and it can be expanded or collapsed by the plus sign on the left.

Often times those seeking help feel it necessary to dump about 3-4 files into a thread and expect to get help, obviously I don't like skipping over 3-4 files of what may be entirely irrelevant, and the process would be much smoother with a feature similar to "outlining".

It would likely be much appreciated among the Daniweb community, so if you want outlining but don't want to implement it or worry about anything at all and let the Daniweb folks create it, there is now a poll for this.

Best idea yet, IMO, I always thought the post threads were a bit lengthy.

pseudorandom21 166 Practically a Posting Shark

Much agreed, the format of your post is most unhelpful to us. It's really your responsibility to make sure you meet those requirements, and if you're having trouble or you have a specific question we'll surely help.

pseudorandom21 166 Practically a Posting Shark

You're using a tab, use "setw"

setw sets a given number of spaces for the next item to be outputted.

Here's a small example:

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

int main()
{
    string firstColumn = "Name";
    int secondColumn = 21;
    float thirdColumn = 3.58;
    cout << setw(20) << firstColumn << setw(5) << secondColumn << setw(5) << thirdColumn << endl;
}

Assuming the person's name is less than 20 characters, other info less than 5, etc. It will be aligned correctly.

setw basically does this:
[Name ][21 ][3.58 ]

You can also specify alignment with other stream manipulators, and there are other stream manipulators for floating point stuff.

Setting the alignment to right would make "Name" appear on the right side of it's setw "field".

You may also want some basic error checking, at least to make sure the file actually opened.

info >> manifest[x].last_name;
        info >> manifest[x].first_name;
        info >> manifest[x].smoking;
        info >> manifest[x].row;
        info >> manifest[x].seat;

This is more of a personal preference, but if you're not making sure your stream failed to read each of these (individually), you can do this:

info >> manifest[x].last_name 
     >> manifest[x].first_name 
     >> manifest[x].smoking 
     >> manifest[x].row 
     >> manifest[x].seat;

>>It doesn't appear that you are actually outputting your information in a 10 row 3 column format, I really only see two columns and some unnecessary %3 logic.

It's a complete mystery to me what the third column should contain, so you'll have to …

pseudorandom21 166 Practically a Posting Shark

while(patients != -1)}{{

That line.

pseudorandom21 166 Practically a Posting Shark

Your teacher expects you to copy and paste the code on cboard.cprogramming.com and have us explain it to you? I think a monkey just flew right out... nevermind.


You know I always had a problem with copying & pasting code, I still do. I never did it, I typed it myself even when it's free to anyone to use for anything. I just didn't do it, maybe you don't have what it takes? You know, that "ethics" thing?

Somehow stealing the idea and providing your own implementation may help, idk. I hate to call it stealing but I feel that way, even when it's free to anyone.

What have you accomplished by copying and pasting? In my opinion there is further benefit to writing it yourself.

Salem commented: Nicely put +17
pseudorandom21 166 Practically a Posting Shark

That page doesn't tell you everything you need to know either, but it is a good start.

pseudorandom21 166 Practically a Posting Shark

DLL injection just sounds magic to me, I guess. lol

pseudorandom21 166 Practically a Posting Shark

Using the location of the rectangle, and the info in the MouseEventArgs ^e you can do that. At least that's the way it sounds, you haven't posted any code to clear up what you're talking about.

pseudorandom21 166 Practically a Posting Shark

That's a bit disappointing. Thank you.

pseudorandom21 166 Practically a Posting Shark

Well.. That tutorial said IPC is the way to go, but I'm a bit lost on how to utilize it. What should I do now?

pseudorandom21 166 Practically a Posting Shark

Yes, good point Vijayan, I usually assume it's good input even if it has trailing crud for some reason.

Might I ask for an explanation of this line:

typename std::enable_if< std::is_arithmetic<T>::value, T >::type* = 0 )

pseudorandom21 166 Practically a Posting Shark

No it isn't.

You are accessing an element of your array that does NOT exist. You are over-writing something in memory that exists past the end of your array. Any decent modern operating system will crash the program as soon as you reach the last element of the array.

To be *very* clear,

1. The size of your array is 50.
2. The last element you can safely access is 49.
3. for(a = 0; a < SIZE; a++)

pseudorandom21 166 Practically a Posting Shark

hmm.. I'm not sure but *[] may be treated as a multi-dimensional array, in which case the compiler would also need to know the size of the second (and every successive) dimension.

pseudorandom21 166 Practically a Posting Shark

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

This may help you, it says that the function called doesn't need to be known at compile-time. I guess I should wonder, how else are you going to pass a function to a function?

pseudorandom21 166 Practically a Posting Shark

Yes, the idea is to inject my DLL into someone else's process.

pseudorandom21 166 Practically a Posting Shark

You can set windows to show all file extensions, whereas typically it will "hide extensions for known file-types" which is the folder option you uncheck.

pseudorandom21 166 Practically a Posting Shark

Oh crap I kind of said that wrong, "adding the class to the pch" no lol.

include the file in the PCH

pseudorandom21 166 Practically a Posting Shark

Sooo... Every DLL injection result I've read so far only uses a pre-made DLL, loads it into another process and says "darn I'm good." They do absolutely NOTHING useful and a couple of them are rip-offs of one another only using a different programming language. Google has failed me!

Once my DLL is loaded into the target process, what good is it? Can I call functions in the application with the DLL ?

Much appreciated.

pseudorandom21 166 Practically a Posting Shark

Precompiled Header error?

Try adding the class to the pre-compiled header file.

Also you have to have include guards.

Typically for multi-platform you'll want:

#ifndef SOMEHEADER_H
#define SOMEHEADER_H

struct foo{
   int x,y;
};

#endif
pseudorandom21 166 Practically a Posting Shark

Calling the primary thread's invoke member executes the function on that thread instead of the new one.

pseudorandom21 166 Practically a Posting Shark

well, you're also going to need to pass your variables by reference or pointer, otherwise their contents will not be modified. Pass-by-value copies the variables.

pseudorandom21 166 Practically a Posting Shark

I'm guessing 'a' should be your loop control variable? Then you probably meant for (a = 0; a < 50; a++)

pseudorandom21 166 Practically a Posting Shark

Personally I would rather not deal with "cin" failure, but rather a stringstream failure.

I'm writing this in the textbox but it usually works when I do:

template<class int_type>
int_type GetChosenNumber(std::istream &is, std::ostream &os){
   int_type out;
   std::string in;
   std::getline(is, in);
   while( (std::stringstream(in) >> out).fail() ){
      os << "Invalid input, retry." << std::endl;
      std::getline(is,in);
   }
   return out;
}

Use is like:

//Assuming the compiler determines the type.
int result = GetChosenNumber(cin,cout);
//Assuming the compiler doesn't determine the type.
int result = GetChosenNumber<int>(cin,cout);
//Output to a file.
int result = GetChosenNumber<int>(cin,someOutFile);
//Floating point type.
float result = GetChosenNumber(cin,cout);

An overload to use your own error message might be handy too. Note that cin never enters the fail state with this, the stringstream does and a new one is created every time the parsing fails, so you don't have to clear errors and ignore stuff (which is kind of an iffy subject for different platforms).

pseudorandom21 166 Practically a Posting Shark

Excellent idea L7Sqr! I'll have to remember that.

pseudorandom21 166 Practically a Posting Shark

There is probably a debug mode for GCC, you'll have to google the right argument for that.

Debug modes will normally run your application under the control of the debugger.

Alternatively visual studio 2010 express is free, then you just hit "F5".

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

pseudorandom21 166 Practically a Posting Shark

You are accessing an element of your array that doesn't exist by using "<=" in multiple places.

an array of size 128,

starting at zero (0)

is from 0 to 127

for(int i = 0; i < 128; i++)

Debugging with a decent compiler would tell you the stack around "v" was corrupted, meaning you are accessing an element of your array that doesn't exist.

// Calculate second column:
  for (int i=0; i < xMeshPoints; i++)
  {
	  v[i][1] = v[i][0] - (a*dt/dx)*(v[i+1][0]-v[i][0]);//<--
//is v[i+1][0] exist when i < xMeshPoints ??
  }
pseudorandom21 166 Practically a Posting Shark

Yep you're right about that, but I've been through quite a few computer builds, and this baby will last a few more ;)

pseudorandom21 166 Practically a Posting Shark

Usually it's pretty handy to typedef your function pointers.

typedef void (*FuncType)(int, bool);

//...

void SomeFunction( FuncType foo, int n ){ }

For class member function pointers, you will need a pointer to the instance of the object on which you wish to call the function, as well as the pointer to the member function.

Which is a slightly confusing way to say that you pass the "this" pointer of your class instance along with the function pointer, then use something like: (*pObj).foo(100,false); where pObj is the "this" pointer.

You can use templates to simplify adding callbacks, or you can avoid needing the "this" pointer by making the function static.

I've used templates where I want to add a callback to a class of a type I don't know yet, but has a member function with a specified prototype.

An example of the easy workaround is:

typedef void (*FuncType)();
class Bar
{
public:
	static void ffoo(){ }
};

void addCallback( FuncType foo )
{

}

int main()
{
	addCallback(Bar::ffoo);
}
pseudorandom21 166 Practically a Posting Shark

There is also a C++ string class that is not the same as a C style string and the C string functions may not work with it.

You can retrieve a C style string from the C++ string class using the .c_str() function, but it is a const char * and modifying it that way probably isn't recommended.

With the C++ string class you don't really need the C string functions.

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

int main()
{
	string cppString = "Hello World.";
	cppString = "No error, no confusing C functions.";
	getline(cin,cppString);//No buffer overflow from too much input.

	//Use much like an array.
	for( std::string::size_type i = 0; i < cppString.size(); i++ )
		 cppString[i] = 'x';

	cppString += " -- Simple string concatenation too.";

	//Usable with the C++ STL algorithms.
	random_shuffle(cppString.begin(), cppString.end());

	cout << "Can still get a C string if you REALLY want to also." 
		<< endl << cppString.c_str() << endl;

	//Easily convert from string to int/floating point type.
	int someInt = 0;
	cin >> cppString;
	if((stringstream(cppString) >> someInt).fail())
		cout << "Invalid number, woops!";
	else
		cout << someInt << endl << "Just your lucky number." << endl;
}

Sorry, if you want to convert your string to an integer or other type you can use a stringstream. They're pretty simple once you get used to the idea.

pseudorandom21 166 Practically a Posting Shark

Yep, I've been building my own computer for quite a while now. IMO one of the most important things is the case, with an ancient flimsy aluminum case you're bound to have troubles with getting your new hardware installed properly.

I'm using a Cooler Master case at the moment:
http://www.newegg.com/Product/Product.aspx?Item=N82E16811119225

I really like it, the first thing you will notice is that it is gigantic, but it has a lot of good features. One thing, cleaning the steel fan covers isn't as easy as it should be, you have to remove a fan in some cases, but it's still pretty painless.

It's very roomy, everything works, and it seems to keep my PC pretty cool.

pseudorandom21 166 Practically a Posting Shark

So the "this" eh, handle.. in C#, in what ways is it different from "Me" in the latest version of VB ??