Salem 5,265 Posting Sage

> it says error
How many ; should a loop have?

Salem 5,265 Posting Sage

I've written more coherent stuff by falling asleep on the keyboard than that.
http://www.catb.org/~esr/faqs/smart-questions.html#writewell

> 2.balance enquiry
You have $0

> 3.fund transfer
Read an amount, and add to balance.

> 4.view mini transaction..
Your turn

Salem 5,265 Posting Sage

> for (count < numOfStars; ++count;)
The general syntax for a for loop is
for ( initialisation ; comparison ; step )

Which part is your "comparison" ?
Which part should be the initialisation?

Salem 5,265 Posting Sage

http://sourceforge.net/apps/mediawiki/cpwiki/index.php?title=Indentation
Your code is basically unreadable without a lot of effort on our part.
The kind of effort which makes us find something else to do.

Salem 5,265 Posting Sage

You forgot to ask a question.

Note that questions along the lines of "can you write..." are not the sort of questions which will draw a response you'd like.

You also didn't read this.
http://www.daniweb.com/forums/announcement14-2.html

Salem 5,265 Posting Sage

Does system::string have anything in common with std::string ?

In which case, perhaps it has a method like this.

ifstream waveFile ( open.FileName.c_str() );
Salem 5,265 Posting Sage

- run task manager
- select the processes tab
- order by CPU usage

Salem 5,265 Posting Sage

http://www.daniweb.com/forums/thread117.html

7.5 YEARS!
And for what - a helpless "plzgimmetehcodez" homework dump.

Salem 5,265 Posting Sage

It's because you do that for EVERY node.

Your function should be

void filePreOrder(BufferedWriter bufferedWriter)

so that you have just ONE file instance you pass through the tree, writing to as you go.

The caller is responsible for creating the file in the first place, then closing the file when you're done.

Salem 5,265 Posting Sage

You seem to be opening and closing the file at every node.

Salem 5,265 Posting Sage

How bad?
http://www.daniweb.com/forums/thread91939.html
2½ years of "me too" 1-posters, all bleating for a project to do.

You'd think they would get the message that the thread is pointless.

Oh well, at least it makes good target practice ▼

jonsca commented: But Salem, they all fell asleep through their entire academic program... ;) Good word choice anyway. +0
Salem 5,265 Posting Sage

Set the maximum range to say 10000, then when it comes to displaying 0.0 to 999.9, simply multiply by 10.

Salem 5,265 Posting Sage

That's a good example?

The fact that it had to be edited for code tags, and it does NOT answer the original question (as Iam3R points out) is hardly a winning case for the defence (m'lud).

Salem 5,265 Posting Sage

http://www.catb.org/~esr/faqs/smart-questions.html#bespecific

Even for a 1-poster, that "question" would suck.

Salem 5,265 Posting Sage

http://www.cplusplus.com/reference/iostream/fstream/
Modern C++ compilers do not have the .h on the end of standard library includes.

Salem 5,265 Posting Sage

> numArr[MAXSTRLEN],asciiArr[MAXSTRLEN]
long ints are typically 4 bytes, so this little lot takes a whopping 8MB of stack space.

You're almost certainly blowing your stack limits with this code.

> for (i = 0; i < CHARS; i++)
Especially as this much smaller limit seems to be applicable for at least one of the arrays!

Salem 5,265 Posting Sage

You can do a = b = abc(); Or change the code so that it reads a = abc( &b );

Salem 5,265 Posting Sage

> x=(float**) malloc (T*sizeof(float*));
1. Make sure you're compiling your code with a C compiler (not a C++ compiler). If you're getting warnings about "void* to T*", then you're compiling C++ code.
2. Remove the cast of the return result. It does nothing useful if this really is C code.
3. Make sure you're including stdlib.h. If you fail to include this header, AND you have the cast, then you're potentially hiding a very serious bug.

Use x=malloc (T*sizeof(float*)); or better, since it doesn't refer explicitly to a type x= malloc (T*sizeof(*x)); > memset(x, 0, sizeof(x[0][0])*S*T);
This is wrong for two reasons.
1. The memory you allocated was the result of multiple malloc calls. Thus, the memory is NOT contiguous.
2. http://c-faq.com/malloc/calloc.html
All bits zero does NOT imply a floating point constant of 0.0f
If you really want to initialise this memory properly, then you have to use the obvious nested for loops to initialise each element with 0.0

dr_michali commented: very helpful, thanks! +0
Salem 5,265 Posting Sage

What you posted won't even compile.

Nor are we any clearer as to what numbers you tested with.
2 and 3 perhaps?
or 12345 and 67890

Salem 5,265 Posting Sage

> I got a Dell D610 from Ebay from a guy who got it from a guy and so on.
If the person you bought it off doesn't know, then you should be thinking "was this stolen?".

Salem 5,265 Posting Sage

> It compile but it keeps giving me 0 which is not correct.
For what values of n and k?

> denominator = denominator *i ;
These would have numeric overflow pretty quickly.
Add some debug to print each denominator value in the loop.

Also show us how you print the result in the end - are you even assigning the result to a variable you then print?

Salem 5,265 Posting Sage

The cache works better when you HAVE loops, not when you don't.

If all you've got is straight-line code, then the very fast processor is essentially bypassing the cache and it is stuck waiting for slow memory to deliver the next instruction.

A populated cache on the other hand can keep up. Coupled with branch prediction (or speculative execution), a jump from one cache location to another is either a small overhead (or free).

> I'm guessing that's because it was too big for the instruction cache
For 60 elements - I doubt it.
Most tool chains have the ability to tell you how much code a single function occupies at the assembler level (try the map file).

Salem 5,265 Posting Sage

If you're using GIF as your file format, then yes you're stuck with 8-bits and that can get pretty crude at times.

By and large, you should be using
PNG - for computer generated images.
JPG - for photographic images.

IE was the last of the browsers to support PNG properly, but that's been fixed for the past 4 or 5 years.

There are several sites (search:IE PNG fix) which allow you to fix PNG in older versions of IE. But check your server logs to see how many browsers connect with IE versions earlier than IE7

Salem 5,265 Posting Sage

Why not design your images locally in 32-bit mode, then convert them to some other format for publishing.

There are a number of different image formats, which allow you to trade quality for size. Pick the one which fits your needs.

Salem 5,265 Posting Sage

> Console.Write("1"); // --> should not be here
Into

// Console.Write("1"); // --> isn't here any more!
ddanbe commented: Eaten something and it is not becoming you? -1
Salem 5,265 Posting Sage

> int det(int);
Fix this so it looks like your definition of the function.

> int a,k,i,length,minor[10][10];
Pick a different name - it's the same as your function.

Salem 5,265 Posting Sage

So why have you waited until now to say "due at midnight!"?

It's been 3 DAYS since your last post. If you'd bothered to post your latest effort on a daily basis, we could have helped you easily.

But no, it's "an emergency" and you haven't even shown us what you've been doing.

Salem 5,265 Posting Sage
johnir commented: Very Helpful +0
Salem 5,265 Posting Sage

A real pre-emptive OS would need a clock interrupt (from the outside world) to function.

This would be capable of interrupting "while(1);" and give control back to the OS to decide on something else to do.

Salem 5,265 Posting Sage

> (someclass->test->*funcptr)(2, "Lol"); Remove the * (someclass->test->funcptr)(2, "Lol");

Salem 5,265 Posting Sage
kvprajapati commented: It has to work. +8
Salem 5,265 Posting Sage

> size_t t1 = fread(TGAcompare,1,sizeof(TGAcompare),file);
Although it looks pretty, this isn't the way to read a binary file.

The compiler is free to add padding and alignment to the struct, which the external file format will know nothing about. So what you actually read will be skewed compared to what the file format actually means.

struct header {
    short int type;
    // 2 bytes of padding here
    long int length;
};

If you read this in, believing you're reading 6 bytes, then you're wrong on several counts
- you've read 8 bytes
- 2 bytes of length wound up in the dead space
- the other two bytes of length are in the wrong half of the word
- the remainder of the length contains 2 bytes of the NEXT data element.

Even if you manage to use pragma(pack) or its equivalents, no amount of compiler magic will fix the endian problem if your machine has a different byte order to the file format.

Salem 5,265 Posting Sage

There's a lot of good info here -> http://www.tomshardware.co.uk/#redir

Salem 5,265 Posting Sage

In C++, you should be using new and delete , or new[] and delete[]

Salem 5,265 Posting Sage

Nice, and you managed to use code tags as well.

But do you have a question about that code, or have you finished the assignment now?

Salem 5,265 Posting Sage

> What if I add some kind of delimiter in my packets like ";" or "$" and I scan for that so I know the packet ends, do you think that will work?
That was the other choice I mentioned.

Salem 5,265 Posting Sage

Your receiver needs to know where one message ends, and the next one begins. There are many ways to do this, depending on what you're trying to do.

Two common ways are:
- fixed_width_count + variable_length_data
- variable_length_data + delimiter

The first is easier for the receiver, since it always knows how much to expect at any given moment.

You can receive a buffer using recv if you want, but you also need a second buffer to store an unused message fragment, where the end of a message is in the middle of a buffer.

Byte-by-Byte simplifies things, but isn't the most efficient.

But getting it working first is a priority, then tinker with the performance (by using a buffer say) later on.

Salem 5,265 Posting Sage

Yes indeed.

Salem 5,265 Posting Sage

I've no idea how big your send and receive buffers are.

You're assuming a perfect transport mechanism (that is, each send ALWAYS sends the whole message, and recv always get exactly what send sent).
Neither of these things is actually true.
http://www.daniweb.com/forums/post1157666.html#post1157666

> Recvbuffer[receivedBytes] = 0;
I'm going to take a stab and think that you have char RecvBuffer[1000];
- you're screwed if recv() completely fills the buffer, and the \0 lands out of bounds
- you're screwed if recv returns -1, and you scribble off the other end instead.

> va_start(ap, Format);
You don't have a va_end() either.

Salem 5,265 Posting Sage

Use getline() and a loop.
After that, look up the various methods in std::string.

Salem 5,265 Posting Sage

> packet = Client->Recv();
Can you post the code for Recv() and Send()?

Salem 5,265 Posting Sage

The prototype needs to be void deal (user&, user&, card[]); if you want to modify the details of the user and dealer.

Salem 5,265 Posting Sage

>Need an answer
And we need YOU to read the forum rules and make an effort.
http://www.daniweb.com/forums/announcement118-2.html

You didn't even ask a question. You just dumped your assignment!

Salem 5,265 Posting Sage

I think they've screwed up the compiler installation by editing stdio.h at some point in an attempt to solve a problem.

Now, every project is broken.

Re-install the compiler and SDK.

Salem 5,265 Posting Sage

If it's an XML file, why not use an XML library?
There are several around.

Salem 5,265 Posting Sage

OIC,
Are you taking into account that your two MOV EAX instructions are different lengths?

Does that code go on to save the return result of ShowWindow somewhere for later checking?

Salem 5,265 Posting Sage

If you don't want a window, why are you creating one?

Salem 5,265 Posting Sage

Your compiler will have read the entire function, and worked out in advance just how much space each local variable would need (and the total space).

At code generation time, the right amount of stack space can be reserved.

Salem 5,265 Posting Sage

So just because your luck ran out, you decide that there is a problem with the universe?

Salem 5,265 Posting Sage

What about looking at the return result of send() to see how much you actually sent?
- assuming that send() always sends the whole thing in one call is a bug.

What about the recv() end as well?
Messages can be fragmented in transit, and it's your job to reassemble them.


hole == whole