Announcement

Collapse
No announcement yet.

New to Web Development

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Knuth Konrad
    replied
    Originally posted by Joe Byrne View Post
    You need to understand what a web application is, and then whether you can adapt those restrictions to what you want to do. The limiting factor is not going to be a "language" as much as it will be the way the web works and how far you want to go to over come its process.
    This!

    I would go even one step further: First, you need to understand what "the web" is and how it works. That means: start by learning (X)HTML. Because whatever technique or programming language you choose later on, it all boils down to sending (X)HTML down to the client (oversimplified).

    Leave a comment:


  • Kev Peel
    replied
    PS. If you do decide on the PB-CGI route (on a Windows server), I would be very careful on what your CGI executable does. One of my customers had a problem with a CGI that crashed* as it was uploading data to the client and the ISP sent us a stark warning to fix or remove the CGI immediately. Let's just say they were not happy

    *To be fair, the problem wasn't entirely our fault - the "Dr. Watson" debugger was enabled on the server and promptly crashed when it found it couldn't debug the CGI. So the problem was bad server config that got triggered by our crashes. It pretty much locked up the server.
    Last edited by Kev Peel; 4 Feb 2009, 06:07 PM.

    Leave a comment:


  • Kev Peel
    replied
    PHP is the standard now. I use both PHP to generate web pages and PB CGI executables to manage the back-end data. The two compliment each other perfectly.

    To move to Php/JavaScript means leaving PB behind, and learning a new way of developing applications.
    Andy, That's not the case, you wouldn't be solely moving to PHP (for example) as PHP is only a web language, and I would think it'd be pretty hard to "unlearn" PB

    Grab any "beginners" book on PHP and you will see how easy it is to learn, not forgetting the many many PHP sites (with sample code) to help you along.

    Here's one manual for it: http://www.php.net/manual/en/

    Leave a comment:


  • Eric Pearson
    replied
    Andy --

    Have you seen this thread about PowerBASIC and PHP?

    http://powerbasic.com/support/pbforu...d.php?t=36413&

    -- Eric

    Leave a comment:


  • Brad D Byrne
    replied
    Originally posted by Edwin Knoppert View Post
    (Edit: a response to #20)
    ....
    Btw, it's also a bit harsh to claim ISAPI is CGI (see above).
    ASP.NET for example is basically ISAPI calling a framework.
    I suspect that many other languages are ISAPI libraries as well.
    Shielded for the programmer of course.

    I don't think they base themselves on CGI executables
    yeah, I agree, that was a bit sloppy, should have said "ISAPI is simalar to CGI"

    Leave a comment:


  • Mike Doty
    replied
    Andy have you installed a server software program on a local machine?
    If you do, you can run the PB cgi program DBG.EXE to get started.
    At least by doing this you can see what a cgi program returns to you.
    In my opinion getting your server running is step 1.

    Leave a comment:


  • Edwin Knoppert
    replied
    Ok

    Leave a comment:


  • Joe Byrne
    replied
    Originally posted by Edwin Knoppert View Post
    (Edit: a response to #20)

    A typical nonsense reply, first you turn my advise down without reason then you start rambling like a teacher about static files.
    Good advise may also make one skip the full learning cycle you know?
    (As if one must know the whole SDK to create a window or so)
    Edwin,
    I meant no disrespect, but clearly Andy is just getting his feet wet in the world of the web. IMO, ISAPI is a bit to advanced at this stage for what Andy needs to learn. I think this was pretty clear from his response to your post.

    When one is just getting started in new territory, you don't want to confuse the issues with "better" or "faster" concepts. You want to make the process as clear as possible.

    Andy has a background in creating PB executables so IMO, that is where he should start. My first tutorial does exactly that. Once he can take what he already knows, and apply it to new territory, then he can start asking the questions of how to make it better or faster. But it you get to far ahead of him, discounting what he already has mastered, then your advice only goes to make this more complicated than they are, and need to be.

    All of the replies here have been accurate and worthwhile information, but only valuable at the proper time. Andy needs to crawl first, just as you and I did, and then he can worry about sprinting.

    And for the record, if I sounded like a teacher, that's probably because I do teach and write books. Its my nature, sorry.

    Leave a comment:


  • Edwin Knoppert
    replied
    (Edit: a response to #20)

    A typical nonsense reply, first you turn my advise down without reason then you start rambling like a teacher about static files.
    Good advise may also make one skip the full learning cycle you know?
    (As if one must know the whole SDK to create a window or so)

    I don't care what technique one choose but i have some experiance with CGI executables and it wasn't the best thing to have.
    There will soon be a reason to step over to another technique.

    Btw, it's also a bit harsh to claim ISAPI is CGI (see above).
    ASP.NET for example is basically ISAPI calling a framework.
    I suspect that many other languages are ISAPI libraries as well.
    Shielded for the programmer of course.

    I don't think they base themselves on CGI executables

    Leave a comment:


  • Brad D Byrne
    replied
    well, I REALLY hate to agree w/ Joe!!

    but in this case I do! his tut's are very good, hit them first! http://www.basicrocks.com/

    Leave a comment:


  • Joe Byrne
    replied
    This is now as clear as mud to me. I am even more confused.

    Edwin says "Forget CGI...., and suggest using ISAPI dll. I have no idea what he is talking about.
    Forget ISAPI. Should never have even been mentioned in this thread
    Jonh is saying I should be able to use PB once I have access to a windows server, by loading dlls and executables. This is new to me, have
    <experience with this.
    You don't need to load anything, nor mess with any DLLs.
    Guys, I really appreciate all of the information. I am looking to implement this application on a windows server. I would like to use PB as far as possible because it's what I know, other than that I would have to learn a new language, extending my time to market so to speak. So suggestion with this in mind would be appreciated.
    Go back to my original reply and ignore most of the other 'noise' your getting here. You need to understand what a web application is, and then whether you can adapt those restrictions to what you want to do. The limiting factor is not going to be a "language" as much as it will be the way the web works and how far you want to go to over come its process. Again, the web, by nature, is not "interactive". Its all 'static' information being sent back and forth. That is not how you typically write a Win32 program so you NEED to understand how the web works differently first.

    Take a look at my first tutorial. It will show you the very basics of a web form to present an "input" form to the user, get that information back to the server, and send a reply based on the input. You have to take this baby step first and understand what's going on. THEN you can start to ask, "how can I improve ....."

    While everyone is trying to be helpful, at this stage, you'd be better off not listening to too much "help" until you get your feet wet.

    Leave a comment:


  • Mike Doty
    replied
    To add more mud, if you want to run a PowerBASIC cgi over the internet the host ISP (whoever is running the server software) must allow running executable (.exe files), not just scripts. Most ISP's do not allow it.
    You should have a server software program running on a local machine at least for easy testing.
    If setup correctly, the directories can later be easily copied to an internet server provider to host them (if you want.)
    If you host your own server software program, your local internet server provider may not let you run on port 80.
    Some of us use remote hosting with http://www.trustedwebhost.com because they allow PB executables.
    Do you have a server software program? Windows comes with a server software program.
    I use a server software program named Abyss when running locally. http://www.aprelium.com They also have a free version.
    Last edited by Mike Doty; 4 Feb 2009, 12:29 PM.

    Leave a comment:


  • Brad D Byrne
    replied
    Originally posted by Andy Flowers View Post
    I have written a number of applicatons using PB/Win. There is on in particular that I would like to migrate over to a Web application. The application has a number of entry screens. I use ADO/ADOX to talk to MS SQL for storing the data. All reports are printed as pdf documents.

    I have two sons that develope web application using php, c#, javascript, .... They keep telling me to move with the times. I am a old school programmer. What would be the best approach to moving this application over to a Web Application. What are my options with PB?
    Andy, ok my 2 cents,

    lots of suggestions here, because it's a big field,

    imo, if you are comfortable w/ PB CGI's use them, ISAPI is same as cgi's except it allows you to pre-compile a (cgi)dll on the server which is always running, thus making server faster, not having to reload the cgi every time it's called.

    there are many environments to build in, most have their advantages, (I know little of ADO) yet I do know that PBcgis is like the assembly of them all, (you can do anything with them, however it often takes more work, they will also run the fastest and be easier to secure), I believe that after you understand web programming more you will use a mixture of many platforms, ie, you can write your own database in cgi, or you can use cgi to call mySql, which is easier. In any event, imo the programmer that understands cgi level stuff is far better off than the programmer that only understands php, c#, c++, etc.

    to build any web environment you need to use the following at a minimum;

    javascript, runs in the client browser (IE explorer, firefox, opera, etc), allows you to build cookies, rewrite data sent from the server, validate forms on client (faster than using server for same), etc.

    html, is the display language of the client browser.

    css, are type fields that allow you to custom style how the html is displayed in a shortcut way. (css will be the most confusing of all, because different browsers use different rules, so simplest to use validated cross-browser (xbrowser) examples.

    all of this is trying to be standardized by the W3C consortium,

    for very easy, working examples & tutorials goto; http://www.w3schools.com/

    I would first checkout the AJAX Tutorial, http://www.w3schools.com/ajax/default.asp

    it will give you a quick jumpstart! (you may have to go back and forth to other simpler tut's (javascript, html, etc)) but if you get thru it, you will cut out a lot of time! and even though it all looks very complicated it's not, just go thru the w3schools tutorials, you can master them all in less than a week!

    ADDED; also stick to html DOM examples, DOM stuff is the way the web is moving,
    Last edited by Brad D Byrne; 4 Feb 2009, 12:12 PM.

    Leave a comment:


  • Michael Mattias
    replied
    CGI, ISAPI, Flash.... these are all "hows".

    First focus on the "What" and you then you can pick a "how" consistent with your skills.

    Script out your application in pseudo-code. In addition to focusing on the real goals, p-code can give you a list of procedures you will have to develop. I do this all the time, writing p-code like

    Code:
        DO 
            CALL GetRecord 
            CALL ProcessRecord
            CALL OutputRecord
        LOOP UNTIL no_more_to_do.
    That the "GetRecord", "ProcessRecord" and "OutputRecord" procedures don't yet exist - and I don't have clue as to "how" I am going to actually do it - at the very least it gives me a series of "small" challenges to be conquered, instead of throwing the kitchen sink at me all at once.

    MCM

    Leave a comment:


  • Andy Flowers
    replied
    This is now as clear as mud to me. I am even more confused.

    Edwin says "Forget CGI...., and suggest using ISAPI dll. I have no idea what he is talking about.

    Jonh is saying I should be able to use PB once I have access to a windows server, by loading dlls and executables. This is new to me, have no experience with this.

    Guys, I really appreciate all of the information. I am looking to implement this application on a windows server. I would like to use PB as far as possible because it's what I know, other than that I would have to learn a new language, extending my time to market so to speak. So suggestion with this in mind would be appreciated.

    Leave a comment:


  • Shawn Anderson
    replied
    Amazon and Google both use CGI heavily (along with other technologies).
    Google built its AJAX framework specifically for use with CGI.

    I would think you want to learn javascript too.

    Any technology that works for you is OK as far as I'm concerned.

    I would never do a whole page in Flash or similar product.

    Leave a comment:


  • John Strasser
    replied
    Hi Andy,

    Originally posted by Andy Flowers View Post
    Thanks Joe.
    I will give CGI a try. I did not purchase the latest version of PBCC but I do have the latest version PB/Win. (I do have version 4 of PB/CC) Can I use PB/Win to write CGI applications or is it best to use PB/CC? How is this done?
    For nice simple tutorials on the web tech I always reccomend Tizag (http://www.tizag.com)

    BUT

    There is no requirement that you use php.

    On the web (as Joe has said) html (or xhtml) with css and simple javascript (primarily for form validation) is all you need. Now the next step is:

    If you want to work on a linux box, then use php. But if you have access to a windows web server where you can load dlls and executables then use PB and don't sweat it.

    Even if you want to use database apps, there's plenty of code here (and at Jose's) and third party tools (perfectsynch) that will get you all the database backend power you need. And then some. Plus (on the windows box) you can use the .net and api libraries as well in your code should you need it. You could even mix and match windows and linux in a server farm type of environment if that's what you need.

    Php is a useful language (similar to C, it's worth learning) but don't let anyone tell you it's the only way to go.

    JS

    Leave a comment:


  • Mike Doty
    replied
    pbcgiboth.inc in the source code works with PbWin.
    It doesn't hurt to know cgi. http://www.powerbasic.com/support/pb...ad.php?t=24378
    Also, study dbg.bas that comes with PowerBASIC.
    c:\pbcc50\samples\internet\cgi

    pbcgi.inc includes this sub that writes the new page for the browser to pick up.
    Code:
    SUB WriteCGI(BYVAL x AS STRING)
      STATIC header AS LONG
      IF ISFALSE header THEN
        STDOUT "Content-type: text/html" + CHR$(13, 10)
        header = -1
      END IF
      REPLACE "''" WITH CHR$(34) IN x
      STDOUT x
    END SUB





    Code:
     
    'cgiwrite.bas    demonstrates open/get/put/lock/unlock/flush/close functions on the internet
    'comments/suggestion link:  [URL]http://www.powerbasic.com/support/pb...ad.php?t=29447[/URL]
    DECLARE FUNCTION getmodulefilename LIB "kernel32.dll" ALIAS "getmodulefilenamea" (BYVAL hmodule AS DWORD, lpfilename AS ASCIIZ, BYVAL nsize AS DWORD) AS DWORD
    DECLARE FUNCTION getmodulehandle LIB "kernel32.dll" ALIAS "getmodulehandlea" (lpmodulename AS ASCIIZ) AS DWORD
    DECLARE FUNCTION OPENFILE(filname AS STRING)AS LONG 'rename if using win32api.inc
    DECLARE FUNCTION lockfile(filehandle AS LONG) AS LONG
    DECLARE FUNCTION unlockfile(filehandle AS LONG) AS LONG
    DECLARE FUNCTION getrecord(recordnumber AS LONG, buffer AS STRING,filehandle AS LONG) AS LONG
    DECLARE FUNCTION putrecord(recordnumber AS LONG,buffer AS STRING,filehandle AS LONG) AS LONG
    DECLARE FUNCTION closefile(filehandle AS LONG) AS LONG
    DECLARE FUNCTION flushfile(filehandle AS LONG) AS LONG
    DECLARE FUNCTION killfile(filenam AS STRING) AS LONG
    DECLARE FUNCTION exename AS STRING
    DECLARE SUB      DISPLAY(TEXT AS STRING)
    FUNCTION PBMAIN AS LONG
      DIM filname$,buffer$,hits&,recnum&, l$,programname$,programdir$,org&
      DIM recordstowrite&,attempt&,filehandle&,result&,recordnumber&, recordlen&
      recordstowrite = 10
      recordlen = 1000
      buffer = SPACE$(recordlen)
      stdout "content-type: text/html" & $CRLF  'required by some servers
      stdout "<pre>"
      DISPLAY "remote_addr " & ENVIRON$("remote_addr") & "      "  & "remote_host " & ENVIRON$("remote_host") _
                            & "      " &  DATE$ & "    " & TIME$
      programname$ = exename
      FOR org = LEN(programname$) TO 1 STEP -1
        IF MID$(programname$, org, 1) = "\" THEN
          programdir = LEFT$(programname$, org)
          EXIT FOR
        END IF
      NEXT
      filname = CURDIR$ + "\hits.txt"
      'result = killfile(filname)
      stdout "curdir$ " & CURDIR$
      stdout "path_translated " & ENVIRON$("path_translated")
      filehandle = OPENFILE(filname):IF filehandle < 1 THEN EXIT FUNCTION
      DISPLAY "open " & filname & " for binary lock shared as #" & FORMAT$(filehandle) &  " " & TIME$
      stdout "writing"& STR$(recordstowrite) & " records (" & FORMAT$(recordlen) & "-bytes each.)  start byte of each record:"
      result = lockfile(filehandle)                         'first lock the file
      FOR recnum = 1 TO recordstowrite
        LSET buffer = FORMAT$(LOF(1)+1)                     'data to write
        recordnumber = LOF(#filehandle) + 1                 'insert at end of file
        result = putrecord(recordnumber, buffer,filehandle)
        stdout FORMAT$(recordnumber) & " ";
      NEXT
      DISPLAY "last byte" & STR$(LOF(filehandle))
      stdout "unlock" :result = unlockfile(filehandle)
      stdout "flush"  :result = flushfile(filehandle)
      stdout "close"  :result = closefile(filehandle)
      stdout "</pre>"
      'beep:waitkey$
    END FUNCTION
    FUNCTION lockfile(filehandle AS LONG) AS LONG
      DIM attempt&,maxattempts&
      maxattempts = 10
      attempt = 0   'lock record/get/update/flush/unlock
      DO
        ERRCLEAR
        LOCK #filehandle
        IF ERR THEN
          INCR attempt
          SLEEP 100
        END IF
      LOOP UNTIL ERR = 0 OR attempt => maxattempts
      IF attempt => maxattempts THEN FUNCTION = ERRCLEAR
    END FUNCTION
    FUNCTION unlockfile(filehandle AS LONG) AS LONG
      DIM attempt&,maxattempts&
      maxattempts = 10
      attempt = 0   'lock record/get/update/flush/unlock
      DO
        ERRCLEAR
        UNLOCK #filehandle
        IF ERR THEN
          INCR attempt
          SLEEP 100
        END IF
      LOOP UNTIL ERR = 0 OR attempt => maxattempts
      IF attempt THEN
        IF attempt => maxattempts THEN
          FUNCTION = ERRCLEAR
        END IF
      END IF
    END FUNCTION
    FUNCTION getrecord(recordnumber AS LONG, buffer AS STRING,filehandle AS LONG) AS LONG
      GET #filehandle,recordnumber,buffer
      IF ERR THEN FUNCTION = ERRCLEAR
    END FUNCTION
    FUNCTION putrecord(recordnumber AS LONG, buffer AS STRING,filehandle AS LONG) AS LONG
      PUT #filehandle,recordnumber,buffer
      IF ERR THEN FUNCTION = ERRCLEAR
    END FUNCTION
    FUNCTION flushfile(filehandle AS LONG) AS LONG
      FLUSH #filehandle
      IF ERR THEN FUNCTION = ERRCLEAR
    END FUNCTION
    FUNCTION closefile(filehandle AS LONG) AS LONG
      CLOSE #filehandle
      IF ERR THEN FUNCTION = ERRCLEAR
    END FUNCTION
    FUNCTION OPENFILE(filname AS STRING)AS LONG
      DIM attempt AS LONG
      DIM maxattempts AS LONG
      DIM filehandle AS LONG
      maxattempts& = 10
      attempt = 0
      DO
        ERRCLEAR
        filehandle = FREEFILE
        OPEN filname FOR BINARY LOCK SHARED AS #filehandle
        IF ERR THEN
          INCR attempt
          SLEEP 100
        END IF
      LOOP UNTIL ERR = 0 OR attempt => maxattempts
      IF attempt => maxattempts THEN
          FUNCTION = -ERRCLEAR
          EXIT FUNCTION
      END IF
      FUNCTION = filehandle
    END FUNCTION
    FUNCTION killfile(filname AS STRING) AS LONG
      KILL filname
      IF ERR THEN FUNCTION = ERRCLEAR
    END FUNCTION
    SUB DISPLAY(TEXT AS STRING)
      stdout TEXT & "<br>"    '<br> single  <p> double
    END SUB
    FUNCTION exename() AS STRING
      LOCAL hmodule AS LONG
      LOCAL temp AS ASCIIZ * 256
      hmodule = getmodulehandle(BYVAL 0&)
      getmodulefilename hmodule, temp, 256
      FUNCTION = temp
    END FUNCTION
    Last edited by Mike Doty; 3 Feb 2009, 02:19 PM.

    Leave a comment:


  • Edwin Knoppert
    replied
    Forget CGI, it's usually slower and it's *equally* easy to make an ISAPI dll.

    Since PB can now do com interfaces and can load com dll's without a need to register the dll it may be very convienant to use an ISAPI dll which uses a 2nd dll having a com implementation.
    A 2nd dll is often used since you may have a technique implmented in the ISAPI dll to unload and load a newer dll version on demand.

    If we didn't do ASP.NET this would be my 2nd best.

    Also, people often prefer to write single compact executables or dll's and tend to embed or generate html from code.
    Imo, try to avoid that and simply stream html files where you may replace content for your dynamic content.

    Even while you may never use ASP.NET i can recommend you to use a serious html editor (like Visual Web Developer for example) and learn from common mistakes.
    Iow prepare your html file with such a tool and eventually rewrite the content on demand during streaming/request.

    It's all fairly simple and is just a matter of perspective imo.

    Leave a comment:


  • Andy Flowers
    replied
    Thanks Joe.

    I will give CGI a try. I did not purchase the latest version of PBCC but I do have the latest version PB/Win. (I do have version 4 of PB/CC) Can I use PB/Win to write CGI applications or is it best to use PB/CC? How is this done?

    Leave a comment:

Working...
X