Jump to content

Zane

Administrators
  • Posts

    4,362
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zane

  1. http://php.net/manual/en/function.stats-standard-deviation.php function standard_deviation($aValues, $bSample = false) { $fMean = array_sum($aValues) / count($aValues); $fVariance = 0.0; foreach ($aValues as $i) { $fVariance += pow($i - $fMean, 2); } $fVariance /= ( $bSample ? count($aValues) - 1 : count($aValues) ); return (float) sqrt($fVariance); }
  2. You mean $files = glob('*txt);
  3. Try LogMeIn
  4. Tutorials, tutorials, and more tutorials. If you don't like tutorials, then I suggest you come up with an idea for a web application that doesn't involve cloning facebook, or twitter. Start small. You obviously can't learn PHP overnight, but you CAN come up with a simple idea for an application overnight. Suppose you have a massive collection of MP3s, you can use PHP to organize them and search through them. Suppose you have full bookshelves that you would love to keep track of. Suppose you are a business owner and your inventory is only stored in paper form. The key is to find something relevant to your everyday life that can be improved with a web application. It doesn't matter if you're a plumber, a carpet salesman, a blacksmith, a writer, or even an alcoholic.... there is always something to be organized. And that is where you begin in the PHP learning process... this also applies to other languages, but your question dealt with PHP so.. yeah. Find your problem, google the hell out of it, READ THE PHP MANUAL, and read a few tutorials. There are quite a few hosted here on PHPFreaks.
  5. Zane

    NaCl

    I thought NaCl was salt.
  6. I haven't exactly read every reply in here, but wouldn't it be easier to set name to NULL instead of a white-space? This way you could simply SET name = NULL You could also query for null values with WHERE name IS NULL
  7. HTML5 is the ideal doctype to have, but seeing as a good percentage or people are still using XP and IE6 and 7, you should just maintain that same HTML4.01 Traditional/Strict/etc. doctype that has been around since 1999. Unless you absolutely need HTML5 features I don't see any point in using it. Here is a rundown of differences. http://dev.w3.org/html5/html4-differences/
  8. http://www.php.net/manual/en/function.nl2br.php#91828
  9. Well if you have no say so in the construction, you could always grab the fields with DESCRIBE and use the LIKE keyword to grab them all. $describe = mysql_query("DESCRIBE yourtable"); while($r = mysql_fetch_array ($describe)) { $fields[] = $r['Field']; } // Create SQL statement $sql = "SELECT * FROM yourtable WHERE "; $c = 0; foreach($fields as $field) { if($c >= count($fields)) $sql .= "(`$field` LIKE '%.jpg')"; else $sql .= "(`$field` LIKE '%.jpg') OR \n"; $c++; } $query = mysql_query($sql) or die("SQL: $sql \nError:" . mysql_error());
  10. use the plus selector to select the adjacent sibling element. #t1:hover + t2 { background-color: green; }
  11. I agree with Pikachu, it would just be an annoyance. Besides, the point of these forums is to teach programming, including code syntax. If you're too lazy, or too incapable, to type the BBC codes, then you obviously need more programming practice.
  12. yes, my bad.. You are supposed to compare it to zero. IOW, $count % 4 == 0
  13. You need to use the .click() function to initiate anything after clicking a button.
  14. What have you tried so far? .. and jQuery would definitely be the way to go.
  15. Have you tried using the include function built-in to PHP.
  16. Check out PHP's get_browser function
  17. http://www.tshirthell.com/hell.shtml Click Baby Hell.. funny stuff.
  18. If you want to put text underneath each image, then you'll need to either create a span element with some CSS modifications or... use a table.
  19. For this effect you use the modulus operator along with a counter Example, using part of your code $count = 0; while($tir = mysql_fetch_array($tiquery)) { $tiid = $tir['itemid']; $tin = $tir['name']; $tiim = $tir['image']; $tid = $tir['description']; echo ""; if($count % 4) echo " \n"; $count++; }
  20. So long as your only using PHP to access that file, I don't think it should matter. Now if you somehow mixed PHP code with ASP code (through AJAX most likely) and used them both to access the same file, then you might have access issues. Also, it's just a txt file.. Think of how many millions of users access the same index page when they go to Google..there's no access issues there
  21. Again, why do you have 600.000 lines inside one field? If you're c/p'ing this from a text file with newlines,... why don't you just use the file function? Instead of putting all those lines in the database, just reference the text file's name.
  22. I don't believe there is a way to select 2000 random lines from a single field. I also can't understand why you have such a database design. I'm only assuming, in the below example, that there is an actual newline in between each 600,000 set. Anyway, since I'm not an SQL genious, I can only show you how I'd use PHP to do this. Perhaps fenway knows a much more efficient way. Note: this isn't tested whatsoever.... while($row = mysql_fetch_array($result)) { $x = shuffle( explode("\n", row['lines']) ); $data[] = array_rand($x, 2000); //echo " "; } echo "", print_r($data), ""; What I'm doing is breaking the 600,00 lines into an array Then I shuffle that... making it randomized. From that shuffled array, I then grab 2000 random entries from it.
  23. I'm not exactly sure what $row['lines'] holds.. Try this and post the output. while($row = mysql_fetch_array($result)) { $data[] = $row['lines']; //echo " "; } echo "", print_r($data), ""; [/code
  24. What separate table? You only provided very vague information about one table.
  25. depends on the linux distro. Then you google it like {linux distro} minecraft server setup tutorial
×
×
  • 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.