Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
XSS and SQL injection are two entirely different attack vectors. A website isn't necessarily vulnerable to SQL injections if it's vulnerable to XSS or vice versa.
-
Doesn't sound particular strange to me. PHP Freaks gets less traffic in the weekends as well, and it results in a graph that looks something like that.
-
Sorry, but you obviously don't understand what an index is or let alone how relational databases work. Go read a book about databases, it's too much to go over in a forum topic. How does your database handle ACID, transactions, locking, integrity constraints. How about "simple" things like table joins or aggregate functions? Or how about user authorization on database/table/column level? There is more to a DBMS than raw speed on simple selection queries, and that is of course the reason why the world uses real databases like MySQL, Oracle, MS SQL, PostreSQL, etc.
-
What the hell are you talking about? None of your post makes sense. The concept of being number 2 only exists if you choose an ordering beforehand. Or do you mean on the disk? You don't unless you choose CHAR as your datatype. Duh, yes. Being able to access information quickly has the tradeoff that it takes up more space. What did you expect? What do you mean with undefined? What's undefined? VARCHAR is exactly the same as CHAR except it has variable ("VAR") instead of fixed length. This means 255. TEXT can store 216. Of course indexes take up space. How exactly do you imagine you would build an index without taking up space? Again, it's a tradeoff. A typically used data structure for building an index could be a B+ tree. This allows searching in O(log n), which is faster than just searching through the table linearly. However, maintaining an index means slower insert times (you'll have to update the index) and a larger disk space requirement (the index needs to be stored somewhere). The power of a DBMS is specifically that it has some metadata that makes it able to figure out how to get the information as fast as possible. If you want to consume the minimal amount of space then store it in a flat file with one row per line and no metadata. Besides, hard disks are really cheap, so the disk space consumption is the least of your worries.
-
Google uses BigTable Not for everything. http://www.mysql.com/customers/view/?id=555
-
You round using the round function.
-
Uh, multiply by 1.1?
-
PHP has no concept of colors, and it certainly has nothing to do with mathematics. Anyways, here you go for all the HTML colors: <?php for ($i = 0; $i <= 0xFFFFFF; ++$i) printf('<span style="color:#%1$06X">#%1$06X</span><br>' . PHP_EOL, $i); }
-
incredibly tired need help with timestamp issues.
Daniel0 replied to monkeytooth's topic in PHP Coding Help
Unix time is defined as being UTC. As for timezones, just change the date.timezone ini setting. -
Can't you just parse it yourself then? CSV files are trivial to parse. In fact, see the fgetcsv function.
-
Because variables cannot start with digits. Read the manual... http://www.php.net/manual/en/language.variables.basics.php
-
"\n" not working, arrays not displaying properly...
Daniel0 replied to rxgvhqkrywq6cxdjoar's topic in PHP Coding Help
You need to read up on content types. If you send data as text/html to a web browser, it'll regard it as HTML. In HTML, consecutive whitespace is ignored. For example, a billion space characters would still only be represented as a single space. -
Since when did that become universally accepted in the scientific world?
-
The source code will always be returned from the webserver. Isn't it your friend's fault that she chose the wrong client to check it out with?
-
Works fine for me: daniel@daniel-laptop:~/test$ ls hello.cpp test.php daniel@daniel-laptop:~/test$ cat hello.cpp #include <iostream> #include <fstream> using namespace std; int main () { ofstream myfile; cout << "Creating File... (hello.txt)\n"; myfile.open ("hello.txt"); cout << "Writing to File...\n"; myfile << "Writing -crap- to this to a file.\n"; cout << "Closing File...\n"; myfile.close(); return 0; } daniel@daniel-laptop:~/test$ g++ hello.cpp -o hello daniel@daniel-laptop:~/test$ cat test.php <?php $command = "./hello"; $output = shell_exec($command." 2>&1") ; echo $output; ?> daniel@daniel-laptop:~/test$ php -v; php test.php PHP 5.3.3-dev (cli) (built: Mar 23 2010 10:24:53) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Xdebug v2.0.5, Copyright (c) 2002-2008, by Derick Rethans Creating File... (hello.txt) Writing to File... Closing File... daniel@daniel-laptop:~/test$ ls hello hello.cpp hello.txt test.php daniel@daniel-laptop:~/test$ cat hello.txt Writing -crap- to this to a file.
-
Just some nitpicking: A reverse DNS (rDNS) lookup is actually something different. Essentially it's going from IP->domain instead of domain->IP. Not a URL, but a domain name. They're different concepts. The dot is the separator. The root-servers are represented by the void after the dot. So essentially google.com.[root] if we were to replace it with something else.
-
It also depends on what exactly you're going to do with "computing".
-
Ah, well, it's pretty easy actually: <?php function matrixMult(array $m1, array $m2) { $m1rows = count($m1); $m1cols = count($m1[0]); $m2cols = count($m2[0]); for ($i = 0; $i < $m1rows; ++$i) { for ($j = 0; $j < $m2cols; ++$j) { for ($k = 0; $k < $m1cols; ++$k) { if (!isset($m3[$i])) $m3[$i] = array(); if (!isset($m3[$i][$j])) $m3[$i][$j] = 0; $m3[$i][$j] += $m1[$i][$k] * $m2[$k][$j]; } } } return $m3; } $m1 = array( array(1, 2), array(3, 4), array(5, 6), ); $m2 = array( array(1, 2, 3), array(4, 5, 6), ); print_r(matrixMult($m1, $m2));
-
I want to license stuff but dont understand it properly, help please.
Daniel0 replied to eddedwards's topic in Miscellaneous
Almost sounds like this one: http://creativecommons.org/licenses/by-nc-nd/3.0/ -
Do you know how to do it using pen and paper? The naive O(n^3) algorithm is just three nested loops. Take a look at http://en.wikipedia.org/wiki/Matrix_multiplication
-
From the manual on include: