php-general Digest 24 Sep 2008 11:18:39 -0000 Issue 5699

2008-09-24 Thread php-general-digest-help

php-general Digest 24 Sep 2008 11:18:39 - Issue 5699

Topics (messages 280802 through 280825):

Re: $this-value VS $value
280802 by: Jochem Maas
280803 by: Eric Butera
280805 by: Nathan Nobbe
280806 by: Nathan Nobbe
280807 by: Eric Butera
280808 by: Nathan Nobbe

Re: Browser could not get mp3 files from http site
280804 by: hce
280809 by: Richard Lynch
280818 by: hce
280825 by: Ashley Sheridan

Re: PHP tags - any reasons to close ?
280810 by: Ross McKay

Using Static Class Variables to Access Globally
280811 by: Ryan Panning
280812 by: Richard Lynch
280814 by: Nathan Nobbe
280816 by: Ryan Panning
280820 by: Colin Guthrie

class const versus define
280813 by: Richard Lynch
280817 by: Carlos Medina
280819 by: Chris
280821 by: Jochem Maas

The Data Literacy Test
280815 by: Shelley

Re: How to detect the host (window or Linux)?
280822 by: hce

Google Checkout
280823 by: Richard Heyes
280824 by: Stephen Wellington

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---

Nathan Nobbe schreef:

On Tue, Sep 23, 2008 at 10:41 AM, Micah Gersten [EMAIL PROTECTED] wrote:


Eric Butera wrote:

On Tue, Sep 23, 2008 at 12:26 PM, Jochem Maas [EMAIL PROTECTED]

wrote:

(using $this-foo or MyClass::$foo for static properties).


also self::



Actually within a class, I think you must self:: before a static
property or something shows up in the error log.



yea, php will think its a local variable if not qualified w/ the self
keyword and scope resolution (or w/e its called in php :D), but the name of
the class and the scope resolution operator works as well.  its just a hair
less flexible because if the class name changes you have to update some code
whereas w/ self, the code is no longer dependent upon the class name.

/// psuedocode !
class A {
protected static $someStatic = 5;

public function doStuff() {
  $someStatic  // php thinks this is a local var
  self::$someStatic  // php can id this as a static var
  A::$someStatic  // php can id this as a static var


Nathan is correct, I'd like to add that 'self' is actually nothing more than
a simple alias used at compile time to put the class name in ...
'self' literally equates to 'MyClass',  but it saves hassle when refactoring
and it's much clearer that you mean 'this class Im looking at/working in'
 personally whenever I see a classname referenced statically inside a method
I kind of assume it must be another class :-P

... now had 'self' been late (statically) bound ... no I won't go there, we get
'static' very soon now :-P


}

-nathan



---End Message---
---BeginMessage---
On Tue, Sep 23, 2008 at 6:25 PM, Jochem Maas [EMAIL PROTECTED] wrote:
 Nathan Nobbe schreef:

 On Tue, Sep 23, 2008 at 10:41 AM, Micah Gersten [EMAIL PROTECTED] wrote:

 Eric Butera wrote:

 On Tue, Sep 23, 2008 at 12:26 PM, Jochem Maas [EMAIL PROTECTED]

 wrote:

 (using $this-foo or MyClass::$foo for static properties).

 also self::


 Actually within a class, I think you must self:: before a static
 property or something shows up in the error log.


 yea, php will think its a local variable if not qualified w/ the self
 keyword and scope resolution (or w/e its called in php :D), but the name
 of
 the class and the scope resolution operator works as well.  its just a
 hair
 less flexible because if the class name changes you have to update some
 code
 whereas w/ self, the code is no longer dependent upon the class name.

 /// psuedocode !
 class A {
 protected static $someStatic = 5;

 public function doStuff() {
  $someStatic  // php thinks this is a local var
  self::$someStatic  // php can id this as a static var
  A::$someStatic  // php can id this as a static var

 Nathan is correct, I'd like to add that 'self' is actually nothing more than
 a simple alias used at compile time to put the class name in ...
 'self' literally equates to 'MyClass',  but it saves hassle when refactoring
 and it's much clearer that you mean 'this class Im looking at/working in'
  personally whenever I see a classname referenced statically inside a
 method
 I kind of assume it must be another class :-P

 ... now had 'self' been late (statically) bound ... no I won't go there, we
 get
 'static' very soon now :-P

 }

 -nathan



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



Active Record sucks :P
---End Message---
---BeginMessage---
On Tue, Sep 23, 2008 at 4:25 PM, Jochem Maas [EMAIL PROTECTED] wrote:

 ... now had 'self' been late (statically) bound ... no I won't go there, we
 get
 'static' very soon now :-P


and 

[PHP] Re: class const versus define

2008-09-24 Thread Carlos Medina

Richard Lynch schrieb:

Is there any reason why the logic behind define() couldn't be pushed down to 
class const?

Code like this is kinda fugly:

//It's okay here, but not in a class?
define('CACHE_DIR_LONG',  CONFIG_ROOT_PATH . '/cache/');
class Cache {
  const CACHE_DIR = '/dev/shm/cache/';
  const CACHE_TTL = 300; //5 minutes
  const CACHE_DIR_LONG = CACHE_DIR_LONG;

I'd really prefer to write:
class Cache {
  const CACHE_DIR = '/dev/shm/cache/';
  const CACHE_TTL = 300; //5 minutes
  const CACHE_DIR_LONG = CONFIG_ROOT_PATH . '/cache/';

I'm happy to add it as a feature request, but not if somebody reliable says Don't 
Bother...

--
Richard Lynch



___

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214


Hi Richard,
the define function is to be used on the global scope of your 
application. This is helpful to assign Configurations Options and other 
data that you do not will move. For the Class Constants you define the 
Constant only fo the Class where you are working.

Please read the documentation about this on PHP.NET
http://de.php.net/manual/en/language.oop5.constants.php

Regards

Carlos

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



Re: [PHP] Re: Browser could not get mp3 files from http site

2008-09-24 Thread hce
On Wed, Sep 24, 2008 at 9:56 AM, Richard Lynch [EMAIL PROTECTED] wrote:
 As a general rule, check what happens when you do wget -S on the URL and see 
 what the browser sees.

Thanks Richard and all responses. That was the best PHP and HTML debug
I've learned so far. I always find it is difficult to debug html and
JS when doing PHP program. I can debug C/C++ using gdb well but no
idea what the tools can be used for browser debug.

Anyway, the problem has been resolved. It turns out it was an
authorisation issue. My web server requests a log in at beggin,
although I can see every pages and download other data and image
files, somehow it cannot download the mp3 file. As soon as I remove
the login, it works fine.

Appreciate all of your helps and responses.

Cheers.

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



Re: [PHP] Re: class const versus define

2008-09-24 Thread Chris


the define function is to be used on the global scope of your 
application. This is helpful to assign Configurations Options and other 
data that you do not will move. For the Class Constants you define the 
Constant only fo the Class where you are working.

Please read the documentation about this on PHP.NET
http://de.php.net/manual/en/language.oop5.constants.php


Re-read what he said.

What he wants to do is use a previous class constant in another one.

With defines, you can do:

define('VAR_1', 'This is var 1');
define('VAR_2', VAR_1 . ' plus some more on the end');

You cannot do a similar thing with class constants (you get parse 
errors), he's asking why.


--
Postgresql  php tutorials
http://www.designmagick.com/


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



[PHP] Re: Using Static Class Variables to Access Globally

2008-09-24 Thread Colin Guthrie

Nathan Nobbe wrote:

in many cases, people like to drive client code through methods, which,
given the current set of language features in php, could be reason to favor
a singleton w/ __get()  __set() methods defined.  you still have the same
'global' scope, except that the data doesnt have to be public.  (im not
saying its bad to use public vars, im merely presenting an alternative
perspective).


/me prefers singleton with __get and __set but each to their own :)

I quite like the fact that the __construct of the singleton itself can 
fill up the variables that are accessed via __get and from then on rogue 
code cannot overwrite them (assuming you do not implement a __set!)


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] class const versus define

2008-09-24 Thread Jochem Maas

Richard Lynch schreef:

Is there any reason why the logic behind define() couldn't be pushed down to 
class const?


probably no reason why it couldn't but from what I gather there is a specific
reason wht it works like this: speed.

const is compile time, define is runtime

IIRC const was made this way in order to make it fast.

I also recall posts by Matt Wilmas on internals regarding a patch for 'constant 
expression
folding' which allows simple expressions in const definitions (whilst keeping 
the compile
time speed) ... I think it made it in to 5.3 but you'd have to check.


Code like this is kinda fugly:

//It's okay here, but not in a class?
define('CACHE_DIR_LONG',  CONFIG_ROOT_PATH . '/cache/');
class Cache {
  const CACHE_DIR = '/dev/shm/cache/';
  const CACHE_TTL = 300; //5 minutes
  const CACHE_DIR_LONG = CACHE_DIR_LONG;

I'd really prefer to write:
class Cache {
  const CACHE_DIR = '/dev/shm/cache/';
  const CACHE_TTL = 300; //5 minutes
  const CACHE_DIR_LONG = CONFIG_ROOT_PATH . '/cache/';


talking of fugly, your declaring a class, from a purists POV it really
shouldn't contain such values in it's definition ... these are things
you set when initializing the class/object for use. :-P


I'm happy to add it as a feature request, but not if somebody reliable says Don't 
Bother...


I'd go with Don't Bother ... although check the internals archives
as your desired feature may actually be on it's way in, in some form.


--
Richard Lynch



___

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214


bla bla bla.






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



Re: [PHP] How to detect the host (window or Linux)?

2008-09-24 Thread hce
On Mon, Sep 22, 2008 at 4:04 PM, Thodoris [EMAIL PROTECTED] wrote:

 $win = stripos(PHP_OS, 'win') !== false ? true : false;
 Perhaps you could also use this as an alternative:

 http://gr.php.net/manual/en/function.php-uname.php

Thanks Thodoris and Anderson. Sorry for not clear about the question.
I mean to detect the OS in Host system where the browser is located,
not the SERVER OS.

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



[PHP] Google Checkout

2008-09-24 Thread Richard Heyes
Hi,

As a follow up, I've just switched from Paypal to Google Checkout.
Setup was quick and pain free (easily less than 2 hours), and I would
recommend it (so far). Like other people have said though, it's just
UK and USA at the moment.

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.phpguru.org/RGraph

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



Re: [PHP] Google Checkout

2008-09-24 Thread Stephen Wellington
I'm looking at using this myself for an upcoming project..
Do you know if they force customers to sign up with a google account
before processing or can they just put in card details and be done
with it?
Thanks,
Steve

On Wed, Sep 24, 2008 at 10:59 AM, Richard Heyes [EMAIL PROTECTED] wrote:
 Hi,

 As a follow up, I've just switched from Paypal to Google Checkout.
 Setup was quick and pain free (easily less than 2 hours), and I would
 recommend it (so far). Like other people have said though, it's just
 UK and USA at the moment.

 --
 Richard Heyes

 HTML5 Graphing for FF, Chrome, Opera and Safari:
 http://www.phpguru.org/RGraph

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





--
Stephen Wellington
07956 042387
01865 28 ext 12438
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]



-- 
Stephen Wellington
07956 042387
01865 28 ext 12438
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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



Re: [PHP] Re: Browser could not get mp3 files from http site

2008-09-24 Thread Ashley Sheridan
On Wed, 2008-09-24 at 17:03 +1000, hce wrote:
 On Wed, Sep 24, 2008 at 9:56 AM, Richard Lynch [EMAIL PROTECTED] wrote:
  As a general rule, check what happens when you do wget -S on the URL and 
  see what the browser sees.
 
 Thanks Richard and all responses. That was the best PHP and HTML debug
 I've learned so far. I always find it is difficult to debug html and
 JS when doing PHP program. I can debug C/C++ using gdb well but no
 idea what the tools can be used for browser debug.
 
 Anyway, the problem has been resolved. It turns out it was an
 authorisation issue. My web server requests a log in at beggin,
 although I can see every pages and download other data and image
 files, somehow it cannot download the mp3 file. As soon as I remove
 the login, it works fine.
 
 Appreciate all of your helps and responses.
 
 Cheers.
 
For debugging PHP there is PHPDebug, which is like an add-on that gives
debug output comparable to ColdFusion or ASP.Net (or so I've heard.) It
might be worth having a quick look into that if you think it will be of
any help.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] The Data Literacy Test

2008-09-24 Thread Ashley Sheridan
On Wed, 2008-09-24 at 09:20 +0800, Shelley wrote:
 http://phparch.cn/index.php/php/34-php-basics/202-the-data-literacy-testThe
 Data Literacy Test:
 
 http://www.phparch.cn/index.php/php/34-php-basics/202-the-data-literacy-test
 
What the smeg is this?


Ash
www.ashleysheridan.co.uk


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



[PHP] spreadsheets are opened read only

2008-09-24 Thread Thodoris


Hi guys. I am having a problem with opening xls files from a link 
generated from php script. Let me analyze this:


I have two linux servers with apache (php,mysql etc) that are running 
the same project. There is a part in this project that reads all the 
files from a directory and generates the appropriate links to them. 
These files are usually spreadsheets (xls) and when I open a file using 
the link on the first machine it opens normally but when I open the file 
from the second it is opened read only.


I have checked the rights and the ownership and they are the exact same 
from the servers document root to the file itself.


Any ideas why is this happening?

--
Thodoris


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



Re: [PHP] How to detect the host (window or Linux)?

2008-09-24 Thread Ashley Sheridan
On Wed, 2008-09-24 at 19:01 +1000, hce wrote:
 On Mon, Sep 22, 2008 at 4:04 PM, Thodoris [EMAIL PROTECTED] wrote:
 
  $win = stripos(PHP_OS, 'win') !== false ? true : false;
  Perhaps you could also use this as an alternative:
 
  http://gr.php.net/manual/en/function.php-uname.php
 
 Thanks Thodoris and Anderson. Sorry for not clear about the question.
 I mean to detect the OS in Host system where the browser is located,
 not the SERVER OS.
 
For this you can use the get_browser() function of PHP, which returns a
plethora of information as an array. If this function doesn't work (it
didn't for me because of hosting restrictions) then someone called sam
on the php.net manual page has written a function called
php_get_browser() which does the same thing. Just make sure you download
an up-to-date browscap.ini file and you'll have all the information you
want.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Google Checkout

2008-09-24 Thread Ashley Sheridan
On Wed, 2008-09-24 at 11:08 +0100, Stephen Wellington wrote:
 I'm looking at using this myself for an upcoming project..
 Do you know if they force customers to sign up with a google account
 before processing or can they just put in card details and be done
 with it?
 Thanks,
 Steve
 
 On Wed, Sep 24, 2008 at 10:59 AM, Richard Heyes [EMAIL PROTECTED] wrote:
  Hi,
 
  As a follow up, I've just switched from Paypal to Google Checkout.
  Setup was quick and pain free (easily less than 2 hours), and I would
  recommend it (so far). Like other people have said though, it's just
  UK and USA at the moment.
 
  --
  Richard Heyes
 
  HTML5 Graphing for FF, Chrome, Opera and Safari:
  http://www.phpguru.org/RGraph
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 --
 Stephen Wellington
 07956 042387
 01865 28 ext 12438
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 
 
 
 -- 
 Stephen Wellington
 07956 042387
 01865 28 ext 12438
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 
They do have to sign up for an account, but it's all inline with the
payment as well. As far as signing up goes, the only extra information
they have to put in is a username and password.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] spreadsheets are opened read only

2008-09-24 Thread Ashley Sheridan
On Wed, 2008-09-24 at 14:28 +0300, Thodoris wrote:
 Hi guys. I am having a problem with opening xls files from a link 
 generated from php script. Let me analyze this:
 
 I have two linux servers with apache (php,mysql etc) that are running 
 the same project. There is a part in this project that reads all the 
 files from a directory and generates the appropriate links to them. 
 These files are usually spreadsheets (xls) and when I open a file using 
 the link on the first machine it opens normally but when I open the file 
 from the second it is opened read only.
 
 I have checked the rights and the ownership and they are the exact same 
 from the servers document root to the file itself.
 
 Any ideas why is this happening?
 
 -- 
 Thodoris
 
 
Do you have the spreadsheet opened on both machines at the same time? If
so, then as far as I know there is no way to prevent it short of
versioning software. The first person opening a M$ Office document marks
it as read-only for anyone else who later opens it at the same time. As
soon as the first person closes it, it gets marked write-allowed.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] $this-value VS $value

2008-09-24 Thread Eric Butera
On Tue, Sep 23, 2008 at 7:30 PM, Nathan Nobbe [EMAIL PROTECTED] wrote:
 On Tue, Sep 23, 2008 at 5:25 PM, Eric Butera [EMAIL PROTECTED] wrote:

 I generate my data access objects too.  It goes against my better
 judgment, but performance wins out in this specific situation.

 getting off the point of the thread (i could care less :D), but have you
 seen the model taken by qcodo, propel (and likely others) where the
 generated layer is extended, so that subsequent re-generation does not
 interfere w/ customizations on the generated library?

 -nathan


I have looked at Propel several times and I'm quite close to jumping
on that bandwagon.  The last time I was looking I decided against it
though since it required a big base library to run properly (at least
I think it was that, could be wrong).  I do really like the idea of
having something else take care of the DAO business for the most part.
 One less problem, right?

My little generator just does the basic load, save (which calls
update/insert based on pk), delete.  From there I hand write out the
actual fetch statements.  I have some templates to ease the burden of
doing some of the more repetitive queries, such as the ones that
require pagination.  I think it is very important to craft data
fetching SQL statements though since that is usually the largest
bottle neck of the system.

After looking at that Qcodo framework for a second I've actually made
another generator that creates the management side MVC pages to work
off of a table too.  That is an interesting idea though extending the
generated classes to get around customizations.  I was thinking about
trying to come up with a way of doing a diff to handle this in my own
generators.  It is easy enough to just copy the basic methods and
paste them over my current ones though.  I hardly ever find myself
adding new fields to tables once a job is complete so I haven't felt
the motivation to do it yet.

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



Re: [PHP] spreadsheets are opened read only

2008-09-24 Thread Thodoris



On Wed, 2008-09-24 at 14:28 +0300, Thodoris wrote:
  
Hi guys. I am having a problem with opening xls files from a link 
generated from php script. Let me analyze this:


I have two linux servers with apache (php,mysql etc) that are running 
the same project. There is a part in this project that reads all the 
files from a directory and generates the appropriate links to them. 
These files are usually spreadsheets (xls) and when I open a file using 
the link on the first machine it opens normally but when I open the file 
from the second it is opened read only.


I have checked the rights and the ownership and they are the exact same 
from the servers document root to the file itself.


Any ideas why is this happening?

--
Thodoris




Do you have the spreadsheet opened on both machines at the same time? If
so, then as far as I know there is no way to prevent it short of
versioning software. The first person opening a M$ Office document marks
it as read-only for anyone else who later opens it at the same time. As
soon as the first person closes it, it gets marked write-allowed.


Ash
www.ashleysheridan.co.uk

  


No that is not the case since every server is completely independent 
from the other. That is why I was comparing the configuration and the 
rights. In addition to this I said that these are linux servers.


The weird is that apache opens the files and sends them and openoffice 
takes the file and opens it. There is a difference in that procedure 
between the two that make the office to open the file as read only that 
I am not aware of.


--
Thodoris



Re: [PHP] The Data Literacy Test

2008-09-24 Thread tedd

At 12:25 PM +0100 9/24/08, Ashley Sheridan wrote:

On Wed, 2008-09-24 at 09:20 +0800, Shelley wrote:


http://phparch.cn/index.php/php/34-php-basics/202-the-data-literacy-testThe
 Data Literacy Test:

 http://www.phparch.cn/index.php/php/34-php-basics/202-the-data-literacy-test


What the smeg is this?


I don't know, but I figure 27.

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] Using Static Class Variables to Access Globally

2008-09-24 Thread Eric Butera
On Tue, Sep 23, 2008 at 9:03 PM, Ryan Panning [EMAIL PROTECTED] wrote:
 The typical way to access a variable or instance from inside a
 function/method is to either declare it a global variable or pass it as a
 argument. Is there any reason why someone shouldn't use static class
 variables to do this? Ex:

 ?php
 class Foo {
public static $bar_instance;
 }

 class Bar {
public function do_something() {}
 }

 Foo::$bar_instance = new Bar;

 function foo_bar() {
Foo::$bar_instance-do_something();
 }

 foo_bar();
 ?

 Crude example but imagine this on a larger scale. I'm thinking there may be
 some kind of php optimization that this would hamper or something to that
 effect.

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



You might also look into these concepts:

- service locator
- registry pattern
- dependency injection

I wouldn't create something like what you're doing without a very good
documented reason for it.  The reason everything is hidden behind
methods/structures is so that you can change your code and have a
layer to deal with the changes.  By exposing a variable to be public
static then you're opening your implementation up allowing people to
rely on it forcing you to be stuck in a rut if you need to swap it out
for something else.  Blah blah blah.  ;)

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



Re: [PHP] spreadsheets are opened read only

2008-09-24 Thread Ashley Sheridan
On Wed, 2008-09-24 at 14:59 +0300, Thodoris wrote:
 
  On Wed, 2008-09-24 at 14:28 +0300, Thodoris wrote:

   Hi guys. I am having a problem with opening xls files from a link 
   generated from php script. Let me analyze this:
   
   I have two linux servers with apache (php,mysql etc) that are running 
   the same project. There is a part in this project that reads all the 
   files from a directory and generates the appropriate links to them. 
   These files are usually spreadsheets (xls) and when I open a file using 
   the link on the first machine it opens normally but when I open the file 
   from the second it is opened read only.
   
   I have checked the rights and the ownership and they are the exact same 
   from the servers document root to the file itself.
   
   Any ideas why is this happening?
   
   -- 
   Thodoris
   
   
   
  Do you have the spreadsheet opened on both machines at the same time? If
  so, then as far as I know there is no way to prevent it short of
  versioning software. The first person opening a M$ Office document marks
  it as read-only for anyone else who later opens it at the same time. As
  soon as the first person closes it, it gets marked write-allowed.
  
  
  Ash
  www.ashleysheridan.co.uk
  

 
 No that is not the case since every server is completely independent
 from the other. That is why I was comparing the configuration and the
 rights. In addition to this I said that these are linux servers.
 
 The weird is that apache opens the files and sends them and openoffice
 takes the file and opens it. There is a difference in that procedure
 between the two that make the office to open the file as read only
 that I am not aware of.
 -- 
 Thodoris
I don't think you understood my response and I didn't really understand
yours. Are you saying that you have two configurations, with two servers
and two workstations that should be acting the same and aren't?


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] spreadsheets are opened read only

2008-09-24 Thread Thodoris




On Wed, 2008-09-24 at 14:59 +0300, Thodoris wrote:
  

On Wed, 2008-09-24 at 14:28 +0300, Thodoris wrote:
  
  
Hi guys. I am having a problem with opening xls files from a link 
generated from php script. Let me analyze this:


I have two linux servers with apache (php,mysql etc) that are running 
the same project. There is a part in this project that reads all the 
files from a directory and generates the appropriate links to them. 
These files are usually spreadsheets (xls) and when I open a file using 
the link on the first machine it opens normally but when I open the file 
from the second it is opened read only.


I have checked the rights and the ownership and they are the exact same 
from the servers document root to the file itself.


Any ideas why is this happening?

--
Thodoris





Do you have the spreadsheet opened on both machines at the same time? If
so, then as far as I know there is no way to prevent it short of
versioning software. The first person opening a M$ Office document marks
it as read-only for anyone else who later opens it at the same time. As
soon as the first person closes it, it gets marked write-allowed.


Ash
www.ashleysheridan.co.uk

  
  

No that is not the case since every server is completely independent
from the other. That is why I was comparing the configuration and the
rights. In addition to this I said that these are linux servers.

The weird is that apache opens the files and sends them and openoffice
takes the file and opens it. There is a difference in that procedure
between the two that make the office to open the file as read only
that I am not aware of.
--
Thodoris


I don't think you understood my response and I didn't really understand
yours. Are you saying that you have two configurations, with two servers
and two workstations that should be acting the same and aren't?


Ash
www.ashleysheridan.co.uk

  


Two servers (two configurations but similar) independent to each other 
running the same php scripts (everyone has its own copy).


You click a link and browser asks you if you want to open or save the 
file. If you choose to open it then on the first server opens read-write 
but on the second writing is not permitted.



--
Thodoris



Re: [PHP] Re: Using Static Class Variables to Access Globally

2008-09-24 Thread Richard Heyes
 /me prefers singleton with __get and __set but each to their own :)

Do you mean registry?

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.phpguru.org/RGraph

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



Re: [PHP] The Data Literacy Test

2008-09-24 Thread Maciek Sokolewicz

tedd wrote:

At 12:25 PM +0100 9/24/08, Ashley Sheridan wrote:

On Wed, 2008-09-24 at 09:20 +0800, Shelley wrote:


http://phparch.cn/index.php/php/34-php-basics/202-the-data-literacy-testThe 


 Data Literacy Test:

 http://www.phparch.cn/index.php/php/34-php-basics/202-the-data-literacy-test 




What the smeg is this?


I don't know, but I figure 27.

Cheers,

tedd



yes, I think 27 aswell...

- Tul

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



Re: [PHP] spreadsheets are opened read only

2008-09-24 Thread Jochem Maas

Thodoris schreef:




On Wed, 2008-09-24 at 14:59 +0300, Thodoris wrote:
 

On Wed, 2008-09-24 at 14:28 +0300, Thodoris wrote:
   
Hi guys. I am having a problem with opening xls files from a link 
generated from php script. Let me analyze this:


I have two linux servers with apache (php,mysql etc) that are 
running the same project. There is a part in this project that 
reads all the files from a directory and generates the appropriate 
links to them. These files are usually spreadsheets (xls) and when 
I open a file using the link on the first machine it opens normally 
but when I open the file from the second it is opened read only.


I have checked the rights and the ownership and they are the exact 
same from the servers document root to the file itself.


Any ideas why is this happening?

--
Thodoris



Do you have the spreadsheet opened on both machines at the same 
time? If

so, then as far as I know there is no way to prevent it short of
versioning software. The first person opening a M$ Office document 
marks

it as read-only for anyone else who later opens it at the same time. As
soon as the first person closes it, it gets marked write-allowed.


Ash
www.ashleysheridan.co.uk



No that is not the case since every server is completely independent
from the other. That is why I was comparing the configuration and the
rights. In addition to this I said that these are linux servers.

The weird is that apache opens the files and sends them and openoffice
takes the file and opens it. There is a difference in that procedure
between the two that make the office to open the file as read only
that I am not aware of.
--
Thodoris


I don't think you understood my response and I didn't really understand
yours. Are you saying that you have two configurations, with two servers
and two workstations that should be acting the same and aren't?


Ash
www.ashleysheridan.co.uk

  


Two servers (two configurations but similar) independent to each other 
running the same php scripts (everyone has its own copy).


You click a link and browser asks you if you want to open or save the 
file. If you choose to open it then on the first server opens read-write 
but on the second writing is not permitted.


Yeah, your opening them simultaneously on the same desktop, Excel sees that 
they're
they have the same file name and makes the second read-only ... at least that's
what i think Ash tried to explain. play with 'save as' using a different file 
name
see if that clears up the situation








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



Re: [PHP] spreadsheets are opened read only

2008-09-24 Thread Thodoris



Thodoris schreef:




On Wed, 2008-09-24 at 14:59 +0300, Thodoris wrote:
 

On Wed, 2008-09-24 at 14:28 +0300, Thodoris wrote:
  
Hi guys. I am having a problem with opening xls files from a link 
generated from php script. Let me analyze this:


I have two linux servers with apache (php,mysql etc) that are 
running the same project. There is a part in this project that 
reads all the files from a directory and generates the 
appropriate links to them. These files are usually spreadsheets 
(xls) and when I open a file using the link on the first machine 
it opens normally but when I open the file from the second it is 
opened read only.


I have checked the rights and the ownership and they are the 
exact same from the servers document root to the file itself.


Any ideas why is this happening?

--
Thodoris



Do you have the spreadsheet opened on both machines at the same 
time? If

so, then as far as I know there is no way to prevent it short of
versioning software. The first person opening a M$ Office document 
marks
it as read-only for anyone else who later opens it at the same 
time. As

soon as the first person closes it, it gets marked write-allowed.


Ash
www.ashleysheridan.co.uk



No that is not the case since every server is completely independent
from the other. That is why I was comparing the configuration and the
rights. In addition to this I said that these are linux servers.

The weird is that apache opens the files and sends them and openoffice
takes the file and opens it. There is a difference in that procedure
between the two that make the office to open the file as read only
that I am not aware of.
--
Thodoris


I don't think you understood my response and I didn't really understand
yours. Are you saying that you have two configurations, with two 
servers

and two workstations that should be acting the same and aren't?


Ash
www.ashleysheridan.co.uk

  


Two servers (two configurations but similar) independent to each 
other running the same php scripts (everyone has its own copy).


You click a link and browser asks you if you want to open or save the 
file. If you choose to open it then on the first server opens 
read-write but on the second writing is not permitted.


Yeah, your opening them simultaneously on the same desktop, Excel sees 
that they're
they have the same file name and makes the second read-only ... at 
least that's
what i think Ash tried to explain. play with 'save as' using a 
different file name

see if that clears up the situation









Sorry Ash I didn't got that on the first place but I use openoffice and 
when I open the same file the second time it opens it using a different 
name like test.xls-2 or something like that.


But besides this when I upload a file (using a form) and then try to 
open it then it is opened it opens as read only on the first place.


Is it possible that is this caused by apache or can I  reconfigure 
php.ini to change this behavior?


I suspect that the  headers  are being  sent  are somehow  different .

--
Thodoris


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



Re: [PHP] spreadsheets are opened read only

2008-09-24 Thread Ashley Sheridan
On Wed, 2008-09-24 at 15:43 +0300, Thodoris wrote:
  Thodoris schreef:
 
 
  On Wed, 2008-09-24 at 14:59 +0300, Thodoris wrote:
   
  On Wed, 2008-09-24 at 14:28 +0300, Thodoris wrote:

  Hi guys. I am having a problem with opening xls files from a link 
  generated from php script. Let me analyze this:
 
  I have two linux servers with apache (php,mysql etc) that are 
  running the same project. There is a part in this project that 
  reads all the files from a directory and generates the 
  appropriate links to them. These files are usually spreadsheets 
  (xls) and when I open a file using the link on the first machine 
  it opens normally but when I open the file from the second it is 
  opened read only.
 
  I have checked the rights and the ownership and they are the 
  exact same from the servers document root to the file itself.
 
  Any ideas why is this happening?
 
  -- 
  Thodoris
 
 
  
  Do you have the spreadsheet opened on both machines at the same 
  time? If
  so, then as far as I know there is no way to prevent it short of
  versioning software. The first person opening a M$ Office document 
  marks
  it as read-only for anyone else who later opens it at the same 
  time. As
  soon as the first person closes it, it gets marked write-allowed.
 
 
  Ash
  www.ashleysheridan.co.uk
 
  
  No that is not the case since every server is completely independent
  from the other. That is why I was comparing the configuration and the
  rights. In addition to this I said that these are linux servers.
 
  The weird is that apache opens the files and sends them and openoffice
  takes the file and opens it. There is a difference in that procedure
  between the two that make the office to open the file as read only
  that I am not aware of.
  -- 
  Thodoris
  
  I don't think you understood my response and I didn't really understand
  yours. Are you saying that you have two configurations, with two 
  servers
  and two workstations that should be acting the same and aren't?
 
 
  Ash
  www.ashleysheridan.co.uk
 

 
  Two servers (two configurations but similar) independent to each 
  other running the same php scripts (everyone has its own copy).
 
  You click a link and browser asks you if you want to open or save the 
  file. If you choose to open it then on the first server opens 
  read-write but on the second writing is not permitted.
 
  Yeah, your opening them simultaneously on the same desktop, Excel sees 
  that they're
  they have the same file name and makes the second read-only ... at 
  least that's
  what i think Ash tried to explain. play with 'save as' using a 
  different file name
  see if that clears up the situation
 
 
 
 
 
 
 Sorry Ash I didn't got that on the first place but I use openoffice and 
 when I open the same file the second time it opens it using a different 
 name like test.xls-2 or something like that.
 
 But besides this when I upload a file (using a form) and then try to 
 open it then it is opened it opens as read only on the first place.
 
 Is it possible that is this caused by apache or can I  reconfigure 
 php.ini to change this behavior?
 
 I suspect that the  headers  are being  sent  are somehow  different .
 
If you are trying to open a file that has a URL instead of a local path,
then it will always be opened as read-only, and there is no way to
change this. If you are opening it using a local path (samba, nfs, fish,
etc) then I would check to see the file permissions. As the file is
being written by Apache from a form upload, the file will have Apache
permissions. Either exec out to a shell script and change the owner
(chown) of the file, or have Apache modify the persions with the
built-in PHP command chmod.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] spreadsheets are opened read only

2008-09-24 Thread Thodoris



If you are trying to open a file that has a URL instead of a local path,
then it will always be opened as read-only, and there is no way to
change this. If you are opening it using a local path (samba, nfs, fish,
etc) then I would check to see the file permissions. As the file is
being written by Apache from a form upload, the file will have Apache
permissions. Either exec out to a shell script and change the owner
(chown) of the file, or have Apache modify the persions with the
built-in PHP command chmod.


Ash
www.ashleysheridan.co.uk


  


Well what is bothering me is that the rights are identical to all dirs 
from the document root to all containing folders and I doubled checked 
that. Plus the rights are also the same.


grr!!

I think I may reconsider to change my career and start training 
elephants in a zoo or something.


--
Thodoris



RE: [PHP] Re: class const versus define

2008-09-24 Thread Richard Lynch
 Richard Lynch schrieb:
  Is there any reason why the logic behind define() couldn't be pushed
 down to class const?
 
  Code like this is kinda fugly:
 
  //It's okay here, but not in a class?
  define('CACHE_DIR_LONG',  CONFIG_ROOT_PATH . '/cache/');
  class Cache {
const CACHE_DIR = '/dev/shm/cache/';
const CACHE_TTL = 300; //5 minutes
const CACHE_DIR_LONG = CACHE_DIR_LONG;
 
  I'd really prefer to write:
  class Cache {
const CACHE_DIR = '/dev/shm/cache/';
const CACHE_TTL = 300; //5 minutes
const CACHE_DIR_LONG = CONFIG_ROOT_PATH . '/cache/';
 
  I'm happy to add it as a feature request, but not if somebody
 reliable says Don't Bother...


 Hi Richard,
 the define function is to be used on the global scope of your
 application. This is helpful to assign Configurations Options and other
 data that you do not will move. For the Class Constants you define the
 Constant only fo the Class where you are working.
 Please read the documentation about this on PHP.NET
 http://de.php.net/manual/en/language.oop5.constants.php

I understand the difference quite well, thank you.

I need the PATH to differ in development, staging, and production due to mixed 
environments.

Unfortunately, I CANNOT construct a class const on the fly from global 
define'd constants and constant strings.

Yet, the logic that makes it possible to do that for define itself in some kind 
of pre-processor should not be terribly difficult to push down to the class 
level, I would think.

So, in fact, I'd LIKE to use the class const properly for what it is mean for, 
but cannot do that because its value depends upon the environment.

PS
Apologies for the legal disclaimer over which I have no control; not even the 
silly punct-
uation it ended up with in plain-text email.
Sigh.


___

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214

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



RE: [PHP] Re: Browser could not get mp3 files from http site

2008-09-24 Thread Richard Lynch
 On Wed, Sep 24, 2008 at 9:56 AM, Richard Lynch [EMAIL PROTECTED]
 wrote:
  As a general rule, check what happens when you do wget -S on the URL
 and see what the browser sees.

 Thanks Richard and all responses. That was the best PHP and HTML debug
 I've learned so far. I always find it is difficult to debug html and
 JS when doing PHP program. I can debug C/C++ using gdb well but no
 idea what the tools can be used for browser debug.

 Anyway, the problem has been resolved. It turns out it was an
 authorisation issue. My web server requests a log in at beggin,
 although I can see every pages and download other data and image
 files, somehow it cannot download the mp3 file. As soon as I remove
 the login, it works fine.

If you are used to gdb, you will want to check out:
XDebug

If you are on Windows, there is also a web-based kcachegrind-like tool for code 
analysis, though it is in its infancy:
http://code.google.com/p/webgrind/
Written in PHP, natch. :-)

For webgrind, xdebug-helper is invaluable:
https://addons.mozilla.org/en-US/firefox/addon/3960
Alas, it doesn't seem to work for me with latest FF 3.0.1 :-(


___

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214

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



RE: [PHP] How to detect the host (window or Linux)?

2008-09-24 Thread Richard Lynch
 Thanks Thodoris and Anderson. Sorry for not clear about the question.
 I mean to detect the OS in Host system where the browser is located,
 not the SERVER OS.

It's really none of your business what OS I'm running :-v

You may be able to make an educated guess from the HTTP headers in $_SERVER.

var_dump($_SERVER);
and see what you get.

But you can't RELY on them, as some users will intentionally mask/alter that.

If your website depends on the visitor's OS for anything other than trivial 
behaviour, you're in real trouble.


___

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214

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



RE: [PHP] spreadsheets are opened read only

2008-09-24 Thread Richard Lynch
 Hi guys. I am having a problem with opening xls files from a link
 generated from php script. Let me analyze this:

 I have two linux servers with apache (php,mysql etc) that are running
 the same project. There is a part in this project that reads all the
 files from a directory and generates the appropriate links to them.
 These files are usually spreadsheets (xls) and when I open a file using
 the link on the first machine it opens normally but when I open the
 file
 from the second it is opened read only.

 I have checked the rights and the ownership and they are the exact same
 from the servers document root to the file itself.

 Any ideas why is this happening?

If Excel thinks they are the SAME document, and it's already open, then you can 
only open it read-only.


___

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214

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



Re: [PHP] spreadsheets are opened read only

2008-09-24 Thread Jim Lucas
Thodoris wrote:
 
 Hi guys. I am having a problem with opening xls files from a link
 generated from php script. Let me analyze this:
 
 I have two linux servers with apache (php,mysql etc) that are running
 the same project. There is a part in this project that reads all the
 files from a directory and generates the appropriate links to them.
 These files are usually spreadsheets (xls) and when I open a file using
 the link on the first machine it opens normally but when I open the file
 from the second it is opened read only.
 
 I have checked the rights and the ownership and they are the exact same
 from the servers document root to the file itself.
 
 Any ideas why is this happening?
 

Thodoris,

I would think the simple answer to this is, is that you had the document open
when you uploaded it.

Try uploading it again, this time without any application viewing it.  This
should clear the owned by flag set when the document is open.

Their is no setting with Apache/PHP/Mysql/etc..-server side,  that could cause
this problem!

It is specific to the file that is uploaded.

Try to copy (cmd line using scp or something) from the first (working) machine
to the second (not working) machine and try to view it then.

I think it is a simple mistake of uploading the file when you had it open.

-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


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



Re: [PHP] spreadsheets are opened read only

2008-09-24 Thread Thodoris

O/H Jim Lucas έγραψε:

Thodoris wrote:
  

Hi guys. I am having a problem with opening xls files from a link
generated from php script. Let me analyze this:

I have two linux servers with apache (php,mysql etc) that are running
the same project. There is a part in this project that reads all the
files from a directory and generates the appropriate links to them.
These files are usually spreadsheets (xls) and when I open a file using
the link on the first machine it opens normally but when I open the file
from the second it is opened read only.

I have checked the rights and the ownership and they are the exact same
from the servers document root to the file itself.

Any ideas why is this happening?




Thodoris,

I would think the simple answer to this is, is that you had the document open
when you uploaded it.

Try uploading it again, this time without any application viewing it.  This
should clear the owned by flag set when the document is open.

Their is no setting with Apache/PHP/Mysql/etc..-server side,  that could cause
this problem!

It is specific to the file that is uploaded.

Try to copy (cmd line using scp or something) from the first (working) machine
to the second (not working) machine and try to view it then.

I think it is a simple mistake of uploading the file when you had it open.

  
Yes this the case thanks Jim. Well when you upload the file if it is 
already opened then the browser uploads as read-only.


When you try to open it using linux it opens normally but when you open 
it using windows then it detects the read-only attribute that

that was set before and it keeps it as read-only.

Windowz have their own way of things.

Thanks guys and sorry for the lame question I haven't though that it 
would be so obvious.


Thodoris


Re: [PHP] Re: Using Static Class Variables to Access Globally

2008-09-24 Thread Nathan Nobbe
On Wed, Sep 24, 2008 at 6:28 AM, Richard Heyes [EMAIL PROTECTED] wrote:

  /me prefers singleton with __get and __set but each to their own :)

 Do you mean registry?


could be, but it doesnt have to.  when i think of a registry, i think of
something that stores a single instance of several classes in a structure
like an array, and then when asked by clients for an instance of a certain
class, it either gives them a handle to the object it has internally or
creates it first (if not yet created) then returns the handle.  earlier in
this thread we were talking about using the singleton as a way to have
'custom superglobals' essentially, which imo, is different than a registry.

-nathan


Re: [PHP] Re: class const versus define

2008-09-24 Thread Nathan Nobbe
On Wed, Sep 24, 2008 at 7:35 AM, Richard Lynch [EMAIL PROTECTED] wrote:

 I need the PATH to differ in development, staging, and production due to
 mixed environments.


factory *cough*


 Unfortunately, I CANNOT construct a class const on the fly from global
 define'd constants and constant strings.


no, but you could select a class on the fly from globally defined constants.

So, in fact, I'd LIKE to use the class const properly for what it is mean
 for, but cannot do that because its value depends upon the environment.


i tend to agree w/ Jocheem here, if the value is something that will vary,
perhaps it is best implemented as an instance variable rather than a
constant.  a factory method which took $path, or $env (something like that)
could easily select an appropriate concrete class to instantiate.

-nathan


[PHP] Re: br was [PHP] Re: render html

2008-09-24 Thread Michelle Konzack
Am 2008-09-21 14:27:11, schrieb Ashley Sheridan:
 You will only get the errors you describe if you've messed up the
 document type declaration. I always use this one for my sites:
 
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 
 and it never gives shorttag warnings or errors.

Mee too...  :-)

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
+49/177/935194750, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


RE: [PHP] Re: class const versus define

2008-09-24 Thread Richard Lynch
I’m kind of stuck with a pre-existing code-base that cannot be substantially 
changed at this time...

I guess I can just make it a class variable, even if it never “varies” in the 
script, which to me screams “const”
[shrug]

From: Nathan Nobbe [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 24, 2008 11:14 AM
To: Richard Lynch
Cc: [EMAIL PROTECTED]; php-general@lists.php.net
Subject: Re: [PHP] Re: class const versus define

On Wed, Sep 24, 2008 at 7:35 AM, Richard Lynch [EMAIL PROTECTED]mailto:[EMAIL 
PROTECTED] wrote:
I need the PATH to differ in development, staging, and production due to mixed 
environments.

factory *cough*

Unfortunately, I CANNOT construct a class const on the fly from global 
define'd constants and constant strings.

no, but you could select a class on the fly from globally defined constants.
So, in fact, I'd LIKE to use the class const properly for what it is mean for, 
but cannot do that because its value depends upon the environment.

i tend to agree w/ Jocheem here, if the value is something that will vary, 
perhaps it is best implemented as an instance variable rather than a constant.  
a factory method which took $path, or $env (something like that) could easily 
select an appropriate concrete class to instantiate.

-nathan

___

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214


[PHP] calling functions from one or multiple files

2008-09-24 Thread Lamp Lists
Hi,
Right now I use one file, usually called functions.php, with all functions I'm 
going to use most likely on every page.
Then, I create each function I'm going to use once in a while as separate file.
Pro: I would include a function when I'm going to use.
Con: I have to write extra include line to call function. And have bunch of 
files (functions) in function folder.

I was talking to co-workers few days ago and they said I complicate my
life to much and putting ALL functions in one file is just fine and
I'll not be able to see difference in real situations.

True?

-ll



  

Re: [PHP] Re: class const versus define

2008-09-24 Thread Jochem Maas

Richard Lynch schreef:

Richard Lynch schrieb:

Is there any reason why the logic behind define() couldn't be pushed

down to class const?

Code like this is kinda fugly:

//It's okay here, but not in a class?
define('CACHE_DIR_LONG',  CONFIG_ROOT_PATH . '/cache/');
class Cache {
  const CACHE_DIR = '/dev/shm/cache/';
  const CACHE_TTL = 300; //5 minutes
  const CACHE_DIR_LONG = CACHE_DIR_LONG;

I'd really prefer to write:
class Cache {
  const CACHE_DIR = '/dev/shm/cache/';
  const CACHE_TTL = 300; //5 minutes
  const CACHE_DIR_LONG = CONFIG_ROOT_PATH . '/cache/';

I'm happy to add it as a feature request, but not if somebody

reliable says Don't Bother...




Hi Richard,
the define function is to be used on the global scope of your
application. This is helpful to assign Configurations Options and other
data that you do not will move. For the Class Constants you define the
Constant only fo the Class where you are working.
Please read the documentation about this on PHP.NET
http://de.php.net/manual/en/language.oop5.constants.php


I understand the difference quite well, thank you.


lol



I need the PATH to differ in development, staging, and production due to mixed 
environments.

Unfortunately, I CANNOT construct a class const on the fly from global 
define'd constants and constant strings.

Yet, the logic that makes it possible to do that for define itself in some kind 
of pre-processor should not be terribly difficult to push down to the class 
level, I would think.


did you read my reply? define() ia  runtime function, const is a compile time 
declaration. one is fast the other is slow.


So, in fact, I'd LIKE to use the class const properly for what it is mean for, 
but cannot do that because its value depends upon the environment.


great, then I suggest once more environment specific values don't belong in 
class constants.


do you have full control over the servers in question? if so then one trick you 
might like to try is this:

drop an app.ini into the /etc/php.d/ dir (I assume php is built to read 
additional ini files, if not
add it to your php.ini) with something like the following:

myapp_cache_dir   = /foo/bar/qux
myapp_another_dir = /foo/bar/another

then in your app you can retrieve and set the data like so

Cache::init(get_cfg_var('myapp_cache_dir'));

where Cache::init() does something like:

Cache {
$private $cacheDir = '/my/default/cache/dir';
function init($dir) {
if ($dir) self::$cacheDir = $dir;
}
}

this works fairly fast (I tested various workable methods of defining/using 
installation
specific app settings some time ago ... this came out on top), the ini file is 
only
parsed once (i.e. when apache/fastcgi starts up) and get_cfg_var() is rapido 
because it
only looks at ini values as they we're defined originally (as opposed to 
ini_get() which
needs to check whatever the current value might have been changed to, etc)

as you say, ymmv, and there are always other ways to skin the cat.


PS
Apologies for the legal disclaimer over which I have no control; not even the 
silly punct-
uation it ended up with in plain-text email.
Sigh.


lol, figured as much ... didn't seem very lynch-like



___

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214




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



Re: [PHP] Re: Using Static Class Variables to Access Globally

2008-09-24 Thread Nathan Rixham

Nathan Nobbe wrote:

On Wed, Sep 24, 2008 at 6:28 AM, Richard Heyes [EMAIL PROTECTED] wrote:


/me prefers singleton with __get and __set but each to their own :)

Do you mean registry?



could be, but it doesnt have to.  when i think of a registry, i think of
something that stores a single instance of several classes in a structure
like an array, and then when asked by clients for an instance of a certain
class, it either gives them a handle to the object it has internally or
creates it first (if not yet created) then returns the handle.  earlier in
this thread we were talking about using the singleton as a way to have
'custom superglobals' essentially, which imo, is different than a registry.

-nathan




Here's one of mine.. works sweet and gives access to all global level 
variables anywhere (with read only option)..


?php
/**
 * LEVEL ZERO [lz] GLOBAL replacement object with read only option
 *
 * @author Nathan Rixham
 * @version 2
 */

class lz  {

  private static $lz = array();
  private static $stored = FALSE;
  private static $readonly = TRUE;
  public $variables;

  private static function savelz($lz) {
if( !self::$stored ) {
  self::$lz = $lz;
  self::$stored = TRUE;
}
  }

  private static function getlz() {
return self::$lz;
  }

  public function __construct( $variables = FALSE , $readonly=FALSE ) {
if( $variables !== FALSE  !self::$stored ) {
  self::$readonly = $readonly;
  self::savelz($this);
  $this-variables = $variables['GLOBALS'];
  unset( $this-variables['GLOBALS'] );
} elseif( self::$stored ) {
  $this-variables = lz::getlz()-variables;
  unset( $this-variables['lz'] );
}
  }

  public function __get( $name )
  {
if(isset(self::$lz-variables[$name])) {
  return self::$lz-variables[$name];
}
  }

  public function __set( $name , $value ) {
if( !self::$readonly ) {
  $this-variables[$name] = $value;
}
  }

}

# WRITE ACCESS VERSION
$lz = new lz( get_defined_vars() );

# READ ONLY VERSION
# $lz = new lz( get_defined_vars() , TRUE );


# EXAMPLE
$egg = 'shell';

function examplelz() {
  $lz = new lz;
  echo PHP_EOL . __FUNCTION__ . ' - BEFORE SET : ' . $lz-egg . PHP_EOL;
  $lz-egg = 'new value';
  echo PHP_EOL . __FUNCTION__ . ' - AFTER SET : ' . $lz-egg . PHP_EOL;
}

echo PHP_EOL . 'BEFORE FUNCTION : ' . $egg . PHP_EOL;

examplelz();

echo PHP_EOL . 'AFTER FUNCTION : ' . $egg . PHP_EOL;

?

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



Re: [PHP] calling functions from one or multiple files

2008-09-24 Thread b

Lamp Lists wrote:

Hi,
Right now I use one file, usually called functions.php, with all functions I'm 
going to use most likely on every page.
Then, I create each function I'm going to use once in a while as separate file.
Pro: I would include a function when I'm going to use.
Con: I have to write extra include line to call function. And have bunch of 
files (functions) in function folder.

I was talking to co-workers few days ago and they said I complicate my
life to much and putting ALL functions in one file is just fine and
I'll not be able to see difference in real situations.



When not using a framework (eg. Cake) i also usually keep a single file 
and include it. I think it depends on how many functions you have. If 
you've got a really huge functions.php and most of them are used only in 
one or two scripts, then you probably shouldn't be loading it into every 
script. Otherwise, i wouldn't be too concerned about it.


Of course, you should also think about using classes if that makes sense 
for what you're doing.


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



Re: [PHP] calling functions from one or multiple files

2008-09-24 Thread Ashley Sheridan
On Wed, 2008-09-24 at 12:37 -0400, b wrote:
 Lamp Lists wrote:
  Hi,
  Right now I use one file, usually called functions.php, with all functions 
  I'm going to use most likely on every page.
  Then, I create each function I'm going to use once in a while as separate 
  file.
  Pro: I would include a function when I'm going to use.
  Con: I have to write extra include line to call function. And have bunch of 
  files (functions) in function folder.
  
  I was talking to co-workers few days ago and they said I complicate my
  life to much and putting ALL functions in one file is just fine and
  I'll not be able to see difference in real situations.
  
 
 When not using a framework (eg. Cake) i also usually keep a single file 
 and include it. I think it depends on how many functions you have. If 
 you've got a really huge functions.php and most of them are used only in 
 one or two scripts, then you probably shouldn't be loading it into every 
 script. Otherwise, i wouldn't be too concerned about it.
 
 Of course, you should also think about using classes if that makes sense 
 for what you're doing.
 
I tend to try and group functions I use on a site, with common ones
going into a generic functions.php file. This avoid the problems of
overly large function files included on every page, as chances are you
won't need every function.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] calling functions from one or multiple files

2008-09-24 Thread b

Ashley Sheridan wrote:

On Wed, 2008-09-24 at 12:37 -0400, b wrote:

Lamp Lists wrote:

Hi, Right now I use one file, usually called functions.php, with
all functions I'm going to use most likely on every page. Then, I
create each function I'm going to use once in a while as separate
file. Pro: I would include a function when I'm going to use. Con:
I have to write extra include line to call function. And have
bunch of files (functions) in function folder.

I was talking to co-workers few days ago and they said I
complicate my life to much and putting ALL functions in one file
is just fine and I'll not be able to see difference in real
situations.


When not using a framework (eg. Cake) i also usually keep a single
file and include it. I think it depends on how many functions you
have. If you've got a really huge functions.php and most of them
are used only in one or two scripts, then you probably shouldn't be
loading it into every script. Otherwise, i wouldn't be too
concerned about it.

Of course, you should also think about using classes if that makes
sense for what you're doing.

I tend to try and group functions I use on a site, with common ones 
going into a generic functions.php file. This avoid the problems of 
overly large function files included on every page, as chances are

you won't need every function.



Done that, but not so much anymore. It depends on how specialised the 
functions (and sections) are. Usually an administration section can do 
with a separate file (while also including the general one). But, for 
other areas, it'll work fine until you find that you need a function 
that's in another file.


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



Re: [PHP] calling functions from one or multiple files

2008-09-24 Thread Eric Butera
On Wed, Sep 24, 2008 at 12:28 PM, Lamp Lists [EMAIL PROTECTED] wrote:
 Hi,
 Right now I use one file, usually called functions.php, with all functions 
 I'm going to use most likely on every page.
 Then, I create each function I'm going to use once in a while as separate 
 file.
 Pro: I would include a function when I'm going to use.
 Con: I have to write extra include line to call function. And have bunch of 
 files (functions) in function folder.

 I was talking to co-workers few days ago and they said I complicate my
 life to much and putting ALL functions in one file is just fine and
 I'll not be able to see difference in real situations.

 True?

 -ll





I work with functions much the same way that I work with classes.
When I'm forced to work on procedural code I always prefix the
namespace onto it.  Let's take a very generic shopping cart example.
There's going to be products and a cart.

Here are the files/prototypes:

/code/storeappname/item.php
function storeappname_item_load(int $id);
function storeappname_item_save(array $item);
function storeappname_item_delete(int $id);

/code/storeappname/cart.php
function storeappname_cart_add_item(array $item);
function storeappname_cart_remove_item(int $id);
function storeappname_cart_calculate_totals();

I'd set /code into the include path.  Depending on what page you're on
you just include the function files that you know you're going to use
like require_once 'storeappname/cart.php', etc.  Too bad there's not
an autoload for functions.

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



Re: [PHP] calling functions from one or multiple files

2008-09-24 Thread Thodoris



On Wed, 2008-09-24 at 12:37 -0400, b wrote:
  

Lamp Lists wrote:


Hi,
Right now I use one file, usually called functions.php, with all functions I'm 
going to use most likely on every page.
Then, I create each function I'm going to use once in a while as separate file.
Pro: I would include a function when I'm going to use.
Con: I have to write extra include line to call function. And have bunch of 
files (functions) in function folder.

I was talking to co-workers few days ago and they said I complicate my
life to much and putting ALL functions in one file is just fine and
I'll not be able to see difference in real situations.

  
When not using a framework (eg. Cake) i also usually keep a single file 
and include it. I think it depends on how many functions you have. If 
you've got a really huge functions.php and most of them are used only in 
one or two scripts, then you probably shouldn't be loading it into every 
script. Otherwise, i wouldn't be too concerned about it.


Of course, you should also think about using classes if that makes sense 
for what you're doing.




I tend to try and group functions I use on a site, with common ones
going into a generic functions.php file. This avoid the problems of
overly large function files included on every page, as chances are you
won't need every function.


Ash
www.ashleysheridan.co.uk


  
I was using the same method until now but functions.php grew so much 
that made my life difficult. The solution was to break down this file 
into smaller files that each included a category like:

web.php
db.php
math.php
client.php
user.php
session.php
etc.

This made my life easier since I can edit and maintain the separate 
files more efficiently and I didn't have to include the whole API every 
time but only the files I really need. A good thing was to put these 
files into a separate dir which I named include.


Same thing applies to classes I guess which is probably the next step.


Thodoris


Re: [PHP] spreadsheets are opened read only

2008-09-24 Thread James
On Wed, September 24, 2008 7:28 am, Thodoris wrote:


 Hi guys. I am having a problem with opening xls files from a link
 generated from php script. Let me analyze this:

 I have two linux servers with apache (php,mysql etc) that are running
 the same project. There is a part in this project that reads all the files
 from a directory and generates the appropriate links to them. These files
 are usually spreadsheets (xls) and when I open a file using the link on
 the first machine it opens normally but when I open the file from the
 second it is opened read only.

 I have checked the rights and the ownership and they are the exact same
 from the servers document root to the file itself.

 Any ideas why is this happening?

Check the generated links.


 --
 Thodoris



 --
 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] calling functions from one or multiple files

2008-09-24 Thread Ashley Sheridan
On Wed, 2008-09-24 at 20:32 +0300, Thodoris wrote:
 
  On Wed, 2008-09-24 at 12:37 -0400, b wrote:

   Lamp Lists wrote:
   
Hi,
Right now I use one file, usually called functions.php, with all 
functions I'm going to use most likely on every page.
Then, I create each function I'm going to use once in a while as 
separate file.
Pro: I would include a function when I'm going to use.
Con: I have to write extra include line to call function. And have 
bunch of files (functions) in function folder.

I was talking to co-workers few days ago and they said I complicate my
life to much and putting ALL functions in one file is just fine and
I'll not be able to see difference in real situations.

  
   When not using a framework (eg. Cake) i also usually keep a single file 
   and include it. I think it depends on how many functions you have. If 
   you've got a really huge functions.php and most of them are used only in 
   one or two scripts, then you probably shouldn't be loading it into every 
   script. Otherwise, i wouldn't be too concerned about it.
   
   Of course, you should also think about using classes if that makes sense 
   for what you're doing.
   
   
  I tend to try and group functions I use on a site, with common ones
  going into a generic functions.php file. This avoid the problems of
  overly large function files included on every page, as chances are you
  won't need every function.
  
  
  Ash
  www.ashleysheridan.co.uk
  
  

 I was using the same method until now but functions.php grew so much
 that made my life difficult. The solution was to break down this file
 into smaller files that each included a category like:
 web.php
 db.php
 math.php
 client.php
 user.php
 session.php
 etc.
 
 This made my life easier since I can edit and maintain the separate
 files more efficiently and I didn't have to include the whole API
 every time but only the files I really need. A good thing was to put
 these files into a separate dir which I named include.
 
 Same thing applies to classes I guess which is probably the next step.
 
 
 Thodoris
Ah maybe I wasn't clear but that's what I meant by grouping the
functions. Generic ones that are used on all pages go into functions.php
and others go into other function includes. So I might have one that
deals with my blog, other for images, etc, depending on the project in
question.


Ash
www.ashleysheridan.co.uk


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



[PHP] Don't understand what is this $arr['N']['#']

2008-09-24 Thread It flance
Hi,

I am working on the code of a former employee and I don't understand what this  
$arr['N']['#'] refers to.

I know it is a multidimensional associative array but the # i don't what this 
means.

Thank you


  


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



Re: [PHP] Don't understand what is this $arr['N']['#']

2008-09-24 Thread Thiago H. Pojda
Hello,

On Wed, Sep 24, 2008 at 2:51 PM, It flance [EMAIL PROTECTED] wrote:

 Hi,

 I am working on the code of a former employee and I don't understand what
 this  $arr['N']['#'] refers to.


I'm not sure you can do that (can't test atm), but looks like a valid
position as it's in ' '. I wonder if that wouldn't comment the rest of the
line...


 I know it is a multidimensional associative array but the # i don't what
 this means.

 Thank you


Thank you for bringing this up, it's a good question (at least I think so)

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



-- 
Thiago Henrique Pojda
http://nerdnaweb.blogspot.com


Re: [PHP] Don't understand what is this $arr['N']['#']

2008-09-24 Thread Ashley Sheridan
On Wed, 2008-09-24 at 10:51 -0700, It flance wrote:
 Hi,
 
 I am working on the code of a former employee and I don't understand what 
 this  $arr['N']['#'] refers to.
 
 I know it is a multidimensional associative array but the # i don't what this 
 means.
 
 Thank you
 
 
   
 
 
Well, because N and the hash (#) are both inside single quotes, they are
literal strings rather than variables.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Don't understand what is this $arr['N']['#']

2008-09-24 Thread Jochem Maas

It flance schreef:

Hi,

I am working on the code of a former employee and I don't understand what this  
$arr['N']['#'] refers to.

I know it is a multidimensional associative array but the # i don't what this 
means.


it's a string ... used as the (associative) key to an array. the item you 
mention probably contains
an id or number (because '#' is sometimes used to mean that), try this:

var_dump($arr['N']['#']);

'#' is just a string, it could be anything: 'A', 'B', 'my_array_key', 'even a 
complete sentence',
these are all valid associative array keys.



Thank you


  






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



Re: [PHP] Don't understand what is this $arr['N']['#']

2008-09-24 Thread Richard Heyes
 I am working on the code of a former employee and I don't understand what 
 this  $arr['N']['#'] refers to.

They're just obscure array index names.

 I know it is a multidimensional associative array but the # i don't what this 
 means.

Nothing special.

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.phpguru.org/RGraph

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



[PHP] How to show ppt file on webpage/flash

2008-09-24 Thread Tiji varghese
Hi all,
I want to show '.ppt' (Power Point) files on my web page either as a flash or 
embedded into web page or by doing some processing at the server side.
The actual scenario being that a user would just upload their 'ppt' files 
online and on the next page I will be showing them the contents of the ppt file 
as a slide show, also making sure that user's formatting is well preserved.I 
don't mind what format it would be in as far as I'm able to show it on IE at 
least.
I searched on the internet about it and read some stuff but none of them were 
useful enough. Please Help.
 
Thanks,
Tiji


  Download prohibited? No problem. CHAT from any browser, without download. 
Go to http://in.webmessenger.yahoo.com/

RE: [PHP] calling functions from one or multiple files

2008-09-24 Thread Richard Lynch
 -Original Message-
 Right now I use one file, usually called functions.php, with all
 functions I'm going to use most likely on every page.
 Then, I create each function I'm going to use once in a while as
 separate file.
 Pro: I would include a function when I'm going to use.
 Con: I have to write extra include line to call function. And have
 bunch of files (functions) in function folder.

 I was talking to co-workers few days ago and they said I complicate my
 life to much and putting ALL functions in one file is just fine and
 I'll not be able to see difference in real situations.

You'd have to have a LOT of functions either way to make a difference...

Actually, it's probably more expensive to open up the individual function files 
than to toss ~30 more functions into a single file.

You'll have to profile 'require' on your own hardware to turn ~30 into a real 
number...


___

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214

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



RE: [PHP] Don't understand what is this $arr['N']['#']

2008-09-24 Thread Richard Lynch
 -Original Message-
 I am working on the code of a former employee and I don't understand
 what this  $arr['N']['#'] refers to.

 I know it is a multidimensional associative array but the # i don't
 what this means.

'#' is just a string value.

It has no special meaning whatsoever.


___

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214

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



[PHP] Re: Just testing IGNORE!!!

2008-09-24 Thread Shawn McKenzie

uaca man wrote:




Did IGNORE!!!  pass or fail the testing?

-Shawn

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



Re: [PHP] Don't understand what is this $arr['N']['#']

2008-09-24 Thread Nathan Nobbe
On Wed, Sep 24, 2008 at 1:00 PM, Richard Lynch [EMAIL PROTECTED] wrote:

  -Original Message-
  I am working on the code of a former employee and I don't understand
  what this  $arr['N']['#'] refers to.
 
  I know it is a multidimensional associative array but the # i don't
  what this means.

 '#' is just a string value.

 It has no special meaning whatsoever.


except in the deranged world of the original author :D

-nathan


RE: [PHP] calling functions from one or multiple files

2008-09-24 Thread Robert Cummings
On Wed, 2008-09-24 at 13:58 -0500, Richard Lynch wrote:
  -Original Message-
  Right now I use one file, usually called functions.php, with all
  functions I'm going to use most likely on every page.
  Then, I create each function I'm going to use once in a while as
  separate file.
  Pro: I would include a function when I'm going to use.
  Con: I have to write extra include line to call function. And have
  bunch of files (functions) in function folder.
 
  I was talking to co-workers few days ago and they said I complicate my
  life to much and putting ALL functions in one file is just fine and
  I'll not be able to see difference in real situations.
 
 You'd have to have a LOT of functions either way to make a difference...
 
 Actually, it's probably more expensive to open up the individual function 
 files than to toss ~30 more functions into a single file.
 
 You'll have to profile 'require' on your own hardware to turn ~30 into a real 
 number...

Seems kind of silly to have every function in it's own file. Also seems
kind of cluttered ot have every function in one file.

Now grouping related functions into a single file... that's sounds like
a good middle ground.

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] Don't understand what is this $arr['N']['#']

2008-09-24 Thread It flance
hi,

You're right. Because associative arrays are meant to make code easier to 
understand by using meaningful indexes.

Thank you guys 


--- On Wed, 9/24/08, Nathan Nobbe [EMAIL PROTECTED] wrote:

 From: Nathan Nobbe [EMAIL PROTECTED]
 Subject: Re: [PHP] Don't understand what is this $arr['N']['#']
 To: Richard Lynch [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED] [EMAIL PROTECTED], php-general@lists.php.net 
 php-general@lists.php.net
 Date: Wednesday, September 24, 2008, 7:38 PM
 On Wed, Sep 24, 2008 at 1:00 PM, Richard Lynch
 [EMAIL PROTECTED] wrote:
 
   -Original Message-
   I am working on the code of a former employee and
 I don't understand
   what this  $arr['N']['#'] refers
 to.
  
   I know it is a multidimensional associative array
 but the # i don't
   what this means.
 
  '#' is just a string value.
 
  It has no special meaning whatsoever.
 
 
 except in the deranged world of the original author :D
 
 -nathan


  


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



[PHP] Problem with install lybrary GD

2008-09-24 Thread opc
Hi forum

I try install library GD on Centos 5

I download the gd-2.0.35.tar with the next sentece

./configure --prefix=/usr/local --with=/usr/local --with-jpeg=/usr/local
make
make install

Here all ok.

And next install the php-5.2.6

./configure (... n parameter...) --with-gd=/usr/local/lib
--with-png-dir=/usr/local/bin --with-jpeg-dir=/usr/local/bin
make
make install

And don't get any problem, all ok.

But, execute in code php, the command phpinfo(); and see the next result

Configure Command'./configure' ... '--with-freetype-dir=/usr'
'--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm'
'--with-gettext' '--with-jpeg-dir=/usr' '--with-png' '--without-gd'
..

And test with code in php var_dump(gd_info()); but nothing.

What is wrong. Why don't work

Thanks,

P.D. The content the directory are:

/usr/local/bin

annotate
bdftogd
gd2copypal
gd2togif
gd2topng
gdcmpgif
gdlib-config
gdparttopng
gdtopng
giftogd2
pngtogd
pngtogd2
wcmgr
webalizer
webazolver
webpng


/usr/local/lib

gd.h
libgd.a
libgd.la
libgd.so
libgd.so.2
libgd.so.2.0.0
libpcap.a


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



[PHP] Eclipse - PDT, prevent validation on some files

2008-09-24 Thread Sancar Saran
Hello there, 

sorry to bugging the list and I hope finding the answer quickly.

Today I watch a youtube video which showing eclipse pdt and I want to try. 

It was amazing, it was so advanced after kate and if I handle one thing, I 
would be very happy.

This thing checks every file in the project and validates it.

So ?

Eclipse found some veird errors (they use custom html element attirbuties or 
someting like that) and I can't find the way to fix it. Also it wasn't my 
code.

My Question is

Is there any way to prevent validation some files and directories under 
eclipse.

Thanks 

Sancar

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



Re: [PHP] Eclipse - PDT, prevent validation on some files

2008-09-24 Thread Jochem Maas

Sancar Saran schreef:
Hello there, 


sorry to bugging the list and I hope finding the answer quickly.


then STFW, or something?

Today I watch a youtube video which showing eclipse pdt and I want to try. 

It was amazing, it was so advanced after kate and if I handle one thing, I 
would be very happy.


who the  is kate and what god's earth could eclipse possibly have on her?
(okay maybe she's fat ... but then so is eclipse)


This thing checks every file in the project and validates it.

So ?


exactly.



Eclipse found some veird errors (they use custom html element attirbuties or 
someting like that) and I can't find the way to fix it. Also it wasn't my 
code.


I vind other veople's code wery veird vost of the vime.



My Question is

Is there any way to prevent validation some files and directories under 
eclipse.


1. yes .. it'll practically do the dishes for you if you know which preference 
to edit.
2. frakkin' ignore the validation if it chokes on whatever and you know it
doesn't matter

take it to an eclipse list/forum/site, this aint the place.



Thanks 


Sancar




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



Re: [PHP] Search functionality

2008-09-24 Thread Dan Shirah

   Its pretty straight forward, you create a query that extracts the name
 and id of the records with a relevant where clause created on the fly. When
 outputing the data, each record gets created as a link that then loads
 another page/div with the total dataset for that record. The question for
 you is how you want the interface for the search to work. You can provide a
 dropdown with some choices (date, zip, etc) and a text input / date input
 picker to allow the user to enter the data. This then gets submitted and
 runs the query



Correct, right now each record is displayed on the screen as a link.  When
the link is clicked a query runs to pull all of the related data and
displays it as a subset of items under the main link.

The problem is, since I am not pulling all of the detail when I run the
initial query, what would be the best way to find the search results when
they will most liely be contained in the data I did not initially pull.


Re: [PHP] Eclipse - PDT, prevent validation on some files

2008-09-24 Thread Nathan Rixham

Jochem Maas wrote:

Sancar Saran schreef:

Hello there,
sorry to bugging the list and I hope finding the answer quickly.


then STFW, or something?

Today I watch a youtube video which showing eclipse pdt and I want to 
try.
It was amazing, it was so advanced after kate and if I handle one 
thing, I would be very happy.


who the  is kate and what god's earth could eclipse possibly have on 
her?

(okay maybe she's fat ... but then so is eclipse)


This thing checks every file in the project and validates it.

So ?


exactly.



Eclipse found some veird errors (they use custom html element 
attirbuties or someting like that) and I can't find the way to fix it. 
Also it wasn't my code.


I vind other veople's code wery veird vost of the vime.



My Question is

Is there any way to prevent validation some files and directories 
under eclipse.


1. yes .. it'll practically do the dishes for you if you know which 
preference to edit.

2. frakkin' ignore the validation if it chokes on whatever and you know it
doesn't matter

take it to an eclipse list/forum/site, this aint the place.



Thanks
Sancar





tough day master maas?

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



Re: [PHP] How to show ppt file on webpage/flash

2008-09-24 Thread James
On Wed, September 24, 2008 2:53 pm, Tiji varghese wrote:
 Hi all,
 I want to show '.ppt' (Power Point) files on my web page either as a flash
 or embedded into web page or by doing some processing at the server side.
  The actual scenario being that a user would just upload their 'ppt'
 files online and on the next page I will be showing them the contents of
 the ppt file as a slide show, also making sure that user's formatting is
 well preserved.I don't mind what format it would be in as far as I'm
 able to show it on IE at least. I searched on the internet about it
 and read some stuff but none of them were useful enough. Please Help.  
  Thanks,
 Tiji

I have no clue.
You need a PPT plugin.
Maybe you could convert the PPT to PDF.




 Download prohibited? No problem. CHAT from any browser, without download.
 Go to http://in.webmessenger.yahoo.com/



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



RE: [PHP] Problem with install lybrary GD

2008-09-24 Thread Richard Lynch
Did you change php.ini to load in the php_gd.so file?

Is this in Apache, and did you restart apache, which only reads php.ini on 
startup?

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 24, 2008 3:35 PM
 To: php-general@lists.php.net
 Subject: [PHP] Problem with install lybrary GD

 Hi forum

 I try install library GD on Centos 5

 I download the gd-2.0.35.tar with the next sentece

 ./configure --prefix=/usr/local --with=/usr/local --with-
 jpeg=/usr/local
 make
 make install

 Here all ok.

 And next install the php-5.2.6

 ./configure (... n parameter...) --with-gd=/usr/local/lib
 --with-png-dir=/usr/local/bin --with-jpeg-dir=/usr/local/bin
 make
 make install

 And don't get any problem, all ok.

 But, execute in code php, the command phpinfo(); and see the next
 result

 Configure Command'./configure' ... '--with-freetype-
 dir=/usr'
 '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm'
 '--with-gettext' '--with-jpeg-dir=/usr' '--with-png' '--without-gd'
 ..

 And test with code in php var_dump(gd_info()); but nothing.

 What is wrong. Why don't work

 Thanks,

 P.D. The content the directory are:

 /usr/local/bin

 annotate
 bdftogd
 gd2copypal
 gd2togif
 gd2topng
 gdcmpgif
 gdlib-config
 gdparttopng
 gdtopng
 giftogd2
 pngtogd
 pngtogd2
 wcmgr
 webalizer
 webazolver
 webpng


 /usr/local/lib

 gd.h
 libgd.a
 libgd.la
 libgd.so
 libgd.so.2
 libgd.so.2.0.0
 libpcap.a


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


___

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214


Re: [PHP] Eclipse - PDT, prevent validation on some files

2008-09-24 Thread Jochem Maas

Nathan Rixham schreef:

Jochem Maas wrote:


...



tough day master maas?


like chewing on wasps :-/






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



Re: [PHP] Eclipse - PDT, prevent validation on some files

2008-09-24 Thread Eric Butera
On Wed, Sep 24, 2008 at 4:36 PM, Sancar Saran [EMAIL PROTECTED] wrote:
 Hello there,

 sorry to bugging the list and I hope finding the answer quickly.

 Today I watch a youtube video which showing eclipse pdt and I want to try.

 It was amazing, it was so advanced after kate and if I handle one thing, I
 would be very happy.

 This thing checks every file in the project and validates it.

 So ?

 Eclipse found some veird errors (they use custom html element attirbuties or
 someting like that) and I can't find the way to fix it. Also it wasn't my
 code.

 My Question is

 Is there any way to prevent validation some files and directories under
 eclipse.

 Thanks

 Sancar

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



I turn off validation for all the xml and html.  See, I symlink in the
FCKEditor on a lot of sites.  I never change that source but PDT
thinks it needs to validate it.  So my answer was to turn off
validation for everything except php.  I still get my real-time php
errors and also parse errors in files without all the notices that
makes the info pane useless.

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



Re: [PHP] Google Checkout

2008-09-24 Thread Nathan Rixham

[snip]
switched from Paypal to Google Checkout.
[/snip]

http://www.e-junkie.com/

does both.. google checkout + paypal

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



[PHP] abmeldung

2008-09-24 Thread Sascha Braun ! CEO @ BRAUN Networks
unsubscribe


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



Re: [PHP] abmeldung

2008-09-24 Thread Stut

Look at the bottom of this email...

On 24 Sep 2008, at 16:10, Sascha Braun ! CEO @ BRAUN Networks wrote:


unsubscribe


No, lower...


--
PHP General Mailing List (http://www.php.net/)


Bit further...


To unsubscribe, visit: http://www.php.net/unsub.php


There it is!! For a CEO you're not so much with the smarts!

-Stut

--
http://stut.net/

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



Re: [PHP] abmeldung

2008-09-24 Thread Ashley Sheridan
On Wed, 2008-09-24 at 23:13 +0100, Stut wrote:
 Look at the bottom of this email...
 
 On 24 Sep 2008, at 16:10, Sascha Braun ! CEO @ BRAUN Networks wrote:
 
  unsubscribe
 
 No, lower...
 
  -- 
  PHP General Mailing List (http://www.php.net/)
 
 Bit further...
 
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 There it is!! For a CEO you're not so much with the smarts!
 
 -Stut
 
 -- 
 http://stut.net/
 
Apparently that doesn't work, BUT, on EVERY email there are email
headers, and one of these said headers is the unsubscribe email address.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] How to show ppt file on webpage/flash

2008-09-24 Thread Ashley Sheridan
On Wed, 2008-09-24 at 16:59 -0400, James wrote:
 On Wed, September 24, 2008 2:53 pm, Tiji varghese wrote:
  Hi all,
  I want to show '.ppt' (Power Point) files on my web page either as a flash
  or embedded into web page or by doing some processing at the server side.
   The actual scenario being that a user would just upload their 'ppt'
  files online and on the next page I will be showing them the contents of
  the ppt file as a slide show, also making sure that user's formatting is
  well preserved.I don't mind what format it would be in as far as I'm
  able to show it on IE at least. I searched on the internet about it
  and read some stuff but none of them were useful enough. Please Help.  
   Thanks,
  Tiji
 
 I have no clue.
 You need a PPT plugin.
 Maybe you could convert the PPT to PDF.
 
 
 
 
  Download prohibited? No problem. CHAT from any browser, without download.
  Go to http://in.webmessenger.yahoo.com/
 
 
 
If the user has M$ Office installed they should already then have the
office plugin for IE (and I think there is one for Fx too)


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] abmeldung

2008-09-24 Thread Stut

On 24 Sep 2008, at 23:18, Ashley Sheridan wrote:

On Wed, 2008-09-24 at 23:13 +0100, Stut wrote:

Look at the bottom of this email...

On 24 Sep 2008, at 16:10, Sascha Braun ! CEO @ BRAUN Networks wrote:


unsubscribe


No, lower...

--  
PHP General Mailing List (http://www.php.net/)


Bit further...


To unsubscribe, visit: http://www.php.net/unsub.php


There it is!! For a CEO you're not so much with the smarts!

-Stut

--  
http://stut.net/



Apparently that doesn't work, BUT, on EVERY email there are email
headers, and one of these said headers is the unsubscribe email  
address.


What doesn't work? That page is a list of instructions which  
essentially tell you what the unsubscribe address is, or how to find  
it if you don't know which address you subscribed with.


Rocket science it ain't!

-Stut

--
http://stut.net/

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



Re: [PHP] abmeldung

2008-09-24 Thread Nathan Rixham

Stut wrote:

On 24 Sep 2008, at 23:18, Ashley Sheridan wrote:

On Wed, 2008-09-24 at 23:13 +0100, Stut wrote:

Look at the bottom of this email...

On 24 Sep 2008, at 16:10, Sascha Braun ! CEO @ BRAUN Networks wrote:


unsubscribe


No, lower...


-- PHP General Mailing List (http://www.php.net/)


Bit further...


To unsubscribe, visit: http://www.php.net/unsub.php


There it is!! For a CEO you're not so much with the smarts!

-Stut

-- http://stut.net/


Apparently that doesn't work, BUT, on EVERY email there are email
headers, and one of these said headers is the unsubscribe email address.


What doesn't work? That page is a list of instructions which essentially 
tell you what the unsubscribe address is, or how to find it if you don't 
know which address you subscribed with.


Rocket science it ain't!

-Stut



however.. the unsubscribe feature is kinda common place now-a-days so 
maybe better placed to point this feature out to the php list makers and 
see if it can be incorporated rather than knock Sascha for trying the 
obvious first.


ps: wonder why he's leaving :o

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



Re: [PHP] abmeldung

2008-09-24 Thread Stut

On 25 Sep 2008, at 00:26, Nathan Rixham wrote:

Stut wrote:

On 24 Sep 2008, at 23:18, Ashley Sheridan wrote:

On Wed, 2008-09-24 at 23:13 +0100, Stut wrote:

Look at the bottom of this email...

On 24 Sep 2008, at 16:10, Sascha Braun ! CEO @ BRAUN Networks  
wrote:



unsubscribe


No, lower...


-- PHP General Mailing List (http://www.php.net/)


Bit further...


To unsubscribe, visit: http://www.php.net/unsub.php


There it is!! For a CEO you're not so much with the smarts!

-Stut

-- http://stut.net/


Apparently that doesn't work, BUT, on EVERY email there are email
headers, and one of these said headers is the unsubscribe email  
address.
What doesn't work? That page is a list of instructions which  
essentially tell you what the unsubscribe address is, or how to  
find it if you don't know which address you subscribed with.

Rocket science it ain't!
-Stut


however.. the unsubscribe feature is kinda common place now-a-days  
so maybe better placed to point this feature out to the php list  
makers and see if it can be incorporated rather than knock Sascha  
for trying the obvious first.


There are very few list servers around that will accept commands on  
the list email address. Every single one I can think of has a separate  
address for commands, and most have a separate address dedicated to  
unsubscribing.



ps: wonder why he's leaving :o


Couldn't care less, his loss.

-Stut

--
http://stut.net/


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



Re: [PHP] The Data Literacy Test

2008-09-24 Thread Philip Thompson

On Sep 24, 2008, at 7:29 AM, Maciek Sokolewicz wrote:


tedd wrote:

At 12:25 PM +0100 9/24/08, Ashley Sheridan wrote:

On Wed, 2008-09-24 at 09:20 +0800, Shelley wrote:


http://phparch.cn/index.php/php/34-php-basics/202-the-data-literacy-test 
The

Data Literacy Test:

http://www.phparch.cn/index.php/php/34-php-basics/202-the-data-literacy-test


What the smeg is this?

I don't know, but I figure 27.
Cheers,
tedd


yes, I think 27 aswell...

- Tul


No no no. We all know the answer is 42.

~Phil


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



Re: [PHP] The Data Literacy Test

2008-09-24 Thread Shelley
2008/9/25 Philip Thompson [EMAIL PROTECTED]

 On Sep 24, 2008, at 7:29 AM, Maciek Sokolewicz wrote:

  tedd wrote:

 At 12:25 PM +0100 9/24/08, Ashley Sheridan wrote:

 On Wed, 2008-09-24 at 09:20 +0800, Shelley wrote:


 
 http://phparch.cn/index.php/php/34-php-basics/202-the-data-literacy-test
 The
 Data Literacy Test:


 http://www.phparch.cn/index.php/php/34-php-basics/202-the-data-literacy-test

  What the smeg is this?

 I don't know, but I figure 27.
 Cheers,
 tedd


 yes, I think 27 aswell...

 - Tul


 No no no. We all know the answer is 42.

 ? How come 42?


-- 
With best regards,
Shelley Shyan
http://phparch.cn


Re: [PHP] How to show ppt file on webpage/flash

2008-09-24 Thread Bastien Koert
On Wed, Sep 24, 2008 at 6:20 PM, Ashley Sheridan
[EMAIL PROTECTED]wrote:

 On Wed, 2008-09-24 at 16:59 -0400, James wrote:
  On Wed, September 24, 2008 2:53 pm, Tiji varghese wrote:
   Hi all,
   I want to show '.ppt' (Power Point) files on my web page either as a
 flash
   or embedded into web page or by doing some processing at the server
 side.
The actual scenario being that a user would just upload their 'ppt'
   files online and on the next page I will be showing them the contents
 of
   the ppt file as a slide show, also making sure that user's formatting
 is
   well preserved.I don't mind what format it would be in as far as I'm
   able to show it on IE at least. I searched on the internet about it
   and read some stuff but none of them were useful enough. Please Help.
 Â
Thanks,
   Tiji
 
  I have no clue.
  You need a PPT plugin.
  Maybe you could convert the PPT to PDF.
 
  
  
  
   Download prohibited? No problem. CHAT from any browser, without
 download.
   Go to http://in.webmessenger.yahoo.com/
 
 
 
 If the user has M$ Office installed they should already then have the
 office plugin for IE (and I think there is one for Fx too)


 Ash
 www.ashleysheridan.co.uk


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


http://www.authorgen.com/authorpoint-lite-free/powerpoint-to-flash-converter.aspxmay
be of interest

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Search functionality

2008-09-24 Thread Bastien Koert
On Wed, Sep 24, 2008 at 4:47 PM, Dan Shirah [EMAIL PROTECTED] wrote:

   Its pretty straight forward, you create a query that extracts the name
 and id of the records with a relevant where clause created on the fly. When
 outputing the data, each record gets created as a link that then loads
 another page/div with the total dataset for that record. The question for
 you is how you want the interface for the search to work. You can provide a
 dropdown with some choices (date, zip, etc) and a text input / date input
 picker to allow the user to enter the data. This then gets submitted and
 runs the query



 Correct, right now each record is displayed on the screen as a link.  When
 the link is clicked a query runs to pull all of the related data and
 displays it as a subset of items under the main link.

 The problem is, since I am not pulling all of the detail when I run the
 initial query, what would be the best way to find the search results when
 they will most liely be contained in the data I did not initially pull.



 Pass the search criteria previously entered thru session or hidden fields
or in the url along with the id to further refine the search


-- 

Bastien

Cat, the other other white meat


Re: [PHP] The Data Literacy Test

2008-09-24 Thread Eric Butera
On Wed, Sep 24, 2008 at 9:22 PM, Shelley [EMAIL PROTECTED] wrote:
 2008/9/25 Philip Thompson [EMAIL PROTECTED]

 On Sep 24, 2008, at 7:29 AM, Maciek Sokolewicz wrote:

  tedd wrote:

 At 12:25 PM +0100 9/24/08, Ashley Sheridan wrote:

 On Wed, 2008-09-24 at 09:20 +0800, Shelley wrote:


 
 http://phparch.cn/index.php/php/34-php-basics/202-the-data-literacy-test
 The
 Data Literacy Test:


 http://www.phparch.cn/index.php/php/34-php-basics/202-the-data-literacy-test

  What the smeg is this?

 I don't know, but I figure 27.
 Cheers,
 tedd


 yes, I think 27 aswell...

 - Tul


 No no no. We all know the answer is 42.

 ? How come 42?


 --
 With best regards,
 Shelley Shyan
 http://phparch.cn


The question can't exist in the same universe as the answer. :(

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



[PHP] Wierd Variable Initialization

2008-09-24 Thread VamVan
So guys,

I found some thing strange that happened to me yesterday. Its small but
kinda freaked me out.

So I have a tokenmap.php that I include include in different configuration
files. Some are classes and some are simple php files.

So in my tokenmap.php I have declared an array as global.

SO $GLOBAL['tokenmap'] = array()

As a good programming practice what I did was:

require_once('tokenmap.php');
$tokenmap = array();
$tokenmap = $GLOBAL['tokenmap'];
print_r($tokenmap);

The above displays empty array

But when I do this , it works

require_once('tokenmap.php');
$tokenmap = $GLOBAL['tokenmap'];
print_r($tokenmap);

Its kind of wierd for me. I am trying to understand. Can some one shed some
light on it for me.

Thanks


Re: [PHP] Wierd Variable Initialization

2008-09-24 Thread 惠新宸
Title: Laruence's Signature




register_global = on ?

VamVan wrote:

  So guys,

I found some thing strange that happened to me yesterday. Its small but
kinda freaked me out.

So I have a tokenmap.php that I include include in different configuration
files. Some are classes and some are simple php files.

So in my tokenmap.php I have declared an array as global.

SO $GLOBAL['tokenmap'] = array()

As a good programming practice what I did was:

require_once('tokenmap.php');
$tokenmap = array();
$tokenmap = $GLOBAL['tokenmap'];
print_r($tokenmap);

The above displays empty array

But when I do this , it works

require_once('tokenmap.php');
$tokenmap = $GLOBAL['tokenmap'];
print_r($tokenmap);

Its kind of wierd for me. I am trying to understand. Can some one shed some
light on it for me.

Thanks

  


-- 





惠
新宸 xinchen.hui |  SYS |  (+8610)82602112-7974 | :laruence






Re: [PHP] Wierd Variable Initialization

2008-09-24 Thread 惠新宸
Title: Laruence's Signature




register_global = on ?

VamVan wrote:

  So guys,

I found some thing strange that happened to me yesterday. Its small but
kinda freaked me out.

So I have a tokenmap.php that I include include in different configuration
files. Some are classes and some are simple php files.

So in my tokenmap.php I have declared an array as global.

SO $GLOBAL['tokenmap'] = array()

As a good programming practice what I did was:

require_once('tokenmap.php');
$tokenmap = array();
$tokenmap = $GLOBAL['tokenmap'];
print_r($tokenmap);

The above displays empty array

But when I do this , it works

require_once('tokenmap.php');
$tokenmap = $GLOBAL['tokenmap'];
print_r($tokenmap);

Its kind of wierd for me. I am trying to understand. Can some one shed some
light on it for me.

Thanks

  


-- 





惠
新宸 xinchen.hui |  SYS |  (+8610)82602112-7974 | :laruence






Re: [PHP] Wierd Variable Initialization

2008-09-24 Thread Chris

VamVan wrote:

So guys,

I found some thing strange that happened to me yesterday. Its small but
kinda freaked me out.

So I have a tokenmap.php that I include include in different configuration
files. Some are classes and some are simple php files.

So in my tokenmap.php I have declared an array as global.

SO $GLOBAL['tokenmap'] = array()


I assume you mean $GLOBALS ..



As a good programming practice what I did was:

require_once('tokenmap.php');
$tokenmap = array();
$tokenmap = $GLOBAL['tokenmap'];
print_r($tokenmap);

The above displays empty array


Why set it to an empty array first? You're just overriding it straight away.

It's pretty silly to do:

?php

$a = 1;
$b = 0;
$b = $a;

?


Add:

error_reporting(E_ALL);
ini_set('display_errors', true);

to the top of your script.

Any errors/notices/warnings?

--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] Wierd Variable Initialization

2008-09-24 Thread Shelley
Yeah, use $GLOBALS[''], or
global $tokenmap;


2008/9/25 Chris [EMAIL PROTECTED]

 VamVan wrote:

 So guys,

 I found some thing strange that happened to me yesterday. Its small but
 kinda freaked me out.

 So I have a tokenmap.php that I include include in different configuration
 files. Some are classes and some are simple php files.

 So in my tokenmap.php I have declared an array as global.

 SO $GLOBAL['tokenmap'] = array()


 I assume you mean $GLOBALS ..


 As a good programming practice what I did was:

 require_once('tokenmap.php');
 $tokenmap = array();
 $tokenmap = $GLOBAL['tokenmap'];
 print_r($tokenmap);

 The above displays empty array


 Why set it to an empty array first? You're just overriding it straight
 away.

 It's pretty silly to do:

 ?php

 $a = 1;
 $b = 0;
 $b = $a;

 ?


 Add:

 error_reporting(E_ALL);
 ini_set('display_errors', true);

 to the top of your script.

 Any errors/notices/warnings?

 --
 Postgresql  php tutorials
 http://www.designmagick.com/


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




-- 
With best regards,
Shelley Shyan
http://phparch.cn