Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. Google uses BigTable Not for everything. http://www.mysql.com/customers/view/?id=555
  6. You round using the round function.
  7. Uh, multiply by 1.1?
  8. 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); }
  9. Unix time is defined as being UTC. As for timezones, just change the date.timezone ini setting.
  10. Okay, so let me explain why it works... Basically you're trying to figure out how far the user is from getting to the next level. For each level you have the minimum required fans. This is acting as an offset, so you essentially just need to subtract this from the other parameters.
  11. How doesn't it work? Take level 2 for instance: min = 75; max = 149 current = 75 => progress = (75-75)/(149-75) = 0.0 = 0% current = 112 => progress = (112-75)/(149-75) = 0.5 = 50% current = 149 => progress = (149-75)/(149-75) = 1.0 = 100% 0.1 = 10% 0.1 * 100 = 10% * 100 = 1000%
  12. The display time should obviously default to the school's local timezone. If you want to be further unambiguous and target a worldwide audience, what's preventing you from printing the timezone information to the screen?
  13. [math]progress = \frac{current - min}{max - min}[/math]
  14. Can't you just parse it yourself then? CSV files are trivial to parse. In fact, see the fgetcsv function.
  15. Because variables cannot start with digits. Read the manual... http://www.php.net/manual/en/language.variables.basics.php
  16. 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.
  17. Since when did that become universally accepted in the scientific world?
  18. 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?
  19. 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.
  20. 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.
  21. It also depends on what exactly you're going to do with "computing".
  22. 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));
  23. Almost sounds like this one: http://creativecommons.org/licenses/by-nc-nd/3.0/
  24. 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
  25. From the manual on include:
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.