pseudorandom21 166 Practically a Posting Shark

You could try adjusting the size of the stack for your application (if you can do that for C# mobile apps).

Probably a project setting option.

pseudorandom21 166 Practically a Posting Shark

I'm just wondering how programmers rate their own skills, for instance I haven't been using C# very long, but I do feel I have a good grasp on the language.

If I see on a job listing: "* 3+ years C# or Visual Basic.NET "

What the heck is 3+ years of C# ?? What does that mean to you guys? Surely experience with programming using C++ should count for something also.

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

IRC, (AKA "Multiplayer Notepad") isn't really "cool" or "hip" these days. I am kind of fond of the idea, but unless I have a browser-based IRC client, I will be reluctant to visit often. Just because I won't ever open the IRC client, not because I don't like the chat.

Would a browser-based IRC client take up too much resources? It may very well become the hippest thing sliced bread if implemented so it's easy to use, and integrated with the 'site.

Would a chatbox be too much to ask for? I hear Chatango has some good ones... They may provide it for free, but I don't know.

pseudorandom21 166 Practically a Posting Shark

I think he means the data structure call the "map" in C++.

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

Check out the "Dictionary", and maybe other classes.

pseudorandom21 166 Practically a Posting Shark

I've opted to use a DataTable as a data source, and save it as a .XML file.
http://msdn.microsoft.com/en-us/library/system.data.datatable.aspx

Sorry for creating the thread.

pseudorandom21 166 Practically a Posting Shark

I have a DataGridView on a form that updates the datagridview automatically and will allow the user to manually edit the information. I need to save the information in the DataGridView somehow. I don't know what the best option would be. I could of course use a file to store the information but it seems error-prone and overly complicated. Are there any better options?

pseudorandom21 166 Practically a Posting Shark

If using Windows....

Does this help?
http://www.codeproject.com/KB/winsdk/harddiskspace.aspx

How about this?
http://msdn.microsoft.com/en-us/library/aa364935(v=vs.85).aspx
or this?
http://msdn.microsoft.com/en-us/library/aa364937(v=vs.85).aspx
see also this:
http://support.microsoft.com/kb/202455

You will probably need only to include <windows.h>

pseudorandom21 166 Practically a Posting Shark

I come off as a douche-bag a lot, I think my personality is worse online.

Really, it's happened like 3-4 times now. I'm glad you were able to fix your problem. I would also like to give you a tip I think may be helpful, set breakpoints and press F5 for the "Debug" build of your application. It will pause execution and allow you to examine the contents of variables, and the debugger tool can also be used to track the flow-of-control. You can then narrow down the problem entirely.

pseudorandom21 166 Practically a Posting Shark

First of all, what is a "data source", the kind that can be attached to a "DataGridView", what are they used for, and how can I use one?

pseudorandom21 166 Practically a Posting Shark

At least make the effort to put into words what you're too lazy to do.

Fbody commented: I'm not too sure this was necessary... :( -1
ddanbe commented: You did not deserve the neg rep! +9
pseudorandom21 166 Practically a Posting Shark

Please see this page for more algorithm information: http://en.wikipedia.org/wiki/Quicksort

pseudorandom21 166 Practically a Posting Shark

I can tell you GetAsyncKeyState will return true a million or so times per key press. You can check the return value for information about the keypress, it should return different values for key-down and key-up. Try this:

if(GetAsyncKeyState(VK_F1) == -32767)
{
  this->checkBox1->Checked = ! this->checkBox1->Checked;//Toggle
}
pseudorandom21 166 Practically a Posting Shark
std::vector<int>::iterator it = myVec.begin();

Please see here: http://www.cplusplus.com/reference/stl/vector/begin/

pseudorandom21 166 Practically a Posting Shark

std::string is a C++ class (or maybe a typedef'd class template). It's not a C style "string".

Notice the C++ string has member functions that can be accessed via the direct member access operator ( . ).

i.e.,

std::string input;
std::cin >> input;
std::cout << "Size =" << input.size() << std::endl;
input.clear();
std::cout << "Size =" << input.size() << std::endl;
pseudorandom21 166 Practically a Posting Shark

It doesn't "send" anything as far as I know, and if it does, it's probably dependent on the implementation--which you shouldn't concern yourself with.

It "returns" an iterator to the first element in the vector container.

For example:

std::vector<int> myVec(10,7);
std::vector<int>::iterator it = myVec.begin();
for( ; it != myVec.end(); ++it)
{
  std::cout << *it << std::endl;
}

You may want to brush up on iterators.

pseudorandom21 166 Practically a Posting Shark

Lambdas are awesome.

auto lam = [](const char *str) { std::cout << str << std::endl; };
lam("Hello World!");
pseudorandom21 166 Practically a Posting Shark

I only know a little bit about the Global Assembly Cache. After creating a WPF application, in the toolbox, if you right click and select "Choose Items", it will open a window in which you can specify controls you want to use that are in the GAC.

Is it safe to assume those will always be there if they are created by Microsoft? Does the application include these in the .exe, or will it attempt to look for them in the Global Assembly Cache every time?

pseudorandom21 166 Practically a Posting Shark

Or maybe Application::Run(gcnew John());

pseudorandom21 166 Practically a Posting Shark

If you're using Windows you will probably want to use "SendInput" in the Windows API

pseudorandom21 166 Practically a Posting Shark

What is the meaning of "immutable" when relating to an Int32 ?

Int32 i = 0;
i++;
//etc

pseudorandom21 166 Practically a Posting Shark

Unless this is an assignment I would use a library to do this.

Otherwise, some creative design could likely solve the problem, you may want to work out some pseudo-code for the entire program.

It may go something like:

-order-of-operations scan, instantiation of evaluator class if required. Innermost expression is evaluated first, in groups of two "terms".

i.e.,
input: 3 + 8 / 10
evaluator: 8 / 10

-replace "terms" with result.

i.e.,
input: 3 + 0.8

-continue until evaluated.

pseudorandom21 166 Practically a Posting Shark

Is "stateB" a constant? The compiler may be whining that you are trying to initialize the array with dynamic data.

pseudorandom21 166 Practically a Posting Shark

May want to check the file stream for errors also.

Could re-design loop to be:

while( inFile >> tempInt )//<-- exits loop on error, possibly what you want.
{
  if( (tempInt + sum) > 1000 )
    break;
  //...
}
pseudorandom21 166 Practically a Posting Shark

I think that happens when an exception is thrown that isn't caught. Had that message from a VS2008 app once before.

pseudorandom21 166 Practically a Posting Shark

Forgot to mention I'm using Windows.

Also, what is the reason for bitwise AND'ing the address of the array with -1UL then XOR'ing it with 0xfff ?

pseudorandom21 166 Practically a Posting Shark

Is there a way to store binary code in memory (as a value) then execute it?

For instance if I have an array of bytes I have filled with the binary code of say, a .exe, is it possible to execute it?

pseudorandom21 166 Practically a Posting Shark

Is there a way to store binary code in memory (as a value) then execute it?

For instance if I have an array of bytes I have filled with the binary code of say, a .exe, is it possible to execute it?

pseudorandom21 166 Practically a Posting Shark

What exactly are you wanting?

What are you having trouble with?

What do you need improvement in?

pseudorandom21 166 Practically a Posting Shark

I agree with using both an "ifstream" and an "ofstream" because it will simplify the process of reading and writing; if one used "fstream" for both i and o, it will most likely complicate things more.

pseudorandom21 166 Practically a Posting Shark

I think the reason to not make it static is so that if creating more than one instance of the class to still enable proper multi-threading for all instances. For some other reason I can't remember I thought it shouldn't be static. If I remember, I'll let you know.

pseudorandom21 166 Practically a Posting Shark

I see this all the time, and I hope by me explaining it, will make it clear to you.

After creating an array like so: char buffer[10] = { 'a','b','c'}; when you use the operator[] ( [ # ] ) you are accessing a SINGLE ELEMENT. No matter how you try to twist the meaning of using the operator[] on a simple array, it always does the same thing.

This is accessing a SINGLE element of the array, and if I did this: std::cout << buffer[1]; it would access the second element of the array, the second character. It would print 'b'.

The operator[] is NOT magic.

Pointers may seem like magic, but they aren't either. In fact, when I learned to program and had the epiphany that nothing about the computer is magic I was also disappointed.

A C style string (sometimes called a C string) is an array of char's with the last character set to 0, or NULL, or '\0'. The program will process characters in a C string until the terminating NULL character is encountered, this avoids needing to specify the length/size of a string. Thus an algorithm can simply process characters until the character NULL is encountered. This is very important for large strings. Variable length strings are used. The string can occupy a part of, or all of (minus the NULL) a character array.

Pascal strings were limited by a value specifying the length, please see this wikipedia …

pseudorandom21 166 Practically a Posting Shark

Yes, thanks for the Exception info, and using delegates to call a function residing on the same thread the control was created is one way.

pseudorandom21 166 Practically a Posting Shark

I do that all the time, except using a Mutex. I'm extremely new to C# and only today learned of the "lock" statement.

From what I've read about multi-threading in C# you may not want your _Status to be static. I searched google again and couldn't find the exact page on it. Remember I'm still new to this C# business. The readonly on the _LockThis puzzles me also.

pseudorandom21 166 Practically a Posting Shark

It's common in my programs to need to share data between threads, I'm looking into the "lock" statement now.

pseudorandom21 166 Practically a Posting Shark

I usually opt to use the Thread class, with mutexes,
http://msdn.microsoft.com/en-us/library/system.threading.thread.aspx
and with a function and delegates.

Delegates will probably be needed to access any controls on your form because the controls must be accessed on the same thread they were created.

You can define a custom delegate for a function you wish to call to interact with your controls, or use a pre-defined one : Action
http://msdn.microsoft.com/en-us/library/018hxwa8.aspx

One can use the form's Invoke() member function to call the functions being "pointed to" by the delegates.

I strongly suggest you read about some Multi-threading fundamentals before attempting this.

Of course that's just one way to do it, I never liked the backgroundworker, personally.

pseudorandom21 166 Practically a Posting Shark

loop through it and make sure at least one character isn't a space would also tell you.

Oh, and it's "Your" instead of "You're", you're = you are

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

What happens when an exception is thrown from within a new thread of execution?

How do I catch it? Must it be within the same thread?

Also, what is the proper way to update a control residing on a form, from within a new thread? I think it would be using a delegate, but I'm extremely new to C#.

pseudorandom21 166 Practically a Posting Shark

I'm quite sure. It's probably what I get for installing the VS2010 SP1 Beta. Have you confirmed that it should be working? If so, I will report a bug.

pseudorandom21 166 Practically a Posting Shark

Is there any way to add a disclaimer using the "Publish" feature of Visual Studio 2010 ?

I just kind of fear someone will claim the application damaged their computer and try to sue me or something, it's unlikely anyone would, but I suppose it could happen.

If not, what is the best way to ensure my application is free software, and that I am not responsible for any "damage" caused by it?

pseudorandom21 166 Practically a Posting Shark

I never expected to have a problem like this, but I get an assertion failure, "string iterators are incompatible" with this slight modification:

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <cctype>

//global operator overload.
bool operator>>(std::string &left, std::string &right){
	typedef std::string::reverse_iterator rit;
	
	if( !left.size() )
		return false;
	
	rit it_begin;
	rit it_end;
	rit it_e_end;//erase section end (whitespace removal)
	rit it;
	std::string::difference_type sum = 0;
	//detect if all spaces.
	sum =
		std::count_if(left.begin(),left.end(), std::isspace);
	if( sum == left.size() ){
		left.clear();
		return false;
	}

	//Loop backward, find first !isspace or begin()
	it_begin =
	std::find_if( left.rbegin(), left.rend(), isalnum );//<---- Error!  Idk why.

	//for(it = left.rbegin(); it != left.rend() && std::isspace(*it); ++it) {}
	//it_begin = it;

	//Loop backward from previous iterator, find first isspace, or begin()
	for( ; it != left.rend() && !std::isspace(*it); ++it) {}
	it_end = it;
	//Loop backward from previous iterator, find first !isspace, or begin()
	for( ; it != left.rend() && std::isspace(*it); ++it) {}
	it_e_end = it;

	//Remove range from left, set right equal to.
	right.assign(it_end.base(), it_begin.base());
	//Erase from ebegin, to end.
	left.erase(it_e_end.base(),it_begin.base());

	return true;
}

int main()
{
	std::string input;
	std::string token;
	std::getline(std::cin,input);
	while(input >> token)
	{
		std::cout << token << std::endl;
	}
	std::cout << "Input size: " << input.size() << std::endl;
	std::cout << "Token size: " << token.size() << std::endl;
}

I've never seen this assertion failure that I can recall, and I made this to test it, and it works just fine:

int main()
{
	using namespace std;
	string input;
	getline(cin,input);

	string::reverse_iterator diff =
		find_if(input.rbegin(), input.rend(),isalnum); …
pseudorandom21 166 Practically a Posting Shark

percent = totalvote;

that isn't correct.

Try making it a percentage based on totalvote and the number of votes they actually got.

pseudorandom21 166 Practically a Posting Shark

Hey guys, I'm making a global operator, and I have a line where I'm comparing a std::string::difference_type to a std::string::size_type, I think the difference_type is usually a signed integer, and the size_type an unsigned..

Any ideas for an algorithm change? Also, there is a lambda function used I would like to remove without adding another function.

Basically the algorithm will malfunction if the std::string &left has only empty spaces,
so there is a count_if() to count spaces and compare the count to the size.

#include <iostream>
#include <string>
#include <algorithm>
#include <cctype>

//global operator overload.
//define STRING_OPER_RIGHT_SHIFT_REVERSE
//if you want "string right" to have the characters
//in reverse order.
bool operator>>(std::string &left, std::string &right){
	typedef std::string::reverse_iterator rit;
	if( !left.size() )
		return false;
	
	rit it_begin;
	rit it_end;
	rit it_e_end;//erase section end (whitespace removal)
	rit it;
	std::string::difference_type sum = 0;
	//detect if all spaces.
	sum =
	std::count_if(left.begin(),left.end(), [](std::string::value_type ch){
		return std::isspace(ch) ? true : false;
	});
	if( sum == left.size() ){
		left.clear();
		return false;
	}

	//Loop backward, find first !isspace or begin()
	for(it = left.rbegin(); it != left.rend() && std::isspace(*it); ++it) {}
	it_begin = it;
	//Loop backward from previous iterator, find first isspace, or begin()
	for( ; it != left.rend() && !std::isspace(*it); ++it) {}
	it_end = it;
	//Loop backward from previous iterator, find first !isspace, or begin()
	for( ; it != left.rend() && std::isspace(*it); ++it) {}
	it_e_end = it;

	//Remove range from left, set right equal to.
	right.clear();
	//Copy from begin to end.
#ifdef STRING_OPER_RIGHT_SHIFT_REVERSE
	right.insert(right.begin(),it_begin,it_end);
#else
	right.insert(right.begin(), …
pseudorandom21 166 Practically a Posting Shark
pseudorandom21 166 Practically a Posting Shark

I agree with cscgal on her thoughts about the two. Fortunately, I will also be attending a university in the fall for CS, so it may become more clear to me.

pseudorandom21 166 Practically a Posting Shark

Just a suggestion since you're using C++, why not use templates instead of void pointers ?

pseudorandom21 166 Practically a Posting Shark

Excellent. Famous people rule.

pseudorandom21 166 Practically a Posting Shark

Use [code] /* code here */ [/code]

pseudorandom21 166 Practically a Posting Shark

There is a "for each" in C++/CLI. In C++ we do have a function named that: http://www.cplusplus.com/reference/algorithm/for_each/