[PHP] Re: Progressbar

2009-06-25 Thread Colin Guthrie

'Twas brillig, and tedd at 24/06/09 15:24 did gyre and gimble:
The biggest problem in uploading a file is figuring out how large it is. 
You can't find that out in php


Well you can find it out with the uploadprogress or APC PECL extensions.

If you use Zend Framework then it has a progress bar for file upload 
built in.


http://www.framework.zend.com/manual/en/zend.file.html#zend.file.transfer.introduction.uploadprogress

HTHs

Col


--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] CSV file

2009-06-25 Thread Richard Heyes
Hi,

> Well, you are reading the whole file there (and throwing the data you
> read not assigning the fgets result to anything), and then to store it
> in the database you need to read it again, so you read the file twice.
> It will probably better to store the data you read the first time in
> an array and then store it in the database, that way you read it only
> once.

No, it's not. If the file is large then you could end up reading megs
into memory. If physical memory is low then the pagefile will come
into play and you'll get a lot of disk accesses. Reading 1 line at a
time is far more efficient and with larger files will be faster.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 20th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] Re: Progressbar

2009-06-25 Thread Michael A. Peters

Colin Guthrie wrote:

'Twas brillig, and tedd at 24/06/09 15:24 did gyre and gimble:
The biggest problem in uploading a file is figuring out how large it 
is. You can't find that out in php


Well you can find it out with the uploadprogress or APC PECL extensions.


http://www.clfsrpm.net/upprogress/index.php

example of form and all related files, with soure, demonstrating how 
uploadprogress works to make a progress bar.


My bar is kind of low tech but it works.

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



[PHP] Re: Deleting a file after download/upload

2009-06-25 Thread Parham Doustdar
Hi there Shawn,
Thank you for your help. That works.

-- 
---
Contact info:
Skype: parham-d
MSN: fire_lizard16 at hotmail dot com
email: parham90 at GMail dot com
"Shawn McKenzie"  wrote in message 
news:ee.3d.36467.c0261...@pb1.pair.com...
> Parham Doustdar wrote:
>> Hi there,
>> I am writing a PHP FTP client for my project. I want to put a "download" 
>> option and an "upload"" option, but I don't know how. My problem is this:
>> How can I make the server the PHP script is on delete the file after 
>> uploading it to the SFTP, or after the user has finished downloading it 
>> from the server the PHP script is on?
>> Let me put the question this way.
>> My server connects to an FTP. Then, it downloads a file from the FTP, and 
>> then sends me the link to that temperary file on the server. Now, when I 
>> download it from my server, my script should delete the file. How can I 
>> make it wait until the download of the file is finished?
>> Same goes for uploading.
>> Thanks!
>>
>
> Well if you write a download script, then you can delete it at the end
> and it won't be deleted until after the download completes:
>
> //Do your ftp from remote to local'/path/to/file.ext'
> exec('ftp_get.sh remotefile.ext /path/to/file.ext);
> //or
> $conn_id = ftp_connect($ftp_server);
> $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
> ftp_gett($conn_id, '/path/to/file.ext', $server_file, FTP_BINARY)
> ftp_close($conn_id);
>
>  //send proper headers for download
> readfile('/path/to/file.ext');
>
> unlink('/path/to/file.ext');
> ?>
>
> For upload, depending upon how you're doing it, a call to unlink()
> shouldn't execute until your FTP is done and exited:
>
>  //User uploads file to '/path/to/file.ext'
>
> exec('ftp_put.sh /path/to/file.ext);
> //or
> $conn_id = ftp_connect($ftp_server);
> $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
> ftp_put($conn_id, $server_file, '/path/to/file.ext', FTP_BINARY)
> ftp_close($conn_id);
>
> unlink('/path/to/file.ext');
> ?>
>
> -- 
> Thanks!
> -Shawn
> http://www.spidean.com 



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



RE: [PHP] Re: idiot proofing

2009-06-25 Thread Jay Blanchard
[snip]
...stuff...
[/snip]

I had to LOL at the subject line for the potential irony :)

Typically we set applications to submit to central processing code for a
number of reasons, maintainability being the highest among these. So you
get...

Form->Central Processing->Output

Typically this allows us to stay within the MVC idiom and offers many
benefits.

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



[PHP] require_once failure

2009-06-25 Thread ste.paole...@tiscali.it
Hi all, I'm a php programmer an I found an anomaly.. it could be a bug. 
On Mac Os all goes right but on debian enviroment there are some 
problems:
Suppose I've the file /home/ste/test.php containing the 
following line:
 http://abbonati.tiscali.it/promo/tuttoincluso/

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



RE: [PHP] require_once failure

2009-06-25 Thread Jay Blanchard
[snip] s...@debian:~$ php test.php
Warning: require_once

(PHPUnit/Extensions/Database/Testcase.php): failed to open stream: No

such file or directory in /home/ste/test.php on line 3

Fatal error:

require_once(): Failed opening required

'PHPUnit/Extensions/Database/Testcase.php'

(include_path='/usr/share/php') in /home/ste/ste.php on line 3
[/snip]

The first thing I would do is check the permissions on the file to be
included. If those are OK modify your script to give the absolute path
to the file.

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



Re: [PHP] CSV file

2009-06-25 Thread Jonathan Tapicer
Hi,

I don't say that reading the whole file into memory is the best
option, I just say that your approach goes to the disk twice, if you
have a 100MB file, you are reading 200MB from disk (unless there are
some pages cached in physical memory, but you never can know, in the
best case all the pages will be cached and you will only read 100MB
from disk); and mine, if you have 100MB or more physical memory
(available for the script) will only go once. Of course, if you have
low physical memory, in the worst case you will end up reading 200MB
from disk, because all the pages will go to the pagefile.

So, both approaches have a worst case of reading approximately two
times the file size from disk and a best case of reading it
approximately only once from disk, and since you never know the actual
conditions of the memory, you can't say which approach is better
without additional information.

In the general case, I think that your approach is better for large
files and mine for small files, with the size barrier depending on the
memory set up and current conditions at the time the script runs.

This discussion went in a different direction considering the initial
question of Alain, but this could always be useful for someone.

Jonathan

On Thu, Jun 25, 2009 at 5:37 AM, Richard Heyes wrote:
> Hi,
>
>> Well, you are reading the whole file there (and throwing the data you
>> read not assigning the fgets result to anything), and then to store it
>> in the database you need to read it again, so you read the file twice.
>> It will probably better to store the data you read the first time in
>> an array and then store it in the database, that way you read it only
>> once.
>
> No, it's not. If the file is large then you could end up reading megs
> into memory. If physical memory is low then the pagefile will come
> into play and you'll get a lot of disk accesses. Reading 1 line at a
> time is far more efficient and with larger files will be faster.
>
> --
> Richard Heyes
> HTML5 graphing: RGraph (www.rgraph.net - updated 20th June)
> PHP mail: RMail (www.phpguru.org/rmail)
> PHP datagrid: RGrid (www.phpguru.org/rgrid)
> PHP Template: RTemplate (www.phpguru.org/rtemplate)
> PHP SMTP: http://www.phpguru.org/smtp
>

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



Re: [PHP] require_once failure

2009-06-25 Thread Michael A. Peters

ste.paole...@tiscali.it wrote:
Hi all, I'm a php programmer an I found an anomaly.. it could be a bug. 
On Mac Os all goes right but on debian enviroment there are some 
problems:
Suppose I've the file /home/ste/test.php containing the 
following line:

 also suppose that file 
/usr/share/php/PHPUnit/Extensions/Database/Testcase.php really exist.



If I open a shell and runs the script I've the following fatal error:


s...@debian:~$ php -v
PHP 5.2.6-1+lenny2 with Suhosin-Patch 0.9.6.2

(cli) (built: Jan 26 2009 22:41:04)
Copyright (c) 1997-2008 The PHP

Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

with Zend Debugger v5.2.15, Copyright (c) 1999-2008, by Zend

Technologies

s...@debian:~$ php test.php
Warning: require_once

(PHPUnit/Extensions/Database/Testcase.php): failed to open stream: No

such file or directory in /home/ste/test.php on line 3

Fatal error:

require_once(): Failed opening required

'PHPUnit/Extensions/Database/Testcase.php'

(include_path='/usr/share/php') in /home/ste/ste.php on line 3




Someone can help me? Why on Mac Os there are no problems?
Thanks all


Are you sure it isn't in /usr/share/pear ??
I don't know Debian's layout, but CentOS/Fedora put pear stuff in 
/usr/share/pear - NOT /usr/share/php


I bet if you comment out the explicit setting if the include path it 
would work, the path to pear is usually in the default include path 
defined in the php.ini file on Linux installs.


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



Re: [PHP] require_once failure

2009-06-25 Thread Daniel Brown
On Thu, Jun 25, 2009 at 07:26,
ste.paole...@tiscali.it wrote:
>
> Someone can help me? Why on Mac Os there are no problems?

Start by making sure that the file is there and is readable by the
user as which you are logged in.  Execute the command:

ls -l /usr/share/php/PHPUnit/Extensions/Database/Testcase.php

My guess is that it's not there, but if it is, that it is not readable.

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] PHP doesn't see php.ini

2009-06-25 Thread Bastien Koert
On Wed, Jun 24, 2009 at 8:32 AM, Tir wrote:
> When i installed PHP, I had written to my httpd.conf PHPIniDir "c:/php". But
> phpinfo() returns "C:\WINDOWS" in "Configuration File (php.ini) Path" row
> and right path to my php.ini in "Loaded Configuration File". It looks like
> php.ini really isn't used. I think so because when i try to enable MySQL
> extension it doesn't work ("extension=php_mysql.dll",
> "extension=php_mysqli.dll" and "extension=php_pdo_mysql.dll" is uncommented,
> "extension_dir" is correct, libmysql.dll is copied to C:\WINDOWS\system32).
> I've tried to write to php.ini an abracadabra. But I haven't received an
> error as i expected. I've tried to rename php.ini. phpinfo() has returned
> "(none)" in "Loaded Configuration File" row instead of "c:\php\php.ini" as
> that was before. But PHP still worked. It worked without php.ini. It seems
> very strange. I've searched another php.ini on my system. There is no
> another one. What's wrong? Why doesn't PHP use php.ini file?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Did you use an installer or have another version of php installed at
some point?
-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] PHP doesn't use php.ini

2009-06-25 Thread Daniel Brown
On Wed, Jun 24, 2009 at 09:47, Tir wrote:
> When i installed PHP, I had written to my httpd.conf PHPIniDir "c:/php". But
> phpinfo() returns "C:\WINDOWS" in "Configuration File (php.ini) Path" row
> and right path to my php.ini in "Loaded Configuration File". It looks like
> php.ini really isn't used. I think so because when i try to enable MySQL it
> doesn't work ("extension=php_mysql.dll", "extension=php_mysqli.dll" and
> "extension=php_pdo_mysql.dll" is uncommented, "extension_dir" is correct,
> libmysql.dll is copied to C:\WINDOWS\system32). I've tried to write to
> php.ini an abracadabra. But I havent received an error as i expected. I've
> tried to rename php.ini. phpinfo() has returned "(none)" in "Loaded
> Configuration File" row instead of "c:\php\php.ini" as that was before. But
> PHP still worked. It worked without php.ini. It seems very strange. I've
> searched another php.ini on my system. There is no another one. What's
> wrong? Why doesn't PHP use php.ini file?

It *does* use the file, but will work without it using default
settings.  An initialization file such as php.ini (or httpd.conf,
my.cnf, etc.) is simply a script of variables automatically set at
run-time of the engine reading the file.

Check out the manual entry for installing PHP on Windows and the
user notes - particularly the note from (dpharshman AT dslextreme DOT
com) on 17-MAY-2009:

http://www.php.net/manual/en/install.windows.php


-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



RE: [PHP] Re: idiot proofing

2009-06-25 Thread tedd

At 6:39 AM -0500 6/25/09, Jay Blanchard wrote:

[snip]
...stuff...
[/snip]

I had to LOL at the subject line for the potential irony :)


Me too, but for a different reason -- I fear it's too late.  :-)

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Re: Progressbar

2009-06-25 Thread tedd

At 8:30 AM +0100 6/25/09, Colin Guthrie wrote:

'Twas brillig, and tedd at 24/06/09 15:24 did gyre and gimble:
The biggest problem in uploading a file is figuring out how large 
it is. You can't find that out in php


Well you can find it out with the uploadprogress or APC PECL extensions.

If you use Zend Framework then it has a progress bar for file upload built in.

http://www.framework.zend.com/manual/en/zend.file.html#zend.file.transfer.introduction.uploadprogress

HTHs

Col


I purchased Zend Studio around five years ago, but never got it to 
work for me. Maybe I should try it again.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Re: Unable to load dynamic php_oci8.dll

2009-06-25 Thread Raj
Hi all,

Kindly help me out

Ramesh

On Thu, Jun 25, 2009 at 9:48 AM, Raj  wrote:

> Hi,
>
> I get the following error when i start the Apache Server.
>
> PHP Startup: Unable to load dynamic library
> 'F:\\Apps\\PHP\\ext\\php_oci8.dll' - The specified procedure could not
> be found.\r\n in Unknown on line 0
>
> I dont see there is any issue with the dir as well as the ini file.
> everything is in place.
>
> oracle version in 9.2
> windows XP
> PHP  5.2.10
>
> Kindly let me know, what needs to be checked.
>
> Thank you
>
> Raj
>



-- 


Thank you

Ramesh S Raj


Re: [PHP] Re: Progressbar

2009-06-25 Thread Stuart
2009/6/25 tedd :
> At 8:30 AM +0100 6/25/09, Colin Guthrie wrote:
>>
>> 'Twas brillig, and tedd at 24/06/09 15:24 did gyre and gimble:
>>>
>>> The biggest problem in uploading a file is figuring out how large it is.
>>> You can't find that out in php
>>
>> Well you can find it out with the uploadprogress or APC PECL extensions.
>>
>> If you use Zend Framework then it has a progress bar for file upload built
>> in.
>>
>>
>> http://www.framework.zend.com/manual/en/zend.file.html#zend.file.transfer.introduction.uploadprogress
>>
>> HTHs
>>
>> Col
>
> I purchased Zend Studio around five years ago, but never got it to work for
> me. Maybe I should try it again.

Zend Studio and Zend Framework have no connection to each other beyond
both coming from Zend. Studio took a major leap downhill when they
switched to the Eclipse platform which is why I no longer use it. Take
a look by all means, but don't get your hopes up.

-Stuart

-- 
http://stut.net/

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



[PHP] Unit test platform

2009-06-25 Thread Bob McConnell
I need some guidance. I have looked over the PHP site and don't see any
hints about using PHP interpreters for unit testing. I would like to
know if this idea has any chance of working.

I want to set up the development and build machines with PHP
interpreters to do automated unit tests. Because we use PostgreSQL, I
want to set up those boxes without any Postgres libraries and substitute
FIT test stubs in their place.

1. I have to use MS-Windows as my development platform. Currently I have
XP-Pro with NetBeans 6.5.1. I have played with Eclipse and Komodo
Editor, which remain as possible options. I need a PHP interpreter that
will allow me to write and debug FIT tests for functions already in use,
as well as new code that I write or modify.

2. The production server is RHEL ES 5 with Apache 2 and PostgreSQL. I
cannot make any changes to this platform.

3. The build machine is running Fedora Core (version unknown), also with
Apache and PostgreSQL installed as it is also used for integration
testing. I want to change this to remove the Postgres libraries so they
can be replaced with the FIT back end. Integration testing would require
a separate server which would also solve some other QA issues we have.
We currently do both development and QA testing on this box, releasing a
set of RPM files to production once they have been run through the
wringer.

Is this a reasonable plan?

Where can I find PHP interpreters for MS-Windows and FC that will
support this?

Thank you,

Bob McConnell

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



Re: [PHP] Re: Progressbar

2009-06-25 Thread Eddie Drapkin
On Thu, Jun 25, 2009 at 9:58 AM, Stuart wrote:
> 2009/6/25 tedd :
>> At 8:30 AM +0100 6/25/09, Colin Guthrie wrote:
>>>
>>> 'Twas brillig, and tedd at 24/06/09 15:24 did gyre and gimble:

 The biggest problem in uploading a file is figuring out how large it is.
 You can't find that out in php
>>>
>>> Well you can find it out with the uploadprogress or APC PECL extensions.
>>>
>>> If you use Zend Framework then it has a progress bar for file upload built
>>> in.
>>>
>>>
>>> http://www.framework.zend.com/manual/en/zend.file.html#zend.file.transfer.introduction.uploadprogress
>>>
>>> HTHs
>>>
>>> Col
>>
>> I purchased Zend Studio around five years ago, but never got it to work for
>> me. Maybe I should try it again.
>
> Zend Studio and Zend Framework have no connection to each other beyond
> both coming from Zend. Studio took a major leap downhill when they
> switched to the Eclipse platform which is why I no longer use it. Take
> a look by all means, but don't get your hopes up.
>
> -Stuart
>
> --
> http://stut.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Really?  I think that was one of the better decisions that they made
about it.  I don't know of a better (free) IDE platform.

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



Re: [PHP] Re: Progressbar

2009-06-25 Thread Stuart
2009/6/25 Eddie Drapkin :
> On Thu, Jun 25, 2009 at 9:58 AM, Stuart wrote:
>> 2009/6/25 tedd :
>>> At 8:30 AM +0100 6/25/09, Colin Guthrie wrote:

 'Twas brillig, and tedd at 24/06/09 15:24 did gyre and gimble:
>
> The biggest problem in uploading a file is figuring out how large it is.
> You can't find that out in php

 Well you can find it out with the uploadprogress or APC PECL extensions.

 If you use Zend Framework then it has a progress bar for file upload built
 in.


 http://www.framework.zend.com/manual/en/zend.file.html#zend.file.transfer.introduction.uploadprogress

 HTHs

 Col
>>>
>>> I purchased Zend Studio around five years ago, but never got it to work for
>>> me. Maybe I should try it again.
>>
>> Zend Studio and Zend Framework have no connection to each other beyond
>> both coming from Zend. Studio took a major leap downhill when they
>> switched to the Eclipse platform which is why I no longer use it. Take
>> a look by all means, but don't get your hopes up.
>>
>> -Stuart
>>
>> --
>> http://stut.net/
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> Really?  I think that was one of the better decisions that they made
> about it.  I don't know of a better (free) IDE platform.

I wasn't criticising Eclipse - I think the platform rocks, but somehow
they've managed to screw it up!! I now use Aptana which is also built
on Eclipse but has a far more polished feel to it.

-Stuart

-- 
http://stut.net/

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



Re: [PHP] Re: Progressbar

2009-06-25 Thread Eddie Drapkin
On Thu, Jun 25, 2009 at 10:29 AM, Stuart wrote:
> 2009/6/25 Eddie Drapkin :
>> On Thu, Jun 25, 2009 at 9:58 AM, Stuart wrote:
>>> 2009/6/25 tedd :
 At 8:30 AM +0100 6/25/09, Colin Guthrie wrote:
>
> 'Twas brillig, and tedd at 24/06/09 15:24 did gyre and gimble:
>>
>> The biggest problem in uploading a file is figuring out how large it is.
>> You can't find that out in php
>
> Well you can find it out with the uploadprogress or APC PECL extensions.
>
> If you use Zend Framework then it has a progress bar for file upload built
> in.
>
>
> http://www.framework.zend.com/manual/en/zend.file.html#zend.file.transfer.introduction.uploadprogress
>
> HTHs
>
> Col

 I purchased Zend Studio around five years ago, but never got it to work for
 me. Maybe I should try it again.
>>>
>>> Zend Studio and Zend Framework have no connection to each other beyond
>>> both coming from Zend. Studio took a major leap downhill when they
>>> switched to the Eclipse platform which is why I no longer use it. Take
>>> a look by all means, but don't get your hopes up.
>>>
>>> -Stuart
>>>
>>> --
>>> http://stut.net/
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>> Really?  I think that was one of the better decisions that they made
>> about it.  I don't know of a better (free) IDE platform.
>
> I wasn't criticising Eclipse - I think the platform rocks, but somehow
> they've managed to screw it up!! I now use Aptana which is also built
> on Eclipse but has a far more polished feel to it.
>
> -Stuart
>
> --
> http://stut.net/
>

When's the last you used Zend Studio?  The latest (6.1.2) stable Zend
Studio v. the latest stable Aptana, I'd take Zend Studio hands down.
Granted, the 5 series of Studio were _atrocious_ but that's long past!
 I also don't really appreciate the in-IDE advertising that Aptana
sports.

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



Re: [PHP] Unit test platform

2009-06-25 Thread Bastien Koert
On Thu, Jun 25, 2009 at 10:00 AM, Bob McConnell wrote:
> I need some guidance. I have looked over the PHP site and don't see any
> hints about using PHP interpreters for unit testing. I would like to
> know if this idea has any chance of working.
>
> I want to set up the development and build machines with PHP
> interpreters to do automated unit tests. Because we use PostgreSQL, I
> want to set up those boxes without any Postgres libraries and substitute
> FIT test stubs in their place.
>
> 1. I have to use MS-Windows as my development platform. Currently I have
> XP-Pro with NetBeans 6.5.1. I have played with Eclipse and Komodo
> Editor, which remain as possible options. I need a PHP interpreter that
> will allow me to write and debug FIT tests for functions already in use,
> as well as new code that I write or modify.
>
> 2. The production server is RHEL ES 5 with Apache 2 and PostgreSQL. I
> cannot make any changes to this platform.
>
> 3. The build machine is running Fedora Core (version unknown), also with
> Apache and PostgreSQL installed as it is also used for integration
> testing. I want to change this to remove the Postgres libraries so they
> can be replaced with the FIT back end. Integration testing would require
> a separate server which would also solve some other QA issues we have.
> We currently do both development and QA testing on this box, releasing a
> set of RPM files to production once they have been run through the
> wringer.
>
> Is this a reasonable plan?
>
> Where can I find PHP interpreters for MS-Windows and FC that will
> support this?
>
> Thank you,
>
> Bob McConnell
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


http://www.phpunit.de/ ?

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] Re: Progressbar

2009-06-25 Thread Stuart
2009/6/25 Eddie Drapkin :
> On Thu, Jun 25, 2009 at 10:29 AM, Stuart wrote:
>> 2009/6/25 Eddie Drapkin :
>>> On Thu, Jun 25, 2009 at 9:58 AM, Stuart wrote:
 2009/6/25 tedd :
> At 8:30 AM +0100 6/25/09, Colin Guthrie wrote:
>>
>> 'Twas brillig, and tedd at 24/06/09 15:24 did gyre and gimble:
>>>
>>> The biggest problem in uploading a file is figuring out how large it is.
>>> You can't find that out in php
>>
>> Well you can find it out with the uploadprogress or APC PECL extensions.
>>
>> If you use Zend Framework then it has a progress bar for file upload 
>> built
>> in.
>>
>>
>> http://www.framework.zend.com/manual/en/zend.file.html#zend.file.transfer.introduction.uploadprogress
>>
>> HTHs
>>
>> Col
>
> I purchased Zend Studio around five years ago, but never got it to work 
> for
> me. Maybe I should try it again.

 Zend Studio and Zend Framework have no connection to each other beyond
 both coming from Zend. Studio took a major leap downhill when they
 switched to the Eclipse platform which is why I no longer use it. Take
 a look by all means, but don't get your hopes up.

 -Stuart

 --
 http://stut.net/

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


>>>
>>> Really?  I think that was one of the better decisions that they made
>>> about it.  I don't know of a better (free) IDE platform.
>>
>> I wasn't criticising Eclipse - I think the platform rocks, but somehow
>> they've managed to screw it up!! I now use Aptana which is also built
>> on Eclipse but has a far more polished feel to it.
>>
>> -Stuart
>>
>> --
>> http://stut.net/
>>
>
> When's the last you used Zend Studio?  The latest (6.1.2) stable Zend
> Studio v. the latest stable Aptana, I'd take Zend Studio hands down.
> Granted, the 5 series of Studio were _atrocious_ but that's long past!
>  I also don't really appreciate the in-IDE advertising that Aptana
> sports.

The last time I used it would have been shortly after they released
v6. Prior to that I had been using it for many years. I actually
preferred v5. Aside from being a resource hog it was everything I
needed and more, and it never argued with the way I wanted to work.

I tried Aptana after someone recommended it as an alternative to v6.
For me (and this is a very personal thing) Aptana is a far better
product and is a helluvalot cheaper into the bargain.

-Stuart

-- 
http://stut.net/

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



Re: [PHP] Re: Progressbar

2009-06-25 Thread Andrew Ballard
On Thu, Jun 25, 2009 at 10:32 AM, Eddie Drapkin wrote:
> On Thu, Jun 25, 2009 at 10:29 AM, Stuart wrote:
>> 2009/6/25 Eddie Drapkin :
>>> On Thu, Jun 25, 2009 at 9:58 AM, Stuart wrote:
 2009/6/25 tedd :
> At 8:30 AM +0100 6/25/09, Colin Guthrie wrote:
>>
>> 'Twas brillig, and tedd at 24/06/09 15:24 did gyre and gimble:
>>>
>>> The biggest problem in uploading a file is figuring out how large it is.
>>> You can't find that out in php
>>
>> Well you can find it out with the uploadprogress or APC PECL extensions.
>>
>> If you use Zend Framework then it has a progress bar for file upload 
>> built
>> in.
>>
>>
>> http://www.framework.zend.com/manual/en/zend.file.html#zend.file.transfer.introduction.uploadprogress
>>
>> HTHs
>>
>> Col
>
> I purchased Zend Studio around five years ago, but never got it to work 
> for
> me. Maybe I should try it again.

 Zend Studio and Zend Framework have no connection to each other beyond
 both coming from Zend. Studio took a major leap downhill when they
 switched to the Eclipse platform which is why I no longer use it. Take
 a look by all means, but don't get your hopes up.

 -Stuart

 --
 http://stut.net/

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


>>>
>>> Really?  I think that was one of the better decisions that they made
>>> about it.  I don't know of a better (free) IDE platform.
>>
>> I wasn't criticising Eclipse - I think the platform rocks, but somehow
>> they've managed to screw it up!! I now use Aptana which is also built
>> on Eclipse but has a far more polished feel to it.
>>
>> -Stuart
>>
>> --
>> http://stut.net/
>>
>
> When's the last you used Zend Studio?  The latest (6.1.2) stable Zend
> Studio v. the latest stable Aptana, I'd take Zend Studio hands down.
> Granted, the 5 series of Studio were _atrocious_ but that's long past!
>  I also don't really appreciate the in-IDE advertising that Aptana
> sports.
>

At risk of further hijacking this thread

I still use the old Zend Studio (5.5) and prefer it to the newer
version. I have tried to get into the new version a few times, but it
just seems so much more complicated to even set up a project in the
new version and it seems like there are always updates to some
component or other, many of which I do not use and some of which would
not actually install.

When I went looking for an IDE, I wanted a good code editor with
features like syntax checking and code completion, and I wanted a
debugger that I could step through code to figure out why something
wasn't working as I expected. There were a couple that were close, but
I chose Zend Studio at the time because it seemed to have the most
complete/accurate code completion not only of the core language, but
also recognizing functions and classes declared within the PHP code in
the project itself (especially when you include a basic phpdoc block
that describes the function @params and @return). Perhaps the new
version still does all that wonderfully well, but as I said I've found
it to be not worth the hassle. Perhaps, to be fair, I need to take
some time to get familiar with the new paradigm, but that furthers my
point: I want an editor that I can be productive with more or less out
of the box.

Andrew

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



Re: [PHP] CSV file

2009-06-25 Thread Shawn McKenzie
Jonathan Tapicer wrote:
> Hi,
> 
> I don't say that reading the whole file into memory is the best
> option, I just say that your approach goes to the disk twice, if you
> have a 100MB file, you are reading 200MB from disk (unless there are
> some pages cached in physical memory, but you never can know, in the
> best case all the pages will be cached and you will only read 100MB
> from disk); and mine, if you have 100MB or more physical memory
> (available for the script) will only go once. Of course, if you have
> low physical memory, in the worst case you will end up reading 200MB
> from disk, because all the pages will go to the pagefile.
> 
> So, both approaches have a worst case of reading approximately two
> times the file size from disk and a best case of reading it
> approximately only once from disk, and since you never know the actual
> conditions of the memory, you can't say which approach is better
> without additional information.
> 
> In the general case, I think that your approach is better for large
> files and mine for small files, with the size barrier depending on the
> memory set up and current conditions at the time the script runs.
> 
> This discussion went in a different direction considering the initial
> question of Alain, but this could always be useful for someone.
> 
> Jonathan
> 
> On Thu, Jun 25, 2009 at 5:37 AM, Richard Heyes wrote:
>> Hi,
>>
>>> Well, you are reading the whole file there (and throwing the data you
>>> read not assigning the fgets result to anything), and then to store it
>>> in the database you need to read it again, so you read the file twice.
>>> It will probably better to store the data you read the first time in
>>> an array and then store it in the database, that way you read it only
>>> once.
>> No, it's not. If the file is large then you could end up reading megs
>> into memory. If physical memory is low then the pagefile will come
>> into play and you'll get a lot of disk accesses. Reading 1 line at a
>> time is far more efficient and with larger files will be faster.
>>
>> --
>> Richard Heyes
>> HTML5 graphing: RGraph (www.rgraph.net - updated 20th June)
>> PHP mail: RMail (www.phpguru.org/rmail)
>> PHP datagrid: RGrid (www.phpguru.org/rgrid)
>> PHP Template: RTemplate (www.phpguru.org/rtemplate)
>> PHP SMTP: http://www.phpguru.org/smtp
>>

Stuart is still the winner.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Re: Progressbar

2009-06-25 Thread Martin Scotta
I found extremely un-productive editors or IDEs like Eclipse or Zend Studio.

I use SciTE.

It don't has any feature you are talking about...

but it..
 # do not eat all you ram
 # starts in a microsecond
 # opens any type of file
 # paints the code in pretty colors.
 # has a little intellisense using pre-written words or api files



On Thu, Jun 25, 2009 at 11:55 AM, Andrew Ballard wrote:
> On Thu, Jun 25, 2009 at 10:32 AM, Eddie Drapkin wrote:
>> On Thu, Jun 25, 2009 at 10:29 AM, Stuart wrote:
>>> 2009/6/25 Eddie Drapkin :
 On Thu, Jun 25, 2009 at 9:58 AM, Stuart wrote:
> 2009/6/25 tedd :
>> At 8:30 AM +0100 6/25/09, Colin Guthrie wrote:
>>>
>>> 'Twas brillig, and tedd at 24/06/09 15:24 did gyre and gimble:

 The biggest problem in uploading a file is figuring out how large it 
 is.
 You can't find that out in php
>>>
>>> Well you can find it out with the uploadprogress or APC PECL extensions.
>>>
>>> If you use Zend Framework then it has a progress bar for file upload 
>>> built
>>> in.
>>>
>>>
>>> http://www.framework.zend.com/manual/en/zend.file.html#zend.file.transfer.introduction.uploadprogress
>>>
>>> HTHs
>>>
>>> Col
>>
>> I purchased Zend Studio around five years ago, but never got it to work 
>> for
>> me. Maybe I should try it again.
>
> Zend Studio and Zend Framework have no connection to each other beyond
> both coming from Zend. Studio took a major leap downhill when they
> switched to the Eclipse platform which is why I no longer use it. Take
> a look by all means, but don't get your hopes up.
>
> -Stuart
>
> --
> http://stut.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

 Really?  I think that was one of the better decisions that they made
 about it.  I don't know of a better (free) IDE platform.
>>>
>>> I wasn't criticising Eclipse - I think the platform rocks, but somehow
>>> they've managed to screw it up!! I now use Aptana which is also built
>>> on Eclipse but has a far more polished feel to it.
>>>
>>> -Stuart
>>>
>>> --
>>> http://stut.net/
>>>
>>
>> When's the last you used Zend Studio?  The latest (6.1.2) stable Zend
>> Studio v. the latest stable Aptana, I'd take Zend Studio hands down.
>> Granted, the 5 series of Studio were _atrocious_ but that's long past!
>>  I also don't really appreciate the in-IDE advertising that Aptana
>> sports.
>>
>
> At risk of further hijacking this thread
>
> I still use the old Zend Studio (5.5) and prefer it to the newer
> version. I have tried to get into the new version a few times, but it
> just seems so much more complicated to even set up a project in the
> new version and it seems like there are always updates to some
> component or other, many of which I do not use and some of which would
> not actually install.
>
> When I went looking for an IDE, I wanted a good code editor with
> features like syntax checking and code completion, and I wanted a
> debugger that I could step through code to figure out why something
> wasn't working as I expected. There were a couple that were close, but
> I chose Zend Studio at the time because it seemed to have the most
> complete/accurate code completion not only of the core language, but
> also recognizing functions and classes declared within the PHP code in
> the project itself (especially when you include a basic phpdoc block
> that describes the function @params and @return). Perhaps the new
> version still does all that wonderfully well, but as I said I've found
> it to be not worth the hassle. Perhaps, to be fair, I need to take
> some time to get familiar with the new paradigm, but that furthers my
> point: I want an editor that I can be productive with more or less out
> of the box.
>
> Andrew
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
Martin Scotta

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



RE: [PHP] PHP doesn't see php.ini

2009-06-25 Thread Arno Kuhl
-Original Message-
From: Bastien Koert [mailto:phps...@gmail.com] 
Sent: 25 June 2009 03:11 PM
To: Tir
Cc: php-general@lists.php.net
Subject: Re: [PHP] PHP doesn't see php.ini

On Wed, Jun 24, 2009 at 8:32 AM, Tir wrote:
> When i installed PHP, I had written to my httpd.conf PHPIniDir 
> "c:/php". But
> phpinfo() returns "C:\WINDOWS" in "Configuration File (php.ini) Path" 
> row and right path to my php.ini in "Loaded Configuration File". It 
> looks like php.ini really isn't used. I think so because when i try to 
> enable MySQL extension it doesn't work ("extension=php_mysql.dll", 
> "extension=php_mysqli.dll" and "extension=php_pdo_mysql.dll" is 
> uncommented, "extension_dir" is correct, libmysql.dll is copied to
C:\WINDOWS\system32).
> I've tried to write to php.ini an abracadabra. But I haven't received 
> an error as i expected. I've tried to rename php.ini. phpinfo() has 
> returned "(none)" in "Loaded Configuration File" row instead of 
> "c:\php\php.ini" as that was before. But PHP still worked. It worked 
> without php.ini. It seems very strange. I've searched another php.ini 
> on my system. There is no another one. What's wrong? Why doesn't PHP use
php.ini file?
> --

Did you use an installer or have another version of php installed at some
point?

Bastien

Cat, the other other white meat

--
On my Windows I see the same thing - "Configuration File (php.ini) Path"
points to C:\WINDOWS (even though there is no php.ini there) and "Loaded
Configuration File" points to the dir where the php.ini actuall is. My setup
(PHP 5.2.6) works fine. Presume you did restart apache after making the
change? It looks like your php is using your php.ini since phpinfo reports
(none) when you rename it. Is there anything in your phpinfo output that
relates to your php.ini? Maybe some error near the beginning of php.ini
causes php to stop loading the ini file? Check that the "extension_dir" in
phpinfo agrees with the "extension_dir" in your php.ini.

Maybe try enabling error logging in the php.ini and check the log file - I
use apache\logs\phperror.log and invalid extension loading is definitely
reported there (I've had this problem before). In php.ini set
"log_errors=On" and set "error_log=c:\apache\logs\phperror.log" (or wherever
your apache is installed). Restart apache and check the phperror.log file.
If you find nothing then create a dummy entry to force an error, something
like "extension=php_dummy.dll" to check that the error logging is working.
If your logging is working and there is no error reported for loading the
mysql extension, and you still see no entry for mysql in phpinfo output,
then you have a different problem, maybe a mysql installation problem.

HTH
Arno


"Cat, the other other white meat" - looks like the economic downturn hit
really hard... 
Does it go with "Weed, the other green tea"?



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



Re: [PHP] Re: Progressbar

2009-06-25 Thread Michael A. Peters

Martin Scotta wrote:

I found extremely un-productive editors or IDEs like Eclipse or Zend Studio.

I use SciTE.

It don't has any feature you are talking about...

but it..
 # do not eat all you ram
 # starts in a microsecond
 # opens any type of file
 # paints the code in pretty colors.
 # has a little intellisense using pre-written words or api files




I almost exclusively use bluefish, the closest I come to an IDE for 
anything I do is emacs + AUCTeX for my occasional TeX needs.


I also use vim and on the rare occasions I'm stuck with Windows, 
something I think called PSPad (not sure, downloaded it awhile back at 
my parents house). I actually have a license for Homesite, but I don't 
think I can install it on their computer and I don't run Windows 
anymore. That was nice.


On a Mac - bbedit for everything.

However, all that being said, I do very little php. Right now though a 
little more than usual.


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



Re: [PHP] PHP doesn't see php.ini

2009-06-25 Thread Tir
No, i haven't used an installer when i installed PHP. And no, I haven't 
another version of PHP on my computer.

"Bastien Koert"  ???/ ?  ?: 
news:d7b6cab70906250611l538e38ecr3849c5d4b6ab2...@mail.gmail.com...
> On Wed, Jun 24, 2009 at 8:32 AM, Tir wrote:
>
>
> Did you use an installer or have another version of php installed at
> some point?
> -- 
>
> Bastien
>
> Cat, the other other white meat 



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



[PHP] Re:Re:require_once failure

2009-06-25 Thread ste.paole...@tiscali.it
The file I wanna include exist and is in the corrent location:


s...@debian:~$ ll /usr/share/php/PHPUnit/Extensions/Database/TestCase.
php
-rw-r--r-- 1 root root 8818 31 mar 23:35

/usr/share/php/PHPUnit/Extensions/Database/TestCase.php

If in my 
script omit line 2 (so I dont' explicity set the include path) the

output is:
s...@debian:~$ php test.php

Warning: require_once


(PHPUnit/Extensions/Database/Testcase.php): failed to open stream: No 
such file or directory in /home/ste/test.php on line 2

Fatal error:


require_once(): Failed opening required 
'PHPUnit/Extensions/Database/Testcase.php' (include_path='.:
/usr/share/php:/home/ste/php') in /home/ste/test.php on line 2


The 
same outup also if I use the absolute path in the require line.
Is this 
a bug?


Con Tutto Incluso chiami e navighi senza limiti a soli 14,95 euro al mese. 
Gratis la Sim Tiscali Mobile con 50 euro di traffico! L’offerta è valida solo 
se attivi entro il 25/06/09

http://abbonati.tiscali.it/promo/tuttoincluso/

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



Re: [PHP] Re:Re:require_once failure

2009-06-25 Thread Daniel Brown
On Thu, Jun 25, 2009 at 12:31,
ste.paole...@tiscali.it wrote:
> The file I wanna include exist and is in the corrent location:
>
>
> s...@debian:~$ ll /usr/share/php/PHPUnit/Extensions/Database/TestCase.
> php
> -rw-r--r-- 1 root root 8818 31 mar 23:35

What is the output when running the target include file directly?  Id est:

php /usr/share/php/PHPUnit/Extensions/Database/TestCase.php

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Ask me about our fully-managed servers and proactive management
clusters starting at just $200/mo.!

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



Re: [PHP] Re: Progressbar

2009-06-25 Thread tedd

At 8:51 AM -0700 6/25/09, Michael A. Peters wrote:

On a Mac - bbedit for everything.


I never knew that I could use BBEdit to edit/save files to a server -- thanks.

Now if BBEdit would only keep track of projects, such as what files 
have been changed and automatically upload those files to the server 
I would never have to use GoLive again.


While I've tried using Eclipse, and it has a cool editor, *I* can't 
get it to connect to my server to upload/down-load files. It seems to 
have the ability, but I can't figure it out.


Also it seem that Eclipse is a huge overkill for me, but still 
doesn't do what I want. BBEdit is neat but under powered. GoLive does 
what I want, but is very bloated (for what I need) and frequently 
confuses itself and crashes.


I tried Stuart's recommendation Aptana and I'm a total failure at 
understanding anything that thing is providing. It's like I'm asking 
"Can you give me directions to the nearest gas station?" and the 
answer I receive is 
"011002020aa010201rr0001238910-381--494-19-49-193-1249-30840". In 
other words, I totally friggen lost All I do know it that it 
keeps telling "Buy hosting from us and everything will be fine."


As for Zend, while I purchased in back in 2005, and couldn't get it 
to work then, I just received a call minutes just ago from Zend who 
told me if I spring for another $399, I can get their newest release 
coming in a few months.


Okay, I think I'll go back to my planet now.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: Progressbar

2009-06-25 Thread Eddie Drapkin
On Thu, Jun 25, 2009 at 12:52 PM, Bastien Koert wrote:
> On Thu, Jun 25, 2009 at 11:51 AM, Michael A. Peters wrote:
>> Martin Scotta wrote:
>>>
>>> I found extremely un-productive editors or IDEs like Eclipse or Zend
>>> Studio.
>>>
>>> I use SciTE.
>>>
>>> It don't has any feature you are talking about...
>>>
>>> but it..
>>>  # do not eat all you ram
>>>  # starts in a microsecond
>>>  # opens any type of file
>>>  # paints the code in pretty colors.
>>>  # has a little intellisense using pre-written words or api files
>>>
>>>
>>
>> I almost exclusively use bluefish, the closest I come to an IDE for anything
>> I do is emacs + AUCTeX for my occasional TeX needs.
>>
>> I also use vim and on the rare occasions I'm stuck with Windows, something I
>> think called PSPad (not sure, downloaded it awhile back at my parents
>> house). I actually have a license for Homesite, but I don't think I can
>> install it on their computer and I don't run Windows anymore. That was nice.
>>
>> On a Mac - bbedit for everything.
>>
>> However, all that being said, I do very little php. Right now though a
>> little more than usual.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> over the past little while I have been using
>
> komodo edit (free) - good (more like a text editor with some brains),
> good code completion and hinting
> aptana studio (free) - eclipse based, bigger learning curve, but lots
> of functionality
> netbeans (free) - good, nice interface
>
>
>
>
> --
>
> Bastien
>
> Cat, the other other white meat
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Well the thing about being productive out of the box with Zend Studio
isn't entirely related to Zend Studio, it's more of an Eclipse
problem.  Eclipse itself, whether using it in a heavily modified form
like Aptana or PDT or Zend Studio, or just using it out of the box for
Java development or C/C++ development or anything in between, has a
ridiculously steep learning curve for what's really just a fancy text
editor.  While this turns a lot of people off, I was lucky (although I
sure didn't think so at the time) enough to have it forced on me when
I was learning Java in school.  And in the end, I'm pretty glad that I
was forced to learn Eclipse because it's been the go to editor for all
my coding needs, whether PHP, Python, C, Java, even complex shell
scripting.  And whenever someone is learning to develop and gets to
the point that they'd actually take advantage of some of the more
advanced features of Eclipse - step through debugging, code
autocompletion, etc. - I recommend that they take some time out of
learning the code, or coding, and learn Eclipse.  The second Java
class I took was actually "learning Eclipse" and it was one of the
more useful classes that I've taken, given that there's no longer a
learning curve for any IDE that I want to use.

Yes, Eclipse is pretty intimidating and oftentimes more complicated
than it needs to be, but there's a level of customizability that
doesn't exist in any other editors that I've seen.  Whether it's
making code look and behave exactly the same, or binding keybindings
to things like SVN commit / update / resolve, it's all possible in
Eclipse.  Whether you use Aptana, PDT, Zend Studio (>= 6.0) or another
derivative, I'd definitely recommend using Eclipse and once you've
topped the learning curve, you'll be able to say that your IDE
actually boosts your productivity significantly, which is the ultimate
goal anyway.

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



[PHP] Re: Re:Re:Re:require_once failure

2009-06-25 Thread ste.paole...@tiscali.it
Running php /usr/share/php/PHPUnit/Extensions/Database/Testcase.php 
there is no output


Con Tutto Incluso chiami e navighi senza limiti a soli 14,95 euro al mese. 
Gratis la Sim Tiscali Mobile con 50 euro di traffico! L’offerta è valida solo 
se attivi entro il 25/06/09

http://abbonati.tiscali.it/promo/tuttoincluso/

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



Re: [PHP] Re: Progressbar

2009-06-25 Thread Igor Escobar
http://www.ajaxload.info/


Regards,
Igor Escobar
Systems Analyst & Interface Designer

+ http://blog.igorescobar.com
+ http://www.igorescobar.com
+ @igorescobar (twitter)





On Thu, Jun 25, 2009 at 2:03 PM, Eddie Drapkin  wrote:

> On Thu, Jun 25, 2009 at 12:52 PM, Bastien Koert wrote:
> > On Thu, Jun 25, 2009 at 11:51 AM, Michael A. Peters
> wrote:
> >> Martin Scotta wrote:
> >>>
> >>> I found extremely un-productive editors or IDEs like Eclipse or Zend
> >>> Studio.
> >>>
> >>> I use SciTE.
> >>>
> >>> It don't has any feature you are talking about...
> >>>
> >>> but it..
> >>>  # do not eat all you ram
> >>>  # starts in a microsecond
> >>>  # opens any type of file
> >>>  # paints the code in pretty colors.
> >>>  # has a little intellisense using pre-written words or api files
> >>>
> >>>
> >>
> >> I almost exclusively use bluefish, the closest I come to an IDE for
> anything
> >> I do is emacs + AUCTeX for my occasional TeX needs.
> >>
> >> I also use vim and on the rare occasions I'm stuck with Windows,
> something I
> >> think called PSPad (not sure, downloaded it awhile back at my parents
> >> house). I actually have a license for Homesite, but I don't think I can
> >> install it on their computer and I don't run Windows anymore. That was
> nice.
> >>
> >> On a Mac - bbedit for everything.
> >>
> >> However, all that being said, I do very little php. Right now though a
> >> little more than usual.
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> > over the past little while I have been using
> >
> > komodo edit (free) - good (more like a text editor with some brains),
> > good code completion and hinting
> > aptana studio (free) - eclipse based, bigger learning curve, but lots
> > of functionality
> > netbeans (free) - good, nice interface
> >
> >
> >
> >
> > --
> >
> > Bastien
> >
> > Cat, the other other white meat
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> Well the thing about being productive out of the box with Zend Studio
> isn't entirely related to Zend Studio, it's more of an Eclipse
> problem.  Eclipse itself, whether using it in a heavily modified form
> like Aptana or PDT or Zend Studio, or just using it out of the box for
> Java development or C/C++ development or anything in between, has a
> ridiculously steep learning curve for what's really just a fancy text
> editor.  While this turns a lot of people off, I was lucky (although I
> sure didn't think so at the time) enough to have it forced on me when
> I was learning Java in school.  And in the end, I'm pretty glad that I
> was forced to learn Eclipse because it's been the go to editor for all
> my coding needs, whether PHP, Python, C, Java, even complex shell
> scripting.  And whenever someone is learning to develop and gets to
> the point that they'd actually take advantage of some of the more
> advanced features of Eclipse - step through debugging, code
> autocompletion, etc. - I recommend that they take some time out of
> learning the code, or coding, and learn Eclipse.  The second Java
> class I took was actually "learning Eclipse" and it was one of the
> more useful classes that I've taken, given that there's no longer a
> learning curve for any IDE that I want to use.
>
> Yes, Eclipse is pretty intimidating and oftentimes more complicated
> than it needs to be, but there's a level of customizability that
> doesn't exist in any other editors that I've seen.  Whether it's
> making code look and behave exactly the same, or binding keybindings
> to things like SVN commit / update / resolve, it's all possible in
> Eclipse.  Whether you use Aptana, PDT, Zend Studio (>= 6.0) or another
> derivative, I'd definitely recommend using Eclipse and once you've
> topped the learning curve, you'll be able to say that your IDE
> actually boosts your productivity significantly, which is the ultimate
> goal anyway.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Re: Progressbar

2009-06-25 Thread Bastien Koert
On Thu, Jun 25, 2009 at 11:51 AM, Michael A. Peters wrote:
> Martin Scotta wrote:
>>
>> I found extremely un-productive editors or IDEs like Eclipse or Zend
>> Studio.
>>
>> I use SciTE.
>>
>> It don't has any feature you are talking about...
>>
>> but it..
>>  # do not eat all you ram
>>  # starts in a microsecond
>>  # opens any type of file
>>  # paints the code in pretty colors.
>>  # has a little intellisense using pre-written words or api files
>>
>>
>
> I almost exclusively use bluefish, the closest I come to an IDE for anything
> I do is emacs + AUCTeX for my occasional TeX needs.
>
> I also use vim and on the rare occasions I'm stuck with Windows, something I
> think called PSPad (not sure, downloaded it awhile back at my parents
> house). I actually have a license for Homesite, but I don't think I can
> install it on their computer and I don't run Windows anymore. That was nice.
>
> On a Mac - bbedit for everything.
>
> However, all that being said, I do very little php. Right now though a
> little more than usual.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

over the past little while I have been using

komodo edit (free) - good (more like a text editor with some brains),
good code completion and hinting
aptana studio (free) - eclipse based, bigger learning curve, but lots
of functionality
netbeans (free) - good, nice interface




-- 

Bastien

Cat, the other other white meat

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



RE: [PHP] Unit test platform

2009-06-25 Thread Bob McConnell
From: Bastien Koert
> On Thu, Jun 25, 2009 at 10:00 AM, Bob McConnell wrote:
>> I need some guidance. I have looked over the PHP site and don't see
any
>> hints about using PHP interpreters for unit testing. I would like to
>> know if this idea has any chance of working.
>>
>> I want to set up the development and build machines with PHP
>> interpreters to do automated unit tests. Because we use PostgreSQL, I
>> want to set up those boxes without any Postgres libraries and
substitute
>> FIT test stubs in their place.
>>
>> 1. I have to use MS-Windows as my development platform. Currently I
have
>> XP-Pro with NetBeans 6.5.1. I have played with Eclipse and Komodo
>> Editor, which remain as possible options. I need a PHP interpreter
that
>> will allow me to write and debug FIT tests for functions already in
use,
>> as well as new code that I write or modify.
>>
>> 2. The production server is RHEL ES 5 with Apache 2 and PostgreSQL. I
>> cannot make any changes to this platform.
>>
>> 3. The build machine is running Fedora Core (version unknown), also
with
>> Apache and PostgreSQL installed as it is also used for integration
>> testing. I want to change this to remove the Postgres libraries so
they
>> can be replaced with the FIT back end. Integration testing would
require
>> a separate server which would also solve some other QA issues we
have.
>> We currently do both development and QA testing on this box,
releasing a
>> set of RPM files to production once they have been run through the
>> wringer.
>>
>> Is this a reasonable plan?
>>
>> Where can I find PHP interpreters for MS-Windows and FC that will
>> support this?
> 
> 
> http://www.phpunit.de/ ?

We have looked at that and it does not appear to be a workable option.
Near as I can tell it can only test OO code already organized as
classes. But...

1. None of the code I need to test is OO. The system was originally
written as PHP 4 procedures and has not been significantly changed since
then. Rewriting it as OOP has been discussed, but will not likely happen
in the next two or three years.

2. I don't do objects. After 40 years of procedural programming, with
the last 20 in low level embedded devices, I just cannot think that way.
In addition, I learned to program using "eschew obfuscation" as my
primary guideline. To me, OOP appears to be obfuscation taken to an
absurd level. I'm more into the concrete and have a real problem with
abstraction. So it takes me longer to read and understand other
programmers' objects than to write the same functions myself as
procedural code.

Now, is there any support to implement unit testing without objects?
Does my plan outline above have any merit?

Bob McConnell

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



[PHP] Does anyone know how gettext works under the hood?

2009-06-25 Thread Michael Shadle
I'm wondering if there is a way to save some processing time, and I
could totally be off my rocker, or violating the pre-mature
optimization rule...

But my assumption is when you ask gettext in PHP to load up a .po
file, it has to convert that into bytecode. That takes some overhead,
especially on a busy website. Could it be possible then to take the
APC approach and only process it once, keeping the output in shared
memory and only destroy the cache then the .po file is changed?

I haven't profiled the portion of my code using gettext yet but it
would be interesting to see how much % of each request it takes to
load the file. I also assume as the file gets larger it will take up
more resources as well...

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



Re: [PHP] PHP doesn't see php.ini

2009-06-25 Thread Tir
> Presume you did restart apache after making the change?
Of course

> Is there anything in your phpinfo output that relates to your php.ini?
I think there must be a mention of MySQL because i've enabled it. But it 
isn't there.

> Maybe some error near the beginning of php.ini causes php to stop loading 
> the ini file?
I use a copy of php.ini-recommended from PHP distributive. I don't think 
that there could be errors. I've only uncommented few strings to enable 
MySQL extensions, set display_errors on and changed extension_dir.

> Check that the "extension_dir" in phpinfo agrees with the "extension_dir" 
> in your php.ini.
It agrees.

> Maybe try enabling error logging in the php.ini and check the log file - I 
> use apache\logs\phperror.log and invalid extension loading is definitely 
> reported there (I've had this problem before).
That's it, i think. I've enabled display_startup_errors and now on start 
apache i receive errors. PHP can't find libraries of MySQL extensions. But 
this libraries exactly exist in folder that indicated in error messages. 
What that could be? 



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



Re: [PHP] Re: Progressbar

2009-06-25 Thread Michael A. Peters

tedd wrote:

At 8:51 AM -0700 6/25/09, Michael A. Peters wrote:

On a Mac - bbedit for everything.


I never knew that I could use BBEdit to edit/save files to a server -- 
thanks.


I don't know if you can either, I use to use MacOS almost exclusively 
but then they came out with OS X which worked but was way way way slower 
than Linux on the same hardware and I didn't feel like shelling out a 
bunch of cash for a new G4. Now, Apple refused to come out with either a 
mid level tower or a laptop with three buttons, so I haven't had an 
Apple in a while.


But I use rsync for uploading. That way what's on the devel server is 
what is on the production (er, should be test, but I'm not that fancy) 
server.


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



Re: [PHP] How to sort a two-D ARRAY

2009-06-25 Thread Ashley Sheridan
On Wed, 2009-06-24 at 15:23 -0700, salmarayan wrote:
> Can Anyone tell me how to sort two D Array in Descending Order
> for example like this one based on the gain
> Array ( [0] => Array ( [company_name] =>X [gain] => 0.2 ) [1] => Array (
> [company_name] => y[gain] => 0.34 )[2]1] => Array ( [company_name] =>z[gain]
> => 2 )  )
> Thanks in advance
> -- 
> View this message in context: 
> http://www.nabble.com/How-to-sort-a-two-D-ARRAY-tp24193925p24193925.html
> Sent from the PHP - General mailing list archive at Nabble.com.
> 
> 
stw http://us3.php.net/manual/en/function.array-multisort.php



Thanks
Ash
www.ashleysheridan.co.uk


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



[PHP] OT mysql pivot table problem

2009-06-25 Thread Matt Giddings
I know this is the off topic (sorry), but it is a php project that I'm
working on!  I need some pointers on how to pivot a mysql column (containing
comma delimited data) into an equal number of rows (see example).  Any
direction (pointers to links, etc. would be appreciated).

>From this:

user.table
uid|name|groups
1|mcgiddin|1,4,7,10,12


To this:

pivot.table
uid|group
1|1
1|4
1|7
1|10
1|12


Re: [PHP] Re: Progressbar

2009-06-25 Thread Michael A. Peters

Lenin wrote:

@Peters you probably didnt understand the thread at all.



Then the prudent thing to do would be to explain it.
That's what lists are for.

As far as the *real thread* before the IDE tangent, I'm the only one who 
posted real demonstratively working code that provides a working non 
fake progress bar ...


"I'm making an upload script with PHP, is there a way I can show a
progressbar while uploading?"

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



Re: [PHP] OT mysql pivot table problem

2009-06-25 Thread Ashley Sheridan
On Thu, 2009-06-25 at 15:20 -0400, Matt Giddings wrote:
> I know this is the off topic (sorry), but it is a php project that I'm
> working on!  I need some pointers on how to pivot a mysql column (containing
> comma delimited data) into an equal number of rows (see example).  Any
> direction (pointers to links, etc. would be appreciated).
> 
> From this:
> 
> user.table
> uid|name|groups
> 1|mcgiddin|1,4,7,10,12
> 
> 
> To this:
> 
> pivot.table
> uid|group
> 1|1
> 1|4
> 1|7
> 1|10
> 1|12

I don't know of any fancy ways of doing it just in MySQL, but if the
records are all as simple as that, something like this should do the
trick:

$query = "SELECT * FROM `user`";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
$uid = $row['uid'];
$groups = explode(','$row['groups']);
for($i=0; $ihttp://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] OT mysql pivot table problem

2009-06-25 Thread Matt Giddings
Thanks for taking the time to provide an example.  I'm going to take the
advice given by you and others and simply do this in php instead of looking
for a fancy mysql solution.  ; )  Dang, and I was really wanting to wow
myself today...
Thanks again!
Matt

On Thu, Jun 25, 2009 at 3:51 PM, Ashley Sheridan
wrote:

> On Thu, 2009-06-25 at 15:20 -0400, Matt Giddings wrote:
> > I know this is the off topic (sorry), but it is a php project that I'm
> > working on!  I need some pointers on how to pivot a mysql column
> (containing
> > comma delimited data) into an equal number of rows (see example).  Any
> > direction (pointers to links, etc. would be appreciated).
> >
> > From this:
> >
> > user.table
> > uid|name|groups
> > 1|mcgiddin|1,4,7,10,12
> >
> >
> > To this:
> >
> > pivot.table
> > uid|group
> > 1|1
> > 1|4
> > 1|7
> > 1|10
> > 1|12
>
> I don't know of any fancy ways of doing it just in MySQL, but if the
> records are all as simple as that, something like this should do the
> trick:
>
> $query = "SELECT * FROM `user`";
> $result = mysql_query($query);
> while($row = mysql_fetch_array($result))
> {
>$uid = $row['uid'];
>$groups = explode(','$row['groups']);
>for($i=0; $i{
>$query2 = "INSERT INTO `pivot` VALUES($uid, $groups[$i])";
>$result2 = mysql_query($query2);
>}
> }
>
> Also, I'd recommend having some sort of auto increment value on that
> pivot table, so you can manipulate specific rows at a later date.
>
> Thanks
> Ash
> www.ashleysheridan.co.uk
>
>


-- 
Matt Giddings
Web Programmer
Information Technology Services
Saginaw Valley State University
Phone: 989.964.7247

http://www.svsu.edu


Re: [PHP] OT mysql pivot table problem

2009-06-25 Thread Eddie Drapkin
You'd be much, much better off creating a query by concatenating ",
($uid, $groups[$i])" into one huge insert query.

YOU SHOULD NEVER, EVER EVER EVER EVER RUN QUERIES IN A LOOP!


On Thu, Jun 25, 2009 at 4:11 PM, Matt Giddings wrote:
> Thanks for taking the time to provide an example.  I'm going to take the
> advice given by you and others and simply do this in php instead of looking
> for a fancy mysql solution.  ; )  Dang, and I was really wanting to wow
> myself today...
> Thanks again!
> Matt
>
> On Thu, Jun 25, 2009 at 3:51 PM, Ashley Sheridan
> wrote:
>
>> On Thu, 2009-06-25 at 15:20 -0400, Matt Giddings wrote:
>> > I know this is the off topic (sorry), but it is a php project that I'm
>> > working on!  I need some pointers on how to pivot a mysql column
>> (containing
>> > comma delimited data) into an equal number of rows (see example).  Any
>> > direction (pointers to links, etc. would be appreciated).
>> >
>> > From this:
>> >
>> > user.table
>> > uid|name|groups
>> > 1|mcgiddin|1,4,7,10,12
>> >
>> >
>> > To this:
>> >
>> > pivot.table
>> > uid|group
>> > 1|1
>> > 1|4
>> > 1|7
>> > 1|10
>> > 1|12
>>
>> I don't know of any fancy ways of doing it just in MySQL, but if the
>> records are all as simple as that, something like this should do the
>> trick:
>>
>> $query = "SELECT * FROM `user`";
>> $result = mysql_query($query);
>> while($row = mysql_fetch_array($result))
>> {
>>    $uid = $row['uid'];
>>    $groups = explode(','$row['groups']);
>>    for($i=0; $i>    {
>>        $query2 = "INSERT INTO `pivot` VALUES($uid, $groups[$i])";
>>        $result2 = mysql_query($query2);
>>    }
>> }
>>
>> Also, I'd recommend having some sort of auto increment value on that
>> pivot table, so you can manipulate specific rows at a later date.
>>
>> Thanks
>> Ash
>> www.ashleysheridan.co.uk
>>
>>
>
>
> --
> Matt Giddings
> Web Programmer
> Information Technology Services
> Saginaw Valley State University
> Phone: 989.964.7247
>
> http://www.svsu.edu
>

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



RE: [PHP] Re: mounting folder shares WAS: Progressbar

2009-06-25 Thread Daevid Vincent
 

> -Original Message-
> From: tedd [mailto:tedd.sperl...@gmail.com] 
> Sent: Thursday, June 25, 2009 9:59 AM
> To: php-general@lists.php.net; Michael A. Peters
> Subject: Re: [PHP] Re: Progressbar
> 
> At 8:51 AM -0700 6/25/09, Michael A. Peters wrote:
>
> While I've tried using Eclipse, and it has a cool editor, *I* can't 
> get it to connect to my server to upload/down-load files. It seems to 
> have the ability, but I can't figure it out.

Why not just use a SAMBA mount and then it's transparent to the IDE or
anything for that matter?

Also, here at work, we have uber-cautious IT people and they freaked when I
installed SAMBA for some reason and said I could only use ports 22 or 443.
Not so great for Windows developers. In linux you can use sshfs which is
awesome. After searching high and low and trying all sorts of things
(including that flakey Dokan) I found this ExpanDrive which works like a f'n
champ! It's transparent, uses ssh (even keys!), automounts. I can't say
enough good about it.
http://www.expandrive.com


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



Re: [PHP] OT mysql pivot table problem

2009-06-25 Thread Andrew Ballard
On Thu, Jun 25, 2009 at 3:20 PM, Matt Giddings wrote:
> I know this is the off topic (sorry), but it is a php project that I'm
> working on!  I need some pointers on how to pivot a mysql column (containing
> comma delimited data) into an equal number of rows (see example).  Any
> direction (pointers to links, etc. would be appreciated).
>
> From this:
>
> user.table
> uid|name|groups
> 1|mcgiddin|1,4,7,10,12
>
>
> To this:
>
> pivot.table
> uid|group
> 1|1
> 1|4
> 1|7
> 1|10
> 1|12
>

The best performance I've seen for a SQL solution uses a tally table.

CREATE TABLE Tally (
N int not null,
PRIMARY KEY (N)
)

The table holds a sequence of numbers from 1 to some large number.

Then you can write a query something like this:

 SELECT uid, 
SUBSTRING(user.table.groups,N+1,LOCATE(',',user.table.groups,N+1)-N-1)
   FROM Tally, user.table
  WHERE N < LENGTH(user.table.groups)
AND SUBSTRING(user.table.groups,N,1) = ','




Andrew

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



Re: [PHP] OT mysql pivot table problem

2009-06-25 Thread Ashley Sheridan
On Thu, 2009-06-25 at 16:17 -0400, Eddie Drapkin wrote:
> You'd be much, much better off creating a query by concatenating ",
> ($uid, $groups[$i])" into one huge insert query.
> 
> YOU SHOULD NEVER, EVER EVER EVER EVER RUN QUERIES IN A LOOP!
> 
> 
> On Thu, Jun 25, 2009 at 4:11 PM, Matt Giddings wrote:
> > Thanks for taking the time to provide an example.  I'm going to take the
> > advice given by you and others and simply do this in php instead of looking
> > for a fancy mysql solution.  ; )  Dang, and I was really wanting to wow
> > myself today...
> > Thanks again!
> > Matt
> >
> > On Thu, Jun 25, 2009 at 3:51 PM, Ashley Sheridan
> > wrote:
> >
> >> On Thu, 2009-06-25 at 15:20 -0400, Matt Giddings wrote:
> >> > I know this is the off topic (sorry), but it is a php project that I'm
> >> > working on!  I need some pointers on how to pivot a mysql column
> >> (containing
> >> > comma delimited data) into an equal number of rows (see example).  Any
> >> > direction (pointers to links, etc. would be appreciated).
> >> >
> >> > From this:
> >> >
> >> > user.table
> >> > uid|name|groups
> >> > 1|mcgiddin|1,4,7,10,12
> >> >
> >> >
> >> > To this:
> >> >
> >> > pivot.table
> >> > uid|group
> >> > 1|1
> >> > 1|4
> >> > 1|7
> >> > 1|10
> >> > 1|12
> >>
> >> I don't know of any fancy ways of doing it just in MySQL, but if the
> >> records are all as simple as that, something like this should do the
> >> trick:
> >>
> >> $query = "SELECT * FROM `user`";
> >> $result = mysql_query($query);
> >> while($row = mysql_fetch_array($result))
> >> {
> >>$uid = $row['uid'];
> >>$groups = explode(','$row['groups']);
> >>for($i=0; $i >>{
> >>$query2 = "INSERT INTO `pivot` VALUES($uid, $groups[$i])";
> >>$result2 = mysql_query($query2);
> >>}
> >> }
> >>
> >> Also, I'd recommend having some sort of auto increment value on that
> >> pivot table, so you can manipulate specific rows at a later date.
> >>
> >> Thanks
> >> Ash
> >> www.ashleysheridan.co.uk
> >>
> >>
> >
> >
> > --
> > Matt Giddings
> > Web Programmer
> > Information Technology Services
> > Saginaw Valley State University
> > Phone: 989.964.7247
> >
> > http://www.svsu.edu
> >
> 
Consider my wrists firmly slapped!

Thanks
Ash
www.ashleysheridan.co.uk


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



[PHP] Removing empty values from array

2009-06-25 Thread Martin Scotta
Hi all

I have this in a simple routine...

for($i=0, $if=count($array); $i<$if; ++$i)
if( $array[$i] == '' )
{   
array_splice( $array, $i, 1);

--$i;
--$if;
}

My question: is this the better way to do it?

-- 
Martin Scotta

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



Re: [PHP] Removing empty values from array

2009-06-25 Thread Robert Cummings

Martin Scotta wrote:

Hi all

I have this in a simple routine...

for($i=0, $if=count($array); $i<$if; ++$i)
if( $array[$i] == '' )
{   
array_splice( $array, $i, 1);

--$i;
--$if;
}

My question: is this the better way to do it?




The above will not remove a value of '0' which IMHO is not empty. If you 
actually want to get rid of '0' also, then change === to == and remove 
the (string) cast.


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



Re: [PHP] Removing empty values from array

2009-06-25 Thread Ashley Sheridan
On Thu, 2009-06-25 at 17:52 -0300, Martin Scotta wrote:
> Hi all
> 
> I have this in a simple routine...
> 
> for($i=0, $if=count($array); $i<$if; ++$i)
>   if( $array[$i] == '' )
>   {   
>   array_splice( $array, $i, 1);
>   
>   --$i;
>   --$if;
>   }
> 
> My question: is this the better way to do it?
> 
> -- 
> Martin Scotta
> 
array_filter() will return an array without any elements that equate to
false (empty strings, 0, false) although you can use the optional
argument to specify your own function which should return true if you
want to keep an element, or false if you want to ditch it, if you need
to eliminate only empty strings.


Thanks
Ash
www.ashleysheridan.co.uk


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



Re: [PHP] OT mysql pivot table problem

2009-06-25 Thread Andrew Ballard
On Thu, Jun 25, 2009 at 4:21 PM, Andrew Ballard wrote:
> On Thu, Jun 25, 2009 at 3:20 PM, Matt Giddings wrote:
>> I know this is the off topic (sorry), but it is a php project that I'm
>> working on!  I need some pointers on how to pivot a mysql column (containing
>> comma delimited data) into an equal number of rows (see example).  Any
>> direction (pointers to links, etc. would be appreciated).
>>
>> From this:
>>
>> user.table
>> uid|name|groups
>> 1|mcgiddin|1,4,7,10,12
>>
>>
>> To this:
>>
>> pivot.table
>> uid|group
>> 1|1
>> 1|4
>> 1|7
>> 1|10
>> 1|12
>>
>
> The best performance I've seen for a SQL solution uses a tally table.
>
> CREATE TABLE Tally (
>    N int not null,
>    PRIMARY KEY (N)
> )
>
> The table holds a sequence of numbers from 1 to some large number.
>
> Then you can write a query something like this:
>
>  SELECT uid, 
> SUBSTRING(user.table.groups,N+1,LOCATE(',',user.table.groups,N+1)-N-1)
>   FROM Tally, user.table
>  WHERE N < LENGTH(user.table.groups)
>    AND SUBSTRING(user.table.groups,N,1) = ','
>
>
>
>
> Andrew
>

OK, I actually tested this and it appears I missed something. For this
query to work, the string has to begin and end with the delimiter. So
I just replaced user.table.groups with CONCAT(',', user.table.groups,
',').

 SELECT uid, SUBSTRING(CONCAT(',', user.table.groups,
','),N+1,LOCATE(',',CONCAT(',', user.table.groups, ','),N+1)-N-1)
  FROM Tally, sample
 WHERE N < LENGTH(CONCAT(',', user.table.groups, ','))
   AND SUBSTRING(CONCAT(',', user.table.groups, ','),N,1) = ','


For more in-depth information, check out some of the links in this search:
http://www.google.com/search?q=sql+split+tally+table


Andrew

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



Re: [PHP] Removing empty values from array

2009-06-25 Thread Eddie Drapkin
On Thu, Jun 25, 2009 at 5:00 PM, Ashley
Sheridan wrote:
> On Thu, 2009-06-25 at 17:52 -0300, Martin Scotta wrote:
>> Hi all
>>
>> I have this in a simple routine...
>>
>> for($i=0, $if=count($array); $i<$if; ++$i)
>>       if( $array[$i] == '' )
>>       {
>>               array_splice( $array, $i, 1);
>>
>>               --$i;
>>               --$if;
>>       }
>>
>> My question: is this the better way to do it?
>>
>> --
>> Martin Scotta
>>
> array_filter() will return an array without any elements that equate to
> false (empty strings, 0, false) although you can use the optional
> argument to specify your own function which should return true if you
> want to keep an element, or false if you want to ditch it, if you need
> to eliminate only empty strings.
>
>
> Thanks
> Ash
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I'd just do

foreach($array as &$v) {
if($v === false || $v === null || $v === 0) {
unset($v);
}
}


I wouldn't do anything more complicated >.>

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



Re: [PHP] Removing empty values from array

2009-06-25 Thread Robert Cummings

Eddie Drapkin wrote:

On Thu, Jun 25, 2009 at 5:00 PM, Ashley
Sheridan wrote:

On Thu, 2009-06-25 at 17:52 -0300, Martin Scotta wrote:

Hi all

I have this in a simple routine...

for($i=0, $if=count($array); $i<$if; ++$i)
  if( $array[$i] == '' )
  {
  array_splice( $array, $i, 1);

  --$i;
  --$if;
  }

My question: is this the better way to do it?

--
Martin Scotta


array_filter() will return an array without any elements that equate to
false (empty strings, 0, false) although you can use the optional
argument to specify your own function which should return true if you
want to keep an element, or false if you want to ditch it, if you need
to eliminate only empty strings.


Thanks
Ash
www.ashleysheridan.co.uk


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




I'd just do

foreach($array as &$v) {
if($v === false || $v === null || $v === 0) {
unset($v);
}
}


I wouldn't do anything more complicated >.>


And you would unfortunately find it doesn't work.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



Re: [PHP] Removing empty values from array

2009-06-25 Thread Ashley Sheridan
On Thu, 2009-06-25 at 17:18 -0400, Eddie Drapkin wrote:
> On Thu, Jun 25, 2009 at 5:00 PM, Ashley
> Sheridan wrote:
> > On Thu, 2009-06-25 at 17:52 -0300, Martin Scotta wrote:
> >> Hi all
> >>
> >> I have this in a simple routine...
> >>
> >> for($i=0, $if=count($array); $i<$if; ++$i)
> >>   if( $array[$i] == '' )
> >>   {
> >>   array_splice( $array, $i, 1);
> >>
> >>   --$i;
> >>   --$if;
> >>   }
> >>
> >> My question: is this the better way to do it?
> >>
> >> --
> >> Martin Scotta
> >>
> > array_filter() will return an array without any elements that equate to
> > false (empty strings, 0, false) although you can use the optional
> > argument to specify your own function which should return true if you
> > want to keep an element, or false if you want to ditch it, if you need
> > to eliminate only empty strings.
> >
> >
> > Thanks
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> I'd just do
> 
> foreach($array as &$v) {
> if($v === false || $v === null || $v === 0) {
> unset($v);
> }
> }
> 
> 
> I wouldn't do anything more complicated >.>

Erm,

$array = array_filter($array);

is a lot less complicated than

foreach($array as &$v) {
if($v === false || $v === null || $v === 0) {
unset($v);
}
}

and as it's a built-in function, likely faster.

Thanks
Ash
www.ashleysheridan.co.uk


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



[PHP] point me to functions to parse the URL? (best one for *this* job?)

2009-06-25 Thread Govinda

Hi all,

(PHP newbie here.  Newbie-level task to match.)

I am RTFM and working on this..  but I am also under deadline, so, I  
ask you in case you can point me quick where to read...  what  
functions I need to use for this.


Incoming URL will look like these, for example:

domain.com/unix/asdfsdf.html
domain.com/macos/khsdfg.html

I need to parse those URLs and set the value of $myfolder to as follows:

domain.com/unix/asdfsdf.html
$myfolder=unix
domain.com/macos/khsdfg.html
$myfolder=macos

BUT if there is no dir/ in between the domain and file,
like so:
domain.com/khsdfg.html
 then I want:
$myfolder=default

I am playing with $_SERVER['PATH_TRANSLATED'], ..
what function will parse that best?
I need to also account for when the URL does not have an in-between  
dir/, nor a filename in it, e.g.:

domain.com/
(then again $myfolder=default)

TIA!
-Govinda

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



[PHP] Re: point me to functions to parse the URL? (best one for *this* job?)

2009-06-25 Thread Shawn McKenzie
Govinda wrote:
> Hi all,
> 
> (PHP newbie here.  Newbie-level task to match.)
> 
> I am RTFM and working on this..  but I am also under deadline, so, I ask
> you in case you can point me quick where to read...  what functions I
> need to use for this.
> 
> Incoming URL will look like these, for example:
> 
> domain.com/unix/asdfsdf.html
> domain.com/macos/khsdfg.html
> 
> I need to parse those URLs and set the value of $myfolder to as follows:
> 
> domain.com/unix/asdfsdf.html
> $myfolder=unix
> domain.com/macos/khsdfg.html
> $myfolder=macos
> 
> BUT if there is no dir/ in between the domain and file,
> like so:
> domain.com/khsdfg.html
>  then I want:
> $myfolder=default
> 
> I am playing with $_SERVER['PATH_TRANSLATED'], ..
> what function will parse that best?
> I need to also account for when the URL does not have an in-between
> dir/, nor a filename in it, e.g.:
> domain.com/
> (then again $myfolder=default)
> 
> TIA!
> -Govinda

No way, you want to "parse" the "url"?

How about, parse_url()?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: point me to functions to parse the URL? (best one for *this*job?)

2009-06-25 Thread Shawn McKenzie
Shawn McKenzie wrote:
> Govinda wrote:
>> Hi all,
>>
>> (PHP newbie here.  Newbie-level task to match.)
>>
>> I am RTFM and working on this..  but I am also under deadline, so, I ask
>> you in case you can point me quick where to read...  what functions I
>> need to use for this.
>>
>> Incoming URL will look like these, for example:
>>
>> domain.com/unix/asdfsdf.html
>> domain.com/macos/khsdfg.html
>>
>> I need to parse those URLs and set the value of $myfolder to as follows:
>>
>> domain.com/unix/asdfsdf.html
>> $myfolder=unix
>> domain.com/macos/khsdfg.html
>> $myfolder=macos
>>
>> BUT if there is no dir/ in between the domain and file,
>> like so:
>> domain.com/khsdfg.html
>>  then I want:
>> $myfolder=default
>>
>> I am playing with $_SERVER['PATH_TRANSLATED'], ..
>> what function will parse that best?
>> I need to also account for when the URL does not have an in-between
>> dir/, nor a filename in it, e.g.:
>> domain.com/
>> (then again $myfolder=default)
>>
>> TIA!
>> -Govinda
> 
> No way, you want to "parse" the "url"?
> 
> How about, parse_url()?
> 

Oh, and in the future, if you want to "strip" the "slashes" from a var,
you would use the remove_escape_char() function :-)

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: point me to functions to parse the URL? (best one for *this*job?)

2009-06-25 Thread Shawn McKenzie
Shawn McKenzie wrote:
> Shawn McKenzie wrote:
>> Govinda wrote:
>>> Hi all,
>>>
>>> (PHP newbie here.  Newbie-level task to match.)
>>>
>>> I am RTFM and working on this..  but I am also under deadline, so, I ask
>>> you in case you can point me quick where to read...  what functions I
>>> need to use for this.
>>>
>>> Incoming URL will look like these, for example:
>>>
>>> domain.com/unix/asdfsdf.html
>>> domain.com/macos/khsdfg.html
>>>
>>> I need to parse those URLs and set the value of $myfolder to as follows:
>>>
>>> domain.com/unix/asdfsdf.html
>>> $myfolder=unix
>>> domain.com/macos/khsdfg.html
>>> $myfolder=macos
>>>
>>> BUT if there is no dir/ in between the domain and file,
>>> like so:
>>> domain.com/khsdfg.html
>>>  then I want:
>>> $myfolder=default
>>>
>>> I am playing with $_SERVER['PATH_TRANSLATED'], ..
>>> what function will parse that best?
>>> I need to also account for when the URL does not have an in-between
>>> dir/, nor a filename in it, e.g.:
>>> domain.com/
>>> (then again $myfolder=default)
>>>
>>> TIA!
>>> -Govinda
>> No way, you want to "parse" the "url"?
>>
>> How about, parse_url()?
>>
> 
> Oh, and in the future, if you want to "strip" the "slashes" from a var,
> you would use the remove_escape_char() function :-)
> 

Sorry, after actually reading your post, and having nothing else to do
at the moment (one solution):

$myfolder = basename(dirname($_SERVER['PHP_SELF']));

if(empty($myfolder)) {
$myfolder = 'default';
}

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Does php have multithread, shared object(like jsp application)

2009-06-25 Thread WenDong Zhang
Hi guys:

Now days I want to develop a web application like a chat room. the requests
per seconds maybe very large, so I want to save some common info into to
memory (quick access).

So, I want to know does php have the follow features or implement them in
other ways.
1. server scope objects, mostly like application in jsp.  // the most
important~
2. multithread synchronize.
3. I want to start a thread timed execute, like Timer in java

thanks
-- 
Best Regards!
Wen Dong


Re: [PHP] Does php have multithread, shared object(like jsp application)

2009-06-25 Thread Eddie Drapkin
PHP doesn't support threading.

On Thu, Jun 25, 2009 at 10:59 PM, WenDong Zhang wrote:
> Hi guys:
>
> Now days I want to develop a web application like a chat room. the requests
> per seconds maybe very large, so I want to save some common info into to
> memory (quick access).
>
> So, I want to know does php have the follow features or implement them in
> other ways.
> 1. server scope objects, mostly like application in jsp.  // the most
> important~
> 2. multithread synchronize.
> 3. I want to start a thread timed execute, like Timer in java
>
> thanks
> --
> Best Regards!
> Wen Dong
>

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



[PHP] Regarding Accesing mp3 with php

2009-06-25 Thread Gautam Bhatia
hello all,
 Is there anyway in php by which i can get the total play
time of a mp3 , I found some information while doing the google thing
using some 3rd party plug ins like getID3 but without any luck, Any help
in this case would be helpful. Thank you.
Regards,

Gautam Bhatia .





RE: [PHP] Does php have multithread, shared object(like jsp application)

2009-06-25 Thread HallMarc Websites
No, it doesn't at this time. Have you looked into Quercus?



> -Original Message-
> From: Eddie Drapkin [mailto:oorza...@gmail.com]
> Sent: Thursday, June 25, 2009 11:42 PM
> To: WenDong Zhang
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Does php have multithread, shared object(like jsp
> application)
> 
> PHP doesn't support threading.
> 
> On Thu, Jun 25, 2009 at 10:59 PM, WenDong Zhang
> wrote:
> > Hi guys:
> >
> > Now days I want to develop a web application like a chat room. the
> requests
> > per seconds maybe very large, so I want to save some common info into
> to
> > memory (quick access).
> >
> > So, I want to know does php have the follow features or implement
> them in
> > other ways.
> > 1. server scope objects, mostly like application in jsp.  // the most
> > important~
> > 2. multithread synchronize.
> > 3. I want to start a thread timed execute, like Timer in java
> >
> > thanks
> > --
> > Best Regards!
> > Wen Dong
> >
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> __ Information from ESET Smart Security, version of virus
> signature database 4190 (20090626) __
> 
> The message was checked by ESET Smart Security.
> 
> http://www.eset.com
> 



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



[PHP] This Friday's OT Thread

2009-06-25 Thread Björn Bartels

Hello fellow coders...

THE 'KING OF POP' IS DEAD !

Tonight (here in Germany), Mr. Michael Joseph Jackson, also known as  
'the king of pop',

died on heart failure in the age of 50.

I just want to express my condolences to his family and friends and  
all the people

who loved him and his music.
This incomparable legendary musician has made such a big impact on  
music and musicians

than any other artist in history.

Rest in peace, Mr. Jackson! And may you and your music never be  
forgotten...


YT
BB (a drummer)

PS: I know, this thread usually is of some funny nature, so I  
opologize for this mood killing

post and I hope you understand


[Björn Bartels   ]

[email :  bart...@dragon-projects.de ]
[home  :   http://dragon-projects.de ]
[skype :  bb-drummer ]
[icq   :   283827160 ]

[--- ]

Diese E-Mail könnte vertrauliche und/oder rechtlich geschützte  
Informationen enthalten. Wenn Sie nicht der richtige Adressat sind  
oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte  
sofort den Absender und vernichten Sie diese Mail. Das unerlaubte  
Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht  
gestattet.


This e-mail may contain confidential and/or privileged information. If  
you are not the intended recipient (or have received this e-mail in  
error) please notify the sender immediately and destroy this e-mail.  
Any unauthorised copying, disclosure or distribution of the material  
in this e-mail is strictly forbidden.


[--- ]










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



[PHP] What does this mean?

2009-06-25 Thread Jason Carson
Hey all, I'm new to the list and I have a question...

What does => mean?

The book I am reading is called Programming PHP published by O'Reilly. I
haven't read the whole book yet. I was flipping through the pages and in
the book there is mention of <= (less than or equal) and >= (greater than
or equal)but it doesn't say what => is even though it is used numerous
times in the example code.

Thanks

Jason




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



Fwd: [PHP] What does this mean?

2009-06-25 Thread Eddie Drapkin
Just getting this back on the list >.>


-- Forwarded message --
From: Eddie Drapkin 
Date: Fri, Jun 26, 2009 at 2:36 AM
Subject: Re: [PHP] What does this mean?
To: Jason Carson 


It's used in key value combinations in several places.

When building an array:
$foo = array('key' => 'value', 'another_key' => 'another value');
which will give you an array that looks like
$foo['key'] = 'value';
$foo['another_key'] = 'another_value';

Also, in foreach(), which is a language construct used to iterate over arrays:

foreach($foo as $key => $val) {
 echo "The key for this element is $key and the value is $val\n";
}
will output:
The key for this element is key and the value is value
The key for this element is another_key and the value is another_value

Those are the two most common places you'll see it (and perhaps the
only, I don't want to speak conclusively, though, I'm awfully tired
this evening!)

On Fri, Jun 26, 2009 at 2:31 AM, Jason Carson wrote:
> Hey all, I'm new to the list and I have a question...
>
> What does => mean?
>
> The book I am reading is called Programming PHP published by O'Reilly. I
> haven't read the whole book yet. I was flipping through the pages and in
> the book there is mention of <= (less than or equal) and >= (greater than
> or equal)but it doesn't say what => is even though it is used numerous
> times in the example code.
>
> Thanks
>
> Jason
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



RE: [PHP] PHP doesn't see php.ini

2009-06-25 Thread Arno Kuhl
-Original Message-
From: Tir [mailto:tirsa...@yandex.ru]
Sent: 25 June 2009 08:48 PM
To: php-general@lists.php.net
Subject: Re: [PHP] PHP doesn't see php.ini

> Presume you did restart apache after making the change?
Of course

> Is there anything in your phpinfo output that relates to your php.ini?
I think there must be a mention of MySQL because i've enabled it. But it
isn't there.

> Maybe some error near the beginning of php.ini causes php to stop 
> loading the ini file?
I use a copy of php.ini-recommended from PHP distributive. I don't think
that there could be errors. I've only uncommented few strings to enable
MySQL extensions, set display_errors on and changed extension_dir.

> Check that the "extension_dir" in phpinfo agrees with the "extension_dir" 
> in your php.ini.
It agrees.

> Maybe try enabling error logging in the php.ini and check the log file
> - I use apache\logs\phperror.log and invalid extension loading is 
> definitely reported there (I've had this problem before).
That's it, i think. I've enabled display_startup_errors and now on start
apache i receive errors. PHP can't find libraries of MySQL extensions. But
this libraries exactly exist in folder that indicated in error messages. 
What that could be? 

--

Does mysql run from the command line? You can also download MySQL
Administrator from mysql.com and see if it can connect to mysql.

Cheers
Arno


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



[PHP] Re: point me to functions to parse the URL? (best one for *this*job?)

2009-06-25 Thread Nisse Engström
On Thu, 25 Jun 2009 18:20:36 -0500, Shawn McKenzie wrote:

> Shawn McKenzie wrote:
>> Govinda wrote:
>>> I need to parse those URLs and set the value of $myfolder to as follows:
>>>
>>> domain.com/unix/asdfsdf.html
>>> $myfolder=unix
>>> domain.com/macos/khsdfg.html
>>> $myfolder=macos
>>>
>>> BUT if there is no dir/ in between the domain and file,
>>> like so:
>>> domain.com/khsdfg.html
>>>  then I want:
>>> $myfolder=default
>> 
>> No way, you want to "parse" the "url"?
>> 
>> How about, parse_url()?

Or something like:

  /* UNTESTED */
  $myfolder = 'default';
  if (preg_match ('@^[^/]+/([^/]+)/@', $url, $m) {
$myfolder = $m[1];
  }

or:

  /* UNTESTED */
  $myfolder = 'default';
  $parts = explode ('/', $url);
  if (count ($parts) > 2) {
$myfolder = $parts[1];
  }

> Oh, and in the future, if you want to "strip" the "slashes" from a var,
> you would use the remove_escape_char() function :-)

Is there a manual page for that?


/Nisse

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