Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Richard Heyes
Hi,

 ...

As has been suggested you could use mod_rewrite, but you don't have to
if your needs are simple (or maybe you don't have it). You could also
use the ForceType directive. Eg on my website the URLs are like this:

http://www.phpguru.org/article/20-years-of-php

Where article is actually a PHP file without the .php extension.
It's forced to run as a PHP file using this:

Files article 
ForceType application/x-httpd-php
/Files

And you will find the URL in $_SERVER somewhere.

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 5th September)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] anyone interested in PHP? Call for moderator

2009-09-15 Thread Richard Heyes
Hi,

 It is good to hear that they teach PHP in kindergarden these days.

I've heard it's soon to be part of the national curriculum here in the UK.

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 5th September)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] Taking body of an email and storing it in MySQL database

2009-09-07 Thread Richard Heyes
Hi,

 ...

Sounds like you may have a MIME (an HTML email or one with attachments
etc) email to decode. What you can do is use the PEAR class
Mail_mimeDecode ( http://pear.php.net/package/Mail_mimeDecode ). Pass
it the entire email (headers and all) and it will try to decode it for
you.

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 5th September)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] PHP6 Stable Release Schedule

2009-09-05 Thread Richard Heyes
Hi,

 Also, will PHP ever implement the Strict mode similar to Perl's 'using
 Strict'?

Don't know if it's similar having never used Pearl, but there's always
the E_STRICT error level.

?php
  error_reporting(E_STRICT);
?

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 5th September)
Lots of PHP and Javascript code - http://www.phpguru.org
50% reseller discount on licensing now available - ideal for web designers

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



Re: [PHP] PHP6 Stable Release Schedule

2009-09-05 Thread Richard Heyes
Hi (again),

 ?php
  error_reporting(E_STRICT);
 ?

This might work better:

?php
  error_reporting(E_ALL | E_STRICT);
?

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 5th September)
Lots of PHP and Javascript code - http://www.phpguru.org
50% reseller discount on licensing now available - ideal for web designers

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



Re: [PHP] PHP6 Stable Release Schedule

2009-09-05 Thread Richard Heyes
Hi,

 E_STRICT is now part of E_ALL

Oopsy. Shows how much PHP I do these days...

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 5th September)
Lots of PHP and Javascript code - http://www.phpguru.org
50% reseller discount on licensing now available - ideal for web designers

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



Re: [PHP] Why aren't you rich? (was Re: unset() something that doesn't exist)

2009-08-26 Thread Richard Heyes
Hi,

 time is really what i want more of.

Personally I'd settle for a Ferrari. Or two. It would be hard, but I
think I could just about manage.

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 8th August)
Lots of PHP and Javascript code - http://www.phpguru.org
50% reseller discount on licensing now available - ideal for web designers

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



Re: [PHP] Why aren't you rich? (was Re: unset() something that doesn't exist)

2009-08-26 Thread Richard Heyes
Hi,

 time is really what i want more of.

 Personally I'd settle for a Ferrari. Or two. It would be hard, but I
 think I could just about manage.

 Might look nice in your driveway...
 But without the time to drive it... :|

 ;)

I actually don't have a driving license either... :-/

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 8th August)
Lots of PHP and Javascript code - http://www.phpguru.org
50% reseller discount on licensing now available - ideal for web designers

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



Re: [PHP] Rounding down?

2009-08-22 Thread Richard Heyes
Hi,

 Is there a way to round down to the nearest 50?

 Example: Any number between 400 and 449 I would 400 to be displayed; 450 to 
 499 would be 450; 500 to 549 would be 500, etc?

Off the top of my head: divide the number by 50, run floor() on the
result, then times it by 50.

1. 449 / 50 = 9.whatever
2. floor(9.whatever) = 9
3. 9 * 50 = 450

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 8th August)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] Rounding down?

2009-08-22 Thread Richard Heyes
Hi,

 It should be round() and not floor().

 449 / 50 = 8.98
 floor(8.98) = 8
 8 * 50 = 400

 round(8.98) = 9
 9 * 50 = 450

Not based on the examples given:

 Example: Any number between 400 and 449 I would 400 to be displayed

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 8th August)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] Rounding down?

2009-08-22 Thread Richard Heyes
Hi,

 ...

A little modification:

?php
/**
* Rounds down to the nearest 50
*/
function myRound($val)
{
$units = intval(substr($val, -2));

return intval(substr($val, 0, -2) . ($units = 50 ? '50' : '00'));
}

echo myRound(449) . 'br /'; // 400
echo myRound(450) . 'br /'; // 450
echo myRound(356) . 'br /'; // 350
echo myRound(79) . 'br /';  // 50
?

PS I haven't checked if there's a PHP function for this.

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 8th August)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] HTML text extraction

2009-08-18 Thread Richard Heyes
HI,


 ...

The easy way (Back to the Future 2 anyone...?) would be to use
strip_tags() first:

http://uk.php.net/strip_tags

--
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 8th August)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] Sending email w/ attachments

2009-08-11 Thread Richard Heyes
Hi,

 Very cool!

I'll take that as a compliment... :-)

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 8th August)

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



Re: [PHP] Sending email w/ attachments

2009-08-11 Thread Richard Heyes
Hi,

 ...

Sorry, quoted wrong email. Oopsy...

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 8th August)

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



Re: [PHP] ZCE Question

2009-08-09 Thread Richard Heyes
Hi,

 Looks like XMLRPC to me.

Agreed - it's not gibberish so it can't be SOAP...

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 8th August)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] Re: Problem: Writing into Files?

2009-08-03 Thread Richard Heyes
Hi

 The thing with this method is that it's just like the previous one; it opens
 then adds something. I'm assuming if again two visitors visit at the same
 time, this'd reset to zero.

No, the a mode (IIRC) handles file locking for you. Even if it
doesn't, the file won't be truncated, so you won't lose your count.

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 25th July)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] Re: Dan Brown

2009-08-03 Thread Richard Heyes
Hi,

 ...

As said over IM, best wishes.

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 25th July)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] Re: Problem: Writing into Files?

2009-08-02 Thread Richard Heyes
Hi,

 ...

You can write a single byte to the file to increment the counter,
then to read the count just use filesize(). I believe the a fopen()
mode will handle locking for you. It will result in a slowly growing
file, but space isn't exactly at a premium nowadays, and when the file
gets to a certain size (eg 1 gazillion k) you could use a summary
file.

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 25th July)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] Re: Problem: Writing into Files?

2009-08-02 Thread Richard Heyes
 I don't quite know how I can write a bite into a file. I also looked into a
 manual and couldn't find a mention of FLock-ing in the explaination for
 FOpen parameters.

Ok, from memory:

?php
fwrite(fopen('/tmp/counter', 'a'), '1');
?

The 1 could be any single byte character I guess.

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 25th July)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] Better Formatting Options?

2009-07-31 Thread Richard Heyes
Hi,

        I have many products per page and this code pulls the list price and
 formats it.  It works fine, but I'd like to know if I can shorten it.

Personally, I would advise against trying to cram as much as possible
into the least amount of space as possible, and instead going for
verbosity/readability. It will help when you come back to re-read it
in X months.

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 25th July)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] Sessions

2009-07-03 Thread Richard Heyes
Hi,

 ..

This is precisely what I do, albeit my file is called config.php, and
not init.php. Not that it makes a jot of difference. This file is used
to setup the environment, so that way everything I commonly need is
available simply by including one file. One thing to note though is
that a database connection is not established by default. I used to
get a lot of comment spam on my blog and because it was needlessly
connecting to the database, it was bringing down the server. So now I
simply use something like this to quickly and easily get a reference
to a database object:

$db = getDatabase();

Wunderbar.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 3rd July)

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



Re: [PHP] Push an Array, Comma separated.

2009-06-30 Thread Richard Heyes
 My array:
 Array ( [0] = Demo2.txt [1] = Demo.txt [2] = Demo.txt )

 How could I push the values as:

 - Demo2.txt, Demo.txt, Demo.txt?

 Not sure which approach is good.

 $saveFiles = array();
 array_push($saveFiles, $ufName);

you could use array_push(), or the shorter syntax:

 o array_push();

array_push($myArr, 'Demo2.txt', 'Demo.txt', 'Demo.txt');

 o Shorter syntax:

$myArr[] = 'Demo2.txt';
$myArr[] = 'Demo.txt';
$myArr[] = 'Demo.txt';

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 20th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] CSV file

2009-06-25 Thread Richard Heyes
Hi,

 Well, you are reading the whole file there (and throwing the data you
 read not assigning the fgets result to anything), and then to store it
 in the database you need to read it again, so you read the file twice.
 It will probably better to store the data you read the first time in
 an array and then store it in the database, that way you read it only
 once.

No, it's not. If the file is large then you could end up reading megs
into memory. If physical memory is low then the pagefile will come
into play and you'll get a lot of disk accesses. Reading 1 line at a
time is far more efficient and with larger files will be faster.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 20th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] CSV file

2009-06-24 Thread Richard Heyes
Hi,

 You can read the whole file (file_get_contents) and count the number
 of \n in it, or read it line by line with fgets and store the lines
 in an array, and then the number of lines is the count() of the array,
 and you can use that array to store it in the database.

If you have a billion line CSV then speed may suffer somewhat though.
Best to still use fgets()  or fgetcsv() and count as you go.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 20th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] CSV file

2009-06-24 Thread Richard Heyes
Hi,

 If you want to know how many lines there are *before* inserting to the
 database, you can't count as you go, you have to either read the
 file twice or read it once, store it memory in a variable and then
 insert in the database.

Sure you can, simply do the line count first, then the insert. If it's
a big file it will still be quicker than reading the whole thing into
memory.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 20th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] CSV file

2009-06-24 Thread Richard Heyes
Hi,

 To do the line count first, you have to read the whole file, how would
 you do it?

Something like this:

$fp = fopen('/tmp/foo', 'r');
$count = 0;

while (!feof($fp)) {
  fgets($fp);
  ++$count;
}

--
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 20th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] mirroring website

2009-06-21 Thread Richard Heyes
Hi,

 I have the following issue! I want to develop my website on my local
 machine, and then upload the entire developed site to a production
 server. What is the best strategy to do that?
 I have been looking at a php mirroring script but that was about 5 years
 old! Is'nt there a better/newer approach?

I used to use rsync (with a bunch of options) whenever I did this.
With you being on Linux, it would be trivial to automate it with a
script.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 20th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] Mail function and hotmail

2009-06-10 Thread Richard Heyes
Hi,

 ...

Use something that is already proven to work. It will save you an
awful lot of time.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 6th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] Mail function and hotmail

2009-06-10 Thread Richard Heyes
Hi,

 pear's mime mail

I believe I had a hand in that too. It's like a bad rash - it gets
everywhere... :-)

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 6th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] PHP Graphing Libraries...?

2009-06-08 Thread Richard Heyes
 ...

Something like the last example?

http://dev.rgraph.net/examples/scatter.html

And before you ask, you can only have one line :-)

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 6th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] PHP Graphing Libraries...?

2009-06-08 Thread Richard Heyes
Hi (again),

 And before you ask, you can only have one line :-)

Though thinking a bit more about this, you could achieve it straight
forwardly enough.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 6th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] PHP Graphing Libraries...?

2009-06-08 Thread Richard Heyes
Hi,

 Don't see anything except a grid on Firefox 3.0.10 on PC.

Yes the whole library requires FF3.5+, Safari 4+ or Chrome 2+.

http://www.rgraph.net/#browser

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 6th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] php applications

2009-06-08 Thread Richard Heyes
Hi,

 I've heard that php can be used for more than web programming, but I am not
 aware of specifically how that can be done. So, let me ask directly -- can
 php be used to create a Mac Application?

 If so, how?

Don't know about Mac specifically, but with *nix in general it can be
used to create command line stuff, and also GUI based apps using the
Gtk extension.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 6th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] php applications

2009-06-08 Thread Richard Heyes
Hi,

 Real men use perl ;)

    's/Real men/Masochists'

There's always VB...

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 6th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] PHP Graphing Libraries...?

2009-06-07 Thread Richard Heyes
Hi,

 Reasonable, no?

Could be, but I don't follow. A point has an X coord and a Y coord,
and with a line chart you simply connect the dots (much like a
dot-to-dot). Like the charts here:

http://dev.rgraph.net/examples/line.html

Or perhaps I'm not quite following (entirely likely) ?

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 6th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] PHP Graphing Libraries...?

2009-06-05 Thread Richard Heyes
Hi,

 I've looked at the docs and I don't see how exactly it handles x,y
 plotting.  I need the ability to plot multiple lines (which it obviously
 does) with wildly varying x,y values.   It seems that all of these
 libraries cheat and force common x values via the labels.  I need
 something like the following (all in the same chart):
 $line_one_data = [x,y,x,y,x,y,x,y,x,y,x,y,x,y,x,y,x,y,x,y,x,y,x,y]
 $line_two_data = [x,y,x,y,x,y,x,y]
 $line_three_data = [x,y,x,y,x,y,x,y,x,y,x,y,x,y]
 $graph-plot($line_one_data,$line_two_data,$line_three_data)
 As I said, each line has its own set of x,y, and although they're all
 obviously numbers, they don't all have y results at the same x intervals
 so I need to be able to control them independently.  Surely there's
 something that can accommodate this...?

Well the line doesn't do this, the X values are linear. However the
Scatter works like this. ie You set an maximum X value and the X
values are put in the corresponding places.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 23rd May)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] Web friendly file names

2009-06-03 Thread Richard Heyes
Hi,

 I have a file uploader module that allows users to upload documents and of
 course people are using all kinds of file names that are not web friendly.

 I guess the best solution is to replace any non alphanumeric with maybe '_'
 the underscore? How does that sound?

 Unfortunately, after 20+ years of coding I cannot get my brain around
 regular expressions to any decent level of proficiency, I know sad.

 I'd like to hear other solutions for this problem, I am thinking of a regexp
 that replaces special chars with the underscore; sounds pretty robust and
 globally acceptable?

I replace any non alpha chat with a hyphen, then replace two or more
hyphens with one. Simple, but I would also include the date so that
naming clashes are less likely (if it's applicable). So you might end
up with something similar to this:

/product/2009/06/03/24ct-gold-earrings

Or if using the date is not applicable, you could get something like this:

/product/24ct-gold-earrings

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 23rd May)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] recipes anyone?

2009-05-29 Thread Richard Heyes
Hi,

 I'd like to get some input on how to deal with recipes.
 use html pages to store and display, XML or db or... ? And what about
 clips, like flvs ? TIA.

Actual recipes? As in a pork roast? I would put them on the file
system in .html files. You could use a PHP file to serve them, and
have a URL like this:

http://www.pig-supper.com/recipe/pork-roast.html

recipe could be a PHP file that adds a common header and footer. I
do similar with my site. Eg:

http://www.phpguru.org/static/canvas.html

Or did you mean something else entirely...?

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 23rd May)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] Create multipart email

2009-05-28 Thread Richard Heyes
Hi,

 i have been using PEAR Mail. major reason being nearly all of my web
 hosts have this supported (pre-installed)

It doesn't need to be installed for you to use it. If you want/need to
you can get the sauce off of the PEAR website:

http://cvs.php.net/viewvc.cgi/pear/Mail/

Click on the version numbers to get at the code. You can then treat it
like you would any other PHP file. You'll have to resolve any
depenencies yourself though.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 23rd May)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] templating engine options

2009-05-25 Thread Richard Heyes
Hi,

 and then you have the joy of telling the client its 6 months work

6 months vs 1 day... Ka-Ching! :-)

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 23rd May)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] executing background process from php

2009-05-25 Thread Richard Heyes
Hi,

 I am newbie with this subject and really need to know it...
 I need a good and clear samples of 'executing background process from
 phphttp://www.webdeveloper.com/forum/showthread.php?t=90061'

 where can I find it?

The manual I would imagine. To execute a background task you need to
redirect all output streams, like this (on Unix - on Windows I have no
idea I'm afraid):

?php
  exec('sleep 5 /dev/null 21 ');
?


-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 23rd May)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] templating engine options

2009-05-25 Thread Richard Heyes
 That's where your integrity is called into question.

What's that...? :-)

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 23rd May)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] templating engine options

2009-05-24 Thread Richard Heyes
 ...

For a long time I used require(), simply because I worked in an
environment where the web people could either cope with PHP or were
programmers. But then I succumbed to the lure and wrote RTemplate
(http://www.phpguru.org/rtemplate) - a simple caching template doobry.

And now I still use require()... :-/

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] Accepting Credit Card Payments

2009-05-20 Thread Richard Heyes
Hi,

 ...

If you're in the US or UK then you could look at using Google Checkout
- it's very easy to setup. Plus your punters (/Customers) may feel a
little better about giving their CC details to a recognized brand like
Google. Or if they're in Switzerland, maybe not... :-/

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] object literals

2009-05-03 Thread Richard Heyes
 i'm really lazy about typing.

I think every good programmer is... ;-)

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)

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



Re: [PHP] object literals

2009-05-01 Thread Richard Heyes
Hi,

    $x = (object) array('a'=1, 'b'=3, ...);

 which works but isn't very lovely. it's neater in, for example, javascript.

Well, you could wrap it up in a function to make it a bit lovelier. Eg:

$foo = createObject(array('key' = 'value'));

It's not great, but PHP doesn't have a object literal syntax AFAIK.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)

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



Re: [PHP] object literals

2009-05-01 Thread Richard Heyes
Hi,

 You could use JSON,

 $foo = json_decode('{a:1,b:3}');

 but I guess that's not much better than Richard's suggestion.

Didn't think of that (well... it's new). That's actually much better I
think, since you get the added boon of ease of portability to JS (if
that's even a factor).

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)

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



Re: [PHP] CamelCase conversion to proper_c_style

2009-04-27 Thread Richard Heyes
Hi,

 I know it's probably heresy for a lot of coders, but does anyone know a
 function or class or regexp or somesuch which will scan through a PHP
 file and convert all the CamelCase code into proper C-type code? That
 is, CamelCase gets converted to camel_case. I snagged a bunch of
 someone else's PHP code I'd like to modify, but it's coded the wrong
 way, so I'd like to fix it.

 (I'm teasing you CamelCase people. But I really would like to change
 this code around, because it doesn't happen to be my preference.)

I'd say, if you must, then change as you go. If you do it all in a
oner you'll likely introduce a shed load of problems.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)

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



Re: [PHP] PHP CLI vs WebServed

2009-04-25 Thread Richard Heyes
Hi,

...

Never done this, but could you set environment variables, which would
then be picked up by PHP (and stuffed in $_ENV)?

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)

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



Re: [PHP] Multiple return statements in a function.

2009-04-24 Thread Richard Heyes
Hi,

 your function could be condensed to this:

 function check($a)
 {
    return is_array($a) ? true : false;
 }

Or even better, this:

function check($a)
{
   return is_array($a);
}

Not that I'd imagine it makes a great deal of difference.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)

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



Re: [PHP] Multiple return statements in a function.

2009-04-23 Thread Richard Heyes
Hi,

 while(true){

Yikes.

Personally, I'd put the return value wherever it will make the code
easier to read. If you're checking what has been passed as arguments,
and one of them is wrong, I think there's little point in continuing,
so an immediate return is the order of the day. Though with
exceptions, this could be mitigated (IIRC). BTW there's also something
to be said for code conciseness, which I think is loosely related. Eg
your function could be condensed to this:

function check($a)
{
return is_array($a) ? true : false;
}

But then the question is nullified somewhat.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)

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



Re: [PHP] Select List/Menu

2009-04-17 Thread Richard Heyes
 in VBSCRIPT

In what?

Use [] at the end of your selects name:

select name=mySelect[]
   ...
/select

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated April 11th)

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



Re: [PHP] https and Credit Cards

2009-04-15 Thread Richard Heyes
Hi,

 To add to what others have said: CC processors with which I have worked will
 audit your site *before* certifying your site to accept CC information. In
 other words, if you don't do SSL, you won't be *allowed* to process cards.

FWIW, companies exist that will host your buy page(s), so  you don't
end up with the hassle of buying and installing your own SSL
certificate.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated April 11th)

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



Re: [PHP] alt() - unknown function?

2009-04-15 Thread Richard Heyes
 grep gets my vote, since i don't use netbeans

I'd go for grep too (unix or Win32):

grep -rin function alt *

What's the exact error?

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated April 11th)

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



Re: [PHP] https and Credit Cards

2009-04-14 Thread Richard Heyes
Hi,

 I've always put any forms that collect credit card information behind a
 secure connection, https, figuring that sending that information from the
 client browser to the server should be secure, but I'm having convincing a
 client that it is necessary.

 He instead insists that only the call to the credit card processor's server
 needs to be secure and of course the processor supplies the connection
 there.

 But doesn't also the form need to be secure since you're sending CC
 information from that form back to the web site's server?

Yes. Any connection to you where your punter supplies CC details
should be secure. If the punters ISP runs a transparent proxy for
example, then these details could be easily captured if not sent over
a secure connection.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated April 11th)

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



Re: [PHP] Caching

2009-04-11 Thread Richard Heyes
 Hey! About   Header set Expires Thu, 15 Apr 2010 20:00:00 GMT 
 The problem is the files might change, lets say - every week. How can I use
  Header set Expires Thu, 15 Apr 2010 20:00:00 GMT to something like

 Header set Expires today plus week

 (or X seconds / y minutes / etc...)

In that case you will want to use Cache-Control instead:

Header set Cache-Control private,public,max-age=604800

The max-age is the number of seconds (1 week in this case) that the
page is cached for. The private and public determine which kinds of
cache should cache it. IIRC (which isn't likely).

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated April 11th)

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



Re: [PHP] Caching

2009-04-10 Thread Richard Heyes
Hi,

 I started caching some of the static files on my application,
 I was wondering - Lets say I have an article on my website and I *want* to
 cache it. How will I cache it AND will be able to make my visitors
 re-cache it if it has been changed?

Work from the last modified date/time on the file. When you update the
file it will change. Though if your files really are static, then
there's little point - the OS will do a far better job of caching them
than you will.

Also, you may also want to have a goosey at the Cache-Control: HTTP
header over Expires:. It can give you more control.

 How do I use *Header set Expires* (on htaccess) and specifying in a week?

A quick Google found this:

Header set Expires Thu, 15 Apr 2010 20:00:00 GMT

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 28th)

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



Re: [PHP] Increase your monthly income!

2009-04-09 Thread Richard Heyes
 Get paid for your opinion!

Y'know, I really think I should...

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 28th)

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



Re: [PHP] Increase your monthly income!

2009-04-09 Thread Richard Heyes
 I actually thought you were going to point out to our guest that this is a
 mailing list for PHP-related issues only. And we're not here to get paid for
 our opinions are we??? I won't blame anybody going for the offer though but
 the point remains, this is a PHP-Mailing list.

Wow, someone is playing Mr. Misery Guts in the school play aren't they?

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 28th)

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



Re: [PHP] Increase your monthly income!

2009-04-09 Thread Richard Heyes
 In the history of email, the only
 better SPAM blocking stuff has been a pair of scissors applied to the
 power cord.

Wearing insulating gloves I would add...

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 28th)

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



Re: [PHP] Am I being hacked?

2009-04-08 Thread Richard Heyes
 I set up a simple form to save comments on my webpage, and after just one
 day of going live, i'm getting weird comments up like this

 declare @q varchar(8000) select @q =
 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)


 I don't recognise this code - is this an attempt to do something nefarious,
 or nothing I should worry about?

Looks like it may be. As long as you escape you SQL correctly using
mysql_real_escape_string() or the equivalent, you should be OK.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 28th)

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



Re: [PHP] file_get_contents for URLs?

2009-04-07 Thread Richard Heyes
 Hey all,

Hello.

 I'm doing some maintenance work on an existing system and there is a piece
 of code that uses file_get_contents() to read data from a URL, which is fine
 in theory I suppose.

 But the problem is sometimes the server where that URL lives is not
 available, and the system hangs indefinitely.

 Shouldn't this be done with curl, and if so can it be done so that the call
 will time out and return control back when the server is not available?

Looking at the docs alone, it looks like you can pass a stream as the
third argument to file_get_contents(). So create a stream, set the
timeout on that (using stream_context_create() 
stream_context_set_option() ), and then pass it to
file_get_contents().

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 28th)

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



Re: [PHP] PHP/MySQL ISP recommendation that lets one edit ft_min_word_len variable?

2009-04-04 Thread Richard Heyes
Hi,

 Can anyone here recommend an ISP that will let me have a dedicated
 server (not shared), and also allow me to adjust the ft_min_word_len
 mySQL parameter?  I was originally thinking Dreamhost PS, but I
 recently found out that they do not allow changes to mySQL
 environmental variables.  I really need to adjust ft_min_word_len so
 that I can do rapid text searches on words less than 4 chars.

Dan the man on this very mailing list. Or Rackspace.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 28th)

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



Re: [PHP] Button id's - firefox and IE different ?

2009-04-02 Thread Richard Heyes
 Any suggestions ?

Try this:

input type=submit name=btid value=Delete /
input type=submit name=btid value=Cancel /
input type=submit name=btid value=Save /


And then you can check the value of $_POST['btid']. Oh and btw...
center... seriously?
That's so 9 years ago. ;-)

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 28th)

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



Re: [PHP] time() TIMER in seconds or just numbers

2009-03-30 Thread Richard Heyes
2009/3/30 Andrew Williams andrew4willi...@gmail.com:
 what does time();

 $t1 = time();

 {

 do something
 }
 $t2 = time();

 $end_time = $t2 - $t1;
 echo $end_time;

 what does $end_time represent?

$end_time is not a great name for it: it's the time (number of
seconds) it took to go from $t1 to $t2. $duration might be better.

 how do you determine the next 5 mins?

Eh? time() + 300 is five minutes from now.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 14th)

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



Re: [PHP] time() TIMER in seconds or just numbers

2009-03-30 Thread Richard Heyes
 When someone does that, it means the execution time between $t1 and $t2...

Is that for my benefit? Believe it or not, I do know the arcane art of
subtraction...

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 14th)

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



[PHP] Namespce operator

2009-03-25 Thread Richard Heyes
Backslash? Seriously? I'm hurt that my suggestion of ¬ (ASCII170 ?)
wasn't used. :-(

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 14th)

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



Re: [PHP] Namespce operator

2009-03-25 Thread Richard Heyes
 Backslash doesn't sound like it will look very pretty

Well no, but practically I can't see any dis/advantages. Except that
it saves two whole keypresses over something like :::. Think of the
RSI lawsuits prevented...

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 14th)

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



Re: [PHP] preg_replace() question

2009-03-18 Thread Richard Heyes
 1. What is the overhead on preg_replace?

Minimal. If you're looking for all the speed you can get, you'd
probably be better off with an str* function though if you can find
one. You'd have to be seriously after speed gains though.

 2. Is there a better way to strip spaces and non alpha numerical
 characters from text strings? I suspect not...

Have a look through the string functions. the ctype_* functions too.
See if one fits your needs.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 14th)

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



Re: [PHP] Sanitizing Numbers

2009-03-13 Thread Richard Heyes
 ereg

[Gasps and runs off shouting PCRE] ...

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated February 28th)

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



Re: [PHP] Re: Sending out large amounts of email

2009-03-07 Thread Richard Heyes
 thanks a thousand

A thousand? That's a bit stingy - usually it's thanks a million...

:-)

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated February 28th)

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



Re: [PHP] Database Abstraction Class

2009-03-07 Thread Richard Heyes
Hi,

 Anywhoo, that being said, does anyone have a suggestion for a good database
 abstraction class?

Ooh, I think you'll get the odd one or two...

 Preferably one that already has decent support for several open source
 databases?

PEAR::DB was good, but IIRC it's now been deprecated in favour of
MDB2. Which may or may not also be in PEAR.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated February 28th)

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



Re: [PHP] Database Abstraction Class

2009-03-07 Thread Richard Heyes
Hi,

 Never used pear before, but I seem to recall there being some issues where
 pear did not provide very good forward support when moving to new versions
 of php causing a need to recode. Is that still an issue?

Don't really know. I've not really had a problem with the stuff that
I've written. I suppose it depends very much on each individual
package author (there are a fair few).

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated February 28th)

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



Re: [PHP] Sending out large amounts of email

2009-03-06 Thread Richard Heyes
Hi,

 Our company is merging with another company and newsletter now needs to go
 out to more than 100.000 people.

Out source it. It will cost you far less in the long run. And the
short run. I tried Jango mail and they seemed OK, though I didn't have
to talk to their support, and my use was very brief. These types of
company will also have far more success in getting the emails
delivered (and not flagged as spam).

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated February 28th)

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



Re: [PHP] Question about template systems

2009-03-03 Thread Richard Heyes
Hi,

 First post here, I'm in the process of learning PHP , I'm digesting a few
 books as we speak.
 I'm working on a content heavy website that provides a lot of information, a
 template system would be great and so i've been looking at ways to create
 dynamic data with a static navigation system.

 So far, using the require_once(); function seems to fit the bill in order to
 bring in the same header html file on each page.
 I've also looked at Smartys template system.

If you've looked at require_once() and it fits the bill, then
chances are that Smarty might be overkill slightly.

 I wondered how you folk would go about creating a template system ?

I wouldn't (or at least, I wouldn't advise it). Use one that's already
out there and save your self some (a lot of) work.

 My second question might be me jumping the gun here, I haven't come across
 this part in my book but i'll ask about it anyway.  I often see websites
 that have a dynamic body and static header, and their web addresses end like
 this: index.php?id=445 where 445 i presume is some file reference.
 What is this called ?

I don't know of the specific name, but the URL is simply passing an
identifier (445) to the script (index.php). This ID could be the ID of
a record in a database, which is then retrieved and shown to the user.

 It seems like the system i'm after but it doesn't
 appear in my book,  If anyone could let me know what this page id subject is
 called i can do some research on the subject.

Erm, don't know of the specific name, except that it's a GET parameter
(so I guess I do...). Everything following the question mark is
collectively known as the query string. You can retrieve these by
examining the $_GET variable. You will aalso find some useful things,
in $_SERVER.

Eg:

pre
?php
  print_r($_GET);
  print_r($_SERVER);
?

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated February 28th)

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



[PHP] Just a test

2009-03-02 Thread Richard Heyes
-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 28th)

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



Re: [PHP] Just a test

2009-03-02 Thread Richard Heyes
2009/3/2 Daniel Brown danbr...@php.net:
 On Mon, Mar 2, 2009 at 05:55, Richard Heyes rich...@rgraph.net wrote:

 This is just a test to see who here still thinks I'm a dork.

    I still do, Richy.

I see. You won't be wanting any of billion dollar empire when I make
it then. Ho hum.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 28th)

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



Re: [PHP] Just a test

2009-03-02 Thread Richard Heyes
    No, but coincidentally, the month that happens, your hosting goes
 up to $46.2M US per month, and you're locked into a contract for a
 minimum of three lifetimes.  Weird.

Bummer. That makes it almost worth going back to 1and1. Almost.

    Are you using a dynamic signature, is that what you're testing?

Nope. Email addresses. I think.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated February 28th)

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



Re: [PHP] A puzzler (well, for me at least)

2009-02-28 Thread Richard Heyes
 Your answer is neither relevant nor funny. :-|

    And your response wasn't welcome.  So there, everyone's even.

 I'm even?? You sure? People been telling me my entire life that I'm odd!


 rob, that was either funny or relevant.

Neither was that.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 28th)

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



[PHP] A puzzler (well, for me at least)

2009-02-26 Thread Richard Heyes
Hi,

I've been recently wondering (musing if you will) about timings, and
roughly how long, in a very real sense, it takes on a modern computer
for a single line of PHP, or Javascript (or interpreted code in
general) to execute. Nanoseconds? Quicker?

You could say I have too much time on my hands...

Cheers.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



Re: [PHP] A puzzler (well, for me at least)

2009-02-26 Thread Richard Heyes
 Your answer is neither relevant nor funny. :-|

Someone didn't get any last night...

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



Re: [PHP] A puzzler (well, for me at least)

2009-02-26 Thread Richard Heyes
 Not taking pipelining into account, a 3GHz processor will execute one
 instruction in 333 picoseconds, so three instructions in a nanosecond.
 How many instructions to a line of code?  10,000 ?

Ooh, less than that - round about 1000. I have some Javascript that
I'm curious about, and since it's usually got most of the CPU to play
with, I reckon it will be plenty fast enough. Nice to know that I can
be sloppy though if I wanted to.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-17 Thread Richard Heyes
 The *other* white meat?

Sorry, no idea what that means.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-17 Thread Richard Heyes
 Can someone explain to me why pear mail_mime is not a good idea to use? I
 noticed some comments like that a few times but no explanation

There's no reason not to use it - it works for a good many people. And
a few cats too.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-17 Thread Richard Heyes
 Cats are the other white meat. Sorry have flu, may be delirious

You haven't been around any birds recently have you?

-- 
(A concerned) Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



Re: [PHP] display_errors and error_reporting not enough?

2009-02-17 Thread Richard Heyes
 When I make something wrong like syntax error; I get blank pages.

Because the PHP code is not running (because of the syntax error), and
thus not setting the error reporting as desired. You'll need to aither
use a .htaccess file (if you're running Apache) or make the changes in
your php.ini file (and restart your web server). Either way you won't
be able to use the constants (which you use only in a PHP script. IIRC
the correct directive would be:

error_reporting 2047

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-16 Thread Richard Heyes
Hi,

 my problem is that I send an e-mail with an attachment (pdf file). I get the
 filename out of a mysql table. While using echo or downloading the file, the
 filename is showed as expected but as an attachment it is not properly
 encoded:
 Should be: PC-Beschaffung 2008 (nur für Lehre)
 Will be: US-ASCII''PC-Beschaffung%202008%20(nur%20f%C3%BCr%20Lehre)

 I think I have to encode the file name and already tried utf8encode but this
 didn't help.

This may help:

http://www.phpguru.org/static/mime.mail.html

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



Re: [PHP] ?php=

2009-02-16 Thread Richard Heyes
 ...

Sorry, should've mentioned, I'm talking about PHP6.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-16 Thread Richard Heyes
 I'm already using pear Mail_Mime.

[Ducks and runs off]

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



[PHP] ?php=

2009-02-15 Thread Richard Heyes
Hi,

Does anyone the status of ?php=, as opposed to ?= ? And if it's even
being implemented?

Thanks.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



Re: [PHP] Reverse IP lookup

2009-02-15 Thread Richard Heyes
 Is there anyway to get a list of sitess that are on a specific IP?

Not AFAIK. You can get the name associated with that IP adress (IIRC),
but one IP could be serving multiple sites using virtual hosting.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



Re: [PHP] sprintf thousand separator.

2009-02-11 Thread Richard Heyes
 Thanks for your answer, but my real problem is to get thousand separator in
 jpgraph class which uses sprintf to display almost everithing;

Can you format it first, and then pass it to JPGraph ?

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 31st)

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



Re: [PHP] paging

2009-02-10 Thread Richard Heyes
 ...

Hi,

Too lazy to actually read the email (tsk), but there's rather a nice
paging library in PEAR that may help. Imaginitively called Pager.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 31st)

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



Re: [PHP] Re: paging

2009-02-10 Thread Richard Heyes
 ...

Are you the same Tony Marston who was on the Demon Internet webmaster
type mailing list? (I don't remember the actual name).

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 31st)

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



[PHP] PHP usage stats

2009-02-08 Thread Richard Heyes
Hi,

Can anyone point out some general statistics on PHP usage compared to
other server languages? I've tried Netcraft, but they only appear (or
I've only found) to have statistics on the httpd server used.

Thanks.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 31st)

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



Re: [PHP] PHP usage stats

2009-02-08 Thread Richard Heyes
Hi,

 Why anyone would see value in such a number is beyond me.

Just trying to get an (over)view of the market.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 31st)

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



Re: [PHP] long echo statement performance question

2009-02-06 Thread Richard Heyes
 ...

Wouldn't have thought so. But for readability, you may find this a
little easier instead:

?
{$var1} Blah {$var2}
...
?php

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 31st)

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



Re: [PHP] long echo statement performance question

2009-02-06 Thread Richard Heyes
 Wouldn't have thought so. But for readability, you may find this a
 little easier instead:

Slight correction:

?
?=$var1? blah ?=var2?
?php

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 31st)

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



Re: [PHP] Where does the sendmail() function come from?

2009-02-05 Thread Richard Heyes
Hi,

 A while back someone mentioned that I could use the sendmail() function
 like this:

 sendmail(envelope-from,envelope-to,mailtext)

 I'm now in the process of moving a site to a new webserver, and for some
 reason I haven't got a sendmail() any more.  I can't find a reference
 to it in the manual, so where does it come from?

Presumably it's either undocumented or user defined.
get_defined_functions() will help you in determining that.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 31st)

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



Re: [PHP] Where does the sendmail() function come from?

2009-02-05 Thread Richard Heyes
 think I shouldve stayed
 in bed today.

I feel like that most days...

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 31st)

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



  1   2   3   4   5   6   7   8   9   >