Announcement

Collapse
No announcement yet.

New to Web Development

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

  • New to Web Development

    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?

  • #2
    Andy,

    There is no single answer except to say that you're not going to simply "port" a Win32 application to the web. You'll need to totally redesign the user interface which means learning how HTML works for starters.

    The web is mostly one-way-communications. The server provides a form. The user fills out the form. The user sends the form data to the server. The server processes the data. The server sends a response back to the client. There are other ways to do it, but you have to learn to walk before you run.

    PB can take any data sent back from the client's web form and do just about anything you want with it. The results are formatted back into proper HTML code and presented to the user. These are called CGI applications and they run on the web server, behind the scenes.

    I've written a number of CGI tutorials that you should probably read through (easy reading, not real long or detailed). It'll give you a good foundation on how things work in the web world. You can read them at: http://www.basicrocks.com/
    Software makes Hardware Happen

    Comment


    • #3
      You might try Jose Roca's site
      http://com.it-berater.org/
      How long is an idea?

      Comment


      • #4
        Hi,

        Well, CGI is mostly dead as a dead mouse. If you want to get into Web Development using latest technology check out Adobe Flex and Flash. This is now becoming the new way of building rich internet applications with a true windows feel behind it.

        Now, CGI can still be used but it is old-fashioned.

        Of course it all depends of what you want to do. There is never one solution for everything.
        So here we are, this is the end.
        But all that dies, is born again.
        - From The Ashes (In This Moment)

        Comment


        • #5
          Well, CGI is mostly dead as a dead mouse.
          Really? Well I guess a few million web developers didn't get the memo

          The web is evolving, and doing so quickly. What is "hot" today, could very likely be "dead" tomorrow. While Adobe has done a pretty good job at trying to set some standards, they clearly have not accomplished that feat. Flash for example, was very hot for a long time, but never quite hit 30% and has been on a slow decline recently.

          CGI is a method not a product. Most PERL code is thought of a CGI and PERL has a lot more influence than FLEX and FLASH. Of course, these things don't serve the exact same purpose either.

          PHP is probably as close to a "standard" as you'll find, and each release (v6 on the way) brings in more and more developers. PHP easily pushed MS (ASP) out of the box....not an easy thing to do on any level.

          The bottom line really is, at this point in the Web's life, that there are no de-facto standards to speak of. There are lots and lots of options and all of them work to some extent, and all of them fail to some extent. But for people who already have a foundation in a specific skill, PB in this case, using what you already know is an excellent spring-board to other technologies.

          I wrote many commercial web sites using PB CGIs. I don't use PB nearly as much any longer (PHP/Javascripts - i.e. AJAX) solves most of my problems easier than PB/Javascript although both can accomplish the same goal.
          Software makes Hardware Happen

          Comment


          • #6
            Joe,

            You're right. CGI is not a product but a technology. I don't want to say that using CGI is a bad thing or is less capable of ... but one has to first have an idea what needs to be accomplished (which we don't in this case). If all it takes is some dynamic HTML showing data from a SQL database, by all means,
            PB/CC or any other CGI approach will do the job.

            however, are the requirments more demanding ? Does the website require 'a factor of coolness' ...... then other methodologies must be taken into consideration.

            Like I said, there is not one solution for everything.
            So here we are, this is the end.
            But all that dies, is born again.
            - From The Ashes (In This Moment)

            Comment


            • #7
              Joe,

              You seems to be the person who knows alot about Web Development.

              To move to Php/JavaScript means leaving PB behind, and learning a new way of developing applications.

              I've been told by most of my developer pals that CGI is not as popular any more, and that php and javascript is the new wave. Maybe it is time I catch the wave.

              How easy was it for you to move to php/js? Any suggestion on good reading material that can assist me?

              Comment


              • #8
                I use ADO/ADOX to talk to MS SQL for storing the data. All reports are printed as pdf documents.


                Andy,
                I pointed you to Jose Roca's site for ADO routines.

                I personally would look at SQLitening for client/server.
                Firefly (on the same site below) might get you ADO. http://www.planetsquires.com/

                1) Do you need ADO?
                2) Do you need MS SQL?
                3) Does the application need to be run using any browser or do you control all the code on both ends?

                When anyone mentions a web application does that imply it needs to work with a browser on port 80?
                Last edited by Mike Doty; 3 Feb 2009, 08:14 AM.
                How long is an idea?

                Comment


                • #9
                  Firefly (on the same site below) might get you ADO. http://www.planetsquires.com/
                  1) Do you need ADO?
                  You never "need" ADO. ADO is just a more convenient way to use the DBMS's OLE interface, providing a DBMS-agnostic techinique for creating DB applications.

                  And, although I have not tried it yet, you are supposed to be able to use ADO via the ODBC interface by specifying an ODBC DSN in the OLE connection string. Source: http://www.connectionstrings.com

                  That would be pretty neat to be able to use the same applications code (ADO) if the DBMS offers EITHER an OLE or ODBC interface.. kind of extends the number of DBMS products on which a single application can run.

                  FWIW, Jet (Access), SQL/Server and Oracle all offer OLE interface.

                  Jet and SQL/Server have easily-available ODBC (v3) interfaces available. There are ODBC-2 drivers for Oracle, but you have to kind of hunt for ODBC-3 Oracle drivers and those are not inexpensive. (Plus they have to be installed, whereas the OLE provider "comes with" the base Oracle product).

                  MCM
                  Michael Mattias
                  Tal Systems (retired)
                  Port Washington WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment


                  • #10
                    Originally posted by Andy Flowers View Post
                    Joe,
                    You seems to be the person who knows alot about Web Development.
                    To move to Php/JavaScript means leaving PB behind, and learning a new way of developing applications.
                    I've been told by most of my developer pals that CGI is not as popular any more, and that php and javascript is the new wave. Maybe it is time I catch the wave.
                    How easy was it for you to move to php/js? Any suggestion on good reading material that can assist me?
                    Andy,
                    PHP was rather easy to pick up on. There are an enormous number of resources available for it. I've probably picked up a half dozen books, mainly because each one had a specific topic of interest, but all of them overlap the main concepts.

                    IMO, if you haven't done any web-based programming, writing a few simple PB CGIs is a great way to "see" how the process works. I think it would be quite difficult to jump right into a fully interactive site with no previous experience. The biggest problem is that there is no single tool to get from point A to point B. Its a collection of different tools and technologies and you need at least a basic understanding of them before you can do anything productive.

                    For example, your interface is going to be HTML in the end. Therefore, you should be pretty comfortable with HTML and CSS. PHP will get you to the point of setting up forms, gathering data, and accessing the back-office database, but you'll still be pretty much on the 'Client-->Server; Server-->Client' method, not interactive as you'd be in a "normal" PB application. To get beyond this, you need javascript (harder to learn than PHP IMO, but not impossible). Then to "jazz" things up, you'll need to know stuff like FLASH.

                    I would recommend starting with a simple web form. Create the HTML code, pass the data to a PB-CGI application. Process it on the server (using PB), and spit back an HTML page based on the data. This way, you can use products you're familiar with and "see" how the flow works behind the scenes. Once you're comfortable there, pick up a book (or bookmark any number of PHP tutorial sites for free) on PHP and see how that works. PHP is more of a scripting language that you can mix in with your HTML. After you've grasped the idea of form processing from your CGI apps, the PHP concepts will make more sense. From there, you'll see the missing pieces that need to be filled in and will have a pretty good idea of what additional steps you want to take to "make the application/interaction better".

                    As some here have said: "Make it work, then make it work better". That's real good advice for the web if you haven't played in that area before.
                    Software makes Hardware Happen

                    Comment


                    • #11
                      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?

                      Comment


                      • #12
                        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.
                        hellobasic

                        Comment


                        • #13
                          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, 01:19 PM.
                          How long is an idea?

                          Comment


                          • #14
                            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
                            John,
                            --------------------------------
                            John Strasser
                            Phone: 480 - 273 - 8798

                            Comment


                            • #15
                              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.

                              Comment


                              • #16
                                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.

                                Comment


                                • #17
                                  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
                                  Michael Mattias
                                  Tal Systems (retired)
                                  Port Washington WI USA
                                  [email protected]
                                  http://www.talsystems.com

                                  Comment


                                  • #18
                                    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, 11:12 AM.

                                    Comment


                                    • #19
                                      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, 11:29 AM.
                                      How long is an idea?

                                      Comment


                                      • #20
                                        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.
                                        Software makes Hardware Happen

                                        Comment

                                        Working...
                                        X