Re: [PHP] Re: Problem: Writing into Files?

2009-08-02 Thread Richard Heyes
Hi, > ... You can write a single byte to the file to "increment" the counter, then to read the count just use filesize(). I believe the a fopen() mode will handle locking for you. It will result in a slowly growing file, but space isn't exactly at a premium nowadays, and when the file gets to a c

[PHP] Re: Problem: Writing into Files?

2009-08-02 Thread Ollisso
On Sun, 02 Aug 2009 07:11:27 +0300, "Parham Doustdar" wrote: Dear Ollisso, I tried it with FLock() but it still didn't work. This is what I did: [code] $fp = fopen($f, "r"); $count =fgets($fp, 1024); fclose($fp); $fw = fopen($f, "w"); while (!flock($fw, LOCK_EX)) sleep(1); $cnew = $count + 1;

[PHP] Re: Problem: Writing into Files?

2009-08-02 Thread Parham Doustdar
Now this one always sets the file to one for some reason. I'll reiterate just in case there's been a misunderstanding on my part: [code] $fp = fopen($f, "r+"); while (!flock($fp, LOCK_EX)) sleep(1); $count = fgets($fp,filesize($fp)); ftruncate($fp, 0); fwrite($fp, ($count+1)); flock($fp, LOCK_UN);

Re: [PHP] Re: Problem: Writing into Files?

2009-08-02 Thread Parham Doustdar
Dear Richard, I don't quite know how I can write a bite into a file. I also looked into a manual and couldn't find a mention of FLock-ing in the explaination for FOpen parameters. Thanks a lot for your help. -- --- Contact info: Skype: parham-d MSN: fire_lizard16 at hotmail dot com email: parha

[PHP] Notification system

2009-08-02 Thread Dušan Novaković
Hi, Does anyone has any idea how to create notification system with combination of php, mysql and javascript. It should be something similar to facebook notification system (when someone make some action it should be automatically reported to other people on system through pop-up menu or something

Re: [PHP] PHP programming strategy

2009-08-02 Thread Larry Garfield
On Saturday 01 August 2009 11:01:11 pm Eddie Drapkin wrote: > > I actually benchmarked that once. I had a reasonably large PHP file that > > was, in fact, over 50% docblocks. That's not even counting inline > > comments. While trying to find things to optimize, removing about 800 > > lines worth

Re: [PHP] PHP programming strategy

2009-08-02 Thread Eddie Drapkin
On Sun, Aug 2, 2009 at 2:24 PM, Larry Garfield wrote: > On Saturday 01 August 2009 11:01:11 pm Eddie Drapkin wrote: >> > I actually benchmarked that once.  I had a reasonably large PHP file that >> > was, in fact, over 50% docblocks.  That's not even counting inline >> > comments.  While trying to

[PHP] PHPGitAdmin Project Brainstorm

2009-08-02 Thread Daniel Kolbo
Hello, I had a thought today while walking...why do all ideas come while walking under the sun rather than slouching in front of the LCD's glow? Wouldn't it be cool to develop an application that allowed one to manage Git via PHP? I'm thinking, sorta like how the PHPMyAdmin project helps people

Re: [PHP] Re: Problem: Writing into Files?

2009-08-02 Thread Richard Heyes
> I don't quite know how I can write a bite into a file. I also looked into a > manual and couldn't find a mention of FLock-ing in the explaination for > FOpen parameters. Ok, from memory: The 1 could be any single byte character I guess. -- Richard Heyes HTML5 graphing: RGraph - www.rgraph.n

[PHP] newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?

2009-08-02 Thread Govinda
Hi all I posted this on the PHP-db list, but it is sunday.. and with so little traffic today, perhaps no one will mind if I post this here too? (with hoped I'll get a quicker pointer?). I'm translating some code from another server-side language into PHP, and I need something that 'summa

[PHP] how to pass variable argument list in a childconstructor to parent constructor, ideas wanted

2009-08-02 Thread Ralph Deffke
problem: __ construct( $something ... variable argument list ){ parent::__construct( ??? ); } I tried with func_get_args, but the problem is that it gives an indexed array back. lets say the argument list is mixed like this: ( "string", "string", array) func_get_args will give this [0] => "

Re: [PHP] how to pass variable argument list in a childconstructor to parent constructor, ideas wanted

2009-08-02 Thread Jonathan Tapicer
I don't understand completely your problem, but think that something like this may help you: This will output: array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } As expected. The key is using call_user_func_array in combination with func_get_args to call the parent constructor wi

Re: [PHP] Script to Compare Database Structures

2009-08-02 Thread Mattias Thorslund
Look into the Reverse module of PEAR MDB2. http://pear.php.net/manual/en/package.database.mdb2.intro-reverse-module.php Cheers, Mattias Matt Neimeyer wrote: I know I CAN hack something together but I hate to reinvent the wheel. I want to be able to compare the structure of two different clien