-
Posts
15,227 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Which one? Random? First? First in what order?
-
I can give pointers, sure, but I don't know what all you've been taught. Your teacher wouldn't ask you to write a parser unless s/he gave instructions on how to do so. So now, (a) did the teacher tell you how to do it and (b) are you sure you're supposed to?
-
There are two problems: 1. getElementsByClassName (as well as getElementsByTagName) returns a DOMNodeList, or whatever the name of the interface is. It's more than just an array: it can change as its elements change. When you remove items that are found in that list, they also disappear from the list. As i counts up, the length of the list counts down. 2. "in" is dangerous. It will find everything that's a member of whatever you're trying to traverse. Try console.log()ing or alert()ing i, see what you get. var details = document.getElementsByClassName("details"); // simply going from 0->length wouldn't work as the length changes // going in reverse is a cheap alternative for (var i = details.length; i > 0; i--) { var p = details[0].parentNode; p.removeChild(details[0]); // once removed, [1] becomes [0], [2] becomes [1], etc. }
-
When you don't want external code to have access to something but might want children to. Like "helper" methods or useful variables.
-
Yeah... Because you're overwriting the previous value. Right there on the first line.
-
Assuming that totaltime was previously set, just subtract that value from time(). time() - $_SESSION['Yahtzee']['totaltime']
-
Yes, but first you should ask your teacher/professor whether the malformed XML was intentional and how you should deal with it. [edit] And whether you're supposed to write your own XML parser or what. I would expect so.
-
Can PHP dynamically change .htaccess files?
requinix replied to Ivan Ivković's topic in PHP Coding Help
A web-based text editor comes to mind. How? [edit] You might be talking about a kind of site administration thing, but in that case the .htaccess is just a normal file you'd want to edit as your site evolves. We're talking about something that needs the .htaccess to change dynamically and (I assume) automatically for whatever reason. -
What errors, if any, does libxml_get_errors return?
-
Can PHP dynamically change .htaccess files?
requinix replied to Ivan Ivković's topic in PHP Coding Help
...but there are, like, zero reasons you should ever need to. What are you trying to do? -
Check the PHP manual for exactly what the w+ mode means:
-
I vaguely recall there being problems with PHP, libxml, and filesystem access. Some security settings preventing reading and writing. Are you simply dumping /Schema/Table to a file?
-
bind_param("$srt.'i'", $par, $c_arr_tags) That first argument is a bit messed up. If $str was empty then you'd be passing literally .'i'
-
string cmd = string.Format(@"-u{0} -p{1} -h{2} {3}", "root", "password", "localhost", DBName); Those are the arguments you're giving to mysqldump.exe. Modify that so you get the kind of backup you want. mysqldump
-
Go through the lines in the file and keep track of (=store in an array) the lines you actually want to choose from. Then array_rand() on that.
-
Try something more like foreach ($array as $key => $value) { if ($value is an array) { $return = recursive search on $value; if ($return means that the search found the value) return $return; } else if ($value matches the search value) { return whatever you want; } }
-
Trying To Get Button Inside Anchor Tag to Valididate in HTML5
requinix replied to jimmyoneshot's topic in HTML Help
A tags are anchors (and inline). Use a DIV instead (which is block). -
can't connect to mysql server on 'localhost' 10061
requinix replied to nephesh's topic in MySQL Help
mysqld is the server process: that needs to be running before you can connect to it. -
Do you need to specify a "category" in that $arg2?
-
copy works too.
-
Isn't accessing a static variable from a non-static function bad?
requinix replied to AFTNHombre's topic in PHP Coding Help
That syntax is bad, yes. Accessing them in general is fine, but the way to do it is self::$FormatType Yes, PHP is tolerating the code, but somewhere it's creating warning messages (even if you can't see them).