|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help
lists.php.net
Date: Thu Feb 14 2008 - 14:32:53 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 14 Feb 2008 20:32:53 -0000 Issue 5293
Topics (messages 269287 through 269319):
Re: Template system in PHP
269287 by: Paul Scott
XSLTProcessor without validation
269288 by: Siegfried Gipp
269306 by: Richard Lynch
Re: Static variable in a class method
269289 by: Jochem Maas
269290 by: Jochem Maas
269296 by: Nathan Nobbe
269300 by: Jochem Maas
269302 by: Eric Butera
269303 by: Nathan Nobbe
269305 by: Nathan Rixham
269308 by: Richard Lynch
269313 by: Zoltán Németh
269314 by: Eric Butera
269315 by: Robert Cummings
Re: Session and Multi Server Architecture
269291 by: Richard Lynch
269309 by: Richard Lynch
269310 by: Richard Lynch
Re: Copying 1000s files and showing the progress
269292 by: Jochem Maas
269299 by: Michelle Konzack
269301 by: Nathan Rixham
269304 by: Ritesh Nadhani
Re: generate xls file on fly
269293 by: Hiep Nguyen
269297 by: Nirmalya Lahiri
269298 by: Andrew Ballard
php+mail+TLS/SSL
269294 by: julian
269295 by: Per Jessen
269312 by: Richard Lynch
Re: Curl doesn't handle memory stream
269307 by: Richard Lynch
open source PHP/MySQL image viewing application
269311 by: Bruce Gilbert
Re: Security scanner
269316 by: Richard Lynch
Re: Exception handling with file()
269317 by: Richard Lynch
Re: \n problems when creating an email
269318 by: Richard Lynch
Re: Trouble with PHP server script
269319 by: Richard Lynch
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
On Thu, 2008-02-14 at 09:29 +0100, Zoltán Németh wrote:
> and by the way, symfony has YAML configuration files and a plugin for
> REST services.
>
and Chisimba does YAML configs in the blog module, REST, SOAP and
XML-RPC services as well as a whole whack of XML-ish things.
--Paul
--
------------------------------------------------------------.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za |
:------------------------------------------------------------:
All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
attached mail follows:
Hi,
i still got no answer. Maybe i did not see it, altough i'm trying to read any
single post. But may be i overlooked it due to high traffic. So now i have
set up a filter (hopefully) copying answers to another folder.
Here is the question: Is it possible to disable validation when using
XSLTProcessor? If yes, how?
When i use xsltproc, the command line tool for the libxslt, i can use the
switch --novalid to subpress validation. This makes a huge difference in
speed. Without validation it is fast enough. With validation it takes far too
long to be acceptable. So how do i use XSLTProcessor from within PHP to
achieve the same result as if using xsltproc --novalid?
Regards
Siegfried
attached mail follows:
On Thu, February 14, 2008 4:24 am, Siegfried Gipp wrote:
> i still got no answer. Maybe i did not see it, altough i'm trying to
> read any
> single post. But may be i overlooked it due to high traffic. So now i
> have
> set up a filter (hopefully) copying answers to another folder.
>
> Here is the question: Is it possible to disable validation when using
> XSLTProcessor? If yes, how?
>
> When i use xsltproc, the command line tool for the libxslt, i can use
> the
> switch --novalid to subpress validation. This makes a huge difference
> in
> speed. Without validation it is fast enough. With validation it takes
> far too
> long to be acceptable. So how do i use XSLTProcessor from within PHP
> to
> achieve the same result as if using xsltproc --novalid?
You may want to try using http://php.net/exec to run your command line
tool and ignore the PHP one, if it won't let you turn off validation.
You could also consider filing a "Feature Request" in
http://bugs.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?
attached mail follows:
Pauau schreef:
> 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.
the engine doesn't give 2 hoots about what you think it should be of course.
'static' doesn't do what you think.
chances are you want to use a private instance property:
<?php
class Foo {
private $i = 0;
public function bar() {
echo $this->i, "\n";
$this->i++;
}
}
$a = new Foo;
$b = new Foo;
$a->bar();
$a->bar();
$a->bar();
$b->bar();
$b->bar();
?>
do please read the OO sections of the manual, some functionality, although named
similarly to other languages, works quite differently - you'll avoid alot of assumption
biting you in the a$$.
>
attached mail follows:
Nathan Nobbe schreef:
> On Feb 13, 2008 8:44 PM, Nirmalya Lahiri <nirmalyalahiri
yahoo.com> wrote:
>
>> --- Pauau <wakamonka747
hotmail.com> 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.
actually it pretty much *is* the same - the static class member will exhibit the
same behaviour, only the scope is different.
> 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.
behaviour is indentical to usage inside standalone functions.
>
> 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
>
attached mail follows:
On Thu, Feb 14, 2008 at 6:37 AM, Jochem Maas <jochem
iamjochem.com> wrote:
> Nathan Nobbe schreef:
> > 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.
>
> actually it pretty much *is* the same - the static class member will
> exhibit the
> same behaviour, only the scope is different.
>
> > 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.
>
> behaviour is indentical to usage inside standalone functions.
thats a gamble since there is no description of how the static keyword
behaves inside class member functions. i for one will stick to static class
variables and instance variables, and avoid this static variable feature
altogether.
-nathan
attached mail follows:
Nathan Nobbe schreef:
> On Thu, Feb 14, 2008 at 6:37 AM, Jochem Maas <jochem
iamjochem.com> wrote:
>
>> Nathan Nobbe schreef:
>>> 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.
>> actually it pretty much *is* the same - the static class member will
>> exhibit the
>> same behaviour, only the scope is different.
>>
>>> 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.
>> behaviour is indentical to usage inside standalone functions.
>
>
> thats a gamble since there is no description of how the static keyword
> behaves inside class member functions. i for one will stick to static class
> variables and instance variables, and avoid this static variable feature
> altogether.
they work the same because they are the same thing. no gamble. nada.
>
> -nathan
>
attached mail follows:
On Thu, Feb 14, 2008 at 9:50 AM, Nathan Nobbe <quickshiftin
gmail.com> wrote:
> On Thu, Feb 14, 2008 at 6:37 AM, Jochem Maas <jochem
iamjochem.com> wrote:
>
> > Nathan Nobbe schreef:
>
> > > 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.
> >
> > actually it pretty much *is* the same - the static class member will
> > exhibit the
> > same behaviour, only the scope is different.
> >
> > > 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.
> >
> > behaviour is indentical to usage inside standalone functions.
>
>
> thats a gamble since there is no description of how the static keyword
> behaves inside class member functions. i for one will stick to static class
> variables and instance variables, and avoid this static variable feature
> altogether.
>
> -nathan
>
Just FYI the static keyword was quite popular in PHP4 for the
singleton pattern. You could do something like:
function getInstance() {
static $instance;
if (empty($instance)) {
$instance =& new Instance;
}
return $instance;
}
I've used it across multiple classes without any real conflicts so it
was fine. Of course I wouldn't do such a thing now that I am working
in 5, but I just thought I'd throw that out there.
attached mail follows:
On Thu, Feb 14, 2008 at 12:10 PM, Eric Butera <eric.butera
gmail.com> wrote:
> On Thu, Feb 14, 2008 at 9:50 AM, Nathan Nobbe <quickshiftin
gmail.com>
> wrote:
> > On Thu, Feb 14, 2008 at 6:37 AM, Jochem Maas <jochem
iamjochem.com>
> wrote:
> >
> > > Nathan Nobbe schreef:
> >
> > > > 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.
> > >
> > > actually it pretty much *is* the same - the static class member will
> > > exhibit the
> > > same behaviour, only the scope is different.
> > >
> > > > 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.
> > >
> > > behaviour is indentical to usage inside standalone functions.
> >
> >
> > thats a gamble since there is no description of how the static keyword
> > behaves inside class member functions. i for one will stick to static
> class
> > variables and instance variables, and avoid this static variable
> feature
> > altogether.
> >
> > -nathan
> >
>
> Just FYI the static keyword was quite popular in PHP4 for the
> singleton pattern. You could do something like:
>
> function getInstance() {
> static $instance;
> if (empty($instance)) {
> $instance =& new Instance;
> }
> return $instance;
> }
>
> I've used it across multiple classes without any real conflicts so it
> was fine. Of course I wouldn't do such a thing now that I am working
> in 5, but I just thought I'd throw that out there.
>
and im certain it was used heavily that way in php4 as well. its also
great for those people who dont want to use classes in their php.
i mainly avoid it as a matter of preference. all im saying from earlier,
is that even if it does work inside class methods, theres no doc out there
that gives the green light on such usage (at least not to my knowledge).
-nathan
attached mail follows:
Nathan Nobbe wrote:
> On Thu, Feb 14, 2008 at 12:10 PM, Eric Butera <eric.butera
gmail.com> wrote:
>
>> On Thu, Feb 14, 2008 at 9:50 AM, Nathan Nobbe <quickshiftin
gmail.com>
>> wrote:
>>> On Thu, Feb 14, 2008 at 6:37 AM, Jochem Maas <jochem
iamjochem.com>
>> wrote:
>>> > Nathan Nobbe schreef:
>>>
>>>>> 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.
>>> >
>>> > actually it pretty much *is* the same - the static class member will
>>> > exhibit the
>>> > same behaviour, only the scope is different.
>>> >
>>> > > 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.
>>> >
>>> > behaviour is indentical to usage inside standalone functions.
>>>
>>>
>>> thats a gamble since there is no description of how the static keyword
>>> behaves inside class member functions. i for one will stick to static
>> class
>>> variables and instance variables, and avoid this static variable
>> feature
>>> altogether.
>>>
>>> -nathan
>>>
>> Just FYI the static keyword was quite popular in PHP4 for the
>> singleton pattern. You could do something like:
>>
>> function getInstance() {
>> static $instance;
>> if (empty($instance)) {
>> $instance =& new Instance;
>> }
>> return $instance;
>> }
>>
>> I've used it across multiple classes without any real conflicts so it
>> was fine. Of course I wouldn't do such a thing now that I am working
>> in 5, but I just thought I'd throw that out there.
>>
>
> and im certain it was used heavily that way in php4 as well. its also
> great for those people who dont want to use classes in their php.
> i mainly avoid it as a matter of preference. all im saying from earlier,
> is that even if it does work inside class methods, theres no doc out there
> that gives the green light on such usage (at least not to my knowledge).
>
> -nathan
>
static variables save your scripts repeating themselves..
class used_all_over_the_place {
private static $bigArrayOfThings;
public function __construct() {
if (!is_array(self::$bigArrayOfThings)) {
$this->complicatedMethodThatFormsArray();
}
}
protected function complicatedMethodThatFormsArray() {
#loads of stuff that would be best not to repeat to often
}
}
#complicatedMethodThatFormsArray is called here
$myclass = new used_all_over_the_place;
function something() {
#complicatedMethodThatFormsArray is NOT called here
$myclass = new used_all_over_the_place;
}
maybe I've gone ot or missed the point of this thread..
attached mail follows:
On Thu, February 14, 2008 11:10 am, Eric Butera wrote:
> Just FYI the static keyword was quite popular in PHP4 for the
> singleton pattern. You could do something like:
I have used and will continue to use the static keyword in functions,
and will most likely never use a class in PHP...
If a website is complicated enough to need a class hierarchy, then
something is wrong in your Design. :-) :-) :-)
--
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?
attached mail follows:
2008. 02. 14, csĂĽtörtök keltezĂ©ssel 14.07-kor Richard Lynch ezt Ărta:
> On Thu, February 14, 2008 11:10 am, Eric Butera wrote:
> > Just FYI the static keyword was quite popular in PHP4 for the
> > singleton pattern. You could do something like:
>
> I have used and will continue to use the static keyword in functions,
> and will most likely never use a class in PHP...
>
> If a website is complicated enough to need a class hierarchy, then
> something is wrong in your Design. :-) :-) :-)
who said we make websites with all those classes and frameworks? ;)
greets
Zoltán Németh
>
> --
> 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?
>
attached mail follows:
On Thu, Feb 14, 2008 at 3:07 PM, Richard Lynch <ceo
l-i-e.com> wrote:
> On Thu, February 14, 2008 11:10 am, Eric Butera wrote:
> > Just FYI the static keyword was quite popular in PHP4 for the
> > singleton pattern. You could do something like:
>
> I have used and will continue to use the static keyword in functions,
> and will most likely never use a class in PHP...
>
> If a website is complicated enough to need a class hierarchy, then
> something is wrong in your Design. :-) :-) :-)
>
> --
> 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?
>
>
Thanks for your opinion! I'll be filing that right into /dev/null. :D
attached mail follows:
On Thu, 2008-02-14 at 15:21 -0500, Eric Butera wrote:
> On Thu, Feb 14, 2008 at 3:07 PM, Richard Lynch <ceo
l-i-e.com> wrote:
> > On Thu, February 14, 2008 11:10 am, Eric Butera wrote:
> > > Just FYI the static keyword was quite popular in PHP4 for the
> > > singleton pattern. You could do something like:
> >
> > I have used and will continue to use the static keyword in functions,
> > and will most likely never use a class in PHP...
> >
> > If a website is complicated enough to need a class hierarchy, then
> > something is wrong in your Design. :-) :-) :-)
There's something wrong with re-usable components that are extended as
separate classes? Weird, I thought that was half the purpose of OOP.
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. |
`------------------------------------------------------------'
attached mail follows:
On Mon, February 11, 2008 1:53 pm, Per Jessen wrote:
> Paul Scott wrote:
>
>> Either that or in a db, but if you are already in clustering, you
>> probably have a memcached instance already right?
>
> Am I right in thinking that memcached will replicate session
> information
> across a cluster, and that your application is only safe as long as
> you
> stick _all_ session-related info in $_SESSION?
Yes and yes...
Tho I suppose you might have some "extra" info in the replicated DB
about the user that would not be crucial to be up-to-the-second
accurate that could be considered part of your "session" data...
--
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?
attached mail follows:
On Mon, February 11, 2008 1:30 pm, mike wrote:
> On 2/11/08, Per Jessen <per
computer.org> wrote:
>> Make sure all requests from the same client go to the same server.
>> This
>> is often done by IP-address.
>
> isn't that an archaic piece of advice?
It can "help" reduce the amount of cross-server data, but it's not a
solution since a user could have multiple IP addresses in a single
session, and multiple users could have the same IP address.
--
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?
attached mail follows:
On Mon, February 11, 2008 3:07 pm, mike wrote:
> actually right now i have an issue on my system i'm working on
> resolving - and it does create some poor experience for users. when
> one of my webservers is taken out of the pool (softly due to a
> healthcheck failure, not via reboot) those clients can get connection
> refused, or connection reset (if mid-connection) - and if anyone is
> uploading or downloading a file, they're screwed too. persistence or
> not, that won't solve this, but it is my note about servers going down
> and the little bit of non-transparency of the failover...
There is some kinda signal you can send to Apache to GRACEFULLY die out.
New connections are refused, but old ones are finished and then the
child exits.
http://apache.org/
There is a "graceful" restart for sure. Perhaps it's just "apachectl
graceful stop"???
--
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?
attached mail follows:
Ritesh Nadhani schreef:
> On Feb 13, 2008 6:03 PM, Richard Lynch <ceo
l-i-e.com> 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 "$file<br />\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)?
the problem with the AJAX approach is the fact that there is absolutely
no reason for a user to sit staring at the screen. hit 'Go' get an
email when it's done, do something else in the mean time.
of course a PHB might demand functionality that gives him/her an excuse to
watch a progress bar ... in which case why not waste man hours making it a
funky web2.0 deal ... heck go the whole hog and use 'comet technique' to
push update info to the browser.
>
attached mail follows:
Am 2008-02-13 04:28:46, schrieb Ritesh Nadhani:
> 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
You can use a resized window (JS required) which automaticaly
refresh all 2 seconds and show the status of the taring...
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)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFHtCRhC0FPBMSS+BIRAmeDAJ9Z5VhgdFx8yFbi1MQN/oVfm/I84ACdHtCI
tOpLW4UgGvyW3juM3lY5cQs=
=ggXF
-----END PGP SIGNATURE-----
attached mail follows:
Jochem Maas wrote:
> Ritesh Nadhani schreef:
>> On Feb 13, 2008 6:03 PM, Richard Lynch <ceo
l-i-e.com> 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 "$file<br />\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)?
>
> the problem with the AJAX approach is the fact that there is absolutely
> no reason for a user to sit staring at the screen. hit 'Go' get an
> email when it's done, do something else in the mean time.
>
> of course a PHB might demand functionality that gives him/her an excuse to
> watch a progress bar ... in which case why not waste man hours making it a
> funky web2.0 deal ... heck go the whole hog and use 'comet technique' to
> push update info to the browser.
>
>>
Can't see any problem with going down the ajax route myself (depending
on how many concurrent users you expect) - A simple ajax style poll
every second would suffice.
You could always use the fancily named yet really old "comet technique"
aswell.. slap the script in a "magic" iframe and ob_flush whenever you
have new data to send.
To be honeswt, both are trade-offs on a technology which isn't around
yet. With ajax you've got to spawn a new thread for every request (say 1
per second, 100 concurrent users, that's 100 requests per second minimum
on your server) OR with comet you've got 100 long lasting worker threads
going.
If you do go comet, it's worth investigating mod event for apache 2.*
http://httpd.apache.org/docs/2.2/mod/event.html
Nath
attached mail follows:
Thanks all.
I will work on all the options and let you know how it went :)
On Thu, Feb 14, 2008 at 10:37 AM, Nathan Rixham <nrixham
gmail.com> wrote:
>
> Jochem Maas wrote:
> > Ritesh Nadhani schreef:
> >> On Feb 13, 2008 6:03 PM, Richard Lynch <ceo
l-i-e.com> 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 "$file<br />\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)?
> >
> > the problem with the AJAX approach is the fact that there is absolutely
> > no reason for a user to sit staring at the screen. hit 'Go' get an
> > email when it's done, do something else in the mean time.
> >
> > of course a PHB might demand functionality that gives him/her an excuse to
> > watch a progress bar ... in which case why not waste man hours making it a
> > funky web2.0 deal ... heck go the whole hog and use 'comet technique' to
> > push update info to the browser.
> >
> >>
>
> Can't see any problem with going down the ajax route myself (depending
> on how many concurrent users you expect) - A simple ajax style poll
> every second would suffice.
>
> You could always use the fancily named yet really old "comet technique"
> aswell.. slap the script in a "magic" iframe and ob_flush whenever you
> have new data to send.
>
> To be honeswt, both are trade-offs on a technology which isn't around
> yet. With ajax you've got to spawn a new thread for every request (say 1
> per second, 100 concurrent users, that's 100 requests per second minimum
> on your server) OR with comet you've got 100 long lasting worker threads
> going.
>
> If you do go comet, it's worth investigating mod event for apache 2.*
> http://httpd.apache.org/docs/2.2/mod/event.html
>
> Nath
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Ritesh
http://www.riteshn.com
attached mail follows:
On Fri, 8 Feb 2008, Per Jessen wrote:
> Hiep Nguyen wrote:
>
>> let say that user searched and found 10 records,
>> in the meantime, other users may change any of these 10 records,
>> so if we saved mysql statement and re-run mysql statement again, the
>> result might be different. to prevent this problem, i only want to
>> download records that returned on this page only.
>
> This is more of a caching issue - then you determine how long you want
> to keep the results for, and only re-run the mysql query when the
> results have gone stale.
>
>
> /Per Jessen, ZĂĽrich
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
in the last couple days, i've looked into php $_SESSION and kinda get the
concept. my question is can i use $_SESSION to store mysql statement?
what is the pro/con to store mysql statement in $_SESSION?
with $_COOKIE, i can use setrawcookie to avoid urlencoding. is ther
anything similar in $_SESSION?
thanks,
t. hiep
attached mail follows:
--- Hiep Nguyen <hiep
ee.ucr.edu> wrote:
> On Fri, 8 Feb 2008, Per Jessen wrote:
>
> > Hiep Nguyen wrote:
> >
> >> let say that user searched and found 10 records,
> >> in the meantime, other users may change any of these 10 records,
> >> so if we saved mysql statement and re-run mysql statement again,
> the
> >> result might be different. to prevent this problem, i only want
> to
> >> download records that returned on this page only.
> >
> > This is more of a caching issue - then you determine how long you
> want
> > to keep the results for, and only re-run the mysql query when the
> > results have gone stale.
> >
> >
> > /Per Jessen, Zürich
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> in the last couple days, i've looked into php $_SESSION and kinda
> get the
> concept. my question is can i use $_SESSION to store mysql
> statement?
> what is the pro/con to store mysql statement in $_SESSION?
> with $_COOKIE, i can use setrawcookie to avoid urlencoding. is
> ther
> anything similar in $_SESSION?
>
> thanks,
> t. hiep
Hiep,
There is no need to use "setraw" in case of session. Because every
session variable keeps its value as it is assign to it. Where as in
case of cookie by default browser encode the cookie in urlencoding
format. To stop this feature of browser we use setrawcookie() function.
---
Nirmalya Lahiri
[+91-9433113536]
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
attached mail follows:
On Thu, Feb 14, 2008 at 9:23 AM, Hiep Nguyen <hiep
ee.ucr.edu> wrote:
> On Fri, 8 Feb 2008, Per Jessen wrote:
>
> > Hiep Nguyen wrote:
> >
> >> let say that user searched and found 10 records,
> >> in the meantime, other users may change any of these 10 records,
> >> so if we saved mysql statement and re-run mysql statement again, the
> >> result might be different. to prevent this problem, i only want to
> >> download records that returned on this page only.
> >
> > This is more of a caching issue - then you determine how long you want
> > to keep the results for, and only re-run the mysql query when the
> > results have gone stale.
> >
> >
> > /Per Jessen, ZĂĽrich
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> in the last couple days, i've looked into php $_SESSION and kinda get the
> concept. my question is can i use $_SESSION to store mysql statement?
> what is the pro/con to store mysql statement in $_SESSION?
> with $_COOKIE, i can use setrawcookie to avoid urlencoding. is ther
> anything similar in $_SESSION?
>
> thanks,
> t. hiep
>
>
You can easily store a SQL statement in $_SESSION since the statement
is just a string. Are you asking if you can store the *result* of the
statement execution in $_SESSION?
You shouldn't store the SQL statement in cookies. It gives the end
user way too much insight into your DB implementation if they can see
the actual statement that you will be issuing to the database and it's
an even bigger security risk for SQL injection than simply using raw,
unescaped form input in a statement without validation! The attacker
doesn't even have to think how to create a parameter to escape out of
your statement - they can send you "DELETE FROM mysql.user" or any
other wonderful thing they like. Granted, your script should not be
using a db user account that has privileges to execute such a
statement, but that should give you a clue that this would be a VERY
bad idea.
URL encoding/decoding isn't really an issue with sessions since the
session data is stored internally on the server and does not have to
be urlencoded to be sent between the server and the browser in an HTTP
header.
Andrew
attached mail follows:
Hi,
I am using phpmailer currently to send email from my applications. My
ISP is restricting the usage of email without SSL/TLS and my SMTP
connections have started to fail...
Any hints on the best approach to send email from php appplciations ?, I
wish I could use my standard gmail/yahoo accounts.... like my desktop
email program...
Any help appreciated.
Thanks.
JCG
attached mail follows:
julian wrote:
> I am using phpmailer currently to send email from my applications. My
> ISP is restricting the usage of email without SSL/TLS and my SMTP
> connections have started to fail...
>
> Any hints on the best approach to send email from php appplciations ?,
I think the best way is to have a local MTA (e.g. postfix), to which
mail()/sendmail can simply drop emails in the filesystem.
/Per Jessen, ZĂĽrich
attached mail follows:
On Thu, February 14, 2008 8:34 am, julian wrote:
> I am using phpmailer currently to send email from my applications. My
> ISP is restricting the usage of email without SSL/TLS and my SMTP
> connections have started to fail...
>
> Any hints on the best approach to send email from php appplciations ?,
> I
> wish I could use my standard gmail/yahoo accounts.... like my desktop
> email program...
Often times, you can write a tiny shell script to connect using an
authentication password to the mail server, and then the rest go
through as you are already authenticated...
Not sure this applies to TLS/SSL, but it's worth a try.
--
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?
attached mail follows:
On Wed, February 13, 2008 8:19 pm, Nathan Nobbe wrote:
> On Feb 13, 2008 6:52 PM, Richard Lynch <ceo
l-i-e.com> 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, ummmm... 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 :)
Having seen your sample code, it probably IS within the PHP code,
since you are passing a file handle to curl -- and it should behave as
a proper file handle, in an ideal world, as far as curl is
concerned...
But then curl may be doing something funky with it and making invalid
assumptions too...
--
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?
attached mail follows:
can anyone reccomend an open source PHP/MySQL based image viewing
application. I am looking to store the images in MySQL and have a
viewer on the page with the option to click to the next image and
back, possibly with the display of an enlarged image as well as the
option to click on thumbnails below.
this may also be somehting I could look into creating from scratch,
but I dodn't want to re-invent the wheel if I don't have to...
--
::Bruce::
attached mail follows:
On Mon, February 11, 2008 9:27 am, Emil Edeholt wrote:
> Thanks. Sure, I know how to escape and filter the input.. But since
> not
> all my sites use PDO yet, and I use some external code it would be a
> good idea to also use an sql injection scanner.
Scanning for SQL injection is like a "blacklist" approach -- always
bound to be another injection you didn't think of.
Validating the data and using mysql_real_escape_string is the
"whitelist" approach -- You specifically require the data to be of the
correct format, and you get MySQL to delimit it properly as DATA and
not SQL CODE.
--
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?
attached mail follows:
On Mon, February 11, 2008 6:34 am, John Papas wrote:
> I need to open a remote file with file() and I would like to put it
> inside a try-catch but as far as I can tell file() does not raise an
> exception if it fails. The following code:
>
> try {
> $data = file('http://myserver.com/myfile.txt');
> $date = substr($data, 0);
> } catch (Exception $e) {
> $data = "it failed";
> }
>
> echo $data;
>
> echoes a warning:
>
> Warning: file('http://myserver.com/myfile.txt') [function.file]:
> failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
> in.....
Old-school PHP functions do not (and will not) raise exceptions.
Use http://php.net/set_error_handler
--
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?
attached mail follows:
If the recipient is gmail, then you need to use \r\n because Gmail is
following in the Windows way of ignoring standards... :-(
On Mon, February 11, 2008 6:10 am, Angelo Zanetti wrote:
> Hi guys,
>
> I am making email text based on some fields the user fills in and then
> email
> the admin the details.
>
> I am having a problem where sometimes the \n (new line) works and
> sometimes
> it just does nothing. Im not sure the cause but I cant seem to figure
> it
> out.
>
> Here is a segment of code:
>
> ."\nHow far would they be
> prepared to travel to "
> ."\n event venue?
> \n\t\t\t\t\t". $travel
>
> ."\nDo you have a specific
> location "
> ." \n of preference?
> \n\t\t\t\t\t". $locationPref
> ."\n City or country
> preference:\t". $cityPref
>
>
> Here is the output:
>
> How far would they be prepared to travel to event venue?
> Z Logic e Business Cape
> Do you have a specific location
> of preference?
> Z Logic e Business Cape
> City or country preference: Z Logic e Business Cape
>
>
> As you can see the first line doesn't go to the next row before
> "event"
>
> But it works fine for the location \n preference
>
> Is there any reason it works for the 1 piece of code and not the next?
> Do
> spaces affect anything?
>
>
> Kind regards,
> Angelo Zanetti
> Application Developer
> ________________________________
>
>
> Telephone: +27 (021) 552 9799
> Mobile: +27 (0) 72 441 3355
> Fax: +27 (0) 86 681 5885
>
> Web: http://www.elemental.co.za
> E-Mail: angelo
elemental.co.za
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
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?
attached mail follows:
On Sun, February 10, 2008 9:09 pm, Robert Cox wrote:
> Is it possible to use the "$_SERVER['PHP_AUTH_USER'];" construct in a
> URL
> forwarded site? I am trying to find the authorised user id so that I
> can
> access an SQL database with it. Anyone got some ideas?
If you do a Location: with a FULL URL then the browser will forward
POST and I think AUTH data.
If you use a partial URL, it seems to work, but IE will decide not to
forward that data.
It is in the spec that you need the full URL, starting with http://
for a Location header.
This may (or may not) be what is messing you up.
--
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?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]