php-general Digest 23 Apr 2008 11:23:57 -0000 Issue 5420

Topics (messages 273450 through 273463):

Re: php framework vs just php?
        273450 by: Tony Marston
        273451 by: Tony Marston
        273452 by: Tony Marston
        273453 by: Shawn McKenzie
        273459 by: Robert Cummings
        273460 by: Robert Cummings
        273461 by: Robert Cummings
        273462 by: Robert Cummings
        273463 by: Lester Caine

Should This Newbie Learn From Dreamweaver?
        273454 by: revDAVE
        273456 by: Ray Hauge
        273457 by: Jason Pruim
        273458 by: Larry Garfield

Check it out
        273455 by: Robert Burdo

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 ---
"Shawn McKenzie" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Tony Marston wrote:
>> ""Jay Blanchard"" <[EMAIL PROTECTED]> wrote in message 
>> news:[EMAIL PROTECTED]
>>> [snip]
>>>> But can you create a database table, then generate the PHP scripts 
>>>> which
>>>> generate the HTML and SQL which allow an online user to read, write,
>>>> update
>>>> and delete records from this table without writing even a single line 
>>>> of
>>>> code? Can you do this with immediate access to a role based access
>>>> control system, an audit logging system and a workflow system?
>>> [/snip]
>>
>>> Yes, and it doesn't take 5 minutes.
>>
>> Then where can us mere mortals download this wonderful framework so that 
>> we can all share in your wizardry?
>>
> http://cakephp.org
>
> Not sure about the audit logging and I have no idea what a workflow system 
> is.
>
> -Shawn
>

Audit logging - http://www.tonymarston.net/php-mysql/auditlog.html
Workflow - http://www.tonymarston.net/php-mysql/workflow.html

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org 



--- End Message ---
--- Begin Message ---
""Dan Joseph"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Tue, Apr 22, 2008 at 1:40 PM, Tony Marston 
> <[EMAIL PROTECTED]>
> wrote:
>
>> You haven't answered the question. Where can this piece of wizardry be
>> downloaded so that it can be reviewed by your peers?
>>
>>
>>
>>
>
> I didn't originally want to get in the middle of a fist fight, but I've 
> been
> reading this all day, and I really have to ask...
>
> What in the world is wrong with you?  Did you get picked on by the kids in
> the science club always saying their framework was better than yours?
>
> You seem to be arguing that your framework is the only one that anyone
> should use, and is capable of getting the job done.

If you bother to read what I have written you will see that I have ever made 
any such claims. I have simply been answerng the  questions "what is a 
framework" and "what are the benefits of using a framework"

> You based this claim on
> a senseless argument that you can build a table and generate some page to
> handle it in under 5 minutes.

I am saying that using a framework will allow you to create components much 
quicker than not using a framework for the simple reason that you don't have 
to keep writing code to reinvent the wheel - you reuse code that is provided 
within the framework.

>  Who cares?  Do you know what a framework really is?

Actually I do. I have been developing software over three decades in three 
different languages. I have used many frameworks written by other people, 
but I have always been far more productive using framedworks which I have 
written myself.

>  Is it solely a means by which to build an application in as
> little time as possible?

There are two parts to a framework - (a) the ability to generate new 
components, and (b) providing a runtime environment with which to run those 
components.

> Many on the list are saying "We wrote our own, we don't like or want to
> use the ones out there."  Think about the reasons...  We have applications
> we build internally that either (1) the frameworks can't get done, or (2)
> the frameworks are way overkill.

I agree that finding the right framework to use can be very difficult, which 
is why a lot of programmers (like me) prefer to roll their own. But if you 
can find an off-the-shelf framework that does the job it can save you an 
awful amount of time.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

> You are essentially arguing the same point
> that everyone else is.  You've just isolated it to Radicore.  Do you even
> realize that?

I know nothing, I'm from Barcelona!  :)

> -Dan Joseph
>
> "Build a man a fire, and he will be warm for the rest of the day.
> Light a man on fire, and will be warm for the rest of his life."
> 



--- End Message ---
--- Begin Message ---
""Jay Blanchard"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
[snip]
>> You haven't answered the question. Where can this piece of wizardry be
>> downloaded so that it can be reviewed by your peers?
[/snip]

> It is not available for download

So your claims cannot be substantiated by anyone in this group.

> but it has been reviewed by peers on
> several project teams who have used it. It was developed specifically
> for a company who owns the work product. I have not re-created for
> general use by mere mortals but I will soon.

Let me know when as I could do with a good laugh.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org 



--- End Message ---
--- Begin Message ---
Tony Marston wrote:
""Jay Blanchard"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
[snip]
You haven't answered the question. Where can this piece of wizardry be
downloaded so that it can be reviewed by your peers?
[/snip]

It is not available for download

So your claims cannot be substantiated by anyone in this group.

but it has been reviewed by peers on
several project teams who have used it. It was developed specifically
for a company who owns the work product. I have not re-created for
general use by mere mortals but I will soon.

Let me know when as I could do with a good laugh.


Well, if you would take the time to individually download > 1,000 classes and piece them together you may find a very feature rich framework: http://www.phpclasses.org. Or maybe meta storage http://www.meta-language.net/metastorage.html.

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html


--- End Message ---
--- Begin Message ---
On Tue, 2008-04-22 at 22:11 +0800, paragasu wrote:
> >I'm guessing, since you quoted os-commerce and phpBB, you don't know
> >shit code when you see it. Just because it's popular doesn't mean the
> >code is good. Have you ever tried to modify either of these? What a
> >mess.
> honestly, i don't and not really interested to dig inside thus code. but i
> guess, modifying
> the phpBB code not easier than modifying the core of codeIgniter or CakePHP.
> 
> > 10k lines of code built over a framework is not the same as 10k lines
> >  that essentially required you to build your own framework.
> since framework already included a thousand line of code even before you
> start to
> do the program, i think it will be less code if we start to write the
> program on our own.
> Not to mention, the framework core take a lot of diskspace. some more than
> 2MB of code.

You didn't just say 2MB and "lot of diskspace" in the same breath did
you? Please, someone pinch me, I must be dreaming. Space is CHEAP!

> My client is a small2 company. i manage to write code less than 300KB to do
> everything they
> ask me to do. Sure, i do not need all thus fancy feature (caching etc), i do
> not need multiple
> user or role based support provided by framework.

If you're focused on disk space under 5 megs, I would argue you have
your priorities a bit screwed up.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
On Tue, 2008-04-22 at 10:07 -0600, Nathan Nobbe wrote:
> On Tue, Apr 22, 2008 at 9:54 AM, paragasu <[EMAIL PROTECTED]> wrote:
> 
> > i can only think of copy & paste method if i were required to write a PHP
> > application
> > without a single line of code even a simple "hello world!" application.
> >  i am really cannot be in the same league :( . well, i might have to work
> > a
> > little harder.
> >
> 
> imagine a cms, like drupal or joomla.  you install the thing w/ the web
> based installer then go through adding content via the web interface; u can
> do it :D

You said that wrong...

    You can do eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeet!

:)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
On Wed, 2008-04-23 at 01:02 +0800, paragasu wrote:
> > imagine a cms, like drupal or joomla.  you install the thing w/ the web
> > based installer then go through adding content via the web interface; u
> > can
> > do it :D
> >
> > -nathan
> >
> 
> i am going to miss the fun doing programming then.
> 
> As a comparison, framework is like a canned food. available anytime you
> wan't. but still, it doesn't give me the fun of cooking my own meal.
> sometimes, it is not about eating that make me happy. it is  the cooking
> part.
> Same goes for programming. Great cooker invent good recipe and make a
> factories to
> produce the same product in a large number. Great programmer invent
> framework so other
> people can use it to create many program.
> If for productivity. canned food is good.
> But i think, i still prefer sweet & sour fried rice over canned food. don't
> you?

I prefer raw huma^M^M^M^M^M^M^M^M chicken! Yeah, chicken! That's it!

:B

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
On Tue, 2008-04-22 at 19:05 -0500, Shawn McKenzie wrote:
> Tony Marston wrote:
> > ""Jay Blanchard"" <[EMAIL PROTECTED]> wrote in message 
> > news:[EMAIL PROTECTED]
> > [snip]
> >>> You haven't answered the question. Where can this piece of wizardry be
> >>> downloaded so that it can be reviewed by your peers?
> > [/snip]
> > 
> >> It is not available for download
> > 
> > So your claims cannot be substantiated by anyone in this group.
> > 
> >> but it has been reviewed by peers on
> >> several project teams who have used it. It was developed specifically
> >> for a company who owns the work product. I have not re-created for
> >> general use by mere mortals but I will soon.
> > 
> > Let me know when as I could do with a good laugh.
> > 
> 
> Well, if you would take the time to individually download > 1,000 
> classes and piece them together you may find a very feature rich 
> framework: http://www.phpclasses.org.  Or maybe meta storage 
> http://www.meta-language.net/metastorage.html.

Or you may find you've got >999 classes of code you'll never use :) That
would be one hell of an undertaking to piece them together. I'm going to
guess you'll need namespaces too since I bet some of them step on each
other's toes.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
Tony Marston wrote:
Audit logging - http://www.tonymarston.net/php-mysql/auditlog.html
Workflow - http://www.tonymarston.net/php-mysql/workflow.html

Yuck - MySQL :(
A decent database has it's own logging stuff built in ;)
And a decent database library does not care which database you use :)

I think that there is a reasonable 'breakpoint' here. As soon as you what an application structure where users need to log in and security needs managing then ideally that is provided by the framework. Decent frameworks use well established libraries to provide some of those functions - ADOdb and smarty suit me nicely. I can write stand alone stuff via ADOdb direct, or I can work via the framework and access second level functions such as gallery, board, editing and the like. Some applications can directly access the libraries, and that is the hole I have 'dug' myself into since moving from the earlier simple 'framework' to something that provides a proper security and expandability is now proving difficult.

'If it isn't broken don't fix it' causes a problem when YOU know that the step change will make future development easier, but the customers keep asking - 'Can you just add XXX' :(

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

--- End Message ---
--- Begin Message ---
First of all - I know this is an entirely subjective question, and I know
there's no single approach to learning this technology. I'm just looking for
a few hints from seasoned professionals basically whether Dreamweaver
verbose code (at least it looks like that to me at this beginning point) is
all 'needed & necessary'...

I have a background using ColdFusion, however I am new to php / mySQL.

I am caught between two learning approaches:

1 -  I know that generally, it is better to build my knowledge from the
'bottom up' - coding by hand from books and such etc. - and so far I have
been doing that with php and mySQL. Slowly I am getting there. Php is quite
powerful and impressive.

2 - Dreamweaver cs3 is pretty cool.  Creating recordsets -  dynamic data -
updating records etc. is pretty seductive it seems to work well.

A few questions:

One of my issues is that the Dreamweaver code that gets created seems quite
verbose and somewhat complex (like using switch & case in a simple query
listed below...), therefore even harder for this newbie to try to learn
from. My question is this:  Is this Dreamweaver code actually all
modern/necessary (vs a 'simple approach') - or is it way over the top?

Without getting too detailed:

- If in fact you folks say that most of the DW approach (for those that have
seen it) is  'necessary' & 'the right way to do things' - then I will be
happy to use it and try to figure out some of its complexities . But, if you
think that DW is over the the top ('...I don't use all that suff - I do a
query in just a few lines!') ... then I'll just start with the 'bottom up -
code by hand - do it yourself simple approach'.

BTW: if anyone wants to see more DW code - email me off-list - I'll be happy
to send more examples... (I don't want to clog up this cool list)

BTW: I also tried a happy medium - simplifying the DW code - however that
will break its usefulness in DW - and other DW interface items stop working,
so I guess that's not an option right now.

Interested in your thoughts... Dave

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

Example get recordset query w DW:


<?php require_once('../Connections/weblink.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;
}
}

$colname_get_Recordset1 = "-1";
if (isset($_SESSION['mem_id'])) {
  $colname_get_Recordset1 = $_SESSION['mem_id'];
}
mysql_select_db($database_weblink, $weblink);
$query_get_Recordset1 = sprintf("SELECT * FROM tbl_test WHERE mem_id = %s
ORDER BY mem_id ASC", GetSQLValueString($colname_get_Recordset1, "int"));
$get_Recordset1 = mysql_query($query_get_Recordset1, $weblink) or
die(mysql_error());
$row_get_Recordset1 = mysql_fetch_assoc($get_Recordset1);
$totalRows_get_Recordset1 = mysql_num_rows($get_Recordset1);
?><!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>Untitled Document</title>
</head>

<body>
</body>Remember
</html>
<?php
mysql_free_result($get_Recordset1);
?>


--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists]




--- End Message ---
--- Begin Message ---
revDAVE wrote:
First of all - I know this is an entirely subjective question, and I know
there's no single approach to learning this technology. I'm just looking for
a few hints from seasoned professionals basically whether Dreamweaver
verbose code (at least it looks like that to me at this beginning point) is
all 'needed & necessary'...

Like you said it's all subjective, but my opinion is to learn the basics first, then you can rely on your tools to take the mundane work out of the way for you. I'd still suggest using an editor with code completion though, because it will help you when you're trying to remember parameter orders or even function names to a point.

After you feel comfortable with that, then you'll be able to understand what the program is doing for you and it won't be a "black box" that really is unsupportable. I find the best way to do that is to come up with some little program that you code up for fun to help get you through the learning stages. You'll learn more figuring out how to get something to work than just copying and pasting code.

That's my 2 cents.  Hope that helps.

--
Ray Hauge
www.primateapplications.com

--- End Message ---
--- Begin Message ---

On Apr 22, 2008, at 9:04 PM, revDAVE wrote:

First of all - I know this is an entirely subjective question, and I know there's no single approach to learning this technology. I'm just looking for
a few hints from seasoned professionals basically whether Dreamweaver
verbose code (at least it looks like that to me at this beginning point) is
all 'needed & necessary'...

I have a background using ColdFusion, however I am new to php / mySQL.

I am caught between two learning approaches:

1 - I know that generally, it is better to build my knowledge from the 'bottom up' - coding by hand from books and such etc. - and so far I have been doing that with php and mySQL. Slowly I am getting there. Php is quite
powerful and impressive.

When I first started learning PHP/MySQL just about a year ago, I started using dreamweaver 8, just for the code completion/syntax highlighting though... I wanted to be able to visually see where I missed a ' or a " type of thing.

One of the best ways I've found to learn everything though is to take a simple script that is close to what you want, and change it to fit your needs... You can learn alot about how other people code... Which always helped me.

Or do what tedd does.. Build an example of everything that gets asked on the list... See if you can figure it out, once you understand how to do it, fixing and extending it is much easier.


And in regards to the code you posted... That did seem a little verbose.. It probably works great being so specific and all... But my simple queries tend to work good most of the time as well :)



--- End Message ---
--- Begin Message ---
Welcome to PHP!  Please have exact change.

As a general rule, I distrust generated code in PHP, or in HTML.  I virtually 
never use Dreamweaver (or its evil twin, FronPage), as the code it generates 
is rarely what I want at the quality level I want.  Such code is designed for 
the cut-and-paster.  Such code is how we ended up with the same MM_ 
Javascript functions that everyone used for a decade because DW would 
autogenerate them for you, despite their not being that good and generating 
lousy code that is difficult to maintain because the people "writing 
Javascript" didn't actually have the slightest clue what they're doing.

You will get far better code by either writing it by hand yourself or using an 
existing library that someone else with more experience than you wrote by 
hand.  You will also learn more in the process.  (That could be a code 
library or a framework, to nod to the other thread raging right now, but in 
either case it's written by a human.)

Now, you can certainly study assisted code to see what it's doing and figure 
out why, but remember that it's generated by a simple, dumb algorithm so it 
is designed not for speed, readability, or quality, but safety against 
cut-and-paste spoon-coding.  Never use it in actual production.

On Tuesday 22 April 2008, revDAVE wrote:
> First of all - I know this is an entirely subjective question, and I know
> there's no single approach to learning this technology. I'm just looking
> for a few hints from seasoned professionals basically whether Dreamweaver
> verbose code (at least it looks like that to me at this beginning point) is
> all 'needed & necessary'...
>
> I have a background using ColdFusion, however I am new to php / mySQL.
>
> I am caught between two learning approaches:
>
> 1 -  I know that generally, it is better to build my knowledge from the
> 'bottom up' - coding by hand from books and such etc. - and so far I have
> been doing that with php and mySQL. Slowly I am getting there. Php is quite
> powerful and impressive.
>
> 2 - Dreamweaver cs3 is pretty cool.  Creating recordsets -  dynamic data -
> updating records etc. is pretty seductive it seems to work well.
>
> A few questions:
>
> One of my issues is that the Dreamweaver code that gets created seems quite
> verbose and somewhat complex (like using switch & case in a simple query
> listed below...), therefore even harder for this newbie to try to learn
> from. My question is this:  Is this Dreamweaver code actually all
> modern/necessary (vs a 'simple approach') - or is it way over the top?
>
> Without getting too detailed:
>
> - If in fact you folks say that most of the DW approach (for those that
> have seen it) is  'necessary' & 'the right way to do things' - then I will
> be happy to use it and try to figure out some of its complexities . But, if
> you think that DW is over the the top ('...I don't use all that suff - I do
> a query in just a few lines!') ... then I'll just start with the 'bottom up
> - code by hand - do it yourself simple approach'.
>
> BTW: if anyone wants to see more DW code - email me off-list - I'll be
> happy to send more examples... (I don't want to clog up this cool list)
>
> BTW: I also tried a happy medium - simplifying the DW code - however that
> will break its usefulness in DW - and other DW interface items stop
> working, so I guess that's not an option right now.
>
> Interested in your thoughts... Dave
>
> ------------------------
>
> Example get recordset query w DW:
>
>
> <?php require_once('../Connections/weblink.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;
> }
> }
>
> $colname_get_Recordset1 = "-1";
> if (isset($_SESSION['mem_id'])) {
>   $colname_get_Recordset1 = $_SESSION['mem_id'];
> }
> mysql_select_db($database_weblink, $weblink);
> $query_get_Recordset1 = sprintf("SELECT * FROM tbl_test WHERE mem_id = %s
> ORDER BY mem_id ASC", GetSQLValueString($colname_get_Recordset1, "int"));
> $get_Recordset1 = mysql_query($query_get_Recordset1, $weblink) or
> die(mysql_error());
> $row_get_Recordset1 = mysql_fetch_assoc($get_Recordset1);
> $totalRows_get_Recordset1 = mysql_num_rows($get_Recordset1);
> ?><!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>Untitled Document</title>
> </head>
>
> <body>
> </body>Remember
> </html>
> <?php
> mysql_free_result($get_Recordset1);
> ?>
>
>
> --
> Thanks - RevDave
> Cool @ hosting4days . com
> [db-lists]


-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
Check out
knigifts.com

-- 
Robert Burdo
nuschooldesign.com

--- End Message ---

Reply via email to