php-general Digest 15 Sep 2010 01:00:44 -0000 Issue 6941

Topics (messages 308060 through 308074):

Re: Counting Children!
        308060 by: Sridhar Pandurangiah

Re: 1984 (Big Brother)
        308061 by: Kevin Kinsey
        308065 by: tedd

Adjusting Session Times
        308062 by: Floyd Resler
        308063 by: chris h
        308064 by: Andrew Ballard
        308066 by: tedd
        308067 by: Floyd Resler

Re: Filestat.c erorrs when building php-5.3.3 on solaris
        308068 by: STANFIELD, VICKI CTR DFAS

Re: php cli question
        308069 by: J Ravi Menon
        308071 by: Per Jessen

bcompiler: compile in a diferent directory
        308070 by: Ramiro Gonzalez

Image question for runways
        308072 by: Alexis

Re: Could this be a bug?
        308073 by: Camilo Sperberg

Re: Question about news.php.net
        308074 by: Nathan Rixham

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


----------------------------------------------------------------------
--- Begin Message --- I managed to solve this myself. Here is the code. For some reason "foreach" works for the first set of non unique tags and doesn't work if the non unique tags are nested within the first set. Use the following code to access the tag values of the nested non unique tags. (see the XML file below if this seems confusing)

                $chi = count($member->line);
                for ($i = 0; $i < $chi; $i++)
                {
                        echo $member->line[$i]->particular1;
                        echo $member->line[$i]->amount1;
                        echo $member->line[$i]->particular2;
                        echo $member->line[$i]->amount2;
                }


Best regards

Sridhar


Sridhar Pandurangiah wrote:
Hi

I have an XML generated by another computer application. The format is
as below. (Don't worry about the data in the XML. Its the test
data).

I am able to locate the correct member bill using XPATH.
However I have hit a bottleneck. I am unable to echo all the <line> elements. This is what happens

    $row = simplexml_load_string($member->asXML());

            echo $line->particular1;
            echo $line->amount1;
            echo $line->particular2;
            echo $line->amount2;

Echoes the first <line> element of the member bill. If I add the same set of statements it echoes the second <line> element and so on. But then if I put the following code which I feel is correct
    $row = simplexml_load_string($member->asXML());

        foreach ($row->line as $line);
        {
            echo $line->particular1;
            echo $line->amount1;
            echo $line->particular2;
            echo $line->amount2;
        }

Echoes only the last <line> element of the member. Can someone tell me what's wrong

-----------------The XML file -------------------------------------------------

<bill>
    <clubname>The Great Eastern Club</clubname>
    <address>Anna Road</address>
    <city>Madras</city>
    <title>BILL</title>
    <member>
        <membernumber>A00000099</membernumber>
        <billnumber>Bill no. : A00000099/APRIL 10</billnumber>
        <membername>Raman C V</membername>
        <billdate>Run date : 03/05/2010</billdate>
        <memberaddress1>NO 33,MUGAPPAIR ROAD,</memberaddress1>
        <memberaddress2>PADI,</memberaddress2>
        <membercity>CHENNAI</membercity>
        <memberpostalcode>600032</memberpostalcode>
        <memberphonenumber>9840012345</memberphonenumber>
        <preface>STATEMENT OF ACCOUNTS AND BILL FOR THE MONTH OF
APRIL-2010</preface>
        <columnh1>Particulars</columnh1>
        <columnh2>Debit</columnh2>
        <columnh3>Receivables</columnh3>
        <columnh4>Credit</columnh4>
        <line>
            <particular1>Opening Balance</particular1>
            <amount1>275.14</amount1>
            <particular2>-</particular2>
            <amount2>0.00</amount2>
        </line>
        <line>
            <particular1>CHARGES</particular1>
            <amount1>33.09</amount1>
        </line>
        <line>
            <particular1>MINIMUM USAGE</particular1>
            <amount1>220.60</amount1>
        </line>
        <line>
            <particular1>SUBSCRIPTION CHARGES</particular1>
            <amount1>220.60</amount1>
        </line>
        <line>
            <particular1>WATER CHARGE</particular1>
            <amount1>22.06</amount1>
        </line>
        <line>
            <particular1>Total Debit</particular1>
            <amount1>771.49</amount1>
            <particular2>Total Credit</particular2>
            <amount2>0.00</amount2>
        </line>
        <line>
            <particular1>Amount to be Received</particular1>
            <amount1>771.49</amount1>
        </line>
        <note>Hereafter no reminders will be sent for payment of
monthly/Arrears bills.</note>
    </member>
    <member>
        <membernumber>A00000100</membernumber>
        <billnumber>Bill no. : A00000100/APRIL 10</billnumber>
        <membername>Sandeep</membername>
        <billdate>Run date : 03/05/2010</billdate>
        <memberaddress1>NO 12,</memberaddress1>
        <memberaddress2>TNAGAR,</memberaddress2>
        <membercity>CHENNAI</membercity>
        <memberpostalcode>600017</memberpostalcode>
        <memberphonenumber>9840012365</memberphonenumber>
        <preface>STATEMENT OF ACCOUNTS AND BILL FOR THE MONTH OF
APRIL-2010</preface>
        <columnh1>Particulars</columnh1>
        <columnh2>Debit</columnh2>
        <columnh3>Receivables</columnh3>
        <columnh4>Credit</columnh4>
        <line>
            <particular1>Opening Balance</particular1>
            <amount1>496.38</amount1>
            <particular2>-</particular2>
            <amount2>0.00</amount2>
        </line>
        <line>
            <particular1>ENTERTAINMENT CHARGES</particular1>
            <amount1>33.09</amount1>
            <particular2>17/06/2010 CASH PCR/000544/10-11</particular2>
            <amount2>124.00</amount2>
        </line>
        <line>
            <particular1>MINIMUM USAGE</particular1>
            <amount1>124.00</amount1>
        </line>
        <line>
            <particular1>SUBSCRIPTION CHARGES</particular1>
            <amount1>220.60</amount1>
        </line>
        <line>
            <particular1>WATER CHARGE</particular1>
            <amount1>22.06</amount1>
        </line>
        <line>
            <particular1>Total Debit</particular1>
            <amount1>896.13</amount1>
            <particular2>Total Credit</particular2>
            <amount2>124.00</amount2>
        </line>
        <line>
            <particular1>Amount to be Received</particular1>
            <amount1>772.13</amount1>
        </line>
        <note>Hereafter no reminders will be sent for payment of
monthly/Arrears bills.</note>
    </member>
</bill>

--- End Message ---
--- Begin Message ---
Gary wrote:
tedd wrote:
I have a client who wants his employees' access to their online business
database restricted to only times when he is logged on. (Don't ask why)

Simply put a "dead man's handle" under his seat which turns on the power
to the server when he sits on it.


I figured we'd get here sooner or later, esp. after I saw Daniel B. talking
about lawnmowers.

And now you can tell the client with a straight face ... "if you want any
work to get done today you'd best sit your @$$ down right here...."

Then, of course, for fun, you could encourage PHB to bounce up & down a
few times a day "to keep the employees on their toes."  He'd dig it, I'm
sure, and you'd pick up a good parcel of extra work recovering DB's ...
and disks.

Richard Quadling:
You get all the employees in a room, with the boss.

And then you tell them that when the boss isn't in, they don't have to
do any work.

I'm pretty sure the employees will be your new BFFs.

+11.

We should ABSOLUTELY copy Scot Adams on this.

Wait a minute, maybe Tedd's client IS Scot Adams.

Kevin Kinsey

--- End Message ---
--- Begin Message ---
At 8:05 PM -0400 9/13/10, Daniel Brown wrote:
The boss stands up, his entire infrastructure collapses, everyone's
connections are closed, and all PCs subsequently catch fire.

LOL

Sounds good to me.

After that happens a couple of times, maybe things will change. If it's the private sector, they investigate and find a better solution. If it's the public sector, they will probably require water based fire extinguishers.

Cheers,

tedd

--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---
We just got a client whose requirement is that user sessions expire after 30 
minutes of inactivity.  Our other clients are happy with not having their 
sessions expire during the work day (i.e. life is 8 hours).  I am using a MySQL 
database to store the session data.  My thought is to adjust the session 
expiration in the table based on the client currently logged in.  Is this a 
good approach or would there be better ways to do it?  And just to clarify: all 
clients use the same Web site.

Thanks!
Floyd


--- End Message ---
--- Begin Message ---
> My thought is to adjust the session expiration in the table based on the
> client currently logged in.
>
>
I don't know if there's a better way, but I would probably just do that.
 The expiration would be set to whatever the client's preference is, and
default to 8 hours if he doesn't have one.  You may want to set some checks
to ensure that the client's preference is within a specific range (e.g.
between 30 minutes and 16 hours).


Chris.

--- End Message ---
--- Begin Message ---
On Tue, Sep 14, 2010 at 10:26 AM, Floyd Resler <fres...@adex-intl.com> wrote:
> We just got a client whose requirement is that user sessions expire after 30 
> minutes of inactivity.  Our other clients are happy with not having their 
> sessions expire during the work day (i.e. life is 8 hours).  I am using a 
> MySQL database to store the session data.  My thought is to adjust the 
> session expiration in the table based on the client currently logged in.  Is 
> this a good approach or would there be better ways to do it?  And just to 
> clarify: all clients use the same Web site.
>
> Thanks!
> Floyd

I store the date and time of the last page access and the session
lifetime in minutes in the database. Then when I fetch the session
from the database, the WHERE clause includes a condition that the
number of minutes elapsed between the current date/time and the time
stored in the session table is less than the session lifetime (maximum
duration of inactivity for that session). That way, each individual
user could have his or her own session timeout period if needed.

Andrew

--- End Message ---
--- Begin Message ---
At 10:26 AM -0400 9/14/10, Floyd Resler wrote:
We just got a client whose requirement is that user sessions expire after 30 minutes of inactivity. Our other clients are happy with not having their sessions expire during the work day (i.e. life is 8 hours). I am using a MySQL database to store the session data. My thought is to adjust the session expiration in the table based on the client currently logged in. Is this a good approach or would there be better ways to do it? And just to clarify: all clients use the same Web site.

Thanks!
Floyd

Floyd:

I don't know how others solve this, but my solution is pretty straightforward (see code below).

I require this code for every script that is in the secured area. Simply put, if the user runs a script, then this script is also run.

As a result, if the user is not logged in they are directed to the login script. If the user is logged in, but has exceeded the expiration time due to inactivity, then the user is redirected to the same login script with a GET value to trigger the login script to report that they timed out due to inactivity.

I find it bad practice to tell a user that they are not logged in when they did log in. It's better to explain why they have to log on again.

Now, with respect to your storing the expiration time in the database, that could be done easily enough by this script accessing the database, getting, and setting the time-limit -- OR -- at the start of any logon have the script pull the time-limit from the database and store that value in a SESSION. Either way would work.

In any event, this is what I do.

Cheers,

tedd

========== code

<?php

$redirect = 'http://yourdomain.com/admin/logon.php';

// standard security

$secure = isset($_SESSION['security']) ? $_SESSION['security'] : 0;

if ($secure == 0) // if admin is not logged in -- then redirect to the admin logon
   {
   header("location:$redirect");
   exit();
   }

// timed security

$_SESSION['start'] = isset($_SESSION['start']) ? $_SESSION['start'] : 0;

$timelimit = 15 * 60; // 15 minutes
$now = time();

if($now > $_SESSION['start'] + $timelimit)
   {
   logOff();
   $t = '?t=1';
   header("location:$redirect$t");
   exit();
   }

$_SESSION['start'] = time();

// properly logged on pass here

?>


<?php //============  log off  function =============
// to destroy the current session

function logOff()
   {
   $_SESSION = array();

   if(isset($_COOKIE[session_name()]))
      {
      setcookie(session_name(), '', time()-86400, '/');
      }
   session_destroy();
   }

--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---
Tedd,
        I really like your solution.  The idea of storing the expiration in the 
SESSION makes it easier for me and makes it more flexible.  Someone else had 
provided a solution that would actually allow me to take it down to a user 
level if I needed to.  I loved the idea for flexibility but would have required 
a major rewrite.  Your idea gives me the flexibility and doesn't require any 
major rewriting - just a little tweaking.

Thanks!
Floyd

On Sep 14, 2010, at 12:58 PM, tedd wrote:

> At 10:26 AM -0400 9/14/10, Floyd Resler wrote:
>> We just got a client whose requirement is that user sessions expire after 30 
>> minutes of inactivity.  Our other clients are happy with not having their 
>> sessions expire during the work day (i.e. life is 8 hours).  I am using a 
>> MySQL database to store the session data.  My thought is to adjust the 
>> session expiration in the table based on the client currently logged in.  Is 
>> this a good approach or would there be better ways to do it?  And just to 
>> clarify: all clients use the same Web site.
>> 
>> Thanks!
>> Floyd
> 
> Floyd:
> 
> I don't know how others solve this, but my solution is pretty straightforward 
> (see code below).
> 
> I require this code for every script that is in the secured area. Simply put, 
> if the user runs a script, then this script is also run.
> 
> As a result, if the user is not logged in they are directed to the login 
> script. If the user is logged in, but has exceeded the expiration time due to 
> inactivity, then the user is redirected to the same login script with a GET 
> value to trigger the login script to report that they timed out due to 
> inactivity.
> 
> I find it bad practice to tell a user that they are not logged in when they 
> did log in. It's better to explain why they have to log on again.
> 
> Now, with respect to your storing the expiration time in the database, that 
> could be done easily enough by this script accessing the database, getting, 
> and setting the time-limit -- OR -- at the start of any logon have the script 
> pull the time-limit from the database and store that value in a SESSION. 
> Either way would work.
> 
> In any event, this is what I do.
> 
> Cheers,
> 
> tedd
> 
> ========== code
> 
> <?php
> 
> $redirect = 'http://yourdomain.com/admin/logon.php';
> 
> // standard security
> 
> $secure = isset($_SESSION['security']) ? $_SESSION['security'] : 0;
> 
> if ($secure == 0) // if admin is not logged in -- then redirect to the admin 
> logon
>   {
>   header("location:$redirect");
>   exit();
>   }
> 
> // timed security
> 
> $_SESSION['start'] = isset($_SESSION['start']) ? $_SESSION['start'] : 0;
> 
> $timelimit = 15 * 60; // 15 minutes
> $now = time();
> 
> if($now > $_SESSION['start'] + $timelimit)
>   {
>   logOff();
>   $t = '?t=1';
>   header("location:$redirect$t");
>   exit();
>   }
> 
> $_SESSION['start'] = time();
> 
> // properly logged on pass here
> 
> ?>
> 
> 
> <?php //============  log off  function =============
> // to destroy the current session
> 
> function logOff()
>   {
>   $_SESSION = array();
> 
>   if(isset($_COOKIE[session_name()]))
>      {
>      setcookie(session_name(), '', time()-86400, '/');
>      }
>   session_destroy();
>   }
> 
> -- 
> -------
> http://sperling.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
For the record, the problem appears to have been that the gcc version
was too old. It compiles with gcc 3.4.6 

  -Vicki Stanfield, RHCE, CISSP
Web Management Group
tso-cs-web-t...@dfas.mil

Defense Finance and Accounting Service
Technical Services Organization - Corporate Services
vicki.stanfield....@dfas.mil
(317)510-3375

-----Original Message-----
From: Tom Rogers [mailto:trog...@kwikin.com] 
Sent: Thursday, September 09, 2010 10:05 PM
To: STANFIELD, VICKI CTR DFAS
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] Filestat.c erorrs when building php-5.3.3 on solaris

Hi,

Friday, September 10, 2010, 2:49:36 AM, you wrote:
SVCD> Ok, I tried removing the --disable-posix and adding
--with-tsrm-pthreads
SVCD> to the configure options. 
SVCD> The resulting configure looks like this:

SVCD> CC='/usr/local/bin/gcc' \
SVCD> './configure' \
SVCD> '--prefix=/app/php533' \
SVCD> '--enable-shared' \
SVCD> '--with-tsrm-pthreads' \
SVCD> '--with-gnu-ld' \
SVCD> '--with-apxs2=/app/apache2216/bin/apxs' \
SVCD> '--with-zlib' \
SVCD> '--with-zlib-dir=/usr/lib' \
SVCD> '--with-png-dir=/usr/include/libpng' \
SVCD> '--with-openssl=/shared_ro/openssl_098' \
SVCD> '--with-oci8=/shared_ro/users.oracle/11.1.0'

SVCD> Now I get this:

SVCD> /users/03333/php-5.3.3/ext/posix/posix.c: In function
SVCD> `zif_posix_getgrnam':
SVCD> /users/03333/php-5.3.3/ext/posix/posix.c:1017: error: too many
arguments
SVCD> to function `getgrnam_r'
SVCD> /users/03333/php-5.3.3/ext/posix/posix.c: In function
SVCD> `zif_posix_getgrgid':
SVCD> /users/03333/php-5.3.3/ext/posix/posix.c:1067: error: too many
arguments
SVCD> to function `getgrgid_r'
SVCD> /users/03333/php-5.3.3/ext/posix/posix.c:1067: warning: assignment
makes
SVCD> integer from pointer without a cast
SVCD> /users/03333/php-5.3.3/ext/posix/posix.c: In function
SVCD> `zif_posix_getpwnam':
SVCD> /users/03333/php-5.3.3/ext/posix/posix.c:1136: error: too many
arguments
SVCD> to function `getpwnam_r'
SVCD> /users/03333/php-5.3.3/ext/posix/posix.c: In function
SVCD> `zif_posix_getpwuid':
SVCD> /users/03333/php-5.3.3/ext/posix/posix.c:1184: error: too many
arguments
SVCD> to function `getpwuid_r'
SVCD> /users/03333/php-5.3.3/ext/posix/posix.c:1184: warning: assignment
makes
SVCD> integer from pointer without a cast
SVCD> gmake: *** [ext/posix/posix.lo] Error 1

SVCD> Do I need to add the -D_POSIX_PTHREAD_SEMANTICS in the makefile or
SVCD> configure.in somewhere? Can you point me in the right direction?

SVCD>   -Vicki Stanfield, RHCE, CISSP

SVCD> -----Original Message-----
SVCD> From: Tom Rogers [mailto:trog...@kwikin.com] 
SVCD> Sent: Wednesday, September 08, 2010 10:06 PM
SVCD> To: Tom Rogers
SVCD> Cc: php-gene...@lists.php.net
SVCD> Subject: Re: [PHP] Filestat.c erorrs when building php-5.3.3 on
solaris

SVCD> Hi,

SVCD> Thursday, September 9, 2010, 11:31:06 AM, you wrote:
TR>> Hi,

TR>> Thursday, September 9, 2010, 2:07:50 AM, you wrote:
SVCD>>> I am trying to build php-5.3.3 and getting the following error: 

SVCD>>> /users/03333/php-5.3.3/TSRM -I/users/03333/php-5.3.3/Zend
SVCD>>> -I/usr/local/include -g -O2 -DZTS   -c
SVCD>>> /users/03333/php-5.3.3/ext/standard/filestat.c -o
SVCD>>> ext/standard/filestat.lo 
SVCD>>> /users/03333/php-5.3.3/ext/standard/filestat.c: In function
SVCD>>> `php_do_chgrp':
SVCD>>> /users/03333/php-5.3.3/ext/standard/filestat.c:416: error: too
SVCD> many
SVCD>>> arguments to function `getgrnam_r'
SVCD>>> /users/03333/php-5.3.3/ext/standard/filestat.c: In function
SVCD>>> `php_do_chown':
SVCD>>> /users/03333/php-5.3.3/ext/standard/filestat.c:517: error: too
SVCD> many
SVCD>>> arguments to function `getpwnam_r'
SVCD>>> make: *** [ext/standard/filestat.lo] Error 1

SVCD>>> I have set my ORACLE_HOME, my PATH, and my LD_LIBRARY_PATH
SVCD>>> And used the following configure command:

SVCD>>> ./configure --prefix=/app/php533
SVCD> --with-apxs2=/app/apache2215/bin/apxs
SVCD>>> --with-zlib --with-zlib-dir=/usr/lib
SVCD>>> --with-png-dir=/usr/include/libpng
SVCD>>> --with-openssl=/shared_ro/openssl_098
SVCD>>> --with-oci8=/shared_ro/users.oracle/11.1.0

SVCD>>> I am using gmake 3.80. Can anyone give me a hint as to what I am
SVCD> doing
SVCD>>> wrong in this build?

SVCD>>>   -Vicki Stanfield, RHCE, CISSP


TR>> From   the   error  message  it  would  seem  the  operating
SVCD> system's
TR>> getpwnam_r() function is not POSIX compatible.
TR>> What system are you compiling on?

TR>> -- 
TR>> regards,
TR>> Tom



SVCD> It  would  seem  you  need to add -D_POSIX_PTHREAD_SEMANTICS to
the cc
SVCD> flags to get the right function.

SVCD> -- 
SVCD> regards,
SVCD> Tom



That  should  get  added  automatically  when  you run configure if it
recognizes that the system is solaris.

Try adding --host=solaris to configure and see if that helps

-- 
regards,
Tom


--- End Message ---
--- Begin Message ---
On Tue, Sep 14, 2010 at 12:43 AM, Per Jessen <p...@computer.org> wrote:
> J Ravi Menon wrote:
>
>> Few questions:
>>
>> 1) Does opcode cache really matter in such cli-based daemons? As
>> 'SomeClass' is instantiated at every loop, I am assuming it is only
>> compiled once as it has already been 'seen'.
>
> Yup.

Just to clarify, you mean we don't need the op-code cache here right?


>
>> 2) What about garbage collection? In a standard apache-mod-php setup,
>> we rely on the end of a request-cycle to free up resources - close
>> file descriptiors, free up memory etc..
>>     I am assuming in the aforesaid standalone daemon case, we would
>> have to do this manually?
>
> Yes.
>

So 'unset($some_big_array)'  or 'unset($some_big_object)' etc.. is the
right way to go for non-resource based items? i.e. it needs to be
explicitly done?

thx,
Ravi



>> Note: I have written pre-forker deamons in php directly and
>> successfully deployed them in the past, but never looked at in depth
>> to understand all the nuances. Anecdotally, I have
>> done 'unset()' at some critical places were large arrays were used,
>> and I think it helped. AFAIK, unlike Java, there is no 'garbage
>> collector' thread that does all the magic?
>
> Correct.
>
>
>
> --
> Per Jessen, Zürich (12.9°C)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
J Ravi Menon wrote:

> On Tue, Sep 14, 2010 at 12:43 AM, Per Jessen <p...@computer.org> wrote:
>> J Ravi Menon wrote:
>>
>>> Few questions:
>>>
>>> 1) Does opcode cache really matter in such cli-based daemons? As
>>> 'SomeClass' is instantiated at every loop, I am assuming it is only
>>> compiled once as it has already been 'seen'.
>>
>> Yup.
> 
> Just to clarify, you mean we don't need the op-code cache here right?

That is correct.

>>> 2) What about garbage collection? In a standard apache-mod-php
>>> setup, we rely on the end of a request-cycle to free up resources -
>>> close file descriptiors, free up memory etc..
>>> I am assuming in the aforesaid standalone daemon case, we would
>>> have to do this manually?
>>
>> Yes.
> 
> So 'unset($some_big_array)'  or 'unset($some_big_object)' etc.. is the
> right way to go for non-resource based items? i.e. it needs to be
> explicitly done?

It's not quite like C - if you reassign something, the previous contents
are automagically freed.  I use unset() if I know it could be a while
(hours) before it'll likely be reassigned, but it won't be used in the
meantime. 



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


--- End Message ---
--- Begin Message ---
I use bcompiler in my php
code(bcompiler_write_header+bcompiler_write_file+bcompiler_write_footer).
If the original phps are not located in the deployment directory I get an
error: require_once use the path to the not compiled phps.
I'd like to know if there is any way to compile the phps and use the
compiled versión from a different directory.

Thanks
Ramiro

--- End Message ---
--- Begin Message ---
Hi,

I am trying to create an on the fly image of runway layouts but am hitting a brick wall.

I have both the starting and ending coordinates of each runway, it's length, as well as it's angle of direction (heading).

I can draw one runway without any problem, but where I am falling short is how to 'scale', if that is the right word, the other runway(s) to display properly in a 500x500px image


function imagepolarline($image,$x1,$y1,$length,$angle,$color)
        {
        $length=($length/500)*20;
        $x2 = $x1 + cos( deg2rad($angle-90)) * $length;
        $y2 = $y1 + sin( deg2rad($angle-90)) * $length;
        imageline($image, $x1,$y1,$x2,$y2, $color);     
        }

//'base' coords
$x1=200;$y1=200;

$scale=10000;

//if first runway
if ($d==0) {$xbase=abs($lon1);$ybase=abs($lat1);}
//for all others
else
        {
        $x1=$x1+(($xbase-(abs($lon1)))*$scale);
        $y1=$y1+(($ybase-(abs($lat1)))*$scale);
        }


Here is some test data if that would help:
"length","lat_start","lon_start","heading","lat_stop","lon_stop"
"6869","38.8424","-77.0368","355.5000","38.8612","-77.0387"
"4911","38.8423","-77.0408","26.0000","38.8544","-77.0333"
"5204","38.8617","-77.0438","142.7000","38.8503","-77.0327"

Any suggestions would be most appreciated.

Alexis

--- End Message ---
--- Begin Message ---
On Tue, Sep 14, 2010 at 02:46, Thijs Lensselink <d...@lenss.nl> wrote:

>  On 09/14/2010 08:33 AM, Thijs Lensselink wrote:
>
>>  On 09/14/2010 12:16 AM, Camilo Sperberg wrote:
>>
>>> I have some really strange behaviour going on here, and I think it could
>>> be
>>> a (minor) PHP's bug.
>>> I am not really sure about what happens internally, but my best guess
>>> would
>>> be that after a memory exhaustion, when I try to execute a custom error
>>> handler with the register_shutdown_function (which is executed even after
>>> a
>>> fatal error) and try to access the element that provoked the memory
>>> exhaustion, no error should raise instead of *Uninitialized string
>>> offset:
>>> 0.
>>>
>>> I have prepared a little test case to reproduce the error and (I hope)
>>> can
>>> explain the error.
>>>
>>> <?php
>>> date_default_timezone_set('America/Santiago');
>>> ini_set('memory_limit','1M');
>>> ini_set('display_errors',1);
>>> error_reporting(-1);
>>>
>>> function my_error_handler($errno = '0', $errstr = '[FATAL] General
>>> Error',
>>> $errfile = 'N/A', $errline = 'N/A', $errctx = '') {
>>>
>>
> This seems to be your error. You set $errctx to be a string. But later on
> you use it as an array.
> Remove the = '' part. And it will function as expected.


You're right... However I don't like leaving non-default value in functions
so I did something like if(empty($errctx)) $errctx = array() in the first
line of the custom error handler which threw out the error message and
everything works ok now.

But -and correct me if I'm wrong- isn't isset (or empty) supposed to return
a FALSE whenever that variable doesn't exist?

With your help, I could reduce the test case into:

$asdf = 'hello world';
if (empty($asdf[4]['inventing'])) echo 'nice little world';
if (isset($asdf['inventing'][6])) echo 'little nice world';
// This works ok.

$asdf = '';
if (empty($asdf[4]['inventing'])) echo 'nice little world';
if (isset($asdf['inventing'][6])) echo 'little nice world';
// This returns E_NOTICE

Shouldn't these 2 examples work exactly the same way? (AKA as Nº 1). If
not... why not? Both are string types, onyl difference is that one has no
characters in it while the other does, but essentialy they are both the
same.

Greetings !

-- 
Mailed by:
UnReAl4U - unreal4u
ICQ #: 54472056
www1: http://www.chw.net/
www2: http://unreal4u.com/

--- End Message ---
--- Begin Message ---
Daniel Brown wrote:
On Mon, Sep 13, 2010 at 18:09, MikeB <mpbr...@gmail.com> wrote:
However, getting access seems to be hit-and-miss, since I more often than
not get a message that the connection to news.php.net timed out.

Is this an indication that the server is just very busy? I don't get this on
any other news server I'm using on the smae news reader and I have gotten
this on two different news readers that I have tried.

    I don't believe that we've been having any issues with the server,
no.  Are you using NNTP to connect?  You may want to consider using
the HTTP-based RSS and/or RDF feeds if it continues to be an issue.
In addition, if you continue to have problems, file a bug report at
http://bugs.php.net/ and we'll look into it further.

Dan, Mike,

I can confirm this happens "all the time" in thunderbird, and always has for many years now, on all PHP NNTP lists.

However, the problem can be worked around simply, for some reason the timeout generally only happens with the first call to view a mailing list, after X minutes of inactivity. Thus, I simply subscribe to a few different PHP lists (like .soap .test and general) then when I open thunderbird I quickly click a list I *don't* want to see, then click on .general, .general then loads nicely as expected letting the other one timeout :)

It's hardly a fix, but it works - may be worth checking if this is the case with the latest thunderbird revision and then reporting it as a "bug" (in either thunderbird or the mailing list software that PHP is running).

Best,

Nathan

--- End Message ---

Reply via email to