php-general Digest 13 Feb 2008 19:32:56 -0000 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]


----------------------------------------------------------------------
--- Begin Message ---
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 ---
--- Begin Message ---
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 ---
--- Begin Message ---
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 ---
--- Begin Message ---
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)  |
'---------------------------------------------------------'

Attachment: signature.asc
Description: PGP signature


--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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); } ?>

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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).

--- End Message ---
--- Begin Message ---
> ...

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

--- End Message ---
--- Begin Message ---
> > 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

--- End Message ---
--- Begin Message ---
> 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 **

--- End Message ---
--- Begin Message ---
>  > 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

--- End Message ---
--- Begin Message ---
On Wed, 2008-02-13 at 11:26 +0000, 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.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
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.

--- End Message ---
--- Begin Message ---

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

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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/9351947    50, rue de Soultz         MSN LinuxMichi
+33/6/61925193     67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


--- End Message ---
--- Begin Message ---
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.

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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); } ?>

--- End Message ---
--- Begin Message ---
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%7Cfr&text=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

--- End Message ---

Reply via email to