resthelper fixes

Topics: Developer Forum, User Forum
Oct 18, 2013 at 3:45 PM
Hi all

I already open a issue tracker proposal for fixing last bugs encountered.

please check:

I need it anyway, so I think it compensates the effort and hope it would be useful for others too.

I also hope tested it enough , if not: my own project will suffer the consecuencies :( , so please advice about any issue you find.

note: I will upload the file in the next few hours

Thank you
Oct 18, 2013 at 6:22 PM
Edited Oct 18, 2013 at 9:57 PM
Hi all again

Believe me, I don't want to insert more controversial about this issue but , while doing a final test I noticed that a rest request could include a dot in it's last parameter on the last 4 positions.

i.e. http://localhost/ActiveVFP603/customers/getaction/25.110

That should be considered a no-restful Uri and consecuent skyped

I was almost ready to retire the improvement part, when I noticed that a cuestion mark could be in the same case too, so, if I am correct in the actual situation any "?" in the url is not considered restful i.e.


Therefore ,in order to have the most accurate and bugs-free AVFP resthelper and avoid fixing partial things in different and separated proposals I conmmit your oppinion about that

SimonCl show us a snippet code of his work in progress of a totally new rest structure , and wondering if a customized adaptation to it include the "dot" check also could solve this new bug and maintain a small improvement ( with his permission of course)

So, sorry for postpose/delay the file upload , cause it could add more confusion, which is not desired

Oct 21, 2013 at 9:27 AM
Edited Oct 21, 2013 at 3:24 PM
Never mind!

I figured it out by myself while watching how fun and entertaining is to study someone's code.

Found how to bypass the bug maintaining the improvement, (I'm remembering fox-code quickly).

Basically checks only the first two "chunks" (3 if needed) in "SCRIPT_NAME" and the (.) & (?) positions inside.
If you find it very restrictive for a general proupose, just replace it by your own, or use the original ..OR AT("?",cUri)<>0 8-(
   IF !EMPTY(JUSTEXT(cUri)) OR (OCCURS("/",cUri)<3 AND ATC(".",cUri,1)>LEN(cUri)-5) OR;
   (OCCURS("/",cUri)<3 AND ATC(".",cUri,1)>LEN(cUri)-5 AND ATC("?",cUri,1)<ATC(".",cUri,1)+6 ) 
Also fixed actions names exact match and replace actions from being the first parameter (lines 154 , 200).
That still keeps the possible use of a default (empty) parameter in an action, but removes the default (empty) action for a controller,
So now controller and action are mandatory. but I learned how to do it just in case :)

Well, That's all for now

I tested it some, but forgive me if have something , I'm going to use it , so in case it fails, I'll let you know.
I really can not dedicate more time on this issue now cause I must be focused 120% on my toy , and that will take me away for quite a while, so......

Thanks a ton for the help, wish you the best of luck ,take care and be good

Best Regards to all

BTW: FoxPro forums were always selfless assistance sites, full of collaboration and peace.
Ego & competition only brings problems and makes things worse.
My vote for a nice, relaxed, trusted and good humor treatment.

We, Old schoolers have failed sometimes to teach some good values to youngers
(and one of my favorites) Life is short enough to believe that win or lose matters.
Oct 21, 2013 at 3:23 PM


An AVFP normal request (no restful) will never met both conditions i.e.


So the unique posible check is that a dot exist in the first X chunks ( and never use dot in controllers)
( one more slash and is considered rest because controller/action are mandatory)
  IF !EMPTY(JUSTEXT(cUri)) OR (OCCURS("/",cUri)<3 AND ATC(".",cUri,1)>0)
And that depends on where is AVFP installed, if in the default web page or on a 1st level ( virtual directory/aplication) the check as it is now is fine in both cases, but if installed more levels deep ??

Wondering if it would need a new sever variable to determine that .. or is any other way to test it. and avoid the need of recompile in particular cases

Uploading... see you
Oct 21, 2013 at 3:40 PM
This one seems to be the more aceptable ( not included in the file ) :-)
  IF !EMPTY(JUSTEXT(cUri)) OR (OCCURS("/",cUri)<3 AND ATC(".",cUri,1)>LEN(cUri)-5) OR;
   (OCCURS("/",cUri)<3 AND ATC("?",cUri,1)>0)
Oct 22, 2013 at 11:36 PM
Hi Karl,

Do not think you are being ignored. I guess, like me, everyone has already modified this portion of AVFP, in their systems, to suit their individual needs, and may consider it a non issue for their systems. ( i.e. do not want another round of QA).

However, new users may have requirements similar to yours, and your emails on this topic will surely help them a lot.

Thanks for sharing.
Oct 23, 2013 at 6:20 PM
Hi Titu1

Thank you very much for worrying about what I can think, I just hope It could help others, and would not be the first time nor the last that is assumed not to live with bugs.

Even proposed fixes with them !.

I Strongly recommend Andy's weblog article.

I've never been more in line with hes comments.
I just want people to avoid the mistakes I made and, since I am older than most of my peers, I have also made more mistakes. Been there, done that!
And what differentiates the wise from the foolish is not making mistakes (they both do that) but learning from them Wink [;)]

Thanks Andy , you are a reference.
Oct 23, 2013 at 8:01 PM
Hi Karl,

I too agree with andy. I think, the problem here is of time required to make a new release. Therefore, the procedure for submitting changes.

My approach has been to make my observations/enhancements visible in the discussion section for anyone searching a solution to similar problems. I am sure, when a new release does come out, all our comments will be reviewed.

Meanwhile, you are free to make changes in our copy of AVFP since you have all the source. That is just priceless.
Oct 23, 2013 at 8:51 PM
Yep Titu, I agree in part with that

As I suposse this is my last post, I'm going to use the freedom privilege that birngs me my age ( and I use it in very few situations).

It's kown that listing the negative part, allows to make all new constructive things.

You mention the change-submiting proccess , and that is one possible stopping cause, to make the product grow faster and with better conditions,
( sometimes the political rules are not ideal, that's the game, but could cause a lot of troubles )

When someone ( like me i.e.) enter the first day and heard, If you want it fixed, fix it yourself ( no available fixes for that , and users are supposed to do it ),
the first sensation is that nobody cares for big problems, and it's not coordinated, seems like there are more important things, users are requesting. so fix the great AVFP utillityes anounced with bells and whistles is defenitely a second priority.

I think I'm going to stop here...

Thanks & Regards
Oct 24, 2013 at 10:45 AM
Guys, I don't think it's asking a lot for you to make your changes, recompile the project, and test what you have done. At that point we all can test it. It's just not that hard...
Oct 24, 2013 at 3:09 PM
Of course claudefox, and it is not ! ,

The only inconvenient is that for a 2 days task max. took almost 15 days, because the 'team' is more focused on other issues, and Q&A ( a thing that 99.9% software
cies. used every single day to mantain the product apart from serious quality compromised ) is not important when the matter in question is fix severe bugs. So internal fights are affecting the quality also, and I'm not a friend of mixing personal interests with job and pleassure :)

All said, whish you the best, see you on next project.
Oct 24, 2013 at 5:22 PM
"So internal fights.."
What are you talking about? One guy (abigdreamer) made a big fuss because he didn't understand the software and didn't read the docs. He then proceeded to act like a big baby blaming everyone else but himself. Now you blame everyone and the project over one bad apple??
... question is fix severe bugs.
What severe bugs?? If you went to the trouble of finding "severe bugs" and providing "fixes" the least you could do update the code and show what the fix achieved. It just isn't that hard and, yes, it is unfair to expect me or anyone else to take responsibility for doing this ( I think I've contributed enough already - what have you contributed??). Community and Open Source are seemingly foreign concepts to some people. Try acting like this in ANY Open Source project and see if you get better results....

Sorry you're having so much difficulty. If adding your changes and recompiling is too difficult, then maybe this sort of thing is not for you.
Oct 24, 2013 at 6:12 PM
Now you blame everyone and the project....
I`m not blaming ANYONE but me, please re-read how, when and why I was fixing.

what have you contributed??......
Really nothing. just my time ( any value at all)

If adding your changes and recompiling ......
I've push the button 'generate' more times than the hours I lived in my wole life, that's not the big effort :)
This is nothing personal, good to know we have different oppinions. everyone happy.
Oct 24, 2013 at 8:18 PM
No problem. But people need to get over the expectation that I (or someone else) needs to fix everything on this project.. If a developer wants to fix or change the functionality they have everything they need here to do so. After doing most of the project, video, documentation, etc since 2006 it's time for others to get actively involved if they're interested.. I don't have any problem helping those that help themselves as long as it doesn't involve me doing the majority of the work. I too value my time..
Oct 25, 2013 at 12:24 AM
Hey Claudefox

I guess you didn't check the issues tab for your comments, Excuse me for no mentioned it earlier , nothing malicious, just reminds me of my time of preconceptions, when the trees would not let me see the forest. good theraphy for me in this hard moments.
Oct 25, 2013 at 5:56 PM
Let me share my thoughts once again (in the end this is my unique thread and I'm still the newbie thinking what to do)

A project can not live without contribution of users, and users choose projects for their needs, this is a symbiosis.

Change the rules in one direction has never worked.

This been going on for thousands of years in the community and are not expected to change in the coming centuries.

Users contribute for various reasons, some to adapt the product to their liking, some for improve, others for mere fun, and some share their ideas and improvements, or fixes and other not,

The trick is to give everyone what they expect and make them feel safe, comfortable and cared. In summary that they both trust each other.

To achieve that, sometimes threre sould be rules that need revision, actitudes that need to be softed, and procedures to be observed.

But all that is just an old newbie oppinion, nothing more, nothing less.

And Claude, you are very right making decissions to put all in a new age phase.

I trust in this excelent project ( if not , I've never been fixed it since the very first day)
I don't have any problem helping those that help themselves as long as it doesn't .......
Users doesn't have any problem contributing as long as ............. ( please write something atractive here)
Oct 28, 2013 at 1:40 AM
Titu1 one last thing ( I promise)
My approach has been to make my observations / enhancements visible in the discussion section for anyone searching a solution to problems like . I am sure, When a new release does come out , all our comments will be reviewed .
Meanwhile , you are free to make changes in our copy of AVFP since You have all the source . That is just priceless .
Sorry for say this but..
I guess you have the scope twisted
remember when I said ? .....
we are ...reticent to try to fix something important that would affect someone's critical app bussiness, cause our fixes can produce other bugs even worse......
Well, it's just that.

What if a user enters saying , ... I'm using restful for a critical app and crashed , I `ve alrready applyed your fix and does not work , And I need a perfect fix for yesterday !
That is the FIRST priority , discover bugs after users can do it, and have at least a minimum fix ready.

If the project is more robust, and bug's free everybody wins, If yo think that a file system solution is better for the resthelper now, make a new proposal, If you see something dangerous, advise opening an issue, you can delete it later.

I give you my proposal if you promise to have 2 eyes looking at stability and not the votes , theorys, or custom implementations ( I'm too old to compete , and long ago I do not care )

you see it now? really ? sure?

Please do not give me a yes but ....
Oct 28, 2013 at 3:03 PM
Edited Oct 28, 2013 at 3:08 PM

Sorry if you don't like our rules, but, you have to abide by them if you want cooperation around here.

If you think there are bugs in the RESTful version, you first have to:

1.) prove it is a bug by either giving us code to reproduce it or, even better, give us a link where we can see it.

2.) make the case that it is important enough to add to a new release, preferably by getting others to VOTE for it in the ISSUES section

3.) Preferably, you will compile a new release with your changes and we can all test it to make sure it doesn't mess other things up.

So you see there isn't any need to be scared that you will mess things up because it will never be in an official release until you get through these steps.

The worst thing you can do here is claim the software is full of bugs and, on top of that, demand we do all the work fixing the supposed "problems" you found. We already went through that with the BigDreamer and he is no longer here ....

I've got a list of 2 legitimate problems with the REST version (and these can easily be worked with in the current version):

1.) Add an error handler to RestHelper.prg with COMReturnERROR included
2.) Change DEFINE CLASS restHelper AS Custom to DEFINE CLASS restHelper AS Session

Feel free to add to this list but you WILL have to do some work. JUST PLEASE DO NOT COMPLAIN SO MUCH. STAY POSITIVE!! Constructive criticism is welcome!