Excizted 67 Posting Whiz

Well my dependencies are cross platform.
The only actual problem I've had compiling the project under windows was having MinGW link my .lib/.dll's.

Excizted 67 Posting Whiz

So tell me if I get you right:
You suggest each of us two developers set up our own projects on our respective platform, and yet use the shared source code?

At least that is an easy solution. It's just a lot of work if I were on some other computer.

The remote login thing sounds like something that could be done with a build server. Maybe I should try that out, that'd be a new experience.

Well I'm glad you came with your opinion.

Excizted 67 Posting Whiz

LOL. My brain read const into the expression int array_size = 10. Sorry OP! Thanks "NE"

OP haven't been online during all this, so he'll probably not mind anyway ;)

Excizted 67 Posting Whiz

Don't use the sleep function. Make your own function.

void awesomeWaitFunction(const unsigned int& delayMs)
{
    unsigned int start = (float(clock())/CLOCK_PER_SEC)*1000;
    while((float(clock())/CLOCK_PER_SEC)*1000 < start+delayMs);
}
Excizted 67 Posting Whiz

Yeah, I have ISO C++ standards on. I'm using the GNU compiler usually.
The error you mentioned sounds familiar, probably it's just me being forgetful. :D

Excizted 67 Posting Whiz

Really? I'm sure I've done that it the way I posted before.
Anyway, thanks for correcting x)

Excizted 67 Posting Whiz

Oh yeah, you're right, thanks for noticing.

Excizted 67 Posting Whiz

An array is a number of objects.

Example on array:

const int array_size = 10; // const because Nick Evan says so :)
float floatArray[array_size]; // this is how we make an array
floatArray[0] = 4.2; // this is how we access the first element in the array

for(int i = 0; i <= array_size-1; i++)
{
    floatArray[i] = i*2.56; // how we dynamically set values in all elements in the array.
} // note that i said array_size minus one. Thats because the index number for the last element will always be one less than the array size, because the indexing starts at 0 instead of 1.

A normal array cannot be dynamically changed, so if you make an array of 10, and suddenly want it to hold 11, then you have to make a whole new array and copy the original data to it.

You can redetermine the size of an array like this:

float bigArray[x]; // x, because we don't know the size of the array.
array_size = sizeof(bigArray)/sizeof(float); // we take the size of the array, and divide with the size of a single float. Leaves us with the number of floats in the array.
Excizted 67 Posting Whiz

Hi, thanks for replying.
We are already using SVN for versioning.

NetBeans is excellent for C++, with the C/C++ plugin.
The reason we both use NetBeans is because we both prefer NetBeans over any other IDE.

I would be happy if it was so easy just to copy it over in a test project, but unfortunately it is a game project with ten-thousands of lines of code.

Only a few of our simplest classes are not dependent on other classes.

For the final release it is obvious to me, that with a little push it shouldn't be hard to get a Windows version compiled. But now I have to figure a way for optimal and fast development cross platform.

We have 10 dependency libraries all cross platform and compiled on Windows, yet we didn't succeed at having MinGW compile them.
I suppose it of course is possible to have MinGW compile, but it seems like a lot of work, just to do some work on another PC.

Excizted 67 Posting Whiz

The problem is obvious :)
Let me show you some examples here:

if(false)
    std::cout << "We can't get here"; // This is the first action after the if, so this is what will be executed if the condition is met
std::cout << "We will get here,  because I'm not a part of the if statement."; // This has nothing to do with the if.
else // this is your problem... the else tries to match the if statement which may only be 1 action away.

The proper way to do it:

if(false)
{
    std::cout << "We can't get here!";
    std::cout << "This time you won't see me, because I'm inside the brackets connected to the if statement! :(";
}else{ // now the else will match the if statement on the first matching opening bracket.

So if() without brackets are fine if theres only going to happen one thing. But more than one action requires brackets.

Let me know if it helped :)

Excizted 67 Posting Whiz

No problem, buy me an ice cream now :)

Nick Evan commented: <8 (it's icecream rotated 90 degrees) +12
Excizted 67 Posting Whiz

Look at this example... Every step (which is very fast, you probably want the user to input something or put a delay, otherwise it will move in matter of nanoseconds), the code will generate a number between 1 and 3.
In the case the number is 1, it will move Left. Case that number is 2, move middle. Case number is 3, move to the right.

Of course you have to replace those functions I made with how you actually want to move the evil guy or whatever.

bool gameRunning = true;
while(gameRunning)
{
    int event = rand()%3+1;
    switch(event)
    {
         case 1:
             moveLeft();
             break;
         case 2:
              moveMiddle();
              break;
         case 3:
              moveRight();
              break;
     }
     // Maybe wait for the users action, or wait x seconds before repeating this loop?
}
Excizted 67 Posting Whiz

But you told us to compile it.. Can't compile half a code.

And you didn't actually write what your problem is, but that we had to guess it from how it runs on our computer. In my case a problem with platform dependency would occur.

Excizted 67 Posting Whiz

Hello. :D

I've been working on a project for couple months now, on Linux.
When I invited a new team member, of course he came with his Windows.

I want to hear your opinion on how to make the development easy cross platform. Usually I would just tell him to write a code which works, but since he's not very skilled he needs to be able to compile to check for errors.

Our IDE is NetBeans which is available both on Linux and on Windows.

I heard of CMake, but the configuration files seems as quite a work to set up. It is only two developers in a private project, not a big open source project.

Also I might be interested in setting up a build server if that could be any use, although I'm not completely sure how good that is in this case - never used one before.

Thoughts? :)

Excizted 67 Posting Whiz

Uhm lol.
You need the PS3 SDK (aka PS3 Software Development Kit). I'm afraid it costs money. If Sony aren't tards you probably can download a demo version or maybe a personal version.

Then you of course need to gain programming experience.

And finally you'll spend 1 year designing the game, 1 year programming it, and 1 year making the graphics. That if you have a team of atleast 10 developers. Well and then success, you now made Modern Warfare 3. But oh well? Copyright issues? Oh gawd you didn't know of that, but well it was fun as long it lasted, now too bad you had to pay your billion income to Infinity Ward.

So... that's how you do.

MosaicFuneral commented: Poor attempt at being snide. +0
Excizted 67 Posting Whiz

Well, I'm not sure what you need help with.
You'll need the rand() function to simulate the dice output. Find it on google, and notice you'll need the srand() aswell.

Then you could hardcode all the field, and make an algorithm that decides where the player lands, when he dices x.

So... unsure what more I can tell you, since I don't know what you want to know.

Excizted 67 Posting Whiz

Hmm you didn't include the headers in the code above.
And you're using system a lot, I probably won't be able to test it then, because it seems like Windows commands, and I'm on Linux.

Excizted 67 Posting Whiz

Glad that I could help :)

Excizted 67 Posting Whiz

I don't understand your last post.
I can tell you that when you make some variable, it magically appears in the computers memory. Magic.
A pointer contains a memory address. They are used to access whatever is a that memory position.

References and pointers are basically the same.
Except pointers may change their address.

Example:

float* numPtr = new float(10); // the new operator creates a float that isn't associated to a scope. Means it lives until it is manually deleted.
std::cout << *numPtr; // We have to write * in front of our pointer, otherwise the pointers contained address is output, instead of the value of the memory at that address
numPtr = new float(133);
std::cout << *numPtr; // we output the same pointer, but it has a different value. MAGIC!
// Oh well, now where here. What now? Oh yes, we gotta delete the floats we created:
delete numPtr;
delete ... // Oh gawd, we don't have the address of the other float anymore. This is a memory leek. But don't worry, exit the app and your OS will delete the associated memory anyway.

So what is the point of it?
Well in C++ you may have a whole lot of objects, but only one is to be active at a time. So you have a pointer, and your code will work with that pointer. But you dynamically change the address in that pointer, and the code has a whole other …

Excizted 67 Posting Whiz

how to delete a string index inside an array that the user inputs???,, could someone pls
help??

Useless title - but indeed, your post is so short, you might just written it in the title.

Also, I don't even understand what you want to do.
You have a user inputted string? Alright.
An array? With what? Predefined size?

More info, and you will get help. And while you update your post to be useful, (and of course you'll update your existing one instead of making a reply, I'm sure) then update the title to something relevant. "Delete String inside Array" or whatever you mean.

Salem commented: Nicely put +19
Excizted 67 Posting Whiz

You seem friendly. God I want to help you. You have an error, I must help.
The only problem is.... I don't know what your problem is.
- Compiler error? Post it here.
- Runtime expectation mismatch? What happens, and what doesn't?

Almost a good and useable post that could get answers, would just make life easier for us to do so, if we knew a bit more about the mentioned error you have.

Excizted 67 Posting Whiz

Hey.
Uhm, you have to tell us if theres anything that needs a 'repair'? Is it not working, or?
I have no clue what it is, if I were to come with improvements, I'd like to know a bit more what you're trying to achieve? A card game, or something?

Note: "thapchi corporations limited" appears to be a name - that means you gotta start with a capital letter :) Just a hint, if you're going to sell pro console games, you must be able to type your name correctly :D

Excizted 67 Posting Whiz

Hey, please download my 100 dollars and upload it when you have made it a billion dollars.
You see whats wrong? This is a forum. We help each other. We don't work for each other.

shouvik.d commented: well said! +4
Excizted 67 Posting Whiz

I know <br /> is a linebreak. That's where I wan't linebreaks. I don't want to make linebreaks in my IDE, and have those linebreaks happen on my webpage. Some lines may be hundreds of characters long, because I want the design to break the long lines as needed.

I'm sure this has not always been the case, as I remember, 7 years ago when I started webprogramming, I was quite annoyed that there didn't appear linebreaks when I pressed enter in my notepad.

Excizted 67 Posting Whiz

Well it's like everywhere. Here's an example anyway:

echo "<h1>Edit Page</h1><p>Here you are allowed to edit your personal page, \"",
        $array["page"], "\", in all sorts of ways. You can start out by
        choosing a background color, and what font you would like.<br />
        In that way you can make a completely unique page, that is like no others.<br />
        Have fun! :)";
Excizted 67 Posting Whiz

use LIMIT in your SQL Query.
Google is your friend too, http://www.dynamicdrive.com/forums/showthread.php?t=30884

Excizted 67 Posting Whiz

lol and use code tags next time, then we people might love you too :D

Excizted 67 Posting Whiz

Hey.

I'm having an annoying problem, that I can't seem to figure out.

In my page when I echo long messages, I do an in-code linebreak at around 100th character, to keep at all in my view.

But when I do that I also get the line breaks and indents on my webpage.
Can I do something? Some PHP setting? Hopefully the solution isn't having ~1000 character long lines.

Thank you :)

Excizted 67 Posting Whiz

Hey !

I've been using NetBeans for quite a long time, and totally addicted to it. Therefore there was no mercy when my mate wanted to join my project.
- He had to get it too. He's one of those Windows guys tho x)

I installed him MinGW and MSYS, and set them up in NetBeans as is totally logically, and we compiled some hello world apps to test.

But in the moment I tried to link the application to some of our SDK's, no matter how I tried, I would still get "undefined reference to external" or whatever.

I really can't understand it. I tried several libraries, all with failure. Absolute paths, relative paths. I'm really lost, spent the last many hours attempting to try everything.

I hope anyone with some knowledge on MinGW or NetBeans (I'm unsure where the problem lies) could hint'n help me out.

Thanks so much if you'll give it a try :)

Excizted 67 Posting Whiz

I agree. The reason for this is, that a computer can not just generate a random number. It does not have emotions to pick a number, it must solve it mathematically. There is no equation not actually giving the same each time.

So you have to seed the rand function with the current time. Then in theory tho, rand would return the same if the time is the same each time you run it. Although that shouldn't be the case, since I believe the time function returns the time since 1970 or something.

Excizted 67 Posting Whiz

If it happens, ask him to check the message that he gets when it BSOD's.. I've always been able to roughly fix BSOD problems from their message.

Under no circumstances a Windows box should BSOD because of a segmentation fault.

Excizted 67 Posting Whiz

+rep WaltP :D

Excizted 67 Posting Whiz

Yeah I know how to post code here too :) and code tags... impressive.

Excizted 67 Posting Whiz

Do you want help?

More seems like a challenge or something?
At least to achieve this you really only need very basic knowledge of C++. A friend of mine was able to do almost the same with no programming knowledge of any kind, just using his intuition and the one hint about std::cin, std::cout and std::string to exist, but not how to use them.

Excizted 67 Posting Whiz

Hi.

I have some, probably, very basic questions. :D

I'm making an engine, which will be script driven.
But I'm concerned with the performance of plain text, even if it was loaded to the memory.

I want the scripts to be executable very fast, since there would be a lot of them.

So I heard some people make a compiler for their scripts.
How does that work?:

* What would I want to input to the compiler, to make the binary files?
* How would I use those binary files, as in handling them from my main code?
* And what makes it improve performance?

I hope someone would be able to learn me something here :)
Thank you.

Excizted 67 Posting Whiz

Thank you :)

Excizted 67 Posting Whiz

Hi :)

I am certain of when to use static_cast, but often I can get satisfactory results by writing the target type in a parenthesis.

For example:

void* data = somePointer;
SomeClass* new_ptr = static_cast<SomeClass*>(data);

seems to work when replaced with

void* data = somePointer;
SomeClass* new_ptr = (SomeClass*) data;

So could anyone help me out, what the difference in the methods are? :)

Thank you.

Excizted 67 Posting Whiz

That it was indeed! Great, thanks :)

Excizted 67 Posting Whiz

Hello.

I remember once I googled a topic, and I kept stumbling upon a linux command, that would allow me to get some info on a binary application, including it's architecture. Basicly, I could see if the program was build for x86_64 or for x86.

Now I actually need this command to check if i cross compiled the architecture correctly, but after googling for half an hour I simply can't find it, unbelievably.

It is not my Linux kernel architecture, it is the architecture of a compiled program.

Also, if anyone know the command to do this, can I do it on (shared) libraries aswell?

Thank you very much :)

Excizted 67 Posting Whiz

Thanks.

Excizted 67 Posting Whiz

Are we talking about a html <table> or a MySQL table?

It seems you're posting the actual image data into your MySQL table - why don't you just post the link to the uploaded image, and then do a <img src=\"".$row."\">.

Excizted 67 Posting Whiz

Ok I'll be looking at that.

Excizted 67 Posting Whiz

Now i have a mySQL database

What can i do with it? i already tried a basic register and login script and i get a error saying how do i solve this?

and what can i get for my mysql i have seen loads of e-commerce but thats all i have seen

Well congrats with your MySQL database.
You use it for fast storing and loading data, organized in databases and tables, divided into Rows and Cells.

You get an error, oh god. Well the error says that in your database, called mydatabase, there is no table called users. You need to create that table prior to usage.

I am not sure if Navicat is free anymore, but the free edition used to be quite easy-to-use interface/client for MySQL. Try to google "Navicat Lite MySQL".

Excizted 67 Posting Whiz

Uhm..

So you spammed this post with code.. What is it supposed to do? What does it fail to do? What does not "display in your program" (i supposed you mean browser, or sumthin')?

Does anything get inserted to your MySQL Database? What do you mean by "together with other records"? - Does that mean it cannot be shown when anything else is shown, or that some other records you are too lazy to define, won't show neither?

Excizted 67 Posting Whiz

"Please give the solution" is most probably what causes this thread to have 0 replies.

I didn't really read your topic, but in your form you write

action="?result1?id=<? $_GET['city']?>"

Wouldn't you want to write

action=?result1&id=...

?

Goodluck.

Excizted 67 Posting Whiz

I won't even consider reading your code and helping you out, until YOU consider how you formulate your topic.
I'm not blaming your English, although understanding what your problem is wasn't exactly easy. But you're actually demanding an answer. You should tell us what you tried, and if you suspect anything specific.

Don't put a deadline on free help.

Oh and use code tags to make your code more reader-friendly.

Excizted 67 Posting Whiz

Hello.

I'm going to create a stack of pointers to objects, and I need to implement an identifier with the best performance.
Those objects are custom classes.

I'm wondering what would be best for performance. Either of these two ways, or maybe a third better way?.

1) Making an std::map for the stack, with a string identifier.
2) Making an std::vector with just the pointer, and then loop through all the objects (which may be 50+, each containing a few kilobytes), and read object::name which would be a string too.

And again to mention, if theres a better way, please hint me :)

Thank you ahead! :D

Excizted 67 Posting Whiz

Yeah, okay - So, you suggest a bytearray? :)

Excizted 67 Posting Whiz

Well, since an IP address is a 32-bit integral value (IPv4), I would probably use a 32-bit unsigned integer.

I'm just wondering then, what about an IP like 87.185.83.120? Would I store it in the integer as 87185083120 and then assume a 0 at front for each "missing" digit?

Excizted 67 Posting Whiz

Hello.

I'm needing to store the IP adress as a variable in my application.
I was then wondering, what the most efficient way of doing this would be?

I would simply make 4 integers, and then in a setter function, read four arguments, and pass them into those four integers, and checking if it is valid for an ip. Ex. int1 = 192; int2 = 168; int3 = 1; int4 = 1;

I imagine than using hex in some way would be best? Whats your suggestion? :D

Thanks!