php-general Digest 13 Feb 2008 19:32:56 -0000 Issue 5291

2008-02-13 Thread php-general-digest-help

php-general Digest 13 Feb 2008 19:32:56 - Issue 5291

Topics (messages 269233 through 269256):

Re: memcached (was: session and Multi Server Architecture)
269233 by: mike
269235 by: Per Jessen
269236 by: mike

DOMXML Warning
269234 by: Miguel J. Jiménez
269245 by: Nathan Rixham
269252 by: Daniel Brown
269254 by: Andrew Ballard

Re: Template system in PHP
269237 by: Sancar Saran
269238 by: Arvids Godjuks
269240 by: Richard Heyes
269242 by: Christoph Boget
269244 by: Richard Heyes
269247 by: Christoph Boget
269248 by: Robert Cummings

Copying 1000s files and showing the progress
269239 by: Ritesh Nadhani
269249 by: Nathan Rixham

help me out with form details converted into pdf file save it one place as well 
as send mail attactment
269241 by: pretty
269253 by: Brady Mitchell
269256 by: David Giragosian

Re: urgent !!! Please Help preg_replace !
269243 by: Michelle Konzack

PHP fsockopen with the UNIX abstract namespace
269246 by: .4u

Re: How to read excel sheet and display it's contents.
269250 by: tedd

Re: database design tool
269251 by: Daniel Brown

Re: Curl doesn't handle memory stream
269255 by: Nathan Nobbe

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---
On 2/12/08, Per Jessen [EMAIL PROTECTED] wrote:

 Cache layers are cheap - it's a known science after all.  The key thing
 (AFAICT) about memcached is that is _distributed_.  You need this when
 you don't have session persistency (session being the client-to-server
 relationship).

correct. local file caching, APC, etc... but that doesn't really help,
since you'd be constantly throwing out data (acting as an LRU) and
have one copy of the data on each server is wasteful...

yes the thing that makes memcached the best is the distribution. it
also makes it not a requirement for cache persistency (if there is
such a concept...) not -just- sessions. session persistency to me is a
concept from the 90's...

memcached's distribution in action (20 servers) for example:

20 megs of data x 20 servers = 400 megs of data used total (local cache)
20 megs of data x memcache = 20 megs of data. 40 if you copied it
twice (using pecl memcache) to alleviate cache stampedes.
---End Message---
---BeginMessage---
mike wrote:

 On 2/12/08, Per Jessen [EMAIL PROTECTED] wrote:
 
 Cache layers are cheap - it's a known science after all.  The key
 thing
 (AFAICT) about memcached is that is _distributed_.  You need this
 when you don't have session persistency (session being the
 client-to-server relationship).
 
 correct. local file caching, APC, etc... but that doesn't really help,
 since you'd be constantly throwing out data (acting as an LRU) and
 have one copy of the data on each server is wasteful...

Ah, but each server will only have what it needs for its clients.  So if
you've got say 2000 clients spread over 10 servers, each server will
have the data relevant for its 200 clients.  And there is no need for
network access everytime you reach for a cached object.  (only if you
don't find it in cache).

 yes the thing that makes memcached the best is the distribution. it
 also makes it not a requirement for cache persistency (if there is
 such a concept...) not -just- sessions. session persistency to me is a
 concept from the 90's...

Yeah, you mentioned that before. The computer is a concept from the
early 1940s -  but it's still holding up :-)



/Per Jessen, Zürich
---End Message---
---BeginMessage---
On 2/13/08, Per Jessen [EMAIL PROTECTED] wrote:

 Ah, but each server will only have what it needs for its clients.  So if
 you've got say 2000 clients spread over 10 servers, each server will
 have the data relevant for its 200 clients.  And there is no need for
 network access everytime you reach for a cached object.  (only if you
 don't find it in cache).

eh. seems like the way of the future is distributed, not silo'ed.
computer components will fail (come on, hard drive specs are measured
by how often it fails, how's that for a metric)

in your situation, all the clients from B would migrate to A and C,
and all the data would be re-cached again... i don't know, on paper it
probably consumes more memory. i guess we'll just disagree here, i
like shared nothing style distribution, and something about keeping
servers as islands conflicts with that to me.

from what everyone seems to find is that memcached's additional
network access is pretty much trivial.

 Yeah, you mentioned that before. The computer is a concept from the
 early 1940s -  but it's still holding up :-)

touche!
---End Message---
---BeginMessage---

Re: [PHP] Re: memcached (was: session and Multi Server Architecture)

2008-02-13 Thread Per Jessen
mike wrote:

 On 2/12/08, Per Jessen [EMAIL PROTECTED] wrote:
 
 Cache layers are cheap - it's a known science after all.  The key
 thing
 (AFAICT) about memcached is that is _distributed_.  You need this
 when you don't have session persistency (session being the
 client-to-server relationship).
 
 correct. local file caching, APC, etc... but that doesn't really help,
 since you'd be constantly throwing out data (acting as an LRU) and
 have one copy of the data on each server is wasteful...

Ah, but each server will only have what it needs for its clients.  So if
you've got say 2000 clients spread over 10 servers, each server will
have the data relevant for its 200 clients.  And there is no need for
network access everytime you reach for a cached object.  (only if you
don't find it in cache).

 yes the thing that makes memcached the best is the distribution. it
 also makes it not a requirement for cache persistency (if there is
 such a concept...) not -just- sessions. session persistency to me is a
 concept from the 90's...

Yeah, you mentioned that before. The computer is a concept from the
early 1940s -  but it's still holding up :-)



/Per Jessen, Zürich

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



Re: [PHP] Re: memcached (was: session and Multi Server Architecture)

2008-02-13 Thread mike
On 2/13/08, Per Jessen [EMAIL PROTECTED] wrote:

 Ah, but each server will only have what it needs for its clients.  So if
 you've got say 2000 clients spread over 10 servers, each server will
 have the data relevant for its 200 clients.  And there is no need for
 network access everytime you reach for a cached object.  (only if you
 don't find it in cache).

eh. seems like the way of the future is distributed, not silo'ed.
computer components will fail (come on, hard drive specs are measured
by how often it fails, how's that for a metric)

in your situation, all the clients from B would migrate to A and C,
and all the data would be re-cached again... i don't know, on paper it
probably consumes more memory. i guess we'll just disagree here, i
like shared nothing style distribution, and something about keeping
servers as islands conflicts with that to me.

from what everyone seems to find is that memcached's additional
network access is pretty much trivial.

 Yeah, you mentioned that before. The computer is a concept from the
 early 1940s -  but it's still holding up :-)

touche!

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



Re: [PHP] Template system in PHP

2008-02-13 Thread Sancar Saran
Hello,

I vote for Typo3 template system. If you work bunch of HTML only designers 
this one best.

If you have some php avare designers, you should go with php based + memcached 
template systems.

Second option was much faster anything else.

Just store the template into memcached and do some str_replace.


Regards

Sancar

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



Re: [PHP] Template system in PHP

2008-02-13 Thread Arvids Godjuks
About designers who don't know PHP.

There are two kinds
1). They draw only. They usualy don't know even HTML - they just draw.
2). They know HTML and make templates. usualy these people have to know HTML
and CSS very well. And I can't imagine how they can do that without knowing
at least Smarty tags (if they work with it). My idea is basicly that for
them there is no difference if there if
?=$variable?
or
{$variable}
They just have to know that such constructions displays some data.
So I and my colegaues stick to HTML with PHP injections in templates (i
worked with smarty once's, have to say comparing to PHP it was realy a mess.
And at least with PHP I have code highlight).


[PHP] Copying 1000s files and showing the progress

2008-02-13 Thread Ritesh Nadhani
Hello All

I have a situation where I have to copy something like 1000 files one
by one to a temporary folder. Tar it using the system tar command and
let the user download the tar file.

Now while the copy is going on at server, I want to show some progress
to the user at client side. Most of the tutorial I found on net was
about showing progress while a file is being uploaded from client to
server. In this case the client has the info but for my case, the
client has no info.

A similar was problem was solved at
http://menno.b10m.net/blog/blosxom/perl/cgi-upload-hook.html but its
in PERL and uses some form of hook. I have no clue how to do it in
PHP.

Any clues or right direction would be awesome.

-- 
Ritesh
http://www.riteshn.com

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



Re: [PHP] Template system in PHP

2008-02-13 Thread Richard Heyes

 ...

You won't find many solutions (if any) faster than require(). If all you 
have currently is developers you don't really have reason to use a 
custom templating language to slow things down. Even when you do get 
designers, they should:


1. Not have the final say before systems go live
2. Not be brain dead enough not to understand this:

?if($foo):?
...
?endif?

   Or for simple variable this:

?=$name?

3. If your front-end people can't understand that (and you can of course
   expect training to be necessary or some sort of cheat sheet that can
   be referred to), then they quite honestly aren't worth employing.

(the alternative syntax for PHP conditionals and loops, along with short 
tags)


And there should of course be some sort of test site on the same box as 
your live site allowing you to thoroughly test your new stuff before it 
goes live.


--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and Helpdesk software for £299 hosted for you -
no installation, no maintenance, new features automatic and free

 ** New Helpdesk demo now available **

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



[PHP] help me out with form details converted into pdf file save it one place as well as send mail attactment

2008-02-13 Thread pretty

hi any one help me out, im using cronofirm, i need to field form details will
converted into pdf as well as it will go maill attachment doing this in
joomla, atleast i need this only php with out joomla.


-- 
View this message in context: 
http://www.nabble.com/help-me-out-with-form-details-converted-into-pdf-file-save-it-one-place-as-well-as-send-mail-attactment-tp15456850p15456850.html
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] Template system in PHP

2008-02-13 Thread Christoph Boget
  As an aside, you can save lines when debugging by doing:
  echo 'pre' . print_r( $var, TRUE ) . '/pre';
 OMG, thanks for that.  Lines are so expensive nowadays and all.

Sarcasm aside, when I'm debugging I like to be as concise as possible.

thnx,
Chris

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



[PHP] Re: urgent !!! Please Help preg_replace !!!!!!!!!!!!!!!!!!!!!

2008-02-13 Thread Michelle Konzack
Am 2008-02-10 12:38:45, schrieb Robert Cummings:
 Considering you marked the email as urgent, perhaps you have better
 things to do than try to squeeze your problem into a regex. Feel free to
 post your single regex when you find it... a side note of how much time
 you wasted would be most informative too.

ROTFL...  :-)

Thanks, Greetings and nice Day
Michelle Konzack
Systemadministrator
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] Template system in PHP

2008-02-13 Thread Richard Heyes

 when I'm debugging I like to be as concise as possible.

Concise? Really?

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and Helpdesk software for £299 hosted for you -
no installation, no maintenance, new features automatic and free

 ** New Helpdesk demo now available **

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



[PHP] Re: DOMXML Warning

2008-02-13 Thread Nathan Rixham

Miguel J. Jiménez wrote:

Hi, after enabling error reporting with E_ALL I am having this strange
warning while loading a XML:

Warning: DOMDocument::load() [function.DOMDocument-load]: Extra content
at the end of the document in [...]

The code I use is:

$dom = new DOMDocument();
$dom-load(http://example.com/file.xml;);
[...]

If I open the xml uri (with firefox) I get a complete and well formed
xml (nothing strange about it).

With error reporting disabled everything works fine so I am
puzzled :-( Any help will be appreciated.


---
.-.
| Miguel J. Jiménez   |
| Sector Público, ISOTROL S.A.|
| [EMAIL PROTECTED]   |
:-:
| KeyID 0xFFE63EC6 hkp://pgp.rediris.es:11371 |
:-:
| Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta.|
| Parque Tecnológico Cartuja '93, 41092 Sevilla (ESP).|
| Tlfn: +34 955 036 800 (ext.1805) - Fax: +34 955 036 849 |
| http://www.isotrol.com  |
:-:
| UTM ED-50 X:765205.09 Y:4144614.91 Huso: 29 |
:-:
| Oh no, Number One. I'm sure most will be much more |
| interesting. Let's see what's out there. Engage.   |
|  Capt. Jean-Luc Picard  |
|Star Trek TNG (1x01, Encounter At Farpoint)  |
'-'


check raw the file output by doing:
print_r(file_get_contents(http://example.com/file.xml;));

that should show you exactly what's causing the error.

another possibility is that the site has bot protection on there and is 
redirecting your request to a standard web page.


Alternatively pass the url to the XML file to me and I'll investigate 
for you.


Nathan

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



[PHP] PHP fsockopen with the UNIX abstract namespace

2008-02-13 Thread @4u
Hi,

I have a problem with fsockopen in connection with the UNIX abstract
namespace.

To open a UNIX socket in the abstract namespace I have to add a nul byte
in front of the path.

Unfortunately PHP returns
fsockopen() [function.fsockopen]: unable to connect to unix://:0
(Connection refused)

for unix://\x00/tmp/dbus-whatever which is a bit strange because I
expected at least the error message fsockopen() [function.fsockopen]:
unable to connect to unix://[NUL byte]/tmp/dbus-whatever:0 (Connection
refused)

Is this a known issue or do I have to set something in the php.ini?

I would appreciate any ideas how to debug this issue.

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



Re: [PHP] Template system in PHP

2008-02-13 Thread Robert Cummings

On Wed, 2008-02-13 at 11:26 +, Richard Heyes wrote:
  ...
 
 You won't find many solutions (if any) faster than require().

Mine is faster. Compiling to the requested page removes cache overhead
and file access overhead since the content is already pulled in.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Template system in PHP

2008-02-13 Thread Christoph Boget
   when I'm debugging I like to be as concise as possible.
 Concise? Really?

Fair enough.  Perhaps I should have said concise with my code, verbose
with my actual messages. :p

thnx,
Chris


  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

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



[PHP] Re: Copying 1000s files and showing the progress

2008-02-13 Thread Nathan Rixham

Ritesh Nadhani wrote:

Hello All

I have a situation where I have to copy something like 1000 files one
by one to a temporary folder. Tar it using the system tar command and
let the user download the tar file.

Now while the copy is going on at server, I want to show some progress
to the user at client side. Most of the tutorial I found on net was
about showing progress while a file is being uploaded from client to
server. In this case the client has the info but for my case, the
client has no info.

A similar was problem was solved at
http://menno.b10m.net/blog/blosxom/perl/cgi-upload-hook.html but its
in PERL and uses some form of hook. I have no clue how to do it in
PHP.

Any clues or right direction would be awesome.



Write a bash script on the fly to do the work, execute it using php, 
output the progress of the bash script back to the browser using output 
buffering.. just remember to pad the strings to buffer size and flush() 
so they actually get sent.


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



RE: [PHP] How to read excel sheet and display it's contents.

2008-02-13 Thread tedd

At 3:46 PM -0800 2/11/08, Warren Vail wrote:

I finally settled for CSV, but even there Microsoft plays games with the
format, or so it seems.


Yes, it's a bugger.

M$ always has a better idea and replaces it daily.

Stick with CSV and let applications sort it out.

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] help me out with form details converted into pdf file save it one place as well as send mail attactment

2008-02-13 Thread Brady Mitchell


On Feb 13, 2008, at 426AM, pretty wrote
hi any one help me out, im using cronofirm, i need to field form  
details will
converted into pdf as well as it will go maill attachment doing this  
in

joomla, atleast i need this only php with out joomla.


For sending email:

The standard mail function
http://php.net/mail

I've found that for sending anything more than the simplest email,  
it's usually easier to use something like PHPMailer (http://phpmailer.sf.net 
).


For creating PDF files, here are a few options:

http://fpdf.org
http://www.ros.co.nz/pdf/
http://framework.zend.com/manual/en/zend.pdf.html

Saving the pdf and sending it as an email shouldn't be difficult:

Step 1 - Generate the PDF
Step 2 - Save it somewhere on the server
Step 3 - Email the PDF as an attachment.

I don't fully understand your question, so hopefully this is somewhat  
helpful. If you have specific questions about parts of the process we  
will be able to help you better. Best is if you start writing the code  
and ask questions when you get stuck so we can see what's going on and  
offer ideas.


Best of luck,

Brady

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



Re: [PHP] DOMXML Warning

2008-02-13 Thread Daniel Brown
On Feb 13, 2008 2:51 AM, Miguel J. Jiménez
[EMAIL PROTECTED] wrote:
 Hi, after enabling error reporting with E_ALL I am having this strange
 warning while loading a XML:

 Warning: DOMDocument::load() [function.DOMDocument-load]: Extra content
 at the end of the document in [...]

Is there an extra whitespace or carriage return/newline after the
final closing tag?

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] database design tool

2008-02-13 Thread Daniel Brown
On Feb 12, 2008 7:46 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:
 Can anyone recommend a preferably visual DB design tool? I normally use
 mysql, but one that covered several types wood be cool.  I'm on Linux,
 so the new mysql workbench is a dud.  I used it in an alpha or prior
 version and it looked promising but crashed frequently.  They say a
 Linux version in 2008, but I'm not holding my breath.

For RAD-style database design, check out OpenOffice.org Base.  I
know it comes pre-packaged with Mandriva (which I use), but I'm not
certain about other distros.  Depending on your flavor, you can
probably apt-get, yum, urpmi, or manually install from an RPM or DEB.

It works a lot like Filemaker and Access, so if you're familiar
with those, you should notice a lot of similarities.  Plus, it will
work without a problem with MyODBC, Unix ODBC, JDBC, and native
connections.

For future reference though, Shawn, try sending to the PHP-DB list
when asking questions like that.  Then it's not off-topic.  ;-)

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] DOMXML Warning

2008-02-13 Thread Andrew Ballard
On Feb 13, 2008 1:20 PM, Daniel Brown [EMAIL PROTECTED] wrote:
 On Feb 13, 2008 2:51 AM, Miguel J. Jiménez
 [EMAIL PROTECTED] wrote:
  Hi, after enabling error reporting with E_ALL I am having this strange
  warning while loading a XML:
 
  Warning: DOMDocument::load() [function.DOMDocument-load]: Extra content
  at the end of the document in [...]

Is there an extra whitespace or carriage return/newline after the
 final closing tag?

 --
 /Dan

 Daniel P. Brown
 Senior Unix Geek
 ? while(1) { $me = $mind--; sleep(86400); } ?



I don't think extra whitespace will do that. Even comments after the
closing element tag should be OK. This looks more like a document with
multiple root elements or other non-whitespace characters after the
closing root element tag.

Andrew


Re: [PHP] Curl doesn't handle memory stream

2008-02-13 Thread Nathan Nobbe
On Nov 29, 2007 10:59 AM, Peter Smit [EMAIL PROTECTED] wrote:

 If nobody has a solution I think I'll report it as a bug tomorrow.


did you ever report a bug on this ?

i was messing around with it today, and i discovered that some urls,
partially work.  for example the google translate 'api', and php.net

note, i set the user agent for the google site to work.  and i say,
partially, because even when data does come back, its not the complete
page, which you can easily realize by navigating to the page and comparing
the source w/ the output from the test script.
i dont know of any ini setting that would influence the amount of space
available to the memory buffer, aside from memory_limit, which i have set
to 128M.

?php
#$c = curl_init(
http://google.com/translate_t?langpair=en%7Cfrtext=newspaper;);
$c = curl_init(http://php.net;);
$st = fopen('php://memory', 'r');

curl_setopt($c, CURLOPT_FILE, $st);
curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.8.1.11) Gecko/20080115 Firefox/2.0.0.11');

if(!curl_exec($c)) die (error: .curl_error($c));
curl_close($c);

rewind($st);

echo stream_get_contents($st);
fclose($st);
?

-nathan


Re: [PHP] PHP fsockopen with the UNIX abstract namespace

2008-02-13 Thread Jochem Maas

@4u schreef:

Hi,

I have a problem with fsockopen in connection with the UNIX abstract
namespace.

To open a UNIX socket in the abstract namespace I have to add a nul byte
in front of the path.

Unfortunately PHP returns
fsockopen() [function.fsockopen]: unable to connect to unix://:0
(Connection refused)

for unix://\x00/tmp/dbus-whatever which is a bit strange because I
expected at least the error message fsockopen() [function.fsockopen]:
unable to connect to unix://[NUL byte]/tmp/dbus-whatever:0 (Connection
refused)


your problem might be version related, but php does have a C level function
php_stream_sock_open_unix() explicitly for the issue of the NUL byte
(the NUL byte is seen as the end of a string, unless the string handling
is binary safe - if I got the lingo correct).

my first guess would be to use socket_create() in combination with
socket_connect() instead of fsockopen() and see if that does the trick.




Is this a known issue or do I have to set something in the php.ini?

I would appreciate any ideas how to debug this issue.



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



Re: [PHP] Curl doesn't handle memory stream

2008-02-13 Thread Manuel Lemos
Hello,

on 02/13/2008 05:17 PM Nathan Nobbe said the following:
 If nobody has a solution I think I'll report it as a bug tomorrow.
 
 
 did you ever report a bug on this ?
 
 i was messing around with it today, and i discovered that some urls,
 partially work.  for example the google translate 'api', and php.net
 
 note, i set the user agent for the google site to work.  and i say,
 partially, because even when data does come back, its not the complete
 page, which you can easily realize by navigating to the page and comparing
 the source w/ the output from the test script.
 i dont know of any ini setting that would influence the amount of space
 available to the memory buffer, aside from memory_limit, which i have set
 to 128M.
 
 ?php
 #$c = curl_init(
 http://google.com/translate_t?langpair=en%7Cfrtext=newspaper;);
 $c = curl_init(http://php.net;);
 $st = fopen('php://memory', 'r');
 
 curl_setopt($c, CURLOPT_FILE, $st);
 curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; en-US;
 rv:1.8.1.11) Gecko/20080115 Firefox/2.0.0.11');
 
 if(!curl_exec($c)) die (error: .curl_error($c));
 curl_close($c);
 
 rewind($st);
 
 echo stream_get_contents($st);
 fclose($st);
 ?

It does not seem like it is a real bug but maybe file access is
implemented inside Curl and it has no knowledge about PHP stream support.

Alternatively, you may want to try this HTTP client class, which can use
any access files you need to use in your HTTP requests.

-- 

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] help me out with form details converted into pdf file save it one place as well as send mail attactment

2008-02-13 Thread David Giragosian
On 2/13/08, pretty [EMAIL PROTECTED] wrote:

 hi any one help me out, im using cronofirm, i need to field form details will
 converted into pdf as well as it will go maill attachment doing this in
 joomla, atleast i need this only php with out joomla.

It might be overkill for your purposes, but you might want to explore
pdftex in Tex (or LaTeX), available for both Linux and Windows.

Create a string to write to a file, adding these header calls at the
top, massaged to your needs:

$outputStr = \\documentclass[10pt,fleqn]{article}\n;
$outputStr .= \\usepackage[cp850]{inputenc}\n;
$outputStr .= \\usepackage{textcomp}\n;
$outputStr .= \\setlength{\textwidth}{19.05cm}\n;
$outputStr .= \\setlength{\oddsidemargin}{-2.0cm}\n;
$outputStr .= \\setlength{\textheight}{26.5cm}\n;
$outputStr .= \\setlength{\topmargin}{-1.9cm}\n;
$outputStr .= \\setlength{\headheight}{0.0cm}\n;
$outputStr .= \\setlength{\topskip}{0.0cm}\n;
$outputStr .= \\begin{document}\n;
$outputStr .= \\pagestyle{empty}\n;
$outputStr .= \\begin{verbatim}\n;

$outputStr .=  Then append to the string whatever you want, including
variables for interpolation, formatted however you want. (Sprintf
works really well for alignment, etc...). The verbatim call above
leaves in place all text placement on the page.;

$outputStr .= Then close the string with these commands...;

$outputStr .= \\end{verbatim}\n;
$outputStr .= \\end{document}\n;

Write to a file:

$fh = fopen(FileName.tex, w);
fwrite($fh, $outputStr);
fclose($fh);

`pdflatex FileName.tex`; // ( properly escaped, of course...)

and FileName.pdf is created.

You can also do a lot of really fancy formatting, but the learning
curve can be pretty steep.

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] PHP fsockopen with the UNIX abstract namespace

2008-02-13 Thread @4u
Hi,

thanks for your help - unfortunately it doesn't help.

With stream_socket_client () I get the message unable to connect to
unix://\0/tmp/hald-local/dbus-ZniNmvr5O0 (Connection refused) in
/root/dbus_session.php on line 272 which is at least better, because it
shows the full path.

I verified it with

PHP 5.1.2 (cli) (built: Jul 17 2007 17:32:48)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

(It's a Debian based machine)

and

PHP 5.2.5-pl1-gentoo (cli) (built: Dec 29 2007 11:46:44)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with eAccelerator v0.9.5.1, Copyright (c) 2004-2006 eAccelerator, by
eAccelerator

(Gentoo)

socket_create and socket_connect produces the following error:

Warning: socket_connect() [function.socket-connect]: unable to connect
[22]: Invalid argument in ...

again verified on both systems and definitely with the right arguments -
 the socket resource and a [NUL]/tmp/path string as written in the PHP
manual.

Are their other solutions or known problems? If not, I will maybe post
it as a bug - but wanted to make sure that it's not my fault.

Jochem Maas schrieb:
 @4u schreef:
 Hi,

 I have a problem with fsockopen in connection with the UNIX abstract
 namespace.

 To open a UNIX socket in the abstract namespace I have to add a nul byte
 in front of the path.

 Unfortunately PHP returns
 fsockopen() [function.fsockopen]: unable to connect to unix://:0
 (Connection refused)

 for unix://\x00/tmp/dbus-whatever which is a bit strange because I
 expected at least the error message fsockopen() [function.fsockopen]:
 unable to connect to unix://[NUL byte]/tmp/dbus-whatever:0 (Connection
 refused)
 
 your problem might be version related, but php does have a C level function
 php_stream_sock_open_unix() explicitly for the issue of the NUL byte
 (the NUL byte is seen as the end of a string, unless the string handling
 is binary safe - if I got the lingo correct).
 
 my first guess would be to use socket_create() in combination with
 socket_connect() instead of fsockopen() and see if that does the trick.
 
 

 Is this a known issue or do I have to set something in the php.ini?

 I would appreciate any ideas how to debug this issue.


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



Re: [PHP] Curl doesn't handle memory stream

2008-02-13 Thread Jim Lucas

Nathan Nobbe wrote:

On Nov 29, 2007 10:59 AM, Peter Smit [EMAIL PROTECTED] wrote:


If nobody has a solution I think I'll report it as a bug tomorrow.



did you ever report a bug on this ?

i was messing around with it today, and i discovered that some urls,
partially work.  for example the google translate 'api', and php.net

note, i set the user agent for the google site to work.  and i say,
partially, because even when data does come back, its not the complete
page, which you can easily realize by navigating to the page and comparing
the source w/ the output from the test script.
i dont know of any ini setting that would influence the amount of space
available to the memory buffer, aside from memory_limit, which i have set
to 128M.

?php
#$c = curl_init(
http://google.com/translate_t?langpair=en%7Cfrtext=newspaper;);
$c = curl_init(http://php.net;);
$st = fopen('php://memory', 'r');

curl_setopt($c, CURLOPT_FILE, $st);
curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.8.1.11) Gecko/20080115 Firefox/2.0.0.11');

if(!curl_exec($c)) die (error: .curl_error($c));
curl_close($c);

rewind($st);

echo stream_get_contents($st);
fclose($st);
?

-nathan



I see on the http://us.php.net/wrappers.php page that only php 5.1.0 and newer 
have this feature.  What version of PHP are you using?


--
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] Curl doesn't handle memory stream

2008-02-13 Thread Jim Lucas

Nathan Nobbe wrote:

On Nov 29, 2007 10:59 AM, Peter Smit [EMAIL PROTECTED] wrote:


If nobody has a solution I think I'll report it as a bug tomorrow.



did you ever report a bug on this ?



http://bugs.php.net/bug.php?id=43468

--
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] PHP fsockopen with the UNIX abstract namespace

2008-02-13 Thread Jochem Maas

@4u schreef:

Hi,

thanks for your help - unfortunately it doesn't help.

With stream_socket_client () I get the message unable to connect to
unix://\0/tmp/hald-local/dbus-ZniNmvr5O0 (Connection refused) in
/root/dbus_session.php on line 272 which is at least better, because it
shows the full path.


is the connection refused a permissions thing here? can you
verify that it's possible to connect?

you might consider attaching php to gdb and seeing where things
go wrong, if the socket itself is fine and usable and your sure
then a bug report is in order, no?

maybe someone smarter cares to comment.



I verified it with

PHP 5.1.2 (cli) (built: Jul 17 2007 17:32:48)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

(It's a Debian based machine)

and

PHP 5.2.5-pl1-gentoo (cli) (built: Dec 29 2007 11:46:44)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with eAccelerator v0.9.5.1, Copyright (c) 2004-2006 eAccelerator, by
eAccelerator

(Gentoo)

socket_create and socket_connect produces the following error:

Warning: socket_connect() [function.socket-connect]: unable to connect
[22]: Invalid argument in ...

again verified on both systems and definitely with the right arguments -
 the socket resource and a [NUL]/tmp/path string as written in the PHP
manual.

Are their other solutions or known problems? If not, I will maybe post
it as a bug - but wanted to make sure that it's not my fault.

Jochem Maas schrieb:

@4u schreef:

Hi,

I have a problem with fsockopen in connection with the UNIX abstract
namespace.

To open a UNIX socket in the abstract namespace I have to add a nul byte
in front of the path.

Unfortunately PHP returns
fsockopen() [function.fsockopen]: unable to connect to unix://:0
(Connection refused)

for unix://\x00/tmp/dbus-whatever which is a bit strange because I
expected at least the error message fsockopen() [function.fsockopen]:
unable to connect to unix://[NUL byte]/tmp/dbus-whatever:0 (Connection
refused)

your problem might be version related, but php does have a C level function
php_stream_sock_open_unix() explicitly for the issue of the NUL byte
(the NUL byte is seen as the end of a string, unless the string handling
is binary safe - if I got the lingo correct).

my first guess would be to use socket_create() in combination with
socket_connect() instead of fsockopen() and see if that does the trick.



Is this a known issue or do I have to set something in the php.ini?

I would appreciate any ideas how to debug this issue.





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



Re: [PHP] Curl doesn't handle memory stream

2008-02-13 Thread Nathan Nobbe
On Feb 13, 2008 5:07 PM, Jim Lucas [EMAIL PROTECTED] wrote:

 I see on the http://us.php.net/wrappers.php page that only php 5.1.0 and
 newer
 have this feature.  What version of PHP are you using?


thanks for your time jim;
im using 5.2.5.

manuel, thanks for your time as well.  of course i can just use a file,
but im somewhat interested in this feature.  and im not sure if curl
implements
the file handling on its own, otherwise why would i have partial success
with
certain urls?  i think something goofy is going on here; id like to find out
if
at all possible.  i know that some extensions may not support the feature,
but i could find no documentation that would say either way for the curl
extension..

-nathan


Re: [PHP] Curl doesn't handle memory stream

2008-02-13 Thread Nathan Nobbe
On Feb 13, 2008 5:10 PM, Jim Lucas [EMAIL PROTECTED] wrote:

 Nathan Nobbe wrote:
  On Nov 29, 2007 10:59 AM, Peter Smit [EMAIL PROTECTED] wrote:
 
  If nobody has a solution I think I'll report it as a bug tomorrow.
 
 
  did you ever report a bug on this ?
 

 http://bugs.php.net/bug.php?id=43468


thanks jim ;)

-nathan


Re: [PHP] PHP fsockopen with the UNIX abstract namespace

2008-02-13 Thread @4u
Hi again,

Jochem Maas schrieb:
 @4u schreef:
[snip]
 is the connection refused a permissions thing here? can you
 verify that it's possible to connect?

I'm not sure but I don't think so. 1.) we speak about D-BUS and 2.) its
owner and root should always be able to connect to it. Especially the
socket_create test seems interesting - removing the NUL byte results in
this snipplet to work - adding it again results in an invalid argument.

 you might consider attaching php to gdb and seeing where things
 go wrong, if the socket itself is fine and usable and your sure
 then a bug report is in order, no?

Looks like I'll do that (trying gdb) and post a bug report.

 maybe someone smarter cares to comment.

Once more thanks for your help :) I wasn't sure if it was me or PHP -
but with the socket_* function tests it looks like it's something wrong
with PHP and the NUL byte.

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



Re: [PHP] Curl doesn't handle memory stream

2008-02-13 Thread Richard Lynch


On Wed, February 13, 2008 4:11 pm, Nathan Nobbe wrote:
 On Feb 13, 2008 5:07 PM, Jim Lucas [EMAIL PROTECTED] wrote:

 I see on the http://us.php.net/wrappers.php page that only php 5.1.0
 and
 newer
 have this feature.  What version of PHP are you using?


 thanks for your time jim;
 im using 5.2.5.

 manuel, thanks for your time as well.  of course i can just use a
 file,
 but im somewhat interested in this feature.  and im not sure if curl
 implements
 the file handling on its own, otherwise why would i have partial
 success
 with
 certain urls?  i think something goofy is going on here; id like to
 find out
 if
 at all possible.  i know that some extensions may not support the
 feature,
 but i could find no documentation that would say either way for the
 curl
 extension..

You may or may not want to file a bug report with curl itself,
depending on whether PHP is doing the stream file handling or curl is.

At a wild guess, I would expect it would be buried in curl code, not
PHP code...

Perhaps you can dig around here and find out for sure:
http://lxr.php.net
http://cvs.php.net

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] help me out with form details converted into pdf file save it one place as well as send mail attactment

2008-02-13 Thread Richard Lynch
On Wed, February 13, 2008 6:26 am, pretty wrote:

 hi any one help me out, im using cronofirm, i need to field form
 details will
 converted into pdf as well as it will go maill attachment doing this
 in
 joomla, atleast i need this only php with out joomla.

To make a PDF, you can use:
http://php.net/pdf

To save that to a file, you can use:
http://php.net/file_put_contents

To send the email out, you can use the PEAR mailer, phpmailer, or the
Mime Mail class at phpclasses.org or...

How you'd fit any of this into Joomla is a Joomla problem :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Copying 1000s files and showing the progress

2008-02-13 Thread Richard Lynch
On Wed, February 13, 2008 4:28 am, Ritesh Nadhani wrote:
 I have a situation where I have to copy something like 1000 files one
 by one to a temporary folder. Tar it using the system tar command and
 let the user download the tar file.

 Now while the copy is going on at server, I want to show some progress
 to the user at client side. Most of the tutorial I found on net was
 about showing progress while a file is being uploaded from client to
 server. In this case the client has the info but for my case, the
 client has no info.

 A similar was problem was solved at
 http://menno.b10m.net/blog/blosxom/perl/cgi-upload-hook.html but its
 in PERL and uses some form of hook. I have no clue how to do it in
 PHP.

 Any clues or right direction would be awesome.

First of all, don't do that. :-)

Instead, set up a job system of what should be copied/tarred, and
then notify the user via email.

Don't make the user sit there waiting for the computer!

If you absolutely HAVE to do this due to a pointy-haired boss...

?php
  $path = /full/path/to/1000s/of/files;
  $dir = opendir($path) or die(Change that path);
  $tmp = tmpname(); //or whatever...
  while (($file = readdir($dir)) !== false){
echo $filebr /\n;
copy($path/$file, /tmp/$tmp/$path);
  }
  exec(tar -cf /tmp/$tmp.tar /tmp/$tmp/, $output, $error);
  echo implode(br /\n, $output);
  if ($error){
//handle error here!
die(OS Error: $error);
  }
?

shameless plug:
//handle error here could perhaps use this:
http://l-i-e.com/perror.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] DOMXML Warning

2008-02-13 Thread Richard Lynch
On Wed, February 13, 2008 1:51 am, Miguel J. Jiménez wrote:
 Hi, after enabling error reporting with E_ALL I am having this strange
 warning while loading a XML:

 Warning: DOMDocument::load() [function.DOMDocument-load]: Extra
 content
 at the end of the document in [...]

 The code I use is:

 $dom = new DOMDocument();
 $dom-load(http://example.com/file.xml;);
 [...]

 If I open the xml uri (with firefox) I get a complete and well formed
 xml (nothing strange about it).

 With error reporting disabled everything works fine so I am
 puzzled :-( Any help will be appreciated.

Open the document in a Hex editor to see if there are unprintable
characters at the end.

It's also possible that they aren't at the END of the document, but at
the END of some node within the document, or even some CDATA within a
node within the document...

You could probably Google for an XML validator that would perhaps be
more specific about what's wrong where.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



[PHP] Static variable in a class method

2008-02-13 Thread Pauau
I have a class method which declares a static variable within.However, 
across all the instances of the class, the current value on that variable 
replicates. Is it the intended functionality? Example: class A {public 
function foo() {static $i=0;$i++;}}$obj1 = new 
A();$obj1-foo(); //$i = 1 $obj2 = new A();$obj2-foo(); //$i = 2 where I 
think it should be 1, becaue it's a new instance. 

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



Re: [PHP] Copying 1000s files and showing the progress

2008-02-13 Thread Ritesh Nadhani
On Feb 13, 2008 6:03 PM, Richard Lynch [EMAIL PROTECTED] wrote:

 On Wed, February 13, 2008 4:28 am, Ritesh Nadhani wrote:
  I have a situation where I have to copy something like 1000 files one
  by one to a temporary folder. Tar it using the system tar command and
  let the user download the tar file.
 
  Now while the copy is going on at server, I want to show some progress
  to the user at client side. Most of the tutorial I found on net was
  about showing progress while a file is being uploaded from client to
  server. In this case the client has the info but for my case, the
  client has no info.
 
  A similar was problem was solved at
  http://menno.b10m.net/blog/blosxom/perl/cgi-upload-hook.html but its
  in PERL and uses some form of hook. I have no clue how to do it in
  PHP.
 
  Any clues or right direction would be awesome.

 First of all, don't do that. :-)

 Instead, set up a job system of what should be copied/tarred, and
 then notify the user via email.

 Don't make the user sit there waiting for the computer!

 If you absolutely HAVE to do this due to a pointy-haired boss...

 ?php
   $path = /full/path/to/1000s/of/files;
   $dir = opendir($path) or die(Change that path);
   $tmp = tmpname(); //or whatever...
   while (($file = readdir($dir)) !== false){
 echo $filebr /\n;
 copy($path/$file, /tmp/$tmp/$path);
   }
   exec(tar -cf /tmp/$tmp.tar /tmp/$tmp/, $output, $error);
   echo implode(br /\n, $output);
   if ($error){
 //handle error here!
 die(OS Error: $error);
   }
 ?

 shameless plug:
 //handle error here could perhaps use this:
 http://l-i-e.com/perror.

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/from/lynch
 Yeah, I get a buck. So?



I was actually doing what you just gave the code for. As of now, I was
doing something like:


for file in files:
   copy from source to folder
   echo Copying files encapsulated in ob_flush()

tar the file which hardly takes time on the filessyetm but does take some time

Provide the link to the tar


So at the client side it was like:

Copying file #1
Copying file #2

Download link

I though I could apply some funkiness to it by using some AJAX based
progress bar for which the example showed some sort of hooking and all
which I thought was too much for such a job. I will talk to my boss
regarding this and do the necessary.

BTW, whats the issue with AJAX based approach? Any particular reason
other then it seems to be a hack rather then an elegant solution
(which is more then enough reason not to implement it...but I wonder
if there is a technical reason to it too)?

-- 
Ritesh
http://www.riteshn.com

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



Re: [PHP] Static variable in a class method

2008-02-13 Thread Nirmalya Lahiri
--- Pauau [EMAIL PROTECTED] wrote:

 I have a class method which declares a static variable
 within.However, 
 across all the instances of the class, the current value on that
 variable 
 replicates. Is it the intended functionality? Example: class A {   
 public 
 function foo() {static $i=0;$i++;}}$obj1 = new 
 A();$obj1-foo(); //$i = 1 $obj2 = new A();$obj2-foo(); //$i = 2
 where I 
 think it should be 1, becaue it's a new instance. 
 

Pauau,
 Please visit the link below for help..
http://www.php.net/manual/en/language.oop5.static.php

---
Nirmalya Lahiri
[+91-9433113536]


  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

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



Re: [PHP] Run Process in back ground

2008-02-13 Thread Richard Lynch
On Mon, February 11, 2008 1:23 pm, Richard Kurth wrote:
 Is there a way that I can call a function that will send an email and
 then move on redirecting to another website without having to what for
 the email to send?
 SendEmail($memberemail,$MailFrom,$MailHost);
 header(Location:http://domain.com;);

The email is not actually sent if you use a decent email program that
just queues it up...

So it really should not take any time at all for the SendEmail
function to run...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Static variable in a class method

2008-02-13 Thread Nathan Nobbe
On Feb 13, 2008 8:44 PM, Nirmalya Lahiri [EMAIL PROTECTED] wrote:

 --- Pauau [EMAIL PROTECTED] wrote:

  I have a class method which declares a static variable
  within.However,
  across all the instances of the class, the current value on that
  variable
  replicates. Is it the intended functionality? Example: class A {
  public
  function foo() {static $i=0;$i++;}}$obj1 = new
  A();$obj1-foo(); //$i = 1 $obj2 = new A();$obj2-foo(); //$i = 2
  where I
  think it should be 1, becaue it's a new instance.
 

 Pauau,
  Please visit the link below for help..
 http://www.php.net/manual/en/language.oop5.static.php


what you are using is potentially not what you think it is.  you are using
a 'static variable' which is not a static class member.  you can find the
doc on static variables here,
http://www.php.net/manual/en/language.variables.scope.php
im not sure if their behavior is well defined when they are used in classes,
or objects.

as Nirmalya, has alluded, you should check out the docs on static class
members.  im sure that you can achieve whatever you need to by using
some combination of static class members and instance variables.

-nathan


Re: [PHP] Curl doesn't handle memory stream

2008-02-13 Thread Nathan Nobbe
On Feb 13, 2008 6:52 PM, Richard Lynch [EMAIL PROTECTED] wrote:

 On Wed, February 13, 2008 4:11 pm, Nathan Nobbe wrote:

 You may or may not want to file a bug report with curl itself,
 depending on whether PHP is doing the stream file handling or curl is.

 At a wild guess, I would expect it would be buried in curl code, not
 PHP code...

 Perhaps you can dig around here and find out for sure:
 http://lxr.php.net
 http://cvs.php.net


thanks richard, even tho im not proficient w/ c ill take a look at it this
weekend and see if i can make any headway.  i remember trying to look
when this thread first started and i was like, u... yeah...
but its worth another shot.  and the lxr link is pretty sweet too.  i like
how
they have links for all the line numbers of the source files :)

-nathan


Re: [PHP] Session and Multi Server Architecture

2008-02-13 Thread Richard Lynch
On Mon, February 11, 2008 11:33 am, chetan rane wrote:
  Can any one tell me what will be the best way to maintain session
 information on a Multi Server Architecture i.e a Web Cluster.

Write a custom session handler which:
 a) binhex the session data, and if it is less then 4K, put the actual
session data into a Cookie on the user's computer.  Then their
session data travels with them.
 b) If it's MORE than 4K, put it into memcache (or is it memcached?)
on an external box, which propogates to its own clusters.

More details somewhere on this site:
http://hostedlabs.com/

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Session and Multi Server Architecture

2008-02-13 Thread Michael McGlothlin



Write a custom session handler which:
 a) binhex the session data, and if it is less then 4K, put the actual
session data into a Cookie on the user's computer.  Then their
session data travels with them.
 b) If it's MORE than 4K, put it into memcache (or is it memcached?)
on an external box, which propogates to its own clusters.
  
If you're going to store the user's session data as a cookie then make 
sure there is nothing that will be insecure if they figure out how to 
modify it.


--
Michael McGlothlin
Southwest Plumbing Supply



smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PHP] database design tool

2008-02-13 Thread Shawn McKenzie
Thanks.  I use kubuntu and have all ooo including base, but it seems
very minimal.  I connected via jdbc (as only other option is odbc for
mysql).  I can't even see how to define a key as auto increment, there
is no option.  I tried dbdesigner4 and it is very old and buggy on
linux.  I found a post that suggested I download the windows version and
run it under wine.  Works great.

As for the OT, many apologies, I never even thought of looking for a
php-db list, thanks for the heads-up.

-Shawn

Thanks!
-Shawn

Daniel Brown wrote:
 On Feb 12, 2008 7:46 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:
   
 Can anyone recommend a preferably visual DB design tool? I normally use
 mysql, but one that covered several types wood be cool.  I'm on Linux,
 so the new mysql workbench is a dud.  I used it in an alpha or prior
 version and it looked promising but crashed frequently.  They say a
 Linux version in 2008, but I'm not holding my breath.
 

 For RAD-style database design, check out OpenOffice.org Base.  I
 know it comes pre-packaged with Mandriva (which I use), but I'm not
 certain about other distros.  Depending on your flavor, you can
 probably apt-get, yum, urpmi, or manually install from an RPM or DEB.

 It works a lot like Filemaker and Access, so if you're familiar
 with those, you should notice a lot of similarities.  Plus, it will
 work without a problem with MyODBC, Unix ODBC, JDBC, and native
 connections.

 For future reference though, Shawn, try sending to the PHP-DB list
 when asking questions like that.  Then it's not off-topic.  ;-)

   

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



RE: [PHP] Template system in PHP

2008-02-13 Thread Xavier de Lapeyre
Lol...
If IE7 goes hun what?
I wonder what would happen in lt IE7 :)

GO FIREFOX!!!


Xavier



-Original Message-
From: Nathan Rixham [mailto:[EMAIL PROTECTED] 
Sent: mercredi 13 février 2008 01:27
To: php-general@lists.php.net
Subject: Re: [PHP] Template system in PHP

*sigh* as always, firefox obeys, ie7 goes huh what?

Nathan Rixham wrote:
 Are you creating custom DTD's or 1.1 XHTML Mods then? I'd like to see 
 that, it's something I'd toyed with a few times in the past but found it 
 far too time consuming (even for me), and opted for the ol' redefine 
 everything in CSS
 
 *lightbulb* :: runs off to try css on custom tags why have i never 
 tried that before :: ponders accessibility.. :: wanders off to waste 
 time researching anyways
 
 Robert Cummings wrote:
 On Tue, 2008-02-12 at 15:02 -0600, Greg Donald wrote:
 On Feb 12, 2008 2:57 PM, Robert Cummings [EMAIL PROTECTED] wrote:
 I prefer content formatting encapsulation as provided by custom tags.
 Decorators?

 Custom tags (XML style ones anyways) provide support for arbitrary
 ordering and omission of optional attributes. They nest nicer than
 function calls, and they have the same general formatting as the HTML
 with which you are working. Additionally, they provide the opportunity
 to punt anything not necessary at run-time to pre-compiled HTML.

 Cheers,
 Rob.

-- 
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] Template system in PHP

2008-02-13 Thread Shawn McKenzie
Xavier de Lapeyre wrote:
 Lol...
 If IE7 goes hun what?
 I wonder what would happen in lt IE7 :)
 
 GO FIREFOX!!!
 
 
 Xavier
 
 
 
 -Original Message-
 From: Nathan Rixham [mailto:[EMAIL PROTECTED] 
 Sent: mercredi 13 février 2008 01:27
 To: php-general@lists.php.net
 Subject: Re: [PHP] Template system in PHP
 
 *sigh* as always, firefox obeys, ie7 goes huh what?
 
 Nathan Rixham wrote:
 Are you creating custom DTD's or 1.1 XHTML Mods then? I'd like to see 
 that, it's something I'd toyed with a few times in the past but found it 
 far too time consuming (even for me), and opted for the ol' redefine 
 everything in CSS

 *lightbulb* :: runs off to try css on custom tags why have i never 
 tried that before :: ponders accessibility.. :: wanders off to waste 
 time researching anyways

 Robert Cummings wrote:
 On Tue, 2008-02-12 at 15:02 -0600, Greg Donald wrote:
 On Feb 12, 2008 2:57 PM, Robert Cummings [EMAIL PROTECTED] wrote:
 I prefer content formatting encapsulation as provided by custom tags.
 Decorators?
 Custom tags (XML style ones anyways) provide support for arbitrary
 ordering and omission of optional attributes. They nest nicer than
 function calls, and they have the same general formatting as the HTML
 with which you are working. Additionally, they provide the opportunity
 to punt anything not necessary at run-time to pre-compiled HTML.

 Cheers,
 Rob.
 
Ummm...  It's 11:30PM my time and I'm half drunk.  I can only assume the
same of you.

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



Re: [PHP] Curl doesn't handle memory stream

2008-02-13 Thread Manuel Lemos
Hello

on 02/13/2008 08:11 PM Nathan Nobbe said the following:
 On Feb 13, 2008 5:07 PM, Jim Lucas [EMAIL PROTECTED] wrote:
 
 I see on the http://us.php.net/wrappers.php page that only php 5.1.0 and
 newer
 have this feature.  What version of PHP are you using?
 
 
 thanks for your time jim;
 im using 5.2.5.
 
 manuel, thanks for your time as well.  of course i can just use a file,
 but im somewhat interested in this feature.  and im not sure if curl
 implements
 the file handling on its own, otherwise why would i have partial success
 with
 certain urls?  i think something goofy is going on here; id like to find out
 if
 at all possible.  i know that some extensions may not support the feature,
 but i could find no documentation that would say either way for the curl
 extension..

THat is a bit intriguing why it works in some cases and others it doesn't.

I do not use the Curl library functions except for things that you
cannot do with the current fsockopen based socket connections. In the
latest PHP versions there is not much that you cannot do with socket
connections that you can do with Curl.

In any case, I have encapsulated HTTP client fucntionality in the class
that I mentioned, so it uses fsockopen or curl functions depending on
what you need and what is available in the underlying PHP version. This
way I achive a PHP version independent solution.


-- 

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



RE: [PHP] Template system in PHP

2008-02-13 Thread Xavier de Lapeyre
Sounds interesting...
Are your XML predefined or generated on the run? From say a DB?


Xavier

Please consider the environment before printing this mail note. 



-Original Message-
From: Nathan Rixham [mailto:[EMAIL PROTECTED] 
Sent: mercredi 13 février 2008 01:20
To: php-general@lists.php.net
Subject: Re: [PHP] Template system in PHP

Are you creating custom DTD's or 1.1 XHTML Mods then? I'd like to see 
that, it's something I'd toyed with a few times in the past but found it 
far too time consuming (even for me), and opted for the ol' redefine 
everything in CSS

*lightbulb* :: runs off to try css on custom tags why have i never 
tried that before :: ponders accessibility.. :: wanders off to waste 
time researching anyways

Robert Cummings wrote:
 On Tue, 2008-02-12 at 15:02 -0600, Greg Donald wrote:
 On Feb 12, 2008 2:57 PM, Robert Cummings [EMAIL PROTECTED] wrote:
 I prefer content formatting encapsulation as provided by custom tags.
 Decorators?
 
 Custom tags (XML style ones anyways) provide support for arbitrary
 ordering and omission of optional attributes. They nest nicer than
 function calls, and they have the same general formatting as the HTML
 with which you are working. Additionally, they provide the opportunity
 to punt anything not necessary at run-time to pre-compiled HTML.
 
 Cheers,
 Rob.

-- 
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] Template system in PHP

2008-02-13 Thread Robert Cummings

On Thu, 2008-02-14 at 08:58 +0400, Xavier de Lapeyre wrote:
 Sounds interesting...
 Are your XML predefined or generated on the run? From say a DB?

From a compiler script that extends a base tag class... all it needs to
do is register the tag namespace, tag name, and the function that will
handle the tag's content. Here's a very simple case:

?php

class ExampleSiteCompilersExampleSiteTag extends JinnBaseTagCompiler
{
var $filename = __FILE__;

function ___jinnConstruct()
{
$this-handlers = array
(
'example' = array
( 
'mandatory' = 'expandTagMandatory',
),  
);
} 

function expandTagMandatory
( $content, $space, $tag, $atts, $tagStack )
{
return 'span class=mandatory*/span';
}
}

?

Then when doing forms I can do the following:

example:mandatory/

And that will be expanded to:

span class=mandatory*/span

Then later down the road if I wanted the mandatory symbol to change to
an image, I could change the content expanded in the handler, rebuild
the site and all uses of the mandatory tag would be updated and would
incur no run-time overhead.

This is obviously a trivial example. There is much more that can be done.
For instance creating boxes, popups, relocating content, checking links,
image analysis to get the width and height of image at compile time instead
of run-time, etc. Encapsulating the data into a tag allows greatly
simplifying content. Also the tag system allows recursive expansion. So
a tag handler can output custom tags and those in turn will be expanded.
Hell, I could even create a validation tag around the primary layout
template that would then validate the content at build time.

Anyways, there ARE better template systems than PHP itself.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Copying 1000s files and showing the progress

2008-02-13 Thread Manuel Lemos
Hello,

on 02/13/2008 11:11 PM Ritesh Nadhani said the following:
 I though I could apply some funkiness to it by using some AJAX based
 progress bar for which the example showed some sort of hooking and all
 which I thought was too much for such a job. I will talk to my boss
 regarding this and do the necessary.
 
 BTW, whats the issue with AJAX based approach? Any particular reason
 other then it seems to be a hack rather then an elegant solution
 (which is more then enough reason not to implement it...but I wonder
 if there is a technical reason to it too)?

If the user hits the browser stop button, it may abort the process in
the server if you have the PHP option ignore_user_abort option set to
off. Other than that I do not see any other problem.

AJAX can be a little complicated if you have to code all the Javascript
by hand.

You may want to try this forms class that comes with an AJAX form
submission plug-in.

http://www.phpclasses.org/formsgeneration

Even if you do not need to submit any forms, the AJAX plug-in can be
used to do what you need without having to learn Javascript to implement
a browser independent AJAX solution.

Take a look at this live example that shows how to give progress
feedback of a task running on the server:

http://www.meta-language.net/forms-examples.html?example=test_ajax_form


-- 

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



RE: [PHP] Template system in PHP

2008-02-13 Thread Xavier de Lapeyre
Wow,
Thnks...
Seems that are lots of routes to it.


Xavier de Lapeyre
Web Developer
Enterprise Data Services
www.eds.mu



Please consider the environment before printing this mail note. 



-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED] 
Sent: mercredi 13 février 2008 00:57
To: Shawn McKenzie
Cc: php-general@lists.php.net
Subject: Re: [PHP] Template system in PHP


On Tue, 2008-02-12 at 14:22 -0600, Shawn McKenzie wrote:
 Ryan A wrote:
  Add my vote too for Smarty 
  
  HTH,
  -R
  
  
  

  
  Looking for last minute shopping deals?  
  Find them fast with Yahoo! Search.  
  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
 
 I like smarty and it's very powerful, however what you find is that it's
 just a less capable replacement for PHP.  If I want conditional
 statements to display HTML and/or loop through arrays, why would I want
 to do it in smarty tags?  Instead of moving display away from logic, it
 just replaces the logic with a different language.  When I use templates
 I pretty much want variable substitution.  My next project I'll probably
 use HTML files with little bits of PHP echos etc... sprinkled throughout.

I prefer content formatting encapsulation as provided by custom tags.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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