OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 14 Apr 2006 12:14:13 -0000 Issue 4071

php-general-digest-helplists.php.net
Date: Fri Apr 14 2006 - 07:14:13 CDT


php-general Digest 14 Apr 2006 12:14:13 -0000 Issue 4071

Topics (messages 233937 through 233983):

Re: interview
        233937 by: Jochem Maas
        233938 by: Chrome
        233939 by: John Nichel
        233941 by: Ahmed Saad
        233946 by: Richard Lynch
        233949 by: Richard Lynch
        233950 by: Richard Lynch
        233958 by: Jochem Maas

Re: how should MS Access DATETIME be handled in PHP?
        233940 by: Bing Du
        233947 by: Richard Lynch

Beginner Help - Array
        233942 by: P. Guethlein
        233960 by: chris smith

serialize() function
        233943 by: Nicholas Couloute
        233944 by: Jochem Maas
        233945 by: Jochem Maas
        233954 by: tedd
        233957 by: Jochem Maas
        233962 by: Robert Cummings
        233965 by: Jochem Maas
        233970 by: Richard Lynch
        233973 by: Richard K Miller

Join - Two Columns with the same name
        233948 by: Kevin Murphy
        233951 by: Jochem Maas
        233953 by: Warren Vail

Re: CURLOPT_BINARYTRANSFER [SOLVED]
        233952 by: Richard Lynch

Text database instead of MySql (Recommendations / Advise also welcome)
        233955 by: Ryan A
        233956 by: chris smith
        233961 by: Ryan A
        233963 by: Jochem Maas
        233966 by: Ryan A
        233967 by: Richard Lynch
        233968 by: Ryan A
        233969 by: Richard Lynch
        233975 by: Ryan A

Re: Problems creating images
        233959 by: Richard Lynch
        233964 by: Richard Lynch

Re: Failed MySQL queries
        233971 by: Richard Lynch

Re: Sessions and Frames
        233972 by: Richard Lynch

Dates before 1970
        233974 by: Suhas
        233979 by: Rasmus Lerdorf
        233980 by: Suhas
        233982 by: chris smith

Sessions Issues With 2 Instances On Same Server
        233976 by: Mark Sargent
        233981 by: chris smith

PHP Post & forms
        233977 by: Gary E. Terry
        233978 by: Stephen Johnson

unicode
        233983 by: suresh kumar

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Anthony Ettinger wrote:
> if PHP could PHP a PHP page, how much PHP would a PHP page take to PHP
> a PHP page?

dunno. but it's sounds like a Pretty Hard Problem to solve. :-)
I just envisaging the guy to be interviewed reading this list right now ...
we should run a sweepstake on whether he bothers to turn up. ;-)

>
>
>
> On 4/13/06, Ryan A <Ryancoinpass.com> wrote:
>
>>If a coal cart could cart coal, how much coal would a coal cart cart... if a
>>coal cart could cart coal?
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>
>
>
> --
> Anthony Ettinger
> Signature: http://chovy.dyndns.org/hcard.html
>

attached mail follows:


[snip]
How would you like it if someone who didn't have a clue as to your
expertise, interviewed you and then judged you as to what you know?
[/snip]

Like upper management? ;)

Dan

 
-------------------
http://chrome.me.uk
 
-----Original Message-----
From: tedd [mailto:teddsperling.com]
Sent: 13 April 2006 19:49
To: Mad Unix; php-generallists.php.net
Subject: Re: [PHP] interview

At 5:21 PM +0200 4/13/06, Mad Unix wrote:
>can you please send some interview questions for php
>i have in few days to inteview some people.
>
>
>--
>madunix

<no offense meant>

If you know php, why are you asking us do your work for you?

else

What are you doing interviewing someone for a php position?

How would you like it if someone who didn't have a clue as to your
expertise, interviewed you and then judged you as to what you know?

I took an interview one time where the interviewer had better things
to do and sent in two teenagers to interview me. First, they didn't
have a * clue as to what I was about nor what I could offer the
company; Second, I had underwear older than them so they weren't too
savvy in interview techniques.

A week after the interview, I received a letter from the company
telling me that I didn't have the qualifications they were looking
for. Less than two years later the company folded -- no surprise
there huh? Imagine a company having an interviewer who's clueless in
judging the qualifications of an applicant. If I worked for a company
like that, I would be looking for another position.

</no offense meant>

tedd

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

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

__________ NOD32 1.1488 (20060413) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com

attached mail follows:


Chrome wrote:
> [snip]
> How would you like it if someone who didn't have a clue as to your
> expertise, interviewed you and then judged you as to what you know?
> [/snip]
>
> Like upper management? ;)
>

*ding ding ding*

We have a winner!

I love the 'deer in headlights' look our CEO gets when I explain to him
how things work.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


On 4/13/06, Mad Unix <madunixgmail.com> wrote:
> can you please send some interview questions for php
> i have in few days to inteview some people.

Well, a simple goooooogle search could have saved you all this

http://www.google.com/search?q=php+interview+questions

and do NOT try PHP at home! It's highly flammable ;)

/ahmed

attached mail follows:


On Thu, April 13, 2006 2:46 pm, John Nichel wrote:
> Chrome wrote:
>> [snip]
>> How would you like it if someone who didn't have a clue as to your
>> expertise, interviewed you and then judged you as to what you know?
>> [/snip]
>>
>> Like upper management? ;)
>>
>
> *ding ding ding*
>
> We have a winner!
>
> I love the 'deer in headlights' look our CEO gets when I explain to
> him
> how things work.

I made the mistake a couple months ago of explaining AJAX to our CEO,
in such a way that he actually understood it.

He know understands "copy and paste" and "AJAX".

Now, anytime something on a website, any website, is slow, he wants us
to use AJAX on our site to make it seem faster.

Sigh.

When all you understand is a hammer...

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Thu, April 13, 2006 10:21 am, Mad Unix wrote:
> can you please send some interview questions for php
> i have in few days to inteview some people.
>
> --
> madunix
> Communications Engineering (RWTH Aachen University)
> Systems and Network Engineer
> MCSE, IBM AIX System Specialist, CCNP, CCSP(SECUR,CSVPN)

Assuming any of that junk makes you technically competent in the first
place...

Which, frankly, with an MCSE leading them off, I have severe
reservations...

If you don't know PHP, then most of the decent questions we could send
would have such complex answers that you wouldn't be able to compare
the interviewee's answers to ours with any usefulness.

I mean, a "simple" question like "Why should register_globals be
turned off" requires quite a lot of study before you can understand it
well enough to evaluate an answer.

I'd guess ~70% of the readers on this list could not provide a
correct, complete, cogent answer in an interview to the question,
though many would have decent half-formed answers.

You'll simply have to stumble along like everybody else looking at
their portfolio and examining some of their source code and
documentation to see what their work looks like.

Presumably you can spot good code from bad, and see a well-designed
software package and know it from utter junk, and review some
documetation and see if it's at least organized well enough to be
somewhat useful.

If not, you're stuck with looking at how pretty their portfolio is and
looking for buzzwords and big-name clients/employers in the past...

Wow. Considering my own resume and portfolio, that's just a scary
thought on several different levels and going all kinds of different
directions.

It DOES explain a few of the more clueless headhunters and
interviewees I've had, though. :-)

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Thu, April 13, 2006 2:25 pm, Jochem Maas wrote:
> Anthony Ettinger wrote:
>> if PHP could PHP a PHP page, how much PHP would a PHP page take to
>> PHP
>> a PHP page?

One line:

<?php require 'page.php';?>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Richard Lynch wrote:
> On Thu, April 13, 2006 2:25 pm, Jochem Maas wrote:
>
>>Anthony Ettinger wrote:
>>
>>>if PHP could PHP a PHP page, how much PHP would a PHP page take to
>>>PHP
>>>a PHP page?
>
>
> One line:
>
> <?php require 'page.php';?>
>

heh Richard,
now your just showing off ;-)

attached mail follows:


> I expect there's actually several ways, although I'm thinking it's likely
> that none of them is blindingly obvious. Personally, I think I'd be
> inclined to do it like this:
>
> $mth = 9;
> echo date('F', mktime(12,0,0, $mth));
>

Interesting. Thanks a bunch for the tip, Mike. Appreciate it.

Bing

attached mail follows:


On Thu, April 13, 2006 9:30 am, Bing Du wrote:
> $qry = odbtp_query("SELECT end_date,title,projectID FROM projects
> ORDER
> BY end_date DESC");

While all the data-munging in PHP is very interesting...

Might I suggest that you just use MySQL's date_format() function to
ask MySQL to give you the data you want in the first place?

Some purists would claim that the database is not the place to put
presentation logic, of course.

And for a large-scale library where other users might want to skin a
different format, I couldn't agree more.

But, really, for a small project, K.I.S.S. wins out, and having MySQL
just hand you what you want instead of cluttering up your code with
several lines (or a long multi-operation line) of PHP, seems like a
cleaner solution.

Not to mention that you'll have a lot less headaches like this one.

http://mysql.com and search for "date_format"

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


This seems like it should work, but the option statement is just
filling in one line of data....hmmmmm... the names have multiple
territories (ID's), so I want to have one name associated with one
territory ID ( other stuff happens elseware...).

//building list of names and their territory matching ID's
                           while($getidsd = mysql_fetch_array($getidsr)){
                           if ($getidsd['employeeid'] != '990'&&
$getidsd['employeeid'] != '991') {
                        $salespersonsstor= Array("name"=>$getidsd['fname'].'
'.$getidsd['lname'],"idIS"=>$getidsd['employeeid']);
                           }
                                        }
                                
                              asort($salespersonsstor);
                              $salesmanactive='';
                              $salesmann='';
                              $ID1='';

                              foreach ($salespersonsstor as $key =>
$TheSalesManID) {
                                  switch ($key) {
                                 case "name":
                                  $salesmann = $TheSalesManID;
                                 break;
                                 case "idIS":
                                  $ID1 = $TheSalesManID;
                                           }

                                If (($salesmann != '' && $ID1 != '')
&& ($salesmanactive != $salesmann)) {
                                  echo '<option
value="'.$ID1.'">'.$salesmann.'</option>';
                                  $salesmanactive=$salesmann;
                                  $salesmann='';
                                  $ID1='';
                                  }
                                }

attached mail follows:


On 4/14/06, P. Guethlein <petergdeltronix.com> wrote:
> This seems like it should work, but the option statement is just
> filling in one line of data....hmmmmm... the names have multiple
> territories (ID's), so I want to have one name associated with one
> territory ID ( other stuff happens elseware...).
>
> //building list of names and their territory matching ID's
> while($getidsd = mysql_fetch_array($getidsr)){
> if ($getidsd['employeeid'] != '990'&&
> $getidsd['employeeid'] != '991') {
> $salespersonsstor= Array("name"=>$getidsd['fname'].'
> '.$getidsd['lname'],"idIS"=>$getidsd['employeeid']);
> }
> }

You're always overwriting the array here. PHP arrays can't have
duplicate keys, so it's doing:

name -> $getidsd['fname'];

next time it gets a row, it's overwriting it.

If you do something like this:

 $salespersonsstor[] = Array("name"=>$getidsd['fname'].'
'.$getidsd['lname'],"idIS"=>$getidsd['employeeid']);

it will add to the array (notice the square brackets).

Do a print_r or var_dump after your loop so you understand how the
array is put together and how you can then use it.

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

attached mail follows:


Are there any tutorials and uses for serialize() ? I went to php.net and
it isn't well documented as I would hope!
~Nick Couloute
co-owner/Web Designer
Sidekick2Music.Com

attached mail follows:


Nicholas Couloute wrote:
> Are there any tutorials and uses for serialize() ? I went to php.net and
> it isn't well documented as I would hope!

<?php

$o = new StdObject;
$a = array();
$i = 1;
$b = false;

echo serialize($o),"\n",
      serialize($a),"\n",
      serialize($i),"\n",
      serialize($b),"\n",
      serialize(array("A"=>$o,"B"=>$a,"C"=>$i,"D"=>$b)),"\n",

?>

... and yes there are uses for it. what do you want to do?

> ~Nick Couloute
> co-owner/Web Designer
> Sidekick2Music.Com
>

attached mail follows:


Nicholas Couloute wrote:
> I was thinking of a news system with comments.
>

fine. but what's that got to do with serialize() per se?
or put another don't look at a function decide it might be
useful and then force yourself to build an application with it....

cart before the horse and all that.

> On Thu, 13 Apr 2006 6:04 pm, Jochem Maas wrote:
>
>>
>> Nicholas Couloute wrote:
>>
>>> Are there any tutorials and uses for serialize() ? I went to php.net
>>> and it isn't well documented as I would hope!
>>
>>
>> <?php
>>
>> $o = new StdObject;
>> $a = array();
>> $i = 1;
>> $b = false;
>>
>> echo serialize($o),"\n",
>> serialize($a),"\n",
>> serialize($i),"\n",
>> serialize($b),"\n",
>> serialize(array("A"=>$o,"B"=>$a,"C"=>$i,"D"=>$b)),"\n",
>>
>> ?>
>>
>> ... and yes there are uses for it. what do you want to do?
>>
>>
>>> ~Nick Couloute
>>> co-owner/Web Designer
>>> Sidekick2Music.Com
>>>
> ~Nick Couloute
> co-owner/Web Designer
> Sidekick2Music.Com

attached mail follows:


At 12:04 AM +0200 4/14/06, Jochem Maas wrote:
>Nicholas Couloute wrote:
>>Are there any tutorials and uses for serialize() ? I went to
>>php.net and it isn't well documented as I would hope!
>
><?php
>
>$o = new StdObject;
>$a = array();
>$i = 1;
>$b = false;
>
>echo serialize($o),"\n",
> serialize($a),"\n",
> serialize($i),"\n",
> serialize($b),"\n",
> serialize(array("A"=>$o,"B"=>$a,"C"=>$i,"D"=>$b)),"\n",
>
>?>
>
>... and yes there are uses for it. what do you want to do?

Jochem:

Not that you don't know -- because I'm sure you do -- but for the
benefit of others.

One example, each domain has a limit of cookies (20) and you can use
them up pretty quickly. However, if you place your data in an array,
you could then serialize the array and save it as one long string
(i.e., the cookie). Then you can read it back from the cookie and
un-serialize it back to the array.

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

attached mail follows:


tedd wrote:
> At 12:04 AM +0200 4/14/06, Jochem Maas wrote:
>
>> Nicholas Couloute wrote:
>>
>>> Are there any tutorials and uses for serialize() ? I went to php.net
>>> and it isn't well documented as I would hope!
>>
>>
>> <?php
>>
>> $o = new StdObject;
>> $a = array();
>> $i = 1;
>> $b = false;
>>
>> echo serialize($o),"\n",
>> serialize($a),"\n",
>> serialize($i),"\n",
>> serialize($b),"\n",
>> serialize(array("A"=>$o,"B"=>$a,"C"=>$i,"D"=>$b)),"\n",
>>
>> ?>
>>
>> ... and yes there are uses for it. what do you want to do?
>
>
> Jochem:
>
> Not that you don't know -- because I'm sure you do -- but for the
> benefit of others.

I don't know jack - just ask Jasper ;-)

>
> One example, each domain has a limit of cookies (20) and you can use

I wasn't aware that there was a hard limit on cookies - I always thought
this was a browser dependent setting ... not that I ever get above
2 cookies max (and mostly just 1 for the session cookie).

> them up pretty quickly. However, if you place your data in an array, you
> could then serialize the array and save it as one long string (i.e., the
> cookie). Then you can read it back from the cookie and un-serialize it
> back to the array.

I'd don't tend to do anything with cookies other than the session cookie and
keep any data in $_SESSION - saves having to cleanse whatever incoming
stuff is in the cookie (storing data on the clientside that is serialized
is can of worms waiting to happen - not that you can't code it safely per se,
it's just that much more to think about)

$_SESSION has another advantage - everything you stick in it is automagically
serialized and unserialized at end/start of the request.

>
> tedd

attached mail follows:


On Thu, 2006-04-13 at 18:58, tedd wrote:
> Not that you don't know -- because I'm sure you do -- but for the
> benefit of others.
>
> One example, each domain has a limit of cookies (20) and you can use
> them up pretty quickly. However, if you place your data in an array,
> you could then serialize the array and save it as one long string
> (i.e., the cookie). Then you can read it back from the cookie and
> un-serialize it back to the array.

Except for extremely rare cases you should never need more than 2
cookies for a domain. Rather than saving every data field into a cookie,
save a single unique ID into the user's cookie, and use that to look
into your database. Now you can store zillions of fields and any size
you want.

So that's one, what's the other? Well you can do a persistent cookie
also so that you can remember them when they return :)

If you're going to store data on the the clients computer, you're going
to have to security check every piece of data you saved there before
every use. At least when the data is only linked by a unique key, you
only ever have to validate the unique key.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Robert Cummings wrote:
> On Thu, 2006-04-13 at 18:58, tedd wrote:
>
>>Not that you don't know -- because I'm sure you do -- but for the
>>benefit of others.
>>
>>One example, each domain has a limit of cookies (20) and you can use
>>them up pretty quickly. However, if you place your data in an array,
>>you could then serialize the array and save it as one long string
>>(i.e., the cookie). Then you can read it back from the cookie and
>>un-serialize it back to the array.
>
>
> Except for extremely rare cases you should never need more than 2
> cookies for a domain. Rather than saving every data field into a cookie,
> save a single unique ID into the user's cookie, and use that to look
> into your database. Now you can store zillions of fields and any size
> you want.
>
> So that's one, what's the other? Well you can do a persistent cookie
> also so that you can remember them when they return :)
>
> If you're going to store data on the the clients computer, you're going
> to have to security check every piece of data you saved there before
> every use. At least when the data is only linked by a unique key, you
> only ever have to validate the unique key.

amen.

>
> Cheers,
> Rob.

attached mail follows:


On Thu, April 13, 2006 7:03 pm, Jochem Maas wrote:
>> One example, each domain has a limit of cookies (20) and you can use
>
> I wasn't aware that there was a hard limit on cookies - I always
> thought
> this was a browser dependent setting ... not that I ever get above
> 2 cookies max (and mostly just 1 for the session cookie).

Not only are browsers free to ignore more than X cookies they are also
allowed to purge anything more than Y bytes in the cookies from any
given domain.

[nb]
You really should read the original Netscape Cookie spec -- it's short
and clear and concise, and possibly one of the best-written specs out
there, in some ways.
[/nb]

So I would never recommend serializing a bunch of data to get it all
into one cookie. imho.

Better to give the browser ONE cookie and use that to track everything
else on the server in a session.

This also matters for bandwidth -- It would do Google no good at all
to trim down their homepage to the Nth degree like they do, if they
sent an extra 100K of coookie data back and forth all the time.

Remember:
Whatever you SEND in the Cookie, the browser has to send BACK on every
page hit, every image hit, the CSS, the javascript requests, all of
them, to the same domain.

Serialized data is seldom "small" so even a handful of datastructures
being sent back by the browser on every request could add up quickly.

The user has to wait for that data to get to your server, after all,
before they can even BEGIN to get your content back.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


There's nothing special about the data returned by serialize() except
that it can be safely written saved, transmitted, etc. To do
anything useful with it you have to unserialize() it. The cool part
about it is that you can serialize any data structure, like an entire
array or object.

The Yahoo Developer center (ever friendly to PHP developers) talks
about how their APIs can return serialized data for PHP:

http://developer.yahoo.com/common/phpserial.html

For example, use can use the Yahoo Search API to search for
"Seinfeld", unserialize the results, and have a beautiful array to use:

print_r(unserialize(file_get_contents("http://api.search.yahoo.com/
WebSearchService/V1/webSearch?
appid=YahooDemo&query=Seinfeld&results=3&output=php")));

(It's almost like making SOAP out of a REST call.)

Richard

On Apr 13, 2006, at 3:53 PM, Nicholas Couloute wrote:

> Are there any tutorials and uses for serialize() ? I went to
> php.net and it isn't well documented as I would hope!
> ~Nick Couloute
> co-owner/Web Designer
> Sidekick2Music.Com
>

attached mail follows:


This is probably basic, but I can't seem to find the answer. Is there
a way to specify in a join a specific column when the two tables have
columns with the same name?

Something like:

$row['table1.id'] vs $row['table2.id']

--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326

attached mail follows:


Kevin Murphy wrote:
> This is probably basic, but I can't seem to find the answer. Is there a
> way to specify in a join a specific column when the two tables have
> columns with the same name?
>
> Something like:
>
> $row['table1.id'] vs $row['table2.id']
>

yes. http://dev.mysql.com/doc/ is a good place to starting reading
up on SQL JOIN syntax.

attached mail follows:


Several methods are supported by mysql, here is the one I like,

select * from table1 a, table2 b where a.col1 = b.col1

In this case the a and b are "aliases" of table1 and table2 respectively
and the notation a.col1 and b.col1 refers to column "col1" in table1 and
table2 respectively. You can used the same notation in left and right
joins if you don't want to use the hard join illustrated here. (In a hard
join, if the value in table1 is missing from table2 no row is returned,
even if one exists in table 1).

hope this helps,

Warren Vail

At 03:29 PM 4/13/2006, Kevin Murphy wrote:
>This is probably basic, but I can't seem to find the answer. Is there
>a way to specify in a join a specific column when the two tables have
>columns with the same name?
>
>Something like:
>
>$row['table1.id'] vs $row['table2.id']
>
>--
>Kevin Murphy
>Webmaster: Information and Marketing Services
>Western Nevada Community College
>www.wncc.edu
>775-445-3326
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


On Tue, April 11, 2006 3:56 pm, Richard Lynch wrote:

First, I want to publicly THANK Pierre and Tony2001 for squashing not
one, but *TWO* bugs I managed to stumble across in my latest endeavor.

Their patience with my bumbling through bogus hypotheses and red
herrings in my bug reports should be specially commendated.

Next, I'm pretty sure I know what CURLOPT_BINARYTRANSFER is for, and
am posting a [SOLVED] in case others stumble across this thread.

I have trimmed out all my false conjectures, and left the Truth.

> Can anybody expand on the meaning and correct usage of:
> CURLOPT_BINARYTRANSFER

> [found on the net]
> "That option is not an actual curl option, in fact -- it has something
> to do with PHP's own internals."
>
> [nb]
> Which would go a long way to explaining why I'm not finding
> BINARYTRANSFER documented on the curl site, eh?
> It's strictly a PHP internals thing?
> [/nb]

But does make me wonder why my correct User Contributed Note
encompassing much of the following was nuked...

Oh well. Hopefully those in need find this post.

> #1.
> If you want to get binary data through curl, such as a JPEG/GIF or
> whatever, you need this so PHP will not treat the data as a
> null-terminated string, but will store it as a binary string
> internally.

Note that flip-flopping BINARYTRANSFER from false/true/false... was
(for me, at least, in CLI, at least) triggering a bug which has been
fixed in CVS, so you may have troubles with that unless you upgrade.

The fix is in 5.1 snaps, so I guess it will be in 5.1.3?

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Hey,

I have been asked to make a site that would be pretty high traffic...
problem is, no MySql.

Although i have messed around with php's file and directory commands I have
never really made anything "really big" using them, I always used MySql,
here I dont have that choice as the server itself does not have MySql
installed.

After a bit of seaching on the SEs I found quite a few links to have text
databases and have kind of settled on this one:
PHP Text DB (http://www.c-worker.ch/txtdbapi/index_eng.php)

If anybody has any experience using the above, or would rather recommend
another I would appreciate a reply from you.

As usual; any advise / links would also be appreciated.

Thanks,
Ryan

attached mail follows:


On 4/14/06, Ryan A <Ryanezee.se> wrote:
> Hey,
>
> I have been asked to make a site that would be pretty high traffic...
> problem is, no MySql.
>
> Although i have messed around with php's file and directory commands I have
> never really made anything "really big" using them, I always used MySql,
> here I dont have that choice as the server itself does not have MySql
> installed.
>
> After a bit of seaching on the SEs I found quite a few links to have text
> databases and have kind of settled on this one:
> PHP Text DB (http://www.c-worker.ch/txtdbapi/index_eng.php)
>
> If anybody has any experience using the above, or would rather recommend
> another I would appreciate a reply from you.

A text db is never going to be as fast as a relational db.

Why can't you use a database (I assume there was some sort of
technical reason) ?

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

attached mail follows:


Hey,

> A text db is never going to be as fast as a relational db.

I know ...but I have no choice, no MySql or any other database installed on
the server.

> Why can't you use a database (I assume there was some sort of technical
reason) ?

Load / resources basically, its a bunch of load balanced servers that take
millions of hits per day.

They actually have two types of servers:
The preview servers (which i am allowed to play in) which has php installed
(for a few clients I have to add)
and the content servers which have nothing but static files, no cgi/php and
no DBs of course.

I cant change hosts and I have to work with whats there, I cant ask for
anything to be installed....thats the deal

I thought of doing some fancy hacks with php using includes and text files
etc but in the end I see that I need
a database, or a kind of "database thingy"...hence the text file db.

Thanks,
Ryan

attached mail follows:


Ryan A wrote:
> Hey,
>
> I have been asked to make a site that would be pretty high traffic...

quantify 'high traffic'.

> problem is, no MySql.

you might consider telling the client that the implementation of a high traffic
site should not be constrained from the outset by something as petty as
MySQL not being installed?

but really it's not such a problem if you consider the possibilities of
caching generated output, possibly even using something like Squid in
reverse-proxy-cache mode (or what ever they call it).

then you have things like the APC for caching data/stuff in shared memory
(and caching compiled php files) ... oh and APC kicks ass :-)

and if your on a *nix system don't forget that you have tmpfs, usually
found at /dev/shm - which is ammounts to a RAM disk, i.e. disk IO is pretty
quick ;-)

so plenty of ways of going fast without a DB.

>
> Although i have messed around with php's file and directory commands I have
> never really made anything "really big" using them, I always used MySql,
> here I dont have that choice as the server itself does not have MySql
> installed.
>
> After a bit of seaching on the SEs I found quite a few links to have text
> databases and have kind of settled on this one:
> PHP Text DB (http://www.c-worker.ch/txtdbapi/index_eng.php)

did you consider the sqlite extension already?

>
> If anybody has any experience using the above, or would rather recommend
> another I would appreciate a reply from you.
>
> As usual; any advise / links would also be appreciated.
>
> Thanks,
> Ryan
>

attached mail follows:


Hey,

> A text db is never going to be as fast as a relational db.

I know ...but I have no choice, no MySql or any other database installed on
the server.

> Why can't you use a database (I assume there was some sort of technical
reason) ?

Load / resources basically, its a bunch of load balanced servers that take
millions of hits per day.

They actually have two types of servers:
The preview servers (which i am allowed to play in) which has php installed
(for a few clients I have to add)
and the content servers which have nothing but static files, no cgi/php and
no DBs of course.

I cant change hosts and I have to work with whats there, I cant ask for
anything to be installed....thats the deal

I thought of doing some fancy hacks with php using includes and text files
etc but in the end I see that I need
a database, or a kind of "database thingy"...hence the text file db.

Thanks,
Ryan

attached mail follows:


http://php.net/sqllite

I dunno how well it will do with "high traffic" though...

But at least it will work the same as the MySQL you are familiar with,
for the most part.

It's the same idea as what you are looking at now, but already built
into PHP and ready to rock and roll. :-)

You might just ask the host to install MySQL or switch hosts...

With all due respect to SQLite and the thing you've found, MySQL has
been pounded on a heck of a lot more, and is proven capable of
handling "high volume", in the right hands.

Actually, MySQL has sometimes handled "high volume" quite nicely up to
a point in the totally wrong hands. :-)

I really doubt that you're going to be happy with SQLite or TextDB on
a high volume server, tell you the truth.

On Thu, April 13, 2006 7:07 pm, Ryan A wrote:
> Hey,
>
> I have been asked to make a site that would be pretty high traffic...
> problem is, no MySql.
>
> Although i have messed around with php's file and directory commands I
> have
> never really made anything "really big" using them, I always used
> MySql,
> here I dont have that choice as the server itself does not have MySql
> installed.
>
> After a bit of seaching on the SEs I found quite a few links to have
> text
> databases and have kind of settled on this one:
> PHP Text DB (http://www.c-worker.ch/txtdbapi/index_eng.php)
>
> If anybody has any experience using the above, or would rather
> recommend
> another I would appreciate a reply from you.
>
> As usual; any advise / links would also be appreciated.
>
> Thanks,
> Ryan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Hey,

> quantify 'high traffic'.

Millions of hits per day, hundreds if not thousands of GBs transferred _per
day_
sounds like high traffic? :-D

 -------------------
you might consider telling the client that the implementation of a high
traffic site should not be constrained from the outset by something as petty
as
MySQL not being installed?---------CAnt ask for anything to be installed,
thats the deal.--------------- then you have things like the APC for caching
data/stuff in shared
memory
(and caching compiled php files) ... oh and APC kicks ass :-)...... and if
your on a *nix system don't forget that you have tmpfs, usually
found at /dev/shm - which is ammounts to a RAM disk, i.e. disk IO is
pretty
quick ;-)--------------I dont have access to the whole server...just from
and upwords the public_html folder or in other words the "web folder"> did
you consider the sqlite extension already?Actually no, have heard of it but
have not used it...like I said, very little experience with anything else
other than MySql for my database needs.Cheers,Ryan

attached mail follows:


On Thu, April 13, 2006 7:37 pm, Ryan A wrote:
> Hey,
>
> > A text db is never going to be as fast as a relational db.
>
>
> I know ...but I have no choice, no MySql or any other database
> installed on
> the server.
>
>
>> Why can't you use a database (I assume there was some sort of
>> technical
> reason) ?
>
> Load / resources basically, its a bunch of load balanced servers that
> take
> millions of hits per day.
>
> They actually have two types of servers:
> The preview servers (which i am allowed to play in) which has php
> installed
> (for a few clients I have to add)
> and the content servers which have nothing but static files, no
> cgi/php and
> no DBs of course.
>
> I cant change hosts and I have to work with whats there, I cant ask
> for
> anything to be installed....thats the deal
>
> I thought of doing some fancy hacks with php using includes and text
> files
> etc but in the end I see that I need
> a database, or a kind of "database thingy"...hence the text file db.

You're in for a rough ride...

Quadruple all your time estimates, and start by defining EXACTLY what
your app has to do, and EXACTLY how much data needs to from A to B to
C.

Then start looking for ways to do that efficiently, in theory.

Then build some realistic datasets at 100% size, 10% size, 1% size
and, errr, "tiny" size.

Then start writing tests and benchmarks to test out your theories.

Plus, make sure the tests prove that your results are correct, as well
as fast.

All tests have to run on all sizes of datasets, and only the numbers
from 100% have any real meaning.

If you start typing any PHP code too soon, you'll regret it quickly.

Maybe talk to the client and whomever their admin is to see what they
use in place of database in general, or what they would recommend for
your specific application.

SOMEBODY has set these servers up and (presumably) knows what they are
doing... Use them.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Hey,

> You're in for a rough ride...Yep, sure looks like it.
-----------
Quadruple all your time estimates, and start by defining EXACTLY what
your app has to do, and EXACTLY how much data needs to from A to B to
C.-----------Wise words, have already done most of that, it was very
tempting to start coding immediatly but I have learnt my lessons well there,
never again.

> Then start looking for ways to do that efficiently, in theory.Yep, thats
how i came to this text database thing, and even this will be used very very
VERY sparingly, justfor some (search) select statements and just two tables
with a max of 9 fields each... nothing too fancy or impressive.
> Plus, make sure the tests prove that your results are correct, as well as
fast.Thats the tricky part... :-(

> All tests have to run on all sizes of datasets, and only the numbers from
100% have any real meaning.Point taken.

> If you start typing any PHP code too soon, you'll regret it quickly.Wise
words, but been there...wont happen again (I hope), shooting from the hip is
fun...its when the shots dont hit thatthe fun fades really fast.

Thanks for the advise.Cheers,Ryan

attached mail follows:


On Wed, April 5, 2006 2:42 pm, Age Bosma wrote:
> *confirm_image.php:*

Your browser and webserver "see" confirm_image.php in the URL.

> Header("Content-type: image/jpeg");

REAL browsers like Mozilla and Firefox etc trust this.

Microsoft, however, in its infinite wisdom, ignores
standards-compliant Content-type: headers and "guesses" at the content
type from the URL.

Thus, odds are really good that some versions of IE on some versions
of MS will "decide" that your image must be a JPEG.

The only generalized solution I know of is to make sure you IMG tag
*ends* with .jpg

<imt src="confirm_image.php/ie_sucks.jpg" />

IE (some versions) will "see" the .jpg and "know" it's a JPEG, and
ignore the Content-type:

> ImageString ($image, 5, 12, 2, $code, $text_color);
> ImageJPEG($image, '', 75);
> ImageDestroy($image);
>
> Most people get a nice image but some people get only, what appears to
> be, garbage:
>
> ÿØÿàJFIFÿþ;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62),
  XXX--------

The stuff above XXX...

That doesn't look like valid JPEG starting characters in my experience...

PERHAPS they're fine, or part of some new standard, but every JPEG I
ever saw started with the stuff above --------

It's possible that your code_bg.jpg has EXIF data and/or is a
"progressive" JPEG, and that GD preserves that info, and that some
browsers are incapable of displaying such a JPEG.

> For the complete output have a look here:
> http://www.samuel-area.de/phpbook/confirm_image.php

The crucial thing here is that SOMETHING is forcing some kind of
output and the Content-type: is being set to text/html on that server
for that URL:

-bash-2.05b$ telnet www.samuel-area.de 80
Trying 82.149.248.196...
Connected to www.samuel-area.de.
Escape character is '^]'.
GET /phpbook/confirm_image.php HTTP/1.0
Host: www.samuel-area.de

HTTP/1.1 200 OK
Date: Fri, 14 Apr 2006 00:02:11 GMT
Server: Apache/2.0.53 (Fedora)
X-Powered-By: PHP/4.3.11
Content-Length: 1519
Connection: close
Content-Type: text/html; charset=iso-8859-1

JFIF;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 75
C
 $.' ",#(7),01444'9=82<.342C

> Do you know what is going wrong here?

So, most definitely, in this case, something is configured incorrectly
on that server to over-ride your header() call and it's spewing out
the JPEG as if it were HTML.

My first guess would be some kind of security setting/module which is
trying to be "smart" about .php which is forcing the final output
Content-type: to be text/html, even though PHP is perfectly capable of
generating ANY kind of content.

Since it's an Apache server, if the trick above (end URL in .jpg) does
not work, you could try this:

#1
mv confirm_image.php confirm_image.jpg

Now the URL will look JUST like a .jpg to everybody.

#2
Edit a file .htaccess in that same directory as confirm_image.php and
add this to it:
<Files confirm_image.jpg>
  ForceType application/x-httpd-php
</Files>

Now Apache "knows" that this particular .jpg file should be passed
through PHP to generate output.

#3
Change your IMG tag to point to:
confirm_image.jpg

If that STILL doesn't fix it, you're going to have to get the
administrator of that server to figure out why their server insists on
spewing out Content-type: text/html for a dynamic JPEG.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Thu, April 6, 2006 5:24 pm, Tom Rogers wrote:
> put
>
> error_reporting( E_ALL);
>
> at the top of the script and see if any error messages show up.
> The fact that the mime type is text seems to indicate some output has
> gone to
> the client before your header call. That could be any white space
> outside of
> <?php......?> and could be in an include file or prepend file as well.

Actually, if it's an auto_prepend file, you'll need to change the
reporting level in .htaccess, or it's too late by the time your script
starts executing, no?

php_value error_reporting 2047

Note: I don't think E_ALL is kosher in .htaccess, so I used the value
of E_ALL my PHP reports from:

php -r 'echo E_ALL, "\n";'

I think E_ALL changed value at some point, though...

Maybe you can have your client put up a <?php echo E_ALL;?> page.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Wed, April 5, 2006 1:54 pm, Jim Moseby wrote:
>> Rather than using the following, which simply displays a
>> white screen with
>> the die message, is there a way to add the die message to the
>> body of the
>> original form page, such as in a variable, so that I can
>> display the message
>> on the original form page with all the values already filled
>> out, so that
>> all the user has to do is resubmit?
>>
>> $result = mysql_query($query)
>> or die("User Account could not be
>> created.&nbsp; Please try again
>> later.");

A better solution, for well-structured code, might be more like this:

<?php
  //A collection of error messages for the end user:
  $messages = array();

  //Set up $connection = mysql_connect(...)
  require 'connect.inc';

  //Do all MySQL queries here:
  $query = "this query will generate an error. Guaranteed.";
  $result = mysql_query($query, $connection);
  if ($result === false){
    error_log("mysql_error: " . mysql_error($connection));
    $messages[] = "Unable to do whatever I meant to do. Try again
later.";
    $variable1 = array();
  }
  else while ($row = mysql_fetch_row($result)){
    //store the results in $variable1
  }

  $query = "so will this one.";
  $result = mysql_query($query, $connection);
  if ($result === false){
    error_log("mysql_error: " . mysql_error($connection));
    $messages[] = "Unable to do something else. Try again later.";
    $variable2 = array();
  }
  else while ($row = mysql_fetch_row($result)){
    //store the results in $variable2
  }
?>
<html>
  <head><title>Better Code</title></head>
  <body>
    <?php if (count($messages)) echo "<p class=\"app_error\">",
implode("</p><p class=\"app_error\">", $messages), "</p>\n";?>
    This is your normal page output here, but written for no data.
    It should gracefully handle empty arrays for $variable1 and
$variable2.
    Which is usually needed even if everything works fine, since an
empty set of results is not unusual, so no "extra" code.
  </body>
</html>

You don't really want to expose internal MySQL errors to your end user.

It's just a Bad Idea on so many levels...

You DO want to have all mysql errors logged so you can figure out what
went wrong.

You DO want to give the user "nice" error messages in a pleasant way.

You can simplify this a bit more with http://php.net/set_error_handler
to and http://php.net/trigger_error, which will also make it easy to
get the file and line number of your problem PHP code into your Apache
log, making debugging about 100 X easier as your application grows.

You could also put the $messages initialization, and $messages output,
into include files, so that they can be included on every page.

Or, for that matter, the $messages output could be part of your
standard include files that pull in your
logo/masthead/navigation/whatever, and then you don't even have to
remember to type the include 'messages.inc' on every page. That's
what *I* do, personally.

There's more than one way to skin this cat. :-)

YMMV

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Wed, April 5, 2006 1:02 pm, Shaun wrote:
> I have a site that uses frames. The frameset loads another site (both
> on the
> same server) in the lower frame window. Every time the page changes in
> the
> lower frame the session id changes, how can I stop this happening?

A) Don't use frames. They suck anyway. :-)

B) Capture the session ID in your FRAMESET page and pass it on to the
FRAMES src= pages.

B2) An IFRAME sucks less and MIGHT "just work"

Actually, though, something else weird has to be going on, I think,
cuz the session cookie should not be getting "lost" just by a frame...
Though, I dunno, I never use frames, so maybe they are even more
broken than I thought.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Hello,

I have a project that deals with the date time stamps since 1900 (and
past), any suggestions about a good class that handles Date Time
Format before 1970. I really like date() function and want something
similar.

Thanks in advance!
SP

attached mail follows:


Suhas wrote:
> Hello,
>
> I have a project that deals with the date time stamps since 1900 (and
> past), any suggestions about a good class that handles Date Time
> Format before 1970. I really like date() function and want something
> similar.

date() uses Unix timestamps which on most Unix platforms goes from
-MAX_INT to MAX_INT which means the date range is actually
12:45:52 12/13/1901 to 07:14:07 01/18/2038. So you might be able to get
away with it.

You can check it with:

echo date("h:i:s m/d/Y",-2147483648);
echo date("h:i:s m/d/Y", 2147483647);

Windows, not being Unix, doesn't understand that the timestamp can be
negative, although I think someone fixed that in PHP 5. In my 11+ years
of PHP I have yet to run PHP on Windows, so I wouldn't know.

-Rasmus

attached mail follows:


This will definitely solve one way but still other is there,
How to get that -ve number which starts at 1/1/1900 at 00:00 AM = 0

I need to be able to convert back and forth as there are some
calculations to be done on date field,

But this is very interesting..
Thx
SP

On 4/13/06, Rasmus Lerdorf <rasmuslerdorf.com> wrote:
> Suhas wrote:
> > Hello,
> >
> > I have a project that deals with the date time stamps since 1900 (and
> > past), any suggestions about a good class that handles Date Time
> > Format before 1970. I really like date() function and want something
> > similar.
>
> date() uses Unix timestamps which on most Unix platforms goes from
> -MAX_INT to MAX_INT which means the date range is actually
> 12:45:52 12/13/1901 to 07:14:07 01/18/2038. So you might be able to get
> away with it.
>
> You can check it with:
>
> echo date("h:i:s m/d/Y",-2147483648);
> echo date("h:i:s m/d/Y", 2147483647);
>
> Windows, not being Unix, doesn't understand that the timestamp can be
> negative, although I think someone fixed that in PHP 5. In my 11+ years
> of PHP I have yet to run PHP on Windows, so I wouldn't know.
>
> -Rasmus
>

--
Contact
Suhas Pharkute.
208 830 8915 (C)
208 429 6943 (H)

attached mail follows:


> I have a project that deals with the date time stamps since 1900 (and
> past), any suggestions about a good class that handles Date Time
> Format before 1970. I really like date() function and want something
> similar.

If you're using a database at all, most of them will handle any sort of dates.

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

attached mail follows:


Hi All,

I'm looking at OSCommerce, and have been asked if running 2 instances on
the same server would be doable. I only foresee perhaps issues with
sessions. Has anyone got any thoughts on this? I'd be very appreciative
of any help with this. I have installed already 2 instances on a test
machine here at work. Cheers.

Mark Sargent.

attached mail follows:


On 4/14/06, Mark Sargent <markdiabro.jp> wrote:
> Hi All,
>
> I'm looking at OSCommerce, and have been asked if running 2 instances on
> the same server would be doable. I only foresee perhaps issues with
> sessions. Has anyone got any thoughts on this? I'd be very appreciative
> of any help with this. I have installed already 2 instances on a test
> machine here at work. Cheers.

I doubt you'll have any issues, but you're better off asking the
oscommerce people:
http://www.oscommerce.com/community/support

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

attached mail follows:


Quite possibly a stupid question, but here goes.
 
I have a form that is a list of jobs. On that list is a
checkbox. The form field is named 'changedate'.
 
I also have a hidden field called 'JobID'.
 
What I am trying to accomplish is if a checkbox is
checked, when the form is submitted, I want all of
the JobID's to be updated by an SQL query.
 
But it seems to me that $_POST will only contain
the last JobID in the form, no matter what. Am I correct
on this?

Is what I am trying to accomplish not possible with a
form post?
 
I think I remember doing something similar with Cold Fusion
years ago, but I have never attempted this with PHP.
 
Any suggestions?

attached mail follows:


On 4/13/06 7:40 PM, "Gary E. Terry" <terryquickinet.net> wrote:

> Quite possibly a stupid question, but here goes.
>
> I have a form that is a list of jobs. On that list is a
> checkbox. The form field is named 'changedate'.
>
> I also have a hidden field called 'JobID'.
>
> What I am trying to accomplish is if a checkbox is
> checked, when the form is submitted, I want all of
> the JobID's to be updated by an SQL query.
>
> But it seems to me that $_POST will only contain
> the last JobID in the form, no matter what. Am I correct
> on this?
>
> Is what I am trying to accomplish not possible with a
> form post?
>
> I think I remember doing something similar with Cold Fusion
> years ago, but I have never attempted this with PHP.
>
> Any suggestions?

You need to pass the checkboxes as an array value with the JobID as the
identifier.

Then on the other side, you can run through the list of JobID's and see
which ones need to be updated.

Hope this helps

--
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

stephenthelonecoder.com
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

attached mail follows:


Hi to all,
              we completed one module of our project in English language.but our client asked to do it in chinesse language also.I dont have any idea regarding this.whether we have to download any chinesse fonts or is there any tutorials available for this purpose.or project is in PHP 4 with linux platform.i am waiting for ur reply
   
                                                                                 A.suresh

                                
---------------------------------
 Jiyo cricket on Yahoo! India cricket
Yahoo! Messenger Mobile Stay in touch with your buddies all the time.