php-general Digest 24 Sep 2007 15:43:24 -0000 Issue 5036

Topics (messages 262405 through 262417):

Re: Limiting connection to mysql using old mysql module (not mysqli)
        262405 by: Per Jessen
        262408 by: Chris
        262409 by: Per Jessen
        262410 by: Chris
        262411 by: Per Jessen

imagecreatefromgif fails for a valid image
        262406 by: thushw

Re: Players Table
        262407 by: Christoph

Merging PDF Documents
        262412 by: Tom Chubb
        262413 by: Edward Kay

Data request
        262414 by: Christian Hänsel
        262415 by: Stut
        262416 by: Paul Scott

Re: Access name of variable in $_POST array
        262417 by: Eric Lommatsch

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 ---
Chris wrote:

[snip]
> will not hit the first cache because the fields are different.
> http://dev.mysql.com/doc/refman/4.1/en/query-cache-how.html

All very true, but when a busy website with 100 hits/interval has 25
duplicate queries, that 24% saved per interval.  My only point was -
when you're thinking of caching, start with what is readily available
instead of re-inventing the wheel elsewhere.  

>> The number of connections is presumably only important if we speak
>> about the number of concurrent connections.  If each query can be
>> dealt with faster due to caching, the number of concurrent
>> connections  should drop.
> 
> Err no - it still has to connect to the database (thus use a
> connection slot) to even get to the cache.

Err yes - a query replied to out of cache will take less time to
complete, therefore the connection will be given up faster, therefore
less _concurrent_ connections.  


/Per Jessen, Zürich

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

The number of connections is presumably only important if we speak
about the number of concurrent connections.  If each query can be
dealt with faster due to caching, the number of concurrent
connections  should drop.
Err no - it still has to connect to the database (thus use a
connection slot) to even get to the cache.

Err yes - a query replied to out of cache will take less time to
complete, therefore the connection will be given up faster, therefore
less _concurrent_ connections.

I guess my idea of concurrency is different to yours.

100 people come to your website - that's still going to be 100 connections to the database, regardless of where the results come from.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Chris wrote:

>> Err yes - a query replied to out of cache will take less time to
>> complete, therefore the connection will be given up faster, therefore
>> less _concurrent_ connections.
> 
> I guess my idea of concurrency is different to yours.

http://en.wiktionary.org/wiki/concurrent

"Happening at the same time; simultaneous."

> 100 people come to your website - that's still going to be 100
> connections to the database, regardless of where the results come
> from.

But if that is one every hour for a hundred hours, your max concurrency
is 1.  


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
Per Jessen wrote:
Chris wrote:

Err yes - a query replied to out of cache will take less time to
complete, therefore the connection will be given up faster, therefore
less _concurrent_ connections.
I guess my idea of concurrency is different to yours.

http://en.wiktionary.org/wiki/concurrent

"Happening at the same time; simultaneous."

100 people come to your website - that's still going to be 100
connections to the database, regardless of where the results come
from.

But if that is one every hour for a hundred hours, your max concurrency
is 1.

I'm talking about "now" - not over any time span. 100 connections at the same time. If you get 100 people to your website at exactly the same time, the query cache may be used - but you're still going to have 100 connections to your database.

The OP wanted to cut that down. In which case the answer is to cache things server side using something like memcache or even one of the pear modules.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Chris wrote:

>> "Happening at the same time; simultaneous."
>> 
>>> 100 people come to your website - that's still going to be 100
>>> connections to the database, regardless of where the results come
>>> from.
>> 
>> But if that is one every hour for a hundred hours, your max
>> concurrency is 1.
> 
> I'm talking about "now" - not over any time span. 100 connections at
> the same time. If you get 100 people to your website at exactly the 
> same time, the query cache may be used - but you're still going to
> have 100 connections to your database.

For a while, yes.  I don't believe there is any sense in talking about
server load, number of connections, caching and concurrency without
talking about over how long. 

When you think length("now")==0, you can have an infinite number of
connections. 


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
I get a failure in creating a gif. php error log shows this:

Sep 24 00:25:47 thushw-laptop apache2: PHP Warning:  imagecreatefromgif() [
function.imagecreatefromgif function.imagecreatefromgif ]:
'/home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/img/new/button-middle.gif'
is not a valid GIF file in
/home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/button.php on
line 30

the gif can be viewed by gthumb. it seems ok.

the problem is only for some gifs. Most gifs, all pngs, jpegs that i've
tested so far work.

i'm running php5 on ubuntu (uname -a : Linux thushw-laptop 2.6.20.3-ubuntu1
#2 SMP Sun Apr 15 11:26:58 PDT 2007 i686 GNU/Linux)

phpinfo shows:

gd
GD Support      enabled
GD Version      2.0 or higher
FreeType Support        enabled
FreeType Linkage        with freetype
FreeType Version        2.2.1
T1Lib Support   enabled
GIF Read Support        enabled
GIF Create Support      enabled
JPG Support     enabled
PNG Support     enabled
WBMP Support    enabled

from what i've read so far, seems like i need gd lib >=2.0.28. from phpinfo
output it is not clear if i have the right version. i use: apt-get install
php5-gd to install gd

these are the files i think are of importance:

/usr/lib/libgd.so.2.0.34
/usr/lib/libgd.so.2

[the second is a symlink to the first]

>> ls -l /usr/lib/libgd.so.2
lrwxrwxrwx 1 root root 15 2007-09-24 00:25 /usr/lib/libgd.so.2 ->
libgd.so.2.0.34

how do i debug this further?  any help greatly appreciated. this problem
doesn't appear with the gd we have installed on our centos servers. seems to
happen only on my ubuntu install.

thushara
-- 
View this message in context: 
http://www.nabble.com/imagecreatefromgif-fails-for-a-valid-image-tf4507593.html#a12855355
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
Players
------------------------
NFL_Team ( varchar32 )
Fantasy_team ( varchar32 )

I player can definitely be part of only 1 NFL Team. But how are you handling your league? Is this just for a single small group of people? Or is this database to be set up for lots of leagues? If the latter, you should move Fantasy_team out to another table.

Also, do you want to be able to track a player historically? If so, you might want to move NFL_Team to another table as well since a player can get traded.

Salary cap (int )6

Why do you need this? For the fantasy league? If so, is the cap different for each league? If so, you might want to break this out.

Another thought.
I am not sure on what to do with the players stats.
Should that be in the same table as his profile info?
Like Passing Yards, touchdowns, etc.

If you want to track this as part of historical data, put it into another table. Otherwise it should do fine in the player table.

thnx,
Chris
--- End Message ---
--- Begin Message ---
Please can someone tell me if this is easy to do or whether I should
use a package already available...

I want to upload a pdf file to a folder then for each subsequent
upload, I want it to be appended to the original file. Each pdf is a
timesheet, so I want to end up with one file for all timesheets
instead of different files every week.

What I'd like to know is which function I can use on PHP4?
Is it PDF_begin_page_ext?
Any help appreciated.

Thanks,

Tom

-- 
Tom Chubb
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
>
> Please can someone tell me if this is easy to do or whether I should
> use a package already available...
>
> I want to upload a pdf file to a folder then for each subsequent
> upload, I want it to be appended to the original file. Each pdf is a
> timesheet, so I want to end up with one file for all timesheets
> instead of different files every week.
>
> What I'd like to know is which function I can use on PHP4?
> Is it PDF_begin_page_ext?
> Any help appreciated.
>
> Thanks,
>
> Tom

I haven't used the PDF functions in PHP, but I think they're primarily
designed for creating new PDF files.

I think http://www.linux.com/articles/36815 will be helpful to you though.

Edward

--- End Message ---
--- Begin Message ---
Good afternoon folks,

as this is not directly related to PHP, I put "OT" into the subject line...
Just trying to stop them watchdogs from biting me ;o)

Anyhow, I am looking for data, preferrably in CSV format, concerning
aircraft. I do have a list of all aircraft which are currently crossing our
sky, but what I am looking for is a dataset with as much information as
possible, i.e. seating capacity, which airline is flying this aircraft,
range... all that kind of stuff.

If anybody has a good resource for stuff like that, please let me know. It
would be highly appreciated.

All the best!

Chris

--
-------------------------------------
My baby's first words will be
"Hello World"



--
-------------------------------------
My baby's first words will be
"Hello World"

--- End Message ---
--- Begin Message ---
Christian Hänsel wrote:
as this is not directly related to PHP, I put "OT" into the subject line...
Just trying to stop them watchdogs from biting me ;o)

No you didn't. Chomp!

Anyhow, I am looking for data, preferrably in CSV format, concerning
aircraft. I do have a list of all aircraft which are currently crossing our
sky, but what I am looking for is a dataset with as much information as
possible, i.e. seating capacity, which airline is flying this aircraft,
range... all that kind of stuff.

Ok... I don't think "OT" would have covered it anyway.

If anybody has a good resource for stuff like that, please let me know. It
would be highly appreciated.

Have you tried Google? It knows a lot about most things and a little about the rest.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
On Mon, 2007-09-24 at 14:14 +0100, Stut wrote:
> Have you tried Google? It knows a lot about most things and a little 
> about the rest.

Also try have a look at the models used in flightgear -
http://www.flightgear.org 

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

--- End Message ---
--- Begin Message ---
Hello Dan,

First off I am sorry for not getting back to you sooner, I had a weekend and
was not checking my work email

The reason that I want both the name of the variable and the value of the
variable is because what I need to do is create a text file that another
program I am integrating with is already designed to work with. If I am not
putting the field names in the file along with the data this other program
ignores the file I am creating. What I need as an output is something that
looks similar to:

FirstName       :       Eric
LastName        :       Lommatsch

The point of the script that I am writing is that I want it to be capable of
handling several different PDF forms.

Thank you
 
Eric H. Lommatsch
Programmer
360 Business 
2087 South Grant Street
Denver, CO 80210
Tel 303-777-8939
Fax 303-778-0378
 
[EMAIL PROTECTED]

-----Original Message-----
From: Dan Parry [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 6:26 PM
To: 'Daniel Brown'; 'Stut'
Cc: Eric Lommatsch; [EMAIL PROTECTED]
Subject: RE: [PHP] Access name of variable in $_POST array

> -----Original Message-----
> From: Daniel Brown [mailto:[EMAIL PROTECTED]
> Sent: 21 September 2007 23:27
> To: Stut
> Cc: Eric Lommatsch; [EMAIL PROTECTED]
> Subject: Re: [PHP] Access name of variable in $_POST array
> 
> On 9/21/07, Stut <[EMAIL PROTECTED]> wrote:
> > Please include the list when replying.
> >
> > Eric Lommatsch wrote:
> > > -----Original Message-----
> > > From: Stut [mailto:[EMAIL PROTECTED]
> > > Sent: Friday, September 21, 2007 3:09 PM
> > > To: Eric Lommatsch
> > > Cc: [EMAIL PROTECTED]
> > > Subject: Re: [PHP] Access name of variable in $_POST array
> > >
> > > Eric Lommatsch wrote:
> > >> I am writing a PHP script that is going to accept variables that
> are
> > >> passed from a PDF form and should write both the name of the
> variable
> > >> and its value to a text file.
> > >>
> > >>
> > >> I can get the value that I want to retrieve with out problem.
> However,
> > >> even though I have searched through the PHP.net site and googled
> this
> > >> as well I have not yet been able to find the syntax that I need 
> > >> to
> get
> > >> the names of the variables in the $_Post array.
> > >>
> > >> Can someone point me to the place in the PHP manual where I can
> find
> > >> the syntax to get the name of a variable in the $_POST array?
> > >
> > > http://php.net/array_keys
> > >
> > > As in...
> > >
> > > $varnames = array_keys($_POST);
> > >
> > > -Stut
> > >
> > > --
> > > http://stut.net/
> > >
> > > Hello Stut,
> > >
> > > That is not exactly what I am looking for. If I try using that in
> My PHP
> > > script what I get as a result of that is repeatedly the Phrase
> "Post Array"
> > > when I check the values there. The PDF form that is posting to the
> PHP script
> > > is passing variable names like "Employer_name" or "Employee_Name".
> I am
> > > hoping to get those variable names.
> >
> > Put this line at the top of the script that the form posts to...
> >
> > print '<pre>'.print_r($_POST, true).'</pre>'; exit;
> >
> > That will display the contents of the $_POST array and you should be 
> > able to figure out where everything is.
> >
> > By the sounds of it the posted values are actually in $_POST['Post 
> > Array'] but use the above line to be sure.
> >
> > -Stut
> >
> > --
> > http://stut.net/
> >
> > --
> > PHP General Mailing List (http://www.php.net/) To unsubscribe, 
> > visit: http://www.php.net/unsub.php
> >
> >
> 
>     Maybe this will get you started and give you some ideas.
> 
> <?
> foreach($_POST as $p => $v) {
>     $$p = $v;
>     echo $p." = ".$v."\n";
> }
> ?>

I might be missing something but I fail to see the point of the variable
variable assignation (which is best to be avoided :) )

Dan

--- End Message ---

Reply via email to