Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. Well, you have a few issues there. For example, I'm not sure what you're trying to do here: $mean = (($array_total/$array_count) / $array_count); Shouldn't that be just $array_total / $array_count? Anyway, I'll attempt to explain how to go about solving this problem step by step.. Before we attempt to write a program to calculate standard deviation we must understand what standard deviation actually is, and often just writing down what you're trying to replicate in a program makes it much easier. Standard deviation is defined as: [tex]\sigma = \sqrt{\frac{\sum_{n = 1}^n (x - \overline{x})^2}{n}}[/tex] In words, this simple means that for each number we find the different between it and the average of the numbers, square that result, then find the average of all the results, and take the square root of that. So, now all we need to do is convert this into a procedure in code. First, we'll find the average of the set we're dealing with: $mean = array_sum($sample) / sizeof($sample); Now, we'll loop through all the values in array and find square of the difference between each number and the mean. $devs = array(); foreach($sample as $num) { $devs[] = pow($num - $mean, 2); } Now that we have an array ($devs) of the deviations, we simply find the average of those, then take the square root of that. So.. $standard_deviation = sqrt(array_sum($devs) / sizeof($devs));
  2. I don't think that's a fair comparison. In the 90s cars were already being mass produced for nearly a century with the rough idea being around for over 3 centuries, whereas the web was just getting off its feet in the 90s. Here's an example of what a car might have looked when it was the same age as the web was in the 90s: http://www.blurtit.com/var/question/q/q1/q17/q172/q1723/q172323_382419_860_car1 Granted all websites in the 90s weren't completely horrendous, but there has certainly been an increase in the look and feel of your average website over the years.
  3. You're still looking at the problem from only your perspective. You're coming off as if every programmer programs strictly for money. Just because that's your intention doesn't mean that it's everyone's. Programming and programming for pay are two completely different concepts, and because the OP made no explicit nor implicit reference to making money with programming it's unfair to bring it up. The original question was a question from a programming perspective, and that alone doesn't permit you answer the way you did. There was no reference to making money whatsoever, so regardless of whether or not you think freelancing using "correct" standards is necessary is completely besides the point. The fact is that the OP was asking a question from a programming perspective, and that has absolutely nothing to do with how much money you can make freelancing depending on which route you take.
  4. @tibberous: Pretty much everything you said is either extremely subjective, or just outright bad advice. Only if that's their goal. Just because it was yours doesn't mean it's everyone's goal. That's a horrible recommendation. It's extremely unprofessional and asking for trouble. If you don't know how to do something you shouldn't be getting paid for it in the first place. If you're only interested in making money, screwing over clients, being dishonest, and not interested in learning proper techniques and being professional, then maybe you should follow that advice.
  5. $old_string = "097110107"; $arr = str_split($old_string, 3); $new_string = ""; foreach($arr as $char) { $new_string .= chr($char); } echo $new_string;
  6. There are paid subscriptions already: http://www.phpfreaks.com/forums/profile/?area=subscriptions
  7. Looks like you have an extra ) here: ADDDATE(NOW()), INTERVAL 1 MONTH) Shouldn't that be: ADDDATE(NOW(), INTERVAL 1 MONTH) ?
  8. This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=316160.0
  9. Well, such questions are the basis for science, but I think I understand what you meant. If tibberous was asking for an answer from an evolution point-of-view (which I don't necessarily get the feeling he is), then the discrepancy lies seemingly in the understanding of evolution. A better way to go about this would be to support the positive postulate and explain why you believe that they would be solid enamel (simply because you think it might be better isn't a valid argument), since the burden of proof is on the person trying to prove the positive assertion, anyway.
  10. I could be wrong, but what I got from it was: "why aren't teeth naturally solid enamel?"
  11. Houses are generally not primarily constructed of concrete, and although looking at it from this single perspective it seems that it might be best, you must realize that other factors you are not considering come into play. Otherwise this method would be employed universally, no? Your original question suffers from the same lack of varied perspective. Besides, in your original question you make it sound as if it was a conscious decision made by someone. In your concrete house analogy, it might be fair to ask "Why aren't houses made of concrete?", but you can't apply the same question to the composition of human teeth, for there was no conscious logical decision made in determining this. Evolution, and more specifically, natural selection, doesn't necessarily return optimal results, but rather, on average, better results. Following your same line of thought, similar questions would be: "Why isn't the human skeleton composed of steel" or "Why don't we have twice the brain capacity". Similar to your question, these questions suffer from the same two flaws: 1. Although when contemplating them initially they might seem better, there are most likely flaws that we have not foreseen because we're looking so blindly. 2. Even if (and that's a big if) it turned out that our postulates were indeed true, evolution simply doesn't work that way. I suppose to reiterate and answer your question most concisely: The reason is one of, or a combination of, the following: 1. Your postulate isn't really optimal. 2. Evolution doesn't necessarily provide optimal results.
  12. I think I've experienced this in IE (8?). If you're able to, you should be using a more modern web browser (Chrome, FF, etc..). In any case, this seems like something you'll most likely need to take up with SMF, rather than PHPFreaks.
  13. How is that pointless? If your tooth hurts there is a reason, perhaps infection, and by removing the tooth you're preventing the infection from spreading. Hardly seems pointless to me.
  14. This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=315426.0
  15. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=315156.0
  16. ~name="form_key" value="([^"]+)"~
  17. When you define functions you don't need to specify the return type; in fact, you can't, but for functions that come bundled with PHP the manual tells you the return types. PHP isn't a strict-typed language, but types do still exist. Just because you can't define explicity what a function must return, it doesn't mean that it doesn't return a variable of some type. For example, consider the following function: function some_function() { return "This is a string!"; } There is obviously no explicit definition for the return type of that function, and such a declaration isn't possible in PHP, but that function will always return a string type.
  18. That's the return type for the method. The constructor doesn't return anything, so it's void.
  19. In URLs, the octothorpe has a specific meaning. To use it in another way inside the URL you'll need to use urlencode / urldecode.
  20. It would be more like: $pass = md5($pass . $salt);
  21. He's talking about PHP GD, so it will be an image.
  22. Select only the data you need from the database in your query: $result = mysql_query("SELECT field_item_id_value FROM `content_type_ads`"); (note: In your code, unless you've changed it since the OP, you're also using the nid column)
  23. There used to be a forum for SEO, but it was removed for lack of activity (I think).
  24. This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=312721.0
  25. It's skipping the first record because the first record is being grabbed by this line: $row = mysql_fetch_array( $result ); and nothing is being done with it. Just remove that line and it should work fine.
×
×
  • 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.