Re: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable
I don't think you mean 1,000 times of 2M elements = 2 billions of elements in an array??? Or you mean looping the query 1,000 times, if so. I just did loop 1,000 times of binary search of text array of 20,000 elements and it took 8ms. Looping 1,000 times for 2M elements took 12ms Anyone try it with object since I am still using v13. Alan Chan 4D iNug Technical <4d_tech@lists.4d.com> writes: > >try it 1000 times and compare it with the object method > >> Am 10.11.2016 um 16:18 schrieb 4d_tech-requ...@lists.4d.com: >> >> Find in Array is sequential search. I just try to use Binary search on >> sorted text array with 2,000,000 elements. It took 0 ms. > > ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable
try it 1000 times and compare it with the object method > Am 10.11.2016 um 16:18 schrieb 4d_tech-requ...@lists.4d.com: > > Find in Array is sequential search. I just try to use Binary search on sorted > text array with 2,000,000 elements. It took 0 ms. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
RE: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable
can you include a check sum with the page information? Generate the text, do some calculation on it, sand both values. on the server side redo the calculation Then if someone tries to add/change the form data the check sum fails if it matches off you go if it falis do some thing nasty (again) :) On Wed, 9 Nov 2016 20:47:54 +, Mike McCall wrote: > Thanks so much Chip for the suggestion, > > That thought also crossed my mind but unfortunately with the silly > number of variables we currently have, over 20,000 in total, my > initial tests suggested that it could seriously affect performance to > go with that approach. > > I'd really prefer not to have to do a complete rewrite of how we > handle form fields since that would be very time consuming. > > Thanks again and definitely let me know if you or anyone else has any > other idea. > > Mike > > -Original Message- > From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Chip > Scheide > Sent: Wednesday, November 9, 2016 12:38 PM > To: 4D iNug Technical <4d_tech@lists.4d.com> > Subject: Re: Automatic Variable Assignment and Web Get Variables - > Bad usage of pointer or pointer to an unknown variable > > I do NO web work so take this idea with that in mind > > Instead of : > On Wed, 9 Nov 2016 19:58:16 +, Mike McCall wrote: >> Else >> $p:=Get pointer(arr_Web_Field_Name{$i}) >> $p->:=arr_Web_Field_Value{$i} >> End case > > if (find in array($arr_Legal_Variable_Names;arr_Web_Field_Name{$i})>0) >$p:=Get pointer(arr_Web_Field_Name{$i}) >$p->:=arr_Web_Field_Value{$i} > else >`do nasty things since someone tried to hack your server end if > > Where arr_Legal_Variable_Names > is an array of valid variable names and any value NOT in this array > is an error Chip ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable
Find in Array is sequential search. I just try to use Binary search on sorted text array with 2,000,000 elements. It took 0 ms. Alan Chan 4D iNug Technical <4d_tech@lists.4d.com> writes: >If I change the search parameter to Variable_2_name, the array takes twice >as long (2) and the c_object search is still 0. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
RE: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable
Thank you so very much Lee, I'm still a little foggy on the whole C_Object concept but regardless of that limitation on my part your example was exactly what I needed to get me started. It is AMAZING! I did some exaggerated stress testing and it seemed to be 100 to as much as 1,000 times as fast as using find in array! That performance was more than quick enough to allow me to use this implementation. The worst case is that it adds a millisecond or so to each interaction. Because of that, in brief, I simply copied my variables from compiler_variables and pasted them into a new method and then did a global replace of all "C_Text("with APPEND TO ARRAY(<>arr_Defined_Text_Variables;". I run the new method at startup and then execute the code below to build the object per your example. Thank you again! C_OBJECT(<>Obj_Defined_Text_Variables) For ($i;1;Size of array(<>arr_Defined_Text_Variables)) $VariableName:=<>arr_Defined_Text_Variables{$i} OB SET(<>Obj_Defined_Text_Variables;$VariableName;"") End for ARRAY TEXT(<>arr_Defined_Text_Variables;0) -Original Message- From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Lee Hinde Sent: Wednesday, November 9, 2016 1:26 PM To: 4D iNug Tech <4d_tech@lists.4d.com> Subject: Re: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable C_OBJECT($temp) For ($index;1;2) $key:="Variable_"+String($index)+"_name" OB SET($temp;$key;"") End for C_BOOLEAN($test) C_LONGINT($start) $start:=Milliseconds $test:=OB Is defined($temp;"Variable_1_name") ALERT(String(Milliseconds-$start)) // I get 0 //versus ARRAY TEXT($temp_array;0) C_LONGINT($fnd) For ($index;1;2) $key:="Variable_"+String($index)+"_name" APPEND TO ARRAY($temp_array;$key) End for $start:=Milliseconds $fnd:=Find in array($temp_array;"Variable_1_name") ALERT(String(Milliseconds-$start)) // I get 1 If I change the search parameter to Variable_2_name, the array takes twice as long (2) and the c_object search is still 0. This may or may not have been Justin’s point. :-) > On Nov 9, 2016, at 1:03 PM, Mike McCallwrote: > > Thanks Lee, > > Unfortunately, I'm not familiar with c_objects and how they might work in my > case. Would it be possible to give me a brief example that I could then adapt > and test. > > Thanks again, > > Mike > > -Original Message- > From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Lee > Hinde > Sent: Wednesday, November 9, 2016 12:59 PM > To: 4D iNug Technical <4d_tech@lists.4d.com> > Subject: Re: Automatic Variable Assignment and Web Get Variables - Bad > usage of pointer or pointer to an unknown variable > > Justin Leavens did a summit presentation that showed c_objects were much > faster than arrays for searching. Might be worth a test. > > On Wed, Nov 9, 2016 at 12:47 PM, Mike McCall > > wrote: > >> Thanks so much Chip for the suggestion, >> >> That thought also crossed my mind but unfortunately with the silly >> number of variables we currently have, over 20,000 in total, my >> initial tests suggested that it could seriously affect performance to >> go with that approach. >> >> I'd really prefer not to have to do a complete rewrite of how we >> handle form fields since that would be very time consuming. >> >> Thanks again and definitely let me know if you or anyone else has any >> other idea. >> >> Mike >> >> -Original Message- >> From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Chip >> Scheide >> Sent: Wednesday, November 9, 2016 12:38 PM >> To: 4D iNug Technical <4d_tech@lists.4d.com> >> Subject: Re: Automatic Variable Assignment and Web Get Variables - >> Bad usage of pointer or pointer to an unknown variable >> >> I do NO web work so take this idea with that in mind >> >> Instead of : >> On Wed, 9 Nov 2016 19:58:16 +, Mike McCall wrote: >>> Else >>> $p:=Get pointer(arr_Web_Field_Name{$i}) >>> $p->:=arr_Web_Field_Value{$i} >>> End case >> >> if (find in array($arr_Legal_Variable_Names;arr_Web_Field_Name{$i})>0) >> $p:=Get pointer(arr_Web_Field_Name{$i}) >> $p->:=arr_Web_Field_Value{$i} >> else >> `do nasty things since someone tried to hack your server end if >> >> Where arr_Legal_Variable_Names >> is an array of valid variable names and any value NOT in this array >> is an error Chip >> >> > ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com ** ** 4D Internet
Re: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable
perhaps you could test Not(Nil( $p))) and Type($p->) following Get pointer. remember, a 4D pointer is a structure, not an address, just some information about what to look for (the name in case of a variable), it can be not Nil but point to something that does not exist. but I also favour a flat object containing all the web form variables, it makes sense (a valid form variable name is a valid property name), it is fast (property names are hashed), it is easy (no need to Find in array and test for #-1). I would even go a step further and wish WEB GET VARIABLES would return an object. > 2016/11/10 4:58、Mike McCallのメール: > Is there any way we could avoid this from happening? 宮古 啓介 セールス・エンジニア 株式会社フォーディー・ジャパン 〒150-0043 東京都渋谷区道玄坂1-10-2 渋谷THビル6F Tel: 03-6427-8441 Fax: 03-6427-8449 keisuke.miy...@4d.com www.4D.com/JP ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable
C_OBJECT($temp) For ($index;1;2) $key:="Variable_"+String($index)+"_name" OB SET($temp;$key;"") End for C_BOOLEAN($test) C_LONGINT($start) $start:=Milliseconds $test:=OB Is defined($temp;"Variable_1_name") ALERT(String(Milliseconds-$start)) // I get 0 //versus ARRAY TEXT($temp_array;0) C_LONGINT($fnd) For ($index;1;2) $key:="Variable_"+String($index)+"_name" APPEND TO ARRAY($temp_array;$key) End for $start:=Milliseconds $fnd:=Find in array($temp_array;"Variable_1_name") ALERT(String(Milliseconds-$start)) // I get 1 If I change the search parameter to Variable_2_name, the array takes twice as long (2) and the c_object search is still 0. This may or may not have been Justin’s point. :-) > On Nov 9, 2016, at 1:03 PM, Mike McCallwrote: > > Thanks Lee, > > Unfortunately, I'm not familiar with c_objects and how they might work in my > case. Would it be possible to give me a brief example that I could then adapt > and test. > > Thanks again, > > Mike > > -Original Message- > From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Lee Hinde > Sent: Wednesday, November 9, 2016 12:59 PM > To: 4D iNug Technical <4d_tech@lists.4d.com> > Subject: Re: Automatic Variable Assignment and Web Get Variables - Bad usage > of pointer or pointer to an unknown variable > > Justin Leavens did a summit presentation that showed c_objects were much > faster than arrays for searching. Might be worth a test. > > On Wed, Nov 9, 2016 at 12:47 PM, Mike McCall > wrote: > >> Thanks so much Chip for the suggestion, >> >> That thought also crossed my mind but unfortunately with the silly >> number of variables we currently have, over 20,000 in total, my >> initial tests suggested that it could seriously affect performance to >> go with that approach. >> >> I'd really prefer not to have to do a complete rewrite of how we >> handle form fields since that would be very time consuming. >> >> Thanks again and definitely let me know if you or anyone else has any >> other idea. >> >> Mike >> >> -Original Message- >> From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Chip >> Scheide >> Sent: Wednesday, November 9, 2016 12:38 PM >> To: 4D iNug Technical <4d_tech@lists.4d.com> >> Subject: Re: Automatic Variable Assignment and Web Get Variables - Bad >> usage of pointer or pointer to an unknown variable >> >> I do NO web work so take this idea with that in mind >> >> Instead of : >> On Wed, 9 Nov 2016 19:58:16 +, Mike McCall wrote: >>> Else >>> $p:=Get pointer(arr_Web_Field_Name{$i}) >>> $p->:=arr_Web_Field_Value{$i} >>> End case >> >> if (find in array($arr_Legal_Variable_Names;arr_Web_Field_Name{$i})>0) >> $p:=Get pointer(arr_Web_Field_Name{$i}) >> $p->:=arr_Web_Field_Value{$i} >> else >> `do nasty things since someone tried to hack your server end if >> >> Where arr_Legal_Variable_Names >> is an array of valid variable names and any value NOT in this array is >> an error Chip >> >> > ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable
> On Nov 9, 2016, at 1:58 PM, Mike McCallwrote: > > In a compiled application it works fine as well unless someone were to > maliciously or somehow inadvertently submit a web page with a field name > which was not defined in our application. In brief if they modified an html > form to submit to our application and added a non-existent field, then a > -20010 error - Bad usage of pointer or pointer to an unknown variable message > would be generated and the connection would hang until we clicked OK on the > message on the server. > > Is there any way we could avoid this from happening? We were hopeful that > using "undefined" would help but that doesn't work in a compiled database. Why not use an error handler to catch the error and abort processing of the form? John DeSoi, Ph.D. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
RE: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable
Thanks Lee, Unfortunately, I'm not familiar with c_objects and how they might work in my case. Would it be possible to give me a brief example that I could then adapt and test. Thanks again, Mike -Original Message- From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Lee Hinde Sent: Wednesday, November 9, 2016 12:59 PM To: 4D iNug Technical <4d_tech@lists.4d.com> Subject: Re: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable Justin Leavens did a summit presentation that showed c_objects were much faster than arrays for searching. Might be worth a test. On Wed, Nov 9, 2016 at 12:47 PM, Mike McCallwrote: > Thanks so much Chip for the suggestion, > > That thought also crossed my mind but unfortunately with the silly > number of variables we currently have, over 20,000 in total, my > initial tests suggested that it could seriously affect performance to > go with that approach. > > I'd really prefer not to have to do a complete rewrite of how we > handle form fields since that would be very time consuming. > > Thanks again and definitely let me know if you or anyone else has any > other idea. > > Mike > > -Original Message- > From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Chip > Scheide > Sent: Wednesday, November 9, 2016 12:38 PM > To: 4D iNug Technical <4d_tech@lists.4d.com> > Subject: Re: Automatic Variable Assignment and Web Get Variables - Bad > usage of pointer or pointer to an unknown variable > > I do NO web work so take this idea with that in mind > > Instead of : > On Wed, 9 Nov 2016 19:58:16 +, Mike McCall wrote: > > Else > > $p:=Get pointer(arr_Web_Field_Name{$i}) > > $p->:=arr_Web_Field_Value{$i} > > End case > > if (find in array($arr_Legal_Variable_Names;arr_Web_Field_Name{$i})>0) >$p:=Get pointer(arr_Web_Field_Name{$i}) >$p->:=arr_Web_Field_Value{$i} > else >`do nasty things since someone tried to hack your server end if > > Where arr_Legal_Variable_Names > is an array of valid variable names and any value NOT in this array is > an error Chip > > ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com ** ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable
Justin Leavens did a summit presentation that showed c_objects were much faster than arrays for searching. Might be worth a test. On Wed, Nov 9, 2016 at 12:47 PM, Mike McCallwrote: > Thanks so much Chip for the suggestion, > > That thought also crossed my mind but unfortunately with the silly number > of variables we currently have, over 20,000 in total, my initial tests > suggested that it could seriously affect performance to go with that > approach. > > I'd really prefer not to have to do a complete rewrite of how we handle > form fields since that would be very time consuming. > > Thanks again and definitely let me know if you or anyone else has any > other idea. > > Mike > > -Original Message- > From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Chip > Scheide > Sent: Wednesday, November 9, 2016 12:38 PM > To: 4D iNug Technical <4d_tech@lists.4d.com> > Subject: Re: Automatic Variable Assignment and Web Get Variables - Bad > usage of pointer or pointer to an unknown variable > > I do NO web work so take this idea with that in mind > > Instead of : > On Wed, 9 Nov 2016 19:58:16 +, Mike McCall wrote: > > Else > > $p:=Get pointer(arr_Web_Field_Name{$i}) > > $p->:=arr_Web_Field_Value{$i} > > End case > > if (find in array($arr_Legal_Variable_Names;arr_Web_Field_Name{$i})>0) >$p:=Get pointer(arr_Web_Field_Name{$i}) >$p->:=arr_Web_Field_Value{$i} > else >`do nasty things since someone tried to hack your server end if > > Where arr_Legal_Variable_Names > is an array of valid variable names and any value NOT in this array is an > error Chip > > ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
RE: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable
Thanks so much Chip for the suggestion, That thought also crossed my mind but unfortunately with the silly number of variables we currently have, over 20,000 in total, my initial tests suggested that it could seriously affect performance to go with that approach. I'd really prefer not to have to do a complete rewrite of how we handle form fields since that would be very time consuming. Thanks again and definitely let me know if you or anyone else has any other idea. Mike -Original Message- From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Chip Scheide Sent: Wednesday, November 9, 2016 12:38 PM To: 4D iNug Technical <4d_tech@lists.4d.com> Subject: Re: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable I do NO web work so take this idea with that in mind Instead of : On Wed, 9 Nov 2016 19:58:16 +, Mike McCall wrote: > Else > $p:=Get pointer(arr_Web_Field_Name{$i}) > $p->:=arr_Web_Field_Value{$i} > End case if (find in array($arr_Legal_Variable_Names;arr_Web_Field_Name{$i})>0) $p:=Get pointer(arr_Web_Field_Name{$i}) $p->:=arr_Web_Field_Value{$i} else `do nasty things since someone tried to hack your server end if Where arr_Legal_Variable_Names is an array of valid variable names and any value NOT in this array is an error Chip ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com ** ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable
On Wed, Nov 9, 2016 at 12:37 PM, Chip Scheide <4d_o...@pghrepository.org> wrote: > I do NO web work so take this idea with that in mind > > Instead of : > On Wed, 9 Nov 2016 19:58:16 +, Mike McCall wrote: > > Else > > $p:=Get pointer(arr_Web_Field_Name{$i}) > > $p->:=arr_Web_Field_Value{$i} > > End case > > if (find in array($arr_Legal_Variable_Names;arr_Web_Field_Name{$i})>0) >$p:=Get pointer(arr_Web_Field_Name{$i}) >$p->:=arr_Web_Field_Value{$i} > else >`do nasty things since someone tried to hack your server > end if > > Where arr_Legal_Variable_Names > is an array of valid variable names and any value NOT in this array is > an error > Chip > > I do a lot of web work and I think this is a good idea. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Automatic Variable Assignment and Web Get Variables - Bad usage of pointer or pointer to an unknown variable
I do NO web work so take this idea with that in mind Instead of : On Wed, 9 Nov 2016 19:58:16 +, Mike McCall wrote: > Else > $p:=Get pointer(arr_Web_Field_Name{$i}) > $p->:=arr_Web_Field_Value{$i} > End case if (find in array($arr_Legal_Variable_Names;arr_Web_Field_Name{$i})>0) $p:=Get pointer(arr_Web_Field_Name{$i}) $p->:=arr_Web_Field_Value{$i} else `do nasty things since someone tried to hack your server end if Where arr_Legal_Variable_Names is an array of valid variable names and any value NOT in this array is an error Chip ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **