Rick Strahl's FoxPro and Web Connection Web Log
White Papers | Products | Message Board | News |

Web Connection Version Updates and Compilation


Friday, February 20, 2009, 12:38:00 AM

A lot of people seem to have run into problems with the update of Web Connection 5.41. The problem is that you may be running the new version of Web Connection and get an error like the following:

 

Function FileTime() not found

 

As it turns out FileTime() is indeed a new function in wwUtils.prg in version 5.41 and it is prominently used in the Process class’s RouteRequest() method and because it’s in RouteRequest, if there is a problem with finding this new function you’ll see an error on every hit agains the Web Connection server.

                

If you’re seeing this error, the problem is – compilation. I’ve seen several messages and a few support calls about this and IN EVERY INSTANCE the issue was resolved by properly recompiling your code.

 

Let me explain <g>. When you update a Web Connection installation with the latest version it’s absolutely critical that you recompile all of the PRG and VCX files. Why? Because if you just copy in the new PRG files that are distributed with a new update you are updating only the PRG files and not the FXP files that  already exist on your machine! Simply put your FXP files may be newer than the PRG files we ship and so the FXP files are not updated to reflect the latest version of the new program files.

 

There are two ways to update this right:

  • Recompile all files
  • Compile the application into an EXE and run the EXE
  • Make sure CONSOLE.EXE is up to date

 

Recompile all Files

Personally I rarely run compiled applications so the first option is what I usually work with. In order to do this I recommend you delete all the FXP files in your Web Connection folder and then either manually recompile or just run the application which should then recreate the FXP files when you run.

 

The following should do the trick from the command window:

 

CLOSE ALL

CLEAR ALL

DELETE FILE classes\*.fxp

COMPILE classes\*.prg

COMPILE CLASS CLASSES\*.vcx

 

NOTE: You cannot use the Project Manager and recompile an APP or EXE file to get the FXP files to update. The project manager can build an up to date EXE/APP, but it will not update FXP files on disk. So an explicit compile is required for the PRG files. VCX files are compiled by the project manager since they are self contained and embedded into the EXE

 

If for some reason this doesn’t do the trick for you, search for any of the Web Connection FXP files in your FoxPro path in different locations.

 

To help with this process, the next update to Web Connection there will include be a small helper program that you can use to update your application(s) easily. It’s basically a small PRG file that recompiles all the Web Connection files in your application and also copies all Web related dependency files – scripts, styles, Web Controls, updated DLLs – into one Web directory. You can run this script multiple times to update several Web directories with the latest Web related resources .

 

In the next rev (5.43 or later) you will be able to do:

 

DO console\UpdateVersion WITH "c:\inetpub\wwwroot\wconnect"

 

To force an update of the installation in the install folder and the specified Web folder.

 

Here’s what this script looks like if you’re interested and don’t want to wait for it in the next update:

 

************************************************************************

*  UpdateVersion

****************************************

***  Function: Updates a Web Connection installation rrrby recompiling

***            all Web Connection files in the classes directory and

***            copying Web support files into a Web directory specified.

***    Assume: Web Path must exist

***      Pass: lcWebPath - Optional, File path to a Web Connection Web

***                        you need to run this on each Web site to update

************************************************************************

LPARAMETERS lcWebPath

 

DO wwUtils

 

IF EMPTY(lcWebPath)

      lcWebPath = GETDIR("\","Please find the Web Directory where files are to be copied","Find Web Directory",64+ 16)

      IF EMPTY(lcWebPath)

            RETURN

      ENDIF

ENDIF 

 

*** Must run out of the Web Connection Root directory!

IF !ISDIR("templates")

      WAIT WINDOW "This script needs to be run out of the Web Connection Install Folder"

      RETURN

ENDIF

 

IF !ISDIR(lcWebPath)

      WAIT WINDOW NOWAIT "Invalid Web Path specified."

      RETURN

ENDIF

 

lcWebPath = ADDBS(lcWebPath)

 

LOCAL lcWebTemplate

lcWebTemplate = "templates\webTemplate\"

 

SET PROCEDURE TO

SET CLASSLIB TO

WAIT WINDOW NOWAIT "Compiling files..."

DELETE FILE classes\*.fxp

COMPILE classes\*.prg

COMPILE CLASS CLASSES\*.vcx

DO wwUtils

 

WAIT WINDOW NOWAIT "Copying files..."

 

*** wwScriptLibrary is copied from an embedded resource

CopyTree(lcWebTemplate + "scripts\*.*",lcWebPath + "scripts")

CopyTree(lcWebTemplate + "images\*.*",lcWebPath + "images")

 

LOCAL loException

loException = .NULL.

 

TRY

      *** Rename wc.dll file first then copy: NOTE: requires restart for new dll to actually load

      IF FILE(lcWebPath + "bin\wc.dll")

         ERASE (lcWebPath + "bin\wc.dll.bak")

         RENAME (lcWebPath + "bin\wc.dll") TO (lcWebPath + "bin\wc.dll.bak")

      ENDIF

      COPY FILE("scripts\wc.dll") TO (lcWebPath + "bin\wc.dll")  

        

      IF FILE(lcWebPath + "bin\WebConnectionModule.dll")

         ERASE (lcWebPath + "bin\WebConnectionModudule.dll.bak")

         RENAME (lcWebPath + "bin\WebConnectionModule.dll") TO (lcWebPath + "bin\WebConnectionModudule.dll.bak")

      ENDIF

      COPY FILE("scripts\WebConnectionModule.dll") TO (lcWebPath + "bin\WebConnectionModule.dll")

     

      *** Update WebControls on a development machine - won't matter on a runtime box

      IF FILE("VisualStudio\WebConnectionWebControls\bin\Debug\WebConnectionWebControls.dll")

            COPY FILE ("VisualStudio\WebConnectionWebControls\bin\Debug\WebConnectionWebControls.dll") TO (lcWebPath + "bin\WebConnectionWebControls.dll")

      ENDIF

 

      COPY FILE (lcWebTemplate + "westwind.css") TO (lcWebPath + "westwind.css")

     

      WAIT WINDOW NOWAIT "Version Update Complete"

CATCH TO loException

      WAIT WINDOW NOWAIT ;

                        "Web Resource Update Failed" +  ;

                        loException.Message

ENDTRY

 

RETURN

 

Since this is just a script you can also copy and update this to add your own logic to handle any special updates you might need to do when a new version comes around, perhaps of your own applicatino.

 

Run a compiled EXE

The other alternative is to run as an EXE. Compile your project in the project manager and compile it to an exe and run the EXE.

 

Trust me – it’s Compilation

Several knowledgable people have come at me with this particular issue and I can insure you that the problem is DEFINITELY compilation. If you don’t think so compile the EXE and run it and that should 100% resolve the issue always.

 

CLEAR ALL

CLOSE ALL

DO wcDemo.exe

 

Old Version of Console.exe

One other thing that can cause problems is the CONSOLE.EXE which runs when Web Connection starts. There’s a Command=DO WCSTART.PRG in config.fpw, that causes the console to run when Web Connection starts and when it does it loads up it’s internally compiled versions of the various Web Connection libraries. If these versions are out of sync with the current version of Web Connection there can be problems with files not being found.

 

In fact, it turns out this is what is causing the problem that so many people were seeing in 5.41 – an older version of CONSOLE.EXE was accidentally shipped with Version 5.41. You can re-download version 5.41 which includes an updated file that is in sync with the current version prg files.

 

Alternately you can force FoxPro to release these procedures by doing:

 

CLEAR ALL

CLOSE ALL

Do wcDemoMain.prg && use your PRG main

 

After that you you should again have a clear procedure stack that will reload when your application runs. Using the Web Connection menu will re-run CONSOLE.EXE for many options and may also reload the CONSOLE.EXE files.
Posted in:

Feedback for this Weblog Entry


re: Web Connection Version Updates and Compilation



Harvey Mushman
This all sounds good and in particular the "COMPILE CLASS" command which might really be the issue in the end since it is the only step, I have not done yet!<g>

But it is hard to understand why the CLOSE ALL, CLEAR ALL would fix that?

re: Web Connection Version Updates and Compilation


The problem, Rick, is actually deeper than that.

In my view, if there's one thing that really needs correcting in Web Connect it's file headers. I think you need to pay more attention to those.

For example, the most recent version of WWUtils says
Modified: 03/10/2003
... and there's no version number anywhere therein. Even the copyright statement is 6-years out of date.

I'll bet if you could audit 10 WC developers who've been at-it a while, you'd find folks with various WC core framework files duplicated all over the place because otherwise there's just no really good versioning story.

At least today the WConnect.H file has version information in it now. That needs to be extended to the other core files as well.

There's a reason you see
Version: @version
... in the raw files stored in the source-control trunks of many open-source projects. Sooner or later, users in framework upgrade scenarios desperately need to know.

**--** Steve

re: Web Connection Version Updates and Compilation


@Steve - I'm not quite sure I get what you mean.

Per file version information is next to impossible to manage. How would you consolidate that even with the whole of Web Connection or for that matter for the 5 products that many of these files live in? Dates could be added, but for that you can use the file timestamp - what do you need a version number for on a per file basis?

I agree it's sloppy to have the old dates in there - it's a creating date not a modified date really. I agree versioning is important but my reasoning has been for versioning at the package level (ie. wconnect.h which has always been versioned) rather than at the file level.

I don't see what else would provide useful version information on a file level.

re: Web Connection Version Updates and Compilation


@Steve - also just to clarify a version number wouldn't have helped anyone in this particular scenario. The problem in the problem above is CONSOLE.EXE and its loading of the same library files out of the EXE vs. the files from disk. So even if the right version of the file exists on disk it's not used because it's already loaded.

This is an issue that I need to manage on my end for sure - and I usually am pretty careful to make sure that CONSOLE.EXE gets compiled and included as the last step before packaging a distributable. Only this time I slipped and didn't update the file.

This is entirely my fault that this happened with shipping these out of sync files but no amount of versioning would have helped this particulare issue.

re: Web Connection Version Updates and Compilation



Roodynudy
From the Project Manager, can't you select Build, Rebuild Project, Recompile All files? I'd always believed that this would recompile the WW prgs.

re: Web Connection Version Updates and Compilation


@rudynudy - nope. That will compile only files inside of the EXE/APP, not the files on disk. It doesn't change the FXP files on disk, so if you run the PRGs you may still get version mismatches.
 



© Rick Strahl, West Wind Technologies, 2003 - 2018