php-general Digest 5 Jun 2009 14:22:19 -0000 Issue 6160
Topics (messages 293646 through 293666):
Re: PHP Graphing Libraries...?
293646 by: Paul M Foster
293647 by: Michael A. Peters
293656 by: Richard Heyes
293658 by: lists.mgreg.com
293659 by: Eddie Drapkin
293661 by: Paul M Foster
293662 by: Al
293665 by: Michael A. Peters
293666 by: lists.mgreg.com
preg_replace
293648 by: Ben Miller
293650 by: Ben Miller
293651 by: Marc Steinert
Re: https setup
293649 by: Per Jessen
293654 by: Michael A. Peters
Re: Listening on host:port - Windows
293652 by: John Fairley
databse query
293653 by: web
Re: formatting - design question
293655 by: Peter Ford
293664 by: tedd
PHP, OOP and AJAX
293657 by: Julian Muscat Doublesin
Re: Web application design considerations - a good reference ?
293660 by: Julian Muscat Doublesin
Google Calendar Integration
293663 by: Leonard Burton
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
On Thu, Jun 04, 2009 at 01:50:28PM -0700, Michael A. Peters wrote:
> [email protected] wrote:
>> Hi All,
>>
>> I'm currently looking for a quality (preferably open source) PHP
>> graphing library that will allow me to create various graphs and plot
>> points. I've seen several that do some amazing things, but cost a
>> fortune -- others are either limited, lack documentation, or don't allow
>> plotting of points for multiple entities within the same graph.
>>
>> Can anyone make any quality suggestions?
>>
>> Best,
>> Michael
>>
>
> gnuplot may be what you want - but it doesn't have php bindings as far
> as I know, so you'll have to call it via a system call.
I use Gnuplot every week to graph the statistics of my business. It's
extremely flexible, and will output not only to graphics formats, but to
PDF format, if I'm not mistaken.
Paul
--
Paul M. Foster
--- End Message ---
--- Begin Message ---
Paul M Foster wrote:
On Thu, Jun 04, 2009 at 01:50:28PM -0700, Michael A. Peters wrote:
[email protected] wrote:
Hi All,
I'm currently looking for a quality (preferably open source) PHP
graphing library that will allow me to create various graphs and plot
points. I've seen several that do some amazing things, but cost a
fortune -- others are either limited, lack documentation, or don't allow
plotting of points for multiple entities within the same graph.
Can anyone make any quality suggestions?
Best,
Michael
gnuplot may be what you want - but it doesn't have php bindings as far
as I know, so you'll have to call it via a system call.
I use Gnuplot every week to graph the statistics of my business. It's
extremely flexible, and will output not only to graphics formats, but to
PDF format, if I'm not mistaken.
I know for a fact it outputs to postscript, as I've used that with TeX
before, so it probably does pdf as well (and if not - pdf is just a
ps2pdf away).
--- End Message ---
--- Begin Message ---
> ...
I would have to suggest RGraph... ( http://www.rgraph.net ) :-) It's
uses canvas though, so browser support is limited at the moment though
to Firefox 3.5, Safari 4 and Chrome 2.
--
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
--- End Message ---
--- Begin Message ---
On Jun 5, 2009, at 5:26 AM, Richard Heyes wrote:
...
I would have to suggest RGraph... ( http://www.rgraph.net ) :-) It's
uses canvas though, so browser support is limited at the moment though
to Firefox 3.5, Safari 4 and Chrome 2.
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...?
Best,
Michael
--- End Message ---
--- Begin Message ---
I've had a lot of success with flot, but that's a jQuery plugin, so it may
not be exactly what you need. If you're just making graphs for client side
viewing, it ought to be sufficient, though.
On Fri, Jun 5, 2009 at 8:33 AM, [email protected] <[email protected]> wrote:
>
> On Jun 5, 2009, at 5:26 AM, Richard Heyes wrote:
>
> ...
>>>
>>
>> I would have to suggest RGraph... ( http://www.rgraph.net ) :-) It's
>> uses canvas though, so browser support is limited at the moment though
>> to Firefox 3.5, Safari 4 and Chrome 2.
>>
>
>
> 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...?
>
>
> Best,
> Michael
--- End Message ---
--- Begin Message ---
On Thu, Jun 04, 2009 at 09:17:07PM -0700, Michael A. Peters wrote:
> Paul M Foster wrote:
>> On Thu, Jun 04, 2009 at 01:50:28PM -0700, Michael A. Peters wrote:
>>
>>> [email protected] wrote:
>>>> Hi All,
>>>>
>>>> I'm currently looking for a quality (preferably open source) PHP
>>>> graphing library that will allow me to create various graphs and plot
>>>> points. I've seen several that do some amazing things, but cost a
>>>> fortune -- others are either limited, lack documentation, or don't allow
>>>> plotting of points for multiple entities within the same graph.
>>>>
>>>> Can anyone make any quality suggestions?
>>>>
>>>> Best,
>>>> Michael
>>>>
>>> gnuplot may be what you want - but it doesn't have php bindings as far
>>> as I know, so you'll have to call it via a system call.
>>
>> I use Gnuplot every week to graph the statistics of my business. It's
>> extremely flexible, and will output not only to graphics formats, but to
>> PDF format, if I'm not mistaken.
>
> I know for a fact it outputs to postscript, as I've used that with TeX
> before, so it probably does pdf as well (and if not - pdf is just a
> ps2pdf away).
Now that I think of it, that's probably how I do it (ps2pdf).
Paul
--
Paul M. Foster
--- End Message ---
--- Begin Message ---
[email protected] wrote:
Hi All,
I'm currently looking for a quality (preferably open source) PHP
graphing library that will allow me to create various graphs and plot
points. I've seen several that do some amazing things, but cost a
fortune -- others are either limited, lack documentation, or don't allow
plotting of points for multiple entities within the same graph.
Can anyone make any quality suggestions?
Best,
Michael
Imagemagick may do it for you. Here is just one example.
http://www.imagemagick.org/Usage/draw/#bezier
Use the PHP API http://docs.php.net/manual/en/book.imagick.php
Here are some simple graph examples: http://valokuva.org/?cat=2&paged=2
The learning curve is a bit steep; but, once you get the hang of it, things work
great.
--- End Message ---
--- Begin Message ---
[email protected] wrote:
On Jun 5, 2009, at 5:26 AM, Richard Heyes wrote:
...
I would have to suggest RGraph... ( http://www.rgraph.net ) :-) It's
uses canvas though, so browser support is limited at the moment though
to Firefox 3.5, Safari 4 and Chrome 2.
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...?
Sure - the gd library.
Scale the x/y position according to your needs.
--- End Message ---
--- Begin Message ---
On Jun 5, 2009, at 9:41 AM, Michael A. Peters wrote:
Sure - the gd library.
Scale the x/y position according to your needs.
Well, I was trying to avoid building from scratch, but you may be
right. I'm surprised no one else has need for an intuitive setup of
this nature.
Thanks,
Michael
--- End Message ---
--- Begin Message ---
I bought PHP & MySQL for DUMMIES and it shows me how to use special
characters for pattern matching and I've figured out the basics of using
preg_replace to replace pattern matches. What I am having trouble with,
though, is figuring out how to replace anything that does not match the
pattern. For example, I want to replace anything that is NOT an
alphanumeric character. Any help would be appreciated. Thanks.
Ben
--- End Message ---
--- Begin Message ---
Oh yeah - not sure if spaces are considered alphanumeric or not, but I need
to keep spaces - replacing anything that is NOT a letter, a number or a
space. Thanks again.
-----Original Message-----
From: Ben Miller [mailto:[email protected]]
Sent: Friday, June 05, 2009 2:09 AM
To: [email protected]
Subject: [PHP] preg_replace
I bought PHP & MySQL for DUMMIES and it shows me how to use special
characters for pattern matching and I've figured out the basics of using
preg_replace to replace pattern matches. What I am having trouble with,
though, is figuring out how to replace anything that does not match the
pattern. For example, I want to replace anything that is NOT an
alphanumeric character. Any help would be appreciated. Thanks.
Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hey Ben,
to replace everything thats not alphanumeric, use the following statement:
$output = preg_replace('/[^[:alnum:]]/', '', $input);
Greetings from Germany
Marc
PS: Spaces are not alphanumeric ;)
Ben Miller wrote:
Oh yeah - not sure if spaces are considered alphanumeric or not, but I need
to keep spaces - replacing anything that is NOT a letter, a number or a
space. Thanks again.
-----Original Message-----
From: Ben Miller [mailto:[email protected]]
Sent: Friday, June 05, 2009 2:09 AM
To: [email protected]
Subject: [PHP] preg_replace
I bought PHP & MySQL for DUMMIES and it shows me how to use special
characters for pattern matching and I've figured out the basics of using
preg_replace to replace pattern matches. What I am having trouble with,
though, is figuring out how to replace anything that does not match the
pattern. For example, I want to replace anything that is NOT an
alphanumeric character. Any help would be appreciated. Thanks.
Ben
--
Synchronize and share your files over the web for free
http://bithub.net/
My Twitter feed
http://twitter.com/MarcSteinert
--- End Message ---
--- Begin Message ---
PJ wrote:
> Can't find anything on G or web - but I probably didn't try hard
> enough.
Correct :-)
> I am unable to set my virtual hosts to handle https.
> I have apache22, mod_ssl, opnenssl and the httpd and httpd-vhosts.conf
> files are set up "correctly" but directing a sensitive user
> information page to an HTTPS page returns an error of "not found". The
> virtual hosts works fine, except for HTTPS.
> This is on my intranet for local developing.
Is your webserver listening for https requests? Port 443, check it
with "netstat -ltn". Or check your "listen.conf" file.
/Per
--
Per Jessen, Zürich (20.2°C)
--- End Message ---
--- Begin Message ---
PJ wrote:
Can't find anything on G or web - but I probably didn't try hard enough.
I am unable to set my virtual hosts to handle https.
I have apache22, mod_ssl, opnenssl and the httpd and httpd-vhosts.conf
files are set up "correctly" but directing a sensitive user information
page to an HTTPS page returns an error of "not found". The virtual hosts
works fine, except for HTTPS.
This is on my intranet for local developing.
TIA
By "not found" do you mean a 404 error from the https domain?
If so, then you probably just have the DocumentRoot directive set up
incorrectly for your secure domain.
--- End Message ---
--- Begin Message ---
Thanks, you are right. I used php.exe -v to confirm cgi version.
My query is what parameter do I use to specify host and port? That will have
the same effect as -b in php5.
Sorry if I didn't make it clear.
John
_____
From: ?? [mailto:[email protected]]
Sent: Friday, June 05, 2009 8:24 AM
To: [email protected]
Subject: Re: [PHP] Listening on host:port - Windows
in php4,php.exe is the cgi version for default,and php-cli is the cli
version
in php5,php.exe is the cli version,and php-cgi is the cgi version
i think you can use php.exe instead of php-cgi.exe in php4
2009/6/5 John Fairley <[email protected]>
I'm running my test server on Windows XP SP3 and have been successfully
running PHP 5 for some time using:
php-cgi.exe -b 127.0.0.1:10000
My live server is running on PHP 4.4 and that gives an incompatibility risk
in problem solving. So I've removed PHP 5 on my test server and have
installed PHP 4.4.9 but I can't find how I set host and port in php.
Running php -v has confirmed that this is the cgi-fcgi version.
I'm sure it's simple but I'm being driven nuts.
TIA,
John
--- End Message ---
--- Begin Message ---
Hello to all,
please i'm new PHP and trying to display some records from my db using
dreamweaver.
I have 2 tables ( Subjects and Pages) where Subjects is the parent and Pages
is the child.
I want to get all pages belonging to each subject but my query gives me all
pages under the first result of the query.
How can I get only pages of each subject under it's own ID ( parent + it's
child)?
I'll include my code for better reference.
<?php require_once('../../Connections/shop.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "",
$theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ?
mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" :
"NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue :
$theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_shop, $shop);
$query_menu_list = "SELECT * FROM subjets";
$menu_list = mysql_query($query_menu_list, $shop) or die(mysql_error());
$row_menu_list = mysql_fetch_assoc($menu_list);
$totalRows_menu_list = mysql_num_rows($menu_list);
mysql_select_db($database_shop, $shop);
$query_pages = "SELECT * FROM pages WHERE id_subject = id";
$pages = mysql_query($query_pages, $shop) or die(mysql_error());
$row_pages = mysql_fetch_assoc($pages);
$totalRows_pages = mysql_num_rows($pages);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>menu_list</title>
</head>
<body>
<?php while ($row_menu_list = mysql_fetch_assoc($menu_list)){
echo "<li>{$row_menu_list['subget_name']}</li>" ;
while ($row_pages = mysql_fetch_assoc($pages)){
echo "<li>{$row_pages['page_name']}</li>";}
} ?>
</body>
</html>
<?php
mysql_free_result($menu_list);
mysql_free_result($pages);
?>
The query gives this result:
* informatica
* Dove Siamo
* Lorem
* web templates in vendita
* assistenza
* shop
* contatti
--- End Message ---
--- Begin Message ---
PJ wrote:
> tedd wrote:
>> At 3:58 PM -0400 6/4/09, PJ wrote:
>>> tedd wrote:
>>>
>>> > Style sheets are meant simplify things so decide on how you want
>>>> things to look uniformly throughout your site and then stick with it.
>>>> There's really no good reason to keep changing things throughout a
>>>> site.
>>>>
>>>> Cheers,
>>>>
>>>> tedd
>>>>
>>>>
>>> Maybe I'm just too complicated. ;-)
>>> I do try to keep it simple. But then, little things creep in, like a
>>> login box on the index page which mucks up all the other pages. Then
>>> there is a recipe page which is totally different, yet to keep is
>>> stylistically continuous it uses a similar layout to the other pages but
>>> different. The same for the main recipe page, and the same for the
>>> portraits of producers - all the pages are different yet remain within a
>>> cohesive style. CSS gets super bloated and almost unamageable. Most
>>> sites are very repetitive; mine tend to be "provocative" or semthing
>>> like that. I really don't see an ooption. Although, Nitsan's body tags
>>> sound promising. I'll have to try that; maybe the solution is to do a
>>> series of definitions unique just fo certain pages. :-)
>> That's simply an example of not thinking things out before you write
>> the code.
>>
>> First you figure out a layout, then you populate it. You don't pick a
>> layout, populate it and then change the layout. That leads to a
>> lackluster and "lack of thought" site.
>>
>> Cheers,
>>
>> tedd
>>
>>
> If only it were that simple.
> When one is developing, one is always changing. And even when you're
> finally "live and on the air", you will still be changing or else your
> site will die before your client gets a chance to see all you can offer.
> It's a matter of evolution and adaptation, Darwin. ;-)
>
Agree with PJ here:
More likely, you go live and the boss says "Can you make that look more like
...?"
"Er, yes, but it totally stuffs the whole design..."
Evolution was *not* carefully thought out - that would be Intelligent Design
<spit/>
--
Peter Ford phone: 01580 893333
Developer fax: 01580 893399
Justcroft International Ltd., Staplehurst, Kent
--- End Message ---
--- Begin Message ---
At 4:54 PM -0400 6/4/09, PJ wrote:
tedd wrote:
> That's simply an example of not thinking things out before you write
the code.
First you figure out a layout, then you populate it. You don't pick a
> layout, populate it and then change the layout.
>
>
If only it were that simple.
When one is developing, one is always changing. And even when you're
finally "live and on the air", you will still be changing or else your
site will die before your client gets a chance to see all you can offer.
It's a matter of evolution and adaptation, Darwin. ;-)
I understand clients changing their minds in mid-stream and wanting
things to be different. That's Okay, because they pay for it --
PROVIDED -- that a meeting of the minds was made with the last layout.
So, before any change is made to the current layout, an agreement
must be made as to what that change is going to be. Anything else
(i.e., let's see if I like it) is going to be very time consuming on
your part.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Update.
Hello Everyone,
First of all, thank you all for your input. I ran a sinmple test using the
suggestions you gave me and and require_once.
Using firebug to test the output, I got an internal server error. I found
out what the problem was.
What I am doing is I have classes which represent the objects, another
class containing the functions. From the function class I create an instance
of each object, manipulate the information, return the HTML result. Finally
I have a runner class that creates an instance of the function class, calls
the function required and outputs the information.
What the problem was for some reason I was did not create an instance of the
function class, just was calling the function. Well by creating the runner
class I solved the problem.
Thanks all for your help.
Regards
Julian
--- End Message ---
--- Begin Message ---
Hi,
If you want to develop a professional business - enterprise application I
suggest you research books related to Database Design and Development, and
Business Systems Analysis.
UML or Unified Modeling Language will help you with database design and
system design. ERD - Entity Relationship Diagrams are the bassis of
understading weather you have a good dtabse design. The RDBMS - Relational
Database Management System.
Other models will help you understand the flow of your programme before you
start and development. Inorder to have a good system you have to have a good
design.
A GOOD DESIGN IS THE BASIS OF EVERYHTHING.
Through this you will learn other things such as SDLC - Software Develpment
Life Cycle. There are many diffrent models you may use to develop an
profesional application. In the end its up to you to choose.
Regards
Julian
On Tue, Jun 2, 2009 at 6:50 AM, Angus Mann <[email protected]> wrote:
> Hi all.
>
> I'm working on a PHP project for my own personal business use. It will
> handle billing and invoices as well as payments and time management,
> bookings, appointments and a few more. I may add things like personal
> messaging between the various users and a customer login to check on the
> progress of their accounts.
>
> It is a big project and will probably take a year or so to complete in my
> spare time.
>
> I have made a couple of starts but I have no experience in creating such
> large applications and I find I often end up with spaghetti code. I've tried
> using session variables to keep track of where and what the program is doing
> but there are so many permuations and combinations I found myself writing
> endless streams of if's, and's and or's just to figure out what page to
> display.
>
> The code is not the probblem for me...it's the flow and organization of the
> code.
>
> Can anybody point me to a good book or tutorial that lays down the
> principles and gives some suggestions for integrating the many subroutines
> of a large application? I want to make the code readable and logical in its
> flow, and avoid repetition of code segments.
>
> Much appreciated.
> Angus
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
HI All,
Has anyone used Google Calendar (of course via PHP) to allow clients
to schedule appointments from the business's webpage? If so, would
you please tell me how you made it so it would only show the client
times which were available and of course not listing private client
details?
Thanks,
--
Leonard Burton, N9URK
http://www.jiffyslides.com
[email protected]
[email protected]
"The prolonged evacuation would have dramatically affected the
survivability of the occupants."
--- End Message ---