Struggling with Activevfp

Topics: Developer Forum
Aug 18, 2013 at 11:29 PM
I've literally spent 50+ hours using Activevfp in the last 30 days and I can tell you anything you try to do outside simple Rest Examples probably won't work. The platform is simply too buggy and tech support though this forum isn't helping.

Sadly I'm close to choosing another platform and I can tell you its not without great regret that I get to this point.

When you write very simple code that returns json results and 1 moment it works, and the next moment it throws an error that you have no Clue how to solve there is obviously a problem and it isn't a FoxPro problem.

I had high hopes of using Appery.io along with Activevfp but I don't think this is gonna happen.

Mike
Coordinator
Aug 19, 2013 at 2:20 AM
Goodbye and good luck!
Coordinator
Aug 19, 2013 at 2:31 AM
Hi Mike,

Sorry to hear that things aren't working out for you.

I'm working on a project at the moment using AVFP almost exclusively to provide RESTful services.

Whilst I'm in my early days working with AVFP and still in the learning stage, I'm gradually making progress.

I've just had a quick look at some of your posts and whilst I realise that you're using AVFP for different things than I am, I'll chip in as much as I can.

Please feel free to send me an email or, and I'm not sure if any of the other members do it, but we can even chat on Skype or something like that if you think that it would help?

BTW, where are you based?

Best regards,
Simon (UK)
Aug 19, 2013 at 2:35 AM
It seems to have something to do with code that's run outside ...

like
set procedure to myprg.prg

you might be completely ok if you can do everything inside 1 or more SQL statements and you
never go outside and do any processing.

As so as I try to get answers to math problems my calling transaction routines and returning results
I get errors...

I haven't figured out For sure what is going on, but I have created code in series ... 1a, 1b, 1c and as I get
closer to what I need it BOMBS...

so I try another approach... and then still another... and then another...
Aug 19, 2013 at 2:38 AM
This is real world... I have a legacy system with thousands of users nationwide in 2 different verticals

I started coding with FoxPro with 1.0 DOS .. was using Dbase II at the beginning

90% of all the code was written by me selling well over 1.5M in Vertical software.

Many of it is still used today. Bridgestone Firestone is one of my clients.

I'm saying all this because I'm not some SMO that started coding hours ago.

Mike
Aug 19, 2013 at 2:39 AM
I went as far as setting up the entire code base in EC2 and letting everybody be able to get to it.

'foxtowsupport' is the skype account I use.

Mike Tallent
Aug 19, 2013 at 2:43 AM
I also think the bulk of my problems is all REST return stuff. I think the majority of people that use
Activevfp use it for other things. They are not using the REST portion of the code base.

Claude has has this portion for less than 18 months I think, so it would make sense if this was the case.
Aug 19, 2013 at 2:47 AM
Sorry SimonCL I didn't answer one of your questions.

Bay Area, Northern California.
Coordinator
Aug 19, 2013 at 3:05 AM
You know it would help if you describe your problems and try to get some help before making threats and trashing what we've done here.
like
set procedure to myprg.prg

you might be completely ok if you can do everything inside 1 or more SQL statements and you
never go outside and do any processing.
SET PROC to 'c:\avfp6\prg\utiltest' ADDITIVE  && DID YOU USE ADDITIVE??????????????????
and if you're making changes to your library, you need to unload it when you're finished so you can make the change easily:
RELEASE PROCEDURE 'c:\avfp5.61Demo\prg\utiltest'   && Clear class and program from memory
OR for a Class library library you'd like to use:
oAA=newOBJECT('schedbizobj','c:\avfp5.61Demo\prg\utiltest2.prg')
oEmp=newOBJECT('schedbizobj','c:\avfp5.61Demo\prg\utiltest2.prg')  &&TEST Class Library
...use the methods of oEmp

and if you're making changes to your class library, unload it when you're finished:
oAA=null       && Clear class and program from memory
CLEAR CLASS ('schedbizobj')  && Clear class and program from memory
CLEAR PROGRAM ('prg\utiltest2.prg')    && Clear class and program from memory
How about learning some of this before making stupid statements?????
Coordinator
Aug 19, 2013 at 3:08 AM
Hi Mike,

Just tried to call you on Skype.

Regards,
Simon
Aug 19, 2013 at 3:20 AM
50+ hours of banging my head against the wall hardly justifies your call for Stupid Statements.

And if you remember I posted the code. ALL OF It, and you got the same errors.

And it wasn't big. (the code)

I even set up an EC2 environment and gave you full access to it.

I think at the end of the day, you probably should charge for Activevfp ... because you obviously
have an attitude problem.

I will make sure I follow all of your steps to the letter.

But in the end. The code base is buggy and needs work. And you really could care less Claude
Coordinator
Aug 19, 2013 at 3:22 AM
Goodbye and good luck.
Coordinator
Aug 19, 2013 at 3:41 AM
Ouch!
Aug 19, 2013 at 4:06 AM
Simon,
what documentation do you use?
Coordinator
Aug 19, 2013 at 4:53 AM
Hi Mike,

If I'm understanding your question correctly, I have been referring in combination to the main AVFP documentation http://thetechconsult.com/avfp553/html/docs.htm, discussions/posting and I suppose I've been gaining most of my insight from going through the source code; most useful for what I've been doing has been ProxyStub.prg, RestHelper.prg & dch.prg.

All the best,
S

Ps. I just realised that it's nearly time for me to get up for work in the morning so I suppose I'd better get some shut eye quickly!
Developer
Aug 19, 2013 at 7:14 PM
Hi ABigDreamer,

I too had persistent but random crash that required re-stating iis. I really doubt you have the same problem but who knows......

Anyway, my problem was happening only when 2 or more testers where QA'ing at the same time. I naturally looked at this as app pool problem.

However, it was much more simple then that. It was two users trying to delete the same file at the same time. It was some code, similar to the following code, (... from samples for PDF printing)

oUtil=NEWOBJECT('AVFPutilities')
  • files older than 20 Minutes(1200 ms.), erase. 3rd param is path - can be hardcoded
    outil.DeleteFiles('pdf',1200,oProp.AppStartPath+[Temp])
I put the 'Erase' command in the DeleteFiles() within the try.. catch block, and crossed my fingers, but the problem has not happened since.

I wish I could be of better help..
Aug 19, 2013 at 8:47 PM
=== Most common error looks something like this.

Server Error in '/cfoxtow_web9V' Application.

Creating an instance of the COM component with CLSID {BEF60CED-FB7C-4835-A927-4EC90F5162CB} from the IClassFactory failed due to the following error: 80004005.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Creating an instance of the COM component with CLSID {BEF60CED-FB7C-4835-A927-4EC90F5162CB} from the IClassFactory failed due to the following error: 80004005.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[COMException (0x80004005): Creating an instance of the COM component with CLSID {BEF60CED-FB7C-4835-A927-4EC90F5162CB} from the IClassFactory failed due to the following error: 80004005.]
AVFPHandler.ProcessRequest(HttpContext context) +58
AVFPHandler.OnInit(EventArgs e) +20
System.Web.UI.Control.InitRecursive(Control namingContainer) +333
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378

Version Information: Microsoft .NET Framework Version:2.0.50727.5466; ASP.NET Version:2.0.50727.5
Aug 19, 2013 at 8:48 PM
The code is 1 PRG, not big. I can send anybody that wants it the prg and the databases that it affects.
-- email me at mikegps1@gmail.com if you want to try and produce this bug.
Aug 19, 2013 at 8:55 PM
When you get an error like the above. Unless you wrote activevfp -- it pretty much makes you dead in the water. What are
your options? With FoxPro ... I could put a debugger in and find my problem.

With activevfp I'm at the mercy of the people that wrote it.

And when I'm told... its in your code.... what do I do... start looking line by line without a clue where to start.

And then ... it makes it even worse when the code runs a 2nd time. perfectly .. the same code.

Explain that!
Aug 19, 2013 at 8:56 PM
(part 1)
  • customers.prg -Customers Controller
    • bypasses Main.prg and .AVFP script code
      *
      Define Class master2Controller As restController
      *
      Procedure openData
      _cursel = Select()
      _currec = Recno()
      Set Exclusive Off
      If !Used('master')
      Select 0
      Use (This.homeFolder + "towmast.dbf") Alias Master
      Set Order To dispstring
      Endif
      If !Used('invoice')
      Select 0
      Use (This.homeFolder + "towinv.dbf") Alias invoice
      Set Order To dispinv
      Endif
      If !Used('drivetran')
      Select 0
      Use (This.homeFolder + "towdrive.dbf") Alias drivetran
      Set Order To dispdrvinv
      Endif
      If !Used('trans')
      Select 0
      Use (This.homeFolder + "towtrans.dbf") Alias Trans
      Set Order To dispdrvinv
      Endif
      Select (_cursel)
      Go (_currec)
    Endproc

    Procedure infoAction
    Return "homeFolder: <b>" + This.homeFolder + "</b>"
    Endproc
*** WHERE Towmast.dispnum = ( 200001 ) ;
Procedure getAction
Local c_dispnum
c_dispnum = This.Params[1]

Set Path To oProp.AppStartPath+'prg\rest\controllers'
*** THIS.openData()
Set Procedure To snippet1 ADDITIVE 

oJSON=Newobject('json','json.prg')

Do Case
Case Len(c_dispnum) = 6

    Select Allt(Str(towmast.dispnum)) As dispnum, Dtoc(towmast.towdate) As towdate,;
        towmast.yearcar, towmast.makecar, towmast.modelcar, towmast.colorcar,;
        towmast.calltype, Dtoc(towmast.datein) As datein, Dtoc(towmast.dateout) As dateout,;
        towmast.callactnum, towmast.refnumber, towmast.callname,;
        towmast.licensest, towmast.licensenum, towmast.callphone,;
        allt(Str(towmast.days)) As days, towmast.storagetype, towmast.whocalled,;
        allt(Str(towmast.perday)) As perday, Allt(Str(towmast.perdaytotal)) As perdaytotal, towmast.vin,;
        towmast.Type, towmast.tagmonthyear, towmast.bodytype, towmast.towedfrom,;
        towmast.towedto, towmast.retowto, towmast.cross_street, towmast.Odometer,;
        towmast.membernum, Dtoc(towmast.liendout) As liendout, Dtoc(towmast.liendin) As liendin, towmast.lientype,;
        towmast.lientypems, Allt(Str(towmast.lienfee)) As lienfee, towmast.releaselic,;
        towmast.condition, towmast.keysinfo, towmast.holdnote,;
        towmast.callremark1, towmast.aaacallnum, towmast.priority,;
        towmast.equipment, towmast.regnametow, towmast.regname, towmast.regaddr1,;
        towmast.regaddr2, towmast.regaddr3, towmast.regcity, towmast.regstate,;
        towmast.regzip, towmast.ReleaseType, towmast.foxtow_id, towmast.mapcord,;
        towmast.area, towmast.ftiresize, towmast.rtiresize, towmast.wposition, towmast.reason,towmast.lotsection,;
        towmast.callremark,Towdrive.invoicenum, Towdrive.Driver, Towdrive.towtagnum,;
        Towtrans.Description As description1,Towtrans.Description As description2,;
        Towtrans.Description As description3,Towtrans.Description As description4,;
        ALLTRIM(Str(Towtrans.quantity)) As quantity1,Alltrim(Str(Towtrans.quantity)) As quantity2,;
        ALLTRIM(Str(Towtrans.quantity)) As quantity3,Alltrim(Str(Towtrans.quantity)) As quantity4,;
        ALLTRIM(Str(Towtrans.price)) As price1,Alltrim(Str(Towtrans.price)) As price2,;
        ALLTRIM(Str(Towtrans.price)) As price3,Alltrim(Str(Towtrans.price)) As price4,;
        Towdrive.trucknum, Towdrive.timerec, Towdrive.timecall,;
        Towdrive.timeinrt, Towdrive.timearrive, Towdrive.timeintow,;
        Towdrive.timeardst, Towdrive.timeclear, Dtoc(Towinv.invdate) As invdate,;
        Towinv.itemgroup, Towinv.ponumber, Towinv.billtoact, Towinv.billtoname,;
        Towinv.billtoaddr1, Towinv.billtoaddr2, Towinv.billtocity,;
        Towinv.billtost, Towinv.billtozip, Towinv.billtophone, Towinv.billtocont,;
        Towinv.paytype, Dtoc(Towinv.release_date) As releasedate, Towinv.release_time,;
        ALLTRIM(Str(Towinv.Total)) As curtotal1, Alltrim(Str(Towinv.curbalance)) As curbalance1,;
        Towinv.release_bywho, Towinv.release_time2, Towinv.kitnum,;
        Towinv.oldinvnum, Towinv.aaamemtype, Allt(Str(Towinv.miles)) As miles,;
        allt(Str(Towinv.milesto)) As milesto, Dtoc(Received.datepaid) As datepaid, Received.custnum,;
        Received.callactnum As callactnum2, Received.paytype As paytype2, Allt(Str(Received.amount)) As amount,;
        Received.referencenum;
        FROM ;
        towbox!towmast ;
        INNER Join towbox!Towdrive ;
        ON  towmast.dispnum = Towdrive.dispnumdrv ;
        INNER Join towbox!Received ;
        ON  towmast.dispnum = Received.dispnum ;
        INNER Join towbox!Towtrans ;
        ON  towmast.dispnum = Towtrans.dispnumtrs ;
        INNER Join towbox!Towinv ;
        ON  towmast.dispnum = Towinv.dispnum;
        WHERE  Alltrim(Str(towmast.dispnum)) = c_dispnum;
        INTO Cursor searchresults Readwrite

Case Len(c_dispnum) = 4
    Select Top 1 Allt(Str(towmast.dispnum)) As dispnum, Dtoc(towmast.towdate) As towdate,;
        towmast.yearcar, towmast.makecar, towmast.modelcar, towmast.colorcar,;
        towmast.calltype, Dtoc(towmast.datein) As datein, Dtoc(towmast.dateout) As dateout,;
        towmast.callactnum, towmast.refnumber, towmast.callname,;
        towmast.licensest, towmast.licensenum, towmast.callphone,;
        allt(Str(towmast.days)) As days, towmast.storagetype, towmast.whocalled,;
        allt(Str(towmast.perday)) As perday, Allt(Str(towmast.perdaytotal)) As perdaytotal, towmast.vin,;
        towmast.Type, towmast.tagmonthyear, towmast.bodytype, towmast.towedfrom,;
        towmast.towedto, towmast.retowto, towmast.cross_street, towmast.Odometer,;
        towmast.membernum, Dtoc(towmast.liendout) As liendout, Dtoc(towmast.liendin) As liendin, towmast.lientype,;
        towmast.lientypems, Allt(Str(towmast.lienfee)) As lienfee, towmast.releaselic,;
        towmast.condition, towmast.keysinfo, towmast.holdnote,;
        towmast.callremark1, towmast.aaacallnum, towmast.priority,;
        Towtrans.Description As description1,;
        towmast.equipment, towmast.regnametow, towmast.regname, towmast.regaddr1,;
        towmast.regaddr2, towmast.regaddr3, towmast.regcity, towmast.regstate,;
        towmast.regzip, towmast.ReleaseType, towmast.foxtow_id, towmast.mapcord,;
        towmast.area, towmast.ftiresize, towmast.rtiresize, towmast.wposition, towmast.reason,towmast.lotsection,;
        towmast.callremark,Towdrive.invoicenum, Towdrive.Driver, Towdrive.towtagnum,;
        Towtrans.Description As description1,Towtrans.Description As description2,;
        Towtrans.Description As description3,Towtrans.Description As description4,;
        Towtrans.quantity As quantity1,Towtrans.quantity As quantity2,;
        Towtrans.quantity As quantity3,Towtrans.quantity As quantity4,;
        Towtrans.price As price1,Towtrans.price As price2,;
        Towtrans.price As price3,Towtrans.price As price4,;
        Towdrive.trucknum, Towdrive.timerec, Towdrive.timecall,;
        Towdrive.timeinrt, Towdrive.timearrive, Towdrive.timeintow,;
        Towdrive.timeardst, Towdrive.timeclear, Dtoc(Towinv.invdate) As invdate,;
        Towinv.itemgroup, Towinv.ponumber, Towinv.billtoact, Towinv.billtoname,;
        Towinv.billtoaddr1, Towinv.billtoaddr2, Towinv.billtocity,;
        Towinv.billtost, Towinv.billtozip, Towinv.billtophone, Towinv.billtocont,;
        Towinv.paytype, Dtoc(Towinv.release_date) As releasedate, Towinv.release_time,;
        ALLTRIM(Str(Towinv.Total)) As curbalance1,;
        Towinv.release_bywho, Towinv.release_time2, Towinv.kitnum,;
        Towinv.oldinvnum, Towinv.aaamemtype, Allt(Str(Towinv.miles)) As miles,;
        allt(Str(Towinv.milesto)) As milesto, Dtoc(Received.datepaid) As datepaid, Received.custnum,;
        Received.callactnum As callactnum2, Received.paytype As paytype2, Allt(Str(Received.amount)) As amount,;
        Received.referencenum;
        FROM ;
        towbox!towmast ;
        INNER Join towbox!Towdrive ;
        ON  towmast.dispnum = Towdrive.dispnumdrv ;
        INNER Join towbox!Received ;
        ON  towmast.dispnum = Received.dispnum ;
        INNER Join towbox!Towtrans ;
        ON  towmast.dispnum = Towtrans.dispnumtrs ;
        INNER Join towbox!Towinv ;
        ON  towmast.dispnum = Towinv.dispnum;
        WHERE  Right(towmast.vin,4) = c_dispnum;
        ORDER By towmast.dispnum Desc;
        INTO Cursor searchresults Readwrite

Endcase
Replace searchresults.curtotal1 With ''
Replace searchresults.curbalance1 With ''
Replace searchresults.perdaytotal With ''

Replace searchresults.description1 With ''
Replace searchresults.description2 With ''
Replace searchresults.description3 With ''
Replace searchresults.description4 With ''

Replace searchresults.price1 With ''
Replace searchresults.price2 With ''
Replace searchresults.price3 With ''
Replace searchresults.price4 With ''

Replace searchresults.quantity1 With ''
Replace searchresults.quantity2 With ''
Replace searchresults.quantity3 With ''
Replace searchresults.quantity4 With 
Aug 19, 2013 at 8:57 PM
(part 2)

*** =gettrans1()
*** =gettotals1()
Local _ll1
oJSON.keyforcursors="master"

oResponse.ContentType = "application/json;charset=utf-8"
oResponse.Write(oJSON.stringify('SearchResults'))

oResponse.Flush
Return []


Endproc

Procedure getAction_old
Local c_dispnum
c_dispnum = This.Params[1]
This.openData()
Select Master
Set Order To dispnum
Seek c_dispnum
**** SELECT CUSTOMERS

**** LOCATE FOR custId = cCustId
If Found()
    Local cJSON
**USE mydbf &&test error
*quick and dirty JSON

**** cJSON = [{"custId":"] + RTRIM(custId) + [","custName":"] + RTRIM(custName) + [",] + ;
**** ["custStat":"] + RTRIM(custStat) + ["}]

*** cJSON = [{"dispnum":"] + str(dispnum) +[","towdate":"] +DTOC(towdate)+;
    cJSON = [{"dispnum":"] + Allt(Str(dispnum)) + [","towdate":"] + Dtoc(towdate) + [",] + ;
        ["yearcar":"] + Allt(yearcar) + ["}]





    Return cJSON
Endif
Endproc

Procedure listAction
Local cHTML
cHTML = ""
*oEmp=newOBJECT('schedbizobj','c:\avfp5.61Demo\prg\utiltest2.prg')
Set Proc To Substr(oProp.AppStartPath,1,At([\],oProp.AppStartPath,2))+'prg\AVFPutilities' Additive   && Make sure you use ADDITIVE or bad things happen!
This.openData()
Select Master
cHTML= oHTML.mergescript(Filetostr(Substr(oProp.AppStartPath,1,At([\],oProp.AppStartPath,2))+'viewtest.avfp'))
Return cHTML
Endproc

Procedure helloworld      && custom method
Local cHTML
cHTML = ""
*USE mydbf
*SET PROC to substr(oProp.AppStartPath,1,AT([],oProp.AppStartPath,2))+'prg\AVFPutilities' ADDITIVE && Make sure you use ADDITIVE or bad things happen!
cHTML= oHTML.mergescript(Filetostr(Substr(oProp.AppStartPath,1,At([\],oProp.AppStartPath,2))+'hello.avfp'))
Return cHTML
Endproc

Procedure getemployees      && custom method

oJSON=Newobject('json','json.prg')

Set Path To oProp.AppStartPath+'data\AVFPdemo41\'

Select e.emp_id As Id, e.first_Name As firstName, e.last_Name As lastName, e.Title As Title, [images/Emps/]+e.Picture As Picture,Count(r.emp_id) As reportCount ;
    from employee e Left Join employee r On Val(r.reports_to) = Val(e.emp_id) ;
    INTO Cursor searchresults;
    group By e.last_Name,e.emp_id, e.first_Name,e.Title, e.Picture ;
    order By e.last_Name,e.first_Name


oJSON.keyforcursors="items"
  • send JSON data and properties back
    oResponse.ContentType = "application/json;charset=utf-8"

    oResponse.Write(oJSON.stringify('SearchResults'))
    *** Response.Write(fwJSON.WriteCursor())
    oResponse.Flush
    lcHTMLout=[]
    Endproc

    Procedure getmaster && custom method

    oJSON=Newobject('json','json.prg')

    Set Path To oProp.AppStartPath+'prg\rest\controllers'

    Select towmast.dispnum, towmast.towdate, towmast.yearcar;
    FROM towbox!towmast;
    INTO Cursor searchresults
    
    
    oJSON.keyforcursors="items"
  • send JSON data and properties back
    oResponse.ContentType = "application/json;charset=utf-8"
    Set Talk On
    Activate Window trace
    oResponse.Write(oJSON.stringify('SearchResults'))
    oResponse.Flush
    lcHTMLout=[]
    Endproc

Enddefine

Function gettrans1
Select Trans
Seek searchresults.dispnum
_counter = 0
Scan While Alltrim(Str(Trans.dispnumtrs)) = Alltrim(searchresults.dispnum)
_counter = _counter + 1
If _counter = 1
    Replace searchresults.description1 With Trans.Description
    Replace searchresults.quantity1 With Alltrim(Str(Trans.quantity))
    Replace searchresults.price1 With Alltrim(Str(Trans.price))
Endif
If _counter = 2
    Replace searchresults.description2 With Trans.Description
    Replace searchresults.quantity2 With Alltrim(Str(Trans.quantity))
    Replace searchresults.price2 With Alltrim(Str(Trans.price))
Endif
If _counter = 3
    Replace searchresults.description3 With Trans.Description
    Replace searchresults.quantity3 With Alltrim(Str(Trans.quantity))
    Replace searchresults.price3 With Alltrim(Str(Trans.price))
Endif
If _counter = 4
    Replace searchresults.description4 With Trans.Description
    Replace searchresults.quantity4 With Alltrim(Str(Trans.quantity))
    Replace searchresults.price4 With Alltrim(Str(Trans.price))
Endif
Endscan

Endfunc

Function gettotals1
Select invoice
Seek searchresults.dispnum

Replace searchresults.perdaytotal With Alltrim(Str(storagetot_web(searchresults.dispnum,'STORAGE')))


Endfunc
Developer
Aug 19, 2013 at 11:44 PM
Yes.. Our basic problem is not having the tracing feature.

I too faced the problem with tracing my code. However, I did not intend to use MVC ( i.e. Only POST and sessions are allowed due to security concerns Its silly but I don’t make rules) so my problem was relatively easy to solve. Also, I haven't used classes unless they are packaged into an 'Exe', never to be changed. i.e. are system development tool, and not as application development tools. It just takes longer to debug with classes due to re-starts.

I did my tracing outside the AVFP page. It’s little convoluted but effective. The basic law is that I live and die in one page only. All the common set procedure to (database connections, calling data from SQL server, setting variables etc etc) are in the page 'header'. Page specific VFP code goes after the </header> and before the <body> in the form of a separate ‘code behind’ prg file ( another set procedure to).. and all the variables/procedures are released in the footer. Client side JS is not used at this time.

This now allows me to create the ‘test’ page in VFP itself as follows

I create a prog in VFP which has all the set procedure to.. additives. I then I develop the entire VFP page in this stand alone prg. This is the reverse of what happens in AVFP page. i.e. the HTML is now in embedded strings.

For oProp, oSession, oRequest etc used inside the actual page.. I create them with Createobject(“empty”) and feed them the values (expected in the actual page), at the start of this development prog. Also have a good error handler that releases the procedures apart from displaying error msg.

Since this is a simple PRG, I run it under VFP and do the trace of the HTML being built, line by line. At the end I dump the sting into a temp folder with HTML extension and call Chrome on it. I never get the control positions right (also no CSS) nor do I intend to.

It is not failsafe. I have lost time when I could switch data session from this development/testing program, but the PDF component did not allow changing data sessions in AVFP page ( under IIS).

You may also have to set procedure to ‘prg’ files of ActiveVFP. I don't. I actually duplicate or re-create them outside, in my common program.

It may seem more time consuming, but my productivity is much better.
Coordinator
Aug 20, 2013 at 3:35 AM
Hi Mike,

re:
Creating an instance of the COM component with CLSID {BEF60CED-FB7C-4835-A927-4EC90F5162CB} from the IClassFactory failed due to the following error: 80004005.
type errors...

Like Titu1, I haven't been trying to instantiate any COM objects so perhaps that's why I haven't so far encountered this type of error message.

I am doing things entirely the "AVFP" way by containing my classes in the prg files + using dch class to handle them.

I was hoping eventually to try and create instances of COM components because that's the way I've been developing for some time now but I think that I'll stay away from this until we properly work out how to do it without causing these types of error.

Regards,
Simon
Developer
Aug 20, 2013 at 5:18 AM
COM error would not show much. It’s a standard garbage line. It just tells that you had some problem in your code. Normally ComReturnError() gives a better picture. I am not sure if it's implemented in MVC part of AVFP. you can check on that one.

I had a quick review of your code and if you don't mind, a few suggestions.
  1. replace select() with Select(0) . That will guarantee return regardless of compatible settings
  2. _currec = Recno().. & Go (_currec) …you may have to take care of BOF() or EOF(). I normally store the GUID of the record and do a ‘locate for’ just to make sure I land of the same ‘state’ while exiting the program. It works unless that record is deleted or if you don't keep UID's for each table!record.
  3. Due to set procedures & open databases.. maybe it would be wise to have a ‘clear all’ as the last command line of your page? It should take out any hanging references just before response takes over.
  4. ….INTO Cursor searchresults Readwrite…
    I think you need to have ‘readwrite’ AND ‘nofilter’. Otherwise, VFP may still pop a cached view.
  5. Not sure of the set path changes. I normally expect the set procedure to and session (in your case.. database) to find all identifiers and references.
    1. if you have CDX files maybe you can re-index them.
  6. comment out the ..
    Set Talk On
    ‘Activate Window trace’
    If this ‘is’ COM.. then user interface may raise error.
  7. Not sure of your ‘set exact’.. but if you are doing string alltrim() then
Alltrim(Str(Trans.dispnumtrs)) = Alltrim(searchresults.dispnum)

Can be written as

Alltrim(Str(Trans.dispnumtrs)) == Alltrim(searchresults.dispnum)
  1. [images/Emps/]+e.Picture As Picture
Do you have proper permissions for this resource?
  1. Now the syntax errors. It may be from _clipboard but still you may like to check
10.1
*** WHERE Towmast.dispnum = ( 200001 ) ;
Procedure getAction

Needs to be

*** WHERE Towmast.dispnum = ( 200001 )
Procedure getAction

10.2
Replace searchresults.quantity4 With

Needs to be

Replace searchresults.quantity4 With ‘’


109.3
• Send JSON Data And properties Back
Needs to be
* Send JSON Data And properties Back
10.4
--------------------------------------------------------------------------------
Needs to be
*--------------------------------------------------------------------------------
I hope it helps.
Aug 20, 2013 at 5:30 AM
This is just one of many PRG's that fail.

they all compile just fine.

thank you for taking the time to look at this code.

Many PRGS bomb. Not just this one.
Aug 20, 2013 at 5:31 AM
And remember... the same exact PRG will run sometimes and not bomb.

without changing 1 line of code.

it just decides to work.
Coordinator
Aug 20, 2013 at 10:34 AM
Edited Aug 20, 2013 at 11:13 AM
And remember... the same exact PRG will run sometimes and not bomb.

without changing 1 line of code.

it just decides to work.
Likely because you weren't using ADDITIVE in your SET PROC as we discussed. This will send some nasty errors to AVFP. COMRETURNERROR will deal with these types of errors in a smoother way and the using the Session class for RestHelper might help as well.

These are already implemented in AVFP scripting. These improvements for RESTful controllers are slated for the next release.

Nothing gets around the fact, though, that there are bugs in your app code.
When you write very simple code that returns json results and 1 moment it works, and the next moment it throws an error
This is the demo on regular GoDaddy shared hosting:
http://www.rootsofmine.com/avfp603/customers/getemployees
http://www.rootsofmine.com/avfp603/customers

If you run it over and over again it will ALWAYS work. Not once in a while, not sometimes.. ALWAYS. If what you're saying is true, this wouldn't be the case. I could set up a separate APP pool in IIS on your AWS server, run the AVFP demo from it, and this would be the case there as well. The only conclusion is that it's your code that is doing this. (And not using ADDITIVE in SET PROC, even as trivial as that sounds, will do this sort of thing.)
Developer
Aug 20, 2013 at 1:41 PM
Hi BigDreamer,

In my (limited) experience with AVFP, the problems were in my code, 99.99% of the time.

I was like you in the beginning i.e. distrustful of AVFP (i.e. nothing is free, so it is crap). However, every time I found the problem on my side, I got happier and happier with AVFP.

As of now, I think it is one of the top apps I've worked on. It is very simple to work with (if you are VFp developer) and very stable.

Haivng the source code is just icing on the cake. It opens unlimited possibilities.

In less than 20 days, I already have 2 modules under QA. Approved budgeted time for these was 6 months minimum for converting to .net. QA is not happy due to lack of unit testing. I got around this by using the approach I described above ( i.e. test prog approach) which will need to be standardized after a critical point is reached.

The last hurdle is to convince the network people regarding security so that it can be loaded in core IIS.

None of these outstanding problems relate to stability of the system.
Coordinator
Aug 20, 2013 at 5:28 PM
Hi Mike,

Did you get my email?

re:
The code is 1 PRG, not big. I can send anybody that wants it the prg and the databases that it affects.
-- email me at mikegps1@gmail.com if you want to try and produce this bug.
I'd like to help if I can but, to be honest, I'm being a bit selfish as well because I think that I'll benefit myself from having a copy of something that is not working (for some reason or other). I hope that this makes sense?

Please do send me copies of the prg and data files so that I can try and run it at my end.

Thanks & regards,
Simon
Aug 20, 2013 at 8:10 PM
Will respond soon.
Aug 20, 2013 at 9:10 PM
I emailed you some files. I am putting more together. See if you can get the simple ones
working first along with my databases.

I am also trying to figure out why they are not working. So far I've only sent you PRGS that work.

More soon.
Mike

P.S. thankful for your help. Regardless of if you end up helping, just the fact that somebody cares is awesome.

(email me) if anybody else want's to follow us along.
mikegps1@gmail.com
Aug 20, 2013 at 9:13 PM
Claude your REST examples are simple. My 13 year old son could have written them.

Get something working in the real world that has some depth and then come back to me and tell me it always works

And I'm referring to your REST examples.

Your example is like 15 lines of code.

Seriously?

this proves the platform is stable?
Aug 20, 2013 at 9:18 PM
And just as a side note.

I do not doubt for 1 moment that Activevfp works 100% of the time.

What I do doubt is that REST code is stable.

And if it IS stable. I sure isn't for me.

Call me an idiot, call me stupid, call me 100 names Dearest Claude

but that doesn't change the fact that I AM TRYING TO USE THIS PLATFORM

And if I am struggling.......... and its always crashing............. don't you think in the end its important?

Solutions like ............. "It's your code idiot" is not really helpful.
Coordinator
Aug 20, 2013 at 9:34 PM
More like an extreme whiner. You are extremely lucky Simon and Titu1 are willing to help you. You've done nothing but whine and trash the project when things are not working for you and you have contributed a big fat ZERO. You obviously do not understand that this is a community project where the primary goal is helping one another, not whining about evry little detail and making threats to get your way like a spoiled child. Geezus, and you keep making the statements.... Why don't you tone down the attacks and just try to learn. You've already ruined your relationship with me, I advise you to take a different tact with the other generous members of this project.
Aug 20, 2013 at 9:51 PM
Complete BS ...

I posted EC2 and shared Appery.io work. Soon I'll be talking on thefoxshow regarding my experience with Appery and tools that allow me
to talk to FoxPro via the web.

I've been playing with 3 different platforms. Your's is just one of them.

If this is not contributing to activevfp then what is?

Fixing .net bugs?

I'm not a .net programmer Claude.

As for ruining my chances with you? You lost credibility with me the moment I shared source and you insisted it was ALL MY code.
Considering MY code was 1 PRG.

Would have taken you about a hour to figure out WHAT was causing this problem.

Instead you resort to this approach

Probably less than an hour.
Coordinator
Aug 20, 2013 at 10:17 PM
Edited Aug 20, 2013 at 10:35 PM
You still don't understand (big surprise!). This is not my project - it's the FoxPro community's project. So you think you're attacking me but you're attacking the community - good luck with that...

Any monkey can open an account with AWS or appery.io. That equals ZERO. Actually working with us here and making constructive progress is our goal, not signing up for some service... Yeesh!

You learn by working with FoxPro code in AVFP, not .NET code. You're not even willing to isolate your own problems in your code but expect someone here to debug your entire prg. I can tell you NO ONE has ever resorted to that tactic here since we began in 2006. So I guess you made some kind of history...congrats or something.

Long story short - I wish you would leave but some of our members are willing to help you so whatever...
Aug 21, 2013 at 3:02 AM
Just out of curiosity Claude: of the people that are here in this forum, what percentage of the lines of code
are YOURS, or somebody that's actively here all the time?

You can't use people like Rick as an example ... because he's never here.

Code that YOU WROTE, versus code that others wrote, that has to do with the MAIN .net classes or the most important GUTS of activevfp

How much was written by others here and who are they?

If this answer is a Community answer, then AWESOME. My mistake. I'll ask those people. Because they can fix bugs in the .net code

If 95% of the code was written by YOU then .....

actually lets get the number. What is the number?

RAW guts of Activevfp that makes it work and makes it crash.
Aug 21, 2013 at 3:03 AM
Server Error in '/cfoxtow_web9V' Application.

Creating an instance of the COM component with CLSID {BEF60CED-FB7C-4835-A927-4EC90F5162CB} from the IClassFactory failed due to the following error: 80004005.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Creating an instance of the COM component with CLSID {BEF60CED-FB7C-4835-A927-4EC90F5162CB} from the IClassFactory failed due to the following error: 80004005.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[COMException (0x80004005): Creating an instance of the COM component with CLSID {BEF60CED-FB7C-4835-A927-4EC90F5162CB} from the IClassFactory failed due to the following error: 80004005.]
AVFPHandler.ProcessRequest(HttpContext context) +58
AVFPHandler.OnInit(EventArgs e) +20
System.Web.UI.Control.InitRecursive(Control namingContainer) +333
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378


P.S. THE CODE ran perfect and then I got this bug.

Looking closely at the code for issues.
Aug 21, 2013 at 3:31 AM
I'm going through all the code... and trying to figure out what's going on. There is a lot of it. Versions
as I moved ahead and changed things.

I have noticed

set procedure to ............ (without) additive

I have changed this code. And I'm praying this is a big part of my problem. Would be awesome if
it was 1 word missing.

Also very scary if this was my only problem.

Hoping
Coordinator
Aug 21, 2013 at 11:13 AM
Hi Mike (abigdreamer),
Did you change the set proc statement and if so has it made a difference?

Regards,
Simon
Developer
Aug 22, 2013 at 12:09 AM
BigDreamer.. yes that is a big one for AVFP.
Coordinator
Aug 22, 2013 at 5:07 PM
It probably works for Mike now. He only posts here when he's ready to give up/trash the software again...
Aug 22, 2013 at 6:43 PM
Claude you could provide a list of all the source code that would halt Activevfp
and cause programmers like me thousands of dollars in wasted productivity.

Then the community could write a PRE PROCESSOR to run on your code that
replaces all these lines or tells you about them.

I'll start the list. Is this entire list inside the DOCS on PAGE 1 in BOLD
60 point RED FONT.. that would be awesome.

Is the list in your docs?

Here, I'll start the list for you.
  1. set procedure to
  2. ___________________________________ ?
I'm still testing and very hopeful my entire problem was 1 line of code.
Aug 22, 2013 at 6:47 PM
I had written the same types of code at least 5 different ways trying to ISOLATE the problem and figure
out what was causing it.

And just FYI Claude ... while your busy talking shit about me (AGAIN) if you look in this forum you will find a lot of
posts about Appery.io

Which has NOTHING TO do about blasting Activevfp

This just proves how worthless your attitude is. If I didn't know better I would be 100% sure your still in high-school.

Mike
Coordinator
Aug 22, 2013 at 7:04 PM
Edited Aug 22, 2013 at 7:12 PM
Whine whine whine . Make you feel better, big baby?

I will not be addressing you directly anymore anymore and I sincerely wish you would leave. You provide nothing positive to the software or this forum and have no respect for this free and open source software generously provided to you by developers actually contributing to the community instead of whining "what have you done for me lately? wah, wah, waaaaahhhhh...... hold my hand.....can you debug and write my code.... I didn't get my way so your software sucks". etc. I can honestly say I've never come across a more rude and selfish developer in my professional career - AND THAT'S SAYING SOMETHING! Goodbye and good luck!!!!
Aug 22, 2013 at 7:22 PM
I guess I'm not getting my list?

'in my professional career'

I'm amazed and your lack of empathy and thankful you never became a doctor.

'Hello Mr Smith, how are you feeling today? Seem's you are probably gonna die because you smoked to many cigarettes
and treating you for cancer is pointless'

Can you point out all of the Activevfp Cuss words? I started the list on another thread.

Oh that's right .. that would be helping me with a Treatment option to actually make the product better. And because the product
is PERFECT that's impossible.
Coordinator
Aug 22, 2013 at 7:26 PM
Edited Aug 22, 2013 at 7:56 PM
You're just an extremely difficult person to work with primarily because of your negativity because something in the software isn't to your liking.. And your selfishness and rudeness is just the icing on the cake...
Developer
Aug 22, 2013 at 8:27 PM
I doubt it’s any different from any other VFP application.

The things which I faced were as.. not necessarily crash. Most occur during debugging.
  1. Leaving dangling objects ( i.e. created by createobjects()). Even if you hae release them at the end of the page, you may leave then hanging during debugging crash or oresponse.redirect (on user error?)
  2. Not closing SQL connections (normally in a transaction). Again debugging problem. Not sure if you are using C/S though.
  3. Regarding set proc.. another issue is the ‘order’ in which you set the pointers to these PRGs. This is issue only if you use function overloading. i.e. two functions with same name & signature but doing different things in two diff PRG files. Again this may be an issue in ‘error stage’, when the one of the prgs may not release and if you don’t keep watch, when you resume the prog execution, the re-loading of set proc pointers will not be in the order you think they are loaded.
  4. Watch out for your ‘Set’ commands. These may be different from the application that you are converting to web.
  5. Take care of multiuser. PACK, create, delete of dbfs may give you grief if you haven't taken care of isolating each page per user.
  6. Do not attempt to access any folder/file unless you are sure you have permissions to that folder. I forgot that ‘Delete’ permission was explicit.
  7. Also use parameterized SQL queries only. Naked strings are big no no, not just in 'Get' but in 'Post' too.
  8. store you querysting/form variables in osession, at the start of prog, i.e. before you check for authentication.
  9. avoid using Sys(2023). We have a temporary folder for this. Now, make sure you do not overwrite or delete or write to any file here, that may potentially be in use by another user. I never load anything here unless it’s name is from sys(2015).
    1. Make no assumption of oSession variables. They last a long time i.e. 20 min. Also these go across multiple tabs of chrome/IE.
More than anything, I kept a positive attitude even when AVFP did not behave the way I expected it to. I had to tell myself that It just gives just a general framework and a starting point and is not the end game. In the beginning I was 'testing' after EVERY command line I wrote. Honest.
Coordinator
Aug 22, 2013 at 8:37 PM
Titu1 wrote:
More than anything, I kept a positive attitude even when AVFP did not behave the way I expected it to. I had to tell myself that It just gives just a general framework and a starting point and is not the end game. In the beginning I was 'testing' after EVERY command line I wrote. Honest.
This works for me even at this time, it's better than banging your head. :)

+1 on the positive attitude as well. :)
Aug 30, 2013 at 3:15 AM
Thank you for this information. It helps!