Which is easier to learn CGI or PHP?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Fesser

    #16
    Re: Which is easier to learn CGI or PHP?

    .oO(John Bokma)
    [color=blue][color=green]
    >> Personally, I agree with your sentiment in many respects. The thing I
    >> don't like about PHP is that it's frankly boring. (Also don't like the
    >> whole $_POST/$_GET thing) would be nice if you could parse the data
    >> before PHP got to it.[/color]
    >
    >GET -> QUERY_STRING. And I can't think of a reason why.[/color]

    I can think of at least two:

    1) Instead of rawurldecode() for decoding URLs PHP uses urldecode(),
    which also decodes plus signs into spaces. You don't always want that.

    2) PHP has its own way of handling multiple form values submitted with
    the same name. To make it work you have to append a '[]' to the name of
    the control. With your own query string parser that won't be necessary.

    Micha

    Comment

    • nospam@geniegate.com

      #17
      Re: Which is easier to learn CGI or PHP?

      In: <Xns961983DC513 47castleamber@1 30.133.1.4>, John Bokma <postmaster@cas tleamber.com> wrote:

      You know, never occured to me until just now, maybe someone brought
      this up already and I glanced over it.. but..

      Forget rexx, wouldn't 'telnet' and 'cat' be considered the best tools
      for learning CGI?:

      #!/bin/sh
      #
      # *** CGI "trainer" ***
      #
      echo "Content-Type: text/plain"
      echo ""
      echo "This is what the browser sent:"
      echo ""
      echo "Environmen t: "
      env
      echo "------"
      echo "Standard Input: "
      echo "--"
      cat
      echo "--"

      Thats what I (still) use when debugging difficult problems, to confirm
      things are being sent as I imagine them to be.
      [color=blue]
      >I have quite some programming experience but never seen an easy
      >programming language.[/color]

      Have a look at REXX.

      I bet you would absolutely hate it because you already know programming.

      Difficult in terms of actually getting anything real done. It was meant to be a
      sort of macro language, much like tcl's niche before tcl. So, it had to be easy
      for non-programmers to use once in awhile. Ease of learning is a primary
      objective. It goes out of it's way for this, such as allowing 'CENTER' and
      'CENTRE'. Speed is not one of it's strengths, neither is clean code.

      There are "advanced" pieces of REXX, probably not suitable for beginners
      though, so, I'd agree on that point. That and it's absolutely horrible for
      working with files.. it's ok for stdio but, I guess mainframes don't have
      directories and filesystems as we know them... rexx is terrible at filesystem
      stuff. (always wished I had a mainframe, that would be fun. :-) ) The fact
      that it's so horrible at filesystem stuff is what makes it strong in areas
      like palm pilots or macro languages in weird environments.
      [color=blue]
      >You don't need to learn the inner gory details of CGI to understand
      >that.[/color]

      True, but I've found it helpful to know what is going on over the wire,
      one can learn "redirects won't work with the POST method" but unless you
      are familiar with CGI (and accepting POST methods) the reasons for this
      aren't real clear.

      If you can accept "it just doesn't work" as an explanation then it's OK.
      [color=blue]
      >Every language has it's quirks. I haven't found a newbie proof and
      >newbie readable programming language yet.[/color]

      I'd agree, there isn't anything absolutely easy for newbies. rexx is
      the closest I've seen, but you're correct it's not 100% newbie proof.

      A smart person with the basic knowledge of "what is a text file" could probably
      write useful rexx stuff in about an hour. If they already know something like
      HTML, much sooner.

      Unless someone likes it or there is nothing else available, they would
      probably want to move on in a week or less.
      [color=blue]
      >They want that bazooka :-D. There are two ways, you can give them a gun
      >and say: look it's way smaller than a bazooka, and hence, it can't harm
      >*bang*... student? student!??![/color]

      LOL! Ok, I asked for that one. Sorry I went a little over the top
      with it. You are quite correct in tackling me on it, and I'm glad
      you have a good sense of humor. :-)
      [color=blue]
      >Or you give them a bazooka with the
      >words: one wrong move can kill you, your loved ones or the horse. So put
      >it down and we first start to find out what this big ugly thing is.[/color]

      True, but I still wouldn't start with a bazooka, I'd start with something
      smaller, like maybe a pellet gun. (Still highly dangerous though, I concur
      with your point about giving them a warning and discussing it first)
      [color=blue]
      >GET -> QUERY_STRING. And I can't think of a reason why.[/color]

      It's a hassle if trying to work with uploaded files, you *may* want to
      process the data as it's being uploaded. PHP makes you transfer and THEN
      process.

      Process as it's being sent is a bit tricky, but it's something you can do if
      you're working directly with CGI.

      Also, same as others have pointed out, the whole [] thing. (although
      usually exactly what you want, not always. Would be nice to be able to
      work directly with it. Example: dealing with urlencoded data that is
      sent from a form you can't control, like a credit card clearing operation
      or automated notification system.

      We're probably locked in an eternal disagreement here. It's been fun, haven't
      had much opportunity to bring up rexx in a long time. :-) but I'll offer to
      shake hands and agree we won't agree 100%.

      Jamie
      --
      http://www.geniegate.com Custom web programming
      guhzo_42@lnubb. pbz (rot13) User Management Solutions

      Comment

      • John Bokma

        #18
        Re: Which is easier to learn CGI or PHP?

        wrote:
        [color=blue]
        > In: <Xns961983DC513 47castleamber@1 30.133.1.4>, John Bokma
        > <postmaster@cas tleamber.com> wrote:[/color]
        [color=blue][color=green]
        >>I have quite some programming experience but never seen an easy
        >>programming language.[/color]
        >
        > Have a look at REXX.[/color]

        I did, ages ago. Wasn't it part of the Amiga's OS?
        [color=blue]
        > I bet you would absolutely hate it because you already know
        > programming.
        >
        > Difficult in terms of actually getting anything real done. It was
        > meant to be a sort of macro language, much like tcl's niche before
        > tcl. So, it had to be easy for non-programmers to use once in awhile.
        > Ease of learning is a primary objective. It goes out of it's way for
        > this, such as allowing 'CENTER' and 'CENTRE'. Speed is not one of it's
        > strengths, neither is clean code.[/color]

        Clean code is what the programmer writes, not what the language dictates
        :-D
        [color=blue]
        > mainframe, that would be fun. :-) ) The fact that it's so horrible at
        > filesystem stuff is what makes it strong in areas like palm pilots or
        > macro languages in weird environments.[/color]

        Really don't get that.
        [color=blue][color=green]
        >>You don't need to learn the inner gory details of CGI to understand
        >>that.[/color]
        >
        > True, but I've found it helpful to know what is going on over the
        > wire, one can learn "redirects won't work with the POST method" but
        > unless you are familiar with CGI (and accepting POST methods) the
        > reasons for this aren't real clear.[/color]

        Yup, but as a programmer you have to accept the fact that you can't
        learn all ins and outs very fast otherwise you get stuck in your own
        "libraries" and never get real work done.
        [color=blue]
        > If you can accept "it just doesn't work" as an explanation then it's
        > OK.[/color]

        Believe me, that's one of the first things a programmer should learn.
        Accept the documentation and use it. Do you accept "print" or do you
        want to know how it exactly works in every detail before you just use
        it? Only when something goes wrong, and even then I ask first :-D.
        [color=blue]
        > LOL! Ok, I asked for that one. Sorry I went a little over the top
        > with it. You are quite correct in tackling me on it, and I'm glad
        > you have a good sense of humor. :-)[/color]

        :-D Thanks. Oh, and I always try to shoot at stuff like that. I can't
        remember how often I have seen software compared to cars :-D.
        [color=blue][color=green]
        >>GET -> QUERY_STRING. And I can't think of a reason why.[/color]
        >
        > It's a hassle if trying to work with uploaded files, you *may* want to
        > process the data as it's being uploaded. PHP makes you transfer and
        > THEN process.[/color]

        Ok, that's a good reason. The other one (other post), + => space is
        another one.
        [color=blue]
        > Process as it's being sent is a bit tricky, but it's something you can
        > do if you're working directly with CGI.
        >
        > Also, same as others have pointed out, the whole [] thing. (although
        > usually exactly what you want, not always. Would be nice to be able to
        > work directly with it. Example: dealing with urlencoded data that is
        > sent from a form you can't control, like a credit card clearing
        > operation or automated notification system.[/color]

        Ok, agreed. But that's no longer beginner's stuff :-D.
        [color=blue]
        > We're probably locked in an eternal disagreement here. It's been fun,
        > haven't had much opportunity to bring up rexx in a long time. :-) but
        > I'll offer to shake hands and agree we won't agree 100%.[/color]

        :-D Agreed ;-)

        --
        John MexIT: http://johnbokma.com/mexit/
        personal page: http://johnbokma.com/
        Experienced programmer available: http://castleamber.com/
        Happy Customers: http://castleamber.com/testimonials.html

        Comment

        Working...