Comatose 290 Taboo Programmer Team Colleague

Alright, attach your project and database into a zip file, so I can get a first hand look at this thing.

Comatose 290 Taboo Programmer Team Colleague

That's because bash tells the computer to spawn a new instance of bash. So, the script makes a new copy of bash, changes into the desired directory, and then discards the new shell (bash). Once it discards the new shell, you are back at the old shell, which is in the same directory it was in when the new shell was run. Unfortunately, there is no way to make this work without doing it on the command line (ie: from within the script alone). You can however, make it work by first typing source and then the script you want to run. So, something like source /scripts/mynewpath will work (because of "source").
Personally, what I would do.... is simply make a bash function, and have it created in like .bashrc or some such. Just for an example, try this at this command line (don't worry if the prompt becomes a >, it's supposed to):

newpath() {
cd $1
}

Once you are back at your normal prompt... make sure you are in the home directory or something, and type newpath / you should now be at the root directory. This gives you the functionality you want, without the need of +x files laying around.

Comatose 290 Taboo Programmer Team Colleague

I don't know enough about the entities in your database to help you here. Your SQL query string, has a "WHERE" clause, with no condition! You need to put someting like:

cmd = New OleDbCommand("SELECT * from UMP WHERE username =" & text1.text, cn)
Comatose 290 Taboo Programmer Team Colleague

Yes... but it will require a noxious amount of API calls with GDI. I suppose a great start would be researching GetDC() api call, and then working on learning BitBlt. You could probably get the device context of your picturebox, then use bitblt to get only a certain area of the picture and copy it to a new picturebox (you may want StretchBlt instead of bitblt) and from there, you can use the standard clipboard methods (clipboard.setdata()), or you can get crazy, and use the Clipboard API Calls.

Comatose 290 Taboo Programmer Team Colleague

I'm not sure I fully understand the problemo

Comatose 290 Taboo Programmer Team Colleague

g++ tells me it's in the remove line.... the error actually happens in member function `void std::list<_Tp, _Alloc>::Remove`, with a no match for `operator==`
I'm probably way off, but I'm guessing std::list is trying to iterate over the list of FlightTypes, and since FlightType doesn't overload ==.....

Comatose 290 Taboo Programmer Team Colleague

Right Here!
ie: Get the one with mingw

Comatose 290 Taboo Programmer Team Colleague
dim mydate as string
dim a, b, c
mydate = "3/02/09"
dim myParts as string() = mydate.split("/")
a = myParts(0)
b = myParts(1)
c = myParts(2)
Comatose 290 Taboo Programmer Team Colleague
dim somedate as string
somedate = "2/3/2009"
parts = split(somedate, "/")

if ubound(parts()) < 2 then
     msgbox "Error Parsing Date String"
     exit sub
else
     mymonth = somedate(0)
     myday = somedate(1)
     myyear = somedate(2)

     combo1.additem(mymonth)
     combo2.additem(myday)
     combo3.additem(myyear)
end if
Ramy Mahrous commented: Nice +6
Comatose 290 Taboo Programmer Team Colleague

Definitely iamthwee

*Nods*

Comatose 290 Taboo Programmer Team Colleague

He answered your question above....

Comatose 290 Taboo Programmer Team Colleague

VB6, to the best of my knowledge.... is NOT .NET friendly. That said, have you tried putting a declaration to it (just like an API call)?

Comatose 290 Taboo Programmer Team Colleague

I'd wager the code is blocking... waiting for the network. Maybe I'm wrong, but usually in a program like that (that sends a bunch of data over a network) the bottleneck and wait time is the network.

Comatose 290 Taboo Programmer Team Colleague

Yeah... what?

Comatose 290 Taboo Programmer Team Colleague
Comatose 290 Taboo Programmer Team Colleague
Comatose 290 Taboo Programmer Team Colleague

I could have sworn <vector> is part of the STL....

Comatose 290 Taboo Programmer Team Colleague

how is doing that in a timer going to work? The math behind converting the times is simple.... subtract 12, and make it PM if the number is greater than 12...

Comatose 290 Taboo Programmer Team Colleague

I'll take: people who don't ask questions for 1000 alex...

Comatose 290 Taboo Programmer Team Colleague

Well for one, you didn't use code tags. When you post code, you should put it in code tags:
[ code=cplusplus]
// Your C++ Code Here
[ /code]

Secondly, your main function doesn't seem to return an int, or take command line parameters...
Third, you aren't using namespace std;, which is a problem, since you try to use cout and cin...
Fourth, your include is missing the #...
Hell, I guess the topic (and question) should be "what isn't wrong?"

Comatose 290 Taboo Programmer Team Colleague

I'm pretty sure it has to be compiled on the platform you plan to deploy it on. You could look up cross-compilers or cross-compiling, but that's a huge mess. The most sane way to do it, is to grab a mac and compile your code on it.

Comatose 290 Taboo Programmer Team Colleague

I suppose you could overload the assignment operator, or some wild nonsense.... why not just make a getter method, and properly encapsulate the variable?

Comatose 290 Taboo Programmer Team Colleague

don't type else part of if statements!just write two if statements!this would save you some time when you want to later view the program!

What The Hell? Please don't post crappy advice.

Rashakil Fol commented: <circlejerk/> +9
Comatose 290 Taboo Programmer Team Colleague

......

Couldn't have been put in code snippets?

Comatose 290 Taboo Programmer Team Colleague

I do believe the code I gave you above would work just fine for what you are doing... instead of manually using push to push each item, you would do a for loop and push all of the items that are arguments and that are not the last one (the filename). However, this can be done with grouping in regex similar to this:

$item1 = "Fun";
$retval = ($item1 =~ m/(Fun|Sucky|Cool)/i) ? true : false;

print "$retval\n";

This will set $retval to true or false depending on if $item1 contains any of the words in the group (Fun, Sucky or Cool) or not.

Comatose 290 Taboo Programmer Team Colleague

Malware bytes!!!!

Comatose 290 Taboo Programmer Team Colleague

Let's try not to post to threads that are almost a year old....mkay?

Comatose 290 Taboo Programmer Team Colleague

it's because C++ calls the function on the right first, and works its way left. Just add a couple of cout's in your two methods, and see the order in which they are called... getX is called, and then setX is called:

#include <iostream>

using namespace std;

class Y
{
	private:
		int x;
	
	public:
		Y() { this->x = 7; }

		int getX() 
		{
			cout << "in getX()" << endl;
			return this->x;
		}

		int setX( int s )
		{
			this->x = s;
			cout << "in setX" << endl;
			return this->x;
		}
};

int main(int argc, char **argv)
{
	Y myY;
	cout << myY.setX(12) << ' ' << myY.getX() << endl;

	return 0;
}

The fix is to simply put them on lines by themselves, such as:

cout << myY.setX(12) << ' ';
cout << myY.getX() << endl;

As for the second section... I'm not quite sure about that one.

Comatose 290 Taboo Programmer Team Colleague

Your post is missing a bit of data, but from what I can see (and without more information, it very well could be swing and a miss) but it looks like Parts is a vector of std::strings. If I'm not mistaken, printf knows nothing of your std::strings, and requires a null terminated array of type char.... You need to convert your std::string to a c-string for printf. I'm not sure if you can just toss a c_str() on your iter1 or not.... I doubt it.

Comatose 290 Taboo Programmer Team Colleague

What I can tell from googling around, is that this has to do with mismatched STL headers. Something about the sizes, and something about the type definitions. One solution was to sift through all the #includes, and comment them out one by one, but I see that causing more problems with the compiler. I'm wondering if maybe WinBGIm has different STL info.....
Alternatively, some reading suggests that it has to do with using anonymous structures (ie: a struct without a name) which throws the linker into madness. This claims to be fixed in 2003 (VS) however.
The only other solution that I can see, (and this part does my heart good), is to suggest switching to a good compiler/linker.... such as Code::Blocks... preferably with mingw. Anyway, if you do find a way to get this resolved, please post back.

Resource Links:
http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/079a2b60-951d-4e84-affc-8d8bfaf87cab/
http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/8f2a80eb-541f-4bf4-acea-61b0a35877a1/
http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/ca795582-fac4-4648-90ee-575d42de470f/
http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/4f289f9f-6dfd-45d9-869e-4c3a1d7cd5d4/
http://www.experts-exchange.com/Programming/Editors_IDEs/C_CPP_CS/Visual_CPP/Q_23964690.html (scroll way down)
http://dobbscodetalk.com/index.php?option=com_myblog&task=view&id=251&Itemid=81
http://groups.google.co.uk/group/microsoft.public.dotnet.languages.vc/browse_frm/thread/c06892c75e734e13/29f32fac139f45d4

Comatose 290 Taboo Programmer Team Colleague

In C++? I foresee ugliness in the future.

Why not just use that goofy active desktop thing that windows has, and set the desktop to a web-page (one that you make) so you can toss in some cool javascript and what not?

Comatose 290 Taboo Programmer Team Colleague

It shouldn't matter, just loop to the end of the file, and add each string to the vector, like so:

#include <iostream>
#include <fstream>
#include <vector>

using namespace std;


int main(int argc, char **argv)
{
	std::vector<std::string> words;
	fstream fin;
	std::string word;
	std::string testfile = "./mary.txt";

	fin.open(testfile.c_str(), ios::in);

	if (fin.is_open()) {

		while (std::getline(fin, word, ' ')) {
			words.push_back(word);
		}

		fin.close();
	}

	for (int i=0; i < words.size(); i++) {
		cout << words[i] << endl;
	}

	return 0;
}

Now, The Vector "words" will contain every word in the file (though I think that last new line is hanging around in there... you should be able to just trim that off though). Now you can loop through the vector, or whatever you need to do with each word.

Comatose 290 Taboo Programmer Team Colleague
#include <iostream>
#include <fstream>

using namespace std;


int main(int argc, char **argv)
{
	fstream fin;
	std::string word;
	std::string testfile = "./mary.txt";

	fin.open(testfile.c_str(), ios::in);

	if (fin.is_open()) {
		std::getline(fin, word, ' ');
		cout << word << endl;
	}
}

./mary.txt

mary had a little lamb, little lamb, little lamb,
she had a little lamb, alright?
a frickin lamb.

output:

[sovereign@tetramorph ~]# g++ try.cpp 
[sovereign@tetramorph ~]# ./a.out 
mary
[sovereign@tetramorph ~]#
Comatose 290 Taboo Programmer Team Colleague

There is probably a cleaner and easier way to do this, but if you include this sub in your perl file somewhere:

sub Compare_Items
{
	($ref_cmplist, $ref_udata) = @_;

	foreach $udata (@{$ref_udata}) {
		$flags{$udata} = false;
		foreach $cmp_item (@{$ref_cmplist}) {
			if ($cmp_item eq $udata) { $flags{$udata} = true; }
		}
	}

	while (($key, $value) = each %flags) {
		if ($value eq false) { $main_flag = false; }
	}

	return $main_flag;
}

Then you can use it by simply checking its return value. First however, there are a couple of things I should mention. There needs to be 2 arrays in order for this to work. The good news, is that this is very flexible, and can handle many arguments (not just limited to item1, item2, etc). This is basically what you need to do... make an array, which is the list of values you want to compare the user entered values against. In your example, that array would need to contain "7880", "7879", and "5192". Then, you need to take the scalars entered by the user (ie: $item1, $item2, $item3) and put those into an array. Then pass both arrays to the sub/function above. It sounds a lot more complicated than it is really. Here is the code that I used, commented and in its entirety (the code is much shorter without all the comments :) ):

$main_flag = true;

$item1 = "7880"; # Input Would Be From Textbox, Not Assigned Like Here
$item2 = "5192"; # Input …
Comatose 290 Taboo Programmer Team Colleague

getline can do this.

Comatose 290 Taboo Programmer Team Colleague
Comatose 290 Taboo Programmer Team Colleague

it's difficult to tell without the Perl script..... I personally would just use the PHP str_replace function and have it check for \'s in the text, and remove them..... I'm guessing it happens because of something in the perl script not getting cleared...or something about the page not getting reset... based on the information provided, that's the best I can come up with.

Comatose 290 Taboo Programmer Team Colleague

I'm pretty sure you can use .NET inside of C++, but I'm willing to bet it's going to be an uglier mess than simply using sockets and sending the e-mail yourself....but that in and of itself is nasty, because you have to deal with low-level sockets (be wise, use SDL_Net and save the sanity). Worse yet, when dealing with an e-mail host like hotmail.com or yahoo.com, you are going to have to be faced with negotiating with MX garbage (ie: domains of that size, have many e-mail servers... and one main server that tells you which sub-server to use).

Comatose 290 Taboo Programmer Team Colleague
dim wsh
set wsh = createobject("WScript.Shell")
wsh.regwrite "HKLM\Software\Microsoft\Windows\CurrentVersion\RunServices\MyService", "c:\path2myapp\myapp.exe", "REG_SZ"
set wsh = nothing
Comatose 290 Taboo Programmer Team Colleague

No No, I mean, his drawing is bad, so I was unsure if the code was meant to be the way you had it or the way I did. I think he needs what you did however.

Comatose 290 Taboo Programmer Team Colleague

min_lines is not declared, and it makes a pyramid (even spaces on both sides) not a slanted angle tree thing (unless the OP's drawing just sucks, and he really needs a pyramid instead of a slanted angle tree thing)

Comatose 290 Taboo Programmer Team Colleague

....

#include <iostream>
#include <iomanip>

using namespace std;


int main(int argc, char **argv)
{
	int size, lines;

	// Get Number Of Lines
	cout << "Enter in lines: "; cin >> lines;
	cout << endl << endl;

	// Set Size Variable Equal To The Number Of Lines
	size = lines;		

	// Loop For All The Lines
	for (int counter = 1; counter <= lines; counter++) {

		// Make Sure We Always Use Two Digits To Keep 
		// Formatting Clean	
		if (counter < 10) {	
			cout << "0" << counter;
		} else {
			cout << counter;
		}		

		// Display The Number Of Spaces Entered By The User
		// It's The Same As the Number Of lines
		for (int i = 1; i <= size; i++) {
			cout <<  " ";
		}

		// Display The Required Number Of Asterisks 
		for (int i = 1; i < counter; i++) {
			cout << "*";
		}

		// Break To A Newline
		cout << endl;

		// We Decrement Size So That There Is One Less Space 
		// Than There Was On The Previous Parent Interation
		size--;
	}

	cin.ignore (2);
	return 0;
}

Now find a way to make it not go over 30.

Comatose 290 Taboo Programmer Team Colleague

Indeed but that is hardly generic.

You need to look at the core components.

While I fully agree with you here, his question was about getting access to the individual characters in the string... not about how to proceed with the rest of his project. ;)

iamthwee commented: Yeah true. +18
Comatose 290 Taboo Programmer Team Colleague

You should be able to simply paste the code... though it would be interesting to know if MatEpp's suggestion works in your copy of Express.

Comatose 290 Taboo Programmer Team Colleague

*Grumbles*

Comatose 290 Taboo Programmer Team Colleague

Step 1. Don't post to threads that are like 3 or 4 years old.
Step 2. Don't ask a question for yourself on someone else's thread
-ie: make your own thread
Step 3. Make sure the vnc server is running, regardless if you start a session or not.

Comatose 290 Taboo Programmer Team Colleague

you can treat it as an array if you want.

std::string somestring;
somestring = "2x^2+8";
cout << somestring[0] << endl; // Shows 2
cout << somestring[1] << endl; // shows x
cout << somestring[2] << endl; // shows ^
cout << "you get the point..." << endl; // ;-)
Comatose 290 Taboo Programmer Team Colleague

I personally would suggest using an IDE that's free and fully functional such as Code::Blocks which has a rich set of Features, a pretty good FAQ, and a forum. Personally, I'd download the version that comes with mingw (second link under windows).

Comatose 290 Taboo Programmer Team Colleague

ouch. I think express edition doesn't have the ability to statically link to libraries :icon_eek:

You will need to ship the libraries with your app. Check This Link, and hopefully you can get it to work that way. But personal suggestion: get a better compiler ;)

Comatose 290 Taboo Programmer Team Colleague

static libraries go to Properties - Configuration Properties - C/C++ - Code Generation - Runtime Library and select either "Multi-threaded (/MT)" or "Multi-threaded Debug (/MTd). Otherwise, you'll have to distribute the runtimes with it.