[PHP] Re: Why?

2002-03-31 Thread Ernesto

Alberto Wagner wrote:
 Why everyone uses $foo or $foobar as examples?




foo
/foo/ 1. interj. Term of disgust. 2 [very common] Used very generally as a
sample name for absolutely everything, esp. programs and files (esp. scratch
files). 3. First on the list of metasyntactic variables used in syntax
examples. See also bar, baz, gux, guux, corge, grault, garply, waldo, fred,
plugh, xyzzy, thud.
When 'foo' is used in connection with 'bar' it has generally traced to the
WWII-era Army slang acronym FUBAR ('Fucked Up Beyond All Repair'), later
modified to foobar. Early versions of the Jargon File interpreted this
change as post-war bowdlerization, but it now seems more likely that FUBAR
was itself a derivative of 'foo' perhaps influenced by German 'furchtbar'
(terrible) - 'foobar' may actually have been the original form.
For, it seems, the world 'foo' itself had an immediate prewar history in
comic strips and cartoons. The earlies documented uses were in the Smokey
Stover comic strip popular in the 1930s, which frequently included the word
'foo'. Bill Holman, the author of the strip, filled it with off jokes and
personal contrivances, including other nonsense phrases such as Notary
Sojac and 1506 nix nix. According to the Warner Brothers Cartoon
Companion Holman claimed to have found the word 'foo' on the bottom of a
chinese figurine. This is plausible; chinese statuettes often have
apotropaic inscriptions, and this may have been the chinese word 'fu'
(sometimes transliterated 'foo'), which can mean happiness when spoken
with the proper tone (the lion-dog guardians flanking the steps of many
chinese restaurants are properly called 'fu dogs'). English speakers'
reception of Holman's 'foo' nonsense word was undoubtely influenced by
Yiddish 'feh' and english 'fooey' and 'fool'.
... (etc.)

(From Babylon Translator).

Michael Kimsal [EMAIL PROTECTED] escribió en el mensaje
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Alberto Wagner wrote:
  Why everyone uses $foo or $foobar as examples?
 
 
 

 Why not?  They are relatively benign words that are simply to
 type and aren't terribly language centric.

 $moo and $moocow would work just as well, or $asdf or $qwerty
 or others.

 As far as I know, they have no specific connotation,
 but they've been used as placement holder names since
 at least the early 80's when I started programming.



 Michael Kimsal
 http://www.phphelpdesk.com
 PHP support when you need it
 734-480-9961




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




[PHP] Re: Any easy way to go from MySQL Dates to PHP dates?

2002-03-31 Thread Ernesto


Use strtotime().

$result = mysql_query(SELECT datefield FROM mytable);
$row = mysql_fetch_array($result);
$datevar=strtotime($row['datefield']);
echo date('m-d-Y', $datevar);

Regards,

David Johansen [EMAIL PROTECTED] wrote:
 I was just wondering if there's any way to work with dates returned from a
 MySQL query in PHP. Right now I do all of different stuff in my MySQL
query
 but it's really cumbersome, so I would like to be able to do it all with
 PHP. Is there any way to do that? Thanks,
 Dave

 Here's my MySQL query:

 $result = mysql_query(SELECT *, WEEKDAY(time0_name) AS day,
 DATE_FORMAT(time0_name,'%m/%d/%y') AS print_date, DATE_FORMAT(time0_name,
 '%l:%i %p') AS begin_time0, DATE_FORMAT(DATE_ADD(time0_name, INTERVAL 2
 HOUR), '%l:%i %p') AS end_time0, DATE_FORMAT(time1_name, '%l:%i %p') AS
 begin_time1, DATE_FORMAT(DATE_ADD(time1_name, INTERVAL 2 HOUR), '%l:%i
%p')
 AS end_time1, DATE_FORMAT(time2_name, '%l:%i %p') AS begin_time2,
 DATE_FORMAT(DATE_ADD(time2_name, INTERVAL 2 HOUR), '%l:%i %p') AS
end_time2,
 DATE_FORMAT(time3_name, '%l:%i %p') AS begin_time3,
 DATE_FORMAT(DATE_ADD(time3_name, INTERVAL 2 HOUR), '%l:%i %p') AS
end_time3,
 DATE_FORMAT(time4_name, '%l:%i %p') AS begin_time4,
 DATE_FORMAT(DATE_ADD(time4_name, INTERVAL 2 HOUR), '%l:%i %p') AS
end_time4,
 DATE_FORMAT(time5_name, '%l:%i %p') AS begin_time5,
 DATE_FORMAT(DATE_ADD(time5_name, INTERVAL 2 HOUR), '%l:%i %p') AS
end_time5
 FROM pickup_times,$dbh);

 I could do it a lot easier if in PHP I think, so I was just wondering if
 anyone could point me to a thing that talked about converting MySQL
DATETIME
 to PHP date stuff.





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




[PHP] Undefined variables

2002-03-30 Thread Ernesto

Hi, newbie here.

I was erroneously using error_reporting=E_ALL ~E_NOTICE on my debug
server.
Now, I changed it to error_reporting=E_ALL and I can see lots of warnings
about using undefined variables.
So, if I don't want to see warnings all over the place, I have to check
every variable with isset() before I use it.
Is it necesary that I do this all the time? Why can't I trust on the
emptiness of uninitialized variables?
I'm using register_globals=Off, so there should be no problem with that.

I know it's a good practice to declare and initialize all variables, but I
need my scripts to run as fast as they can (and I'm too lazy to check every
variable before I use it, too :-)

So... do I have any choice?

Regards,
Ernesto




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




[PHP] Evaluating code

2002-03-06 Thread Ernesto


Hi,

I have code stored on a server which I retrieve via fsockopen() and put it 
into a variable (It's like if it were on a database).
Now, I want to eval that code, but eval() won't work because it has HTML 
and PHP mixed, with ?php ? and everything.

I know I can eval this code saving it to a file and then including it, but 
I want to know if there's a better way.
As I'm going to do this all the time, I prefer not to create temporary 
files (so I don't slow down everything).

Any ideas?

Thanks in advance,
Ernesto


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




[PHP] How to format ODBC dates

2001-12-12 Thread Ernesto


Hi,

Obviously this is somewhere in the FM, which I've (almost) read, but I 
can't find an answer to:

How do I convert a string containing an ODBC date (-MM-DD HH:MM:SS) 
to a date variable, which I can format usging date()?

Thanks in advance,
Ernesto


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Strange bug

2001-12-05 Thread Ernesto


Hi,

I was having some problems with my PHP files (the first 3 HTML lines 
missing and Netscape trying to save the page to disk instead of showing it).

So, I telnet'd my web server and manually issued a GET as follows:

GET /anglers/index.php HTTP/1.1

And this was the response:

HTTP/1.0 200 OK
Date: Tue, 04 Dec 2001 21:09:57 GMT
Server: WebSitePro/2.4.9
Accept-ranges: bytes
!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//ES
!-- Copyright ® 1999-2001 Jogua Web Solutions v3.0 --
!-- BOF: default.inc 2001-12-04 18:09:57 --

html
head
titleAnglers Aventuras \ Inicio/title
etc. etc...

Note the CRLFs missing after the headers :-/
So the browser -naturally- understand those HTML remarks as being part 
of the header, and the HTML starting after those two CRLF I have in my 
HTML file.

I know I can fix this just typing two CRLFs at the very beggining of 
my PHP file, but I'm not supposed to do that. And even if I do that, the 
header is still incomplete (i.e. mime type missing).

This happens with 2 different servers, both running WebSite Pro 2.4 and 
PHP 4.0.6 (one Windows 2000 Advanced Server and the other Windows XP Pro).

Is this a PHP bug, a WebSite bug or my code?
I don't think I screwed something up because I'm not playing with the 
headers here.

Any ideas?

Regards,
Ernesto


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Is this the expected behavior?

2001-12-04 Thread Ernesto


Hi,

I was having some problems with my PHP files (the first 3 HTML lines 
missing and Netscape trying to save the page to disk instead of showing it).

So, I telnet'd my web server and manually issued a GET as follows:

GET /anglers/index.php HTTP/1.1

And this was the response:

HTTP/1.0 200 OK
Date: Tue, 04 Dec 2001 21:09:57 GMT
Server: WebSitePro/2.4.9
Accept-ranges: bytes
!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//ES
!-- Copyright ® 1999-2001 Jogua Web Solutions v3.0 --
!-- BOF: default.inc 2001-12-04 18:09:57 --

html
head
titleAnglers Aventuras \ Inicio/title
etc. etc...

Note the CRLFs missing after the headers :-/
So the browser -naturally- understand those HTML remarks as being part 
of the header, and the HTML starting after those two CRLF I have in my 
HTML file.

I know I can fix this just typing two CRLFs at the very beggining of 
my PHP file, but I'm not supposed to do that. And even if I do that, the 
header is still incomplete (i.e. mime type missing).

Is this a know bug, an unknown bug or my code?
I don't think I screwed something up because I'm not playing with the 
headers here.

This happens with 2 different servers, both running WebSite Pro 2.4 and 
PHP 4.0.6 (one Windows 2000 Advanced Server and the other Windows XP Pro).

The only thing strange with my code is that I use many nested inclusions 
(not recursion, just including a file in an included file wich at it's 
time is included in another, etc.).

Regards,
Ernesto


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Serial Port Programing

2001-11-13 Thread Ernesto


Brian C. Doyle wrote:

 Hello all,
 
 Does PHP have the ability to control a serial port?  I see we can use 
 the Printer but that was All I saw.
 
 
 

I guess you may fopen COM1: or COM2:
You should be able to fopen PRN: or LPT1: as well.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] $QUERY_STRING

2001-11-13 Thread Ernesto


Hi,

I'm a newbie using Apache 1.3.22 and PHP 4.0.6 on Windows.
I'm trying to access the $QUERY_STRING var, but it's empty even when I 
do have a query string. On one server (Win2K), it works ok. On the other 
server (WinXP) it's always empty.
If I use index.php?s=1, $HTTP_GET_VARS['s'] is 1, but I need the raw 
query string because it's something like index.php?1.

Is this a known bug on PHP/WinXP?

Regards,
Ernesto


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: $QUERY_STRING

2001-11-13 Thread Ernesto


Nop. getenv(QUERY_STRING) also returns an empty string.
The crazy thing is that getenv returns an empty string instead of FALSE.
Anyway, if I do index.php?a=1, I get HTTP_GET_VARS['a']==1, but 
$QUERY_STRING is still empty :(


dav wrote:

 Try getenv() function to import the query string from apache ambient.
 This is not a bug, maybe the index.php?1 isn't standard at all.

 Ernesto [EMAIL PROTECTED] ha scritto nel messaggio
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
Hi,

I'm a newbie using Apache 1.3.22 and PHP 4.0.6 on Windows.
I'm trying to access the $QUERY_STRING var, but it's empty even when I
do have a query string. On one server (Win2K), it works ok. On the other
server (WinXP) it's always empty.
If I use index.php?s=1, $HTTP_GET_VARS['s'] is 1, but I need the raw
query string because it's something like index.php?1.

Is this a known bug on PHP/WinXP?

Regards,
Ernesto


 
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] odbc_free_result

2001-11-09 Thread Ernesto


Hi,

I'm a newbie and I'm currently porting a system coded in another language 
to PHP4.
Here's a question about the internals of PHP:

The manual states that it's not necesary to do odbc_free_result() because 
PHP will free all used resources upong script completion. Ok, but what if I 
reuse (overwrite) the ODBC result identifier like this:

 $ex=odbc_exec($jg_difolt, SELECT ...);
 
 //Here... I don't free the resource
 $ex=odbc_exec($jg_difolt, SELECT ...);
 
 //Now... I free the resource...
 odbc_free_result($ex);

I guess both resources are freed, but I just want to make sure because I do 
this all the time (because the old code I'm porting does it (because it's 
ok to do it in _that_ language) (and I'm too lazy to rework it)).

Thanks in advance.

Regards,
Ernesto


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Server redirection

2001-11-09 Thread Ernesto


Hi there... newbie here!

How do I do server-side redirection?
I want to redirect the user to another URL without using javascript.

Regards,
Ernesto


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]