RE: [PHP] another Array question

2012-09-10 Thread admin
Length was my problem the whole time.
Thank you very much.

Resolved 


-Original Message-
From: Jim Lucas [mailto:li...@cmsws.com] 
Sent: Tuesday, September 11, 2012 1:02 AM
To: admin
Cc: php-general@lists.php.net
Subject: Re: [PHP] another Array question

On 9/10/2012 9:41 PM, admin wrote:
> Hello everyone,
>
>   I have a very long array. I want to pull all the data from the array

> from a certain position to a certain position.
> $myarray = array('0'=>'me', 
> '1'=>'you','2'=>'her','3'=>'him','4'=>'them',
> '5'=>'us');
> Yes I know the array above it small it's an example, mine has over 150 
> positions.
>
> $foundyou = array_search('you', $myarray); $foundthem = 
> array_search('them', $myarray);
>
> Now I want to take all the array positions from $foundyou to 
> $foundthem and put their values into a variable; For the life of me I 
> can't remember how I did it.
>
> I DO NOT want to foreach over the array positions that would be 
> counterproductive.
>

Well, depends on exactly what you mean by "and put their values into a
variable".  Do you mean concatenate all the values into one single "flat"
variable.  Or do you mean to make a subset array of the values between your
two points you found?


First, check out array_slice.
Second, look at join


'me',
   '1'=>'you',
   '2'=>'her',
   '3'=>'him',
   '4'=>'them',
   '5'=>'us',
);

$s_pos = array_search('you', $myarray);
$f_pos = array_search('them', $myarray);

# Calculate the length, it is needed by array_slice() $length = ($f_pos -
$s_pos);

$subset_array = array_slice($myarray, $s_pos, $length);

print_r($subset_array);

$all_values = join(', ', $subset_array);

echo $all_values;

?>

Obviously, you need to add in some error checking.  But that should get you
started.

--
Jim


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



Re: [PHP] another Array question

2012-09-10 Thread Jim Lucas

On 9/10/2012 9:41 PM, admin wrote:

Hello everyone,

I have a very long array. I want to pull all the data from the array
from a certain position to a certain position.
$myarray = array('0'=>'me', '1'=>'you','2'=>'her','3'=>'him','4'=>'them',
'5'=>'us');
Yes I know the array above it small it's an example, mine has over 150
positions.

$foundyou = array_search('you', $myarray);
$foundthem = array_search('them', $myarray);

Now I want to take all the array positions from $foundyou to $foundthem and
put their values into a variable;
For the life of me I can't remember how I did it.

I DO NOT want to foreach over the array positions that would be
counterproductive.



Well, depends on exactly what you mean by "and put their values into a 
variable".  Do you mean concatenate all the values into one single 
"flat" variable.  Or do you mean to make a subset array of the values 
between your two points you found?



First, check out array_slice.
Second, look at join


'me',
  '1'=>'you',
  '2'=>'her',
  '3'=>'him',
  '4'=>'them',
  '5'=>'us',
);

$s_pos = array_search('you', $myarray);
$f_pos = array_search('them', $myarray);

# Calculate the length, it is needed by array_slice()
$length = ($f_pos - $s_pos);

$subset_array = array_slice($myarray, $s_pos, $length);

print_r($subset_array);

$all_values = join(', ', $subset_array);

echo $all_values;

?>

Obviously, you need to add in some error checking.  But that should get 
you started.


--
Jim

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



Re: [PHP] Another parse problem

2010-06-26 Thread tedd

At 10:16 PM -0400 6/16/10, Daniel Brown wrote:

I'm hoping Tedd will share his as well.


Daniel:

I'm embarrassed to show it -- it's not as slick and condensed as 
your's and Rob's


http://www.webbytedd.com/b3/parse-domain-collective/

Please be kind.

However, my code was to do something specific in my mind, namely to 
pull out the domains that have specific TLD the user wants, reduce 
the domains to their basic form (no sub domains), strip-out any 
possible gremlins from the input text, and return no duplicates. I am 
NOT saying that yours did anything different -- I'm just saying that 
was *my* intent.


Cheers,

tedd

PS: I'm back from a long stretch of seminars on "Asset Protection". I 
guess that my asset needs protecting. In any event, I now know more 
about the relationships between Corporation, LLC, LP, Trust, and 
other such fun matters than anyone should know.


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Another parse problem

2010-06-16 Thread Daniel Brown
On Wed, Jun 16, 2010 at 21:42, Robert Cummings  wrote:
[snip!]
> Anyways, those, by
> virtue of your above description can have two or more parts and there's not
> a simple way to extract that part without also extracting the sub-domain
> portions.

True.  Not without some static rules and logic, including
knowledge of which ccTLDs have required or potential country-wide
SLDs.  Though I think the solutions provided by yourself, Shawn, and
myself would suffice for most situations.  I'm hoping Tedd will share
his as well.

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!

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



Re: [PHP] Another parse problem

2010-06-16 Thread Robert Cummings

Daniel P. Brown wrote:

On Wed, Jun 16, 2010 at 15:52, Robert Cummings  wrote:

Additionally, extracting top level domains is not so simple since it may
have 2 or more parts.


*Gasp!*  The Great Cummings is incorrect.

/me faints.

Actually, ccTLD's are just the very last group of letters.  For
example, .il, .uk, and .br.  However, the ICANN, registrar policies,
or sponsorship requirements for some of them require the use of an SLD
as well.  For example, .co.il, .org.uk, and .com.br, respectively.
Some ccTLDs offer the SLD options, but don't require them.  For
example, you can register .co.in, .firm.in, .gen.in, or any other
available SLD+ccTLD, or just the ccTLD .in itself.

Still others have no such requirement or even official SLD
endorsements, such as good ol' Canada (Land of Clan Cummings),
Ireland, and here in the US.


Hahah, I can't be right all the time :D I didn't mean to use TLD, I 
meant to use domain name, but not including sub-domained names :) I 
don't even know what that is rightly called to exclude sub-domains. 
Anyways, those, by virtue of your above description can have two or more 
parts and there's not a simple way to extract that part without also 
extracting the sub-domain portions.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] Another parse problem

2010-06-16 Thread Daniel P. Brown
On Wed, Jun 16, 2010 at 15:52, Robert Cummings  wrote:
>
> Additionally, extracting top level domains is not so simple since it may
> have 2 or more parts.

*Gasp!*  The Great Cummings is incorrect.

/me faints.

Actually, ccTLD's are just the very last group of letters.  For
example, .il, .uk, and .br.  However, the ICANN, registrar policies,
or sponsorship requirements for some of them require the use of an SLD
as well.  For example, .co.il, .org.uk, and .com.br, respectively.
Some ccTLDs offer the SLD options, but don't require them.  For
example, you can register .co.in, .firm.in, .gen.in, or any other
available SLD+ccTLD, or just the ccTLD .in itself.

Still others have no such requirement or even official SLD
endorsements, such as good ol' Canada (Land of Clan Cummings),
Ireland, and here in the US.

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!

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



Re: [PHP] Another parse problem

2010-06-16 Thread Robert Cummings



Daniel P. Brown wrote:

On Wed, Jun 16, 2010 at 13:22, tedd  wrote:

The given was to parse domain-names, but both routines pulled out
sub-domains as well. Perhaps I am wrong in my understanding of what a domain
name is, but I would normally look at sub domains as not part of the "domain
name". Sub domains are simply extensions of the domain name, am I right or
wrong?


Technically, a domain name is anything from the TLD and SLD levels
and below.  An FQDN (commonly called a "hostname") is in the format
cname.sld.tld.


Additionally, extracting top level domains is not so simple since it may 
have 2 or more parts.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] Another parse problem

2010-06-16 Thread Daniel P. Brown
On Wed, Jun 16, 2010 at 13:22, tedd  wrote:
>
> The given was to parse domain-names, but both routines pulled out
> sub-domains as well. Perhaps I am wrong in my understanding of what a domain
> name is, but I would normally look at sub domains as not part of the "domain
> name". Sub domains are simply extensions of the domain name, am I right or
> wrong?

Technically, a domain name is anything from the TLD and SLD levels
and below.  An FQDN (commonly called a "hostname") is in the format
cname.sld.tld.

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!

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



Re: [PHP] Another parse problem

2010-06-16 Thread tedd

Rob and Daniel:

As expected, both of your submission were excellent. If this was an 
assignment in one of my classes ("as if" I could teach either of you 
anything) you would both receive an A+.


Daniel's routine also returned .ie TLD, but that was not stated as a 
requirement.


Daniel's routine also allow for full-link parsing, but again that was 
not stated as a requirement.


How to deal with duplicate domains was not addressed in the given and 
both routines differed on that point.


The given was to parse domain-names, but both routines pulled out 
sub-domains as well. Perhaps I am wrong in my understanding of what a 
domain name is, but I would normally look at sub domains as not part 
of the "domain name". Sub domains are simply extensions of the domain 
name, am I right or wrong?


In any event, I will be examining both your code because neither is 
the way I solved the problem. Mine was a bit more verbose and clumsy 
in comparison. It's always nice to see how the top dog's do it.


Cheers,

tedd

PS: I've been away for the last couple of days.

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Another parse problem

2010-06-14 Thread Daniel P. Brown
On Mon, Jun 14, 2010 at 09:14, tedd  wrote:
> Hi gang:
>
> Considering all the recent parsing, here's another problem to consider --
> given any text, parse the domain-names out of it.
>
> You may limit the parsing to the most popular TDL's, such as .com, .net, and
> .org, but the finished result should be an array containing all the
> domain-names found in a text file.

http://-fronted domains like http://php1.net/,
which also contains a number.  If we wanted to match domains plus
paths, but there was no leading http:// to indicate that it should
be a URL, we could extend this to grab things like www.facebook.com/parasane,
so long as we don't ignore the rare one-character SLDs like x.com,
as well as the domains in email addresses like danbr...@php.net
So if everything works as expected, we should see eleven domains
matched here, because ccTLDs like guthr.ie should be matched as well.

TXT;

/**
 * $fromText can be defined via a file_get_contents() or
 * similar function, while $fullLink should be anything
 * but false to enable link-matching, which will return
 * only link-like domains with paths attached.
 */
function extract_domains($fromText,$fullLink=false) {

// If we only want to match the domain names.
if ($fullLink === false) {

preg_match_all('/\b([a-z0-9\-\.]{1,}\.[a-z]{2,5})\b/',$fromText,$matches);
return $matches[1];
}

// If we want to match just domain names with trailing paths.

preg_match_all('/\b([a-z0-9\-\.]{1,}\.[a-z]{2,5}\/.+?)\b/',$fromText,$matches);
return $matches[1];
}

// Demo
echo "".PHP_EOL;

echo "Just domains:".PHP_EOL;
var_dump(extract_domains($text));

echo PHP_EOL;

echo "Full links:".PHP_EOL;
var_dump(extract_domains($text,true));

echo "".PHP_EOL;
?>


-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!

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



Re: [PHP] Another parse problem

2010-06-14 Thread Robert Cummings

tedd wrote:

At 2:18 PM +0100 6/14/10, Ashley Sheridan wrote:

On Mon, 2010-06-14 at 09:14 -0400, tedd wrote:


Hi gang:

Considering all the recent parsing, here's another problem to
consider -- given any text, parse the domain-names out of it.

You may limit the parsing to the most popular TDL's, such as .com,
.net, and .org, but the finished result should be an array containing
all the domain-names found in a text file.

Cheers,

tedd
--
---
http://sperling.com  
http://ancientstones.com  
http://earthstones.com


I'm assuming it won't be anything as simple as assuming all the 
domains begin with the http:// prefix? :p


Thanks,
Ash


Ash:

Nope, just a text file containing whatever and domain-names. The only 
domain-name indicator would be the period followed by an approved 
TDL, such as .com, .net, or .org.




Naive implementation. I'm sure I've missed edge cases someplace.

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] Another parse problem

2010-06-14 Thread tedd

At 2:18 PM +0100 6/14/10, Ashley Sheridan wrote:

On Mon, 2010-06-14 at 09:14 -0400, tedd wrote:



Hi gang:

Considering all the recent parsing, here's another problem to
consider -- given any text, parse the domain-names out of it.

You may limit the parsing to the most popular TDL's, such as .com,
.net, and .org, but the finished result should be an array containing
all the domain-names found in a text file.

Cheers,

tedd
--
---
http://sperling.com  
http://ancientstones.com  
http://earthstones.com




I'm assuming it won't be anything as simple as assuming all the 
domains begin with the http:// prefix? :p


Thanks,
Ash


Ash:

Nope, just a text file containing whatever and domain-names. The only 
domain-name indicator would be the period followed by an approved 
TDL, such as .com, .net, or .org.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Another parse problem

2010-06-14 Thread Ashley Sheridan
On Mon, 2010-06-14 at 09:14 -0400, tedd wrote:

> Hi gang:
> 
> Considering all the recent parsing, here's another problem to 
> consider -- given any text, parse the domain-names out of it.
> 
> You may limit the parsing to the most popular TDL's, such as .com, 
> .net, and .org, but the finished result should be an array containing 
> all the domain-names found in a text file.
> 
> Cheers,
> 
> tedd
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 


I'm assuming it won't be anything as simple as assuming all the domains
begin with the http:// prefix? :p

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Another RegEx Question

2010-06-07 Thread Peter Lind
On 7 June 2010 18:11, Floyd Resler  wrote:
> I need to test for the existence of at least one punctuation (@#$%') 
> character in a string.  What would my regular expression be?
>

I'm certain you'd be capable of finding out if you read a bit on
http://www.regular-expressions.info/ or any of the numerous other
sites with regex info :)

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15


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



Re: [PHP] Another RegEx Question

2010-06-07 Thread Ashley Sheridan
On Mon, 2010-06-07 at 12:11 -0400, Floyd Resler wrote:

> I need to test for the existence of at least one punctuation (@#$%') 
> character in a string.  What would my regular expression be?
> 
> Thanks!
> Floyd
> 
> 


/[...@#\$%\']/

That will match against at least one of those characters you specified.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Another NetBeans Question

2010-06-01 Thread Dan Joseph
On Tue, Jun 1, 2010 at 11:25 AM, tedd  wrote:

> How do you turn off the automatic insertion of quotes when you're editing?
>
> For example, when I type , I end up with  id=""content">. The editor see's me type a quote and then automatically
> inserts another quote.
>
>
>
I can't find where to turn it off either, but I did notice when you type
something like that, when you type in the content in the " ", when you type
the last ", it overwrites the end quote, so you don't end up with two.
phped works this way too.  Helps me at least.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] another "useless" message.

2010-04-09 Thread Rene Veerman
On Sat, Apr 10, 2010 at 12:08 AM, Rene Veerman  wrote:
> On Fri, Apr 9, 2010 at 3:49 PM, Dan Joseph  wrote:
>> On Fri, Apr 9, 2010 at 6:28 AM, Peter Lind  wrote:
>>
>>> That said, there can be little doubt that the response you got went a
>>> tad too far - some netiquette lessons would be useful, I think.
>>>
>>>
>>
>> In defense of the people that react harshly, there has been a lot of people
>> who just spam the list over the years.  Its a natural reaction.
>>
>> You may want to put that kind of thing in your signature also.  Rather than
>> making announcements that bother people, when you participate, your message
>> will go out.  Although, don't make it 100 lines long...
>>
>> --
>> -Dan Joseph
>>
>> www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
>> Code "NEWTHINGS" for 10% off initial order
>>
>> http://www.facebook.com/canishosting
>> http://www.facebook.com/originalpoetry
>>
>
> Very good point; i've set a gmail signature, which will not change
> much i believe.
>
> --
> -
> Greetings from Rene7705,
> creator of open-source web-components: htmlMicroscope(googlecode),
> visCanvasLoaderIcon(not online atm), and buttonAnimate (jQuery based,
> not online atm).
>


ok, last one then; my sig is now this; and i'm posting this because i
took the effort to put my other components online too..

this'll be my "final" sig for a while i think.

-- 
-
Greetings from Rene7705,

I have made some free open source webcomponents designed and written
by me available through
http://code.google.com/u/rene7705/ , or
http://mediabeez.ws (latest dev versions, currently offline)
-

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



Re: [PHP] another "useless" message.

2010-04-09 Thread Rene Veerman
On Fri, Apr 9, 2010 at 3:49 PM, Dan Joseph  wrote:
> On Fri, Apr 9, 2010 at 6:28 AM, Peter Lind  wrote:
>
>> That said, there can be little doubt that the response you got went a
>> tad too far - some netiquette lessons would be useful, I think.
>>
>>
>
> In defense of the people that react harshly, there has been a lot of people
> who just spam the list over the years.  Its a natural reaction.
>
> You may want to put that kind of thing in your signature also.  Rather than
> making announcements that bother people, when you participate, your message
> will go out.  Although, don't make it 100 lines long...
>
> --
> -Dan Joseph
>
> www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
> Code "NEWTHINGS" for 10% off initial order
>
> http://www.facebook.com/canishosting
> http://www.facebook.com/originalpoetry
>

Very good point; i've set a gmail signature, which will not change
much i believe.

-- 
-
Greetings from Rene7705,
creator of open-source web-components: htmlMicroscope(googlecode),
visCanvasLoaderIcon(not online atm), and buttonAnimate (jQuery based,
not online atm).

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



Re: [PHP] another "useless" message.

2010-04-09 Thread Rene Veerman
ok, you're right, of course.

me posting that was not just about "another plug for htmlmicroscope".

there were other, secret, considerations, that led me to post that.

--!!
but i hereby promise to really try to use only bottom-posting replies
and cut-out-posting replies on this list in winter time, when i
actually can afford the concentration to supply useful programming
tips.
--!!
right now, i'm still a bit stressed. personal reasons.

On Fri, Apr 9, 2010 at 12:28 PM, Peter Lind  wrote:
> On 9 April 2010 12:20, Rene Veerman  wrote:
>> lolz :)) u try to be nice, and this is what u get?!?! :-D
>>
>
> Rene, it's nice of you to post messages on the availability of some OS
> tools. However, you should also be aware that it's a minority of
> people on this list that use those tools - which in effect means that
> you're posting stuff that at best is irrelevant to a lot of people and
> at worst is seen as spam by those people.
>
> That said, there can be little doubt that the response you got went a
> tad too far - some netiquette lessons would be useful, I think.
>
>
> --
> 
> 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
> 
>

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



Re: [PHP] another "useless" message.

2010-04-09 Thread Dan Joseph
On Fri, Apr 9, 2010 at 6:28 AM, Peter Lind  wrote:

> That said, there can be little doubt that the response you got went a
> tad too far - some netiquette lessons would be useful, I think.
>
>

In defense of the people that react harshly, there has been a lot of people
who just spam the list over the years.  Its a natural reaction.

You may want to put that kind of thing in your signature also.  Rather than
making announcements that bother people, when you participate, your message
will go out.  Although, don't make it 100 lines long...

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] another "useless" message.

2010-04-09 Thread Peter Lind
On 9 April 2010 12:20, Rene Veerman  wrote:
> lolz :)) u try to be nice, and this is what u get?!?! :-D
>

Rene, it's nice of you to post messages on the availability of some OS
tools. However, you should also be aware that it's a minority of
people on this list that use those tools - which in effect means that
you're posting stuff that at best is irrelevant to a lot of people and
at worst is seen as spam by those people.

That said, there can be little doubt that the response you got went a
tad too far - some netiquette lessons would be useful, I think.


-- 

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


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



Re: [PHP] another "useless" message.

2010-04-09 Thread Rene Veerman
lolz :)) u try to be nice, and this is what u get?!?! :-D


On Fri, Apr 9, 2010 at 11:52 AM, Nilesh Govindarajan  wrote:
> Somebody ban this person. He/she is creating nuisance here. ^)
>
> --
> Nilesh Govindarajan
> Site & Server Administrator
> www.itech7.com
> मेरा भारत महान !
> मम भारत: महत्तम भवतु !
>
> --
> 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] another "useless" message.

2010-04-09 Thread Nilesh Govindarajan

Somebody ban this person. He/she is creating nuisance here. ^)

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

--
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-24 Thread Richard Quadling
On 23 March 2010 16:39, Robert P. J. Day  wrote:
> 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
> 
>

You could of course simply look in the entire file system for a key
file, but ... well ... maybe not!

The thing about an env_var is that it is pretty much no different to
an INI setting in this regard.

By having the setting "closer" to the code using it (i.e. I see the
location in the batch file used to run the testing, I see the location
in the require_once() line in the main script), it is easier to see
the location. An env_var or an ini setting is quite some distance away
from the code and may seem "magical".

What I'm not sure is how you can ever get away without explicitly
declaring the location unless you always put the files in the 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=ZEND002498&r=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 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



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  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=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--
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



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

2010-03-22 Thread Jochem Maas
oops, mailed the OP direct rather than the list. sorry.

 Originele bericht 
Onderwerp: Re: [PHP] another question on setting include paths for a project
Datum: Mon, 22 Mar 2010 15:58:28 +
Van: Jochem Maas 
Aan: Robert P. J. Day 

Op 3/22/10 2:18 PM, Robert P. J. Day schreef:
> 
>   to recap regarding an earlier question i asked regarding extending
> include paths, i have an existing project (call it "proj" currently
> all under a top-level directory also named "proj") which can be SVN
> checked out anywhere under a user's home directory.  so in my case, i
> might have my svn working copy under, say,
> /home/rpjday/stuff/work/proj/, and all proj-related content under
> that.
> 
>   at the moment, there are some subdirs under proj/ like "common" and
> "utils" and "debug", and all includes or requires throughout the
> working copy are currently and awkwardly of the form:
> 
>   include '../../proj/utils/somescript.php';
> 
> in short, every script that needs to include another one somewhere
> else in the code structure sadly needs to know its precise relative
> location.
> 
>   my proposal is to get rid of most of that by:
> 
> 1) having developers set a single env var PROJ_DIR in their login
>session, reflecting wherever the heck they checked out their
>working copy to, then ...
> 2) having said developers uniformly extend their directly callable PHP
>scripts with something at the very top like:
> 
>   set_include_path(getenv('PROJ_DIR') . PATH_SEPARATOR . get_include_path());
> 
> not only will that let them simplify their command-line callable
> scripts to say just:
> 
>   include 'utils/somescript.php';
> 
> also, as i read it, that newly-extended include path percolates down
> through all PHP scripts invoked directly or indirectly from this one,
> right?  so while i could add that set_include_path() to every single
> PHP script everywhere in the code base, it's really only necessary to
> add it to those PHP scripts that people intend to *invoke* directly --
> every other script will pick it up automatically as it's called, is
> that correct?  (did i phrase that meaningfully?)
> 
>   that was part one.
> 
>   the new additional complication is that some of those PHP scripts
> will manually construct HTTP POST requests and ship those requests off
> to PHP scripts that live under a public_html/ directory, whose
> scripts might *also* want to include some of those very same utils/ or
> common/ scripts but that modified include path will, of course, not
> carry across a POST request, so what's the standard way to similarly
> modify the include path of the scripts on the server end?
> 
>   (unsurprisingly, all those "server-side" PHP scripts are also part
> of the entire SVN checkout just so i can keep everything in the same
> place for testing.)
> 
>   so how can i have those "server-side" scripts extend their search
> path based on, perhaps, the same environment variable?
> 
>   thoughts?

I think the whole 'set an ENV var in their shell session' idea is overkill.
everything is checked out from svn, the structure of the project is known,
there is no reason not to use relative paths for the includes, there is
no need to tell the scripts where stuff is in this scenario - they can
work it out automatically.

the following might give you an idea for a bit of bootstrap code that's included
by everything:

define('INC_DIR', dirname(__FILE__));

this would allow all other code to use absolute paths and allow you to set
the include_path to ''.

how do the cmdline scripts know which URL to hit ... I would assume that this
URL can change depending on whose checkout it is and the context (dev/prod),
that means there is already a config file or some such - possibly a good place
to stick the include path or define the include dir.

... and now for something 'completey' different:

another trick I've used is to use custom ini settings in conjunction with
get_cfg_var() - each developer/installation would have their own custom ini
file (which you can store in svn too) .. the ini file would be symlinked to
from the dir php is setup to read additional ini files from, the contents of
the ini file would be something like:

[My Cool App]
my_cool_app.public_url  = 'http://local.coolapp/';
my_cool_app.inc_dir = '/path/to/cool/app/';

you can then grab these values from anywhere using 
get_cfg_var('my_cool_app.inc_dir'),
often I find that additional config stuff is needed per installation - mostly 
related
to webserver setup (which sometimes differs somewhat between live and dev 
installs -
SSL may not be a

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

2010-03-22 Thread Richard Quadling
On 22 March 2010 14:51, Robert P. J. Day  wrote:
> On Mon, 22 Mar 2010, Richard Quadling wrote:
>
>> Depending upon what is being included, an autoloader could help
>> here.
>>
>> The main payoffs for autoloading are reduced memory footprint (class
>> are loaded JIT) and no need for each class to know exactly where the
>> other classes are.
>>
>> So, your main page needs to load the autoloader and the autoloader
>> handles the loading of the classes.
>>
>> No need to change the include_path setting.
>
>  ok, i'm looking at the PHP manual page for autoload, sample:
>
>  function __autoload($class_name)
>  {
>    require_once $class_name . '.php';
>  }
>
> and some obvious questions suggest themselves:
>
> 1) in as simple an example as above, does the include_path still
> control the search?  since i'm not doing anything fancy above in terms
> of specifying *where* that class is defined, it seems that i'll still
> have the same problem to solve, no?

No. The autoloader is part of the project, so it will know its
relative pathing to the other files. __DIR__ in the autoloader will
tell the autoloader where it is and all associated files should be
relative this.

You only need to know the relative path of the autoloader.

No need to alter include_path and you can remove all those
(require|include)(_once)? lines too as the autoloader kicks in
whenever a class it requested that hasn't been loaded.

>
> 2) i'm guessing that i can make the __autoload function as
> sophisticated as i want, in that i can have it consult an environment
> variable to determine where to search, but i'm still unsure as to how
> i can set an environment variable to be consulted on the "server"
> side.

I think once you've got the autoloader working, you don't need to worry.

> rday
> --
>
> 
> Robert P. J. Day                               Waterloo, Ontario, CANADA
>
>            Linux Consulting, Training and Kernel Pedantry.
>
> Web page:                                          http://crashcourse.ca
> Twitter:                                       http://twitter.com/rpjday
> 
>



-- 
-
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=ZEND002498&r=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-22 Thread Richard Quadling
On 22 March 2010 15:28, la...@garfieldtech.com  wrote:
> On 3/22/10 10:25 AM, Paul M Foster wrote:
>
>> That's the key. You can do anything you want inside __autoload(). If you
>> must consult something in the environment, there are a couple of ways to
>> do it. First, set a variable in the $_SESSION array, and consult it in
>> __autoload(). Second, use a configuration file for your application.
>> Have it in a stable place, and read the values out of it as needed.
>> Consult these in your __autoload() if you like.
>>
>> Paul
>
> I'd suggest skipping __autoload() and going straight for
> spl_autoload_register(), as it does the same thing but is more flexible
> since you can then have multiple autoload callbacks if necessary.
>
> --Larry Garfield
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Completely agree with Larry here. spl_autoload_register is __autoload++.

Essentially, the autoloader knows where it is and should know where
everything else it is expected to load is.

Having a naming convention that say maps class name to file path/name
(Zend_Soap_Wsdl_Exception maps to ./Zend/Soap/Wsdl/Exception.php) and
sticking with it allows for a single autoloader to be used for any
root name.

Autoloading only really works out-the-box with classes. There has been
discussion on making this work with functions and namespaces.



-- 
-
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=ZEND002498&r=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-22 Thread la...@garfieldtech.com

On 3/22/10 10:25 AM, Paul M Foster wrote:


That's the key. You can do anything you want inside __autoload(). If you
must consult something in the environment, there are a couple of ways to
do it. First, set a variable in the $_SESSION array, and consult it in
__autoload(). Second, use a configuration file for your application.
Have it in a stable place, and read the values out of it as needed.
Consult these in your __autoload() if you like.

Paul


I'd suggest skipping __autoload() and going straight for 
spl_autoload_register(), as it does the same thing but is more flexible 
since you can then have multiple autoload callbacks if necessary.


--Larry Garfield

--
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-22 Thread Paul M Foster
On Mon, Mar 22, 2010 at 10:51:38AM -0400, Robert P. J. Day wrote:

> On Mon, 22 Mar 2010, Richard Quadling wrote:
> 
> > Depending upon what is being included, an autoloader could help
> > here.
> >
> > The main payoffs for autoloading are reduced memory footprint (class
> > are loaded JIT) and no need for each class to know exactly where the
> > other classes are.
> >
> > So, your main page needs to load the autoloader and the autoloader
> > handles the loading of the classes.
> >
> > No need to change the include_path setting.
> 
>   ok, i'm looking at the PHP manual page for autoload, sample:
> 
>   function __autoload($class_name)
>   {
> require_once $class_name . '.php';
>   }
> 
> and some obvious questions suggest themselves:
> 
> 1) in as simple an example as above, does the include_path still
> control the search?  since i'm not doing anything fancy above in terms
> of specifying *where* that class is defined, it seems that i'll still
> have the same problem to solve, no?

Yep and yep.

> 
> 2) i'm guessing that i can make the __autoload function as
> sophisticated as i want, in that i can have it consult an environment
> variable to determine where to search, but i'm still unsure as to how
> i can set an environment variable to be consulted on the "server"
> side.
> 

That's the key. You can do anything you want inside __autoload(). If you
must consult something in the environment, there are a couple of ways to
do it. First, set a variable in the $_SESSION array, and consult it in
__autoload(). Second, use a configuration file for your application.
Have it in a stable place, and read the values out of it as needed.
Consult these in your __autoload() if you like.

Paul

-- 
Paul M. Foster

-- 
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-22 Thread Nilesh Govindarajan

On 03/22/2010 07:48 PM, Robert P. J. Day wrote:


   to recap regarding an earlier question i asked regarding extending
include paths, i have an existing project (call it "proj" currently
all under a top-level directory also named "proj") which can be SVN
checked out anywhere under a user's home directory.  so in my case, i
might have my svn working copy under, say,
/home/rpjday/stuff/work/proj/, and all proj-related content under
that.

   at the moment, there are some subdirs under proj/ like "common" and
"utils" and "debug", and all includes or requires throughout the
working copy are currently and awkwardly of the form:

   include '../../proj/utils/somescript.php';

in short, every script that needs to include another one somewhere
else in the code structure sadly needs to know its precise relative
location.

   my proposal is to get rid of most of that by:

1) having developers set a single env var PROJ_DIR in their login
session, reflecting wherever the heck they checked out their
working copy to, then ...
2) having said developers uniformly extend their directly callable PHP
scripts with something at the very top like:

   set_include_path(getenv('PROJ_DIR') . PATH_SEPARATOR . get_include_path());

not only will that let them simplify their command-line callable
scripts to say just:

   include 'utils/somescript.php';

also, as i read it, that newly-extended include path percolates down
through all PHP scripts invoked directly or indirectly from this one,
right?  so while i could add that set_include_path() to every single
PHP script everywhere in the code base, it's really only necessary to
add it to those PHP scripts that people intend to *invoke* directly --
every other script will pick it up automatically as it's called, is
that correct?  (did i phrase that meaningfully?)

   that was part one.

   the new additional complication is that some of those PHP scripts
will manually construct HTTP POST requests and ship those requests off
to PHP scripts that live under a public_html/ directory, whose
scripts might *also* want to include some of those very same utils/ or
common/ scripts but that modified include path will, of course, not
carry across a POST request, so what's the standard way to similarly
modify the include path of the scripts on the server end?

   (unsurprisingly, all those "server-side" PHP scripts are also part
of the entire SVN checkout just so i can keep everything in the same
place for testing.)

   so how can i have those "server-side" scripts extend their search
path based on, perhaps, the same environment variable?

   thoughts?

rday
--


Robert P. J. Day   Waterloo, Ontario, CANADA

 Linux Consulting, Training and Kernel Pedantry.

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




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

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com

--
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-22 Thread Robert P. J. Day
On Mon, 22 Mar 2010, Richard Quadling wrote:

> Depending upon what is being included, an autoloader could help
> here.
>
> The main payoffs for autoloading are reduced memory footprint (class
> are loaded JIT) and no need for each class to know exactly where the
> other classes are.
>
> So, your main page needs to load the autoloader and the autoloader
> handles the loading of the classes.
>
> No need to change the include_path setting.

  ok, i'm looking at the PHP manual page for autoload, sample:

  function __autoload($class_name)
  {
require_once $class_name . '.php';
  }

and some obvious questions suggest themselves:

1) in as simple an example as above, does the include_path still
control the search?  since i'm not doing anything fancy above in terms
of specifying *where* that class is defined, it seems that i'll still
have the same problem to solve, no?

2) i'm guessing that i can make the __autoload function as
sophisticated as i want, in that i can have it consult an environment
variable to determine where to search, but i'm still unsure as to how
i can set an environment variable to be consulted on the "server"
side.

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] another question on setting include paths for a project

2010-03-22 Thread Richard Quadling
On 22 March 2010 14:18, Robert P. J. Day  wrote:
>
>  to recap regarding an earlier question i asked regarding extending
> include paths, i have an existing project (call it "proj" currently
> all under a top-level directory also named "proj") which can be SVN
> checked out anywhere under a user's home directory.  so in my case, i
> might have my svn working copy under, say,
> /home/rpjday/stuff/work/proj/, and all proj-related content under
> that.
>
>  at the moment, there are some subdirs under proj/ like "common" and
> "utils" and "debug", and all includes or requires throughout the
> working copy are currently and awkwardly of the form:
>
>  include '../../proj/utils/somescript.php';
>
> in short, every script that needs to include another one somewhere
> else in the code structure sadly needs to know its precise relative
> location.
>
>  my proposal is to get rid of most of that by:
>
> 1) having developers set a single env var PROJ_DIR in their login
>   session, reflecting wherever the heck they checked out their
>   working copy to, then ...
> 2) having said developers uniformly extend their directly callable PHP
>   scripts with something at the very top like:
>
>  set_include_path(getenv('PROJ_DIR') . PATH_SEPARATOR . get_include_path());
>
> not only will that let them simplify their command-line callable
> scripts to say just:
>
>  include 'utils/somescript.php';
>
> also, as i read it, that newly-extended include path percolates down
> through all PHP scripts invoked directly or indirectly from this one,
> right?  so while i could add that set_include_path() to every single
> PHP script everywhere in the code base, it's really only necessary to
> add it to those PHP scripts that people intend to *invoke* directly --
> every other script will pick it up automatically as it's called, is
> that correct?  (did i phrase that meaningfully?)
>
>  that was part one.
>
>  the new additional complication is that some of those PHP scripts
> will manually construct HTTP POST requests and ship those requests off
> to PHP scripts that live under a public_html/ directory, whose
> scripts might *also* want to include some of those very same utils/ or
> common/ scripts but that modified include path will, of course, not
> carry across a POST request, so what's the standard way to similarly
> modify the include path of the scripts on the server end?
>
>  (unsurprisingly, all those "server-side" PHP scripts are also part
> of the entire SVN checkout just so i can keep everything in the same
> place for testing.)
>
>  so how can i have those "server-side" scripts extend their search
> path based on, perhaps, the same environment variable?
>
>  thoughts?
>
> 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
>
>

Depending upon what is being included, an autoloader could help here.

The main payoffs for autoloading are reduced memory footprint (class
are loaded JIT) and no need for each class to know exactly where the
other classes are.

So, your main page needs to load the autoloader and the autoloader
handles the loading of the classes.

No need to change the include_path setting.



-- 
-
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=ZEND002498&r=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 date exercise

2009-08-19 Thread tedd

At 10:43 AM -0500 8/19/09, Shawn McKenzie wrote:

 > First stab at it.  Of course it needs US date ordering (month day year).

  You can't do euro type dates or any other format because there is no
 way to tell the difference between 1/2/2009 (January) and 1/2/2009
 (February):

 



Guess you didn't like this one?  Also, if you change the / to - in the
preg_replace() it should work on Euro style dates.

$date = preg_replace("#([\d])+[^-\d]+([\d]+)[^-\d]+([\d]+)#",
"$1-$2-$3", $date);

-Shawn


-Shawn:

Thanks, but my idea was more along the lines of this:

http://php1.net/b/date-picker/index.php

It's not thoroughly tested, but thus far it works.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Another date exercise

2009-08-19 Thread Luke
2009/8/19 Shawn McKenzie 

> Shawn McKenzie wrote:
> > tedd wrote:
> >> At 3:40 PM +0530 8/17/09, kranthi wrote:
> >>> dont you think http://in3.php.net/strtotime is a solution to your
> >>> problem ?
> >> No, it's not a solution to my problem -- I have he problem solved.
> >>
> >> I was just asking if anyone wanted to submit their php solution. It was
> >> only an exercise.
> >>
> >> I know there are numerous javascript solutions (some good, some bad),
> >> but ALL of their data has to be accepted and scrubbed by a php script
> >> anyway, so I was suggesting creating a php script to do it.
> >>
> >> If it's not a good exercise, then don't do it.
> >
> > First stab at it.  Of course it needs US date ordering (month day year).
> >  You can't do euro type dates or any other format because there is no
> > way to tell the difference between 1/2/2009 (January) and 1/2/2009
> > (February):
> >
> >  >
> > $dates = array(
> > 'August 5, 2009',
> > 'Aug 05 2009',
> > 'Aug 5, 9',
> > '08/05/09',
> > '8-5-9',
> > '8 05 2009',
> > '8,5,9',);
> >
> > foreach($dates as $date) {
> > $date = preg_replace("#([\d])+[^/\d]+([\d]+)[^/\d]+([\d]+)#",
> > "$1/$2/$3", $date);
> > echo date("M j, Y", strtotime($date)) ."\n";
> > }
> >
> > ?>
> >
>
> Guess you didn't like this one?  Also, if you change the / to - in the
> preg_replace() it should work on Euro style dates.
>
> $date = preg_replace("#([\d])+[^-\d]+([\d]+)[^-\d]+([\d]+)#",
> "$1-$2-$3", $date);
>
> -Shawn
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Perhaps you could detect the region of the user to pick which kind of date
to use

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.


Re: [PHP] Another date exercise

2009-08-19 Thread Shawn McKenzie
Shawn McKenzie wrote:
> tedd wrote:
>> At 3:40 PM +0530 8/17/09, kranthi wrote:
>>> dont you think http://in3.php.net/strtotime is a solution to your
>>> problem ?
>> No, it's not a solution to my problem -- I have he problem solved.
>>
>> I was just asking if anyone wanted to submit their php solution. It was
>> only an exercise.
>>
>> I know there are numerous javascript solutions (some good, some bad),
>> but ALL of their data has to be accepted and scrubbed by a php script
>> anyway, so I was suggesting creating a php script to do it.
>>
>> If it's not a good exercise, then don't do it.
> 
> First stab at it.  Of course it needs US date ordering (month day year).
>  You can't do euro type dates or any other format because there is no
> way to tell the difference between 1/2/2009 (January) and 1/2/2009
> (February):
> 
>  
> $dates = array(
> 'August 5, 2009',
> 'Aug 05 2009',
> 'Aug 5, 9',
> '08/05/09',
> '8-5-9',
> '8 05 2009',
> '8,5,9',);
> 
> foreach($dates as $date) {
> $date = preg_replace("#([\d])+[^/\d]+([\d]+)[^/\d]+([\d]+)#",
> "$1/$2/$3", $date);
> echo date("M j, Y", strtotime($date)) ."\n";
> }
> 
> ?>
> 

Guess you didn't like this one?  Also, if you change the / to - in the
preg_replace() it should work on Euro style dates.

$date = preg_replace("#([\d])+[^-\d]+([\d]+)[^-\d]+([\d]+)#",
"$1-$2-$3", $date);

-Shawn

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



Re: [PHP] Another date exercise

2009-08-17 Thread Shawn McKenzie
tedd wrote:
> At 3:40 PM +0530 8/17/09, kranthi wrote:
>> dont you think http://in3.php.net/strtotime is a solution to your
>> problem ?
> 
> No, it's not a solution to my problem -- I have he problem solved.
> 
> I was just asking if anyone wanted to submit their php solution. It was
> only an exercise.
> 
> I know there are numerous javascript solutions (some good, some bad),
> but ALL of their data has to be accepted and scrubbed by a php script
> anyway, so I was suggesting creating a php script to do it.
> 
> If it's not a good exercise, then don't do it.

First stab at it.  Of course it needs US date ordering (month day year).
 You can't do euro type dates or any other format because there is no
way to tell the difference between 1/2/2009 (January) and 1/2/2009
(February):




-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Another date exercise

2009-08-17 Thread Luke
2009/8/17 Luke 

>
>
> 2009/8/17 tedd 
>
>> At 4:10 PM +0100 8/17/09, Luke wrote:
>>
>>  What would be really cool is if someone wrote a PHP script that generates
>>> some Javascript code that could do this.
>>>
>>> I mean while we're on the subject of complicating things ;)
>>>
>>> --
>>> Luke Slater
>>> :O)
>>>
>>
>> While writing/creating javascript from php can be done, that's not the
>> problem.
>>
>> The problem is that the data provided from a javascript program that
>> cannot be trusted. All data taken from javascript routines must be
>> sanitized.
>>
>> So if you want to talk about complicating things, start accepting data
>> from javascript routines without sanitizing and see how that works out for
>> you.
>>
>>
>> Cheers,
>>
>> tedd
>>
>> --
>> ---
>> http://sperling.com  http://ancientstones.com  http://earthstones.com
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> I didn't say anything about accepting unsanitized data now did I?
>
>
> --
> Luke Slater
> :O)
>
> this text is protected by international copyright. it is illegal for
> anybody apart from the recipient to keep a copy of this text.
> dieser text wird von internationalem urheberrecht geschuetzt. allen
> ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
> zu behalten.
>

Sorry to annoy you Tedd,

I guess stage one would be something like

$date = $_GET['datestring'];
$exploded_date = explode(' ', $date);

foreach($exploded_date as $constituent)
{
if(preg_match('/^{1,31}$/', $constituent))
{
$sane_date["day"] = $constituent;
}
}

Then in the foreach loop would also be something that would check for months
and years, setting the constituent to $sane_date["month"] and
$sane_date["year"] respectively.

Something like that?

I would try it out but I'm at work ;)

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.


Re: [PHP] Another date exercise

2009-08-17 Thread Luke
2009/8/17 tedd 

> At 4:10 PM +0100 8/17/09, Luke wrote:
>
>> What would be really cool is if someone wrote a PHP script that generates
>> some Javascript code that could do this.
>>
>> I mean while we're on the subject of complicating things ;)
>>
>> --
>> Luke Slater
>> :O)
>>
>
> While writing/creating javascript from php can be done, that's not the
> problem.
>
> The problem is that the data provided from a javascript program that cannot
> be trusted. All data taken from javascript routines must be sanitized.
>
> So if you want to talk about complicating things, start accepting data from
> javascript routines without sanitizing and see how that works out for you.
>
>
> Cheers,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I didn't say anything about accepting unsanitized data now did I?

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.


Re: [PHP] Another date exercise

2009-08-17 Thread tedd

At 4:10 PM +0100 8/17/09, Luke wrote:
What would be really cool is if someone wrote a PHP script that 
generates some Javascript code that could do this.


I mean while we're on the subject of complicating things ;)

--
Luke Slater
:O)


While writing/creating javascript from php can be done, that's not the problem.

The problem is that the data provided from a javascript program that 
cannot be trusted. All data taken from javascript routines must be 
sanitized.


So if you want to talk about complicating things, start accepting 
data from javascript routines without sanitizing and see how that 
works out for you.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Another date exercise

2009-08-17 Thread Luke
2009/8/17 tedd 

> At 4:22 PM -0400 8/16/09, Paul M Foster wrote:
>
>> On Sun, Aug 16, 2009 at 08:36:17AM +0100, Lester Caine wrote:
>> -snip-
>>  > But as has been said, the real solution is a date picker.
>>
>> I *hate* date pickers. They slow down input. I can type 082309
>> faster than I can ever do it with a date picker. The date class knows
>> I'm in America and since it's a six-digit date, it must be mmddyy. (Yes,
>> for those of you *not* in America, I agree our dates are goofy. I think
>> we all ought to be on the metic system, too, but America and the UK seem
>> intent on sticking to Imperial measure.)
>>
>> Paul
>>
>
>
> Paul:
>
> Yes, that's part of the problem. I was suggesting an exercise where people
> could put their collective heads together and create a php solution.
>
> I realize that US has DD, MM,  and the Euros have , MM, DD and
> others have other things (i.e., Year of the York).
>
> Not addressing the "other things" -- to me, if one uses a character for a
> month, then there's no problem in deciphering any entry regardless of
> format.
>
> For example, 2009 Aug 23, or Aug 23 2009, or Aug 2009 23, or 23 2009 Aug,
> -- they could all be entered in whatever order you want and deciphered
> correctly. The rules of course are:
>
> Year must be in thousands -- 1000-5000.
> Month must be a character -- D for December, May for May, Jun for June and
> so on.
> Day must be in ones or tens -- 1 or 09, or 31.
>
> It's certainly not a problem to write such code, I only suggested the
> exercise to get people to expound on the problems they encountered. Instead,
> I received "use javascript". Okay... but that's not a php solution, right?
>
> Cheers,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
What would be really cool is if someone wrote a PHP script that generates
some Javascript code that could do this.

I mean while we're on the subject of complicating things ;)

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.


Re: [PHP] Another date exercise

2009-08-17 Thread tedd

At 4:22 PM -0400 8/16/09, Paul M Foster wrote:

On Sun, Aug 16, 2009 at 08:36:17AM +0100, Lester Caine wrote:
-snip-
 > But as has been said, the real solution is a date picker.

I *hate* date pickers. They slow down input. I can type 082309
faster than I can ever do it with a date picker. The date class knows
I'm in America and since it's a six-digit date, it must be mmddyy. (Yes,
for those of you *not* in America, I agree our dates are goofy. I think
we all ought to be on the metic system, too, but America and the UK seem
intent on sticking to Imperial measure.)

Paul



Paul:

Yes, that's part of the problem. I was suggesting an exercise where 
people could put their collective heads together and create a php 
solution.


I realize that US has DD, MM,  and the Euros have , MM, DD 
and others have other things (i.e., Year of the York).


Not addressing the "other things" -- to me, if one uses a character 
for a month, then there's no problem in deciphering any entry 
regardless of format.


For example, 2009 Aug 23, or Aug 23 2009, or Aug 2009 23, or 23 2009 
Aug, -- they could all be entered in whatever order you want and 
deciphered correctly. The rules of course are:


Year must be in thousands -- 1000-5000.
Month must be a character -- D for December, May for May, Jun for 
June and so on.

Day must be in ones or tens -- 1 or 09, or 31.

It's certainly not a problem to write such code, I only suggested the 
exercise to get people to expound on the problems they encountered. 
Instead, I received "use javascript". Okay... but that's not a php 
solution, right?


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Another date exercise

2009-08-17 Thread tedd

At 3:40 PM +0530 8/17/09, kranthi wrote:

dont you think http://in3.php.net/strtotime is a solution to your problem ?


No, it's not a solution to my problem -- I have he problem solved.

I was just asking if anyone wanted to submit their php solution. It 
was only an exercise.


I know there are numerous javascript solutions (some good, some bad), 
but ALL of their data has to be accepted and scrubbed by a php script 
anyway, so I was suggesting creating a php script to do it.


If it's not a good exercise, then don't do it.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Another date exercise

2009-08-17 Thread kranthi
dont you think http://in3.php.net/strtotime is a solution to your problem ?

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



Re: [PHP] Another date exercise

2009-08-16 Thread Ralph Deffke
i agree on date pickers and js is  well

use individual fields for day month and year, make month and year as drop
down and u have no problem at all

make live easier

ralph

"Paul M Foster"  wrote in message
news:20090816202217.gs2...@quillandmouse.com...
> On Sun, Aug 16, 2009 at 08:36:17AM +0100, Lester Caine wrote:
>
> > tedd wrote:
> >> Hi gang:
> >>
> >> Here's another exercise to consider.
> >>
> >> This is a date entry problem where the user can enter a date in various
> >> forms, but the return will be in a consistent format.
> >>
> >> For example, a user might enter a date in the form of:
> >>
> >> August 5, 2009
> >> Aug 05 2009
> >> Aug 5, 9
> >> 08/05/09
> >> 8-5-9
> >> 8 05 2009
> >> 8,5,9
> >>
> >> Or any combination thereof.
> >>
> >> However, the resultant date will be standardized to: Aug 5, 2009.
> >>
> >> Extra points for solving this for Euro as well as US date formats
(i.e.,
> >> 5 Aug, 2009 vs Aug 5, 2009).  And, extra extra points for accommodating
> >> month brevity, such as "A" for August and "Mar" for March and so on.
> >
> > But the real problem here is 05/08/09 is still August 5 2009 .
> > So teaching customers to use 2009.08.05 removes the hassle of needing to
> > know
> > where your target site is based!
> >
> > But as has been said, the real solution is a date picker.
>
> I *hate* date pickers. They slow down input. I can type 082309
> faster than I can ever do it with a date picker. The date class knows
> I'm in America and since it's a six-digit date, it must be mmddyy. (Yes,
> for those of you *not* in America, I agree our dates are goofy. I think
> we all ought to be on the metic system, too, but America and the UK seem
> intent on sticking to Imperial measure.)
>
> Paul
>
>
> -- 
> Paul M. Foster



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



Re: [PHP] Another date exercise

2009-08-16 Thread Paul M Foster
On Sun, Aug 16, 2009 at 08:36:17AM +0100, Lester Caine wrote:

> tedd wrote:
>> Hi gang:
>>
>> Here's another exercise to consider.
>>
>> This is a date entry problem where the user can enter a date in various
>> forms, but the return will be in a consistent format.
>>
>> For example, a user might enter a date in the form of:
>>
>> August 5, 2009
>> Aug 05 2009
>> Aug 5, 9
>> 08/05/09
>> 8-5-9
>> 8 05 2009
>> 8,5,9
>>
>> Or any combination thereof.
>>
>> However, the resultant date will be standardized to: Aug 5, 2009.
>>
>> Extra points for solving this for Euro as well as US date formats (i.e.,
>> 5 Aug, 2009 vs Aug 5, 2009).  And, extra extra points for accommodating
>> month brevity, such as "A" for August and "Mar" for March and so on.
>
> But the real problem here is 05/08/09 is still August 5 2009 .
> So teaching customers to use 2009.08.05 removes the hassle of needing to 
> know
> where your target site is based!
>
> But as has been said, the real solution is a date picker.

I *hate* date pickers. They slow down input. I can type 082309
faster than I can ever do it with a date picker. The date class knows
I'm in America and since it's a six-digit date, it must be mmddyy. (Yes,
for those of you *not* in America, I agree our dates are goofy. I think
we all ought to be on the metic system, too, but America and the UK seem
intent on sticking to Imperial measure.)

Paul


-- 
Paul M. Foster

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



Re: [PHP] Another date exercise

2009-08-16 Thread Ashley Sheridan
On Sun, 2009-08-16 at 08:36 +0100, Lester Caine wrote:
> tedd wrote:
> > Hi gang:
> > 
> > Here's another exercise to consider.
> > 
> > This is a date entry problem where the user can enter a date in various 
> > forms, but the return will be in a consistent format.
> > 
> > For example, a user might enter a date in the form of:
> > 
> > August 5, 2009
> > Aug 05 2009
> > Aug 5, 9
> > 08/05/09
> > 8-5-9
> > 8 05 2009
> > 8,5,9
> > 
> > Or any combination thereof.
> > 
> > However, the resultant date will be standardized to: Aug 5, 2009.
> > 
> > Extra points for solving this for Euro as well as US date formats (i.e., 
> > 5 Aug, 2009 vs Aug 5, 2009).  And, extra extra points for accommodating 
> > month brevity, such as "A" for August and "Mar" for March and so on.
> 
> But the real problem here is 05/08/09 is still August 5 2009 .
> So teaching customers to use 2009.08.05 removes the hassle of needing to know 
> where your target site is based!
> 
> But as has been said, the real solution is a date picker.
> 
> -- 
> 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
> 

Seriously, go out and beat your clients over the head, and then hit them
about some more until they understand the folly of using bad date
formats. US-style dates are just the start of it!

Thanks,
Ash
http://www.ashleysheridan.co.uk


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



Re: [PHP] Another date exercise

2009-08-16 Thread Lester Caine

tedd wrote:

Hi gang:

Here's another exercise to consider.

This is a date entry problem where the user can enter a date in various 
forms, but the return will be in a consistent format.


For example, a user might enter a date in the form of:

August 5, 2009
Aug 05 2009
Aug 5, 9
08/05/09
8-5-9
8 05 2009
8,5,9

Or any combination thereof.

However, the resultant date will be standardized to: Aug 5, 2009.

Extra points for solving this for Euro as well as US date formats (i.e., 
5 Aug, 2009 vs Aug 5, 2009).  And, extra extra points for accommodating 
month brevity, such as "A" for August and "Mar" for March and so on.


But the real problem here is 05/08/09 is still August 5 2009 .
So teaching customers to use 2009.08.05 removes the hassle of needing to know 
where your target site is based!


But as has been said, the real solution is a date picker.

--
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



Re: [PHP] Another date exercise

2009-08-15 Thread Phpster


On Aug 15, 2009, at 3:57 PM, tedd  wrote:


Hi gang:

Here's another exercise to consider.

This is a date entry problem where the user can enter a date in  
various forms, but the return will be in a consistent format.


For example, a user might enter a date in the form of:

August 5, 2009
Aug 05 2009
Aug 5, 9
08/05/09
8-5-9
8 05 2009
8,5,9

Or any combination thereof.

However, the resultant date will be standardized to: Aug 5, 2009.

Extra points for solving this for Euro as well as US date formats  
(i.e., 5 Aug, 2009 vs Aug 5, 2009).  And, extra extra points for  
accommodating month brevity, such as "A" for August and "Mar" for  
March and so on.


Gentlemen, start your keyboards.  :-)

As always, should you or any of your IM Force be caught or killed,  
The Secretary will disavow any knowledge of your actions.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Use a js date picker and avoid the whole issue.

Bastien

Sent from my iPod
 


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



Re: [PHP] another pagination problem

2009-07-18 Thread Ashley Sheridan
On Fri, 2009-07-17 at 11:55 -0400, PJ wrote:
> Ashley Sheridan wrote:
> > On Friday 17 July 2009 16:35:10 PJ wrote:
> >   
> >> I noticed the thread on pagination here just after posting to mysql. But
> >> I am using php/mysql ;-)
> >> I have some rather complicated ordering problems:
> >> 1. need to order by 2 fields title, sub_title
> >> 2. need to display 10 items per page (hundreds, if not 1000s or pages)
> >> 3. order by ASC or DESC makes not difference when ordering by 2 fields
> >> 4. when ordering by title, results are totally different for ASC & DESC;
> >> not the same data at all (Is the ordering done on the entire db? )
> >> 5. those funny little dingles over foreign language characters refuse to
> >> follow our normal ordering rules; how do we do this?
> >> 6. The pagination and ordering syntax is correct & working with no
> >> errors; I've double checked on commandline.
> >> 7. At worst, I'll have to leave it at ASC and let visitors p&m; don't
> >> see a simple solution.
> >>
> >> Or am I wrong?
> >>
> >>
> >> --
> >> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> >> -
> >> Phil Jourdan --- p...@ptahhotep.com
> >>http://www.ptahhotep.com
> >>http://www.chiccantine.com/andypantry.php
> >> 
> >
> > How are you attempting to order the query, do you have an excerpt? I've 
> > never 
> > had any problems ordering my results based on more than one field, where 
> > the 
> > orders are based on a mixture of ASC and DESC fields. The ordering part 
> > looks 
> > something like this:
> >
> > ORDER BY `field1` DESC, `field2` ASC, `field3` DESC
> >
> > and that works just fine for me. Also, what character set are you using on 
> > that table, as that may have a difference on how the ordering works.
> >
> >   
> Sorry, forgot: another problem is the Thes - how do you exclude them
> from the ordering.
> 
> Also: one output with just title for field returned a series of The
> Art.., The Birds..., The Birth...etc. in ASC; whereas DESC returned:
> Boats, Black Cumin, Birds of..., Biological..., Bioarchaeology..,
> Avaris... etc.
> 
> -- 
> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> -
> Phil Jourdan --- p...@ptahhotep.com
>http://www.ptahhotep.com
>http://www.chiccantine.com/andypantry.php
> 
> 
So you want to order by the text excluding the word 'The', so you'd have
output like 'The Art', 'The Birds', 'Birds of...' ?

Thanks
Ash
www.ashleysheridan.co.uk


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



Re: [PHP] another pagination problem

2009-07-18 Thread LinuxManMikeC
On Fri, Jul 17, 2009 at 9:35 AM, PJ wrote:
> 4. when ordering by title, results are totally different for ASC & DESC;
> not the same data at all (Is the ordering done on the entire db? )

Yes, sort of.  ORDER BY is applied to the results of the entire query.
 Then LIMIT takes a slice out of the results (paginate).  My guess,
the "problem" you are experiencing is you are viewing page 2 of 5 of
your output in ASC order, then switch over to DESC without adjusting
the page number.  What you are seeing (roughly) for page 2 of 5 in
DESC order is what used to be on page 4 of 5 in ASC order, only
"upside-down". :-)

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



Re: [PHP] another pagination problem

2009-07-17 Thread PJ
Ashley Sheridan wrote:
> On Friday 17 July 2009 16:35:10 PJ wrote:
>   
>> I noticed the thread on pagination here just after posting to mysql. But
>> I am using php/mysql ;-)
>> I have some rather complicated ordering problems:
>> 1. need to order by 2 fields title, sub_title
>> 2. need to display 10 items per page (hundreds, if not 1000s or pages)
>> 3. order by ASC or DESC makes not difference when ordering by 2 fields
>> 4. when ordering by title, results are totally different for ASC & DESC;
>> not the same data at all (Is the ordering done on the entire db? )
>> 5. those funny little dingles over foreign language characters refuse to
>> follow our normal ordering rules; how do we do this?
>> 6. The pagination and ordering syntax is correct & working with no
>> errors; I've double checked on commandline.
>> 7. At worst, I'll have to leave it at ASC and let visitors p&m; don't
>> see a simple solution.
>>
>> Or am I wrong?
>>
>>
>> --
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com
>>http://www.ptahhotep.com
>>http://www.chiccantine.com/andypantry.php
>> 
>
> How are you attempting to order the query, do you have an excerpt? I've never 
> had any problems ordering my results based on more than one field, where the 
> orders are based on a mixture of ASC and DESC fields. The ordering part looks 
> something like this:
>
> ORDER BY `field1` DESC, `field2` ASC, `field3` DESC
>
> and that works just fine for me. Also, what character set are you using on 
> that table, as that may have a difference on how the ordering works.
>
>   
Sorry, forgot: another problem is the Thes - how do you exclude them
from the ordering.

Also: one output with just title for field returned a series of The
Art.., The Birds..., The Birth...etc. in ASC; whereas DESC returned:
Boats, Black Cumin, Birds of..., Biological..., Bioarchaeology..,
Avaris... etc.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] another pagination problem

2009-07-17 Thread PJ
Ashley Sheridan wrote:
> On Friday 17 July 2009 16:35:10 PJ wrote:
>   
>> I noticed the thread on pagination here just after posting to mysql. But
>> I am using php/mysql ;-)
>> I have some rather complicated ordering problems:
>> 1. need to order by 2 fields title, sub_title
>> 2. need to display 10 items per page (hundreds, if not 1000s or pages)
>> 3. order by ASC or DESC makes not difference when ordering by 2 fields
>> 4. when ordering by title, results are totally different for ASC & DESC;
>> not the same data at all (Is the ordering done on the entire db? )
>> 5. those funny little dingles over foreign language characters refuse to
>> follow our normal ordering rules; how do we do this?
>> 6. The pagination and ordering syntax is correct & working with no
>> errors; I've double checked on commandline.
>> 7. At worst, I'll have to leave it at ASC and let visitors p&m; don't
>> see a simple solution.
>>
>> Or am I wrong?
>>
>>
>> --
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com
>>http://www.ptahhotep.com
>>http://www.chiccantine.com/andypantry.php
>> 
>
> How are you attempting to order the query, do you have an excerpt? I've never 
> had any problems ordering my results based on more than one field, where the 
> orders are based on a mixture of ASC and DESC fields. The ordering part looks 
> something like this:
>
> ORDER BY `field1` DESC, `field2` ASC, `field3` DESC
>
> and that works just fine for me. Also, what character set are you using on 
> that table, as that may have a difference on how the ordering works.
>
>   
Here's the query:
"SELECT * FROM book ORDER BY $sort $dir LIMIT $offset, $records_per_page";
$sort == 'title, sub_title'; $dir==ASC (or DESC); $offset== (any
multiple of 10); $records_per_page== 10;
I could let the user change these, but I decided it is simpler to keep
it at 10 books/page. Only the $dir is user settable.
The character set is utf8-general; (I just went through some
self-torture changing all those foreign curlicues to :&cutesy_stuff;
fortunately, the mysql replace() function helped - but six languages
have quite a few weird accents.
The title field can be fairly long - 182 chars; sub_title is 128, but it
looks like I have to lengthen that too; found some truncated inputs.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] another pagination problem

2009-07-17 Thread Ashley Sheridan
On Friday 17 July 2009 16:35:10 PJ wrote:
> I noticed the thread on pagination here just after posting to mysql. But
> I am using php/mysql ;-)
> I have some rather complicated ordering problems:
> 1. need to order by 2 fields title, sub_title
> 2. need to display 10 items per page (hundreds, if not 1000s or pages)
> 3. order by ASC or DESC makes not difference when ordering by 2 fields
> 4. when ordering by title, results are totally different for ASC & DESC;
> not the same data at all (Is the ordering done on the entire db? )
> 5. those funny little dingles over foreign language characters refuse to
> follow our normal ordering rules; how do we do this?
> 6. The pagination and ordering syntax is correct & working with no
> errors; I've double checked on commandline.
> 7. At worst, I'll have to leave it at ASC and let visitors p&m; don't
> see a simple solution.
>
> Or am I wrong?
>
>
> --
> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> -
> Phil Jourdan --- p...@ptahhotep.com
>http://www.ptahhotep.com
>http://www.chiccantine.com/andypantry.php

How are you attempting to order the query, do you have an excerpt? I've never 
had any problems ordering my results based on more than one field, where the 
orders are based on a mixture of ASC and DESC fields. The ordering part looks 
something like this:

ORDER BY `field1` DESC, `field2` ASC, `field3` DESC

and that works just fine for me. Also, what character set are you using on 
that table, as that may have a difference on how the ordering works.

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk

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



Re: [PHP] Another matching question

2009-02-02 Thread Ashley Sheridan
On Mon, 2009-02-02 at 20:35 -0500, Ron Piggott wrote:

> How do I tell if 
> 
> words_from_the_well 
> 
> is not the value of $page (whether it is the entire value of $page OR
> within the value of $page)
> 
> So far I have come up with the following, but it doesn't deal with when
> $page is only within the value of $page
> 
> if ( $page <> "words_from_the_well" )  {
> 
> Ron 

The <> comparison operator won't work in PHP. What you want maybe is
something like this:

if(!strstr($page, "words_from_the_well"))
{}


Ash
www.ashleysheridan.co.uk


Re: [PHP] Another beginner question

2009-01-13 Thread Gary
Dan

Thanks for your reply...however..



This confuses me greatly.  My remote server is godaddy, my testing server is 
apache...

Could you explain that for me?

Thanks again

Gary


""Dan Shirah""  wrote in message 
news:a16da1ff0901130727v3a51cce9na913c8f12098...@mail.gmail.com...
> On Tue, Jan 13, 2009 at 10:17 AM, Gary  wrote:
>
>> I have successfully set up the testing server, now I would like to test 
>> it
>> out on the remote server, but "put" does not seem to be working. I saved
>> the
>> php document, click put, nothing seems to happen.  I am connected to the
>> remote server, but when I put, nothing happens.
>>
>> The file is in the local root file, the local and remote information has
>> not
>> changed.
>>
>> I do get this error "The sites testing and remote servers are different.
>> This scenario is not supported by the Site Wizard", when switching from
>> basic to advanced tabs in site manager.
>>
>> What am I missing?
>>
>> Thank you
>>
>> Gary
>
>
> This sounds like a Dreamweaver question, not a PHP question...
>
> If you go to Site -> Edit Sites
>
> Under Local Info you input the information for the server you develop your
> application on
>
> Under Remote Info you input the information for the server you would like 
> to
> "Put" files on
>
> Under Testing Info you input the information for the server you would like
> to use to "View" your pages.
>
> Your Remote and Testing servers should ideally be the same.
> 



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



Re: [PHP] Another beginner question

2009-01-13 Thread Dan Shirah
On Tue, Jan 13, 2009 at 10:17 AM, Gary  wrote:

> I have successfully set up the testing server, now I would like to test it
> out on the remote server, but "put" does not seem to be working. I saved
> the
> php document, click put, nothing seems to happen.  I am connected to the
> remote server, but when I put, nothing happens.
>
> The file is in the local root file, the local and remote information has
> not
> changed.
>
> I do get this error "The sites testing and remote servers are different.
> This scenario is not supported by the Site Wizard", when switching from
> basic to advanced tabs in site manager.
>
> What am I missing?
>
> Thank you
>
> Gary


This sounds like a Dreamweaver question, not a PHP question...

If you go to Site -> Edit Sites

Under Local Info you input the information for the server you develop your
application on

Under Remote Info you input the information for the server you would like to
"Put" files on

Under Testing Info you input the information for the server you would like
to use to "View" your pages.

Your Remote and Testing servers should ideally be the same.


RE: [PHP] Another question about Google maps

2008-11-17 Thread tedd

At 8:37 AM -0600 11/17/08, Boyd, Todd M. wrote:

tedd, I think it might be displaying your extra divs (if there are any..
just skimmed the source momentarily) for a split second before they are
hidden with Javascript. Maybe try setting the CSS for your 3 map divs
(mapsearch, idlediv, searchdiv or whatever) to display:none and show
them when the page is loaded? Or give all 3 the same top/left
coordinates, etc...

Just a shot in the dark. I may read over the code a bit more if I get
some time later today. I'm no expert, but I've been working with the
Google Maps API rather extensively lately, and maybe I can offer a fresh
set of eyes.

HTH,


Todd Boyd
Web Programmer


Todd:

That would be great. Also, if you see anything there you like, of 
course you may use it.


I think the div's are Okay -- I always check my code through the W3C 
validator and that does a good job of checking that. I wish that 
Google and W3C would decide on what's "acceptable".


I also tried "display: none" via css, but could not get the right 
combination of hide/display to make it work right. However, I'll look 
into your suggestion.


If you can find anything to correct, that would be good. But it's 
just a minor annoyance and I thought someone might readily know what 
the problem was.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



RE: [PHP] Another question about Google maps

2008-11-17 Thread Boyd, Todd M.
> -Original Message-
> From: tedd [mailto:[EMAIL PROTECTED]
> Sent: Saturday, November 15, 2008 2:11 PM
> To: php-general@lists.php.net
> Subject: [PHP] Another question about Google maps
> 
> Hi gang:
> 
> I posted this question on the Google Map Discussion group/list
> thingie, but got zip in replies. Maybe someone here might have an
> idea.
> 
> Here's the url:
> 
> http://masoncollision.com/contact.php
> 
> In both Safari and FireFox for the Mac (I have not tested it with
> other browsers) as the page loads the map border is momentary drawn
> twice. The map border is shown stacked one above the other making the
> page much longer than it actually is. But immediately thereafter, the
> map is drawn correctly and the page returns to the size it's supposed
> to be.
> 
> I just want to get rid of the momentary flash.
> 
> Anyone have any ideas?

tedd, I think it might be displaying your extra divs (if there are any..
just skimmed the source momentarily) for a split second before they are
hidden with Javascript. Maybe try setting the CSS for your 3 map divs
(mapsearch, idlediv, searchdiv or whatever) to display:none and show
them when the page is loaded? Or give all 3 the same top/left
coordinates, etc...

Just a shot in the dark. I may read over the code a bit more if I get
some time later today. I'm no expert, but I've been working with the
Google Maps API rather extensively lately, and maybe I can offer a fresh
set of eyes.

HTH,


Todd Boyd
Web Programmer

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



Re: [PHP] Another question about Google maps

2008-11-16 Thread tedd

At 1:29 AM +1030 11/17/08, Michael Kubler wrote:

Well, it shows up for FFox v2 and v3 on Windows XP as well.
I managed to replicate it by shift+refreshing the page.

I also managed to stop it mid load by setting Firefox to 'Work 
Offline' just as it displayed the flash of both boxes.


Using the Web Developer plugin for FFox I can tell you that the top 
box has a class of '.gsmsc-mapDiv' while the bottom div one is 
'.gsmsc-idleMapDiv', and both are wrapped in the 
'.gsmsc-appContainer' div, and also the '#mapsearch' div.


I've not played with google maps enough, but doubt the above helps, 
I just but know that it's not a PHP issue. It's almost like a flash 
of unstyled content , 
but is being generated because of the javascript.


I hid the '.gsmsc-mapDiv' which stopped the flash of both box boxes 
appearing, and I could view the map, but caused the map to disappear 
after I tried searching for a different Google Maps location.


Michael Kubler
*G*rey *P*hoenix *P*roductions 


Michael

Thanks very much for your time looking into this.

It IS very similar of FOUC and I looked into that as a possible 
problem/solution.


I think you can see why I didn't get a reply from my Google post -- 
it's one of those problems that Google has, but doesn't yet 
understand it well enough to fix it. Too busy with new stuff *.


I may have to hide the map via css and then change display after load 
-- I just didn't want to go that route IF there was a better way.


Thanks again,

tedd


PS: * I really like Google's Analytics, but hate all the javascript 
errors it generates in FF firebug.


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Another question about Google maps

2008-11-16 Thread Michael Kubler

Well, it shows up for FFox v2 and v3 on Windows XP as well.
I managed to replicate it by shift+refreshing the page.

I also managed to stop it mid load by setting Firefox to 'Work Offline' 
just as it displayed the flash of both boxes.


Using the Web Developer plugin for FFox I can tell you that the top box 
has a class of '.gsmsc-mapDiv' while the bottom div one is 
'.gsmsc-idleMapDiv', and both are wrapped in the '.gsmsc-appContainer' 
div, and also the '#mapsearch' div.


I've not played with google maps enough, but doubt the above helps, I 
just but know that it's not a PHP issue. It's almost like a flash of 
unstyled content , but is 
being generated because of the javascript.


I hid the '.gsmsc-mapDiv' which stopped the flash of both box boxes 
appearing, and I could view the map, but caused the map to disappear 
after I tried searching for a different Google Maps location.


Michael Kubler
*G*rey *P*hoenix *P*roductions 



tedd wrote:

Hi gang:

I posted this question on the Google Map Discussion group/list 
thingie, but got zip in replies. Maybe someone here might have an idea.


Here's the url:

http://masoncollision.com/contact.php

In both Safari and FireFox for the Mac (I have not tested it with 
other browsers) as the page loads the map border is momentary drawn 
twice. The map border is shown stacked one above the other making the 
page much longer than it actually is. But immediately thereafter, the 
map is drawn correctly and the page returns to the size it's supposed 
to be.


I just want to get rid of the momentary flash.

Anyone have any ideas?

Cheers and thanks,

tedd


Re: [PHP] Another instance of shameless self promotion

2008-07-07 Thread Daniel Brown
On Sat, Jun 28, 2008 at 5:04 PM, Richard Heyes <[EMAIL PROTECTED]> wrote:
> This time its a line chart:
>
> http://www.phpguru.org/line/test.html
>
> BTW Is anyone else dumbfounded at the inability of the CANVAS tag to render
> text natively? A gross oversight IMO.

I'm dumbfounded by the inability of the CANVAS tag to detect a 404
and properly redirect.  ;-P

-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Another canvas example

2008-06-24 Thread Daniel Brown
On Tue, Jun 24, 2008 at 11:07 AM, Ray Hauge <[EMAIL PROTECTED]> wrote:
>
> Strange, I've tested it on Kubuntu Hardy  FF 3, SuSE SLED 10.1 & FF2,
> Windows FF2&3 Safari Opera 9.5 IE6&7, Mac OSX Safari.  I'd be interested in
> what error you got, just email me off-list if you like.

Sorry, Ray, I meant to send a follow-up immediately afterward.  It
works just fine once you read the directions.  I was trying to place
track pieces before clicking "Start".  I thought it was there to be
clicked when you were ready to have the train go on the track you
built.

So yes, it works on all three of the systems and configurations I
tried.  There was just a mild case of Operator Error.  My logic
processor is still rather buggy sometimes.

Good job!

-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Another canvas example

2008-06-24 Thread Ray Hauge

Daniel Brown wrote:

On Tue, Jun 24, 2008 at 3:53 AM, Ray Hauge <[EMAIL PROTECTED]> wrote:

http://www.primateapplications.com/trackattack/


Ray,

This displays perfectly fine, but does not function beyond looking
pretty on Firefox 3 (Linux/KDE).  I am, however, probably going to
play that game for a bit on my non-Linux (I refuse to say the name!)
machine.

Maybe Rich could turn his canvas example into the first
HTML/CSS/JavaScript beach volleyball game.  It would be the closest
some of us would probably get to detaching from our desks and getting
onto a beach to play anyway.



Strange, I've tested it on Kubuntu Hardy  FF 3, SuSE SLED 10.1 & FF2, 
Windows FF2&3 Safari Opera 9.5 IE6&7, Mac OSX Safari.  I'd be interested 
in what error you got, just email me off-list if you like.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Another canvas example

2008-06-24 Thread Daniel Brown
On Tue, Jun 24, 2008 at 3:53 AM, Ray Hauge <[EMAIL PROTECTED]> wrote:
>
> http://www.primateapplications.com/trackattack/

Ray,

This displays perfectly fine, but does not function beyond looking
pretty on Firefox 3 (Linux/KDE).  I am, however, probably going to
play that game for a bit on my non-Linux (I refuse to say the name!)
machine.

Maybe Rich could turn his canvas example into the first
HTML/CSS/JavaScript beach volleyball game.  It would be the closest
some of us would probably get to detaching from our desks and getting
onto a beach to play anyway.

-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Another canvas example

2008-06-24 Thread Ray Hauge

Richard Heyes wrote:

Pretty sweet! My only problem with it is that I had to use the keyboard
to get to the "Attach" button, since I couldn't click on it with it
being behind the pie chart in the page's Z-order.


Yes, no way around (I think). Even with the buttons z-index set to 99 it 
still shows up behind the beachball.


TAB and the spacebar are your friends I guess... :-)



Oh, I forgot to mention that you'll have to make the css position 
attribute relative.  Then the z-index will work.  I think that's what I 
had to do for the same issue. *


* I had to get up in the middle of the night to check some production 
issues and checked my email while waiting.  My memory might not be fully 
functioning :)


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Another canvas example

2008-06-24 Thread Ray Hauge

Richard Heyes wrote:

Pretty sweet! My only problem with it is that I had to use the keyboard
to get to the "Attach" button, since I couldn't click on it with it
being behind the pie chart in the page's Z-order.


Yes, no way around (I think). Even with the buttons z-index set to 99 it 
still shows up behind the beachball.


TAB and the spacebar are your friends I guess... :-)



You could make the z-index of the beachball at 1, and then put the rest 
of the page in a div with a z-index higher than 1.  The beachball should 
then still appear, but be under the div, which allows you to click the 
button.  I ran into the same issue with a game I've been making:


http://www.primateapplications.com/trackattack/

Since you're working with the Canvas, you can be reasonably sure that 
the browser would support doing this.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Another canvas example

2008-06-23 Thread Richard Heyes

Pretty sweet! My only problem with it is that I had to use the keyboard
to get to the "Attach" button, since I couldn't click on it with it
being behind the pie chart in the page's Z-order.


Yes, no way around (I think). Even with the buttons z-index set to 99 it 
still shows up behind the beachball.


TAB and the spacebar are your friends I guess... :-)

--
Richard Heyes

Employ me:
http://www.phpguru.org/cv

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



RE: [PHP] Another canvas example

2008-06-23 Thread Boyd, Todd M.
> -Original Message-
> From: Richard Heyes [mailto:[EMAIL PROTECTED]
> Sent: Saturday, June 21, 2008 9:40 AM
> To: PHP General List
> Subject: [PHP] Another canvas example
> 
> Hi,
> 
> Latest in my new series of "look at me, aren't I cool" canvas examples
> is here:
> 
> http://www.phpguru.org/pie/pie.html
> 
> Works in IE7 too. And Opera. Ooh.

Richard,

Pretty sweet! My only problem with it is that I had to use the keyboard
to get to the "Attach" button, since I couldn't click on it with it
being behind the pie chart in the page's Z-order.

Just a thought. Looks great, though! Good work!


Todd Boyd
Web Programmer




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



Re: [PHP] Another canvas example

2008-06-22 Thread Richard Heyes

Hi,


You gonna post the source code? ;)


Already have, like all Javascript, it's clientside. The direct URL is:

http://www.phpguru.org/pie/pie.js

There's also the ExCanvas library, but that's public anyway.

--
Richard Heyes

Employ me:
http://www.phpguru.org/cv

++
| Access SSH with a Windows mapped drive |
|http://www.phpguru.org/sftpdrive|
++

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



Re: [PHP] Another canvas example

2008-06-21 Thread Wolf

Richard Heyes wrote:

Hi,

Latest in my new series of "look at me, aren't I cool" canvas examples 
is here:


http://www.phpguru.org/pie/pie.html

Works in IE7 too. And Opera. Ooh.


Great beach ball!

The nice thing about adverts, is that MOST people use /ads/* in their 
coding to place their adverts, so using Adblock+ gets rid of them PDQ.  :)


You gonna post the source code? ;)

Wolf


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




Re: [PHP] Another canvas example

2008-06-21 Thread Ray Hauge

Richard Heyes wrote:

Hi,

Latest in my new series of "look at me, aren't I cool" canvas examples 
is here:


http://www.phpguru.org/pie/pie.html

Works in IE7 too. And Opera. Ooh.



Awesome stuff.  I think the canvas element will be my next adventure. 
I've been learning JavaScript a lot recently.  That's been an 
interesting experience that I'm glad I did.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Another canvas example

2008-06-21 Thread Richard Heyes

> it's a beach ball cursor.

Lol. A didn't see it like that, but now you've mentioned it, it's kinda 
stuck and that's all I can see now. :-)


--
Richard Heyes

Employ me:
http://www.phpguru.org/cv

++
| Access SSH with a Windows mapped drive |
|http://www.phpguru.org/sftpdrive|
++

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



Re: [PHP] Another canvas example

2008-06-21 Thread tedd

At 3:39 PM +0100 6/21/08, Richard Heyes wrote:

Hi,

Latest in my new series of "look at me, aren't I cool" canvas 
examples is here:


http://www.phpguru.org/pie/pie.html

Works in IE7 too. And Opera. Ooh.

--
Richard Heyes


Richard:

It's NOT a pie chart, it's a beach ball cursor. But, it's cool.

As for use, I could think it might be used to let the user know in 
what state their cursor is in.


For example, when we, on a Mac, are copying a file, our cursor turns 
to a pointer with a plus. That cursor is not available via browsers. 
So, your canvas example could provide cursor attributes.


Just a thought -- I have to do some other thinking now.

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Another canvas example

2008-06-21 Thread Daniel Brown
On Sat, Jun 21, 2008 at 10:39 AM, Richard Heyes <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Latest in my new series of "look at me, aren't I cool" canvas examples is
> here:
>
> http://www.phpguru.org/pie/pie.html
>
> Works in IE7 too. And Opera. Ooh.

Tests just fine in FF3 (3.0.0 final) on Windows, and in Mandriva
(KDE) using FF3 beta 5.  I'll check it in Netscape 9, Konqueror, and
Galeon later, because I'm actually curious if they'll correctly decode
the BASE64 in the styling.

Looks good, Rich.

-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Another way to send variables

2008-06-13 Thread Daniel Brown
On Fri, Jun 13, 2008 at 5:49 PM, R B <[EMAIL PROTECTED]> wrote:
> Hello.
>
> I have this script (script1.php):
>
>   $a = "Hello";
>  header("Location: script2.php");
> ?>
>
> I need to send the $a variable to script2.php, but i don´t want to send it
> in the url.
>
> Is there another method?





-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



RE: [PHP] Another way to send variables

2008-06-13 Thread Boyd, Todd M.
> -Original Message-
> From: R B [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 13, 2008 4:50 PM
> To: PHP List
> Subject: [PHP] Another way to send variables
> 
> Hello.
> 
> I have this script (script1.php):
> 
>   $a = "Hello";
>  header("Location: script2.php");
> ?>
> 
> I need to send the $a variable to script2.php, but i don´t want to send
> it
> in the url.
> 
> Is there another method?
> 
> Maybe with another header instruction without putting in the url?
> 
> Thank you.

Well, you can use POST instead of GET. If you're trying to hide it from laymen, 
this is fine. If you're trying to hide it altogether, it's still visible for 
people who know where to look.

HTH,


Todd Boyd
Web Programmer




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



Re: [PHP] Another way to send variables

2008-06-13 Thread Nathan Nobbe
On Fri, Jun 13, 2008 at 3:49 PM, R B <[EMAIL PROTECTED]> wrote:

> Hello.
>
> I have this script (script1.php):
>
>   $a = "Hello";
>  header("Location: script2.php");
> ?>
>
> I need to send the $a variable to script2.php, but i don´t want to send it
> in the url.
>
> Is there another method?
>
> Maybe with another header instruction without putting in the url?


store the variable in a session, on disk (explicitly), in apc (or something
similar), or a database.

-nathan


Re: [PHP] Another question about functions...

2008-01-31 Thread Jason Pruim


On Jan 31, 2008, at 8:19 AM, Zoltán Németh wrote:



I can try :) when I downloaded in clicking on the link, and tried to
open it OS X popped on a message saying that I had downloaded an
applicaiton and it was the first time I had tried to open it, was I
sure that I wanted to, and I could view the web page it was  
downloaded

from, go ahead and open it, or cancel.

When I tell it to open, it opens in excel, what appears to be a copy
of the actual webpage. Including the CSS, images, my banner, and then
as much of the actual database at it can cram into 1 cell.

What I found out though, is after I removed the doctype, and banners
from an included file that I was able to download it as a normal  
excel

file and now is working great.


oh yeah, never put your html&css stuff into an excel download :)



Yeah.. It wasn't intentional... :) Stupid include files... Try and  
manage the settings from 1 location and get hassled for doing it! :P  
Anyway, Now I just create a visual.include file for my doctype/banner  
type stuff :)

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] Another question about functions...

2008-01-31 Thread Zoltán Németh
2008. 01. 31, csütörtök keltezéssel 08.12-kor Jason Pruim ezt írta:
> On Jan 30, 2008, at 7:53 PM, Richard Lynch wrote:
> 
> > On Tue, January 29, 2008 1:39 pm, Jason Pruim wrote:
> >> Okay, so I checked everything I can think of, and it's still
> >> downloading it as an application which means it's downloading the
> >> entire website instead of just the data from the database... Anyone
> >> have any idea what to check?
> >
> > Can you explain what you mean by "downloading it as an  
> > application"?...
> 
> 
> I can try :) when I downloaded in clicking on the link, and tried to  
> open it OS X popped on a message saying that I had downloaded an  
> applicaiton and it was the first time I had tried to open it, was I  
> sure that I wanted to, and I could view the web page it was downloaded  
> from, go ahead and open it, or cancel.
> 
> When I tell it to open, it opens in excel, what appears to be a copy  
> of the actual webpage. Including the CSS, images, my banner, and then  
> as much of the actual database at it can cram into 1 cell.
> 
> What I found out though, is after I removed the doctype, and banners  
> from an included file that I was able to download it as a normal excel  
> file and now is working great.

oh yeah, never put your html&css stuff into an excel download :)

greets
Zoltán Németh

> 
> I hope that explains it a little better...
> 
> And now, I just need to get my search function to work :) But that's  
> another e-mail... We'll see if I get a chance to tackle it today or not.
> 
> Thanks for looking though! Your replies have always been extremely  
> helpful.
> --
> 
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424
> www.raoset.com
> [EMAIL PROTECTED]
> 

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



Re: [PHP] Another question about functions...

2008-01-31 Thread Jason Pruim


On Jan 30, 2008, at 7:53 PM, Richard Lynch wrote:


On Tue, January 29, 2008 1:39 pm, Jason Pruim wrote:

Okay, so I checked everything I can think of, and it's still
downloading it as an application which means it's downloading the
entire website instead of just the data from the database... Anyone
have any idea what to check?


Can you explain what you mean by "downloading it as an  
application"?...



I can try :) when I downloaded in clicking on the link, and tried to  
open it OS X popped on a message saying that I had downloaded an  
applicaiton and it was the first time I had tried to open it, was I  
sure that I wanted to, and I could view the web page it was downloaded  
from, go ahead and open it, or cancel.


When I tell it to open, it opens in excel, what appears to be a copy  
of the actual webpage. Including the CSS, images, my banner, and then  
as much of the actual database at it can cram into 1 cell.


What I found out though, is after I removed the doctype, and banners  
from an included file that I was able to download it as a normal excel  
file and now is working great.


I hope that explains it a little better...

And now, I just need to get my search function to work :) But that's  
another e-mail... We'll see if I get a chance to tackle it today or not.


Thanks for looking though! Your replies have always been extremely  
helpful.

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] Another question about functions...

2008-01-30 Thread Richard Lynch
On Tue, January 29, 2008 1:39 pm, Jason Pruim wrote:
> Okay, so I checked everything I can think of, and it's still
> downloading it as an application which means it's downloading the
> entire website instead of just the data from the database... Anyone
> have any idea what to check?

Can you explain what you mean by "downloading it as an application"?...


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Another question about functions...

2008-01-30 Thread Jason Pruim


On Jan 29, 2008, at 4:29 PM, Nathan Nobbe wrote:


On Jan 29, 2008 3:53 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:
I did as you suggested, and I think I found the reason... I included  
info for the doctype, and some files that are on all my pages...  
Once I comment out those lines it works just fine...


I'm assuming that that is expected behavior?

where did you include this information?
i didnt see it in the original code you posted.
and, btw. im no expert on setting mime types for excel :)

-nathan





They were included in a config file I am working on... the  
defaults.php file that has other config info, such as DB auth info and  
system wide variables.



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]




Re: [PHP] Another question about functions...

2008-01-29 Thread Chris



What's happening is, I have the code set and it downloads the file into 
excel, but it doesn't have the database fields in it, rather a copy of 
the entire webpage which it trys to put into excel. Below is the code 
that I am using in my function to export the records:




echo $select . "\n";

if you run that through your db manually do you get an error?


$export = mysql_query($select);


var_dump($export);


$fields = mysql_num_fields($export);


// initialize the header line to be an empty string.
$header = '';


for ($i = 0; $i < $fields; $i++) {
$header .= mysql_field_name($export, $i) . "\t";
}


You will need a trim here otherwise you'll have an extra empty column 
(extra \t in there):


$header = trim($header);


while($row = mysql_fetch_row($export)) {
$line = '';
foreach($row as $value) {
if ((!isset($value)) or ($value == "")) {
$value = "\t";
}
else
{
$value = str_replace('"', '""', $value);
$value = '"' . $value . '"' . "\t";
}   
$line .= $value;

}
$data .= trim($line). "\n";
}
$data = str_replace("\r", "", $data);
   
if ($data =="") {

$data ="\n(0) Records Found!\n";
}
   
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; 
filename=Export.".$exportdate.".xls");

header("Pragma: no-cache");
header("Expires: 0");
   
   
   
print "$header\n$data";


Once you've printed out the report, you should probably exit so nothing 
else is processed from the script.



}

?>

I am calling the function like so: "excelexportfunc($select, $sortOrder, 
$exportdate);"


the $select is specified in an IF statement on the calling page like so:

if($exportoption =="all"){
$sortOrder= $_SESSION['order'];
$search = "";
$select = "SELECT * FROM ".$table." order by ".$sortOrder."";

}else{

$sortOrder = $_SESSION['order'];
$search = $_SESSION['search'];
$select = "SELECT * FROM ".$table." WHERE FName like 
'%".$search."%' or LName like '%".$search."%' or Add1 like 
'%".$search."%' or Add2 like '%".$search."%' or City like 
'%".$search."%' or State like '%".$search."%' or Zip like 
'%".$search."%' or XCode like '%".$search."%' order by ".$sortOrder."";

}


$sortOrder is now part of $select you don't need to pass it to the 
function unless you actually use it in that function (which from your 
copy/paste isn't the case).



So your function can just be:

function excelexportfunc($select, $exportdate) {

and remove the $sortOrder from the calling lines:

excelexportfunc($select, $exportdate);

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

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



Re: [PHP] Another question about functions...

2008-01-29 Thread Nathan Nobbe
On Jan 29, 2008 3:53 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:

> I did as you suggested, and I think I found the reason... I included info
> for the doctype, and some files that are on all my pages... Once I comment
> out those lines it works just fine...
> I'm assuming that that is expected behavior?
>

where did you include this information?
i didnt see it in the original code you posted.
and, btw. im no expert on setting mime types for excel :)

-nathan


Re: [PHP] Another question about functions...

2008-01-29 Thread Jason Pruim


On Jan 29, 2008, at 2:46 PM, Nathan Nobbe wrote:


On Jan 29, 2008 2:39 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:
Okay, so I checked everything I can think of, and it's still
downloading it as an application which means it's downloading the
entire website instead of just the data from the database... Anyone
have any idea what to check?

im guessing youre trying to hit the invocation of excelexportfunc(),  
as
it sits in your existing script.  create a simple test script that  
does nothing
else but invoke the excelexportfunc() function.  you can pass  
variables to
it from the url, or hardcode them if you like; id probly hardcode  
them at first.




that *should* get you the results youre looking for.  from there you  
need to
determine why the method isnt working in the context of your  
existing script.


-nathan




Hey Nathan,

I did as you suggested, and I think I found the reason... I included  
info for the doctype, and some files that are on all my pages... Once  
I comment out those lines it works just fine...


I'm assuming that that is expected behavior?


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]




Re: [PHP] Another question about functions...

2008-01-29 Thread Nathan Nobbe
On Jan 29, 2008 2:39 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:

> Okay, so I checked everything I can think of, and it's still
> downloading it as an application which means it's downloading the
> entire website instead of just the data from the database... Anyone
> have any idea what to check?


im guessing youre trying to hit the invocation of excelexportfunc(), as
it sits in your existing script.  create a simple test script that does
nothing
else but invoke the excelexportfunc() function.  you can pass variables to
it from the url, or hardcode them if you like; id probly hardcode them at
first.



that *should* get you the results youre looking for.  from there you need to
determine why the method isnt working in the context of your existing
script.

-nathan


Re: [PHP] Another question about functions...

2008-01-29 Thread Jason Pruim


On Jan 29, 2008, at 11:58 AM, Jason Pruim wrote:



On Jan 29, 2008, at 11:48 AM, Nathan Nobbe wrote:


On Jan 29, 2008 11:07 AM, Jason Pruim <[EMAIL PROTECTED]> wrote:
What's happening is, I have the code set and it downloads the file
into excel, but it doesn't have the database fields in it, rather a
copy of the entire webpage which it trys to put into excel.

this sounds to me like you may not be linking to the code that  
generates
the excel spreadsheet properly.  this is just a hunch, but to test  
it, you
might try pointing your browser directly at the script that  
generates the
excel spreadsheet, rather than navigating to it via a link you have  
on your

current page.
as far as the data not showing up in the output, try experimenting by
omitting the header() calls and just dump out the result set of the  
query

to ensure the data is actually getting populated in your function.

-nathan


Well, I commented out the header lines and just printed the data to  
the browser, and it fills it all in perfectly. So I think you are  
right about not calling it right... I'll do some more checking on  
that, back to the $salt farms I go! :)



Okay, so I checked everything I can think of, and it's still  
downloading it as an application which means it's downloading the  
entire website instead of just the data from the database... Anyone  
have any idea what to check?



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] Another question about functions...

2008-01-29 Thread Jason Pruim


On Jan 29, 2008, at 11:48 AM, Nathan Nobbe wrote:


On Jan 29, 2008 11:07 AM, Jason Pruim <[EMAIL PROTECTED]> wrote:
What's happening is, I have the code set and it downloads the file
into excel, but it doesn't have the database fields in it, rather a
copy of the entire webpage which it trys to put into excel.

this sounds to me like you may not be linking to the code that  
generates
the excel spreadsheet properly.  this is just a hunch, but to test  
it, you
might try pointing your browser directly at the script that  
generates the
excel spreadsheet, rather than navigating to it via a link you have  
on your

current page.
as far as the data not showing up in the output, try experimenting by
omitting the header() calls and just dump out the result set of the  
query

to ensure the data is actually getting populated in your function.

-nathan


Well, I commented out the header lines and just printed the data to  
the browser, and it fills it all in perfectly. So I think you are  
right about not calling it right... I'll do some more checking on  
that, back to the $salt farms I go! :)




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]




Re: [PHP] Another question about functions...

2008-01-29 Thread Nathan Nobbe
On Jan 29, 2008 11:07 AM, Jason Pruim <[EMAIL PROTECTED]> wrote:

> What's happening is, I have the code set and it downloads the file
> into excel, but it doesn't have the database fields in it, rather a
> copy of the entire webpage which it trys to put into excel.


this sounds to me like you may not be linking to the code that generates
the excel spreadsheet properly.  this is just a hunch, but to test it, you
might try pointing your browser directly at the script that generates the
excel spreadsheet, rather than navigating to it via a link you have on your
current page.
as far as the data not showing up in the output, try experimenting by
omitting the header() calls and just dump out the result set of the query
to ensure the data is actually getting populated in your function.

-nathan


Re: [PHP] Another form handling posting question

2007-12-07 Thread tedd

At 9:52 PM -0500 12/6/07, Daniel Brown wrote:

On Dec 6, 2007 9:49 PM, tedd <[EMAIL PROTECTED]> wrote:
 > My technical side is like Swiss cheese -- you never know what holes I

 don't know and can be surprised at what I do.


Keep your replies on-list, old man!  ;-P

I know others enjoy your wit as much as I do!


Yeah, but you're assuming that I wanted to display my ignorance openly.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread Daniel Brown
On Dec 6, 2007 10:31 PM, Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Thu, 2007-12-06 at 21:52 -0500, Daniel Brown wrote:
> > > Duh!
> > >
> > > That's like telling everyone to use the shower-head to water-pic your
> > > teeth as Vana White did -- like obvious!
>
> Am I getting old if I remember that clip on TV? :B

Yes

 but at least you're in good company.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread Robert Cummings
On Thu, 2007-12-06 at 21:52 -0500, Daniel Brown wrote:
> On Dec 6, 2007 9:49 PM, tedd <[EMAIL PROTECTED]> wrote:
> > >On Dec 6, 2007 9:10 PM, tedd <[EMAIL PROTECTED]> wrote:
> > >
> > >>  Also, I recently noticed that FF will add text to a Submit button
> > >>if you don't.
> > >
> > > Actually, Tedd, even second-generation browsers (e.g. - Internet
> > >Exploder 2.x, Netscape Navigator 2.x, et cetera) would add the text
> > >"Submit Query" to a button if there was no ``value="Something"``
> > >included in the tag.
> >
> > Duh!
> >
> > That's like telling everyone to use the shower-head to water-pic your
> > teeth as Vana White did -- like obvious!

Am I getting old if I remember that clip on TV? :B

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread Daniel Brown
On Dec 6, 2007 9:49 PM, tedd <[EMAIL PROTECTED]> wrote:
> >On Dec 6, 2007 9:10 PM, tedd <[EMAIL PROTECTED]> wrote:
> >
> >>  Also, I recently noticed that FF will add text to a Submit button
> >>if you don't.
> >
> > Actually, Tedd, even second-generation browsers (e.g. - Internet
> >Exploder 2.x, Netscape Navigator 2.x, et cetera) would add the text
> >"Submit Query" to a button if there was no ``value="Something"``
> >included in the tag.
>
> Duh!
>
> That's like telling everyone to use the shower-head to water-pic your
> teeth as Vana White did -- like obvious!
>
> Oh well, I never said I was smart -- I just said I recently saw it.
> But, in my defense, I have always done it right so I never saw it
> until I ran someone one else's code that did it wrong.
>
> My technical side is like Swiss cheese -- you never know what holes I
> don't know and can be surprised at what I do.


Keep your replies on-list, old man!  ;-P

I know others enjoy your wit as much as I do!

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread Daniel Brown
On Dec 6, 2007 9:10 PM, tedd <[EMAIL PROTECTED]> wrote:

> Also, I recently noticed that FF will add text to a Submit button if you 
> don't.

Actually, Tedd, even second-generation browsers (e.g. - Internet
Exploder 2.x, Netscape Navigator 2.x, et cetera) would add the text
"Submit Query" to a button if there was no ``value="Something"``
included in the tag.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread tedd

At 9:02 PM -0500 12/6/07, Robert Cummings wrote:

On Thu, 2007-12-06 at 13:02 -0500, tedd wrote:

 >
 > 




Not to critique your form logic itself, but IMHE it is much better to
name the submit button "continue" and not "submit". Some browsers, maybe
all (I can't remember), screw things up when you try to do form.submit()
in JavaScript if there is a field called submit.

Cheers,
Rob.


Rob

As always, you are right. I wasn't thinking about js.

Also, I recently noticed that FF will add text to a Submit button if you don't.

There are lot's of things to remember here.

Thanks,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread Robert Cummings
On Thu, 2007-12-06 at 13:02 -0500, tedd wrote: 
> At 10:36 PM -0700 12/5/07, Mike Smith wrote:
> >I am trying to recursively send data to the same form.
> >
> >-snip-
> >
> >What is the best practice for doing this?
> >
> 
> I don't know what the "best" practice is, but this is the way I do it.
> 
> In the form I have a hidden field called step that controls flow via POST..
> 
> Based upon that value, I use a switch to direct the flow to different 
> forms -- all the forms have the same submit button.
> 
> So, it looks like this (pseudo-code):
> 
> $step = isset($_POST['step']) ? $_POST['step'] : 1;
> 
> 
> 
> switch $step
>{
>case 1:
>// present the form for step 1
>
> 
>case 2:
>// present the form for step 2
>
> 
>case 3:
>// present the form for step 3
>}
> 
> 
> 
> That way, it's simple to recursively change a form to gather information.
> 
> If you want to keep/store data in each gather, then either save it to 
> a dB or do sessions.
> 
> It works for me.

Not to critique your form logic itself, but IMHE it is much better to
name the submit button "continue" and not "submit". Some browsers, maybe
all (I can't remember), screw things up when you try to do form.submit()
in JavaScript if there is a field called submit.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread tedd

At 10:36 PM -0700 12/5/07, Mike Smith wrote:

I am trying to recursively send data to the same form.

-snip-

What is the best practice for doing this?



I don't know what the "best" practice is, but this is the way I do it.

In the form I have a hidden field called step that controls flow via POST..

Based upon that value, I use a switch to direct the flow to different 
forms -- all the forms have the same submit button.


So, it looks like this (pseudo-code):

$step = isset($_POST['step']) ? $_POST['step'] : 1;



switch $step
  {
  case 1:
  // present the form for step 1
  

  case 2:
  // present the form for step 2
  

  case 3:
  // present the form for step 3
  }



That way, it's simple to recursively change a form to gather information.

If you want to keep/store data in each gather, then either save it to 
a dB or do sessions.


It works for me.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



  1   2   3   4   >