[PHP] Performance Comments Question

2006-01-19 Thread Rodolfo Andrade
Hi all!

I would like to know if comments in the code affects the performance. I know
that comments are ignored by the interpreter, but it does increase the file
size, so I was thinking about a possible performance hit for highly
commented files.

Can anyone confirm this?
Thanks!

Rodolfo Andrade

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



Re: [PHP] Embedded player

2006-01-19 Thread Rodolfo Andrade
Hi,

You can use readdir() function for list the files. Here's a sample code from
PHP Doc www.php.net/docs.

if ($handle = opendir('/path/to/files')) {
echo Handler: $handle\n;
echo Files:\n;
while (false !== ($file = readdir($handle))) {
echo $file\n;
}

I don't know how that music player works, but since it uses XML for
playlists, I think you can use readdir() then pass the results to XML.

- Original Message - 
From: Jedidiah
To: php-general@lists.php.net
Sent: Thursday, January 19, 2006 9:36 AM
Subject: [PHP] Embedded player


Hi.  I have been wanting to do something on my site for some time and was
recently told that it could be accomplished.



I started a daily devotion on our church website a few weeks ago, so I
changed all of my files to .php and began using a MySQL database.



I have a sermons page (www.mzbc.com/sermons.php) with a table with links to
.wma sermons.  When clicked in Firefox, it prompts to download.  What I want
is to be able to embed a player that will stay on that page and play all of
the files in the table.

I have found a player like this at http://musicplayer.sourceforge.net/.
There is also a Windows Media style player that will do the same thing.  The
problem is I either have to create each individual sermon with an embedded
player in a new page, or create a playlist.  I will eventually have way to
many sermons to use a playlist.  I am sure there must be some way to tell
each file in the table to open in that player, but I am not familiar yet
with programming yet.  I have php for dummies which I started reading, but I
am not sure it will do what I want.



Thanks so much,



Jedidiah

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



Re: [PHP] Embedded player

2006-01-19 Thread Rodolfo Andrade
If you are looking for compatibility then I would recommend the flash player
solution. There are a *LOT* of sites that use flash so I don't think that
making it a must will impact your users.

I don't know which type of users will access your church site, but I'm sure
that if they even use Linux, they will install the plugin, if they haven't
done so.

Just my 2¢
Good luck!
Rodolfo Andrade

- Original Message - 
From: Chris
To: clive
Cc: PHP General
Sent: Thursday, January 19, 2006 10:54 AM
Subject: Re: [PHP] Embedded player


On Thu, 2006-01-19 at 14:44, clive wrote:
 true, but not everyone uses windows as there operating system, so if
 they don't have windows media player they wont even be able to view the
 files.

A problem I`ve come across with many sites whilst using my Linux
box..very irritating.

--
Chris Blake
Cell: 082 775 1492
Work: +27 11 880 2825
Fax : +27 11 782 0841
Mail: [EMAIL PROTECTED]

I realize that today you have a number of top female athletes such as
Martina Navratilova who can run like deer and bench-press Chevrolet
trucks. But to be brutally frank, women as a group have a long way to go
before they reach the level of intensity and dedication to sports that
enables men to be such incredible jerks about it. -- Dave Barry, Sports
is a Drag

-- 
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] Drop down directory structure list box

2006-01-19 Thread Rodolfo Andrade
This depends on User-Agent. Internet Explorer queries the registry (MRU
values) looking for the last open directory.

There's no way to do this in PHP or plain HTML (w3 compilant) and probably
you will need to write an ActiveX plugin (which will sucks if you have a
Linux or Firefox user);

This because you can't query the registry
key(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Us
er Shell Folders) and store the paths.

Hope this is useful.
Best Regards
Rodolfo Andrade
- Original Message - 
From: Jochem Maas
To: Jay Blanchard
Cc: '[EMAIL PROTECTED]' ; 'Sumeet' ; PHP-General
Sent: Thursday, January 19, 2006 12:08 PM
Subject: Re: [PHP] Drop down directory structure list box


Jay Blanchard wrote:
 [snip]
 are you sure it was not internet explorer just showing you the last
 directory you had opened with a 'browse...' button with in that browsing
 session?
 [/snip]

 I am familiar with this behavior, and I am pretty sure that it wasn't
this,
 because it stood out somehow.

ack. just checking - hope you find the site, I'm quite interested in
what/how/etc.
(searching for the issue/problem/bug/thing doesn't seem to return anything
relevant)



-- 
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] odd behavior

2006-01-19 Thread Rodolfo Andrade
I use PWS with Windows 98 for learning purposes.

I just cut PHP.ini from C:\PHP and paste in %windir% then restart the
server. Works fine for me and I can run ASP and PHP for learning. ^^

Regards, Rodolfo Andrade

- Original Message - 
From: Jay Blanchard
To: PHP General (E-mail)
Sent: Thursday, January 19, 2006 3:53 PM
Subject: [PHP] odd behavior


When I expire you will find my hands wrapped tightly around the throat of a
Windows network administrator.

I had PHP installed on a web server, and all was working OK, save for one
small thing. phpinfo() indicated that the path to the php.ini was c:\WINNT,
which it was not. So I copy the file from the c:\php directory to the
c:\winnt directory and restart IIS. Now, when I click a link to take me to a
directory with an index.php I get a 404, not found error. If I refresh the
page shows up just fine. So I remove the ini page, start and stop the IIS
server, click the link, and no problem...the page is delivered just fine.

Has anyone experienced this behavior before, and how do I fix that damned
path to the ini? TIA!

-- 
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 and Apache

2006-01-16 Thread Rodolfo Andrade
www.google.com

or

http://fedoraproject.org/wiki/

But it's in test yet.

Best regards
Rodolfo Andrade
- Original Message - 
From: Erik Saline
To: Curt Zirzow ; php-general@lists.php.net
Sent: Monday, January 16, 2006 3:06 PM
Subject: Re: [PHP] PHP and Apache


Where do I find fc5?


Erik

 On Sun, Jan 15, 2006 at 09:34:40AM -0800, Erik Saline wrote:
 Using Fedora Core 4 using the already Apache and Mysql.  I tried using
the
 already installed PHP but mysql support was not setup or shown when using
 phpinfo().

 I recompiled PHP with the following.

 './configure' '--with-mysqli=/usr/bin/mysql_config'
 '--with-mysql=/usr/bin/mysql_config' '--enable-sockets'
 '--with-jpeg-dir=/usr' '--enable-exif' '--with-apx'

 First off, --with-mysql doesn't expect a mysql_config as an option
 but the $prefix directory were mysql was installed.


 Now all my PHP scripts do not work here is the error I find in the Apache
 Error logs.

 [Sat Jan 14 15:19:02 2006] [error] [client 192.168.1.1] (8)Exec format
error:
 exec of '/var/www/cgi-bin/create_user.php' failed,
 [Sat Jan 14 15:19:02 2006] [error] [client 192.168.1.1] Premature end of
 script headers: create_user.php,


 This is a sign that your in rpm hell.

 I can use php -i phpinfo.html and see that PHP works and that mysql is
now
 loaded.
 I added this to my httpd.conf

 but what does assuming your 'whatis database is upto date':

 'locate php | grep bin' give?
 'locate libphp' give?
 'locate php' give?

 And from those locates:
 ls -laF filenameoflocate


 My Guess:
 you will have a:
 /usr/bin/php
 /usr/local/bin/php
 /path/to/apache/modules/libphp(45).php

 Once that is figured out, what about the extenstions? is there any
 thing in your php.ini that specifies an extension_dir and/or
 extension=something.so?

 Last but should be first, check logs, turn on php.ini:error_log to
 syslog, turn on display_startup_errors, check /var/log/messages, if
 that doesnt work make sure php.ini:error_reporting  is E_ALL. If
 that doesn't work.. are you sure you are editing the correct
 php.ini for the environment you are using?


 AddType application/x-httpd-php .php

 This is for using php as a moudule, the error you are getting is
 based on php ran as a cgi.


 # which php at the command line returns
  /usr/local/bin/php

 try: /usr/bin/php -i


 Do I need to add something in the httpd.d to direct it to
/usr/local/bin/php
 instead of the intial defalt where
 # which php returned
 /usr/bin/php

 Ah, yeah, well, the thing you need to do is:
 1) either get rid of the system's installation of php and do the
installation by hand. Getting rid of php via the systems
installation process. Be forwarned, do this with care.

 2) use fc5


 Curt.

-- 
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] javascript in php page to use window.open()

2006-01-12 Thread Rodolfo Andrade
Hi Olga,

Your Javascript window.open() is missing one argument, the name of the
pop-up window:

window.open(\add.html\,\MyWindowName\,\resizable=no,width=400,height=20
0\);

Best Regards,
Rodolfo Andrade

- Original Message - 
From: Olga Urban
To: php-general@lists.php.net
Sent: Thursday, January 12, 2006 2:51 AM
Subject: [PHP] javascript in php page to use window.open()


Hi everyone,

I am trying to open a new window after a successful function call (I
don't want to use a href. and onclick). Here's what I have, but for
some reason, in IE the new window does not open (I have popup blockers
disabled). It opens in Mozilla, but with the wrong size. What am I doing
wrong here?

if (insert($lname, $fname, $course, $date, $media1,
$media2))
{
echo script type=\text/javascript\\n;
echo 
window.open(\add.html\,\resizable=no,width=400,height=200\);;
echo /script\n\n;
}
else
echo Error adding a record.;



Thanks.

Olga

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



Re: [PHP] test variable value?

2006-01-11 Thread Rodolfo Andrade
How about...

if (!$x){
echo x is empty;
}

Regards,
Rodolfo Andradee


- Original Message - 
From: Stut 
To: William Stokes 
Cc: php-general@lists.php.net 
Sent: Wednesday, January 11, 2006 8:08 AM
Subject: Re: [PHP] test variable value?


William Stokes wrote:

Hello

What is the best way to determine if a variable has no value?

if ($var== '')

or

if ($var== 'null')


Can 'null' be used here?
  

Depends what you mean by no value. I suggest you read 
http://php.net/is_null, http://php.net/empty and http://php.net/isset.

-Stut

-- 
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] Speed

2006-01-11 Thread Rodolfo Andrade
I think calculating directly in MySQL will be faster, since less data will
be travelling from MySQL to PHP.

Just my 2¢.

Regards,
Rodolfo Andrade

- Original Message - 
From: Weber Sites LTD
To: 'Peter Lauri' ; php-general@lists.php.net
Sent: Wednesday, January 11, 2006 6:07 AM
Subject: RE: [PHP] Speed


Why not check it?

Try to query for the AVG() and get the result or query for the data
and do a loop in PHP to calculate the AVG. Check the time each
Takes.

My Money is that getting the value from SQL will be faster.

Sincerely

berber

Visit the Weber Sites Today,
To see where PHP might take you tomorrow.
PHP code examples : http://www.weberdev.com
PHP Web Logs : http://www.weberblog.com/
PHP  MySQL Forums : http://www.weberforums.com/
Learn PHP Playing Trivia http://www.webertrivia.com
Web Development Index http://www.weberindex.com
Web Templates http://www.webertemplates.com
Search for PHP Code from your browser http://toolbar.weberdev.com


-Original Message-
From: Peter Lauri [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 11, 2006 9:14 AM
To: php-general@lists.php.net
Subject: [PHP] Speed

Best group member,



Assume that I save data about an object and it has 10.000 observations of
the object stored in a MySQL database. I want calculate the average value of
a column, is it faster done by using PHP on the result array or using the
MySQL function to do that?



/Peter

-- 
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] test variable value?

2006-01-11 Thread Rodolfo Andrade
I do use if(!$var) for simple application. Only _IF_ I need to know if the
$var is defined but empty or so I would use especific functions.

- Original Message - 
From: Stut
To: Rodolfo Andrade
Cc: William Stokes ; php-general@lists.php.net
Sent: Wednesday, January 11, 2006 11:49 AM
Subject: Re: [PHP] test variable value?


Rodolfo Andrade wrote:

How about...

if (!$x){
echo x is empty;
}



Because $x could be an empty string, 0, false, null or undefined. If
that's what you need to check for then knock yourself out.

-Stuart

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



Re: [PHP] Included php files in a cron job?

2006-01-06 Thread Rodolfo Andrade
Hi Jay,

Yes, you can use include(); with cron.

Regards,
Rodolfo Andrade

- Original Message - 
From: Jay Paulson (CE CEN)
To: php-general@lists.php.net
Sent: Friday, January 06, 2006 2:29 PM
Subject: [PHP] Included php files in a cron job?


I'm in the process of writing a PHP program that is going to be called once
a week via a cron job.  I don't have a place to really test this hence the
reason why I'm asking about it here.  My question is can my php program
include other php files and still get executed correctly when the cron job
runs?

For example:
#!/path/to/php
?php

require_once($file);

//do something

?

Will the code in $file work correctly when the cron job executes the php
file that has something simular to what I have above?

Thanks!

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