Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. A property is not an address, so you shouldn't use inheritance. Inheritance denotes an "is-a" relationship between the child and parent class. What you have is an "has-a" relationship which is made using aggregation or composition. http://en.wikipedia.org/wiki/Object_composition
  2. The regular expressions says: Start of string (^) followed by a character in the range 1-9 ([1-9]) followed by a character in the range 0-9 zero or more times ([0-9]*) followed by end of string ($). Google: "regex" And see: http://www.phpfreaks.com/tutorial/regular-expressions-part1---basic-syntax By the way, preg is faster than ereg.
  3. How are you going to check if the local Apache is running when that's the server you're the script through?
  4. Well, then maybe show the code using that method so we can tell you what you're doing wrong.
  5. Just check out the manual: http://framework.zend.com/manual/en/zend.session.html It's got plenty of examples.
  6. http://www.google.com/search?q=captcha+tutorial+php http://recaptcha.net/plugins/php/
  7. http://www.phpfreaks.com/tutorial/working-with-checkboxes-and-a-database
  8. http://php.net/manual/en/mysqli-stmt.bind-result.php
  9. How about Zend_Session? You won't get a definite answer to which is "the best" because that's subjective.
  10. Universities would be the kind of institutions that need these kinds of massive computational power. Funny that you would use a 32-bit platform on setups that are designed to handle huge amounts of data though.
  11. In your case, only the user huw would have access to that .ssh directory. Either make a new key for Apache/PHP or move the key to where it is writable. I wouldn't recommend using the root user though. You should use an unprivileged user unless the command you wish to run absolutely needs root.
  12. Like this: ssh user@machine -i /path/to/private/key 'command to run on machine as user'
  13. Yes, I am sure: daniel@daniel0:~$ hostname daniel0.net daniel@daniel0:~$ ssh phpfreaks.com 'hostname' phpfreaks.serverpowered.com Are you sure you've got the keys properly setup? Note that it will try with the private key for the user that PHP is run as (which means the user the web server is run as if you run it through a web server). You might want to explicitly set the identity file when calling ssh.
  14. No it shouldn't. This should, however: shell_exec("ssh root@myserver 'uname -a'");
  15. Actually it is. If you generate an array of arrays of natural numbers whose sum is 100, when randomly selecting one of these arrays, the probability of selecting 99+1 is equal to the probability of 100*1. It's unlikely that you select either of those particular ones out of the many that exist, but they are equally probable. Edit: Nevermind. I was still thinking about his initial way of solving the problem.
  16. It's for search indexing. It's not a database.
  17. Yeah you already said that, but how and why? Say I give you the array you're looking for? How do you intend to use it?
  18. Yeah, and this time I remembered to save the updated iptables rules, so if the server reboots again it should work from the start.
  19. Ha... so I've been working on this for a while now, trying to figure out what is wrong. Removing everything, compiling it again. Upgrading. All sorts of stuff. Eventually I find out that iptables is blocking the port that the Sphinx search daemon is listening to. How annoying. Anyway, search should be working again.
  20. Maybe you should elaborate on that. It sounds like there are better ways to do what you're trying to do.
  21. Then pass that individual element instead of the entire array...
  22. You can also just do something like: $start = microtime(true); sleep(2); $end = microtime(true) - $start Same thing really. That parameter was added in PHP5.
  23. Yeah, as I said, it only seems to happen if the key is "key".
  24. Hmm... Check this out: $key = 'key'; $message = 'test'; $encrypted = mc_encrypt($message, $key); $decrypted = mc_decrypt($encrypted, $key); if ($decrypted == $message) { echo 'Works'; } else { echo 'Broken'; } That will output "Broken", but if you do $key = 'abc'; it will output "Works". I cannot give an explanation to that.
×
×
  • 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.