I don't see a destructor at all.
You can define one this way:~CObject( ) { delete [] mName; }
I don't see a destructor at all.
You can define one this way:~CObject( ) { delete [] mName; }
Ok, the code you included is correct.
@deceptikon
You may want to read an intro level tutorial to CPP
http://www.learncpp.com/cpp-tutorial/121-pointers-and-references-to-the-base-class-of-derived-objects/
Objects don't actually recreate their function data (it's not included in structure size) when creating multiple objects.
They refer to a static address table of functions, if the compiler thinks the pointer is a base class it will call the base class function.
@deceptikon
You must be high, at run-time the container object won't know which object is a derived type (versus being a base type) unless he defines the type within the class and casts the base class pointer to the derived class pointer.
@tanatos
In your code, everything will be treated as article within Library.
That means if you have,CArticle *A1 = new CBook(1000);
and you call,A1->print( );
you'll see the output of:virtual void print() const = 0;
@deceptikon
Your solution is wrong.
In your solution, when he calls print() it will treat all of the pointers as articles no matter what they are.
addArticle( ... ) will be interpreted in the context of the pointer.
You'll want to cast it first,
// C++11
auto Magazine((CMagazine*)A3);
// C++3
CMagazine * Magazine((CMagazine*)A3);
Before you call the function itself
Magazine->doSometing( );
// To be quite honest it doesn't really matter what the buffer pointer is
L1.addArticle((void*)Thing); // Some other coders may yell at you if this isn't well documented
Redefine SWAP this way.#define SWAP(a,b) float * t=a;a=b;b=t;
I'm not sure how you can pass implicit type to the define pre-processor. If anyone has any idea, I'd love to know.
By the way, you could also perform a XOR swap.
#define SWAP(a,b) a^=b;b^=a;a^=b;
#define SWAPPTRCONT(a,b) *a^=*b;*b^=*a;*a^=*b;
Pintrest for example has abstract height for images.
You can see a solution to the problem in this jQuery plugin Wookmark.
To have abstract height or abstract width, one of the two must be undefined.
Hey, the error is
vector.empty() doesn't take 1 argument
.mainWrapper{ <---------------------
background-color:red; entirety
width:630px; <-----------------------------------
height:400px;
}
One and two have fixed width,
which consume the entirety,
so it returns.
This is only a hypothesis, perhaps '' is not a valid input.
$query = "INSERT INTO creditlog ('from','to','amount','type'') VALUES ('$sentFrom','$sentTo','$afterCredits','$type');";
'type'' should be 'type'
First you want to start a session.
session_start();
You'll need to include the code (or HTML form) which POSTs; a small bit about how you use it would also be helpful.
isset() is a function, which checks to see if some object is set, or not.
|| is a logical OR operator,
In english, you could say, "OR"
if( condition OR condition ) then ...
In this case, !isset($_POST['potatoes'] should be !isset($_POST['potatoes'])
In my haste, I didn't add the closing parenthesis.
Edit: It would behoove you to understand the error messages, most of them are quite simple.
He said,
but I still get an infinite loop when the input for ‘difficulty ‘ is not an integer.
Meaning he intends for the loop to end when difficulty is not an integer.
if( !isset($_POST['potatoes'] || !isset($_POST['id']) ) die ("Invalid POST.");
$potatoes = $_POST['potatoes'];
$id = $_POST['id'];
$res = mysqli->query( "UPDATE `plate1` SET potatoes=$potatoes WHERE id=$id" );
You took me too literally...
$res = $mysqli->query( "UPDATE `plate1` SET potatoes=$_POST['potatoes'] WHERE id=$_POST['id']" );
After it completes, don't expect $res to be a list of affected rows.
You can test $res for truth though,
$mysqli->query( "" ) or die( "reason" );
$res = ...
if( $res == false ) die ( "reason" );
Well, update doesn't return anything.
So of course you can't translate NOTHING into ROW.
Also, you don't need to wrap your query in parenthesis [ UPDATE table SET value=('value') ] Why not [ SET value='value' ] ???
Plus, it's better if you refer to post with quotes rather than symbol.
$_POST['value'] not $_POST[value]
You aren't necessarily wrong, but I'm fairly certain this behavior is deprecated for all but numeral type.
$files = array( );
$dir = opendir( $name );
while( false !== ($file = readdir($dir)) )
{
if( $file != '.' && $file != '..' )
{
$pop = explode('.',$file);
$ext = "";
if(count($pop)>1) $ext = array_pop($pop);
$files[implode('.',$pop)][] = $ext;
}
}
closedir($dir);
print_r($files);
default:
cout << "\nYou have made an invalid choice." << endl;
return 0;
switch(...) { }
// The switch ends
while( expr ) ; // Do nothing
// Forever...
Is the file which contains the form the same file as the script which processes uploads?
You have no form action.
<form action=
You have no form action.
$uploadDir . $fName will result in "/srv/www/htdocs/diruploadfileName
You're missing a forward slash.
Otherwise, you already stated that $_FILES is empty, therefor the entire script will fail.
You should include the <form> you use to submit the file [plain HTML]
It's better if you include a sample of the HTML you use to submit files, along with the .php file which receives that submission.
Especially considering you're confident about file permissions.
if "-s" in foldername:
???
If the position remains constant after it is found, you could always image search the screen.
So pretend you have 3 surfaces (shapes).
1) the screen (rect)
2) some comparable, constant part of health bar image (rect)
3) a rectangle of equal dimension to (2), to fill in iteration
read (2) from .image memory
for each step size in dimension of (1),
sample spatial position as (3),
return true if equal to (2)
else next spatial iterator
It helps to have a simple expression of the shape in linear format in mind.
For example,
array[100] and array[10][10] are logically equivilant.array[ y * width + x ] == array[x][y]
Once you find the image, save its position.
That way, you don't have to search for it unless the result is invalid.
Can you explain the nature of getpixel?
Are you able to read the memory of the executable in real time?
You'll want to start with the PHP manual.
Here is the basic document regarding sessions.
This is the entire sessions document tree.
A specific document about the container $_SESSION[].
Check in the textbook your teacher assigned to you for this class.
You have 19 activities but you're trying to access the 20th one, which crashes your script.
Counting starts from 0.
Also, feel free to increment x outside of the if statement, since you increment it either way.
if (choice == "1")
theirChoices.push(activityName[x]);
++x;
WC_Cart::get_fees() is undefined.
You'll have to write the function.
No, I meant for you to replace item(0) with item(selected) and set it to false, then set item(selected+1) to true. It's not the same.
Something like,
ListView1.Items.Item(ListView1.FocusedItem.Index+1).Selected = True;
ListView1.Items.Item(ListView1.FocusedItem.Index).Selected = False;
Though I'm not certain of your objective.
There is a lot of missing context, and honestly I didn't take that long to understand your question... however...
ListView1.Items(0).Selected = True
Items(0) is the first item, so it sounds like that's your problem.
SELECT
c.id AS CID, c.vendorid AS VID,
c.course_title, c.author,
c.date_added, c.last_updated
FROM `courses` AS c
JOIN `vendors` AS v
ON VID=v.id;
Print the result and think about it for a while
Please give a sample of the tables.
For example, every column name and perhaps a brief description.
You can make 1 query return information from 2 or more tables using INNER JOIN.
$.post('script.php'
in script.phpif(isset($_POST['names'])) print_r($_POST['names']);
Beej's guides contain intros to network programming and interprocess communication which are both excellent.
Ok ok ok, I really wanted you to figure this out on your own... but it's almost like the typo is holding you back.
Are you sure the connection is properly established?
You left your original query which causes the program to die, you never get to see the output of ->error
From what you've given, there is no way to tell if you failed to submit.
I don't know what code library you're using and I don't really care to find out about its semantics, either.
For all I know, this data is successfully passed to getdata.php.
Why don't you make getdata.php perform the SQL query, and then check to see if it added a row.
Even better, have getdata.php echo something, and then when you receive the response from POST, you can draw it into a text box on the current page. That last request might be difficult for you, but you could at least provide some way of knowing if the request worked at all.
Also, it might help for you to include the HTML of #demoForm
I think this may be a communication breakdown due to our differing native language.
I understand that PHP is catching your error, but you need to ask MySQL what the problem is instead.
I intuited that query did not return a valid result, which is why I attempted to make you check that case.
You'll want to make sure that $result is in fact a valid object.
From the example given in PHP Manual mysqli::query
if (!$mysqli->query("SET @a:='this will not work'")) {
printf("Error: %s\n", $mysqli->error);
}
If you do this, it may give you some insight.
class SQLink
{
public $sqlink;
// make a connection...
public function __construct( $host="localhost", $u="root", $p="", $db="" )
{ // I can't save you from this.
$sqlink = new mysqli( $host, $u, $p, $db );
}
// If you want to call query with the -> operator, be careful
// link->query [does], returns reply.
public function __get( $q )
{
return $sqlink->query( $q );
} // That's all.
// If you're not comfortable with the language, it's probably safer for you
// to route query this way.
public function query( $q )
{
return $sqlink->query( $q );
}
};
$sql = new SQLink( "host", "uname", "pass", "db" );
$table = "arbitrary";
$q = "SELECT * FROM $table";
$res = $sql->$q;
$res = $sql->query( $q );
P.S. In case it's not clear, you'd instantiate this in a global include file for your purpose.
P.P.S. The object doesn't have to be global to be in scope.
That's already page scope, and you could use $row anywhere on the page.
If $row appeared in a function, you could only use it within that function.
The scope is important, perhaps you should provide the code you're using which causes your actual problem.