Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. I wouldn't know how to do that. I can do it in hand, but I wouldn't know how to put it into code. I tried it last night, not fully tested but for my simple tests it worked. Right now it is just a function, but yea. <?php function solve_quadratic($a, $b, $c) { if ((2 * $a) == 0) { $x[0] = "Cannot divide by 0, this is impossible to do."; return $x; } $x[0] = ((($b * -1) + sqrt((pow($b, 2) - (4 * $a * $c)))) / (2 * $a)); $x[1] = ((($b * -1) - sqrt((pow($b, 2) - (4 * $a * $c)))) / (2 * $a)); if ($x[0] == "NAN" || $x[1] == "NAN") { $x[0] = "This quadratic is not solveable."; unset($x[1]); return $x; }else { $x[2] = ($b * -1) . " +/- SquareRoot (" . $b . "^2 - 4*$a*$c) / 2 * $a"; $x[3] = ($b * -1) . " +/- SquareRoot (" . pow($b, 2) . " + " . (4 * $a * $c) . ") / " . (2 * $a); $x[4] = ($b * -1) . " +/- SquareRoot (" . (pow($b, 2) + (4 * $a * $c)) . ") / " . (2 * $a); $x[5] = ($b * -1) . " +/- " . sqrt(pow($b, 2) - (4 * $a * $c)) . " / " . (2 * $a); $x[6] = ($b * -1) . " + " . sqrt(pow($b, 2) - (4 * $a * $c)) . " / " . (2 * $a); $x[7] = ($b * -1) . " - " . sqrt(pow($b, 2) - (4 * $a * $c)) . " / " . (2 * $a); $x[8] = ($b * -1) + sqrt(pow($b, 2) - (4 * $a * $c)) . " / 2 = " . (($b * -1) + sqrt(pow($b, 2) - (4 * $a * $c))) / 2; $x[9] = ($b * -1) - sqrt(pow($b, 2) - (4 * $a * $c)) . " / 2 = " . (($b * -1) - sqrt(pow($b, 2) - (4 * $a * $c))) / 2; } return $x; } echo "<pre>"; print_r(solve_quadratic(1, 3, -4)); echo "<br />"; ?> lol I was pretty bored yestarday, day off for Veterans Day. Oh, yeah if you already know what a, b, and c are then it's fairly easy, but take an equation like this: (25*46x)(13*(-13x)) = -32 That's a quadratic equation, but how would you solve it using PHP? The answer is (rounded to 3 decimals): x = -0.013 or x = 0.013
  2. I wouldn't know how to do that. I can do it in hand, but I wouldn't know how to put it into code.
  3. Sounds like the competitions we once used to have. It was dropped due to lack of interest.
  4. Try just COUNT(*) in both instances.
  5. You could take a look at Zend_Pdf.
  6. For the record, what chrisdburns posted is called a registry.
  7. No, you can check it in your php.ini file what it's set to and you can change it there (you'll have to restart the webserver when you've done that). Alternatively you can add these lines to the top of the script you want to change it in: error_reporting(E_ALL); ini_set('display_errors', true);
  8. There can be lots of reasons for that. Make sure you set error_reporting to E_ALL and display_errors to On to check that.
  9. 7's UAC is much more flexible. I tested it in a VM. The users' stupidity/carelessness is not Microsoft's fault. I disagree. If you are continually forced to repeat the same action, it becomes a habit to click without reading. That's human nature if you ask me - it has little to do with being stupid/careless If you answer a question without knowing what the question is then you are both stupid and careless in my opinion. Personally I sometimes find it annoying when I'm not prompted to verify my action. I've sometimes hit the wrong button and that resulted in loss of data. That's also the reason why many people alias rm to rm -i in Linux for the root user. To prevent accidental data loss.
  10. The users' stupidity/carelessness is not Microsoft's fault.
  11. My suggestion is to switch provider (I suppose you mean web host?). If they haven't updated to PHP 5.2+ by now then they're not worth dealing with in my opinion. The difference between PHP4's and PHP5's object model is vastly different and it'll likely be really difficult if not impossible to downgrade your scripts.
  12. I meant the latter actually, but I suppose the former would be possible as long as God exists of course. Well, no, of course not, but take Iran for instance. Many western countries perceive Iran to be bad. On the other hand, so does Iran think about western countries like USA. This is due to ideological differences. By the way, I'm talking on a governmental level here. With "good" and "evil" I simply meant that whoever is "evil" is doing things incorrectly according to the "good" people (dunno if this makes sense). Also, nobody in the real world gets up in the morning and says "How can I be evil today? What kind of evil things can I do today?".
  13. Well, it's quite simple actually. Either part of the conflict believes that God supports themselves and thus opposed the other part. In reality there are four options: 1) God supports party #1 2) God supports party #2 3) God doesn't care 4) God doesn't exist Party #1 believes in option 1, party #2 in option 2, and I believe in option 4. Thus I believe that both parties are mistaken. It's exactly like "good" and "evil" is a matter of point of view. You always believe your way of doing things is the best, so you are per definition good in your own eyes. Logically speaking the other one must then be evil. However, seeing as both parties believes that this voids the meaning of those two concepts, at least objectively speaking.
  14. From the point of view of "us" in a monotheistic religion, nobody (at least no deity).
  15. Well, you know when you've fetched the result using e.g. mysql_fetch_assoc() then you'll get an associative array where the keys are the field names? Before where you used date as key you'd just use date_formatted because you setup an alias in the query. I.e.: $item['date_formatted'] instead of $item['date'].
  16. Hmm... yeah I suppose that internet speed is not a factor when it's first in your cache. However, the entire screen does flicker for me in FF. The only browser it doesn't do that in is in Opera (it somehow didn't want to load in Chrome for me). I definitely think it has to do with the speed of the rendering engine and benchmarks of those always show Trident as the loser. Even then, you're forgetting that the majority of people do use IE so it does not mean that there is no use for AJAX. Furthermore, AJAX can also decrease the load on the server. What do you think takes up less bandwidth? Sending back an entire new page or a small piece of e.g. JSON?
  17. I'm guessing it's because Trident renders slower than Gecko does.
  18. Maybe if you've got 20 Mbps like CV, but if you've got 1 Mbps like when then you can notice it.
  19. The whole page does reload in FF for me. Your internet connection is probably too fast for you to notice and IE sucks so much that it creates a noticeable lag in comparison to FF.
  20. What do you mean?
  21. It's possible to do so the extra work required will be minimal.
  22. It's in the ToS which you agreed to when you registered. Regardless, I'll lock this topic as it's gone way off-topic. cordoprod, you're free to start a new topic regarding your original question if you wish. waynewex, you're free to discuss this matter with whomever you want using PMs.
  23. You can do this: $page = (int) $_REQUEST['page']; $start = ($page - 1) * 25; $end = $start + 25;
  24. What PFMaBiSmAd means it that you should do this instead: $listq = "SELECT *, DATE_FORMAT(`date`, '%M %e, %Y') as `date_formatted` FROM jokes WHERE category = 'Blonde' ORDER BY date DESC LIMIT {$number}, 20"; Then use date_formatted in your app when you need the formatted date.
  25. There is also Textile if you're looking into alternative markup languages.
×
×
  • 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.