php-general Digest 23 Mar 2010 14:50:12 -0000 Issue 6655

2010-03-23 Thread php-general-digest-help

php-general Digest 23 Mar 2010 14:50:12 - Issue 6655

Topics (messages 303120 through 303142):

PHP to access shell script to print barcodes
303120 by: Rob Gould
303125 by: Jochem Maas
303137 by: Richard Quadling

Re: Will PHP ever grow up and have threading?
303121 by: Tommy Pham
303122 by: Teus Benschop
303123 by: Larry Garfield
303124 by: Jochem Maas
303126 by: Rene Veerman
303127 by: Tommy Pham
303128 by: Tommy Pham
303129 by: Per Jessen
303130 by: jose javier parra sanchez
303133 by: Rene Veerman
303136 by: David McGlone
303138 by: Richard Quadling
303140 by: Michael A. Peters

Re: Filtering all output to STDERR
303131 by: Marten Lehmann
303135 by: Peter Lind

constants STDOUT, STDERR, STDIN not working in 5.2.x?
303132 by: Marten Lehmann
303134 by: Jan G.B.
303141 by: Daniel Egeberg
303142 by: Jan G.B.

Re: another question on setting include paths for a project
303139 by: Robert P. J. Day

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
I am trying to replicate the functionality that I see on this site:

http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/

Notice after you hit SUBMIT QUERY, you get a PDF file with a page of barcodes.  
That's _exactly_ what I'm after.
Fortunately, the author gives step-by-step instructions on how to do this on 
this page:

http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/


So I've gotten through all the steps, and have created the 
barcode_with_samples.ps file, and have it hosted here:

http://www.winecarepro.com/kiosk/fast/shell/

Notice how the last few lines contain the shell-script that renders the 
postscript:

#!/bin/bash

BASE=”100″;
NR=$BASE

for hor in 30 220 410
do
ver=740
while [ $ver -ge 40 ];
do
printf -v FNR “(%06dL3)” $NR
echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode”
let ver=$ver-70
let NR=NR+1
done
done


I need to somehow create a PHP script that executes this shell script.  And 
after doing some research, it sounds like
I need to use the PHP exec command, so I do that with the following file:

http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php

Which has the following script:

?php 

$command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;;
exec($command, $arr);

echo $arr;

?


And, as you can see, nothing works.  I guess firstly, I'd like to know:

A)  Is this PHP exec call really the way to go with executing this shell 
script?  Is there a better way?  It seems to me like it's not really executing.
B)  Can someone try following the 5 steps listed on the website 
(http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/) and tell me if you 
have any better luck?  It doesn't really sound all that difficult.  I'm hosting 
this on Dreamhost, and I'm not sure if there's some sort of permissions/shell 
exec feature I need to make this work.  I'm not convinced that I really have a 
functioning Postscript file.  My Mac renders Postscript files automatically 
after downloading with the Preview app, and I'm not seeing any valid data 
returned.


---End Message---
---BeginMessage---
Op 3/23/10 3:27 AM, Rob Gould schreef:
 I am trying to replicate the functionality that I see on this site:
 
 http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/
 
 Notice after you hit SUBMIT QUERY, you get a PDF file with a page of 
 barcodes.  That's _exactly_ what I'm after.
 Fortunately, the author gives step-by-step instructions on how to do this on 
 this page:
 
 http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/
 
 
 So I've gotten through all the steps, and have created the 
 barcode_with_samples.ps file, and have it hosted here:
 
 http://www.winecarepro.com/kiosk/fast/shell/
 
 Notice how the last few lines contain the shell-script that renders the 
 postscript:
 
 #!/bin/bash
 
 BASE=”100″;
 NR=$BASE
 
 for hor in 30 220 410
 do
 ver=740
 while [ $ver -ge 40 ];
 do
 printf -v FNR “(%06dL3)” $NR
 echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode”
 let ver=$ver-70
 let NR=NR+1
 done
 done
 
 
 I need to somehow create a PHP script that executes this shell script.  And 
 after doing some research, it sounds like
 I need to use the PHP exec command, so I do that with the following file:
 
 http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php
 
 Which has the following script:
 
 ?php 
 
 $command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;;
 exec($command, $arr);
 
 echo $arr;
 
 ?
 
 
 And, as you can see, nothing works.  I guess firstly, I'd like to 

Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Rene Veerman
ExecSum:
*   +1 for better threading features in PHP.
*   overloading = inheritance?
*   listreaders plz allow ppl to vent some frustration without
starting a flamewar.

Threading can be implemented in PHP with an
fopen('http://yourserver.com/url')-fread()_all_threads+usleep(50ms)-fclose()+process
loop.

My own newsscraper threads well like this.
The central script figures out what sites to scrape, and the treaded
subsystem makes sure 1 page per site per N seconds is retrieved.

But i've yet to find a way to keep global objects in memory between
http requests, outside $_SESSION, which i believe is just stored to-
and loaded from disk between http requests.

However, now that i think of it, you could have large pieces of
software stay in memory in a single php script that runs forever and
reads commands (as arrays) out of files (on memory disk?) (put there
by thread-scripts) and [the forever running script] outputs to
stdout, which is caught by the thread-scripts, then passed back to the
thread-caller via fread().
I usually use json for such constructs.
But it's a total hack of course, and i have no idea about performance
issues or even timing bugs. it's theoretically possible..

there is NO reason NOT to let
 the developer choose WHICH of the list of parameters they want to set in a
 function/method call aside from being stubborn! Especially when there are
 many parameters and you can't overload functions like you can in Java

well you could shove all the params in an array, then shove that to
the function called, _or_ a preparatory function that calls the old
function.

as for overloading functions, i think with a bit of cleverness you can
come up with a class / set of functions that simulate overloading of
functions and even inheritance. i for a fact simulate polymorphism
with $functionName_fromPluginX ($params).
i smell all the ingredients that would allow you to overload functions
in php aswell. you'd just have to call things a bit differently,
perhaps like
$var = $overloadingManager-call ('functionName',
'context(object-instance-id)', $param1, $param2).

Better yet; aren't OOP's (and php5's) inheritance features (for
classes) similar to functions overloading? k, it forces you to group
such functions into an object, and derivations into subobjects, but
that's not a show-stopper at all.. You can always ignore the object
boundary and have 1 object-tree for all functions that require
overloading.


 lastly, about the politics of this mail-thread;
imo, it's the ones who open the counterattack who start the
flamewar, out of something that is clearly in this case just venting
some frustration with at least partially valid reasons..

imo, it would be wiser to have offered the guy some actual tips and/or
a casual hey, you could've phrased it friendlier, given the fact that
php costs nothing and all, dude, rather than grabbing the
flamethrower and setting it to vaporize.

On Tue, Mar 23, 2010 at 1:02 AM, Daevid Vincent dae...@daevid.com wrote:
 I've been using PHP for a decade or so (since PHP/FI) and love it. The one
 problem that seems to always keep coming back on enterprise level projects
 is the lack of threading. This always means we have to write some back-end
 code in Ruby or Java or C/C++ and some hacky database layer or DBUS or
 something to communicate with PHP.

 Will PHP ever have proper threading? It would sure let the language take
 the next logical leap to writing applications and daemons. I love the idea
 that Rails/Ruby have where you can just load objects in memory once and
 keep using them from page to page (this is NOT the same as a $_SESSION,
 it's way more flexible and powerful).

 But more importantly, in one application I'm working on, we need to connect
 to an Asterisk system for the IVR abilities. This means we have Ruby doing
 all that fun stuff and PHP doing the web stuff, but we're also duplicating
 a LOT of work. Both Ruby AND PHP now have to have ORMs for the user who's
 calling in, advertisements served, products shown, etc. We could have used
 Rails for the web portion, but I want to stay with PHP and I'm sure I don't
 have to explain to you PHPers why that is. Without threads, PHP just isn't
 even an option or only one user would be able to call in at a time.

 The pcntl stuff is not feasible. It's a hack at best. Spawning multiple
 scripts is also a recipie for disaster.

 When will the PHP core-devs (Zend?) realize that PHP is much more than a
 hook to a database. It's much more than web pages.

 Is this a case of it's too hard? Or is it a case of PHP core developers
 just being douche-bags like they are about the whole
 foo($set_this_parameter=$bar); bull$hit??! (there is NO reason NOT to let
 the developer choose WHICH of the list of parameters they want to set in a
 function/method call aside from being stubborn! Especially when there are
 many parameters and you can't overload functions like you can in Java or
 other typed languages)

 As usual, I created a poll here 

Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Tommy Pham
On Mon, Mar 22, 2010 at 10:01 PM, Larry Garfield la...@garfieldtech.com wrote:
 On Monday 22 March 2010 10:51:14 pm Tommy Pham wrote:
 Threading is one of the 2 two main reasons why I moved to Java 
 asp.net (C#).  I've built a PHP based web crawler about 10 years ago.
 I ran into some problems: cookies, form handling and submission,
 threading, and application variables.  I later found some solutions
 for cookies, form handling  submission.  But no solution for
 threading and application variables.  Thus the move.  Here's a simple
 example of one of the many uses for threading.  For an e-commerce
 site,  when the shopper requests for a category (ID), you can have a
 thread to get all subcategories for that category, another thread to
 get any assigned products,  another thread to fetch all manufacturers
 listed under that category, another thread to fetch any filters (price
 ranges, features, specs, etc) set by the store owner that would fall
 under that category, etc...  versus what PHP currently doing now:
 fetch subcategories, then fetch assigned products, then fetch
 manufacturers, etc  Performance would increase ten fold because of
 parallel (threading) operations versus serial operations.  Add that to
 application variable (less memory usage and CPU cycles due to
 creating/GC of variables that could be used for an entire application
 regardless of requests  sessions), you have an excellent tool.

 Regards,
 Tommy

 Threading is also much more difficult to program for safely, because thread
 order is non-deterministic.  Do you really want to unleash hoards of
 marginally competent programmers on a threaded enviornment? :-)

Marginally competent?  I think some, if not many, on this list will
disagree with that ;)


 Also, the architecture you describe above is fine if you're scaling a single
 server really big.  PHP is designed to scale the other direction: Just add
 more servers.  There's no data shared from one request to another, so there's
 no need to share data between web heads.  Throw a load balancer in front of it
 and spin up as many web servers as you need.

Load balancer is used when the server is overloaded with requests and
upgrade has reached it's limit.  That's not the same thing as a simple
request where multiple answers are needed as in my example.  If you're
thinking of implementing something like my example across multiple
servers (where each server will fetch an answer for a simple request)
via another method, then you're going to face similar issues as
threading ie session/request sync which is equivalent to thread
safety/sync/deadlock but now it's worse because it's spread across
network where performance issues comes in because internal system IO 
(network IO + internal system IO).


 The shared nothing design is very deliberate.  It has design trade-offs like
 anything else.

 PHP is a web-centric language.  It's not really intended for building tier-1
 daemon processes, just like you'd be an idiot to try and code your entire web
 app in C from the start.

Of course since C was engineered to create OSes and (text based) apps
when SMP/MC is unheard of.  But we're now in the digital era where
SMP/MC is very common place.  In fact, trying to buy a new
desktop/laptop now without a multicore becomes very difficult and
undesired.  Why not make use of the SMP/MC? :)  PHP seems strive and
somewhat 'imitate' languages like java  asp.net.  Not trying to go
off topice but for example: namespace (namespace in asp.net and
packages in java).  For many of us that don't use namespace now or
even when it's not yet implemented, we (PHP web app dev) already
implement our own version of it - subfolders.  So why not copy or
imitate the features that would be more beneficial if not more
usability ie threading?  PHP is already ahead of java  asp.net in
terms of generics, not strong typed.

Regards,
Tommy


 --Larry Garfield

 --
 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] Will PHP ever grow up and have threading?

2010-03-23 Thread Tommy Pham
Here's another analogy.  For those of us in the field long enough, we
see the power of AJAX and we use it in one form or another.  For the
newbies, they have yet to see it's power nor the requirements to
implement it.  Threading is similar to that.  It's not for everybody.
But for those of us that are ready and have need for it, we can
implement it IF IT'S THERE, which is the point of OP, although the way
he put it isn't exactly welcoming... perhaps he had a very long week
and it's just starting too.

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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Per Jessen
Daevid Vincent wrote:

 I've been using PHP for a decade or so (since PHP/FI) and love it. The
 one problem that seems to always keep coming back on enterprise level
 projects is the lack of threading. This always means we have to write
 some back-end code in Ruby or Java or C/C++ and some hacky database
 layer or DBUS or something to communicate with PHP.

Use the right tool for the right job - PHP is a scripting/interpreted
language, it does not need threading (IMO of course).


-- 
Per Jessen, Zürich (9.4°C)


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



Re: [PHP] Filtering all output to STDERR

2010-03-23 Thread Marten Lehmann

Have you tried with
http://dk2.php.net/manual/en/function.error-reporting.php or just the
@ operator?


Yes. But this does not work, because error levels and the @ operator 
only relate to errors thrown by the PHP runtime and have nothing to do 
with STDERR.


But I need a way to close the STDERR file handle at the beginning of a 
script or at least catch and remove all output sent to STDERR.


Regards
Marten

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



[PHP] constants STDOUT, STDERR, STDIN not working in 5.2.x?

2010-03-23 Thread Marten Lehmann

Hello,

I found different code examples like this, which use the file handle 
STDERR just like this:


?php
fwrite(STDERR, hello\n);
?

Also, the PHP documentation of input/output streams 
(http://php.net/manual/de/wrappers.php.php) says:


It is recommended that you simply use the constants STDIN, STDOUT  and 
STDERR instead of manually opening streams using these wrappers.


I don't want to use the php://stderr wrapper, because this just 
creates a duplicate of the original STDERR handler and if I'm closing 
php://stderr, the original STDERR still would exist.


When I'm using this code, I only get:

bNotice/b:  Use of undefined constant STDERR - assumed 'STDERR' in 
b/test.php/b on line b4/bbr /

br /
bWarning/b:  fwrite(): supplied argument is not a valid stream 
resource in b/test.php/b on line b4/bbr /


How can I access the original STDERR handle? The constant should be 
there, but does not exist.


regards
Marten

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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Rene Veerman
hmm i use scripted languages because i prefer and they allow/force
simple-to-read-code.

but that does not mean a scripted language can't evolve to expose
complicated code constructs like multi-threading and daemon-building
in a simple manner too.

i'd prefer it if a language like PHP can be used for other things
besides webserving too.
i also think at least some web-apps could benefit from multi-threading
and daemon-building.. particularly web-apps that deal with real-time
dataflows.

and btw, the distinction between compiled and scripted is not a hard
one anymore eh.. not with zend and that facebook php-compiler out
there.

On Tue, Mar 23, 2010 at 10:04 AM, Per Jessen p...@computer.org wrote:
 Daevid Vincent wrote:

 I've been using PHP for a decade or so (since PHP/FI) and love it. The
 one problem that seems to always keep coming back on enterprise level
 projects is the lack of threading. This always means we have to write
 some back-end code in Ruby or Java or C/C++ and some hacky database
 layer or DBUS or something to communicate with PHP.

 Use the right tool for the right job - PHP is a scripting/interpreted
 language, it does not need threading (IMO of course).


 --
 Per Jessen, Zürich (9.4°C)


 --
 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] constants STDOUT, STDERR, STDIN not working in 5.2.x?

2010-03-23 Thread Jan G.B.
2010/3/23 Marten Lehmann lehm...@cnm.de

 Hello,

 I found different code examples like this, which use the file handle STDERR
 just like this:

 ?php
 fwrite(STDERR, hello\n);
 ?

 Also, the PHP documentation of input/output streams (
 http://php.net/manual/de/wrappers.php.php) says:

 It is recommended that you simply use the constants STDIN, STDOUT  and
 STDERR instead of manually opening streams using these wrappers.

 I don't want to use the php://stderr wrapper, because this just creates a
 duplicate of the original STDERR handler and if I'm closing php://stderr,
 the original STDERR still would exist.

 When I'm using this code, I only get:

 bNotice/b:  Use of undefined constant STDERR - assumed 'STDERR' in
 b/test.php/b on line b4/bbr /
 br /
 bWarning/b:  fwrite(): supplied argument is not a valid stream resource
 in b/test.php/b on line b4/bbr /

 How can I access the original STDERR handle? The constant should be there,
 but does not exist.

 regards
 Marten


Hi,

I can reproduce it with some differences. Check this out:

 $ php --version
PHP 5.2.10-2ubuntu6.4 with Suhosin-Patch 0.9.7 (cli) (built: Jan  6 2010
22:56:44)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

$ php 1/dev/null # note that the PHP error messages are
displayed on STDOUT - I don't show them with 1/dev/null
?
$x = fopen('php://stderr', 'r'); fwrite($x, test\n); fclose($x);
$x = fopen(STDERR, 'r'); fwrite($x, test2\n); fclose($x); ?

?
fwrite(STDERR, test3\n);
fwrite ('php://stderr', test4);
?
---

Result:

test




So my assumption is, that the quoted recommendation is outdated / wrong.

Regards


PS: PHP reports this when giving the constant STDERR:
  Warning: fopen(STDERR): failed to open stream: No such file or directory
  Warning: fwrite(): supplied argument is not a valid stream resource


Re: [PHP] Filtering all output to STDERR

2010-03-23 Thread Peter Lind
Ahh, I see why my suggestions had no effect - I assumed you were
dealing with normal php errors, not something done customly by the
code.

I'm afraid the only option I see is that of debugging the problem
script to find out where it opens STDERR - if you're certain that the
script specifically outputs messages to STDERR, then it's opening that
stream somewhere before the output.

Regards
Peter

On 23 March 2010 11:28, Marten Lehmann lehm...@cnm.de wrote:
 Have you tried with
 http://dk2.php.net/manual/en/function.error-reporting.php or just the
 @ operator?

 Yes. But this does not work, because error levels and the @ operator only
 relate to errors thrown by the PHP runtime and have nothing to do with
 STDERR.

 But I need a way to close the STDERR file handle at the beginning of a
 script or at least catch and remove all output sent to STDERR.

 Regards
 Marten

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





-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
/hype

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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread David McGlone
   You could implement the features yourself.
 
  Damn, Mr McGlone beat me to it :)
 
 That's such a STUPID retort I'm so sick of hearing from the FOSS community.
 build it yourself uh huhh uhhh huhhh. Obviously I'm not a low-level C/C++
 coder -- that's WHY I use PHP. :-\ So, you just stay content with the
 status quo. I will continue to ask for features to enhance the language.
 They may fall on deaf ears, but sometimes... just sometimes... The squeaky
 wheel get's the grease.

I didn't intend for my reply to sound nasty. After reading your OP, I see that 
you are a very experienced programmer and I meant for it as a suggestion.

-- 
Blessings
David M.
I have been driven to my knees many times by the overwhelming conviction that 
I had nowhere else to go.

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



Re: [PHP] PHP to access shell script to print barcodes

2010-03-23 Thread Richard Quadling
On 23 March 2010 05:48, Jochem Maas joc...@iamjochem.com wrote:
 Op 3/23/10 3:27 AM, Rob Gould schreef:
 I am trying to replicate the functionality that I see on this site:

 http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/

 Notice after you hit SUBMIT QUERY, you get a PDF file with a page of 
 barcodes.  That's _exactly_ what I'm after.
 Fortunately, the author gives step-by-step instructions on how to do this on 
 this page:

 http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/


 So I've gotten through all the steps, and have created the 
 barcode_with_samples.ps file, and have it hosted here:

 http://www.winecarepro.com/kiosk/fast/shell/

 Notice how the last few lines contain the shell-script that renders the 
 postscript:

 #!/bin/bash

 BASE=”100″;
 NR=$BASE

 for hor in 30 220 410
 do
 ver=740
 while [ $ver -ge 40 ];
 do
 printf -v FNR “(%06dL3)” $NR
 echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode”
 let ver=$ver-70
 let NR=NR+1
 done
 done


 I need to somehow create a PHP script that executes this shell script.  
 And after doing some research, it sounds like
 I need to use the PHP exec command, so I do that with the following file:

 http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php

 Which has the following script:

 ?php

 $command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;;
 exec($command, $arr);

 echo $arr;

 ?


 And, as you can see, nothing works.  I guess firstly, I'd like to know:

 A)  Is this PHP exec call really the way to go with executing this shell 
 script?  Is there a better way?  It seems to me like it's not really 
 executing.

 that's what exec() is for. $command need to contain a *local* path to the 
 command in question, currently your
 trying to pass a url to bash ... which obviously doesn't do much.

 the shell script in question needs to have the executable bit set in order to 
 run (either that or change to command to
 run bash with your script as an argument)

 I'd also suggest putting the shell script outside of your webroot, or at 
 least in a directory that's not accessable
 from the web.

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



I think this is a translation of the script to PHP.

?php
$BASE = 100;
$NR   = $BASE;

foreach(array(30, 220, 410) as $hor) {
$ver = 740;
while ($ver = 40) {
printf($hor $ver moveto (%06dL3) (includetext height=0.55) 
code39
barcode\n, $NR);
$ver -= 70;
++$NR;
}
}



It produces output like ...

30 740 moveto (000100L3) (includetext height=0.55) code39 barcode
30 670 moveto (000101L3) (includetext height=0.55) code39 barcode
30 600 moveto (000102L3) (includetext height=0.55) code39 barcode
30 530 moveto (000103L3) (includetext height=0.55) code39 barcode
30 460 moveto (000104L3) (includetext height=0.55) code39 barcode
30 390 moveto (000105L3) (includetext height=0.55) code39 barcode
30 320 moveto (000106L3) (includetext height=0.55) code39 barcode
30 250 moveto (000107L3) (includetext height=0.55) code39 barcode
30 180 moveto (000108L3) (includetext height=0.55) code39 barcode
30 110 moveto (000109L3) (includetext height=0.55) code39 barcode
30 40 moveto (000110L3) (includetext height=0.55) code39 barcode
220 740 moveto (000111L3) (includetext height=0.55) code39 barcode
220 670 moveto (000112L3) (includetext height=0.55) code39 barcode
220 600 moveto (000113L3) (includetext height=0.55) code39 barcode
220 530 moveto (000114L3) (includetext height=0.55) code39 barcode
220 460 moveto (000115L3) (includetext height=0.55) code39 barcode
220 390 moveto (000116L3) (includetext height=0.55) code39 barcode
220 320 moveto (000117L3) (includetext height=0.55) code39 barcode
220 250 moveto (000118L3) (includetext height=0.55) code39 barcode
220 180 moveto (000119L3) (includetext height=0.55) code39 barcode
220 110 moveto (000120L3) (includetext height=0.55) code39 barcode
220 40 moveto (000121L3) (includetext height=0.55) code39 barcode
410 740 moveto (000122L3) (includetext height=0.55) code39 barcode
410 670 moveto (000123L3) (includetext height=0.55) code39 barcode
410 600 moveto (000124L3) (includetext height=0.55) code39 barcode
410 530 moveto (000125L3) (includetext height=0.55) code39 barcode
410 460 moveto (000126L3) (includetext height=0.55) code39 barcode
410 390 moveto (000127L3) (includetext height=0.55) code39 barcode
410 320 moveto (000128L3) (includetext height=0.55) code39 barcode
410 250 moveto (000129L3) (includetext height=0.55) code39 barcode
410 180 moveto (000130L3) (includetext height=0.55) code39 barcode
410 110 moveto (000131L3) (includetext height=0.55) code39 barcode
410 40 moveto (000132L3) (includetext height=0.55) code39 barcode


No idea if that is accurate or not. If you can run the script by hand
once to confirm, then
-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : 

Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Richard Quadling
On 23 March 2010 00:02, Daevid Vincent dae...@daevid.com wrote:
 douche-bags

I think this is about the best way to get the wrong attention.

Not everyone has a sense of humour like yours.

Maybe no one has a sense of humour like yours.

Good luck.

Richard.

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] another question on setting include paths for a project

2010-03-23 Thread Robert P. J. Day
On Mon, 22 Mar 2010, Nilesh Govindarajan wrote:

 What I do is, set the include path in the top-level bootstrapper.

 /bootstrap.php:

 set_include_path(dirname(__FILE__) . '/lib' . PATH_SEPARATOR .
 get_include_path());

 Then I load the autoloader from /lib/autoload.php at the time of bootstrap.

 /lib contains others /lib/Common, /lib/Util, etc.

 So when I say new Common_Form();, it will include /lib/Common/Form.php

  not bad, i'll look at that more closely.  but let me mention a
wrinkle i mentioned before and expand on it so folks can see what i'm
trying to do and why i was suggesting the strategy i did.

  as i said, something i've used before (in admittedly non-PHP
projects) was to require developers who checked out the code base to
set a single env variable (say, PROJ_DIR) to point at the location of
the checkout.  while someone earlier suggested that was overkill,
this approach had a major benefit for me.

  in both that earlier project and in this current PHP project, there
was the possibility of multiple code base checkouts -- perhaps the
current stable one and a newer development one.  i'm a big fan of lots
and lots of automated testing so i would write numerous scripts that
would, from the command line, test the code base.

  i want those test scripts to work equally well on the production
checkout and the development checkout, and i also don't want to be
forced to locate those test scripts in any particular directory.  i
might want a totally separate checkout for test scripts, and the
freedom to check them out wherever i want.

  quite simply, i want to be able to check out my test scripts, and
tell them *which* code base to run against.  and i see no way around
that other than to have to explicitly identify the location of the
code base to be tested, and that's what the PROJ_DIR variable was for.
using that single variable, i could reset and point at whatever
checkout i wanted to test.  and i didn't see any easier way to do it.

  i've seen lots of suggestions of very clever ways to have the
components of a single checkout know there the rest of the checkout
is, and most of them would work fine.  but it seems clear that none of
those techniques would give me the ability to do what i want above --
to arbitrarily refer to checkouts from *elsewhere* and have everything
still work.  and there's one more thing.

  to speed up coding, i've added a utils directory to the code base,
containing (you guessed it) handy-dandy little utilities.  and since
they're part of the repository, it's not hard for other parts of the
checkout to include them.  but, eventually, someone is going to start
a second, sort-of-related project, and will want to reuse some of
those utilities, and the obvious solution will be to move those
utilities out of the first project and give them their own checkout
(svn external?), and again, i don't want to lock any scripts into any
particular location.

  the single environment variable idea still seems like the obvious
solution, or maybe even more than one.  because i don't see that
there's any way to make this *completely* automated.  at some point,
if i want as much flexibility as possible, a developer who checks out
one or more of these projects has to identify what directories he
wants to work with, and all subsequent includes will work off of that.

  thoughts?  sorry for rambling on so long.

rday
--


Robert P. J. Day   Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page:  http://crashcourse.ca
Twitter:   http://twitter.com/rpjday


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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Michael A. Peters

Rene Veerman wrote:



But i've yet to find a way to keep global objects in memory between
http requests, outside $_SESSION, which i believe is just stored to-
and loaded from disk between http requests.


You can store sessions in a cache and avoid the disk IO.

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



Re: [PHP] constants STDOUT, STDERR, STDIN not working in 5.2.x?

2010-03-23 Thread Daniel Egeberg
On Tue, Mar 23, 2010 at 11:47, Marten Lehmann lehm...@cnm.de wrote:
 Hello,

 I found different code examples like this, which use the file handle STDERR
 just like this:

 ?php
 fwrite(STDERR, hello\n);
 ?

 Also, the PHP documentation of input/output streams
 (http://php.net/manual/de/wrappers.php.php) says:

 It is recommended that you simply use the constants STDIN, STDOUT  and
 STDERR instead of manually opening streams using these wrappers.

 I don't want to use the php://stderr wrapper, because this just creates a
 duplicate of the original STDERR handler and if I'm closing php://stderr,
 the original STDERR still would exist.

 When I'm using this code, I only get:

 bNotice/b:  Use of undefined constant STDERR - assumed 'STDERR' in
 b/test.php/b on line b4/bbr /
 br /
 bWarning/b:  fwrite(): supplied argument is not a valid stream resource
 in b/test.php/b on line b4/bbr /

 How can I access the original STDERR handle? The constant should be there,
 but does not exist.

 regards
 Marten

These I/O streams are only present in the CLI SAPI.

-- 
Daniel Egeberg

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



Re: [PHP] constants STDOUT, STDERR, STDIN not working in 5.2.x?

2010-03-23 Thread Jan G.B.
2010/3/23 Daniel Egeberg degeb...@php.net

 On Tue, Mar 23, 2010 at 11:47, Marten Lehmann lehm...@cnm.de wrote:
  Hello,
 
  I found different code examples like this, which use the file handle
 STDERR
  just like this:
 
  ?php
  fwrite(STDERR, hello\n);
  ?
 
  Also, the PHP documentation of input/output streams
  (http://php.net/manual/de/wrappers.php.php) says:
 
  It is recommended that you simply use the constants STDIN, STDOUT  and
  STDERR instead of manually opening streams using these wrappers.
 
  I don't want to use the php://stderr wrapper, because this just creates
 a
  duplicate of the original STDERR handler and if I'm closing
 php://stderr,
  the original STDERR still would exist.
 
  When I'm using this code, I only get:
 
  bNotice/b:  Use of undefined constant STDERR - assumed 'STDERR' in
  b/test.php/b on line b4/bbr /
  br /
  bWarning/b:  fwrite(): supplied argument is not a valid stream
 resource
  in b/test.php/b on line b4/bbr /
 
  How can I access the original STDERR handle? The constant should be
 there,
  but does not exist.
 
  regards
  Marten

 These I/O streams are only present in the CLI SAPI.

 --
 Daniel Egeberg

 Please confirm that the code of my previous replay on this topic (executed
via php-cli) does not print out test2 or test3. The constant is present
but doesn't work as supposed.

Regards


Re: [PHP] constants STDOUT, STDERR, STDIN not working in 5.2.x?

2010-03-23 Thread Daniel Egeberg
On Tue, Mar 23, 2010 at 15:50, Jan G.B. ro0ot.w...@googlemail.com wrote:


 2010/3/23 Daniel Egeberg degeb...@php.net

 On Tue, Mar 23, 2010 at 11:47, Marten Lehmann lehm...@cnm.de wrote:
  Hello,
 
  I found different code examples like this, which use the file handle
  STDERR
  just like this:
 
  ?php
  fwrite(STDERR, hello\n);
  ?
 
  Also, the PHP documentation of input/output streams
  (http://php.net/manual/de/wrappers.php.php) says:
 
  It is recommended that you simply use the constants STDIN, STDOUT  and
  STDERR instead of manually opening streams using these wrappers.
 
  I don't want to use the php://stderr wrapper, because this just
  creates a
  duplicate of the original STDERR handler and if I'm closing
  php://stderr,
  the original STDERR still would exist.
 
  When I'm using this code, I only get:
 
  bNotice/b:  Use of undefined constant STDERR - assumed 'STDERR' in
  b/test.php/b on line b4/bbr /
  br /
  bWarning/b:  fwrite(): supplied argument is not a valid stream
  resource
  in b/test.php/b on line b4/bbr /
 
  How can I access the original STDERR handle? The constant should be
  there,
  but does not exist.
 
  regards
  Marten

 These I/O streams are only present in the CLI SAPI.

 --
 Daniel Egeberg

 Please confirm that the code of my previous replay on this topic (executed
 via php-cli) does not print out test2 or test3. The constant is present
 but doesn't work as supposed.
 Regards



You are making a number of errors there:
1) You are trying to open php://stderr in read mode, but that stream
is write only (I'm not sure why it outputs regardless).
2) You are trying to open STDERR, but that constant holds a stream
resource while fopen() expects a string.
3) You are trying to write to 'php://stderr'. That's not possible. You
cannot pass a string as stream.

The following should work:

dan...@daniel-laptop:~$ cat test.php
?php
$stderr = fopen('php://stderr', 'w');
fwrite($stderr, 'Error 1' . PHP_EOL);
fwrite(STDERR, 'Error 2' . PHP_EOL);
echo 'Normal echo';
dan...@daniel-laptop:~$ php test.php  /dev/null
Error 1
Error 2
dan...@daniel-laptop:~$ ./src/php-5.2.12/sapi/cli/php test.php  /dev/null
Error 1
Error 2

-- 
Daniel Egeberg

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



Re: [PHP] another question on setting include paths for a project

2010-03-23 Thread Richard Quadling
On 23 March 2010 13:11, Robert P. J. Day rpj...@crashcourse.ca wrote:
 On Mon, 22 Mar 2010, Nilesh Govindarajan wrote:

 What I do is, set the include path in the top-level bootstrapper.

 /bootstrap.php:

 set_include_path(dirname(__FILE__) . '/lib' . PATH_SEPARATOR .
 get_include_path());

 Then I load the autoloader from /lib/autoload.php at the time of bootstrap.

 /lib contains others /lib/Common, /lib/Util, etc.

 So when I say new Common_Form();, it will include /lib/Common/Form.php

  not bad, i'll look at that more closely.  but let me mention a
 wrinkle i mentioned before and expand on it so folks can see what i'm
 trying to do and why i was suggesting the strategy i did.

  as i said, something i've used before (in admittedly non-PHP
 projects) was to require developers who checked out the code base to
 set a single env variable (say, PROJ_DIR) to point at the location of
 the checkout.  while someone earlier suggested that was overkill,
 this approach had a major benefit for me.

  in both that earlier project and in this current PHP project, there
 was the possibility of multiple code base checkouts -- perhaps the
 current stable one and a newer development one.  i'm a big fan of lots
 and lots of automated testing so i would write numerous scripts that
 would, from the command line, test the code base.

  i want those test scripts to work equally well on the production
 checkout and the development checkout, and i also don't want to be
 forced to locate those test scripts in any particular directory.  i
 might want a totally separate checkout for test scripts, and the
 freedom to check them out wherever i want.

  quite simply, i want to be able to check out my test scripts, and
 tell them *which* code base to run against.  and i see no way around
 that other than to have to explicitly identify the location of the
 code base to be tested, and that's what the PROJ_DIR variable was for.
 using that single variable, i could reset and point at whatever
 checkout i wanted to test.  and i didn't see any easier way to do it.

  i've seen lots of suggestions of very clever ways to have the
 components of a single checkout know there the rest of the checkout
 is, and most of them would work fine.  but it seems clear that none of
 those techniques would give me the ability to do what i want above --
 to arbitrarily refer to checkouts from *elsewhere* and have everything
 still work.  and there's one more thing.

  to speed up coding, i've added a utils directory to the code base,
 containing (you guessed it) handy-dandy little utilities.  and since
 they're part of the repository, it's not hard for other parts of the
 checkout to include them.  but, eventually, someone is going to start
 a second, sort-of-related project, and will want to reuse some of
 those utilities, and the obvious solution will be to move those
 utilities out of the first project and give them their own checkout
 (svn external?), and again, i don't want to lock any scripts into any
 particular location.

  the single environment variable idea still seems like the obvious
 solution, or maybe even more than one.  because i don't see that
 there's any way to make this *completely* automated.  at some point,
 if i want as much flexibility as possible, a developer who checks out
 one or more of these projects has to identify what directories he
 wants to work with, and all subsequent includes will work off of that.

  thoughts?  sorry for rambling on so long.

 rday
 --

 
 Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

 Web page:                                          http://crashcourse.ca
 Twitter:                                       http://twitter.com/rpjday
 

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



However you want to identify the location, the autoloading techniques
will allow you to only need to identify the location once. As compared
to every file meticulously maintaining relative links to files.

So, for testing, would this not work?

RunTests C:\Dev\Checkouts\PROJ\trunk\tests
RunTests C:\Installed\PROJ\V1.1\Tests
RunTests C:\Installed\PROJ\V2.2\Tests
RunTests C:\Installed\PROJ\V3.3\Tests

sort of thing?

And in RunTests, you set the location based upon the $argv[1] (using
the autoloader technique).

No env_var. No include_path.



-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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

Re: [PHP] another question on setting include paths for a project

2010-03-23 Thread Robert P. J. Day
On Tue, 23 Mar 2010, Richard Quadling wrote:

 However you want to identify the location, the autoloading techniques
 will allow you to only need to identify the location once. As compared
 to every file meticulously maintaining relative links to files.

 So, for testing, would this not work?

 RunTests C:\Dev\Checkouts\PROJ\trunk\tests
 RunTests C:\Installed\PROJ\V1.1\Tests
 RunTests C:\Installed\PROJ\V2.2\Tests
 RunTests C:\Installed\PROJ\V3.3\Tests

 sort of thing?

 And in RunTests, you set the location based upon the $argv[1] (using
 the autoloader technique).

 No env_var. No include_path.

  sure, but deep down, you're still doing what i'm claiming has to be
done at some point -- *explicitly* identifying the target location.
you're just doing it in a different way, which is fine and might be
what i'm after.

rday
--



Robert P. J. Day   Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page:  http://crashcourse.ca
Twitter:   http://twitter.com/rpjday


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



[PHP] i'm curious about unit testing

2010-03-23 Thread Rene Veerman
Hi..

in an effort to write better code i'd like to know good strategies for
unit testing.
automated testing of code.

the fact that my code can undergo rapid changes has kept me back so far.

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



Re: [PHP] i'm curious about unit testing

2010-03-23 Thread Daniel Brown
On Tue, Mar 23, 2010 at 14:29, Rene Veerman rene7...@gmail.com wrote:
 Hi..

 in an effort to write better code i'd like to know good strategies for
 unit testing.
 automated testing of code.

 the fact that my code can undergo rapid changes has kept me back so far.

This is a question that comes up now and again on the list.  I'd
check the archives (via Google[1]) to get a good baseline, and then
you'll be better-armed to ask more specific questions, since you'll
have at least a general understanding.

^1: http://www.google.com/search?q=php-general+unit+testing

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Looking for hosting or dedicated servers?  Ask me how we can fit your budget!

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



Re: [PHP] PHP to access shell script to print barcodes

2010-03-23 Thread Rob Gould
I love the idea of using PHP to insert data into Postscript.  I'm just not sure 
how to make it happen.

The good news is that I've got barcodes drawing just the way I need them:

http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps

The bad news is that's all hard-coded Postscript.  I'd like to take your 
suggestion and use PHP to loop-through and draw the barcodes - - - however, if 
I put anything that resembles PHP in my .ps file, bad things happen.

Anyone know the secret to creating a postscript .ps file that had PHP code 
injecting data into it?

Here's the source file that works.  Where PHP would be handy is at the very 
bottom of the script

http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps.zip


On Mar 23, 2010, at 7:48 AM, Richard Quadling wrote:

 On 23 March 2010 05:48, Jochem Maas joc...@iamjochem.com wrote:
 Op 3/23/10 3:27 AM, Rob Gould schreef:
 I am trying to replicate the functionality that I see on this site:
 
 http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/
 
 Notice after you hit SUBMIT QUERY, you get a PDF file with a page of 
 barcodes.  That's _exactly_ what I'm after.
 Fortunately, the author gives step-by-step instructions on how to do this 
 on this page:
 
 http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/
 
 
 So I've gotten through all the steps, and have created the 
 barcode_with_samples.ps file, and have it hosted here:
 
 http://www.winecarepro.com/kiosk/fast/shell/
 
 Notice how the last few lines contain the shell-script that renders the 
 postscript:
 
 #!/bin/bash
 
 BASE=”100″;
 NR=$BASE
 
 for hor in 30 220 410
 do
 ver=740
 while [ $ver -ge 40 ];
 do
 printf -v FNR “(%06dL3)” $NR
 echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode”
 let ver=$ver-70
 let NR=NR+1
 done
 done
 
 
 I need to somehow create a PHP script that executes this shell script.  
 And after doing some research, it sounds like
 I need to use the PHP exec command, so I do that with the following file:
 
 http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php
 
 Which has the following script:
 
 ?php
 
 $command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;;
 exec($command, $arr);
 
 echo $arr;
 
 ?
 
 
 And, as you can see, nothing works.  I guess firstly, I'd like to know:
 
 A)  Is this PHP exec call really the way to go with executing this shell 
 script?  Is there a better way?  It seems to me like it's not really 
 executing.
 
 that's what exec() is for. $command need to contain a *local* path to the 
 command in question, currently your
 trying to pass a url to bash ... which obviously doesn't do much.
 
 the shell script in question needs to have the executable bit set in order 
 to run (either that or change to command to
 run bash with your script as an argument)
 
 I'd also suggest putting the shell script outside of your webroot, or at 
 least in a directory that's not accessable
 from the web.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 I think this is a translation of the script to PHP.
 
 ?php
 $BASE = 100;
 $NR   = $BASE;
 
 foreach(array(30, 220, 410) as $hor) {
   $ver = 740;
   while ($ver = 40) {
   printf($hor $ver moveto (%06dL3) (includetext height=0.55) 
 code39
 barcode\n, $NR);
   $ver -= 70;
   ++$NR;
   }
 }
 
 
 
 It produces output like ...
 
 30 740 moveto (000100L3) (includetext height=0.55) code39 barcode
 30 670 moveto (000101L3) (includetext height=0.55) code39 barcode
 30 600 moveto (000102L3) (includetext height=0.55) code39 barcode
 30 530 moveto (000103L3) (includetext height=0.55) code39 barcode
 30 460 moveto (000104L3) (includetext height=0.55) code39 barcode
 30 390 moveto (000105L3) (includetext height=0.55) code39 barcode
 30 320 moveto (000106L3) (includetext height=0.55) code39 barcode
 30 250 moveto (000107L3) (includetext height=0.55) code39 barcode
 30 180 moveto (000108L3) (includetext height=0.55) code39 barcode
 30 110 moveto (000109L3) (includetext height=0.55) code39 barcode
 30 40 moveto (000110L3) (includetext height=0.55) code39 barcode
 220 740 moveto (000111L3) (includetext height=0.55) code39 barcode
 220 670 moveto (000112L3) (includetext height=0.55) code39 barcode
 220 600 moveto (000113L3) (includetext height=0.55) code39 barcode
 220 530 moveto (000114L3) (includetext height=0.55) code39 barcode
 220 460 moveto (000115L3) (includetext height=0.55) code39 barcode
 220 390 moveto (000116L3) (includetext height=0.55) code39 barcode
 220 320 moveto (000117L3) (includetext height=0.55) code39 barcode
 220 250 moveto (000118L3) (includetext height=0.55) code39 barcode
 220 180 moveto (000119L3) (includetext height=0.55) code39 barcode
 220 110 moveto (000120L3) (includetext height=0.55) code39 barcode
 220 40 moveto (000121L3) (includetext height=0.55) code39 barcode
 410 740 moveto (000122L3) (includetext height=0.55) code39 barcode
 410 

Re: [PHP] PHP to access shell script to print barcodes

2010-03-23 Thread Peter Lind
You can create a .php script that sets a proper header to make the
browser download the file rather than display it. That also allows you
to set the filename for the download. What you'd need to do is include
something like:

header(Content-Disposition: attachment; filename: 'barcodemerge.ps');

That tells the browser to download the file. You can also try setting
the content-type

header('Content-type: application/postscript');

Either of the above might do the trick for you.

Regards
Peter

On 23 March 2010 22:10, Rob Gould gould...@me.com wrote:
 I love the idea of using PHP to insert data into Postscript.  I'm just not 
 sure how to make it happen.

 The good news is that I've got barcodes drawing just the way I need them:

 http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps

 The bad news is that's all hard-coded Postscript.  I'd like to take your 
 suggestion and use PHP to loop-through and draw the barcodes - - - however, 
 if I put anything that resembles PHP in my .ps file, bad things happen.

 Anyone know the secret to creating a postscript .ps file that had PHP code 
 injecting data into it?

 Here's the source file that works.  Where PHP would be handy is at the very 
 bottom of the script

 http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps.zip


 On Mar 23, 2010, at 7:48 AM, Richard Quadling wrote:

 On 23 March 2010 05:48, Jochem Maas joc...@iamjochem.com wrote:
 Op 3/23/10 3:27 AM, Rob Gould schreef:
 I am trying to replicate the functionality that I see on this site:

 http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/

 Notice after you hit SUBMIT QUERY, you get a PDF file with a page of 
 barcodes.  That's _exactly_ what I'm after.
 Fortunately, the author gives step-by-step instructions on how to do this 
 on this page:

 http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/


 So I've gotten through all the steps, and have created the 
 barcode_with_samples.ps file, and have it hosted here:

 http://www.winecarepro.com/kiosk/fast/shell/

 Notice how the last few lines contain the shell-script that renders the 
 postscript:

 #!/bin/bash

 BASE=”100″;
 NR=$BASE

 for hor in 30 220 410
 do
 ver=740
 while [ $ver -ge 40 ];
 do
 printf -v FNR “(%06dL3)” $NR
 echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode”
 let ver=$ver-70
 let NR=NR+1
 done
 done


 I need to somehow create a PHP script that executes this shell script.  
 And after doing some research, it sounds like
 I need to use the PHP exec command, so I do that with the following file:

 http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php

 Which has the following script:

 ?php

 $command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;;
 exec($command, $arr);

 echo $arr;

 ?


 And, as you can see, nothing works.  I guess firstly, I'd like to know:

 A)  Is this PHP exec call really the way to go with executing this shell 
 script?  Is there a better way?  It seems to me like it's not really 
 executing.

 that's what exec() is for. $command need to contain a *local* path to the 
 command in question, currently your
 trying to pass a url to bash ... which obviously doesn't do much.

 the shell script in question needs to have the executable bit set in order 
 to run (either that or change to command to
 run bash with your script as an argument)

 I'd also suggest putting the shell script outside of your webroot, or at 
 least in a directory that's not accessable
 from the web.

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



 I think this is a translation of the script to PHP.

 ?php
 $BASE = 100;
 $NR   = $BASE;

 foreach(array(30, 220, 410) as $hor) {
       $ver = 740;
       while ($ver = 40) {
               printf($hor $ver moveto (%06dL3) (includetext height=0.55) 
 code39
 barcode\n, $NR);
               $ver -= 70;
               ++$NR;
       }
 }



 It produces output like ...

 30 740 moveto (000100L3) (includetext height=0.55) code39 barcode
 30 670 moveto (000101L3) (includetext height=0.55) code39 barcode
 30 600 moveto (000102L3) (includetext height=0.55) code39 barcode
 30 530 moveto (000103L3) (includetext height=0.55) code39 barcode
 30 460 moveto (000104L3) (includetext height=0.55) code39 barcode
 30 390 moveto (000105L3) (includetext height=0.55) code39 barcode
 30 320 moveto (000106L3) (includetext height=0.55) code39 barcode
 30 250 moveto (000107L3) (includetext height=0.55) code39 barcode
 30 180 moveto (000108L3) (includetext height=0.55) code39 barcode
 30 110 moveto (000109L3) (includetext height=0.55) code39 barcode
 30 40 moveto (000110L3) (includetext height=0.55) code39 barcode
 220 740 moveto (000111L3) (includetext height=0.55) code39 barcode
 220 670 moveto (000112L3) (includetext height=0.55) code39 barcode
 220 600 moveto (000113L3) (includetext height=0.55) code39 barcode
 220 530 moveto (000114L3) (includetext height=0.55) code39 barcode
 220 460 

Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Tommy Pham
On Tue, Mar 23, 2010 at 2:04 AM, Per Jessen p...@computer.org wrote:

 Use the right tool for the right job - PHP is a scripting/interpreted
 language, it does not need threading (IMO of course).


 --
 Per Jessen, Zürich (9.4°C)



I couldn't agree more.  But here's a real life example.  Your client
has a forum and is using phpbb for their in house use.  They also have
an in house custom PHP app, integrated with phpbb, built to suit their
needs.  Now they want to implement some kind of CMS.  You come in and
implemented a PHP based CMS to integrate into their existing
applications.  Then you realize something troublesome, you have a
performance issue where it could be resolved by implementing thread.
What are you going to do?  Are you going to say to the client We seem
to have a problem.  I suggest we migrate to Java or ASP.Net because
threading will resolve the performance issue.  Or are you going to
spend who knows how long to try find a hack to resolve the issue?
What do you think the client's response is when their need for the
solution requires a short time frame of, if not immediate,
implementation?

Regards,
Tommy

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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Per Jessen
Tommy Pham wrote:

 On Tue, Mar 23, 2010 at 2:04 AM, Per Jessen p...@computer.org wrote:

 Use the right tool for the right job - PHP is a scripting/interpreted
 language, it does not need threading (IMO of course).


 --
 Per Jessen, Zürich (9.4°C)


 
 I couldn't agree more.  But here's a real life example.  Your client
 has a forum and is using phpbb for their in house use.  They also have
 an in house custom PHP app, integrated with phpbb, built to suit their
 needs.  Now they want to implement some kind of CMS.  You come in and
 implemented a PHP based CMS to integrate into their existing
 applications.  Then you realize something troublesome, you have a
 performance issue where it could be resolved by implementing thread.
 What are you going to do? 

The standard, mature, experienced answer is - buy a bigger box. 

[snip]
 What do you think the client's response is when their need for the
 solution requires a short time frame of, if not immediate,
 implementation?

There are no immediate solutions to immediate performance problems.  If
you have a poor design that restricts your throughput, you can 1) throw
hardware at it or 2) change the design.  At some point you'll hit yet
another limit with 1), and you are forced back to 2).  Somewhere along
the line the original designer has presumably left or been made to. 


/Per

-- 
Per Jessen, Zürich (7.5°C)


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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Tommy Pham
On Tue, Mar 23, 2010 at 3:33 PM, Per Jessen p...@computer.org wrote:
 Tommy Pham wrote:

 On Tue, Mar 23, 2010 at 2:04 AM, Per Jessen p...@computer.org wrote:

 Use the right tool for the right job - PHP is a scripting/interpreted
 language, it does not need threading (IMO of course).


 --
 Per Jessen, Zürich (9.4°C)



 I couldn't agree more.  But here's a real life example.  Your client
 has a forum and is using phpbb for their in house use.  They also have
 an in house custom PHP app, integrated with phpbb, built to suit their
 needs.  Now they want to implement some kind of CMS.  You come in and
 implemented a PHP based CMS to integrate into their existing
 applications.  Then you realize something troublesome, you have a
 performance issue where it could be resolved by implementing thread.
 What are you going to do?

 The standard, mature, experienced answer is - buy a bigger box.


The company started small.  As their business grows because they have
products  services that do not exist in the marketplace, their
hardware are already growing along side with it, (load balancers,
clusters).  So then your solution is buy bigger/more boxes?  What if
the their server room is filled and already using recent hardware.
Their current business needs doesn't need to move to a bigger
building.  What then? Hire data center's services?  What if they want
to protect their proprietary break through products and services?
What about unnecessary additional total cost of ownership (licenses,
power consumption, etc...) for more/bigger boxes, even if they have
available space, that could be avoided by just implementing threads?

 [snip]
 What do you think the client's response is when their need for the
 solution requires a short time frame of, if not immediate,
 implementation?

 There are no immediate solutions to immediate performance problems.  If
 you have a poor design that restricts your throughput, you can 1) throw
 hardware at it or 2) change the design.  At some point you'll hit yet
 another limit with 1), and you are forced back to 2).  Somewhere along
 the line the original designer has presumably left or been made to.


 /Per

 --
 Per Jessen, Zürich (7.5°C)


If throwing hardware at it won't work because of the above mentioned,
then you would change the design right?  How long would that take?
What if PHP has threads, how long would it take you implement threads
with minor changes versus and overhaul of application design, coding,
QA, etc... In summary, you're saying that PHP can not grow/evolve with
business right?  If the company started small and want to use
available open source solutions, then grow quickly because of their
unique and quality products and services, and become enterprise level
with-in a few years, what then?  Slow down business growth just so
that IT can migrate everything to another language? Of all the
enterprise applications I've seen, they used threads.

Regards,
Tommy

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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread la...@garfieldtech.com

On 3/23/10 6:04 PM, Tommy Pham wrote:


If throwing hardware at it won't work because of the above mentioned,
then you would change the design right?  How long would that take?
What if PHP has threads, how long would it take you implement threads
with minor changes versus and overhaul of application design, coding,
QA, etc... In summary, you're saying that PHP can not grow/evolve with
business right?  If the company started small and want to use
available open source solutions, then grow quickly because of their
unique and quality products and services, and become enterprise level
with-in a few years, what then?  Slow down business growth just so
that IT can migrate everything to another language? Of all the
enterprise applications I've seen, they used threads.

Regards,
Tommy


The word enterprise is meaningless in this context because it provides 
no context for the distinction.  What does enterprise mean?  Gets 
Captain Kirk to his next date?  Is OpenOffice.org's plugin download site 
enterprise?  Is Sony BMG enterprise?  The sites for the cities of London 
and Athens?  Whitehouse.gov?


That's just a couple of sites now running on Drupal, a particular 
single-threaded PHP application.  That's not counting the thousands of 
similar organizations running PHP (not even PHP-wrapping-custom-C like 
Yahoo) applications of various and sundry kinds.  (Wikipedia anyone?) 
PHP *is* in the enterprise and quite happy there.


Not ready for the enterprise is a totally meaningless statement. 
Similarly, if you cannot think of any way to scale an application that 
doesn't involve threads then I question your competence as a programmer. 
 Sure, threads can be one way to speed things up.  There are lots and 
lots of others that may be more or less appropriate depending on the 
circumstances.  Threads have their own scaling issues, namely they have 
to live within the same process on the same box.  That means when you 
hit the maximum size of your server, you're done.  That doesn't mean 
threads are bad, but they have their trade-offs just like everything 
else does.


But let's consider what adding threads to PHP would take.  That would 
mean making PHP a shared-memory architecture, so that different requests 
now operated in the same memory space.  That means RAM-based 
persistence.  That means needing to write thread-safe PHP libraries. 
(Not the ones in C; I mean the millions of lines of code of PHP already 
out there.)


In short, adding threading support to PHP means PHP is no longer PHP. 
It's Java with dollarsigns.  It's a complete and total rewrite of the 
entire language runtime and environment, and all of the code build atop it.


The idea that you could just add threads to PHP and make it 
enterprise-ready is so naive it's mind boggling.


--Larry Garfield

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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Hans Åhlin
2010/3/24 Tommy Pham tommy...@gmail.com:
 On Tue, Mar 23, 2010 at 3:33 PM, Per Jessen p...@computer.org wrote:
 Tommy Pham wrote:

 On Tue, Mar 23, 2010 at 2:04 AM, Per Jessen p...@computer.org wrote:

 Use the right tool for the right job - PHP is a scripting/interpreted
 language, it does not need threading (IMO of course).


 --
 Per Jessen, Zürich (9.4°C)



 I couldn't agree more.  But here's a real life example.  Your client
 has a forum and is using phpbb for their in house use.  They also have
 an in house custom PHP app, integrated with phpbb, built to suit their
 needs.  Now they want to implement some kind of CMS.  You come in and
 implemented a PHP based CMS to integrate into their existing
 applications.  Then you realize something troublesome, you have a
 performance issue where it could be resolved by implementing thread.
 What are you going to do?

 The standard, mature, experienced answer is - buy a bigger box.


 The company started small.  As their business grows because they have
 products  services that do not exist in the marketplace, their
 hardware are already growing along side with it, (load balancers,
 clusters).  So then your solution is buy bigger/more boxes?  What if
 the their server room is filled and already using recent hardware.
 Their current business needs doesn't need to move to a bigger
 building.  What then? Hire data center's services?  What if they want
 to protect their proprietary break through products and services?
 What about unnecessary additional total cost of ownership (licenses,
 power consumption, etc...) for more/bigger boxes, even if they have
 available space, that could be avoided by just implementing threads?


That screams poor code design. Then to solve the problem might not be
threading or change of language but a reanalyze of the code and the
design, probably a re-write.

 [snip]
 What do you think the client's response is when their need for the
 solution requires a short time frame of, if not immediate,
 implementation?

 There are no immediate solutions to immediate performance problems.  If
 you have a poor design that restricts your throughput, you can 1) throw
 hardware at it or 2) change the design.  At some point you'll hit yet
 another limit with 1), and you are forced back to 2).  Somewhere along
 the line the original designer has presumably left or been made to.


 /Per

 --
 Per Jessen, Zürich (7.5°C)


 If throwing hardware at it won't work because of the above mentioned,
 then you would change the design right?  How long would that take?
 What if PHP has threads, how long would it take you implement threads
 with minor changes versus and overhaul of application design, coding,
 QA, etc... In summary, you're saying that PHP can not grow/evolve with
 business right?  If the company started small and want to use
 available open source solutions, then grow quickly because of their
 unique and quality products and services, and become enterprise level
 with-in a few years, what then?  Slow down business growth just so
 that IT can migrate everything to another language? Of all the
 enterprise applications I've seen, they used threads.


Same answer as above.

 Regards,
 Tommy

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





-- 
MvH / Hans Åhlin
Tel: +46761488019
http//www.kronan-net.com/

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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Michael A. Peters

Tommy Pham wrote:

On Tue, Mar 23, 2010 at 3:33 PM, Per Jessen p...@computer.org wrote:

Tommy Pham wrote:


On Tue, Mar 23, 2010 at 2:04 AM, Per Jessen p...@computer.org wrote:

Use the right tool for the right job - PHP is a scripting/interpreted
language, it does not need threading (IMO of course).


--
Per Jessen, Zürich (9.4°C)



I couldn't agree more.  But here's a real life example.  Your client
has a forum and is using phpbb for their in house use.  They also have
an in house custom PHP app, integrated with phpbb, built to suit their
needs.  Now they want to implement some kind of CMS.  You come in and
implemented a PHP based CMS to integrate into their existing
applications.  Then you realize something troublesome, you have a
performance issue where it could be resolved by implementing thread.
What are you going to do?

The standard, mature, experienced answer is - buy a bigger box.



The company started small.  As their business grows because they have
products  services that do not exist in the marketplace, their
hardware are already growing along side with it, (load balancers,
clusters).  So then your solution is buy bigger/more boxes?  What if
the their server room is filled and already using recent hardware.
Their current business needs doesn't need to move to a bigger
building.  What then? Hire data center's services?


Very few companies have a legitimate reason to run their own server room 
at this point in time and should be using a data center if they are not 
already.


Data centers have excellent bandwidth, diesel generators to keep things 
live during sustained power outages, temperature control to keep things 
cool, and often have technicians on hand with spare parts that can take 
care of many hardware issues 24/7.


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



[PHP] Fwd: FACEBOOK MALWARE BOTNET

2010-03-23 Thread Allen McCabe
*Importance:* High



All:



If you are a Facebook user, you may have recently received an email with the
subject:  *Facebook Password Reset Confirmation Customer Support.
**The *address
of the sender is spoofed to display supp...@facebook.com



*THIS IS MALWARE BOTNET – DO NOT OPEN THIS MESSAGE!*



The message reads, “*Dear user of Facebook, Because of the measures taken to
provide safety to our clients, your password has been changed. You can find
your new password in attached document. Thanks, Your Facebook.*”

*According to TrendMicro, “The malware being delivered is a botnet and is
called ‘BredoLab.’ It has been occasionally spread by spam since May of
2009,**” **There have been at least eight versions of the Facebook BredoLab
malware observed since March 16, 2010**.  *

*“**What is troubling is the newer versions of the BredoLab used in this
latest attack campaign are not being detected by the majority of anti-virus
services — and that means the majority of users who unwittingly click on the
bogus attachments linked to fake e-mails are going to have their computers
infected**“.  *To bypass firewalls, it injects its own code into legitimate
processes.**

The malicious executable is linked to the Bredolab botnet, which has been
linked to massive spam runs and identity-theft related attacks.



BREDOLAB is a software that enables cybercriminal organizations to deliver
any kind of software to its victims.  Once a user’s machine is infected by
BREDOLAB, it will receive regular malware updates the same way it receives
software updates from the user’s security vendor.



To clean and protect your home machine, both anti-virus and
anti-malware/anti-spyware software should be run daily (or nightly).


Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Tommy Pham
Let's go back to my 1st e-commerce example.  The manufacturers list is
about 3,700.  The categories is about about 2,400.  The products list
is right now at 500,000 and expected to be around 750,000.  The site
is only in English.  The store owner wants to expand and be I18n:
Chinese, French, German, Korean, Spanish.  You see how big and complex
that database gets?  The store owners want to have this happens when a
customer clicks on a category:

* show all subcategories for that category, if any
* show all products for that category, if any,
* show all manufacturers, used as filtering, for that category and subcategories
* show price range filter for that category
* show features  specifications filter for that category
* show 10 top sellers for that category and related subcategories
* the shopper can then select/deselect any of those filters and
ability to sort by manufacturers, prices, user rating, popularity
(purchased quantity)
* have the ability to switch to another language translation on the fly
* from the moment the shopper click on a link, the response time (when
web browser saids Done in the status bar) is 5 seconds or less.
Preferably 2-3 seconds. Will be using stopwatch for the timer.

Now show me a website that meets those requirements and uses PHP, I'll
be glad to support your argument about PHP w/o threads :)  BTW, this
is not even enterprise requirement.  I may have another possible
project where # products is over 10 million easily.  With similar
requirements when the user click on category.  Do you think this site,
which currently isn't, can run on PHP?

Regards,
Tommy

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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Tommy Pham
On Tue, Mar 23, 2010 at 6:17 PM, Tommy Pham tommy...@gmail.com wrote:
 Let's go back to my 1st e-commerce example.  The manufacturers list is
 about 3,700.  The categories is about about 2,400.  The products list
 is right now at 500,000 and expected to be around 750,000.  The site
 is only in English.  The store owner wants to expand and be I18n:
 Chinese, French, German, Korean, Spanish.  You see how big and complex
 that database gets?  The store owners want to have this happens when a
 customer clicks on a category:

 * show all subcategories for that category, if any
 * show all products for that category, if any,
 * show all manufacturers, used as filtering, for that category and 
 subcategories
 * show price range filter for that category
 * show features  specifications filter for that category
 * show 10 top sellers for that category and related subcategories

forgot to mention:
* show 10 random sale specials for that category and subcategories

 * the shopper can then select/deselect any of those filters and
 ability to sort by manufacturers, prices, user rating, popularity
 (purchased quantity)
 * have the ability to switch to another language translation on the fly
 * from the moment the shopper click on a link, the response time (when
 web browser saids Done in the status bar) is 5 seconds or less.
 Preferably 2-3 seconds. Will be using stopwatch for the timer.

 Now show me a website that meets those requirements and uses PHP, I'll
 be glad to support your argument about PHP w/o threads :)  BTW, this
 is not even enterprise requirement.  I may have another possible
 project where # products is over 10 million easily.  With similar
 requirements when the user click on category.  Do you think this site,
 which currently isn't, can run on PHP?

 Regards,
 Tommy


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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Robert Cummings

Tommy Pham wrote:

Let's go back to my 1st e-commerce example.  The manufacturers list is
about 3,700.  The categories is about about 2,400.  The products list
is right now at 500,000 and expected to be around 750,000.  The site
is only in English.  The store owner wants to expand and be I18n:
Chinese, French, German, Korean, Spanish.  You see how big and complex
that database gets?  The store owners want to have this happens when a
customer clicks on a category:

* show all subcategories for that category, if any
* show all products for that category, if any,
* show all manufacturers, used as filtering, for that category and subcategories
* show price range filter for that category
* show features  specifications filter for that category
* show 10 top sellers for that category and related subcategories
* the shopper can then select/deselect any of those filters and
ability to sort by manufacturers, prices, user rating, popularity
(purchased quantity)
* have the ability to switch to another language translation on the fly
* from the moment the shopper click on a link, the response time (when
web browser saids Done in the status bar) is 5 seconds or less.
Preferably 2-3 seconds. Will be using stopwatch for the timer.



Now show me a website that meets those requirements and uses PHP, I'll
be glad to support your argument about PHP w/o threads :)  BTW, this


I don't currently know a site, sounds like a fun job though.


is not even enterprise requirement.  I may have another possible
project where # products is over 10 million easily.  With similar
requirements when the user click on category.  Do you think this site,
which currently isn't, can run on PHP?


Yes, I do. There's nothing in your requirements above that sound 
particularly difficult for PHP to handle with a good design and lots of 
caching... and of course the right hardware. I think you're hung up on 
the numbers a bit... those aren't very big numbers for a database.


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Paul M Foster
On Tue, Mar 23, 2010 at 06:17:56PM -0700, Tommy Pham wrote:

 Let's go back to my 1st e-commerce example.  The manufacturers list is
 about 3,700.  The categories is about about 2,400.  The products list
 is right now at 500,000 and expected to be around 750,000.  The site
 is only in English.  The store owner wants to expand and be I18n:
 Chinese, French, German, Korean, Spanish.  You see how big and complex
 that database gets?  The store owners want to have this happens when a
 customer clicks on a category:
 
 * show all subcategories for that category, if any
 * show all products for that category, if any,
 * show all manufacturers, used as filtering, for that category and
 subcategories
 * show price range filter for that category
 * show features  specifications filter for that category
 * show 10 top sellers for that category and related subcategories
 * the shopper can then select/deselect any of those filters and
 ability to sort by manufacturers, prices, user rating, popularity
 (purchased quantity)
 * have the ability to switch to another language translation on the fly
 * from the moment the shopper click on a link, the response time (when
 web browser saids Done in the status bar) is 5 seconds or less.
 Preferably 2-3 seconds. Will be using stopwatch for the timer.
 
 Now show me a website that meets those requirements and uses PHP, I'll
 be glad to support your argument about PHP w/o threads :)  BTW, this
 is not even enterprise requirement.  I may have another possible
 project where # products is over 10 million easily.  With similar
 requirements when the user click on category.  Do you think this site,
 which currently isn't, can run on PHP?

That strikes me as a pretty stiff target, no matter how you look at it.
You effectively want 6 major queries at once, plus response in under 3
seconds on a 75 row product table. I'm not sure I could produce that
kind of performance in C at the command line. (I'm sure some smart guy
on the list will say he can do it in 2 seconds flat over a 10 Base 2
network with teletypes and acoustic modems.)

Which brings me to my question. Why do people expect console-level
performance from a web browser? It's kind of rhetorical, since people
want everything they can get and more all the time. But if performance
came up as a customer question for me, I'd make it clear that they're
not going to get console-level performance from a web browser, unless
they want to spend a whole lot more money. Neither the world wide web
nor browser software were ever designed primarily with speed in mind.
The internet is not your local 64-bit 10 gigabyte memory loaded machine.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread Tommy Pham
On Tue, Mar 23, 2010 at 6:57 PM, Paul M Foster pa...@quillandmouse.com wrote:
 On Tue, Mar 23, 2010 at 06:17:56PM -0700, Tommy Pham wrote:

 Let's go back to my 1st e-commerce example.  The manufacturers list is
 about 3,700.  The categories is about about 2,400.  The products list
 is right now at 500,000 and expected to be around 750,000.  The site
 is only in English.  The store owner wants to expand and be I18n:
 Chinese, French, German, Korean, Spanish.  You see how big and complex
 that database gets?  The store owners want to have this happens when a
 customer clicks on a category:

 * show all subcategories for that category, if any
 * show all products for that category, if any,
 * show all manufacturers, used as filtering, for that category and
 subcategories
 * show price range filter for that category
 * show features  specifications filter for that category
 * show 10 top sellers for that category and related subcategories
 * the shopper can then select/deselect any of those filters and
 ability to sort by manufacturers, prices, user rating, popularity
 (purchased quantity)
 * have the ability to switch to another language translation on the fly
 * from the moment the shopper click on a link, the response time (when
 web browser saids Done in the status bar) is 5 seconds or less.
 Preferably 2-3 seconds. Will be using stopwatch for the timer.

 Now show me a website that meets those requirements and uses PHP, I'll
 be glad to support your argument about PHP w/o threads :)  BTW, this
 is not even enterprise requirement.  I may have another possible
 project where # products is over 10 million easily.  With similar
 requirements when the user click on category.  Do you think this site,
 which currently isn't, can run on PHP?

 That strikes me as a pretty stiff target, no matter how you look at it.
 You effectively want 6 major queries at once, plus response in under 3
 seconds on a 75 row product table. I'm not sure I could produce that
 kind of performance in C at the command line. (I'm sure some smart guy
 on the list will say he can do it in 2 seconds flat over a 10 Base 2
 network with teletypes and acoustic modems.)

 Which brings me to my question. Why do people expect console-level
 performance from a web browser? It's kind of rhetorical, since people
 want everything they can get and more all the time. But if performance
 came up as a customer question for me, I'd make it clear that they're
 not going to get console-level performance from a web browser, unless
 they want to spend a whole lot more money. Neither the world wide web
 nor browser software were ever designed primarily with speed in mind.
 The internet is not your local 64-bit 10 gigabyte memory loaded machine.

 Paul

 --
 Paul M. Foster


The response time, max 5 seconds, will be tested on local gigabit LAN
to ensure the adequate response (optimized DB  code  proper
hardware) without worrying about users' connection limit and site's
upload bandwidth limit (which can easily rectify).  Then thereafter
will be doing stress test of about 10 concurrent users.  As for the
major queries, that's where threads come in, IMO, because those
queries depend on 1 primary parameter (category ID) and 1 secondary
parameter (language ID).  This particular site starts with 500
products about 15 categories, without many of those mentioned filters,
later grew to its current state.

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



Re: [PHP] PHP to access shell script to print barcodes

2010-03-23 Thread Rob Gould
Well, that did something, and it does sound like it should work.  I've scoured 
the web and haven't found anyone with code that does what I'm trying to do.

I've got a working, hardcoded Postscript file here:

http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps

But I need to somehow serve it with PHP, so I can change some variables in it.  

By putting headers in place with PHP, and then doing an echo of the 
postscript, I get postscript errors (though Preview doesn't tell me what the 
error is):

http://www.winecarepro.com/kiosk/fast/shell/serverps.ps

Trying to trick the web-browser into thinking it's receiving Postscript from a 
PHP file is tricky.  I don't know what to do next.

Here's the code I was using in the above url:  
http://www.winecarepro.com/kiosk/fast/shell/serveps.php.zip

It's not clear to me if the server is parsing the postscript first and then 
serving it, or if the server is server the postscript as-is and the browser 
sends it to Preview which interprets it.

I basically want to replicate the functionality found here:

http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/



On Mar 23, 2010, at 5:37 PM, Peter Lind wrote:

 You can create a .php script that sets a proper header to make the
 browser download the file rather than display it. That also allows you
 to set the filename for the download. What you'd need to do is include
 something like:
 
 header(Content-Disposition: attachment; filename: 'barcodemerge.ps');
 
 That tells the browser to download the file. You can also try setting
 the content-type
 
 header('Content-type: application/postscript');
 
 Either of the above might do the trick for you.
 
 Regards
 Peter
 
 On 23 March 2010 22:10, Rob Gould gould...@me.com wrote:
 I love the idea of using PHP to insert data into Postscript.  I'm just not 
 sure how to make it happen.
 
 The good news is that I've got barcodes drawing just the way I need them:
 
 http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps
 
 The bad news is that's all hard-coded Postscript.  I'd like to take your 
 suggestion and use PHP to loop-through and draw the barcodes - - - however, 
 if I put anything that resembles PHP in my .ps file, bad things happen.
 
 Anyone know the secret to creating a postscript .ps file that had PHP code 
 injecting data into it?
 
 Here's the source file that works.  Where PHP would be handy is at the very 
 bottom of the script
 
 http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps.zip
 
 
 On Mar 23, 2010, at 7:48 AM, Richard Quadling wrote:
 
 On 23 March 2010 05:48, Jochem Maas joc...@iamjochem.com wrote:
 Op 3/23/10 3:27 AM, Rob Gould schreef:
 I am trying to replicate the functionality that I see on this site:
 
 http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/
 
 Notice after you hit SUBMIT QUERY, you get a PDF file with a page of 
 barcodes.  That's _exactly_ what I'm after.
 Fortunately, the author gives step-by-step instructions on how to do this 
 on this page:
 
 http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/
 
 
 So I've gotten through all the steps, and have created the 
 barcode_with_samples.ps file, and have it hosted here:
 
 http://www.winecarepro.com/kiosk/fast/shell/
 
 Notice how the last few lines contain the shell-script that renders the 
 postscript:
 
 #!/bin/bash
 
 BASE=”100″;
 NR=$BASE
 
 for hor in 30 220 410
 do
 ver=740
 while [ $ver -ge 40 ];
 do
 printf -v FNR “(%06dL3)” $NR
 echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode”
 let ver=$ver-70
 let NR=NR+1
 done
 done
 
 
 I need to somehow create a PHP script that executes this shell script.  
 And after doing some research, it sounds like
 I need to use the PHP exec command, so I do that with the following file:
 
 http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php
 
 Which has the following script:
 
 ?php
 
 $command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;;
 exec($command, $arr);
 
 echo $arr;
 
 ?
 
 
 And, as you can see, nothing works.  I guess firstly, I'd like to know:
 
 A)  Is this PHP exec call really the way to go with executing this shell 
 script?  Is there a better way?  It seems to me like it's not really 
 executing.
 
 that's what exec() is for. $command need to contain a *local* path to the 
 command in question, currently your
 trying to pass a url to bash ... which obviously doesn't do much.
 
 the shell script in question needs to have the executable bit set in order 
 to run (either that or change to command to
 run bash with your script as an argument)
 
 I'd also suggest putting the shell script outside of your webroot, or at 
 least in a directory that's not accessable
 from the web.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 I think this is a translation of the script to PHP.
 
 ?php
 $BASE = 100;
 $NR   = $BASE;
 
 foreach(array(30, 220, 410) as $hor) {
   $ver = 740;