php-general Digest 26 Jan 2008 23:57:29 -0000 Issue 5258

Topics (messages 268148 through 268161):

Re: Rename
        268148 by: Nathan Rixham
        268154 by: Nathan Nobbe
        268156 by: Per Jessen

Re: how dod you get to do multiple mysql queries  concurrently?
        268149 by: Per Jessen
        268150 by: Per Jessen
        268151 by: Nathan Rixham
        268153 by: Per Jessen
        268155 by: Per Jessen

Re: how do you get to do multiple mysql queries concurrently?
        268152 by: Per Jessen

Printing Question
        268157 by: Peter Jackson
        268158 by: Floor Terra
        268159 by: Robert Cummings

Re: Exception thrown without a stack frame
        268160 by: Jochem Maas

determine file-upload's tmp-filename
        268161 by: Michael Fischer

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
vote 2 for:
mv dir1/* dir2

:) backticks!

Per Jessen wrote:
Pastor Steve wrote:

I have been looking, but the problem is that I don¹t know what
questions to ask or what to look for. I think it is a rename function.
That works, but it only does one file at a time. I was looking for
something that will do all the files in the directory without needing
to know the name of each file.


mv dir1/* dir2


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
On Jan 26, 2008 3:52 AM, Nathan Rixham <[EMAIL PROTECTED]> wrote:

> vote 2 for:
> mv dir1/* dir2


its nice, but its platform dependent.

-nathan

--- End Message ---
--- Begin Message ---
Nathan Nobbe wrote:

> On Jan 26, 2008 3:52 AM, Nathan Rixham <[EMAIL PROTECTED]> wrote:
> 
>> vote 2 for:
>> mv dir1/* dir2
> 
> 
> its nice, but its platform dependent.

Which surely is not that much of a drawback?  (well, the OP didn't
mention it anyway).



/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
Richard Lynch wrote:

> On Fri, January 25, 2008 3:35 am, Per Jessen wrote:
>> I have a website where some of the pages require several mysql
>> queries -
>> they're independent, so in principle they could easily be run in
>> parallel.  Has anyone looked at doing that?
> 
> If MySQL has implemented "cursors" in some new version, you have just
> described a "cursor"...
> 
> There may be something else in MySQL to do this, mind you, but that's
> the easiest way I know of in other DBs...

cursors exist in mysql too, but I don't quite see how I could use them
to run two queries concurrently?  Also, these queries don't return a
lot of data.


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
Richard Lynch wrote:

> 
> 
> On Fri, January 25, 2008 5:07 am, Colin Guthrie wrote:
>> Per Jessen wrote:
>>> I know how to do multiple queries - the key issue in my question was
>>> how
>>> to do them concurrently (i.e. in parallel).
>>
>> So you want to make PHP multithreaded???
> 
> No, he wants to leverage the multi-threaded MySQL DB in the background
> to have *IT* running several queries at once.

Exactly.

> I suspect the overhead of bridging to/from that other thing would
> dwarf the query times, unless you're running queries that are too long
> to start with...

They are too long.  I have e.g. two queries that each take 30 seconds,
so a total of 60 seconds. Running in parallel would reduce runtime by
50%. 

> In which case you should queue them up in a list of "jobs" and notify
> the users when they are finished instead of making the user wait
> around.

Yeah, but that's just like running off-line reports and having them sent
by email.  It kind of ruins the idea of having the information
available on-line in real-time.


/Per Jessen, Zürich

--- End Message ---
--- Begin Message --- I posted you a short script on this thread at 04:07 GMT today that'll get you multithreading (via cli) - but even then you can shell exec that cli script from apache..

Per Jessen wrote:
Richard Lynch wrote:

On Fri, January 25, 2008 3:35 am, Per Jessen wrote:
I have a website where some of the pages require several mysql
queries -
they're independent, so in principle they could easily be run in
parallel.  Has anyone looked at doing that?
If MySQL has implemented "cursors" in some new version, you have just
described a "cursor"...

There may be something else in MySQL to do this, mind you, but that's
the easiest way I know of in other DBs...

cursors exist in mysql too, but I don't quite see how I could use them
to run two queries concurrently?  Also, these queries don't return a
lot of data.


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
Nathan Rixham wrote:

> I posted you a short script on this thread at 04:07 GMT today that'll
> get you multithreading (via cli) - but even then you can shell exec
> that cli script from apache..

Yeah, I noticed, thanks.  The thing is - once pcntl_fork() is added to
the mix, it's getting a little too complicated for what was otherwise a
simple php web-application.  I'm thinking I'm probably better off with
my iframe-rpc stuff. 

>Back on the mysql side of things, try using geometry columns rather
>than numerical primary keys, with spatial indexes.. it's a MASSIVE 
>performance upgrade (I've cut 5 second queries down to 0.005 by using 
>geo columns)

Uh, could you could elaborate a bit on that (whilst I go and do some
googling)? 


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
Richard Lynch wrote:

> Is it really going to help anything to slam the database with 3 X
> queries instead of just letting it finish one before you hit it again?
> You have a VERY good chance of just thrashing MySQL server instead of
> actually gaining any performance.

It's an 8-way box with 8Gb memory, it has multi-path SAN access - it'll
take it :-)


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
Richard Lynch wrote:

> Process forking has EVERYTHING to do with thread safety.
> Whatever is going to go wrong in a threaded environment is going to
> also go wrong when you fork the process, almost for sure.

Forking a process and creating a thread are really two very different
concepts (from a programming pov).

In a threaded environment you often have e.g. semaphores and mutexes to
coordinate access to shared data.  When you've forked a process, you
share data over IPC or similar. 
When you create a new thread, it has access to global scope variables in
the main tread.  It has access to shared heap storage.  None of this
applies to a forked process. 


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
OK this is very general.

Whats the best way to do formatted printing via php?

In my case I have a postgre database that I connect to with a php(naturally seeing as this is the php list).

 My aim is to convert an Access db to php/postgre.

In this access db there are several reports that require landscape printing.

 So the question is how to replace this via php/whatever.

(I did say it was a vague question)

 Oh and I'm aiming for a unix/windows outcome.

 any links welcome.

TIA

Peter

--- End Message ---
--- Begin Message ---
On Jan 26, 2008 1:03 PM, Peter Jackson <[EMAIL PROTECTED]> wrote:

> Whats the best way to do formatted printing via php?

You could try PDFlib().
Draw your reports to landscape formated pdf's and print them.

> Oh and I'm aiming for a unix/windows outcome.

pdf is platform independent.

I hope this is what you meant.

Floor

--- End Message ---
--- Begin Message ---
On Sat, 2008-01-26 at 15:19 +0100, Floor Terra wrote:
> On Jan 26, 2008 1:03 PM, Peter Jackson <[EMAIL PROTECTED]> wrote:
> 
> > Whats the best way to do formatted printing via php?
> 
> You could try PDFlib().
> Draw your reports to landscape formated pdf's and print them.
> 
> > Oh and I'm aiming for a unix/windows outcome.
> 
> pdf is platform independent.
> 
> I hope this is what you meant.

I recently had a request from a client to create a button on client
search results that would generate page that could print off a mailing
envelope for each selected client. They wanted to run a print batch on a
couple of thousand clients. So I used HTML, CSS. Specifically to force
page breaks while printing I used the following:

    <div style="page-break-after: always"></div>

Note that you can't use a span for the above css attribute. Then for
various dimensions of the envelope and return address etc, I used CSS
attributes defined by the inches unit. I'll admint I whipped it up quick
and dirty using tables (sorry, tables are just simpler for generating
quick layouts than divs are... talk to the hand smelly purists :)
So something like the following:

    table.envelopeLayout
    {
        width: 13in;
    }

    table.envelopeLayout td.returnAddress
    {
        height: 3in;
    }

So this looked nice in the browser, but when they went to print it got
all borked when they told IE to use landscape mode. So I told them to
upgrade to a real browser (Firefox (though I prefer Opera :)). After
that they told me it worked perfectly. So, to make the point... you do't
need PDF, HTML will do. BTW, I did this all remotely and someone on-site
did a couple of print tests to give me feedback. I never even got to see
their new fancy schmancy printer :)

I've done other print stuff via the browser before too... such as state
driving certificates for presentation in court. Never had a problem once
the layout and print configuration were refined.

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

--- End Message ---
--- Begin Message ---
Nathan Rixham schreef:
wayyyyy offf topic-ish here..

class destructors, surely they differ from the register_shutdown_function in execution style? seeing as one can echo / do a bit of jiggery pokery before the buffers close.

what exactly is the difference?

the problem with destructors is that you have no garantee of the
destruction order which means you can't garanteed any other objects
will be available (e.g. to write a log to a db or something similar)


Richard Lynch wrote:
On Fri, January 25, 2008 1:31 pm, Jochem Maas wrote:
setup as via register_shutdown_function().

I missed that bit.

Sorry for the noise.

shutdown functions are run outside the normal context of PHP, and need
special care.

Output won't go anywhere, and try/catch won't work, as the bulk of the
PHP "guts" have already gone away.



--- End Message ---
--- Begin Message ---
hi there,

is there a way to determine the tmp-filename of a file upload while the upload 
is still in progress?

the tmp-file is stored in /tmp and it's name is something like PHPXXXXXXXX.

what i would like to do is:
i want to upload a file via a html-form and while the upload is in progress 
make repeatedly ajax-requests to a php-script on the server that replies the 
size of the tmp file (the amount of data that was already uploaded). So in this 
script i need to know what the tmp-filename is.

or do you think this is a completely useless approach?

lg, Michi

--- End Message ---

Reply via email to