Re: [PHP] mysql_query blocking

2009-06-28 Thread Lester Caine

Daniel Kolbo wrote:

Hello,

When a MySQL table is locked a php call of mysql_query() that requires
that table will hang as the request blocks at the MySQL server until the
table is unlocked.  Is there a way to stop a mysql_query from hanging
(by setting a time limit)?


Daniel
I can understand you asking the question here, but I suspect that the 
answer may come better from a list who has people who are more expert in 
MySQL?


Personally - with Firebird - this is not a problem that ever arises 
since 'locking' is not something one would normally do and has only 
appeared IN Firebird because people 'expect' that is how a database 
works. Even if using it would actually be wrong :) The problem is that 
the database is the problem rather than PHP, hence the questions about 
which type of tables you are using in MySQL.


From my personal experience, it's the way that you are using the 
database that may be wrong if it relies on 'locking' to achieve 
something that is not properly managed IN the database. Any database can 
provide 'locking', if that is really required, by additional flagging in 
the database - if the database itself does not provide the function 
properly. Such as setting an 'edit' flag on a record showing who is 
changing it, which can then be used to advise that fact to other users.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



[PHP] Re: Image Type BMP @ "Save Image As" Dialog on IE

2009-06-28 Thread Martin Zvarík

Nitsan Bin-Nun napsal(a):

I have wrote a PHP script that serves JPEG images in smaller size, the
resize is done using GD on-the-fly.
I have noticed an interesting issue during the "save image as..." dialog on
serveral internet explorer browsers, somehow, for some strange reason, the
JPEG file is shown as BMP file.

I don't know why this is happening, but I'm trying to make it save it as JPG
file.
In firefox or any other browser everything works like a charm.

I have to mention that the JPG file is located in the HTML in the following
format:


I have also used mod_rewrite to serve the file with .jpg extension (I
thought that the strange IE may not know how to recognize it..), the PHP
file is sending the correct headers, I'm attaching an example for HTTP
request & response for this resized image:

GET /gallery-image-dolphinim-12450163853. HTTP/1.1
Host: www.dolphinim.net
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10)
Gecko/2009042316 Firefox/3.0.10 FirePHP/0.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: PHPSESSID=e4542edfa5bcb7904e351d39c341fffa

HTTP/1.x 200 OK
Date: Fri, 26 Jun 2009 16:18:52 GMT
Server: Apache/1.3.41 (Unix) PHP/5.2.6 mod_log_bytes/1.2 mod_bwlimited/1.4
mod_auth_passthrough/1.8 FrontPage/5.0.2.2635 DAV/1.0.3 mod_ssl/2.8.31
OpenSSL/0.9.8e-fips-rhel5
X-Powered-By: PHP/5.2.6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache
Keep-Alive: timeout=15, max=98
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: image/jpeg


Any directions will be highly appreciated!

Thanks!



I have noticed the same thing... although after the temporary files 
clean up and refresh it works OK.


So, this is an IE bug - I have not found any workaround.

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



Re: [PHP] Re: Image Type BMP @ "Save Image As" Dialog on IE

2009-06-28 Thread Nitsan Bin-Nun
I have been working on it for a while but no luck.

I personally don't have IE to test it but my customer have noticed it and
brought it up to the table.

If you have any ideas I would like to hear you out :)

On Sun, Jun 28, 2009 at 5:28 PM, Martin Zvarík  wrote:

> Nitsan Bin-Nun napsal(a):
>
>  I have wrote a PHP script that serves JPEG images in smaller size, the
>> resize is done using GD on-the-fly.
>> I have noticed an interesting issue during the "save image as..." dialog
>> on
>> serveral internet explorer browsers, somehow, for some strange reason, the
>> JPEG file is shown as BMP file.
>>
>> I don't know why this is happening, but I'm trying to make it save it as
>> JPG
>> file.
>> In firefox or any other browser everything works like a charm.
>>
>> I have to mention that the JPG file is located in the HTML in the
>> following
>> format:
>> 
>>
>> I have also used mod_rewrite to serve the file with .jpg extension (I
>> thought that the strange IE may not know how to recognize it..), the PHP
>> file is sending the correct headers, I'm attaching an example for HTTP
>> request & response for this resized image:
>>
>> GET /gallery-image-dolphinim-12450163853. HTTP/1.1
>> Host: www.dolphinim.net
>> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10)
>> Gecko/2009042316 Firefox/3.0.10 FirePHP/0.3
>> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
>> Accept-Language: en-us,en;q=0.5
>> Accept-Encoding: gzip,deflate
>> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
>> Keep-Alive: 300
>> Connection: keep-alive
>> Cookie: PHPSESSID=e4542edfa5bcb7904e351d39c341fffa
>>
>> HTTP/1.x 200 OK
>> Date: Fri, 26 Jun 2009 16:18:52 GMT
>> Server: Apache/1.3.41 (Unix) PHP/5.2.6 mod_log_bytes/1.2 mod_bwlimited/1.4
>> mod_auth_passthrough/1.8 FrontPage/5.0.2.2635 DAV/1.0.3 mod_ssl/2.8.31
>> OpenSSL/0.9.8e-fips-rhel5
>> X-Powered-By: PHP/5.2.6
>> Expires: Thu, 19 Nov 1981 08:52:00 GMT
>> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
>> pre-check=0
>> Pragma: no-cache
>> Keep-Alive: timeout=15, max=98
>> Connection: Keep-Alive
>> Transfer-Encoding: chunked
>> Content-Type: image/jpeg
>>
>>
>> Any directions will be highly appreciated!
>>
>> Thanks!
>>
>>
> I have noticed the same thing... although after the temporary files clean
> up and refresh it works OK.
>
> So, this is an IE bug - I have not found any workaround.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] Problems with an extension

2009-06-28 Thread Eric A. Boney
So I am developing a custom extension and I am having a issue. I have a header 
file that I need included in the project. If I #include the header file 
everything compiles and makes just fine, but after restarting the web server 
the extension won't load.

If I remove or comment out the #include of the header file everything still 
compiles and makes just fine, and after restarting the web server the extension 
is loaded just fine.

Does anyone have any idea what would cause the extension to refuse to load 
with the header file included?

-Eric

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



Re: [PHP] Problems with an extension

2009-06-28 Thread Daniel Brown
On Sun, Jun 28, 2009 at 10:56, Eric A.
Boney wrote:
> So I am developing a custom extension and I am having a issue. I have a header
> file that I need included in the project. If I #include the header file
> everything compiles and makes just fine, but after restarting the web server
> the extension won't load.

Eric,

Custom extensions programming is in C/C++ (as also indicated by
your #include reference), which is beyond the scope of this list.
Unfortunately, there is not an official dedicated list for extensions
developers, but if it's not urgent, you can email me privately at
danbr...@php.net and I'll see if I can help you out.

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Ask me about our fully-managed servers and proactive management
clusters starting at just $200/mo.!

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



Re: [PHP] Problems with an extension

2009-06-28 Thread Eric A. Boney
On Sunday 28 June 2009 11:00:48 you wrote:
> On Sun, Jun 28, 2009 at 10:56, Eric A.
>
> Boney wrote:
> > So I am developing a custom extension and I am having a issue. I have a
> > header file that I need included in the project. If I #include the header
> > file everything compiles and makes just fine, but after restarting the
> > web server the extension won't load.
>
> Eric,
>
> Custom extensions programming is in C/C++ (as also indicated by
> your #include reference), which is beyond the scope of this list.
> Unfortunately, there is not an official dedicated list for extensions
> developers, but if it's not urgent, you can email me privately at
> danbr...@php.net and I'll see if I can help you out.
Thanks Dan:

I thought it might be beyond this list, but I figured it might be worth the 
shot. It is not urgent at all, so I will drop you a private message with a 
more detailed explanation and if you can help great, if not, I'll keep poking 
around at it.

-Eric


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



Re: [PHP] mysql_query blocking

2009-06-28 Thread Tom Worster
On 6/27/09 7:09 PM, "Daniel Kolbo"  wrote:

> Tom Worster wrote:
>> On 6/27/09 3:15 PM, "Daniel Kolbo"  wrote:
>> 
>>> When a MySQL table is locked a php call of mysql_query() that requires
>>> that table will hang as the request blocks at the MySQL server until the
>>> table is unlocked.  Is there a way to stop a mysql_query from hanging
>>> (by setting a time limit)?
>> 
>> would it be possible to test for presence of the lock before issuing the
>> query that would block? if so, you could check the lock periodically until
>> your time limit is up. would achieve you you're looking for?
>> 
>> 
>> 
> it would still be possible that after checking but before issuing the
> query the table's could be locked - albeit a much smaller chance.

that's true.

what would be nice for this kind of problem would be a kind of async api,
perhaps a bit like curl_multi but with a way to check the state of an
outstanding query (queued, processing, etc). much like a js script uses
ajax.



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



[PHP] Socket error

2009-06-28 Thread Luke
Hey guys, getting an odd error here... The code involved:

$master_socket = socket_create_listen($this->port);

socket_bind($master_socket, '127.0.0.1', $this->port);
socket_listen($master_socket);
socket_set_option($master_socket, SOL_SOCKET, SO_REUSEADDR, 1);
socket_set_nonblock($master_socket);

And I'm getting:

'PHP Warning:  socket_bind(): unable to bind address [22]: Invalid argument
in /home/luke/talkserver/new/classes/server.php online 30'

$this->port is valid, I've checked both this and that socket_create_listen
seems to be executing correctly.

I'm a bit lost on the error too it seems to be what the php.net manual says
are the parameters?

I'm trying to create a listening socket server that binds to a port on the
local machine.

Thanks in advance for any help!

-- 
Luke Slater
:O)


[PHP] Best way to reinstate radio-button states from database?

2009-06-28 Thread Rob Gould
I have a webpage which allows people to log in and make selections  
with radio buttons and hit SUBMIT and saves the data from those radio  
buttons to a mySQL database.


However, I'm finding that I also need the ability to allow a user to  
log back in at a later date (or even on a different computer), and  
pull up that survey again,
with each of the 50-something radio-buttons back in the positions in  
which they were last saved.


Surely there's a best-case-method for doing this type of thing (saving  
large numbers of radio-button-group settings to mySQL and pulling them  
back
again later).  Any advice is greatly appreciated.  Perhaps there's a  
jQuery-way to retrieve all the radio-button group settings as an array  
and save it and pull it back again?

Or perhaps a PHP-specific method - - - I'm fine with either.



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



Re: [PHP] Best way to reinstate radio-button states from database?

2009-06-28 Thread Bastien Koert
On Sun, Jun 28, 2009 at 7:12 PM, Rob Gould wrote:
> I have a webpage which allows people to log in and make selections with
> radio buttons and hit SUBMIT and saves the data from those radio buttons to
> a mySQL database.
>
> However, I'm finding that I also need the ability to allow a user to log
> back in at a later date (or even on a different computer), and pull up that
> survey again,
> with each of the 50-something radio-buttons back in the positions in which
> they were last saved.
>
> Surely there's a best-case-method for doing this type of thing (saving large
> numbers of radio-button-group settings to mySQL and pulling them back
> again later).  Any advice is greatly appreciated.  Perhaps there's a
> jQuery-way to retrieve all the radio-button group settings as an array and
> save it and pull it back again?
> Or perhaps a PHP-specific method - - - I'm fine with either.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I've tended to use a binary string for the values, as my radio/
checkboxs tend to be yes / no, so I store the data in a single field
as 010111010101010111000 using 0=no and 1=yes.

Then a quick loop through the string sets my values.


-- 

Bastien

Cat, the other other white meat

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



[PHP] Socket error

2009-06-28 Thread Luke
Hey guys, getting an odd error here... The code involved:

$master_socket = socket_create_listen($this->port);

socket_bind($master_socket, '127.0.0.1', $this->port);
socket_listen($master_socket);
socket_set_option($master_socket, SOL_SOCKET, SO_REUSEADDR, 1);
socket_set_nonblock($master_socket);

And I'm getting:

'PHP Warning:  socket_bind(): unable to bind address [22]: Invalid argument
in /home/luke/talkserver/new/classes/server.php online 30'

$this->port is valid, I've checked both this and that socket_create_listen
seems to be executing correctly.

I'm a bit lost on the error too it seems to be what the php.net manual says
are the parameters?

I'm trying to create a listening socket server that binds to a port on the
local machine.

Thanks in advance for any help!


-- 
Luke Slater
:O)


Re: [PHP] Socket error

2009-06-28 Thread Stuart
2009/6/29 Luke :
> Hey guys, getting an odd error here... The code involved:
>
>            $master_socket = socket_create_listen($this->port);
>
>            socket_bind($master_socket, '127.0.0.1', $this->port);
>            socket_listen($master_socket);
>            socket_set_option($master_socket, SOL_SOCKET, SO_REUSEADDR, 1);
>            socket_set_nonblock($master_socket);
>
> And I'm getting:
>
> 'PHP Warning:  socket_bind(): unable to bind address [22]: Invalid argument
> in /home/luke/talkserver/new/classes/server.php online 30'
>
> $this->port is valid, I've checked both this and that socket_create_listen
> seems to be executing correctly.
>
> I'm a bit lost on the error too it seems to be what the php.net manual says
> are the parameters?
>
> I'm trying to create a listening socket server that binds to a port on the
> local machine.
>
> Thanks in advance for any help!

What port are you trying to bind to? If it's <= 1024 then you need to
run it as a privileged user.

-Stuart

-- 
http://stut.net/

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



Re: [PHP] Socket error

2009-06-28 Thread Luke
2009/6/29 Stuart 

> 2009/6/29 Luke :
> > Hey guys, getting an odd error here... The code involved:
> >
> >$master_socket = socket_create_listen($this->port);
> >
> >socket_bind($master_socket, '127.0.0.1', $this->port);
> >socket_listen($master_socket);
> >socket_set_option($master_socket, SOL_SOCKET, SO_REUSEADDR,
> 1);
> >socket_set_nonblock($master_socket);
> >
> > And I'm getting:
> >
> > 'PHP Warning:  socket_bind(): unable to bind address [22]: Invalid
> argument
> > in /home/luke/talkserver/new/classes/server.php online 30'
> >
> > $this->port is valid, I've checked both this and that
> socket_create_listen
> > seems to be executing correctly.
> >
> > I'm a bit lost on the error too it seems to be what the php.net manual
> says
> > are the parameters?
> >
> > I'm trying to create a listening socket server that binds to a port on
> the
> > local machine.
> >
> > Thanks in advance for any help!
>
> What port are you trying to bind to? If it's <= 1024 then you need to
> run it as a privileged user.
>
> -Stuart
>
> --
> http://stut.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Unfortunately that doesn't make a difference :(

-- 
Luke Slater
:O)