Re: [PHP-DB] php v jsp

2004-11-20 Thread John Lim
See  http://peteryared.blogspot.com/2003/09/next-language.html.
Peter Yared was formerly CTO for Sun's Application Server groups.
He has rejected JSP/J2EE and is now advocating solutions such as PHP.

Pretty damning, given Peter's background:

" The Java API’s grow into a morass of inconsistent and incomprehensible API’s, 
even the most simple things proved to be very complicated. The vast majority 
of J2EE deployments (over 80% according to Gartner) are simply Servlet/JSP 
to JDBC applications. Basically HTML front-ends to relational databases. It 
is ironic that much of what makes Java complicated today is all of its 
numerous band-aid extensions, such as generics and JSP templates, which were 
added to make these types of simple applications easier to develop. "

"John Holmes" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Vikas Nanda wrote:
>
>> I just wanted to know what the advantages are of using php against jsp. 
>> My supervisor wants me to use jsp but I think that php might be
> > better. Also can php code be easy reused like jsp?
>
> Why would you think such a thing? They both accomplish the same mission 
> using similar strategies. A competant JSP programmer is going to make a 
> better program than a newbie PHP programmer and vice versa.
>
> Which programming language do you know? What kind of hardware are you 
> using? How many programmers are on your team? What kind of program are you 
> developing?
>
> The question isn't as simple as JSP vs. PHP vs. .NET, etc, many other 
> things need to be taken into consideration, too. You may just have to 
> accept that JSP is a better solution in this instance. Or you may weigh 
> all of the above and decide it'd be stupid to not use PHP.
>
> -- 
>
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals – www.phparch.com 

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



[PHP-DB] ANN: MySQLDiff 0.1, program to output diffs between MySQL tables

2004-11-20 Thread Rajesh Kumar
Hello PHP Community,
MySQLDiff is a PHP5 command-line utility that prints SQL statements to
sync two MySQL databases or tables.
This program works just like the original MySQLDiff
(http://www.mysqldiff.org/), but is much faster and is useful for
quickly comparing two databases.
The source code may be obtained from a public Subversion repository, and
tested as shown:
  $ svn co http://www.svnhosting.org:8000/svn/mysqldiff/trunk mysqldiff
  $ cd mysqldiff
  $ sudo make install
.. installs to /usr/local/bin/mysqldiff
  $ mysqldiff db1 db2
  $ mysqldiff --paranoid db1.tbl db2.tbl
	
MySQLdiff is still alpha and requires heavy testing and
improvements. All required PEAR packages are packaged with MySQLDiff. 
Copyrights may have been violated with regards to PEAR::Text_Diff. If 
so, I'm prepared to take necessary action.

Please contact me (off-list) if you're interested in becoming a 
developer. Please send patches against the HEAD revision by executing 
`svn up && svn diff'

Bug reports, feature suggestions and help requests welcome.
--
Rajesh Kumar
MySQLDiff Maintainer
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: Optimize Query Output

2004-11-20 Thread Michael Stassen
GH wrote:
I have the following query:
SELECT A.`AttID` , S.`SessionDate` , P.LastName, P.FirstName, A.`Present`
FROM `Attendance` A, Sessions S, Participants P
WHERE S.SessionID = A.`Session` AND P.Part_ID = A.`Participant`
GROUP BY P.LastName, P.FirstName, A.Present, A.AttID
Selecting S.SessionDate can get you in trouble here, as it is not one of 
your GROUP BY columns.  Many systems wouldn't allow this.  MySQL does, but 
the result only makes sense if there is a unique value of S.SessionDate per 
group.  Perhaps that's the case for you.  In any event, I don't see why you 
are using GROUP BY, as you are not using any aggregate functions.  Based on 
your sample desired output, I think you want

  ORDER BY P.LastName, P.FirstName, S.SessionDate
rather than GROUP BY.
I would like to have the output to have the P.LastName and P.FirstName
values only shown once and the rest of the output printed...
So instead of something like:
+---+-+-+---+-+
| AttID | SessionDate | LastName| FirstName | Present |
+---+-+-+---+-+
| 1 | 2004-10-30  | Apple   | Robert| Yes |
|11 | 2004-11-06  | Apple   | Robert| Yes |
|31 | 2004-11-13  | Apple   | Robert| Yes |
| 2 | 2004-10-30  | Bravo   | Lisa  | Yes |
|32 | 2004-11-13  | Bravo   | Lisa  | Yes |
|12 | 2004-11-06  | Bravo   | Lisa  | No  |
| 3 | 2004-10-30  | Beta| Elaine| Yes |
|13 | 2004-11-06  | Beta| Elaine| Yes |
|14 | 2004-11-06  | Delta   | Alexander | Yes |
|35 | 2004-11-13  | Delta   | Alexander | Yes |

To have it look like:
+-+---+---+-+-+
| LastName| FirstName | AttID | SessionDate | Present |
+-+---+---+-+-+
| Apple   | Robert S. | 1 |  2004-10-30 | Yes |
| |   |11 |  2004-11-06 | Yes |
| |   |31 |  2004-11-13 | Yes |
| Bravo   | Luz   | 2 |  2004-10-30 | Yes |
| |   |32 |  2004-11-06 | No  |
| |   |12 |  2004-11-13 | Yes |
| Beta| Elaine| 3 |  2004-10-30 | Yes |
| |   |13 |  2004-11-06 | Yes |
| Delta   | Alexander |14 |  2004-11-06 | Yes |
| |   |35 |  2004-11-13 | Yes |
.
Please advise I am running on mySql 4.0
I usually do this in my application code, by only printing values in the 
name columns when they change, but something like the following should work:

  SET @ln = '', @fn = '';
  SELECT
   IF(P.LastName = @ln, '', @ln:= P.LastName) AS 'LastName',
   IF(P.FirstName = @fn, '', @fn:= P.FirstName) AS 'FirstName',
   A.AttID,
   S.SessionDate,
   A.Present
  FROM Attendance A, Sessions S, Participants P
  WHERE S.SessionID = A.Session AND P.Part_ID = A.Participant
  ORDER BY P.LastName, P.FirstName, S.SessionDate;
Hmmm..  Now that I think about it, that won't print the last name if only 
the first name changes ('Smith, Jane' followed by 'Smith, John'), nor will 
it print the first name if only the last name changes ('Johnson, Amy' 
followed by 'Jones, Amy').  Perhaps this would be better:

  SET @name = '';
  SELECT
   IF(CONCAT(P.LastName, ', ', P.FirstName) = @name,
   '',
   @name:= CONCAT(P.LastName, ', ', P.FirstName)
 ) AS 'Name',
   A.AttID,
   S.SessionDate,
   A.Present
  FROM Attendance A, Sessions S, Participants P
  WHERE S.SessionID = A.Session AND P.Part_ID = A.Participant
  ORDER BY P.LastName, P.FirstName, S.SessionDate;
Michael
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Optimize Query Output

2004-11-20 Thread Bastien Koert
Usse PHP to control the output, test for the value and if it changes show 
else don't show it

bastien
From: GH <[EMAIL PROTECTED]>
Reply-To: GH <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: [PHP-DB] Optimize Query Output
Date: Sat, 20 Nov 2004 00:39:36 -0500
I have the following query:
SELECT A.`AttID` , S.`SessionDate` , P.LastName, P.FirstName, A.`Present`
FROM `Attendance` A, Sessions S, Participants P
WHERE S.SessionID = A.`Session` AND P.Part_ID = A.`Participant`
GROUP BY P.LastName, P.FirstName, A.Present, A.AttID
I would like to have the output to have the P.LastName and P.FirstName
values only shown once and the rest of the output printed...
So instead of something like:
+---+-+-+---+-+
| AttID | SessionDate | LastName| FirstName | Present |
+---+-+-+---+-+
| 1 | 2004-10-30  | Apple | Robert  | Yes |
|11 | 2004-11-06  | Apple | Robert  | Yes |
|31 | 2004-11-13  | Apple | Robert  | Yes |
| 2 | 2004-10-30  | Bravo | Lisa   | Yes |
|32 | 2004-11-13  | Bravo | Lisa   | Yes |
|12 | 2004-11-06  | Bravo | Lisa   | No  |
| 3 | 2004-10-30  | Beta   | Elaine| Yes |
|13 | 2004-11-06  | Beta   | Elaine| Yes |
|14 | 2004-11-06  | Delta | Alexander | Yes |
|35 | 2004-11-13  | Delta | Alexander | Yes |

To have it look like:
+-+---+---+-+-+
| LastName| FirstName | AttID | SessionDate | Present |
+-+---+---+-+-+
| Apple | Robert S. | 1 | 2004-10-30  | Yes |
|   |   |11|  2004-11-06 | Yes |
|   |   |31|  2004-11-13 | Yes |
| Bravo | Luz   | 2 | 2004-10-30  | Yes |
|  | |32|  2004-11-06 | No |
|   |   |12|  2004-11-13 | Yes |
| Beta   | Elaine| 3 | 2004-10-30  | Yes |
|  |   |13|  2004-11-06 | Yes |
| Delta  | Alexander |14 | 2004-11-06  | Yes |
|   |   |35|  2004-11-13 | Yes |
.
Please advise I am running on mySql 4.0
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] php v jsp

2004-11-20 Thread John Holmes
Vikas Nanda wrote:
I just wanted to know what the advantages are of using php against 
> jsp. My supervisor wants me to use jsp but I think that php might be
> better. Also can php code be easy reused like jsp?
Why would you think such a thing? They both accomplish the same mission 
using similar strategies. A competant JSP programmer is going to make a 
better program than a newbie PHP programmer and vice versa.

Which programming language do you know? What kind of hardware are you 
using? How many programmers are on your team? What kind of program are 
you developing?

The question isn't as simple as JSP vs. PHP vs. .NET, etc, many other 
things need to be taken into consideration, too. You may just have to 
accept that JSP is a better solution in this instance. Or you may weigh 
all of the above and decide it'd be stupid to not use PHP.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Client username

2004-11-20 Thread Ganesh Babu Nallamothu, Integra-India
Hi all,

How to find the login name of client machine in php?

Regards,
Ganesh

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



Re: [PHP-DB] Optimize Query Output

2004-11-20 Thread John Holmes
GH wrote:
I have the following query:
SELECT A.`AttID` , S.`SessionDate` , P.LastName, P.FirstName, A.`Present`
FROM `Attendance` A, Sessions S, Participants P
WHERE S.SessionID = A.`Session` AND P.Part_ID = A.`Participant`
GROUP BY P.LastName, P.FirstName, A.Present, A.AttID
I would like to have the output to have the P.LastName and P.FirstName
values only shown once and the rest of the output printed...
So instead of something like:
| 1 | 2004-10-30  | Apple | Robert  | Yes |
|11 | 2004-11-06  | Apple | Robert  | Yes |
To have it look like:
>
| Apple | Robert S. | 1 | 2004-10-30  | Yes |
|   |   |11|  2004-11-06 | Yes |
|   |   |31|  2004-11-13 | Yes |
| Bravo | Luz   | 2 | 2004-10-30  | Yes |
|  | |32|  2004-11-06 | No |
Your query is never going to look like that. You use PHP to format the 
result set so it displays how you want it. As you loop through the 
returned rows, keep track of what the current first and last name are. 
If they change, then output them, otherwise output a blank cell.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Optimize Query Output

2004-11-20 Thread Joseph Crawford
the display really has nothing to do with SQL but rather your php
output format.  you would use php to display the data however you want
it formatted.


-- 
Joseph Crawford Jr.
Codebowl Solutions
[EMAIL PROTECTED]

For a GMail account
contact me OFF-LIST

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



Re: [PHP-DB] php v jsp

2004-11-20 Thread Joseph Crawford
Depending on how you code, PHP can easilly be reused.

if you program procedurally it is much more difficult to reuse code
however it can be done through the use of including files.  If you go
for the object oriented approach, php is easy to expand and reuse the
code.  OO is also a cleaner more organized way to use PHP when working
in a team environment.

-- 
Joseph Crawford Jr.
Codebowl Solutions
[EMAIL PROTECTED]

For a GMail account
contact me OFF-LIST

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



[PHP-DB] php v jsp

2004-11-20 Thread Vikas Nanda
Hi 
 
I just wanted to know what the advantages are of using php against jsp. My 
supervisor wants me to use jsp but I think that php might be better. Also can 
php code be easy reused like jsp?
 
Many thanks all
 
Vikas


-
Moving house? Beach bar in Thailand? New Wardrobe? Win £10k with Yahoo! Mail to 
make your dream a reality.