WolfPack 491 Posting Virtuoso Team Colleague

Mike has summarized the process very nicely. If you wish to go into more details, I would recommend "Cross-Platform Development in C++: Building Mac OS X, Linux, and Windows Applications". I sort of learnt the process that Mike described through this book.

WolfPack 491 Posting Virtuoso Team Colleague

What you need to do is adjust 24 so that the string "$" is positioned making allowance for (number of digits before the decimal point ) + 3 digits.
Why 3? Decimal Point + 2 Digits after the decimal place

So in this case, it should work if you wrote
cout << "Shelby" << setw(24-5) << "$" << shelby << endl;

Now to figure out the number of digits before the decimal point.

if( 0 < value < 10 )
    x = 1
if( 10 <= value < 100 )
    x = 2
cout << "Shelby" << setw( 24 - (x + 3) ) << "$" << shelby << endl;
WolfPack 491 Posting Virtuoso Team Colleague

Once you change the scope of account_number, balance and passw to private scope,
you won't be able to access them directly from main().
So you will have to add public accessor functions for each of the above data members, and call them in main().

example:

class account{
private:
      int account_number; //account_number's scope is private

public:
      int GetAccountNumber( ){ return account_number; } // public accessor function
 };

 void main()
 {
 ...
        //if(acno==uxi[i].account_number) // Can't access account_number directly
        if(acno==uxi[i].GetAccountNumber())//Using the public accessor function instead
}
WolfPack 491 Posting Virtuoso Team Colleague

Just noticed, there seems to be a small typo.
It should be
newChars[j]= *alphabet[j].c_str();

WolfPack 491 Posting Virtuoso Team Colleague

getVerticeById is clearly O(n).
The part below of ListAdjGrafo<TV,TR>::distancia seems to be of O(n^{2}) complexity because of the cascading while loops.
So this algorithm is at least O(n^{4}) complexity.
Final answer would depend on the complexity of encvert_key , encvert_conteudo and distanciaMinimaVertice What relation does indice_origem have with the inputs ini and fim ?

Vertice<TV, TR> *apvertini = encvert_conteudo(ini); // O(? )
    Vertice<TV, TR> *apvertfim = encvert_conteudo(fim);// O(? )

    int indice_origem = apvertini->key;
    distancia[indice_origem] = 0;

    while (indice_origem != -1){ //  O(n2) because of the inner while loop called by this while loop.
        processados[indice_origem] = true;
        apvertini = encvert_key(indice_origem); // O(?)
        Ramo<TV, TR> *apramo = apvertini->apramo;
        while (apramo != NULL){ 
            int indice_destino = apramo->apv->key;
            if (!processados[indice_destino] && distancia[indice_destino]>(distancia[indice_origem] + apramo->rconteudo)){
                distancia[indice_destino] = distancia[indice_origem] + apramo->rconteudo;
                caminho[indice_destino] = indice_origem;
            }		
            apramo = apramo->apr;
        }	
        indice_origem = distanciaMinimaVertice(distancia, processados);	//O(?)	
    }

It is a bit difficult to explain unless I write a tutorial on O-notation which I am incapable and not interested in doing.
Also there are a lot of tutorials out there, so if you have read them, it is just a matter of learning how to apply them which I can't teach you anyway. here is one.

WolfPack 491 Posting Virtuoso Team Colleague

Refer this link. It has most of the code that you need to implement a simple server/client to send/receive text.

You don't always have to do the busy for loop. You could just open the socket in blocking mode and wait until text arrives (research blocking). However, this will cause the receiver to halt its execution until something comes its way, so if you plan to do something else with your program as it waits for data, you should consider using a separate thread to do the waiting part.

As an alternative, Winsock has the WM_SOCKET_NOTIFY event that can be used to get notifications when an event for that socket has occurred. This will allow you to do other things, and switch to the data reading part when it actually arrives. But designing this a bit involved if you have no experience with the Windows API.

WolfPack 491 Posting Virtuoso Team Colleague

No. I use visual studio. What problems are you facing when you follow the given link? Please be as descriptive as possible.

WolfPack 491 Posting Virtuoso Team Colleague

Since I am in Japan, I have no experience with the changes made by Google.

But a simple collection of keywords may have worked before to get traffic, but now, quality will have to be given importance above quantity. Not only the answers, but also the questions. I rarely wander out of the C/C++ forums, and there I think 90% of the questions are beginner level questions. Even then, considering the simplicity of the question, the depth of the thread is ridiculously too long. It takes at least 3-4 posts to get the OP to post some code. Developers don't have time to wade through dozens of pages to find a solution. It gets boring and wastes time. That is why Wikipedia is in the top of the search results. It may not have the complete answer, but it is a great starting point for anyone who is not a free loader. I for once haven't come across Daniweb during my work related Google searches. My main hits have been Wikipedia, Stackoverflow, Embedded.com etc. And they point me in the correct direction.

I read in a previous thread, that Dani has made changes targeting more advanced developers from the US/CANADA to post here more, so things will improve. But it won't be easy to reverse the damage the broken English homework students have done in these past 5-6 years.

Moderators will have to pay a lot of attention on the quality of the answers and …

AndreRet commented: I agree 100% +0
WolfPack 491 Posting Virtuoso Team Colleague

The problem must be with how the assignment operator (operator=) is implemented. Is there any documentation regarding that?

daviddoria commented: Thanks, that was exactly the problem! +5
WolfPack 491 Posting Virtuoso Team Colleague

Isn't tagging it incorrectly, like posting C/C++ posts in the Web Development forum?
What is this user's deal anyway? What possible interest can he have in retweeting Daniweb posts blindly like that? And why #webdevelopment. I would ask him, but don't know who he is. Any ideas?

WolfPack 491 Posting Virtuoso Team Colleague
/bin/sh: g++: not found

means just that. Eclipse IDE can't find the compiler. Read the setup instructions carefully.

WolfPack 491 Posting Virtuoso Team Colleague

What if I were to wear a wig and a dress, would that help? :)

Even a kilt would do. :D

WolfPack 491 Posting Virtuoso Team Colleague

Doing fine. Thanks. Trying to get back to my regular posting habits. :D
Ah yeah. Recognized you. Lost you the first time while scanning for good looking chicks who are into programming. ;)

~s.o.s~ commented: WB Wolfy ;-) +0
WolfPack 491 Posting Virtuoso Team Colleague

It is a fairly basic programming exercise on loops.
If you Google you could easily find the answer.
Post the work you have done so far for this assignment.
Someone will help you with the places you are stuck.

Nick Evan commented: Good to see you back! +12
kvprajapati commented: N/A +9
WolfPack 491 Posting Virtuoso Team Colleague

Either you didn't know that you should use braces, or you forgot.

for (int i=0;i<rollsize;i++)
{
    switch (rolls[i])
    { // Forgot this
        case 3:allresults[0] = allresults [0]+1; break;
        case 4:allresults[1] = allresults [1]+1; break;
        /* ......... */ 
        case 17:allresults[14] = allresults [14]+1; break;
        case 18:allresults[15] = allresults [15]+1; break;
    } // And this
}
WolfPack 491 Posting Virtuoso Team Colleague
Sulley's Boo commented: Konnichi wa Wolfiiiiiiiiiiiiiiiiii .. Shibaraku desu ne .. +4
WolfPack 491 Posting Virtuoso Team Colleague

make the following changes to the set function.

void LList::set(int c, int val)
{
	int i = size-1;
	current = head;
	while ( current != NULL )
	{
		if(i==c)
		{
			current->data = val;
			//cout<<current->data;
			break;
		}
		else
		{
			current = current->next;
			i--;
		}
	}
}

You can easily debug these type of programs by using cout . Next time when you are programming, check function by function first before debugging the whole program at once. Also, you are using too many member variables.

  • You are not using tail anywhere.
  • current and degree should not be member variables. They should be variables defined inside the functions. Having current and degree as member variables will give you some very hard to find bugs because they can be used and updated from any function and it is hard to keep track.

Figure out the way to stop printing the last + character. It can be easily done by having a check to find out if current->next is null or not.

Sulley's Boo commented: =D +4
WolfPack 491 Posting Virtuoso Team Colleague

congratulations! It works, albiet a bit inefficient.
As I said before, the only reference needed was x
and you pulled that one in as a value!
All you are doing by taking in all those other unneccessary references is to bring the variable scopes INSIDE the function. It works just as well if the variables were set as global. Aguments pass things in, not out!

I get the feeling that you have missed this point.
good luck.

No he has not missed the point. You have. Arguments can be used to pass things both in and out. Passing by reference can be used to get things out. It is also memory efficient because another copy of the variable is not created in the stack like it is done when you use passing by value.

invisal commented: That's why I don't get his point. +3
WolfPack 491 Posting Virtuoso Team Colleague

Didn't your professor or anybody else at least tell you about this awfully fun site called http://www.google.com/ where you can type A-Star Algorithm in that cute little white box and press search to get some really nice links with more than enough information?

Salem commented: Yes indeed. Some people lack the basic nouse to go do some independent research on their own. +15
WolfPack 491 Posting Virtuoso Team Colleague

I don't see any problem except, you are using <iostream.h>.

What problems are you having?

WolfPack 491 Posting Virtuoso Team Colleague

1. post more.
2. get reputation more.
3. live longer.

Jx_Man commented: thx for answer +1
Aia commented: ...Or don't piss off any one else. ;) +5
WolfPack 491 Posting Virtuoso Team Colleague

Documentation is not written by the developers for fun you know. Unless you are using fairly well known, well established APIs like the Windows API, the chances that someone who has used the library that you are using reads this post is fairly low. So when you are using a third party library, remember that there is no better help than the documentation provided with it.

In this particular case, you can use functions like GetBlock or GetChar to receive data from the buffer.

invisal commented: I agree +3
WolfPack 491 Posting Virtuoso Team Colleague

If you have no previous knowledge of C++ the best thing will be to start by learning C++. The link has information about editors and compilers needed to write, compile and execute C++ programs. Do you at least know C?

WolfPack 491 Posting Virtuoso Team Colleague

Well, you could do that programmatically, but you will need administrative priviledges for that. Wouldn't it be easier to let the user unblock the application by his own accord? After all it is his computer, and it only takes one click of a button.

Sulley's Boo commented: riiiiiiiiiiight! Happy new year Wolfiiiiiii! :cool: +4
WolfPack 491 Posting Virtuoso Team Colleague

Something like this will be easy. There are more compilicated methods if you want to break Japanese or Chinese words. Also you can use a callback function to count the words on the fly, but I think this is the most simple way.

#include <string>
#include <sstream>

// Get the line from the Rich Edit Control .
// Let's hard code it for this example.
	std::string line = "In    that         case   this   sentence    has 27 words.\r\nThis is another line";
	std::stringstream ss(line);
	std::string word;
	int count = 0;

	while ( ss >> word ){
		std::cout << word << std::endl;
		count++ ;
	}
	std::cout << count << std::endl;
iamthwee commented: I approve. +13
Sulley's Boo commented: me too =D +3
WolfPack 491 Posting Virtuoso Team Colleague

I have forgotten all my Java, so the code may give you compile errors and you will have to fix them on your own. However the algorithm will be the same

Try a loop like this.

int x,y; \* Make these integers */
System.out.println("Enter a positive integer: ");
x=Interger.parseInt(input.readLine()); \* Get the user input to x. Used ParseInt to read it from the console. */

if ( x > 0) 
{
	for(y=-x+1;y<x;y++ )/* See the limits used for the loop.*/  
	{ 
        int i ; 
        for (  i = 0; i <= Math.abs(y) ; i++ ){
		System.out.println( i+1 );         
	}
        System.out.println( '\n' );  /* You need a newline at the end of the loop or you will get everything in one line */
	}
}

I guess the above should work. At least the algorithm should.

~s.o.s~ commented: Huh? A wolf in Java land! ;-) +20
WolfPack 491 Posting Virtuoso Team Colleague

C++ does not give you a method out of the box for multithreading like Java does.
To use multithreading, you will have to use the thread libraries offered by the operating system. For win32 you will have to use CreateThread and in unix you will have to use pthread_create .
I think the boost package offers portable ways of creating code that uses threads.

Jishnu commented: Nice one.. Helped me too :) +2
Haranadh commented: Nice point. thanks to refer boost lib info also. +1
WolfPack 491 Posting Virtuoso Team Colleague

The usual reason is that you are not including the library that provides the implementation of pthread_create() . Check the documentation for pthread_create() and find out the required library. Then check if that library is in the makefile's libraries section.

WolfPack 491 Posting Virtuoso Team Colleague

May be nothing, but this is what I see when I open the top link of this google search result in Firefox 2.0.0.6 on Windows Server 2003 Remote Desktop Login. Didn't see it by entering the link directly from the browser address box.

Dani commented: Thanks for the catch. +10
WolfPack 491 Posting Virtuoso Team Colleague

User notes are administrative notes about a particular user that can be updated and read by any administrative staff member. These maybe helpful to the same or another administrative staff member when making decisions regarding that user at a later time

Sulley's Boo commented: :D +3
WolfPack 491 Posting Virtuoso Team Colleague

Get the return value of GetPixel and RGB functions to seperate variables. See if the values are infact what you expect, rather than just comparing them.

Also read the remarks section of the GetPixel documentation.

iamthwee commented: c o r r e c t . +12
WolfPack 491 Posting Virtuoso Team Colleague

This snippet sends the string at zero based index 3, to the position at index 0.

HWND hList = GetDlgItem(hwnd, IDC_LIST);
char buf[100]="";
SendMessage(hList, LB_GETTEXT, (WPARAM)3, (LPARAM)buf);
SendMessage(hList, LB_DELETESTRING, 3, 0);
SendMessage(hList, LB_INSERTSTRING, 0, (WPARAM)buf);

The original order of 0 1 2 3 4 5 will endup with 3 0 1 2 4 5

WolfPack 491 Posting Virtuoso Team Colleague

Densha otoko remake? I guess that was the inspiration behind your nickname (Orewa Cho Otoko Da? )

Aia commented: Let's make it count. +6
WolfPack 491 Posting Virtuoso Team Colleague

What happended to
1. Test that you are not reproductively challanged
2. If 1 is false, say bye bye to your fatherhood dream
3. Get a Girlfriend
4. Test that she is not reproductively challanged
5. Repeat 3 and 4 until 4 is true
6. Get Married (I am a conservative)
7. Do it without protection until the wife gets pregnant
and those stuff?

Must be difficult to fit it into the alphabet I guess.

joshSCH commented: This is for reading Siddhartha :) +11
WolfPack 491 Posting Virtuoso Team Colleague

Yeah. Post in a geeks lounge thread, and say I agree. That will get you all the reputation you need.

Serunson commented: i loved ur idea! +3
WolfPack 491 Posting Virtuoso Team Colleague

Must be talking about the Internationally Reputed Criminals. Yeah nobody likes them.

arjunsasidharan commented: ;) +3
WolfPack 491 Posting Virtuoso Team Colleague

Nurses always seem to be hot over here for some reason. It's a phenomenon I've observed over my lifetime.

I bet it has something to do with their uniforms. A girl who doesn't look good in a nurse's uniform is beyond help.

Aia commented: Ha,ha,ha. +4
WolfPack 491 Posting Virtuoso Team Colleague

First debug it part by part and localize the error. Without knowing what is expected for the output, we are not in the position to debug all that long code. So you will be better off doing it yourself.

You should have compiled and tested it part by part in the first place, while writing that code. Compiling once after writing all that code, and then dumping the code into a IT forum is not the way to be a programmer.

Salem commented: Damn straight on the code "dumping" +7
WolfPack 491 Posting Virtuoso Team Colleague

They are helped, and they give positive rep, but It doesn't count for anything.

Who says they don't count for anything? The people who helped them don't care about the color of the dot. They will care about the gratitude of the OP, and the positive comments they leave. If I remember correctly, the first reputation I recieved was also gray, but it had a very good positive comment on the lines of "Helping the OP without giving any code", i.e. showing the way. Man didn't that feel good. If a moderator or someone with higher reputation power that frequents that forum thinks it fit, they will hand out reputation for that particular helpful post, and it will increase the reputation count. I think that was Dani's philosophy in making the whole reputation handling business public. Other people can judge the post by looking at the reputation received for that post, and by whom it was given. And if they too find it helpful, they will handout some reputation too.

I think I said in a previous post, I count a single grey reputation from a newbie that I help worth more than the 200 or more points I received during the past few months in the geeks lounge.

Dani commented: You're right about my philosophy +10
Aia commented: Mine is not grey, but I hope it will count for you. +2
WolfPack 491 Posting Virtuoso Team Colleague

Unless you want boiled meat balls for dinner I suppose.

arjunsasidharan commented: hee hee.. :D +3
WolfPack 491 Posting Virtuoso Team Colleague

For god's sake people. Let's stop joking and wait till the OP posts his code? This is not the geek's lounge for crying out loud.

John A commented: Whew, thank you for some common sense. +13
WolfPack 491 Posting Virtuoso Team Colleague

Who cares about geek lounge reputation anyway?

Even a grey coloured thanks rep from a newbie in the C/C++ forums are worth a 100 "I agree" reputation points in the geeks lounge to me.

Laughing out loud. Looking at the latest negative reputation I receieved for the above post, I think someone (I am not naming names) who takes the geeks lounge rep very seriously, as that is the only way she gets her (Yeah, you now know who) much needed reputation, is very very vexed.
:D

jbennet commented: lol +14
arjunsasidharan commented: ;) +2
WolfPack 491 Posting Virtuoso Team Colleague

Who cares about geek lounge reputation anyway? It is the reputation points and comments of Narue (has never given me anything), Salem and the rest of the regulars, that I get in the C/C++ forums that I really care about. Even a grey coloured thanks rep from a newbie in the C/C++ forums are worth a 100 "I agree" reputation points in the geeks lounge to me.

Ancient Dragon commented: agree -- rep not relevant in geeks lounge +14
~s.o.s~ commented: Disclaimer: This rep doesn't count. ;-) +19
Serunson commented: thanks for the rep +1
christina>you commented: Yes. Good explanation. -2
Sulley's Boo commented: :D :D :D :D .. +3
arjunsasidharan commented: Wolfpack you never fail to amuse me :D +2
WolfPack 491 Posting Virtuoso Team Colleague

Duh. Here is an attachment from google groups.

christina>you commented: you're dumb -2
Rashakil Fol commented: dumb like a fox! +6
~s.o.s~ commented: Equalizer is a must. Peace :-) +19
WolfPack 491 Posting Virtuoso Team Colleague

That wasn't so obvious... ;-)

You obviously don't use MSN Messenger ;)
I can even see the rose petals in (F).

Sulley's Boo commented: haha Wolfyyy is da maaaaan +3
WolfPack 491 Posting Virtuoso Team Colleague

As for the idea, I don't have any problem with it. But it can be subjective, like increasing or decreasing the font face or color.

As for the colors, it would be good if the colors were different instead of using different shades of the same color ( eg. Software Development and Site Management are of the same color green, but with different shades as I see it). But it doesn't look that bad.

However the IT Water cooler color ( Dark Pink/Maroon ) is a bit too strong for my canine eyes.

Sulley's Boo commented: yeppeeeeee finally it allowed me =D .. :) +3
WolfPack 491 Posting Virtuoso Team Colleague

I was just having a look at the BBC new headlines today morning, when the talk about Yahoo and Microsoft potentially pairing up caught my eye. Obviously this was a step taken to curb the rise of Google in the web search market, and shares of Yahoo has gone up by 14% as a result of this. What do you people think about it? Love to hear your opinions.

~s.o.s~ commented: Oh I am having a pricky conscience doing this.. ;-) ~s.o.s~ +18
WolfPack 491 Posting Virtuoso Team Colleague

Are you saying I am not productive enough?

~s.o.s~ commented: I don't believe I am doing this... ;-) ~s.o.s~ +18
WolfPack 491 Posting Virtuoso Team Colleague

lol

~s.o.s~ commented: Hey you might just get banned, lol is a taboo here ya know ;-) +18
Sulley's Boo commented: "spread is off, would love if some one gave me a lot of rep for all the posts I have made." :D :D :D +3
WolfPack 491 Posting Virtuoso Team Colleague

argv[ 0] is the program name. You can see the contents by using this line

printf( "%s", argv[ 0 ] );

To get the first argument, and convert it to an integer, try this code.

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
    int seconds = atoi( (argv[1]) );
    printf("%d", seconds);
}
John A commented: Good to see you around, Wolfy --joeprogrammer +8