Re: [PHP] using UID in DB

2010-03-31 Thread Lester Caine

Tommy Pham wrote:

Hi,

I'm just wondering if anyone on this list using some type of
UID/UUID/GUID in any of the DB?  If so, what DBMS/RDBMS are you using
and how many rows do you have for the table(s) using it?  What data
type are you using for that column?


Firebird is currently improving support for universal identifier, but it has 
been a 'feature' for a long time. It becomes essential when one is running 
multiple databases across multiple machines that need to be combined later, so 
the 'id' is unique to the machine it was generated on.


Storage wise it is just a 128 bit number, so twice as big as a simple 64 bit 
'generator' that would normally be used in a single database system. The 
improvement is to use a raw number rather than a 16 character string.


Generating it can follow one of the standards ( I forget the number ;) )

Displaying the number in one of the 'preferred formats' is just a matter for the 
client app, but one would probably never need to display it normally.


--
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] how to provide download of files mow in documentroot

2010-03-31 Thread Anshul Agrawal
On Wed, Mar 31, 2010 at 1:12 AM, Nathan Rixham nrix...@gmail.com wrote:

 Anshul Agrawal wrote:
  On Tue, Mar 30, 2010 at 8:41 PM, Jan G.B. ro0ot.w...@googlemail.com
 wrote:
 
  2010/3/30 Nathan Rixham nrix...@gmail.com:
  Jan G.B. wrote:
  2010/3/29 Nathan Rixham nrix...@gmail.com
 
  Jan G.B. wrote:
  2010/3/29 Nathan Rixham nrix...@gmail.com
 
  Jan G.B. wrote:
  Top posting sucks, so I'll answer the post somewhere down there.
  SCNR
 
  2010/3/29 Devendra Jadhav devendra...@gmail.com
 
  Then you can do file_get_contents within PHP. or any file
 handling
  mechanism.
  On Mon, Mar 29, 2010 at 1:00 AM, ebhakt i...@ebhakt.com wrote:
  Hi
  i am writing a web application in php
  this webapp primarily focuses on file uploads and downloads
  the uploaded files will be saved in a folder which is not in
  document
  root
  and my query is how will i be able to provide download to such
  files
  not
  located in document root via php
 
  Try something like that
  ?php
  $content = file_get_contents($filename);
  $etag = md5($content);
  header('Last-Modified: '.gmdate('D, d M Y H:i:s',
  filemtime($filename)).' GMT');
  header('ETag: '.$etag);
  header('Accept-Ranges: bytes');
  header('Content-Length: '.strlen($content));
  header('Cache-Control: '.$cache_value); // you decide
  header('Content-type: '.$should_be_set);
  echo $content;
  exit;
  ?
 
  Depending on the $filesize, you should use something else than
  file_get_contents() (for example fopen/fread). file_get_contents
 on
  a
  huge
  file will exhaust your webservers RAM.
  Yup, so you can map the Directory /path/to in web server config;
  then
  allow from only from localhost + yourdomain. This means you can
  then
  request it like an url and do a head request to get the etag etc
 then
  return a 304 not modified if you received a matching etag
  Last-Modified
  etc; (thus meaning you only file_get_contents when really really
  needed).
  I'd advise against saying you Accept-Ranges bytes if you don't
 accept
  byte ranges (ie you aren't going to send little bits of the file).
 
  If you need the downloads to be secure only; then you could easily
  negate php all together and simply expose the directory via a
  location
  so that it is web accessible and set it up to ask for auth using
  htpasswd; a custom script, ldap or whatever.
 
  And if you don't need security then why have php involved at all?
  simply
  symlink to the directory or expose it via http and be done with the
  problem in a minute or two.
 
  Regards!
 
  In my opinion, serving user-content on a productive server is wicked
  sick.
  You don't want your visitors to upload malicous files that may
 trigger
  some
  modules as mod_php in apache. So it makes sense to store
 user-uploads
  outside of a docroot and with no symlink or whatsover.
  even the simplest of server configurations will ensure safety. just
 use
  .htaccess to SetHandler default-handler which treats everything as
  static content and serves it right up.
 
  Yes. But the average persons posting here aren't server config gods, I
  believe.
  Also, you can not implement permissions on these files.
  The discussion was about serving files from a place outside any
 docroot!
  Guess there is a reason for that.
 
 
  One more thing added: your RAM will be exhausted even if you open
 that
  600mb
  file just once.
  Apaches memory handling is a bit weird: if *one* apache process is
  using
  200mb RAM on *one* impression because your application uses that
 much,
  then
  that process will not release the memory while it's serving another
  1000
  requests for `clear.gif` which is maybe 850b in size.
  again everything depends on how you have your server configured; you
  can
  easily tell apache to kill each child after one run or a whole host
 of
  other configs; but ultimately if you can avoid opening up that file
 in
  php then do; serving statically as above is the cleanest quickest way
  to
  do it (other than using s3 or similar).
 
  regards!
 
  Sure, you could configure your apache like that. Unless you have some
  traffic on your site, because the time intensive thing for apache is
 to
  spawn new processes. So it's just not a good idea to do that, Nor to
  serve
  big files via file_get_contents.
  was only addressing and issue you pointed out.. anyways.. so you
 propose
  what exactly? don't server via apache, don't use file_get_contents
  instead do..?
 
  ps you do realise that virtually every huge file on the net is served
  via a web server w/o problems yeah?
 
 
  I was recommending other file methods like fopen() combinations,
  fpassthru() and at best readfile(). All of them do not buffer the
  whole file in memory.
 
  http://php.net/readfile
  http://php.net/fpassthru
 
  Regards
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  I wanted to see the 

Re: [PHP] Newbie Question about Conditionals

2010-03-31 Thread Richard Quadling
On 31 March 2010 05:45, Matty Sarro msa...@gmail.com wrote:
 That explains it perfectly, thanks you!

 On Wed, Mar 31, 2010 at 12:40 AM, Tommy Pham tommy...@gmail.com wrote:

 On Tue, Mar 30, 2010 at 9:22 PM, Matty Sarro msa...@gmail.com wrote:
  Hey all!
  This is probably my second post on the list, so please be gentle. Right
 now
  I am running through the Heads First PHP and MySQL book from O'Reilly.
  It's been quite enjoyable so far, but I have some questions about some of
  the code they're using in one of the chapters.
 
  Basically the code is retreiving rows from a DB, and I'm just not getting
  the explanation of how it works.
 
  Here's the code:
 
  $result=mysqli_query($dbc,$query)
 
  while($row=mysqli_fetch_array($result)){
  echo $row['first_name'].' '.$row['last_name'].' : '. $row['email'] . 'br
  /';
  }
 
  Now, I know what it does, but I don't understand how the conditional
  statement in the while loop works. Isn't an assignment operation always
  going to result in a true condition? Even if
 mysqli_fetch_array($result)
  returned empty values (or null) wouldn't the actual assignment to $row
 still
  be considered a true statement? I would have sworn that assignment
  operations ALWAYS equated to true if used in conditional operations.
  Please help explain! :)
 
  Thanks so much!
  -Matty
 

 http://www.php.net/manual/en/function.mysql-fetch-array.php

 Returns an array of strings that corresponds to the fetched row, or
 FALSE  if there are no more rows.

 while($row=mysqli_fetch_array($result)) is equivalent to this:

 $row=mysqli_fetch_array($result);
 while ($row){

 // do something

 $row=mysqli_fetch_array($result);
 }

 So, if $row is not equal to FALSE, the loop will happens.



Another part to the answer is the value of the assignment. From the
documentation (http://docs.php.net/manual/en/language.operators.assignment.php),
...

The value of an assignment expression is the value assigned.

while($row = mysqli_fetch_array($result))


But there is a significant issue here. Whilst not attributable to the
mysqli_fetch_array() function, it is certainly possible to give
yourself a significant WTF moment with it.


May be will be easier to see the problem when the code is written as ...

while(False === ($row = mysqli_fetch_array($result)))

No?


If I say ...

0 == False

does that help?



Without running the 2 stupid scripts  below, what output should you get?

?php while($pos = strpos('abc', 'a')) { echo 'a';} ?

and

?php while($pos = strpos('abc', 'z')) { echo 'z';} ?

Clearly, they should be different, yes?

Unfortunately, they won't be.

The first call returns 0 and the second returns False.

And as 0 == False, the while() does not loop.

But ...

?php while(False !== ($pos = strpos('abc', 'a'))) { echo 'a';} ?

and

?php while(False !== ($pos = strpos('abc', 'z'))) { echo 'z';} ?

now operate correctly. The first one runs forever, printing a's and
the second one quits straight away.

By always using ...

while(False !== ($var = function($param)))

you can clearly differentiate between functions that return false to
indicate failure and 0 to indicate a position or actual value.

Regards,

Richard.





-- 
-
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=ZEND002498r=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] using UID in DB

2010-03-31 Thread Tommy Pham
On Wed, Mar 31, 2010 at 12:37 AM, Lester Caine les...@lsces.co.uk wrote:
 Tommy Pham wrote:

 Hi,

 I'm just wondering if anyone on this list using some type of
 UID/UUID/GUID in any of the DB?  If so, what DBMS/RDBMS are you using
 and how many rows do you have for the table(s) using it?  What data
 type are you using for that column?

 Firebird is currently improving support for universal identifier, but it has

Thanks for the info.  I'll look into it.

 been a 'feature' for a long time. It becomes essential when one is running
 multiple databases across multiple machines that need to be combined later,
 so the 'id' is unique to the machine it was generated on.

 Storage wise it is just a 128 bit number, so twice as big as a simple 64 bit
 'generator' that would normally be used in a single database system. The
 improvement is to use a raw number rather than a 16 character string.

Don't you mean raw number as 16 byte, which is what I intend to use
binary(16) on MySQL if I'm going to use MySQL as DB, rather than 32/36
character string?


 Generating it can follow one of the standards ( I forget the number ;) )

 Displaying the number in one of the 'preferred formats' is just a matter for
 the client app, but one would probably never need to display it normally.


Agreed.  Displaying that character string is ugly :)

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



Re: [PHP] how to provide download of files mow in documentroot

2010-03-31 Thread Tommy Pham
On Wed, Mar 31, 2010 at 12:43 AM, Anshul Agrawal drinknder...@gmail.com wrote:
 On Wed, Mar 31, 2010 at 1:12 AM, Nathan Rixham nrix...@gmail.com wrote:

 Anshul Agrawal wrote:
  On Tue, Mar 30, 2010 at 8:41 PM, Jan G.B. ro0ot.w...@googlemail.com
 wrote:
 
  2010/3/30 Nathan Rixham nrix...@gmail.com:
  Jan G.B. wrote:
  2010/3/29 Nathan Rixham nrix...@gmail.com
 
  Jan G.B. wrote:
  2010/3/29 Nathan Rixham nrix...@gmail.com
 
  Jan G.B. wrote:
  Top posting sucks, so I'll answer the post somewhere down there.
  SCNR
 
  2010/3/29 Devendra Jadhav devendra...@gmail.com
 
  Then you can do file_get_contents within PHP. or any file
 handling
  mechanism.
  On Mon, Mar 29, 2010 at 1:00 AM, ebhakt i...@ebhakt.com wrote:
  Hi
  i am writing a web application in php
  this webapp primarily focuses on file uploads and downloads
  the uploaded files will be saved in a folder which is not in
  document
  root
  and my query is how will i be able to provide download to such
  files
  not
  located in document root via php
 
  Try something like that
  ?php
          $content = file_get_contents($filename);
          $etag = md5($content);
          header('Last-Modified: '.gmdate('D, d M Y H:i:s',
  filemtime($filename)).' GMT');
          header('ETag: '.$etag);
          header('Accept-Ranges: bytes');
          header('Content-Length: '.strlen($content));
          header('Cache-Control: '.$cache_value); // you decide
          header('Content-type: '.$should_be_set);
          echo $content;
          exit;
  ?
 
  Depending on the $filesize, you should use something else than
  file_get_contents() (for example fopen/fread). file_get_contents
 on
  a
  huge
  file will exhaust your webservers RAM.
  Yup, so you can map the Directory /path/to in web server config;
  then
  allow from only from localhost + yourdomain. This means you can
  then
  request it like an url and do a head request to get the etag etc
 then
  return a 304 not modified if you received a matching etag
  Last-Modified
  etc; (thus meaning you only file_get_contents when really really
  needed).
  I'd advise against saying you Accept-Ranges bytes if you don't
 accept
  byte ranges (ie you aren't going to send little bits of the file).
 
  If you need the downloads to be secure only; then you could easily
  negate php all together and simply expose the directory via a
  location
  so that it is web accessible and set it up to ask for auth using
  htpasswd; a custom script, ldap or whatever.
 
  And if you don't need security then why have php involved at all?
  simply
  symlink to the directory or expose it via http and be done with the
  problem in a minute or two.
 
  Regards!
 
  In my opinion, serving user-content on a productive server is wicked
  sick.
  You don't want your visitors to upload malicous files that may
 trigger
  some
  modules as mod_php in apache. So it makes sense to store
 user-uploads
  outside of a docroot and with no symlink or whatsover.
  even the simplest of server configurations will ensure safety. just
 use
  .htaccess to SetHandler default-handler which treats everything as
  static content and serves it right up.
 
  Yes. But the average persons posting here aren't server config gods, I
  believe.
  Also, you can not implement permissions on these files.
  The discussion was about serving files from a place outside any
 docroot!
  Guess there is a reason for that.
 
 
  One more thing added: your RAM will be exhausted even if you open
 that
  600mb
  file just once.
  Apaches memory handling is a bit weird: if *one* apache process is
  using
  200mb RAM on *one* impression because your application uses that
 much,
  then
  that process will not release the memory while it's serving another
  1000
  requests for `clear.gif` which is maybe 850b in size.
  again everything depends on how you have your server configured; you
  can
  easily tell apache to kill each child after one run or a whole host
 of
  other configs; but ultimately if you can avoid opening up that file
 in
  php then do; serving statically as above is the cleanest quickest way
  to
  do it (other than using s3 or similar).
 
  regards!
 
  Sure, you could configure your apache like that. Unless you have some
  traffic on your site, because the time intensive thing for apache is
 to
  spawn new processes. So it's just not a good idea to do that, Nor to
  serve
  big files via file_get_contents.
  was only addressing and issue you pointed out.. anyways.. so you
 propose
  what exactly? don't server via apache, don't use file_get_contents
  instead do..?
 
  ps you do realise that virtually every huge file on the net is served
  via a web server w/o problems yeah?
 
 
  I was recommending other file methods like fopen() combinations,
  fpassthru() and at best readfile(). All of them do not buffer the
  whole file in memory.
 
  http://php.net/readfile
  http://php.net/fpassthru
 
  Regards
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  

Re: [PHP] using UID in DB

2010-03-31 Thread Lester Caine

Tommy Pham wrote:

Storage wise it is just a 128 bit number, so twice as big as a simple 64 bit
'generator' that would normally be used in a single database system. The
improvement is to use a raw number rather than a 16 character string.



Don't you mean raw number as 16 byte, which is what I intend to use
binary(16) on MySQL if I'm going to use MySQL as DB, rather than 32/36
character string?


Character is a byte ;)
Firebird we can use character string as 16 bytes. The 'improvement' is to 
provide a proper data type for it, and then return a 'UUID' rather than '16 
character string'.


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

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



[PHP] Audiobooks for Developers

2010-03-31 Thread Auto-Deppe C . Hänsel
Good day all,

since I am driving 2 hrs each day listening to either my radio or the songs
on my USB drive, I was wondering whether there are some web dev related
audio books for download out there.

I have been searching the big G for this stuff, but haven't found anything.

Do you guys know of any good resource?

With best regards,

Christian Hänsel



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



Re: [PHP] using UID in DB

2010-03-31 Thread Tommy Pham
On Wed, Mar 31, 2010 at 2:29 AM, Lester Caine les...@lsces.co.uk wrote:
 Tommy Pham wrote:

 Storage wise it is just a 128 bit number, so twice as big as a simple 64
 bit
 'generator' that would normally be used in a single database system. The
 improvement is to use a raw number rather than a 16 character string.

 Don't you mean raw number as 16 byte, which is what I intend to use
 binary(16) on MySQL if I'm going to use MySQL as DB, rather than 32/36
 character string?

 Character is a byte ;)
 Firebird we can use character string as 16 bytes. The 'improvement' is to
 provide a proper data type for it, and then return a 'UUID' rather than '16
 character string'.


You mean something akin to MSSQL's uniqueidentifier data type - store
as 16 byte but will return the hex string on SELECT? AWESOME!!  You
just gave me another reason not to use MySQL :D

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



Re: [PHP] Re: using UID in DB

2010-03-31 Thread Nathan Rixham
Tommy Pham wrote:
 On Tue, Mar 30, 2010 at 2:27 PM, Nathan Rixham nrix...@gmail.com wrote:
 
 nope never been able to find any significant advantage; and thus ended
 up using http uri's in my own domain space(s) which are always
 guaranteed to be unique as I'm issuing them. bonus is that they can be
 dereferenced and server as both a universal (resource) identifier and a
 locater.

 ps: resource = anything that can be named.

 
 Hi Nathan,
 
 I'm interested in hearing your technique of generating your own uuid
 if you don't mind sharing :).  I'm building a project to test my idea
 about search engine and testing of different RDBMSes.  So naturally,
 it (the app) would crawl the net and I'd have over a 1 billion rows.
 
 Thanks,
 Tommy

Hi Tommy,

Always good to see somebody experimenting and questioning things :)

With regards generating UUID's which are http schema uri's; this is
something I got hooked up about early on, but then with practise
realised much of the worlds data already has globally known and used
http scheme identifiers; for instance if I'm talking about a web page
then it's the URL for it; a user may as well be http://twitter.com/webr3
a country could be http://dbpedia.org/resource/United_Kingdom in the
rare occurrence where i actually need to create an identifier then
anything from a freebase style GUID (http://example.org/GUID-HERE)
through to a generated meaningful URI http://mydomain.com/user/username
/project/project-name or even just strapped to a class + microtime:
$uri = 'http://mydomain.com/__CLASS__/' . microtime(true);

There are milions of approaches; but it's worth noting that with each
you can have extra functionality due to the identifier and locator
duality of http scheme uri's (thanks to the domain name system).

With regards what you are doing, if I may suggest a few things that you
could try:

You can create Identifiers that are spatial POINT()s and store them in
mysql/postgres using either the MySQL spatial extension or PostGIS
respectively. You can create identifiers using something like POINT(
timestamp, float-id ) which again serves a duality of timestamping each
record and identifying it. Moreover you'll be shocked at the speed gains
from spatial indexing (seriously amazing), and further it allows you to
do some pretty cool functionality with amazing speed.

The spatial indexing lets you leverage your information in some pretty
cool ways, at phenomenal speed. Because your data is essentially now
points in a virtual world where X is time and Y is identity, you can
pull information out by drawing MBRs around the data and thus selecting
say all records between timestampA and timestampB with identities in the
range 0-1832.1234 (we use floats rather than ints, far more scope and
lends to great spatial optimisation / boxing). Further you aren't
limited to basic geometries; you can create chains of data using
linestring, test intersections on time, disjunctions and much more;
again all with shocking speed over even the biggest of data sets (many
billions in under 0.001s).

You may also want to test out some non relational databases; as
typically with large datasets you have to remove all the relational
parts of the database (foreign keys etc) just to be able to run the
thing efficiently. There are many kv db's; nosql solutions and my
personal favourites which are quad/triple stores for EAV modeled data.

Taking an datachanging approach and working with + storing all data as
EAV triples is by far the fastest and most efficient way to make both
small and large sites; everything is stored in a single flat table and
you can query across all your data with great speed and chain queries
together linking up id's to access your data in ways you can't even
imagine ;) personally I'm running triple stores with 3-4 billion rows on
many machines, even on my desktop!

I'll leave it there, but something to get you started..

Regards!

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



Re: [PHP] Audiobooks for Developers

2010-03-31 Thread Tommy Pham
On Wed, Mar 31, 2010 at 2:41 AM, Auto-Deppe C. Hänsel
c.haen...@auto-deppe.de wrote:
 Good day all,

 since I am driving 2 hrs each day listening to either my radio or the songs
 on my USB drive, I was wondering whether there are some web dev related
 audio books for download out there.

 I have been searching the big G for this stuff, but haven't found anything.

 Do you guys know of any good resource?

 With best regards,

 Christian Hänsel


Have you consider getting an ebook (preferably PDF as Windows'
Narrator, if you're using Windows, works really well with Acrobat) on
the subject you're interested then use a TTS, like Windows' Narrator,
and record it on your system as an alternative solution?  Using this
approach would be more flexible to your selection of the subject
matter.

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



Re: [PHP] Audiobooks for Developers

2010-03-31 Thread Nathan Rixham
Tommy Pham wrote:
 On Wed, Mar 31, 2010 at 2:41 AM, Auto-Deppe C. Hänsel
 c.haen...@auto-deppe.de wrote:
 Good day all,

 since I am driving 2 hrs each day listening to either my radio or the songs
 on my USB drive, I was wondering whether there are some web dev related
 audio books for download out there.

 I have been searching the big G for this stuff, but haven't found anything.

 Do you guys know of any good resource?

 With best regards,

 Christian Hänsel

 
 Have you consider getting an ebook (preferably PDF as Windows'
 Narrator, if you're using Windows, works really well with Acrobat) on
 the subject you're interested then use a TTS, like Windows' Narrator,
 and record it on your system as an alternative solution?  Using this
 approach would be more flexible to your selection of the subject
 matter.

Good suggestion! I might give that a go.

Currently I do swap out music for TED talks quite often, the odd
interview on podcast (to glean info from those more experienced than
myself + gain exposure to new things), and also there are sometimes
good tv series online than can be listened too without the need to
watch; such as the bbc's latest the virtual revolution
http://www.bbc.co.uk/virtualrevolution/

amazing just how much online video can be listened to rather than watched.

regards!

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



[PHP] Something wrong with the PHP-INSTALL list ?

2010-03-31 Thread Nilesh Govindarajan

Any replies I send to PHP-INSTALL list, I get the follow response:
Any ideas why this is happening ?

 Original Message 
Subject:Re: [PHP-INSTALL] installation problem with php and Apache
[Incident:100331-000506]
Date:   Wed, 31 Mar 2010 06:48:44 -0400 (EDT)
From:   Abuse Department postab...@mailca.custhelp.com
Reply-To:   Abuse Department postab...@mailca.custhelp.com
To: li...@itech7.com



* Response*

** This is an automated reply to your message to Email Abuse.
**

Your message has been delivered to our email abuse department. This
department handles complaints from users that are receiving unwanted
email. We try our best to investigate all reports of abuse. If we
determine that the email you reported was in fact sent from an email
address at one of our domains, or by way of computers operated by us, we
will take the appropriate action.

If you did not include the original message headers along with your
message, please do so by replying to this message, leaving the subject
line intact (which contains our tracking identification), and including
all email headers. Email headers show specific details regarding the
source provider, path, originating program, and destination of the
message which is not shown within the TO: and FROM: address fields of
the email.

Unfortunately, spammers use a variety of techniques to mask an email's
actual point of origin, such as by forging information to make it appear
as though the email originated from a domain that is well recognized
across the Internet. Accordingly, the information in the header is very
helpful in assisting us in our investigation.

We regret any inconvenience this may have caused and appreciate you
bringing this matter to our attention.

Regards,

The Email Abuse Department


* Discussion Thread*
* Customer (Nilesh Govindarajan)*   03/31/2010 06:48 AM
On 03/31/2010 01:41 PM, Henryk Cichy wrote:
  Dear Sir,
 
  I would like to start programming using PHP,Apatche and MySql but I
  couldn't start PHP.
  I installed Apache v.2.2.15 ( directory c:\apatche2.2). It works.
  I installed PHP 5.2.13 for Windows to directory c:/php and add :
 
  PHPIniDir = c:/php/
  LoadModule php5_module c:/php/php5apache2_2.dll
  AddType application/x-httpd-php .php
 
  to httpd.conf.After this change, the service of Apatche couldn't start.
  I get error: service specific error code nr 1.
 
  According to install.txt , I should use php.ini-production ( or
  php.ini-development) for php.ini .
  Unfortunatelly, there are only php.ini-recommended and
  php.ini-dist files (maybe you should change install.txt file). I
  copied php.ini-recommended to php.ini file and add line:
  doc_root = c:/apatche2.2/htdocs
 
  I also added path c:\php to windows enviromnent path and copied
  php.ini and copied this file and php5ts.dll to Windows\System32
  catalog.
  This all I can do.
  I use Windows XP Services Pack 2 or 3 (2 computers).
 
  Henryk.

I think you need to put the PHPIniDir directive after the LoadModule
one. Try it out.

--
Nilesh Govindarajan
Site  Server Administrator
www.itech7.com
   !
?? : ??  !


--
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] Re: using UID in DB

2010-03-31 Thread Tommy Pham
On Wed, Mar 31, 2010 at 2:57 AM, Nathan Rixham nrix...@gmail.com wrote:
 Tommy Pham wrote:
 On Tue, Mar 30, 2010 at 2:27 PM, Nathan Rixham nrix...@gmail.com wrote:

 nope never been able to find any significant advantage; and thus ended
 up using http uri's in my own domain space(s) which are always
 guaranteed to be unique as I'm issuing them. bonus is that they can be
 dereferenced and server as both a universal (resource) identifier and a
 locater.

 ps: resource = anything that can be named.


 Hi Nathan,

 I'm interested in hearing your technique of generating your own uuid
 if you don't mind sharing :).  I'm building a project to test my idea
 about search engine and testing of different RDBMSes.  So naturally,
 it (the app) would crawl the net and I'd have over a 1 billion rows.

 Thanks,
 Tommy

 Hi Tommy,

 Always good to see somebody experimenting and questioning things :)

 With regards generating UUID's which are http schema uri's; this is
 something I got hooked up about early on, but then with practise
 realised much of the worlds data already has globally known and used
 http scheme identifiers; for instance if I'm talking about a web page
 then it's the URL for it; a user may as well be http://twitter.com/webr3
 a country could be http://dbpedia.org/resource/United_Kingdom in the
 rare occurrence where i actually need to create an identifier then
 anything from a freebase style GUID (http://example.org/GUID-HERE)
 through to a generated meaningful URI http://mydomain.com/user/username
 /project/project-name or even just strapped to a class + microtime:
 $uri = 'http://mydomain.com/__CLASS__/' . microtime(true);

 There are milions of approaches; but it's worth noting that with each
 you can have extra functionality due to the identifier and locator
 duality of http scheme uri's (thanks to the domain name system).


Very interesting approach.  I'll have to think and research more into it.

 With regards what you are doing, if I may suggest a few things that you
 could try:

 You can create Identifiers that are spatial POINT()s and store them in
 mysql/postgres using either the MySQL spatial extension or PostGIS
 respectively. You can create identifiers using something like POINT(
 timestamp, float-id ) which again serves a duality of timestamping each
 record and identifying it. Moreover you'll be shocked at the speed gains
 from spatial indexing (seriously amazing), and further it allows you to
 do some pretty cool functionality with amazing speed.

 The spatial indexing lets you leverage your information in some pretty
 cool ways, at phenomenal speed. Because your data is essentially now
 points in a virtual world where X is time and Y is identity, you can
 pull information out by drawing MBRs around the data and thus selecting
 say all records between timestampA and timestampB with identities in the
 range 0-1832.1234 (we use floats rather than ints, far more scope and
 lends to great spatial optimisation / boxing). Further you aren't
 limited to basic geometries; you can create chains of data using
 linestring, test intersections on time, disjunctions and much more;
 again all with shocking speed over even the biggest of data sets (many
 billions in under 0.001s).

 You may also want to test out some non relational databases; as
 typically with large datasets you have to remove all the relational
 parts of the database (foreign keys etc) just to be able to run the
 thing efficiently. There are many kv db's; nosql solutions and my
 personal favourites which are quad/triple stores for EAV modeled data.

 Taking an datachanging approach and working with + storing all data as
 EAV triples is by far the fastest and most efficient way to make both
 small and large sites; everything is stored in a single flat table and
 you can query across all your data with great speed and chain queries
 together linking up id's to access your data in ways you can't even
 imagine ;) personally I'm running triple stores with 3-4 billion rows on
 many machines, even on my desktop!

 I'll leave it there, but something to get you started..

 Regards!


As for spatial data types, I've never find much use for non scientific
related.  (example) If using point as a PK, if MySQL stores it the
same way as PostgreSQL which is 16 bytes, how is that any different -
performance wise - than using UUID and storing it as binary(16) for
MySQL or uniqueidentifier (16 bytes) for PostgreSQL?

Thanks,
Tommy

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



Re: [PHP] Re: using UID in DB

2010-03-31 Thread Nathan Rixham
Tommy Pham wrote:
 
 As for spatial data types, I've never find much use for non scientific
 related.  (example) If using point as a PK, if MySQL stores it the
 same way as PostgreSQL which is 16 bytes, how is that any different -
 performance wise - than using UUID and storing it as binary(16) for
 MySQL or uniqueidentifier (16 bytes) for PostgreSQL?
 

it's all about the indexing (R-Tree)

http://en.wikipedia.org/wiki/R-tree




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



RE: [PHP] Audiobooks for Developers

2010-03-31 Thread Auto-Deppe C . Hänsel
Have you consider getting an ebook (preferably PDF as Windows'
Narrator, if you're using Windows, works really well with Acrobat) on
the subject you're interested then use a TTS, like Windows' Narrator,
and record it on your system as an alternative solution?  Using this
approach would be more flexible to your selection of the subject
matter.

That might actually work. I will give that a shot. ;o) Thanks for this 
suggestion

Cheers

Chris


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



[PHP] MySQL query not working!

2010-03-31 Thread Parham Doustdar
Hi there,
Here is a snippet of code... that doesn't work for some reason. Please note 
that I have put some

@mysql_query($query) or die(mysql_error());

statements, to see if MySQL gives an error. I receive nothing other than the 
file starting to download. This is supposed to be a file download counter:

[code]
?php
//connect to the DB
mysql_connect() //There is no problem with the connection so I didn't 
include the complete code.

//The table where the hits are stored.
$table = files;

$query = select * from  . $table .  where filename = ' . $_GET['file'] . 
';
$result = mysql_query($query);

if ($result) //Has the file previously been added?
{
$query = update  . $table .  set hits = hits + 1 where filename = ' . 
$_GET['file'] . ';
@mysql_query($query) or die(mysql_error());
header('location:http://www.qwitter-client.net/' . $_GET['file']);
}
else //it's the first time we're adding this file to the DB.
{
$query = insert into  . $table .  (filename, hits) values (' . 
$_GET['file'] . ', 1);
@mysql_query($query) or die(mysql_error());
header('location:http://www.qwitter-client.net/' . $_GET['file']);
}
? 



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



Re: [PHP] MySQL query not working!

2010-03-31 Thread Ashley Sheridan
On Wed, 2010-03-31 at 16:20 +0430, Parham Doustdar wrote:

 Hi there,
 Here is a snippet of code... that doesn't work for some reason. Please note 
 that I have put some
 
 @mysql_query($query) or die(mysql_error());
 
 statements, to see if MySQL gives an error. I receive nothing other than the 
 file starting to download. This is supposed to be a file download counter:
 
 [code]
 ?php
 //connect to the DB
 mysql_connect() //There is no problem with the connection so I didn't 
 include the complete code.
 
 //The table where the hits are stored.
 $table = files;
 
 $query = select * from  . $table .  where filename = ' . $_GET['file'] . 
 ';
 $result = mysql_query($query);
 
 if ($result) //Has the file previously been added?
 {
 $query = update  . $table .  set hits = hits + 1 where filename = ' . 
 $_GET['file'] . ';
 @mysql_query($query) or die(mysql_error());
 header('location:http://www.qwitter-client.net/' . $_GET['file']);
 }
 else //it's the first time we're adding this file to the DB.
 {
 $query = insert into  . $table .  (filename, hits) values (' . 
 $_GET['file'] . ', 1);
 @mysql_query($query) or die(mysql_error());
 header('location:http://www.qwitter-client.net/' . $_GET['file']);
 }
 ? 
 
 
 


What is the output of $query?

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




Re: [PHP] MySQL query not working!

2010-03-31 Thread Andre Polykanine
Hello Parham,

Adding to Ash's question, why to use the @ operator before
mysql_query?
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Parham Doustdar parha...@gmail.com
To: php-general@lists.php.net php-general@lists.php.net
Date: Wednesday, March 31, 2010, 2:50:07 PM
Subject: [PHP] MySQL query not working!

Hi there,
Here is a snippet of code... that doesn't work for some reason. Please note 
that I have put some

@mysql_query($query) or die(mysql_error());

statements, to see if MySQL gives an error. I receive nothing other than the 
file starting to download. This is supposed to be a file download counter:

[code]
?php
//connect to the DB
mysql_connect() //There is no problem with the connection so I didn't 
include the complete code.

//The table where the hits are stored.
$table = files;

$query = select * from  . $table .  where filename = ' . $_GET['file'] . 
';
$result = mysql_query($query);

if ($result) //Has the file previously been added?
{
$query = update  . $table .  set hits = hits + 1 where filename = ' . 
$_GET['file'] . ';
@mysql_query($query) or die(mysql_error());
header('location:http://www.qwitter-client.net/' . $_GET['file']);
}
else //it's the first time we're adding this file to the DB.
{
$query = insert into  . $table .  (filename, hits) values (' . 
$_GET['file'] . ', 1);
@mysql_query($query) or die(mysql_error());
header('location:http://www.qwitter-client.net/' . $_GET['file']);
}
? 



-- 
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] MySQL query not working!

2010-03-31 Thread Parham Doustdar

Andre,
The @ operator is used for error catching statements. When you put:

@mysql_connect('localhost', 'username', 'password') or die('Could not 
connect.');


If PHP fails to make a connection, the script execution is stopped, and the 
error message between the apostrophes is given.


And, I found out what the problem was; I should have put:

if (mysql_num_rows($result))

rather than just

if ($result)

Thanks!
- Original Message - 
From: Andre Polykanine an...@oire.org

To: Parham Doustdar parha...@gmail.com
Cc: php-general@lists.php.net
Sent: Wednesday, March 31, 2010 4:41 PM
Subject: Re: [PHP] MySQL query not working!



Hello Parham,

Adding to Ash's question, why to use the @ operator before
mysql_query?
--
With best regards from Ukraine,
Andre
Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org

Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Parham Doustdar parha...@gmail.com
To: php-general@lists.php.net php-general@lists.php.net
Date: Wednesday, March 31, 2010, 2:50:07 PM
Subject: [PHP] MySQL query not working!

Hi there,
Here is a snippet of code... that doesn't work for some reason. Please 
note

that I have put some

@mysql_query($query) or die(mysql_error());

statements, to see if MySQL gives an error. I receive nothing other than 
the

file starting to download. This is supposed to be a file download counter:

[code]
?php
//connect to the DB
mysql_connect() //There is no problem with the connection so I didn't
include the complete code.

//The table where the hits are stored.
$table = files;

$query = select * from  . $table .  where filename = ' . $_GET['file'] 
.

';
$result = mysql_query($query);

if ($result) //Has the file previously been added?
{
$query = update  . $table .  set hits = hits + 1 where filename = ' .
$_GET['file'] . ';
@mysql_query($query) or die(mysql_error());
header('location:http://www.qwitter-client.net/' . $_GET['file']);
}
else //it's the first time we're adding this file to the DB.
{
$query = insert into  . $table .  (filename, hits) values (' .
$_GET['file'] . ', 1);
@mysql_query($query) or die(mysql_error());
header('location:http://www.qwitter-client.net/' . $_GET['file']);
}
?



--
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] MySQL query not working!

2010-03-31 Thread Alexey Bovanenko
Hi!

To view error:
you must use mysql_query(). @ before mysql - error supression.

next

you can use the following:

$result=..
if($result){
 if(mysql_num_rows($result)){
/* you have record in table */
}else{
  /* you haven't */

On Wed, Mar 31, 2010 at 4:11 PM, Andre Polykanine an...@oire.org wrote:

 Hello Parham,

 Adding to Ash's question, why to use the @ operator before
 mysql_query?
 --
 With best regards from Ukraine,
 Andre
 Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @
 jabber.org
 Yahoo! messenger: andre.polykanine; ICQ: 191749952
 Twitter: m_elensule

 - Original message -
 From: Parham Doustdar parha...@gmail.com
 To: php-general@lists.php.net php-general@lists.php.net
 Date: Wednesday, March 31, 2010, 2:50:07 PM
 Subject: [PHP] MySQL query not working!

 Hi there,
 Here is a snippet of code... that doesn't work for some reason. Please note
 that I have put some

 @mysql_query($query) or die(mysql_error());

 statements, to see if MySQL gives an error. I receive nothing other than
 the
 file starting to download. This is supposed to be a file download counter:

 [code]
 ?php
 //connect to the DB
 mysql_connect() //There is no problem with the connection so I didn't
 include the complete code.

 //The table where the hits are stored.
 $table = files;

 $query = select * from  . $table .  where filename = ' . $_GET['file']
 .
 ';
 $result = mysql_query($query);

 if ($result) //Has the file previously been added?
 {
 $query = update  . $table .  set hits = hits + 1 where filename = ' .
 $_GET['file'] . ';
 @mysql_query($query) or die(mysql_error());
 header('location:http://www.qwitter-client.net/' . $_GET['file']);
 }
 else //it's the first time we're adding this file to the DB.
 {
 $query = insert into  . $table .  (filename, hits) values (' .
 $_GET['file'] . ', 1);
 @mysql_query($query) or die(mysql_error());
 header('location:http://www.qwitter-client.net/' . $_GET['file']);
 }
 ?



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




-- 
With regards,
Alexei Bovanenko


Re[2]: [PHP] MySQL query not working!

2010-03-31 Thread Andre Polykanine
Hello Parham,

I know what the @ operator does (it stops PHP from reporting errors
and makes it ignore error_reporting() or any INI directives) but I
don't understand why to use it here, with mysql_query() function.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Parham Doustdar parha...@gmail.com
To: Andre Polykanine an...@oire.org
Date: Wednesday, March 31, 2010, 3:20:54 PM
Subject: [PHP] MySQL query not working!

Andre,
The @ operator is used for error catching statements. When you put:

@mysql_connect('localhost', 'username', 'password') or die('Could not 
connect.');

If PHP fails to make a connection, the script execution is stopped, and the 
error message between the apostrophes is given.

And, I found out what the problem was; I should have put:

if (mysql_num_rows($result))

rather than just

if ($result)

Thanks!
- Original Message - 
From: Andre Polykanine an...@oire.org
To: Parham Doustdar parha...@gmail.com
Cc: php-general@lists.php.net
Sent: Wednesday, March 31, 2010 4:41 PM
Subject: Re: [PHP] MySQL query not working!


 Hello Parham,

 Adding to Ash's question, why to use the @ operator before
 mysql_query?
 -- 
 With best regards from Ukraine,
 Andre
 Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
 jabber.org
 Yahoo! messenger: andre.polykanine; ICQ: 191749952
 Twitter: m_elensule

 - Original message -
 From: Parham Doustdar parha...@gmail.com
 To: php-general@lists.php.net php-general@lists.php.net
 Date: Wednesday, March 31, 2010, 2:50:07 PM
 Subject: [PHP] MySQL query not working!

 Hi there,
 Here is a snippet of code... that doesn't work for some reason. Please 
 note
 that I have put some

 @mysql_query($query) or die(mysql_error());

 statements, to see if MySQL gives an error. I receive nothing other than 
 the
 file starting to download. This is supposed to be a file download counter:

 [code]
 ?php
 //connect to the DB
 mysql_connect() //There is no problem with the connection so I didn't
 include the complete code.

 //The table where the hits are stored.
 $table = files;

 $query = select * from  . $table .  where filename = ' . $_GET['file'] 
 .
 ';
 $result = mysql_query($query);

 if ($result) //Has the file previously been added?
 {
 $query = update  . $table .  set hits = hits + 1 where filename = ' .
 $_GET['file'] . ';
 @mysql_query($query) or die(mysql_error());
 header('location:http://www.qwitter-client.net/' . $_GET['file']);
 }
 else //it's the first time we're adding this file to the DB.
 {
 $query = insert into  . $table .  (filename, hits) values (' .
 $_GET['file'] . ', 1);
 @mysql_query($query) or die(mysql_error());
 header('location:http://www.qwitter-client.net/' . $_GET['file']);
 }
 ?



 -- 
 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] Adding Time

2010-03-31 Thread Anshul Agrawal
On Sun, Mar 28, 2010 at 4:22 AM, Gary gwp...@ptd.net wrote:

 Perfect, thank you very much for your help!

 Gary


 Yousif Masoud yousif.mas...@gmail.com wrote in message
 news:x2tbffe24ad1003271548l65cb6e65qd8f35ae0636e...@mail.gmail.com...
  On Sat, Mar 27, 2010 at 10:26 PM, Gary gwp...@ptd.net wrote:
 
  [...]
 
 
  $end_date=date('m-d-Y',strtotime('$mth')) + date('m-d-Y',
  strtotime('$pay_date'));
 
  [...]
 
 
  Try changing above to:
 
  $end_date = date('m-d-Y',strtotime($pay_date + $mth months));
 
  I think your mail client took it out of the add_date function.
 
 
 
  __ Information from ESET Smart Security, version of virus
  signature database 4978 (20100326) __
 
  The message was checked by ESET Smart Security.
 
  http://www.eset.com
 
 



 __ Information from ESET Smart Security, version of virus signature
 database 4978 (20100326) __

 The message was checked by ESET Smart Security.

 http://www.eset.com





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


Be cautious while using this.

$mth = 1;
$pay_date = 2010-01-31;
$end_date = date('m-d-Y',strtotime($pay_date + $mth months));
echo $end_date; //03-03-2010, will take you to March

Thanks,
Anshul


Re[2]: [PHP] Still searching for a bugtracking system

2010-03-31 Thread Andre Polykanine
Hello Jorge,

Hm... that seems quite fine) If I don't manage to deal with JotBug,
will try Flyspray, thanks!
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Jorge Gomes jorgegome...@gmail.com
To: Shawn McKenzie nos...@mckenzies.net
Date: Tuesday, March 30, 2010, 10:50:08 PM
Subject: [PHP] Still searching for a bugtracking system

What about flyspray?

http://flyspray.org/

Demo: http://flyspray.org/demo

They use it for tracking the bugs of their software (obviously):
http://bugs.flyspray.org/

They have bad documentation but I tested the software and seems to be fine.
They are slowly working in the final 1.0 version.

Rewards
___
Jorge Gomes


2010/3/30 Shawn McKenzie nos...@mckenzies.net

 Andre Polykanine wrote:
  Hello Jan,
 
  And what do you use then?)
 
 If you're able to, you enable the sqllite extension in your php.ini and
 then you create your database as a flat file.  The installer for the bug
 tracker would probably do that for you.

 --
 Thanks!
 -Shawn
 http://www.spidean.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] MySQL query not working!

2010-03-31 Thread Ashley Sheridan
On Wed, 2010-03-31 at 16:50 +0430, Parham Doustdar wrote:

 Andre,
 The @ operator is used for error catching statements. When you put:
 
 @mysql_connect('localhost', 'username', 'password') or die('Could not 
 connect.');
 
 If PHP fails to make a connection, the script execution is stopped, and the 
 error message between the apostrophes is given.
 
 And, I found out what the problem was; I should have put:
 
 if (mysql_num_rows($result))
 
 rather than just
 
 if ($result)
 
 Thanks!
 - Original Message - 
 From: Andre Polykanine an...@oire.org
 To: Parham Doustdar parha...@gmail.com
 Cc: php-general@lists.php.net
 Sent: Wednesday, March 31, 2010 4:41 PM
 Subject: Re: [PHP] MySQL query not working!
 
 
  Hello Parham,
 
  Adding to Ash's question, why to use the @ operator before
  mysql_query?
  -- 
  With best regards from Ukraine,
  Andre
  Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
  jabber.org
  Yahoo! messenger: andre.polykanine; ICQ: 191749952
  Twitter: m_elensule
 
  - Original message -
  From: Parham Doustdar parha...@gmail.com
  To: php-general@lists.php.net php-general@lists.php.net
  Date: Wednesday, March 31, 2010, 2:50:07 PM
  Subject: [PHP] MySQL query not working!
 
  Hi there,
  Here is a snippet of code... that doesn't work for some reason. Please 
  note
  that I have put some
 
  @mysql_query($query) or die(mysql_error());
 
  statements, to see if MySQL gives an error. I receive nothing other than 
  the
  file starting to download. This is supposed to be a file download counter:
 
  [code]
  ?php
  //connect to the DB
  mysql_connect() //There is no problem with the connection so I didn't
  include the complete code.
 
  //The table where the hits are stored.
  $table = files;
 
  $query = select * from  . $table .  where filename = ' . $_GET['file'] 
  .
  ';
  $result = mysql_query($query);
 
  if ($result) //Has the file previously been added?
  {
  $query = update  . $table .  set hits = hits + 1 where filename = ' .
  $_GET['file'] . ';
  @mysql_query($query) or die(mysql_error());
  header('location:http://www.qwitter-client.net/' . $_GET['file']);
  }
  else //it's the first time we're adding this file to the DB.
  {
  $query = insert into  . $table .  (filename, hits) values (' .
  $_GET['file'] . ', 1);
  @mysql_query($query) or die(mysql_error());
  header('location:http://www.qwitter-client.net/' . $_GET['file']);
  }
  ?
 
 
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 


My understanding of the @ here would be that PHP won't register the
error, so it won't ever die()

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




RE: [PHP] Audiobooks for Developers

2010-03-31 Thread Bob McConnell
From: Auto-Deppe C. Hänsel

 since I am driving 2 hrs each day listening to either my
 radio or the songs
 on my USB drive, I was wondering whether there are some
 web dev related
 audio books for download out there.

I have only one recommendation. DON'T DO IT!

Driving a vehicle on public highways is dangerous enough without any 
significant distractions. You don't want to complicate it by adding a task that 
tempts you to focus on something other than the road, signals and other 
traffic. That is a good way to cause accidents.

Bob McConnell

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



Re: [PHP] MySQL query not working!

2010-03-31 Thread Midhun Girish
Yes ash.. me too think the same... @ will supress any error which would have
lead to die()... so die() wont come ever

Midhun Girish



On Wed, Mar 31, 2010 at 6:16 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Wed, 2010-03-31 at 16:50 +0430, Parham Doustdar wrote:

  Andre,
  The @ operator is used for error catching statements. When you put:
 
  @mysql_connect('localhost', 'username', 'password') or die('Could not
  connect.');
 
  If PHP fails to make a connection, the script execution is stopped, and
 the
  error message between the apostrophes is given.
 
  And, I found out what the problem was; I should have put:
 
  if (mysql_num_rows($result))
 
  rather than just
 
  if ($result)
 
  Thanks!
  - Original Message -
  From: Andre Polykanine an...@oire.org
  To: Parham Doustdar parha...@gmail.com
  Cc: php-general@lists.php.net
  Sent: Wednesday, March 31, 2010 4:41 PM
  Subject: Re: [PHP] MySQL query not working!
 
 
   Hello Parham,
  
   Adding to Ash's question, why to use the @ operator before
   mysql_query?
   --
   With best regards from Ukraine,
   Andre
   Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon
 @
   jabber.org
   Yahoo! messenger: andre.polykanine; ICQ: 191749952
   Twitter: m_elensule
  
   - Original message -
   From: Parham Doustdar parha...@gmail.com
   To: php-general@lists.php.net php-general@lists.php.net
   Date: Wednesday, March 31, 2010, 2:50:07 PM
   Subject: [PHP] MySQL query not working!
  
   Hi there,
   Here is a snippet of code... that doesn't work for some reason. Please
   note
   that I have put some
  
   @mysql_query($query) or die(mysql_error());
  
   statements, to see if MySQL gives an error. I receive nothing other
 than
   the
   file starting to download. This is supposed to be a file download
 counter:
  
   [code]
   ?php
   //connect to the DB
   mysql_connect() //There is no problem with the connection so I didn't
   include the complete code.
  
   //The table where the hits are stored.
   $table = files;
  
   $query = select * from  . $table .  where filename = ' .
 $_GET['file']
   .
   ';
   $result = mysql_query($query);
  
   if ($result) //Has the file previously been added?
   {
   $query = update  . $table .  set hits = hits + 1 where filename = '
 .
   $_GET['file'] . ';
   @mysql_query($query) or die(mysql_error());
   header('location:http://www.qwitter-client.net/' . $_GET['file']);
   }
   else //it's the first time we're adding this file to the DB.
   {
   $query = insert into  . $table .  (filename, hits) values (' .
   $_GET['file'] . ', 1);
   @mysql_query($query) or die(mysql_error());
   header('location:http://www.qwitter-client.net/' . $_GET['file']);
   }
   ?
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 


 My understanding of the @ here would be that PHP won't register the
 error, so it won't ever die()

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





RE: [PHP] Audiobooks for Developers

2010-03-31 Thread Auto-Deppe C . Hänsel
 -Original Message-
 From: Bob McConnell [mailto:r...@cbord.com]
 Sent: Wednesday, March 31, 2010 2:52 PM
 To: php-general@lists.php.net
 Subject: RE: [PHP] Audiobooks for Developers
 
 From: Auto-Deppe C. Hänsel
 
  since I am driving 2 hrs each day listening to either my
  radio or the songs
  on my USB drive, I was wondering whether there are some
  web dev related
  audio books for download out there.
 
 I have only one recommendation. DON'T DO IT!
 
 Driving a vehicle on public highways is dangerous enough without any
significant
 distractions. You don't want to complicate it by adding a task that tempts
you to
 focus on something other than the road, signals and other traffic. That is
a good
 way to cause accidents.
 
 Bob McConnell
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


Hi Bob,

thanks for your advide, I understand your concern. I honestly do.

Let me show you quickly the route I am driving every day:
http://maps.google.de/maps?f=dsource=s_dsaddr=helpupdaddr=extertalhl=de;
geocode=Fb3-GAMdIuyEACmdszYJpEC6RzERLZJMgvInJg%3BFetyGgMdDjuLACn7EwcOCWG6RzF
39JiIvP5PLAmra=lssll=51.151786,10.415039sspn=20.175322,57.084961ie=UTF8
t=hz=12

In the morning, it is SO boring I leave home at 5:30am, so not much
traffic going on.

In the afternoon, there is no way of driving fast enough to cause an
accident *haha*

Seriously though: I am always listening to audio books or the radio... but I
do focus on the traffic rather than the audio. Believe me, I understand your
concern. But still: I want audio books :o))

Chris


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



RE: [PHP] Audiobooks for Developers

2010-03-31 Thread Ashley Sheridan
On Wed, 2010-03-31 at 15:01 +0200, Auto-Deppe C. Hänsel wrote:

  -Original Message-
  From: Bob McConnell [mailto:r...@cbord.com]
  Sent: Wednesday, March 31, 2010 2:52 PM
  To: php-general@lists.php.net
  Subject: RE: [PHP] Audiobooks for Developers
  
  From: Auto-Deppe C. Hänsel
  
   since I am driving 2 hrs each day listening to either my
   radio or the songs
   on my USB drive, I was wondering whether there are some
   web dev related
   audio books for download out there.
  
  I have only one recommendation. DON'T DO IT!
  
  Driving a vehicle on public highways is dangerous enough without any
 significant
  distractions. You don't want to complicate it by adding a task that tempts
 you to
  focus on something other than the road, signals and other traffic. That is
 a good
  way to cause accidents.
  
  Bob McConnell
  
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 Hi Bob,
 
 thanks for your advide, I understand your concern. I honestly do.
 
 Let me show you quickly the route I am driving every day:
 http://maps.google.de/maps?f=dsource=s_dsaddr=helpupdaddr=extertalhl=de;
 geocode=Fb3-GAMdIuyEACmdszYJpEC6RzERLZJMgvInJg%3BFetyGgMdDjuLACn7EwcOCWG6RzF
 39JiIvP5PLAmra=lssll=51.151786,10.415039sspn=20.175322,57.084961ie=UTF8
 t=hz=12
 
 In the morning, it is SO boring I leave home at 5:30am, so not much
 traffic going on.
 
 In the afternoon, there is no way of driving fast enough to cause an
 accident *haha*
 
 Seriously though: I am always listening to audio books or the radio... but I
 do focus on the traffic rather than the audio. Believe me, I understand your
 concern. But still: I want audio books :o))
 
 Chris
 
 


There is also the learning technique of listening to audio books whilst
sleeping. Not sure if I hold too much truck with that, but it's an
option!

There are a lot of books offered online in PDF format (I believe
O'Reilly do this a lot) which can be ready out by lots of different
audio software, including Acrobats own PDF reader.

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




Re: [PHP] MySQL query not working!

2010-03-31 Thread Andrew Ballard
On Wed, Mar 31, 2010 at 8:46 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
 On Wed, 2010-03-31 at 16:50 +0430, Parham Doustdar wrote:

 Andre,
 The @ operator is used for error catching statements. When you put:

 @mysql_connect('localhost', 'username', 'password') or die('Could not
 connect.');

 If PHP fails to make a connection, the script execution is stopped, and the
 error message between the apostrophes is given.

 And, I found out what the problem was; I should have put:

 if (mysql_num_rows($result))

 rather than just

 if ($result)

 Thanks!
 - Original Message -
 From: Andre Polykanine an...@oire.org
 To: Parham Doustdar parha...@gmail.com
 Cc: php-general@lists.php.net
 Sent: Wednesday, March 31, 2010 4:41 PM
 Subject: Re: [PHP] MySQL query not working!


  Hello Parham,
 
  Adding to Ash's question, why to use the @ operator before
  mysql_query?
  --
  With best regards from Ukraine,
  Andre
  Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @
  jabber.org
  Yahoo! messenger: andre.polykanine; ICQ: 191749952
  Twitter: m_elensule
 
  - Original message -
  From: Parham Doustdar parha...@gmail.com
  To: php-general@lists.php.net php-general@lists.php.net
  Date: Wednesday, March 31, 2010, 2:50:07 PM
  Subject: [PHP] MySQL query not working!
 
  Hi there,
  Here is a snippet of code... that doesn't work for some reason. Please
  note
  that I have put some
 
  @mysql_query($query) or die(mysql_error());
 
  statements, to see if MySQL gives an error. I receive nothing other than
  the
  file starting to download. This is supposed to be a file download counter:
 
  [code]
  ?php
  //connect to the DB
  mysql_connect() //There is no problem with the connection so I didn't
  include the complete code.
 
  //The table where the hits are stored.
  $table = files;
 
  $query = select * from  . $table .  where filename = ' . $_GET['file']
  .
  ';
  $result = mysql_query($query);
 
  if ($result) //Has the file previously been added?
  {
  $query = update  . $table .  set hits = hits + 1 where filename = ' .
  $_GET['file'] . ';
  @mysql_query($query) or die(mysql_error());
  header('location:http://www.qwitter-client.net/' . $_GET['file']);
  }
  else //it's the first time we're adding this file to the DB.
  {
  $query = insert into  . $table .  (filename, hits) values (' .
  $_GET['file'] . ', 1);
  @mysql_query($query) or die(mysql_error());
  header('location:http://www.qwitter-client.net/' . $_GET['file']);
  }
  ?
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 




 My understanding of the @ here would be that PHP won't register the
 error, so it won't ever die()

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




Nope. All it does is suppress the error message. Just try it:

?php

@mysql_connect('localhost', 'baduser', 'badpassword') or die('Could
not connect');

?

Output:
Could not connect
?php

@mysql_connect('localhost', 'baduser', 'badpassword') or die('Could
not connect');

?

Output:
br /
bWarning/b:  mysql_connect() [a
href='function.mysql-connect'function.mysql-connect/a]: Can't
connect to MySQL server on 'localhost' (10061) in bPHPDocument1/b
on line b3/bbr /
Could not connect

Andrew

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



Re: [PHP] MySQL query not working!

2010-03-31 Thread Midhun Girish
hey Andrew ,
you are correct thanks for pointing tht.. i should have checked it
before so @ just prevents the warnings and errors from showing up

Midhun Girish


On Wed, Mar 31, 2010 at 6:38 PM, Andrew Ballard aball...@gmail.com wrote:

 On Wed, Mar 31, 2010 at 8:46 AM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
  On Wed, 2010-03-31 at 16:50 +0430, Parham Doustdar wrote:
 
  Andre,
  The @ operator is used for error catching statements. When you put:
 
  @mysql_connect('localhost', 'username', 'password') or die('Could not
  connect.');
 
  If PHP fails to make a connection, the script execution is stopped, and
 the
  error message between the apostrophes is given.
 
  And, I found out what the problem was; I should have put:
 
  if (mysql_num_rows($result))
 
  rather than just
 
  if ($result)
 
  Thanks!
  - Original Message -
  From: Andre Polykanine an...@oire.org
  To: Parham Doustdar parha...@gmail.com
  Cc: php-general@lists.php.net
  Sent: Wednesday, March 31, 2010 4:41 PM
  Subject: Re: [PHP] MySQL query not working!
 
 
   Hello Parham,
  
   Adding to Ash's question, why to use the @ operator before
   mysql_query?
   --
   With best regards from Ukraine,
   Andre
   Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon
 @
   jabber.org
   Yahoo! messenger: andre.polykanine; ICQ: 191749952
   Twitter: m_elensule
  
   - Original message -
   From: Parham Doustdar parha...@gmail.com
   To: php-general@lists.php.net php-general@lists.php.net
   Date: Wednesday, March 31, 2010, 2:50:07 PM
   Subject: [PHP] MySQL query not working!
  
   Hi there,
   Here is a snippet of code... that doesn't work for some reason. Please
   note
   that I have put some
  
   @mysql_query($query) or die(mysql_error());
  
   statements, to see if MySQL gives an error. I receive nothing other
 than
   the
   file starting to download. This is supposed to be a file download
 counter:
  
   [code]
   ?php
   //connect to the DB
   mysql_connect() //There is no problem with the connection so I didn't
   include the complete code.
  
   //The table where the hits are stored.
   $table = files;
  
   $query = select * from  . $table .  where filename = ' .
 $_GET['file']
   .
   ';
   $result = mysql_query($query);
  
   if ($result) //Has the file previously been added?
   {
   $query = update  . $table .  set hits = hits + 1 where filename =
 ' .
   $_GET['file'] . ';
   @mysql_query($query) or die(mysql_error());
   header('location:http://www.qwitter-client.net/' . $_GET['file']);
   }
   else //it's the first time we're adding this file to the DB.
   {
   $query = insert into  . $table .  (filename, hits) values (' .
   $_GET['file'] . ', 1);
   @mysql_query($query) or die(mysql_error());
   header('location:http://www.qwitter-client.net/' . $_GET['file']);
   }
   ?
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 
 
 
  My understanding of the @ here would be that PHP won't register the
  error, so it won't ever die()
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 

 Nope. All it does is suppress the error message. Just try it:

 ?php

 @mysql_connect('localhost', 'baduser', 'badpassword') or die('Could
 not connect');

 ?

 Output:
 Could not connect
 ?php

 @mysql_connect('localhost', 'baduser', 'badpassword') or die('Could
 not connect');

 ?

 Output:
 br /
 bWarning/b:  mysql_connect() [a
 href='function.mysql-connect'function.mysql-connect/a]: Can't
 connect to MySQL server on 'localhost' (10061) in bPHPDocument1/b
 on line b3/bbr /
 Could not connect

 Andrew

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




Re: [PHP] Something wrong with the PHP-INSTALL list ?

2010-03-31 Thread Tommy Pham
On Wed, Mar 31, 2010 at 3:50 AM, Nilesh Govindarajan li...@itech7.com wrote:
 Any replies I send to PHP-INSTALL list, I get the follow response:
 Any ideas why this is happening ?

  Original Message 
 Subject:        Re: [PHP-INSTALL] installation problem with php and Apache
 [Incident:100331-000506]
 Date:   Wed, 31 Mar 2010 06:48:44 -0400 (EDT)
 From:   Abuse Department postab...@mailca.custhelp.com
 Reply-To:       Abuse Department postab...@mailca.custhelp.com
 To:     li...@itech7.com



 * Response*

 ** This is an automated reply to your message to Email Abuse.
 **

 Your message has been delivered to our email abuse department. This
 department handles complaints from users that are receiving unwanted
 email. We try our best to investigate all reports of abuse. If we
 determine that the email you reported was in fact sent from an email
 address at one of our domains, or by way of computers operated by us, we
 will take the appropriate action.

 If you did not include the original message headers along with your
 message, please do so by replying to this message, leaving the subject
 line intact (which contains our tracking identification), and including
 all email headers. Email headers show specific details regarding the
 source provider, path, originating program, and destination of the
 message which is not shown within the TO: and FROM: address fields of
 the email.

 Unfortunately, spammers use a variety of techniques to mask an email's
 actual point of origin, such as by forging information to make it appear
 as though the email originated from a domain that is well recognized
 across the Internet. Accordingly, the information in the header is very
 helpful in assisting us in our investigation.

 We regret any inconvenience this may have caused and appreciate you
 bringing this matter to our attention.

 Regards,

 The Email Abuse Department


 * Discussion Thread*
 * Customer (Nilesh Govindarajan)*       03/31/2010 06:48 AM
 On 03/31/2010 01:41 PM, Henryk Cichy wrote:
   Dear Sir,
  
   I would like to start programming using PHP,Apatche and MySql but I
   couldn't start PHP.
   I installed Apache v.2.2.15 ( directory c:\apatche2.2). It works.
   I installed PHP 5.2.13 for Windows to directory c:/php and add :
  
   PHPIniDir = c:/php/
   LoadModule php5_module c:/php/php5apache2_2.dll
   AddType application/x-httpd-php .php
  
   to httpd.conf.After this change, the service of Apatche couldn't start.
   I get error: service specific error code nr 1.
  
   According to install.txt , I should use php.ini-production ( or
   php.ini-development) for php.ini .
   Unfortunatelly, there are only php.ini-recommended and
   php.ini-dist files (maybe you should change install.txt file). I
   copied php.ini-recommended to php.ini file and add line:
   doc_root = c:/apatche2.2/htdocs
  
   I also added path c:\php to windows enviromnent path and copied
   php.ini and copied this file and php5ts.dll to Windows\System32
   catalog.
   This all I can do.
   I use Windows XP Services Pack 2 or 3 (2 computers).
  
   Henryk.

 I think you need to put the PHPIniDir directive after the LoadModule
 one. Try it out.

 --
 Nilesh Govindarajan
 Site  Server Administrator
 www.itech7.com
    !
 ?? : ??  !


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


Don't know about the install list but since you've problems on Windows
platform, try the windows list.  As for Apache error upon service
start, look at the Apache log ;)

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



Re: [PHP] MySQL query not working!

2010-03-31 Thread Andrew Ballard
On Wed, Mar 31, 2010 at 9:08 AM, Andrew Ballard aball...@gmail.com wrote:
 Nope. All it does is suppress the error message. Just try it:

 ?php

 @mysql_connect('localhost', 'baduser', 'badpassword') or die('Could
 not connect');

 ?

 Output:
 Could not connect
 ?php

 @mysql_connect('localhost', 'baduser', 'badpassword') or die('Could
 not connect');

 ?

 Output:
 br /
 bWarning/b:  mysql_connect() [a
 href='function.mysql-connect'function.mysql-connect/a]: Can't
 connect to MySQL server on 'localhost' (10061) in bPHPDocument1/b
 on line b3/bbr /
 Could not connect

 Andrew


OK, for the sake of the archives, I wish there was an EDIT feature
to this list. Copy/paste will get you every time; or, Insanity: doing
the same thing over and over again and expecting different results.
:-)

At any rate, the point I was TRYING to make is correct, even if the
example wasn't quite right.

Andrew

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



Re: [PHP] Audiobooks for Developers

2010-03-31 Thread Tommy Pham
On Wed, Mar 31, 2010 at 6:02 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
 On Wed, 2010-03-31 at 15:01 +0200, Auto-Deppe C. Hänsel wrote:

  -Original Message-
  From: Bob McConnell [mailto:r...@cbord.com]
  Sent: Wednesday, March 31, 2010 2:52 PM
  To: php-general@lists.php.net
  Subject: RE: [PHP] Audiobooks for Developers
 
  From: Auto-Deppe C. Hänsel
 
   since I am driving 2 hrs each day listening to either my
   radio or the songs
   on my USB drive, I was wondering whether there are some
   web dev related
   audio books for download out there.
 
  I have only one recommendation. DON'T DO IT!
 
  Driving a vehicle on public highways is dangerous enough without any
 significant
  distractions. You don't want to complicate it by adding a task that tempts
 you to
  focus on something other than the road, signals and other traffic. That is
 a good
  way to cause accidents.
 
  Bob McConnell
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php


 Hi Bob,

 thanks for your advide, I understand your concern. I honestly do.

 Let me show you quickly the route I am driving every day:
 http://maps.google.de/maps?f=dsource=s_dsaddr=helpupdaddr=extertalhl=de;
 geocode=Fb3-GAMdIuyEACmdszYJpEC6RzERLZJMgvInJg%3BFetyGgMdDjuLACn7EwcOCWG6RzF
 39JiIvP5PLAmra=lssll=51.151786,10.415039sspn=20.175322,57.084961ie=UTF8
 t=hz=12

 In the morning, it is SO boring I leave home at 5:30am, so not much
 traffic going on.

 In the afternoon, there is no way of driving fast enough to cause an
 accident *haha*

 Seriously though: I am always listening to audio books or the radio... but I
 do focus on the traffic rather than the audio. Believe me, I understand your
 concern. But still: I want audio books :o))

 Chris




 There is also the learning technique of listening to audio books whilst
 sleeping. Not sure if I hold too much truck with that, but it's an
 option!


I think you're referring to subliminal learning.  Time to program that
subconscious :))

 There are a lot of books offered online in PDF format (I believe
 O'Reilly do this a lot) which can be ready out by lots of different
 audio software, including Acrobats own PDF reader.

 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] Audiobooks for Developers

2010-03-31 Thread Teus Benschop
On Wed, 2010-03-31 at 06:54 -0700, Tommy Pham wrote:
  There is also the learning technique of listening to audio books whilst
  sleeping. Not sure if I hold too much truck with that, but it's an
  option!

In the past while we were on the road there were no telephone calls and
we could enjoy some rest. Then the cell phones came along. Gone was the
rest on the road. Now, while we sleep, we had some rest. Along comes the
learning while sleeping! Gone is our rest at home. ;) Teus.

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



[PHP] PHP GUI library/package

2010-03-31 Thread Pete Ford

Hi All,

I have a web project built in PHP which we want to break out part of into a 
stand-alone GUI program. The architecture is fine - display nicely separated 
from logic, so coding is not a problem.
What I can't work out is what to use for the GUI part. I looked at phpqt but I 
can't (yet) get that to build on my Linux dev system, let alone code an 
interface with it. I was also looking a PHP-GTK2, but I'm not sure how 
cross-platform it would be - this should run on Windows and Macs as well as Linux...


Anyone made a GUI PHP application like this, with one of the major toolkits?

Cheers
Pete

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



Re: [PHP] PHP GUI library/package

2010-03-31 Thread Ashley Sheridan
On Wed, 2010-03-31 at 15:30 +0100, Pete Ford wrote:

 Hi All,
 
 I have a web project built in PHP which we want to break out part of into a 
 stand-alone GUI program. The architecture is fine - display nicely separated 
 from logic, so coding is not a problem.
 What I can't work out is what to use for the GUI part. I looked at phpqt but 
 I 
 can't (yet) get that to build on my Linux dev system, let alone code an 
 interface with it. I was also looking a PHP-GTK2, but I'm not sure how 
 cross-platform it would be - this should run on Windows and Macs as well as 
 Linux...
 
 Anyone made a GUI PHP application like this, with one of the major toolkits?
 
 Cheers
 Pete
 


I think as far as compatibility goes, QT is your best bet. What is
preventing you from getting that build onto your dev system?

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




Re: [PHP] PHP GUI library/package

2010-03-31 Thread Pete Ford

On 31/03/10 15:30, Ashley Sheridan wrote:

On Wed, 2010-03-31 at 15:30 +0100, Pete Ford wrote:


Hi All,

I have a web project built in PHP which we want to break out part of into a
stand-alone GUI program. The architecture is fine - display nicely separated
from logic, so coding is not a problem.
What I can't work out is what to use for the GUI part. I looked at phpqt but I
can't (yet) get that to build on my Linux dev system, let alone code an
interface with it. I was also looking a PHP-GTK2, but I'm not sure how
cross-platform it would be - this should run on Windows and Macs as well as 
Linux...

Anyone made a GUI PHP application like this, with one of the major toolkits?

Cheers
Pete




I think as far as compatibility goes, QT is your best bet. What is
preventing you from getting that build onto your dev system?

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




Two pints at lunchtime, mainly :)

I need to focus on it a bit better: I'll have another look and ask again if I 
still have trouble.


Cheers
Pete

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



Re: [PHP] PHP GUI library/package

2010-03-31 Thread Richard Quadling
On 31 March 2010 15:48, Pete Ford p...@justcroft.com wrote:
 Two pints at lunchtime, mainly :)

Excellent reason to not do any coding today.

Makes tomorrow less of a revert commit day.



-- 
-
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=ZEND002498r=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] PHP GUI library/package

2010-03-31 Thread Pete Ford

On 31/03/10 15:30, Ashley Sheridan wrote:

On Wed, 2010-03-31 at 15:30 +0100, Pete Ford wrote:


Hi All,

I have a web project built in PHP which we want to break out part of into
a stand-alone GUI program. The architecture is fine - display nicely
separated from logic, so coding is not a problem. What I can't work out is
what to use for the GUI part. I looked at phpqt but I can't (yet) get that
to build on my Linux dev system, let alone code an interface with it. I was
also looking a PHP-GTK2, but I'm not sure how cross-platform it would be -
this should run on Windows and Macs as well as Linux...

Anyone made a GUI PHP application like this, with one of the major
toolkits?

Cheers Pete




I think as far as compatibility goes, QT is your best bet. What is preventing
you from getting that build onto your dev system?

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





Not all down to the beer.
I unpacked the php-qt-0.9.tar.gz and made a build directory in there, ran cmake
(which seemed to go OK), but make fails at
[  8%] Building CXX object smoke/qt/CMakeFiles/smokeqt.dir/x_2.o

with a bunch of errors like

/home/pete/phpqt/build/smoke/qt/x_2.cpp: In static member function ‘static void
x_QAccessibleBridgeFactoryInterface::x_0(Smoke::StackItem*)’:
/home/pete/phpqt/build/smoke/qt/x_2.cpp:167: error: cannot allocate an object of
abstract type ‘x_QAccessibleBridgeFactoryInterface’
/home/pete/phpqt/build/smoke/qt/x_2.cpp:163: note:   because the following
virtual functions are pure within ‘x_QAccessibleBridgeFactoryInterface’:
/usr/include/QtCore/qfactoryinterface.h:53: note:   virtual QStringList
QFactoryInterface::keys() const


I'm building on an OpenSuSE 11.1 system, but looking around it seems that Fedora 
12 has a php-qt package, so I'm putting together a VM to try it on there...


If you have any light to shed, then let me know. The php-qt mailing list seems a 
bit empty at the moment...


Cheers
Pete

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



Re: [PHP] PHP GUI library/package

2010-03-31 Thread Ashley Sheridan
On Wed, 2010-03-31 at 16:48 +0100, Pete Ford wrote:

 On 31/03/10 15:30, Ashley Sheridan wrote:
  On Wed, 2010-03-31 at 15:30 +0100, Pete Ford wrote:
 
  Hi All,
 
  I have a web project built in PHP which we want to break out part of into
  a stand-alone GUI program. The architecture is fine - display nicely
  separated from logic, so coding is not a problem. What I can't work out is
  what to use for the GUI part. I looked at phpqt but I can't (yet) get that
  to build on my Linux dev system, let alone code an interface with it. I was
  also looking a PHP-GTK2, but I'm not sure how cross-platform it would be -
  this should run on Windows and Macs as well as Linux...
 
  Anyone made a GUI PHP application like this, with one of the major
  toolkits?
 
  Cheers Pete
 
 
 
  I think as far as compatibility goes, QT is your best bet. What is 
  preventing
  you from getting that build onto your dev system?
 
  Thanks, Ash http://www.ashleysheridan.co.uk
 
 
 
 
 Not all down to the beer.
 I unpacked the php-qt-0.9.tar.gz and made a build directory in there, ran 
 cmake
 (which seemed to go OK), but make fails at
 [  8%] Building CXX object smoke/qt/CMakeFiles/smokeqt.dir/x_2.o
 
 with a bunch of errors like
 
 /home/pete/phpqt/build/smoke/qt/x_2.cpp: In static member function ‘static 
 void
 x_QAccessibleBridgeFactoryInterface::x_0(Smoke::StackItem*)’:
 /home/pete/phpqt/build/smoke/qt/x_2.cpp:167: error: cannot allocate an object 
 of
 abstract type ‘x_QAccessibleBridgeFactoryInterface’
 /home/pete/phpqt/build/smoke/qt/x_2.cpp:163: note:   because the following
 virtual functions are pure within ‘x_QAccessibleBridgeFactoryInterface’:
 /usr/include/QtCore/qfactoryinterface.h:53: note:   virtual QStringList
 QFactoryInterface::keys() const
 
 
 I'm building on an OpenSuSE 11.1 system, but looking around it seems that 
 Fedora 
 12 has a php-qt package, so I'm putting together a VM to try it on there...
 
 If you have any light to shed, then let me know. The php-qt mailing list 
 seems a 
 bit empty at the moment...
 
 Cheers
 Pete
 


Sorry, about the closest I've got to QT is probably to use some apps
that use it. It's one of those things that I thought would be nice to
play with if I had the time, but never had the time!

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




Re: [PHP] MySQL query not working!

2010-03-31 Thread tedd

At 4:20 PM +0430 3/31/10, Parham Doustdar wrote:

Hi there,
Here is a snippet of code... that doesn't work for some reason. Please note
that I have put some

@mysql_query($query) or die(mysql_error());

statements, to see if MySQL gives an error. I receive nothing other than the
file starting to download. This is supposed to be a file download counter:

[code]
?php
//connect to the DB
mysql_connect() //There is no problem with the connection so I didn't
include the complete code.

//The table where the hits are stored.
$table = files;

$query = select * from  . $table .  where filename = ' . $_GET['file'] .
';
$result = mysql_query($query);

if ($result) //Has the file previously been added?
{
$query = update  . $table .  set hits = hits + 1 where filename = ' .
$_GET['file'] . ';
@mysql_query($query) or die(mysql_error());
header('location:http://www.qwitter-client.net/' . $_GET['file']);
}
else //it's the first time we're adding this file to the DB.
{
$query = insert into  . $table .  (filename, hits) values (' .
$_GET['file'] . ', 1);
@mysql_query($query) or die(mysql_error());
header('location:http://www.qwitter-client.net/' . $_GET['file']);
}


Hi Parham:

Considering that no one made comment, let me say that using $_GET in 
such a fashion is dangerous. One should always clean/scrub all 
variables that makeup a db query.


Doing what you did above is opening your database to possible SQL 
injection. This is not a secure thing to do.


For example, let's say I provide the following string to your form (first GET):

anything OR '1' = '1'; DROP TABLE customers

If your database configuration allows for multiple statements, then 
any table named customers would be immediately dropped from your 
database. I'm sure you can see how you would not want to allow 
someone to drop tables from your database. In short, never trust 
anything coming from client-side.


Here's a reference on the subject:

http://en.wikipedia.org/wiki/SQL_injection

There are many others.

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] Something wrong with the PHP-INSTALL list ?

2010-03-31 Thread Daniel Brown
On Wed, Mar 31, 2010 at 06:50, Nilesh Govindarajan li...@itech7.com wrote:
 Any replies I send to PHP-INSTALL list, I get the follow response:
 Any ideas why this is happening ?

  Original Message 
 Subject:        Re: [PHP-INSTALL] installation problem with php and Apache
 [Incident:100331-000506]
 Date:   Wed, 31 Mar 2010 06:48:44 -0400 (EDT)
 From:   Abuse Department postab...@mailca.custhelp.com
 Reply-To:       Abuse Department postab...@mailca.custhelp.com
 To:     li...@itech7.com

This happens when someone is too lazy to unsubscribe.  They
forward messages to an abuse address instead.  It's happened a few
times over the years, and it's a severe pain in the butt for
legitimate subscribers.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Looking for hosting or dedicated servers?  Ask me how we can fit your budget!

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



Re: [PHP] PHP GUI library/package

2010-03-31 Thread tedd

At 4:45 PM +0100 3/31/10, Ashley Sheridan wrote:

On Wed, 2010-03-31 at 16:48 +0100, Pete Ford wrote:
-snip-
  If you have any light to shed, then let me know. The php-qt 
mailing list seems a

 bit empty at the moment...

 Cheers
 Pete




Sorry, about the closest I've got to QT is probably to use some apps
that use it. It's one of those things that I thought would be nice to
play with if I had the time, but never had the time!

Thanks,
Ash


Pete:

You're not the only one who would like to know how to do this.

I work on a Mac and I would very much like to create a stand-alone 
application from my php scripts, but I am clueless as to how to do 
this.


If anyone has done this on a Mac, I would be very interested in 
knowing how you did it.


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



[PHP] I'm a newbie and running php on Linux

2010-03-31 Thread King Coffee

Hi,

I ran the following code snippet on Windows IIS 7, in my index.php file and 
it worked fine. But when run it on Linux, the die code is executed.


Is there an include file or something else I need to to process this on a 
linux server?


?php
echo 'h1Redirecting... Please Wait/h1';
/*
redirect('welcome.html');
*/
if (!headers_sent()) {
header('Location: ' . 'http://auction.househops.com/index.php');
} else {
die('Could not redirect.');
}
?


Thanks,
King 



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



Re: [PHP] I'm a newbie and running php on Linux

2010-03-31 Thread jose javier parra sanchez
Check your php.ini , look for output_buffering

2010/3/31 King Coffee kcof...@hotmail.com:
 Hi,

 I ran the following code snippet on Windows IIS 7, in my index.php file and
 it worked fine. But when run it on Linux, the die code is executed.

 Is there an include file or something else I need to to process this on a
 linux server?

 ?php
        echo 'h1Redirecting... Please Wait/h1';
 /*
        redirect('welcome.html');
 */
        if (!headers_sent()) {
                header('Location: ' .
 'http://auction.househops.com/index.php');
        } else {
                die('Could not redirect.');
        }
 ?


 Thanks,
 King

 --
 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] I'm a newbie and running php on Linux

2010-03-31 Thread Ashley Sheridan
On Wed, 2010-03-31 at 11:32 -0500, King Coffee wrote:

 Hi,
 
 I ran the following code snippet on Windows IIS 7, in my index.php file and 
 it worked fine. But when run it on Linux, the die code is executed.
 
 Is there an include file or something else I need to to process this on a 
 linux server?
 
 ?php
   echo 'h1Redirecting... Please Wait/h1';
 /*
   redirect('welcome.html');
 */
   if (!headers_sent()) {
   header('Location: ' . 'http://auction.househops.com/index.php');
   } else {
   die('Could not redirect.');
   }
 ?
 
 
 Thanks,
 King 
 
 


This should never ever redirect. You've got an echo statement as your
first line of code. Once output has been sent to the browser, PHP cannot
send a redirect header, as the default ones get sent with the output.

I think maybe you'd need a Javascript redirect here, but that comes with
a warning that you cannot rely on everyone to have Javascript available
or enabled on their browser. People do turn it off, people do use
plugins such as NoScript, some routers have been known to strip
Javascript from web pages and not ever browser supports all Javascript
(think text browsers, speech and Braille browsers, etc)

Why do you need to echo out a message to the user that the browser is
redirecting anyway? A header redirect will be seamless and the user
shouldn't even notice anything happening except for the URL changing.

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




[PHP] php 5.3.2 Unable to fork

2010-03-31 Thread Eduardo Nunes

Hello people!

A time before I had issues with my php 5.2.3 that would not fork anything, 
neither in shell or via apache, and I figured out that commenting out the 
snmp.so extension from php.ini made it fork commands passed to php cli with 
an unprivileged user (www) fine, however apache still would not fork 
anything.


Now I just compiled 5.3.2 and it doesn't fork at all, neither as root 
with -n option.


For example I am running:
r...@saturno:/usr/src/apache/php-5.3.2# ./sapi/cli/php -n -r 'echo 
shell_exec(echo Test!);'
Warning: shell_exec(): Unable to execute 'echo Test!' in Command line code 
on line 1


(neither system, exec, other options work)

Any ideas on what is going on?

(compiled using 
../configure --prefix=/usr --with-apxs2 --disable-cgi --disable-short-tags --disable-ipv6 
--without-sqlite3 --with-mysql --with-pdo-mysql --without-pdo-sqlite --enable-sockets 
--without-sqlite --with-gnu-ld)


Thanks 



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



[PHP] scripts never fork: Unable to fork

2010-03-31 Thread Eduardo Nunes

Hi!

I am having this issue on my Apache 2.2.13 webserver running PHP 5.2.3 on a
Kernel 2.6.30.4 Linux Box.

error_log:
[Sat Mar 20 23:41:34 2010] [error] [client 127.0.0.1] PHP Warning:  exec()
[a href='function.exec'function.exec/a]: Unable to fork [cat
/proc/loadavg] in /server/apache/htdocs/test.php on line 3

The code of test.php is ?php echo exec( 'cat /proc/loadavg' ); ?

Replacing the exec() for system() or shell_exec() or any other program
execution function is not working.

Running the command line $ php test.php as the apache user works fine.

All usual php pages (foruns, phpmysqladmin, phpinfo, etc) works great,
except for the fork functions.

Ideas and help are welcome,

Thank you!

Eduardo Nunes


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



Re: [PHP] PHP GUI library/package

2010-03-31 Thread Teus Benschop
On Wed, 2010-03-31 at 12:23 -0400, tedd wrote:
 I work on a Mac and I would very much like to create a stand-alone 
 application from my php scripts, but I am clueless as to how to do 
 this.
 
 If anyone has done this on a Mac, I would be very interested in 
 knowing how you did it.

There could be some approaches to the problem of creating a stand-along
application out of a working PHP web application. Some would involve
more and others less work. The way we do it is to enable the built-in
Apache server on the Mac, get PHP on it, and then install the web
application on localhost, and run it from there through the browser. It
is less work this way since the PHP code runs as it is, without making
any modification. The other advantage is that since many users are used
to the point and click interface of web based applications, they
possibly get used to your application soon. Teus.

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



Re: [PHP] I'm a newbie and running php on Linux

2010-03-31 Thread Nathan Rixham
Ashley Sheridan wrote:
 On Wed, 2010-03-31 at 11:32 -0500, King Coffee wrote:
 
 Hi,

 I ran the following code snippet on Windows IIS 7, in my index.php file and 
 it worked fine. But when run it on Linux, the die code is executed.

 Is there an include file or something else I need to to process this on a 
 linux server?

 ?php
  echo 'h1Redirecting... Please Wait/h1';
 /*
  redirect('welcome.html');
 */
  if (!headers_sent()) {
  header('Location: ' . 'http://auction.househops.com/index.php');
  } else {
  die('Could not redirect.');
  }
 ?


 Thanks,
 King 


 
 
 This should never ever redirect. You've got an echo statement as your
 first line of code. Once output has been sent to the browser, PHP cannot
 send a redirect header, as the default ones get sent with the output.

problem is very very simple; simply swap the code order

?php
// add in logic if you want
header('Location: ' . 'http://auction.househops.com/index.php');
echo 'h1Redirecting... Please Wait/h1';
?

but please expand including a link to where you are redirecting too.

The apache default pages are very very good and include the status
(+code) and a short note:
302 Found
The resource you requested has been found here-link

note: that's not the exact text, but you get the idea.

 I think maybe you'd need a Javascript redirect here, but that comes with
 a warning that you cannot rely on everyone to have Javascript available
 or enabled on their browser. People do turn it off, people do use
 plugins such as NoScript, some routers have been known to strip
 Javascript from web pages and not ever browser supports all Javascript
 (think text browsers, speech and Braille browsers, etc)

no no no; (sorry ash) but HTTP is there for a reason and it accommodates
everything we need + can be used for *any* file (how do you javascript
redirect an image for instance) - all catered for.

always remember that the web is built on http  hypermedia (media w/
links); it's the whole reason we have a web, is the web and works v well.

also worth noting that apache foundation formed by roy t fielding, same
man who wrote rest, which is the model for http, and check the name at
the top of http, roy again; he's put in tonnes of work and guidance to
the full net, and of course apache http server itself - when in doublt
just copy apache and read the rfc + dissertation.

 Why do you need to echo out a message to the user that the browser is
 redirecting anyway? A header redirect will be seamless and the user
 shouldn't even notice anything happening except for the URL changing.

because user agents MAY redirect, they don't have to - and when its a
post or such like they may want to make the choice of whether to proceed
or not; likewise from https to http and so forth.

http rfc is pretty clear that with every 3xx  4xx status could you
should give a reason as to why and also give possible actions the user
an take next - preferably as hypermedia links to make it properly resftul.

307 Temporary redirect, redirecting you to  click the link if you
are not automatically redirected.

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



Re: [PHP] Newbie Question about Conditionals

2010-03-31 Thread Matty Sarro
After looking up the === operator, I see exactly what you mean. Thanks for
your help everyone. I think the confusion was that I was always under the
impression that assignment is either true or false; I would never have
guessed it was equal to the value assigned. Your examples really helped to
solidify the concept though!

PS: I have to say that PHP has the *best* documentation I've ever seen
beside Java.

Thanks again!

On Wed, Mar 31, 2010 at 4:43 AM, Richard Quadling
rquadl...@googlemail.comwrote:

 On 31 March 2010 05:45, Matty Sarro msa...@gmail.com wrote:
  That explains it perfectly, thanks you!
 
  On Wed, Mar 31, 2010 at 12:40 AM, Tommy Pham tommy...@gmail.com wrote:
 
  On Tue, Mar 30, 2010 at 9:22 PM, Matty Sarro msa...@gmail.com wrote:
   Hey all!
   This is probably my second post on the list, so please be gentle.
 Right
  now
   I am running through the Heads First PHP and MySQL book from
 O'Reilly.
   It's been quite enjoyable so far, but I have some questions about some
 of
   the code they're using in one of the chapters.
  
   Basically the code is retreiving rows from a DB, and I'm just not
 getting
   the explanation of how it works.
  
   Here's the code:
  
   $result=mysqli_query($dbc,$query)
  
   while($row=mysqli_fetch_array($result)){
   echo $row['first_name'].' '.$row['last_name'].' : '. $row['email'] .
 'br
   /';
   }
  
   Now, I know what it does, but I don't understand how the conditional
   statement in the while loop works. Isn't an assignment operation
 always
   going to result in a true condition? Even if
  mysqli_fetch_array($result)
   returned empty values (or null) wouldn't the actual assignment to $row
  still
   be considered a true statement? I would have sworn that assignment
   operations ALWAYS equated to true if used in conditional operations.
   Please help explain! :)
  
   Thanks so much!
   -Matty
  
 
  http://www.php.net/manual/en/function.mysql-fetch-array.php
 
  Returns an array of strings that corresponds to the fetched row, or
  FALSE  if there are no more rows.
 
  while($row=mysqli_fetch_array($result)) is equivalent to this:
 
  $row=mysqli_fetch_array($result);
  while ($row){
 
  // do something
 
  $row=mysqli_fetch_array($result);
  }
 
  So, if $row is not equal to FALSE, the loop will happens.
 
 

 Another part to the answer is the value of the assignment. From the
 documentation (
 http://docs.php.net/manual/en/language.operators.assignment.php),
 ...

 The value of an assignment expression is the value assigned.

 while($row = mysqli_fetch_array($result))


 But there is a significant issue here. Whilst not attributable to the
 mysqli_fetch_array() function, it is certainly possible to give
 yourself a significant WTF moment with it.


 May be will be easier to see the problem when the code is written as ...

 while(False === ($row = mysqli_fetch_array($result)))

 No?


 If I say ...

 0 == False

 does that help?



 Without running the 2 stupid scripts  below, what output should you get?

 ?php while($pos = strpos('abc', 'a')) { echo 'a';} ?

 and

 ?php while($pos = strpos('abc', 'z')) { echo 'z';} ?

 Clearly, they should be different, yes?

 Unfortunately, they won't be.

 The first call returns 0 and the second returns False.

 And as 0 == False, the while() does not loop.

 But ...

 ?php while(False !== ($pos = strpos('abc', 'a'))) { echo 'a';} ?

 and

 ?php while(False !== ($pos = strpos('abc', 'z'))) { echo 'z';} ?

 now operate correctly. The first one runs forever, printing a's and
 the second one quits straight away.

 By always using ...

 while(False !== ($var = function($param)))

 you can clearly differentiate between functions that return false to
 indicate failure and 0 to indicate a position or actual value.

 Regards,

 Richard.





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



[PHP] Re: Newbie Question about Conditionals

2010-03-31 Thread Shawn McKenzie
Matty Sarro wrote:
 Hey all!
 This is probably my second post on the list, so please be gentle. Right now
 I am running through the Heads First PHP and MySQL book from O'Reilly.
 It's been quite enjoyable so far, but I have some questions about some of
 the code they're using in one of the chapters.
 
 Basically the code is retreiving rows from a DB, and I'm just not getting
 the explanation of how it works.
 
 Here's the code:
 
 $result=mysqli_query($dbc,$query)
 
 while($row=mysqli_fetch_array($result)){
 echo $row['first_name'].' '.$row['last_name'].' : '. $row['email'] . 'br
 /';
 }
 
 Now, I know what it does, but I don't understand how the conditional
 statement in the while loop works. Isn't an assignment operation always
 going to result in a true condition? Even if mysqli_fetch_array($result)
 returned empty values (or null) wouldn't the actual assignment to $row still
 be considered a true statement? I would have sworn that assignment
 operations ALWAYS equated to true if used in conditional operations.
 Please help explain! :)
 
 Thanks so much!
 -Matty
 

Others have explained in detail, but I will tell you why you and many
beginners may have been confused by this.  On this list as well as in
other help sites for PHP, beginners post code that contains something
like this, and wonder why it always echoes TRUE:

$value = 'bob';

if($value = 'test') {
echo 'TRUE';
} else {
echo 'FALSE';
}

They normally get an answer such as:  You need to use == for
comparison, = is an assignment operator and the assignment will always
evaluate to true.  Well, this is true for this assignment because the
non-empty string 'test' evaluates to true.  But without explanation it
may sound as though ANY assignment will evaluate to true just because
the actual assignment itself was successful. This is obviously not the
case. This echoes FALSE:

$value = 'bob';

if($value = '') {
echo 'TRUE';
} else {
echo 'FALSE';
}


-- 
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] Something wrong with the PHP-INSTALL list ?

2010-03-31 Thread Nilesh Govindarajan

On 03/31/10 19:14, Tommy Pham wrote:

On Wed, Mar 31, 2010 at 3:50 AM, Nilesh Govindarajanli...@itech7.com  wrote:

Any replies I send to PHP-INSTALL list, I get the follow response:
Any ideas why this is happening ?

 Original Message 
Subject:Re: [PHP-INSTALL] installation problem with php and Apache
[Incident:100331-000506]
Date:   Wed, 31 Mar 2010 06:48:44 -0400 (EDT)
From:   Abuse Departmentpostab...@mailca.custhelp.com
Reply-To:   Abuse Departmentpostab...@mailca.custhelp.com
To: li...@itech7.com



* Response*

** This is an automated reply to your message to Email Abuse.
**

Your message has been delivered to our email abuse department. This
department handles complaints from users that are receiving unwanted
email. We try our best to investigate all reports of abuse. If we
determine that the email you reported was in fact sent from an email
address at one of our domains, or by way of computers operated by us, we
will take the appropriate action.

If you did not include the original message headers along with your
message, please do so by replying to this message, leaving the subject
line intact (which contains our tracking identification), and including
all email headers. Email headers show specific details regarding the
source provider, path, originating program, and destination of the
message which is not shown within the TO: and FROM: address fields of
the email.

Unfortunately, spammers use a variety of techniques to mask an email's
actual point of origin, such as by forging information to make it appear
as though the email originated from a domain that is well recognized
across the Internet. Accordingly, the information in the header is very
helpful in assisting us in our investigation.

We regret any inconvenience this may have caused and appreciate you
bringing this matter to our attention.

Regards,

The Email Abuse Department


* Discussion Thread*
* Customer (Nilesh Govindarajan)*   03/31/2010 06:48 AM
On 03/31/2010 01:41 PM, Henryk Cichy wrote:
Dear Sir,
  
I would like to start programming using PHP,Apatche and MySql but I
couldn't start PHP.
I installed Apache v.2.2.15 ( directory c:\apatche2.2). It works.
I installed PHP 5.2.13 for Windows to directory c:/php and add :
  
PHPIniDir = c:/php/
LoadModule php5_module c:/php/php5apache2_2.dll
AddType application/x-httpd-php .php
  
to httpd.conf.After this change, the service of Apatche couldn't start.
I get error: service specific error code nr 1.
  
According to install.txt , I should use php.ini-production ( or
php.ini-development) for php.ini .
Unfortunatelly, there are only php.ini-recommended and
php.ini-dist files (maybe you should change install.txt file). I
copied php.ini-recommended to php.ini file and add line:
doc_root = c:/apatche2.2/htdocs
  
I also added path c:\php to windows enviromnent path and copied
php.ini and copied this file and php5ts.dll to Windows\System32
catalog.
This all I can do.
I use Windows XP Services Pack 2 or 3 (2 computers).
  
Henryk.

I think you need to put the PHPIniDir directive after the LoadModule
one. Try it out.

--
Nilesh Govindarajan
Site  Server Administrator
www.itech7.com
   !
?? : ??  !


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



Don't know about the install list but since you've problems on Windows
platform, try the windows list.  As for Apache error upon service
start, look at the Apache log ;)


No I don't have any problems. I was replying to one's problem.

--
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] Something wrong with the PHP-INSTALL list ?

2010-03-31 Thread Nilesh Govindarajan

On 03/31/10 21:43, Daniel Brown wrote:

On Wed, Mar 31, 2010 at 06:50, Nilesh Govindarajanli...@itech7.com  wrote:

Any replies I send to PHP-INSTALL list, I get the follow response:
Any ideas why this is happening ?

 Original Message 
Subject:Re: [PHP-INSTALL] installation problem with php and Apache
[Incident:100331-000506]
Date:   Wed, 31 Mar 2010 06:48:44 -0400 (EDT)
From:   Abuse Departmentpostab...@mailca.custhelp.com
Reply-To:   Abuse Departmentpostab...@mailca.custhelp.com
To: li...@itech7.com


 This happens when someone is too lazy to unsubscribe.  They
forward messages to an abuse address instead.  It's happened a few
times over the years, and it's a severe pain in the butt for
legitimate subscribers.



Damn those idiots.

--
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] Re: using UID in DB

2010-03-31 Thread tedd

At 5:56 PM -0700 3/30/10, Tommy Pham wrote:

On Tue, Mar 30, 2010 at 2:27 PM, Nathan Rixham nrix...@gmail.com wrote:


 nope never been able to find any significant advantage; and thus ended
 up using http uri's in my own domain space(s) which are always
 guaranteed to be unique as I'm issuing them. bonus is that they can be
 dereferenced and server as both a universal (resource) identifier and a
 locater.

 ps: resource = anything that can be named.



Hi Nathan,

I'm interested in hearing your technique of generating your own uuid
if you don't mind sharing :).  I'm building a project to test my idea
about search engine and testing of different RDBMSes.  So naturally,
it (the app) would crawl the net and I'd have over a 1 billion rows.

Thanks,
Tommy

PS: Here are some info for those who haven't heard of UUID/GUID:

http://affy.blogspot.com/2003/03/why-use-uuid-values.html
http://www.mysqlperformanceblog.com/2007/03/13/to-uuid-or-not-to-uuid/



I've read your links and see the problem presented.

The solution is to create an absolutely unique user ID and therein 
lies the problem. How do you create something that is absolutely 
unique?


Clearly, if you have one database creating records, an auto_increment 
will work for creating an unique number for that's what increment 
does.  However, if you have more than one database creating records 
at the same time, then conflicts would occur.


I had a similar problem recently where I used two fields to identify 
a record as being unique. One field used the exact time the record 
was added to the database and the other field was a random number. 
Combining the two numbers I believed I had a unique number for the 
taks I was doing. Of course, if activity was spread across hundreds 
of servers with millions of entries per second, then my method would 
not be a solution. As such, the solution should be tailored to the 
problem.


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] Re: using UID in DB

2010-03-31 Thread Tommy Pham
On Wed, Mar 31, 2010 at 4:06 AM, Nathan Rixham nrix...@gmail.com wrote:
 Tommy Pham wrote:

 As for spatial data types, I've never find much use for non scientific
 related.  (example) If using point as a PK, if MySQL stores it the
 same way as PostgreSQL which is 16 bytes, how is that any different -
 performance wise - than using UUID and storing it as binary(16) for
 MySQL or uniqueidentifier (16 bytes) for PostgreSQL?


 it's all about the indexing (R-Tree)

 http://en.wikipedia.org/wiki/R-tree


I can see where the performance would be between B-Tree vs R-Tree for
the same field size but I've yet to see real life application of it.
Case in point, if using point for GPS data coordinates, then wouldn't
it still be a lot better to use Lon (float), Lat (float) which is 2
fields of 4 bytes each vs 1 field of 16 bytes?  The index would still
be faster (8 bytes less) in B-Tree right?  Not to mention smaller row
 DB size.  As for calculating the distance between 2 'points', it
would be simpler for querying purposes to use 'point'.  ATM, I don't
have need to do any such calculations.  If I do use 'point' for PK,
I'd run into problems with scaling and migration later.

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



Re: [PHP] Something wrong with the PHP-INSTALL list ?

2010-03-31 Thread Tommy Pham
On Wed, Mar 31, 2010 at 10:24 AM, Nilesh Govindarajan li...@itech7.com wrote:
 No I don't have any problems. I was replying to one's problem.


My mistake :)

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



Re: [PHP] Re: using UID in DB

2010-03-31 Thread Nathan Rixham
Tommy Pham wrote:
 On Wed, Mar 31, 2010 at 4:06 AM, Nathan Rixham nrix...@gmail.com wrote:
 Tommy Pham wrote:
 As for spatial data types, I've never find much use for non scientific
 related.  (example) If using point as a PK, if MySQL stores it the
 same way as PostgreSQL which is 16 bytes, how is that any different -
 performance wise - than using UUID and storing it as binary(16) for
 MySQL or uniqueidentifier (16 bytes) for PostgreSQL?

 it's all about the indexing (R-Tree)

 http://en.wikipedia.org/wiki/R-tree

 
 I can see where the performance would be between B-Tree vs R-Tree for
 the same field size but I've yet to see real life application of it.
 Case in point, if using point for GPS data coordinates, then wouldn't
 it still be a lot better to use Lon (float), Lat (float) which is 2
 fields of 4 bytes each vs 1 field of 16 bytes?  The index would still
 be faster (8 bytes less) in B-Tree right?  Not to mention smaller row
  DB size.

wish I still had an application to point you at; and I can't assert in
any other way just how much faster it is; especially over large datasets
- regardless of the amount of rows the style of index doesn't slow
(spatial) queries down.

if index byte size is of importance then negate spatial indexes (which
are rather a lot bigger).

regardless though, it was just an idea I was throwing at you, not
suggesting it's the best approach, but worth consideration depending on
your priorities.

  As for calculating the distance between 2 'points', it
 would be simpler for querying purposes to use 'point'.  ATM, I don't
 have need to do any such calculations.  If I do use 'point' for PK,
 I'd run into problems with scaling and migration later.

the points don't matter tbh; or should i say specifying an x and a y
doesn't matter, because you can simply get by a single id, or get a
range of ids very quickly; the other value comes in to play when you
want temporal queries.

again though, i reiterate only useful if you want speed and don't care
about index bytesize - and certainly not forcing it down your neck.

re scaling.. unsure theoretically you have 15 digit precision which is a
mysql DOUBLE/REAL, and that's for each value in the pair, so an almost
incomprehensible number of rows are possible before a collision.

all in all: there are many good reasons why I've only used this on
occassion (specifically when dealing with 1 million+ rows in an RDBMS
table); and many more good reasons why i stick to non-rdbms databases
and use http uri's + eav model data only nowadays.

The latter i would advocate, the former not so unless you are stuck w/
mysql postgres - in which case you can't get faster. [1]

[1] get some numbers to prove when i have time.

Nathan

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



Re: [PHP] Re: using UID in DB

2010-03-31 Thread Tommy Pham
On Wed, Mar 31, 2010 at 10:23 AM, tedd tedd.sperl...@gmail.com wrote:
 At 5:56 PM -0700 3/30/10, Tommy Pham wrote:

 On Tue, Mar 30, 2010 at 2:27 PM, Nathan Rixham nrix...@gmail.com wrote:

  nope never been able to find any significant advantage; and thus ended
  up using http uri's in my own domain space(s) which are always
  guaranteed to be unique as I'm issuing them. bonus is that they can be
  dereferenced and server as both a universal (resource) identifier and a
  locater.

  ps: resource = anything that can be named.


 Hi Nathan,

 I'm interested in hearing your technique of generating your own uuid
 if you don't mind sharing :).  I'm building a project to test my idea
 about search engine and testing of different RDBMSes.  So naturally,
 it (the app) would crawl the net and I'd have over a 1 billion rows.

 Thanks,
 Tommy

 PS: Here are some info for those who haven't heard of UUID/GUID:

 http://affy.blogspot.com/2003/03/why-use-uuid-values.html
 http://www.mysqlperformanceblog.com/2007/03/13/to-uuid-or-not-to-uuid/


 I've read your links and see the problem presented.

 The solution is to create an absolutely unique user ID and therein lies the
 problem. How do you create something that is absolutely unique?

 Clearly, if you have one database creating records, an auto_increment will
 work for creating an unique number for that's what increment does.  However,
 if you have more than one database creating records at the same time, then
 conflicts would occur.

 I had a similar problem recently where I used two fields to identify a
 record as being unique. One field used the exact time the record was added
 to the database and the other field was a random number. Combining the two
 numbers I believed I had a unique number for the taks I was doing. Of
 course, if activity was spread across hundreds of servers with millions of
 entries per second, then my method would not be a solution. As such, the
 solution should be tailored to the problem.

 Cheers,

 tedd


The original implementation of UUID/GUID includes MAC of the NIC which
will guarantee that uniqueness.  But because of certain privacy issues
brought up, they have to come up with other methods, though slightly
less unique. I've not heard of someone running into collision using
UUID/GUID.

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



Re: [PHP] Re: using UID in DB

2010-03-31 Thread tedd

At 11:08 AM -0700 3/31/10, Tommy Pham wrote:

On Wed, Mar 31, 2010 at 10:23 AM, tedd tedd.sperl...@gmail.com wrote:

 At 5:56 PM -0700 3/30/10, Tommy Pham wrote:


 On Tue, Mar 30, 2010 at 2:27 PM, Nathan Rixham nrix...@gmail.com wrote:


  nope never been able to find any significant advantage; and thus ended
  up using http uri's in my own domain space(s) which are always
  guaranteed to be unique as I'm issuing them. bonus is that they can be
  dereferenced and server as both a universal (resource) identifier and a
  locater.

  ps: resource = anything that can be named.



 Hi Nathan,

 I'm interested in hearing your technique of generating your own uuid
 if you don't mind sharing :).  I'm building a project to test my idea
 about search engine and testing of different RDBMSes.  So naturally,
 it (the app) would crawl the net and I'd have over a 1 billion rows.

 Thanks,
 Tommy

 PS: Here are some info for those who haven't heard of UUID/GUID:

 http://affy.blogspot.com/2003/03/why-use-uuid-values.html
 http://www.mysqlperformanceblog.com/2007/03/13/to-uuid-or-not-to-uuid/



 I've read your links and see the problem presented.

 The solution is to create an absolutely unique user ID and therein lies the
 problem. How do you create something that is absolutely unique?

 Clearly, if you have one database creating records, an auto_increment will
 work for creating an unique number for that's what increment does.  However,
 if you have more than one database creating records at the same time, then
 conflicts would occur.

 I had a similar problem recently where I used two fields to identify a
 record as being unique. One field used the exact time the record was added
 to the database and the other field was a random number. Combining the two
 numbers I believed I had a unique number for the taks I was doing. Of
 course, if activity was spread across hundreds of servers with millions of
 entries per second, then my method would not be a solution. As such, the
 solution should be tailored to the problem.

 Cheers,

 tedd



The original implementation of UUID/GUID includes MAC of the NIC which
will guarantee that uniqueness.  But because of certain privacy issues
brought up, they have to come up with other methods, though slightly
less unique. I've not heard of someone running into collision using
UUID/GUID.


I didn't say otherwise.

At some point, you asked how others solve the unique problem and I 
provided my solution.


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] Re: using UID in DB

2010-03-31 Thread Tommy Pham
On Wed, Mar 31, 2010 at 11:01 AM, Nathan Rixham nrix...@gmail.com wrote:
 Tommy Pham wrote:
 On Wed, Mar 31, 2010 at 4:06 AM, Nathan Rixham nrix...@gmail.com wrote:
 Tommy Pham wrote:
 As for spatial data types, I've never find much use for non scientific
 related.  (example) If using point as a PK, if MySQL stores it the
 same way as PostgreSQL which is 16 bytes, how is that any different -
 performance wise - than using UUID and storing it as binary(16) for
 MySQL or uniqueidentifier (16 bytes) for PostgreSQL?

 it's all about the indexing (R-Tree)

 http://en.wikipedia.org/wiki/R-tree


 I can see where the performance would be between B-Tree vs R-Tree for
 the same field size but I've yet to see real life application of it.
 Case in point, if using point for GPS data coordinates, then wouldn't
 it still be a lot better to use Lon (float), Lat (float) which is 2
 fields of 4 bytes each vs 1 field of 16 bytes?  The index would still
 be faster (8 bytes less) in B-Tree right?  Not to mention smaller row
  DB size.

 wish I still had an application to point you at; and I can't assert in
 any other way just how much faster it is; especially over large datasets
 - regardless of the amount of rows the style of index doesn't slow
 (spatial) queries down.

If I see the PoC w/o having to see the actual setup, then I would
probably understand your point better.


 if index byte size is of importance then negate spatial indexes (which
 are rather a lot bigger).


Since the spatial indexes are bigger, wouldn't that work against it
due disk access having to read more?

 regardless though, it was just an idea I was throwing at you, not
 suggesting it's the best approach, but worth consideration depending on
 your priorities.


Thanks for your idea.  I'd appreciate it very much.  I'm told that I
over analyze things at times ... lol ... so please don't take it the
wrong way :)

  As for calculating the distance between 2 'points', it
 would be simpler for querying purposes to use 'point'.  ATM, I don't
 have need to do any such calculations.  If I do use 'point' for PK,
 I'd run into problems with scaling and migration later.

 the points don't matter tbh; or should i say specifying an x and a y
 doesn't matter, because you can simply get by a single id, or get a
 range of ids very quickly; the other value comes in to play when you
 want temporal queries.

 again though, i reiterate only useful if you want speed and don't care
 about index bytesize - and certainly not forcing it down your neck.

 re scaling.. unsure theoretically you have 15 digit precision which is a
 mysql DOUBLE/REAL, and that's for each value in the pair, so an almost
 incomprehensible number of rows are possible before a collision.

 all in all: there are many good reasons why I've only used this on
 occassion (specifically when dealing with 1 million+ rows in an RDBMS
 table); and many more good reasons why i stick to non-rdbms databases
 and use http uri's + eav model data only nowadays.

 The latter i would advocate, the former not so unless you are stuck w/
 mysql postgres - in which case you can't get faster. [1]

 [1] get some numbers to prove when i have time.

 Nathan


Using HTTP URI's + EAV model is something I'll definitely look into.

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



Re: [PHP] I'm a newbie and running php on Linux

2010-03-31 Thread King Coffee

Thanks,
I think Output_Buffering may be the difference on the two servers. I had a 
default php.ini on the Linux server but not on the Windows server. But for 
now, I remove the echo statement.


Thank,
King

jose javier parra sanchez jojap...@gmail.com wrote in message 
news:r2j99f1636c1003310941xdc809603l774b40457870b...@mail.gmail.com...

Check your php.ini , look for output_buffering

2010/3/31 King Coffee kcof...@hotmail.com:

Hi,

I ran the following code snippet on Windows IIS 7, in my index.php file 
and

it worked fine. But when run it on Linux, the die code is executed.

Is there an include file or something else I need to to process this on a
linux server?

?php
   echo 'h1Redirecting... Please Wait/h1';
/*
   redirect('welcome.html');
*/
   if (!headers_sent()) {
   header('Location: ' .
'http://auction.househops.com/index.php');
   } else {
   die('Could not redirect.');
   }
?


Thanks,
King

--
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] Re: using UID in DB

2010-03-31 Thread Tommy Pham
On Wed, Mar 31, 2010 at 11:16 AM, tedd tedd.sperl...@gmail.com wrote:

 I didn't say otherwise.

 At some point, you asked how others solve the unique problem and I provided
 my solution.

 Cheers,

 tedd


Sorry, I misread that.

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



Re: [PHP] I'm a newbie and running php on Linux

2010-03-31 Thread King Coffee

Thanks you Nathan.
That worked.
Sincerely,
King

Nathan Rixham nrix...@gmail.com wrote in message 
news:4bb37e7e.5040...@gmail.com...

Ashley Sheridan wrote:

On Wed, 2010-03-31 at 11:32 -0500, King Coffee wrote:


Hi,

I ran the following code snippet on Windows IIS 7, in my index.php file 
and

it worked fine. But when run it on Linux, the die code is executed.

Is there an include file or something else I need to to process this on 
a

linux server?

?php
echo 'h1Redirecting... Please Wait/h1';
/*
redirect('welcome.html');
*/
if (!headers_sent()) {
header('Location: ' . 'http://auction.househops.com/index.php');
} else {
die('Could not redirect.');
}
?


Thanks,
King





This should never ever redirect. You've got an echo statement as your
first line of code. Once output has been sent to the browser, PHP cannot
send a redirect header, as the default ones get sent with the output.


problem is very very simple; simply swap the code order

?php
// add in logic if you want
header('Location: ' . 'http://auction.househops.com/index.php');
echo 'h1Redirecting... Please Wait/h1';
?

but please expand including a link to where you are redirecting too.

The apache default pages are very very good and include the status
(+code) and a short note:
302 Found
The resource you requested has been found here-link

note: that's not the exact text, but you get the idea.


I think maybe you'd need a Javascript redirect here, but that comes with
a warning that you cannot rely on everyone to have Javascript available
or enabled on their browser. People do turn it off, people do use
plugins such as NoScript, some routers have been known to strip
Javascript from web pages and not ever browser supports all Javascript
(think text browsers, speech and Braille browsers, etc)


no no no; (sorry ash) but HTTP is there for a reason and it accommodates
everything we need + can be used for *any* file (how do you javascript
redirect an image for instance) - all catered for.

always remember that the web is built on http  hypermedia (media w/
links); it's the whole reason we have a web, is the web and works v well.

also worth noting that apache foundation formed by roy t fielding, same
man who wrote rest, which is the model for http, and check the name at
the top of http, roy again; he's put in tonnes of work and guidance to
the full net, and of course apache http server itself - when in doublt
just copy apache and read the rfc + dissertation.


Why do you need to echo out a message to the user that the browser is
redirecting anyway? A header redirect will be seamless and the user
shouldn't even notice anything happening except for the URL changing.


because user agents MAY redirect, they don't have to - and when its a
post or such like they may want to make the choice of whether to proceed
or not; likewise from https to http and so forth.

http rfc is pretty clear that with every 3xx  4xx status could you
should give a reason as to why and also give possible actions the user
an take next - preferably as hypermedia links to make it properly resftul.

307 Temporary redirect, redirecting you to  click the link if you
are not automatically redirected. 



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



Re: [PHP] I'm a newbie and running php on Linux

2010-03-31 Thread Tommy Pham
On Wed, Mar 31, 2010 at 11:25 AM, King Coffee kcof...@hotmail.com wrote:
 Thanks,
 I think Output_Buffering may be the difference on the two servers. I had a
 default php.ini on the Linux server but not on the Windows server. But for
 now, I remove the echo statement.

 Thank,
 King

 jose javier parra sanchez jojap...@gmail.com wrote in message
 news:r2j99f1636c1003310941xdc809603l774b40457870b...@mail.gmail.com...

 Check your php.ini , look for output_buffering

 2010/3/31 King Coffee kcof...@hotmail.com:

 Hi,

 I ran the following code snippet on Windows IIS 7, in my index.php file
 and
 it worked fine. But when run it on Linux, the die code is executed.

 Is there an include file or something else I need to to process this on a
 linux server?

 ?php
       echo 'h1Redirecting... Please Wait/h1';
 /*
       redirect('welcome.html');
 */
       if (!headers_sent()) {
               header('Location: ' .
 'http://auction.househops.com/index.php');
       } else {
               die('Could not redirect.');
       }
 ?


 Thanks,
 King


Having that echo in there pointless since PHP will redirect
immediately.  If you want to inform the users that they're being
redirected because of URL changes, then look into meta tag for the
delayed redirect and you still have that echo for informative
purposes.  You may also need to set the set headers with proper http
code for the search engines.

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



Re: [PHP] Re: using UID in DB

2010-03-31 Thread Nathan Rixham
Tommy Pham wrote:
 On Wed, Mar 31, 2010 at 11:01 AM, Nathan Rixham nrix...@gmail.com wrote:
 Tommy Pham wrote:
 On Wed, Mar 31, 2010 at 4:06 AM, Nathan Rixham nrix...@gmail.com wrote:
 Tommy Pham wrote:
 As for spatial data types, I've never find much use for non scientific
 related.  (example) If using point as a PK, if MySQL stores it the
 same way as PostgreSQL which is 16 bytes, how is that any different -
 performance wise - than using UUID and storing it as binary(16) for
 MySQL or uniqueidentifier (16 bytes) for PostgreSQL?

 it's all about the indexing (R-Tree)

 http://en.wikipedia.org/wiki/R-tree

 I can see where the performance would be between B-Tree vs R-Tree for
 the same field size but I've yet to see real life application of it.
 Case in point, if using point for GPS data coordinates, then wouldn't
 it still be a lot better to use Lon (float), Lat (float) which is 2
 fields of 4 bytes each vs 1 field of 16 bytes?  The index would still
 be faster (8 bytes less) in B-Tree right?  Not to mention smaller row
  DB size.
 wish I still had an application to point you at; and I can't assert in
 any other way just how much faster it is; especially over large datasets
 - regardless of the amount of rows the style of index doesn't slow
 (spatial) queries down.
 
 If I see the PoC w/o having to see the actual setup, then I would
 probably understand your point better.
 
 if index byte size is of importance then negate spatial indexes (which
 are rather a lot bigger).

 
 Since the spatial indexes are bigger, wouldn't that work against it
 due disk access having to read more?

depends on how seriously you take a solution tbh; if you just wanna run
a huge dataset on a sata drive w/ 2gb ram then your screwed whatever
approach (unless you turn the dataset in to many fine grained resources,
heavily cached and only accessed on a need to have basis) but even then
there are many limitations.

one approach is to throw more ram at a situation; where you are
definitely better loading a huge dataset in to one box with massive
amounts of ram than splitting it over multiple boxes. [1]

http://rickonrails.wordpress.com/2009/03/30/big-ole-mysql-spatial-table-optimization-tricks/

if you're really serious then you want to be on a box with a tonne of
ram and pci express solid state storage devices which give you
throughput of 700MB/s and higher; prices aren't that bad comparatively
and one machine w/ a $800 card added works much better than 2-3 servers
(although you still need to cover replication and high availability).

http://www.fusionio.com/ioxtreme/

wandering off course a bit maybe; but these are situations we need to
consider.

I don't know how big you think big is; but realistically aws ec2
instances coupled with various big data / nosql - non rdbms approaches
are the way to go (see many many many recent discussions on the subject
around the net)

 regardless though, it was just an idea I was throwing at you, not
 suggesting it's the best approach, but worth consideration depending on
 your priorities.

 
 Thanks for your idea.  I'd appreciate it very much.  I'm told that I
 over analyze things at times ... lol ... so please don't take it the
 wrong way :)

ty for clarifying, and deal - I'm the same :)

  As for calculating the distance between 2 'points', it
 would be simpler for querying purposes to use 'point'.  ATM, I don't
 have need to do any such calculations.  If I do use 'point' for PK,
 I'd run into problems with scaling and migration later.
 the points don't matter tbh; or should i say specifying an x and a y
 doesn't matter, because you can simply get by a single id, or get a
 range of ids very quickly; the other value comes in to play when you
 want temporal queries.

 again though, i reiterate only useful if you want speed and don't care
 about index bytesize - and certainly not forcing it down your neck.

 re scaling.. unsure theoretically you have 15 digit precision which is a
 mysql DOUBLE/REAL, and that's for each value in the pair, so an almost
 incomprehensible number of rows are possible before a collision.

 all in all: there are many good reasons why I've only used this on
 occassion (specifically when dealing with 1 million+ rows in an RDBMS
 table); and many more good reasons why i stick to non-rdbms databases
 and use http uri's + eav model data only nowadays.

 The latter i would advocate, the former not so unless you are stuck w/
 mysql postgres - in which case you can't get faster. [1]

 [1] get some numbers to prove when i have time.

 Nathan

 
 Using HTTP URI's + EAV model is something I'll definitely look into.
 

good good; i can assure you it's the future; all the major corps and
governments are moving to this (age-old) model under the banner of
linked data, odata, and partially gdata - and meanwhile the development
community is slowly getting there with focus moving to kv databases
which are just one step away from the full on eav / triple approach.

Many regards,

Nathan


[PHP] Re: php 5.3.2 Unable to fork

2010-03-31 Thread Eduardo Nunes
Compiling without mysql support, the cli php -r 'echo shell_exec(echo 
Test!);' works fine even as the apache unprivileged user. However when 
running the test.php script with apache the error log still shows the error 
Unable to execute / Unable to fork ...



Eduardo Nunes zeh...@terra.com.br escreveu na mensagem 
news:38.94.09265.3a973...@pb1.pair.com...

Hello people!

A time before I had issues with my php 5.2.3 that would not fork anything, 
neither in shell or via apache, and I figured out that commenting out the 
snmp.so extension from php.ini made it fork commands passed to php cli 
with an unprivileged user (www) fine, however apache still would not fork 
anything.


Now I just compiled 5.3.2 and it doesn't fork at all, neither as root 
with -n option.


For example I am running:
r...@saturno:/usr/src/apache/php-5.3.2# ./sapi/cli/php -n -r 'echo 
shell_exec(echo Test!);'
Warning: shell_exec(): Unable to execute 'echo Test!' in Command line code 
on line 1


(neither system, exec, other options work)

Any ideas on what is going on?

(compiled using 
../configure --prefix=/usr --with-apxs2 --disable-cgi --disable-short-tags 
 --disable-ipv6 --without-sqlite3 --with-mysql --with-pdo-mysql --without-pdo-sqlite 
 --enable-sockets --without-sqlite --with-gnu-ld)


Thanks 



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



[PHP] Re: php 5.3.2 Unable to fork

2010-03-31 Thread Nathan Rixham
Eduardo Nunes wrote:
 Compiling without mysql support, the cli php -r 'echo shell_exec(echo
 Test!);' works fine even as the apache unprivileged user. However when
 running the test.php script with apache the error log still shows the
 error Unable to execute / Unable to fork ...

back in 5.2.3 i had the same problem and found it to be the psql drivers
not mysql.. may be worth checking

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



Re: [PHP] Re: php 5.3.2 Unable to fork

2010-03-31 Thread Nilesh Govindarajan

On 04/01/10 02:21, Eduardo Nunes wrote:

Compiling without mysql support, the cli php -r 'echo shell_exec(echo
Test!);' works fine even as the apache unprivileged user. However when
running the test.php script with apache the error log still shows the
error Unable to execute / Unable to fork ...


Eduardo Nunes zeh...@terra.com.br escreveu na mensagem
news:38.94.09265.3a973...@pb1.pair.com...

Hello people!

A time before I had issues with my php 5.2.3 that would not fork
anything, neither in shell or via apache, and I figured out that
commenting out the snmp.so extension from php.ini made it fork
commands passed to php cli with an unprivileged user (www) fine,
however apache still would not fork anything.

Now I just compiled 5.3.2 and it doesn't fork at all, neither as root
with -n option.

For example I am running:
r...@saturno:/usr/src/apache/php-5.3.2# ./sapi/cli/php -n -r 'echo
shell_exec(echo Test!);'
Warning: shell_exec(): Unable to execute 'echo Test!' in Command line
code on line 1

(neither system, exec, other options work)

Any ideas on what is going on?

(compiled using ../configure --prefix=/usr --with-apxs2 --disable-cgi
--disable-short-tags --disable-ipv6 --without-sqlite3 --with-mysql
--with-pdo-mysql --without-pdo-sqlite --enable-sockets
--without-sqlite --with-gnu-ld)

Thanks





I think you need to check your PATH environment variable. Add the 
directory to it where your PHP interpreter sits.


PS: This just a guess. Don't bash me if I'm wrong.

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