ShawnCplus 456 Code Monkey Team Colleague
$record = $row['record'];
$cat = $row['cat'];
$sub = $row['subcat'];
$creator = $row['creator'];
$mtitle = $row['maintitle'];
$murl = $row['mainurl'];
$dtitle = $row['directtitle'];
$durl = $row['directurl'];
$descript = $row['descript'];
$requires = $row['requires'];
$tech = $row['techniques'];
$thumb = $row['thumb'];
$large = $row['large'];
$ip = $row['ip'];

--->>>

extract($row);
sagedavis commented: Extremely informative +1
ShawnCplus 456 Code Monkey Team Colleague

You have already output something to the page before you start the session which must come before any headers are sent ie. data sent to the page. I'm not sure where in your file you have that

ShawnCplus 456 Code Monkey Team Colleague
$_SERVER['QUERY_STRING']

That's the short answer

ShawnCplus 456 Code Monkey Team Colleague

I've never seen any GUI apps that do it but GDB is an extremely powerful debugger, that might have been what he was using.

ShawnCplus 456 Code Monkey Team Colleague

Well, for one you are obfuscating your code to an extreme extent by not giving meaningful variable names. friend zz operator-(zz z); Secondly, the - operator is a binary operator. It accepts two operands, the left and the right. (-a) does nothing since you are using a binary operand as a unary operand (--a) which would decrement a if you overload properly, otherwise it decrements the pointer.

So which are you trying to accomplish, the binary operator( a-b ) or the unary operator( --a )?

ShawnCplus 456 Code Monkey Team Colleague

Well first of all HTML is *completely static and PHP is used to make pages dynamic since PHP is a programming language and HTML is a markup language. You still use HTML when you make websites in PHP since that's how browsers interpret the page.

It's extremely easy to incorporate PHP into an existing site. Heck, you can even keep the same pages you are using now, just add PHP functionality to the pages. I recently "converted" all of my site to use PHP and a database instead of static HTML and if I didn't have it posted on the news section you can't tell the difference in the least. PHP doesn't directly modify the look of anything unless you tell it to by outputing HTML or CSS. The only thing users might notice is the whole heap of new features that you've incorporated :)

*aside from server side includes and basic if statements

ShawnCplus 456 Code Monkey Team Colleague

OK I've got to the stage of development where I'm balancing out formulas and I was looking for a bit of input. Here are some formulas I've made (typeset with OO.o Formula).
(See the attached thumbnail)

Just a reminder, << and >> are bitshifts, NOT strictly greater/less than, continue :).

The first determines how much experience a player needs to level. Here is some example data:

PLEVEL = Player Level
LEVEL  = Target Level (plevel + 1)
TNL = PLEVEL*(LEVEL << 10)
TNL = 5*(LEVEL<<10)

Therefor, at level 5 a player needs 30,720 experience to level.

Example data for Experience Gain:
TLEVEL = Target's Level
THEALTH = Target's MAX health

PercDamage = (damage/THEALTH)*100                 
EXPGAIN    = (PercDamage * 128)*(PLEVEL/TLEVEL)      
   Example:                                          
           PLEVEL     =     5                        
           TLEVEL     =     7                        
           Damage     =    20                        
           THEALTH    =   100                        
           Percdamage =    20                        
                                                     
           EXPGAIN    =  1828                        
           Player TNL = 30720                        
           %TNL/hit   =     5.9

The last formula takes a bit more explaining.
When a player uses a skill it requires stamina. What this formula does is add a "penalty" stamina cost to the skill based on how much weight they are carrying(encumbrance). Refer to the attached image for the formula, here is the example data.

Strength - Player's strength stat
Drain - stamina cost for skill
Encumbrance - pounds carried by player

Drain = ((Encumbrance * .01) / (Strength / 2))   
     Example:
           Cost        = 100
           Strength    =   8
           Encumbrance =  40                          
           Drain       =  10
           Total Cost  = 110
ShawnCplus 456 Code Monkey Team Colleague

Well you can't code a game in HTML since HTML isn't a programming language. You might be thinking of PHP or Javascript both of which there are hundreds if not thousands of tutorials online.

ShawnCplus 456 Code Monkey Team Colleague

I'm not sure what implementation you are using because, obviously, it looks very different from the one I'm using. There wasn't really any "installing" when using the PEAR mailer. It was just downloading the class.phpmailer.php file and using the functions provided.

ShawnCplus 456 Code Monkey Team Colleague

add mimetypes to your code...

the PEAR mailer class automatically adds the text/html mimetype to the headers when you say implementation->isHTML = true;

ShawnCplus 456 Code Monkey Team Colleague

This is using the PEAR mailer package

require("phpmailer/class.phpmailer.php");

// personal info ommitted
$mail = new PHPMailer();
    $mail->From = "Application@NarutoFor.Us";
    $mail->AddAddress($email);
    $mail->FromName = "NarutoMUD";    
    $mail->Subject = "Thank you for applying to NarutoMUD";
    $replymsg = str_replace("%RESPONSE%", "{$response}", $replymsg);
    $mail->Body = $replymsg;
    $mail->WordWrap = 50;
    $mail->AltBody = $altmsg;
    $mail->IsHTML(true); //note this line
    if(!$mail->Send())
    {
       echo 'Message was not sent.';
       echo 'Mailer error: ' . $mail->ErrorInfo;
    }
ShawnCplus 456 Code Monkey Team Colleague

Here's a little hint from your own post

You might be asked to attend an interview to prove that your submission is your own work.

Which means, if you don't know how to write it and you just hand in someone else's work they will know. Which is completely aside from the fact that you haven't read the big READ MEs in the forum which state that we don't give homework help to those who don't try

ShawnCplus 456 Code Monkey Team Colleague

It generates only 0 and 1 because rand() % 2 only finds a number between 0 and one. To find a number between one and two you could either do flips = (rand() % 2) + 1 or flips = (rand() % 3); Also, this is unneeded heads = heads ++; . Below you do it correctly with tails++

ShawnCplus 456 Code Monkey Team Colleague

Probably the easiest way to go would be to use the mailer from the PEAR package for php, all you do is set isHTML to true and it will write the headers and all that good stuff for you. It makes mail 100 times easier.
Here's the link for you
http://pear.php.net/package/Mail

ShawnCplus 456 Code Monkey Team Colleague

That's Javascript, not Java. You want this forum
JavaScript / DHTML / AJAX

ShawnCplus 456 Code Monkey Team Colleague

If the same records are showing then the limit statement isn't being changed

ShawnCplus 456 Code Monkey Team Colleague

Well if you are using a condition to select the rows to be inserted/updated just reverse the condition and do a delete on those so if you have something like WHERE name = "bob" just do WHERE name != "bob" aside from reversing a condition I'm not sure there is a way of getting the unaffected rows (hopefully I will be corrected on this)

ShawnCplus 456 Code Monkey Team Colleague

This is just a little something for those of you used to using the Eclipse IDE, it's syntax highlighting almost identical to Eclipse save a bit of enhancement. Eclipse doesn't highlight ints, octal and hex individually but DevC++ can, there are a few other things in there that promote very high levels of readability.

To Install:
Download attachment "Eclipse-enhanced.txt"
Rename to "Eclipse-enhanced.syntax"
Drop into C:\Documents and Settings\<username>\Application Data\Dev-Cpp

To Use in Dev-C++:
Tools->Editor Options
Syntax Tab
Color Speed Settings dropdown->Eclipse-enhanced

Et voila!

Ancient Dragon commented: good info +19
Narue commented: Nice. +16
WolfPack commented: cool +7
ShawnCplus 456 Code Monkey Team Colleague

Another way to do it would have three separate text boxes for hours, minutes and seconds respectively then when you actually submit it you can concatenate the three and make any empty boxes 00.

ShawnCplus 456 Code Monkey Team Colleague

When you output the time use date_parse which breaks the time up into an associative array so you can display it in any way you would like but it is still stored the same in the database.
Quick note: even if you only enter MM:SS the database will add 00 to the hour so 45 minutes 5 seconds would become 00:45:05
Example:

$timeQuery = "SELECT time FROM rides";
$timeResult = mysql_fetch_row($timeQuery);
$parsedTime = date_parse($timeResult['time']);

echo $parsedDate['hour']." hour(s), ".$parsedDate['minute']." minute(s), and ".$parsedDate['second']." second(s).";
ShawnCplus 456 Code Monkey Team Colleague

I used this one to save me some time
This is not Visual C++ dependant, I use this with DEv-C++ as well, you just need the windows header

enum Colors { blue=1, green, cyan, red, purple, yellow, grey, dgrey, hblue, hgreen, hred, hpurple, hyellow, hwhite };

void coutc(int color, char* output)
{
   HANDLE handle= GetStdHandle(STD_OUTPUT_HANDLE);
   SetConsoleTextAttribute( handle, color);
   cout<< output;
   SetConsoleTextAttribute( handle, color);
}

Then to output in color you would just do

coutc(red, "This is in red!");
coutc(purple, "This is purple!");
ShawnCplus 456 Code Monkey Team Colleague

You sort of left off the printBig function which is what seems to be causing the problem.

Just a side note, though you can't use pointers when you pass an array you are technically passing a pointer anyway.

ShawnCplus 456 Code Monkey Team Colleague

I started this a while ago and I have a skeleton of a system on my site with the source and the executable since this was discussed earlier on the forums (search for Several C++ design questions)

The game I have written is pretty much identical to what you are saying accept that currently it supports mob(enemy) scripting, game saves and has a custom equipment system. It's on the devblog section of my site LazyCode.info/DevBlog
Note: It is GPLd as all programs on my site as per the agreement in my Programs page.

ShawnCplus 456 Code Monkey Team Colleague

Well if you have linux then it never hurts to learn the linux commands (cron) whereas if you have Windows you will be using AT instead of cron. In either case getting to know your way around the command line is a good thing.

ShawnCplus 456 Code Monkey Team Colleague

It's an infinite loop because you have || (OR) isntead of && (AND) which pretty much says: while input isn't y or isn't n tell them it's wrong. It should say: while input isn't y AND isn't n tell them it's wrong.

Take out the ifcheck and replace || with &&, there it's fixed :)

ShawnCplus 456 Code Monkey Team Colleague

Well the thing that doesn't need to be in there is the while loop. Just have it "default" to no so if they enter anything aside from a Y then don't continue.

ShawnCplus 456 Code Monkey Team Colleague

It's because $this is a reserved word used with classes to reference the current object. For example

class TestClass
{
    var $blah;    
    function setBlah($input)
    {
        $this->blah = $input;
    }
}
ShawnCplus 456 Code Monkey Team Colleague

Include works be inserting a file into another ie.,

HelloWorld.php

<?php
echo "<h1>Hello World!</h1>\n";
?>

index.php

<html>
<head>
<title>Hello</title>
</head>
<body>
<? include('Hello World.php'); ?>
</body>
</html>

Would generate a page that looks like this:

<html>
<head>
<title>Hello</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>

Obviously it can have more than one echo but that's the easiest way to describe it.

ShawnCplus 456 Code Monkey Team Colleague

Use Google Analytics it will give you tons of information which you will most likely not need but it generates pretty pictures and it doesn't take up any space on your servers

ShawnCplus 456 Code Monkey Team Colleague

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

That's a link to the javascript mp3 player, the same person/team/company (not sure which) makes the JW Media player which plays FLV and it can be controlled just like the mp3 player

ShawnCplus 456 Code Monkey Team Colleague

There seems to be a rash of "do it for tomorrow" posts at the moment :icon_rolleyes:

I guess it's better than "Please help this was due yesterday!"

ShawnCplus 456 Code Monkey Team Colleague
#include "stdafx.h"
#include <cstdlib>
#include <iostream>
usingnamespace std;

Should be using namespace std; NOT usingnamespace std;

ShawnCplus 456 Code Monkey Team Colleague

In the constructor you are trying to initialize the Day, Month and Year variables to variables which do not exist. In that scope theday, themonth and theyear are not accessible. To fix that you would replace it with the parameter names given ie., day, month, year.

//constructor initializes month, day and year
    Date (int month, int day, int year)
    {
       setMonth (month); //You forgot the delimeter on this
       setDay (day);       // and this
       setYear (year);
    } // end Date constructor

With the following bit I'll point you in the direction of the C++ book that you're using to get a better understanding of the cin/cout commands.

// Why does it say enter the month? These functions display it, not retrieve it from user
   cout << "Enter the month " << month.getMonth()   
        <<"/day"<<day.getDay()
        <<"/year"<<year.getYear()
      << endl;
   cin >> "Enter the date:"// user enters the full date 
//(This doesn't take input from the ser, I'm surprised it compiles since you are trying to insert data into a string literal

This function does not require the parameter

void displayDate(int displayDate)
   {
      // this statement calls getMonth, getDay, getYear to get the date
      cout << "Enter the date" << getMonth() << getDay()<< getYear()
         << endl;
   } // end function displayDate

It can be fixed by:

void displayDate()
   {
      // this statement calls getMonth, getDay, getYear to get the date
      cout << getMonth() <<"/"<< getDay()<<"/"<< getYear() << endl;
   } // end function displayDate

You've also made three superfluous instances of the …

ShawnCplus 456 Code Monkey Team Colleague

If you look at line 137 it calles the MessageBox function which takes the arguments MessageBox(<message to show>, <title>, <buttons to show>, <icon to show>)

How can I make this print the text in the edit box when you push the button instead of "You pushed a button." I have looked all over but I can't figure it out.

#include <windows.h>
#include "resource.h"
HWND hWndButton;
HWND hWndEditBox;
HFONT hFont;

/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*  Make the class name into a global variable  */
char szClassName[ ] = "WindowsApp";

int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil)

{
    HWND hWnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default color as the background of the window */
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

    /* Register the window class, and if it fails quit …
ShawnCplus 456 Code Monkey Team Colleague

What is the error? do this mysql_query($sql) or die(mysql_error()); It will tell you the error

ShawnCplus 456 Code Monkey Team Colleague

It's sending empty messages because $comment doesn't exist. You can get it by replacing $comment with $_POST['comment'] .

Also, you $email in sendmail.php should be replaced with $_POST['email'] the same for $subject, it should be changed to $_POST['subject']

ShawnCplus 456 Code Monkey Team Colleague

Peace, I saw a chat Program on the Net...
The Messages In it automatically shows itselves without reloading the web-page..
I saw that and I wondered....
Does Any one know how to do that?

It's not using a database, it's most likely using AJAX or it's Java applet

ShawnCplus 456 Code Monkey Team Colleague

whoops, delete line 9, that was a little booboo

ShawnCplus 456 Code Monkey Team Colleague

The GIMP can do this pretty well. Though I usually just make my own in GIMP, I've never tried to convert jpg over. You could try to just open it with GIMP then do a save as... then use .ico, it should bring up a dialog asking which type of icon to use.

ShawnCplus 456 Code Monkey Team Colleague

The simplest would be something like this

<?php
function randomImage($numImages = 10)
{
     srand( time(NULL));
     $rand = rand()%$numImages;
     $ranImage = '<div class="thumb">
<a href="image'.$rand.'.html">
    <img src="images/image'.$rand.'_thumb.gif" alt="Image'.$rand.'" />
    <span><img src="images/pre_image01.gif" alt="Image01" />
<img src="images/pre_image'.$rand.'.gif" alt="Image'.$rand.'" />
         <em>Image'.$rand.'</em>
    </span>
</a>
</div>
';
    $echo $ranImage;
}
?>

Then wherever you wanted the image to display you would just do <?php randomImage(10); ?> . Given that you have 10 images that is. Also note that there is most likely a way to format a number to have the leading zeroes but I can't think of it off the top of my head.

ShawnCplus 456 Code Monkey Team Colleague

Have you tried Cprogramming.com, it's a good overall reference and they have a bunch of sample code on there you can use as well. Aside from that cplusplus.com has a fairly robust reference you can use.

ShawnCplus 456 Code Monkey Team Colleague

Firstly, use code tags

<img src="http://<?php echo $img_url . "/" . $imgpath . $file; ?>" alt="<?php echo $file; ?>" width="250" >
<br>
//what is this? you don't finish the line
<textarea name="textarea2" cols=23 rows=7 onClick="this.focus();this.sel..."
<a href="http://<?php echo $site_url; ?>" target="_blank" title="<?php echo $urlpath . $file; ?>">
<img src="http://<?php echo $img_url . "/" . $imgpath . $file; ?>" border="0" alt="<?php echo $urlpath . $file; ?>"></a>
<?php if ($support_image != "") { ?>
<img src="http://<?php echo $support_image; ?>" alt="Myspace Editors" style="position:absolute; left:0px; top: 0px;" border="0"></a>
<?php } ?>
<a href="http://<?php echo $site_url; ?>/" target="_blank" title="Myspace Images">This image is from <?php echo $site_name; ?></a>
</center>
</textarea>

Second, there seems to be a bit of your code missing. Fix it up and repost

From what you gave this is what I got:

<img src=<?php echo '"html://'.$img_url . "/" . $imgpath . $file.'"'; ?> alt=<?php echo '"'.$file.'"'; ?> width="250" >
<br />
<textarea name="textarea2" cols=23 rows=7 onClick="this.focus();this.sel..."
<a href=<?php echo '"http://'.$site_url.'"'; ?> target="_blank" title=<?php echo '"'.$urlpath . $file.'"'; ?>>
<img src=<?php echo '"html://'.$img_url . "/" . $imgpath . $file.'"'; ?> border="0" alt="<?php echo $urlpath . $file; ?>"></a>
<?php if ($support_image != "") { ?>
<img src=<?php echo '"http://'.$support_image.'"'; ?> alt="Myspace Editors" style="position:absolute; left:0px; top: 0px;" border="0"></a>
<?php } ?>
<a href=<?php echo '"http://'.$site_url.'/"'; ?> target="_blank" title="Myspace Images">This image is from <?php echo $site_name; ?></a>
</center>
</textarea>
Puckdropper commented: Code tags make everything better! +4
ShawnCplus 456 Code Monkey Team Colleague

Well you wanted C++ but you sort of mashed together non-OO C with OO C++. Also the .h antiquates the header and there is no real reason to have stdio.h in there since that is a C header. But if you are going to use printf the way you used it I'm surprised even compiles since you don't actually give printf any variables.

int x = 10;
printf("This is an integer: %i", x);

would print an integer

You should really just use cout if you are using C++

int x = 10;
cout<<"This is an integer: "<< x << endl;

is the C++ equivalent

ShawnCplus 456 Code Monkey Team Colleague

If anyone can think of any other pseudo-features that would be helpful just give me a shout and I'll write the script for it.

ShawnCplus 456 Code Monkey Team Colleague

For those of you who haven't heard of or used AutoHotKey check it out here http://www.autohotkey.com for the rest of you I made a really simple script for Dev-C++ to add some speed to it. (I had more in the script but they were things only I would remember and wouldn't be used by the general public :) )

/*
Dev-C++ Hotkeys and Autoreplacements
*/
#IfWinActive, Dev-C++ 4.9.9.2
{
RShift & Enter:: Send endl  ;Shift+Enter sends "endl"

/*
Pressing { sends puts cursor on a new line
then makes it {} and places cursor between brackets
*/
:*b0:{::{bs}{enter}{{}{}}{left}

If you don't have AutoHotKey and you don't want to download it there is an attached executable that does the same exact thing but you don't have to have AutoHotKey Installed, just run in before you open Dev-C++ and it'll work just the same.

SpS commented: Good Info ~SpS +3
ShawnCplus 456 Code Monkey Team Colleague
i n t f (v o i d ); // error: abomination

That has too be the funniest error I have seen aside from "Stopping compilation, too many errors. There must be something terribly wrong with your code."

ShawnCplus 456 Code Monkey Team Colleague

Anyway Ancient dragon I thank you. Here is my code.

#include <iostream.h>
main()
{
char pass
char word []="pope" // I assumed this is the setted password
cout << "Enter Password:";
cin >> pass;
if ( pass==word) //I'm stablishing a condition here,but it doesn't work   
    cout << "Password Accepted";
else
    cout << "Password Denied";
return 0;
}

Did you copy and paste directly because you are mising a semicolon on line 4, it should be char pass; even then it's only one character so if you tried to input pope and then compare it the comparison would be if ('p'=="pope") because it will only take in the first character and dump the rest.

Also main() should be int main() or int main(void) since it is returning an int and that is the only ISO C++ way to do it aside from int main(int argc, char *argv[]) which you don't have to worry about.

A better way to do it would be to use strings, also take out the .h since it antiquates the header:

#include <iostream>
#include <string>
using namespace std;
int main(void)
{
    string password = "pope";
    string input;
    cout<<"Enter a word: "<< endl;
    cin>> input;
    if(input==password)
        cout<<"Welcome!"<< endl;
    else
        cout<<"Sorry, the password you entered is incorrect."<< endl;
    cin.get();
    cin.get();
    return 0;
}
ShawnCplus 456 Code Monkey Team Colleague

As the title says: Is the XOR Swap algorithm still viable? I know that temp-swaps are supposedly faster but the shear coolness of an XOR swap makes it more attractive to me. What do you guys/gals think?

For anyone that doesn't know what an XOR swap is here goes

int first = 10;
int second = 5;
cout<<"First: "<< first <<"\nSecond: "<< second << endl;
// XOR Swap
first ^= sec;
sec ^= fir;
fir ^= sec;
// Values are now switched
cout<<"First: "<< first <<"\nSecond: "<< second << endl;

It also works with a char array

cout<<"  XOR Swap"<< endl;
  cout<<"Before Swap:"<< endl;
  
  char x[6] = "shawn";
  char y[6] = "cplus";
  
  cout<<"X: "<< x << endl;
  cout<<"Y: "<< y << endl;
  // XOR Swap
  for(int i=0;i<7;i++)
          x[i]= x[i] ^ y[i];
  for(int i=0;i<7;i++)
          y[i]= x[i] ^ y[i];
  for(int i=0;i<7;i++)
          x[i]= x[i] ^ y[i];
  
  cout<<"\nAfter Swap:"<< endl;
  cout<<"X: "<< x << endl;
  cout<<"Y: "<< y << endl;
ShawnCplus 456 Code Monkey Team Colleague

I would like to make a MUD in C++. So...=) I need to know how i would program it so that other players could attack, see, and trade with each other. I'm gonna host it on my computer, or maybe a remote shell account, so my friends and i can play and work on it. I know i would need to use sockets or something, but not sure =\. Could someone give me a code example of how this would be done? Maybe just like a chat room type thing so I could see how It works??


Thanks ALOT. ~

~Kodiak

Coding sockets aren't just a one-post length thing. Go download SocketMUD which is a C/C++ barebones MUD codebase. It has pretty much nothing but the sockets so you could see how they work that way.

Side Note: I've seen a few posts about making MUDs and you can't imagine how happy I am that people are still finding interest in them with the age of next-gen. *Holds up his fist* Keep the movement alive!

ShawnCplus 456 Code Monkey Team Colleague

The easiest way would be to do an ifcheck on the input and then set a variable to a number then switch-block the number, ie. User input's Labrador which makes dog_id equal 1, then in the switch-block for case 1 call the function for the dog object with the type of dog being Labrador