-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

* and then Rasmus Lerdorf declared....
> I think you guys are making this way more complicated than it needs to be.
> 
> In this case could I suggest that you make use of the fact that appends of
> less than a blocksize are atomic.  Therefore, why not simply append a
> single character to a text file for each vote?  If you are voting for a
> list of things, assigning a character to each item and simply append 'a',
> 'b', 'c' or 'd' to your file.  The size of the file instantly gives you
> the number of votes cast.  Reading the file and counting the number of
> times each letter occurs using something like substr_count() will give you
> the number of votes for each option.
> 
> That gives you a lockless and flexible system without the risk of deadlock
> or missing votes due to race conditions.

Ladies and gentelman, I think we have a winner, a very simple solution
Rasmus, and more than adequate for my needs.

Shame though, all the other file locking stuff looked like fun ;)

Thanks everyone!
- -- 
Nick Wilson     //  www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE86+WuHpvrrTa6L5oRAgWVAJwJ8vOtpNCUaXd6Qm/gdkB407KXsQCfRSBt
mL4lkx5YnYMAeO+ViTh1mo8=
=1ht8
-----END PGP SIGNATURE-----

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to