Parsing unnamed parameters from urls

2016-10-17 Thread Lee Hinde
 I'm working on an api server and needed a way to grab parameters from the
url by their placement.

i.e., from "/api/people/uuid/"  I want the table name and the uuid.

If I received /api/?table=people=uuid then 4D's Web Get Variables would
work just fine.

So, I came up with this (cribbed from the 4D Docs on *Match regex*(:

*C_TEXT*($text;$match;$key)

*C_BOOLEAN*($found)

$text:="/api/people/E862F2A87B4A453087D794576B7E51B0/"

$match:="/api/(\\w+)/(\\w+)/"


*ARRAY LONGINT*($position_found_array;0)

*ARRAY LONGINT*($length_found_array;0)

$found:=*Match regex*($Match;$text;1;$position_found_array;
$length_found_array)

*If *($found)

$table_name:=*Substring*($text;$position_found_array{1};$length_found_array
{1})

*If *(*Size of array*($position_found_array)>=2)

$key:=*Substring*($text;$position_found_array{2};$length_found_array{2})

*End if *

*End if *
**
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: Parsing unnamed parameters from urls

2016-10-17 Thread David Adams
For a different take, here's the old school version I get to parse URL
items into an array:

// WebRequest_ParseURLItems
// Strip parameters off URL and parse the remainder into items.
// 4D automatically URL decodes the incoming data before it arrives.
// Otherwise, this routine would need to convert special characters
// encoded as hex in the incoming URL.

C_TEXT($1;$request_url)
$request_url:=Text_TrimLeadingSlash ($1)  // Don't want a leading /
If ($request_url="@/")  // Don't want a trailing /
  $request_url:=Substring($request_url;1;Length($request_url)-1)  // Drop
the first character.
End if

  // This routine is only interested in regular URL items before any ?
  // and special arguments.
C_LONGINT($question_mark_position)
$question_mark_position:=Position("?";$request_url)
If ($question_mark_position>0)
$request_url:=Substring($request_url;1;$question_mark_position-1)
End if

ARRAY TEXT(WebRequest_URLItems_at;0)
  // Parse the script URL into array items:
Text_ParseIntoArray ($request_url;->WebRequest_URLItems_at;"/")

  // Save the original URL in the 0 element:
WebRequest_URLItems_at{0}:=$request_url

  // End of routine.

I've then got a function to read an item by position safely. I'd expect
that most of us have something like Text_ParseIntoArray in our toolkits
already.
**
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: Questions about workers

2016-10-17 Thread David Belote
I have many of the same questions you do about Workers.  I only discovered the 
new concept of Workers three days ago and am running experiments to try to 
figure them out myself.  But I can offer up the following.  

As for High Velocity:  I created an iteration loop that called a Worker.  The 
only thing that I had the Worker do was to Create a new record, store the 
iteration number + current date + current time in it and save the record.  I 
set it up for 500,000 iterations.  It took about the same time as just running 
in the same process (I didn’t exhaustively compare numbers).  It doesn’t seem 
to have the normal time lag that would occur to start up a New Process.  
Anyway, it was very fast.

I was also concerned about what would happen when a Worker was given a new 
request while it was still executing a previous request.  So I lmited the 
integration to just 20 records, but introduced a 3 second time delay.  It 
stored up those requests and executed all of them.  It did not drop any of the 
request on the floor.  I believe it executed the Worker requests in the same 
sequence of the Worker calls from my iteration loop, but I am not certain about 
that.  I now am wondering what the limit is for the number of requests to the 
Worker that can be stored up?

I did discover what I think is a Worker bug in doing these simple tests.  Each 
time I ran these little tests, the very last record that was created and then 
saved by the Worked is edit locked.  It can’t be deleted.

I hope this helps at least a little bit.

David Belote
Colorado Springs

On 10/16/16, 10:18 AM, "4D_Tech on behalf of Foucauld Perotin" 
<4d_tech-boun...@lists.4d.com on behalf of fp.lis...@teluric.com> wrote:

Hi,

I have some questions about workers. Sorry if it is obvious for some of 
you. I still don’t feel so comfortable with this new stuff. 

- May the workers be local processes? (naming them with a $, I guess)

- What about the stack size ? I see nothing about that, and I do not 
understand why. I guess the stack will have the mystery "default size", but I’m 
not sure... ;)

- I know that preemptive execution implies no interprocess variables. OK. 
But, if the preemptive aspect is not a priority for me now, can I still use 
inteprocess variables without any problem in my workers?

– Is the use of workers not for a high velocity compute section of an app, 
but for a regular part, with basic records filling and so, reasonable or not? 
with the idea to call the worker-process by the "call form" command, when 
needed). Why would I do that? Because some of my apps have a concept of several 
permanent processes with reuse of those. So, the workers would be better than 
the processes which are most of the time sleeping, then wake up, then go back 
to sleep, and so on...

Thanks for your upcoming replies! :)

-- 
Foucauld Pérotin
 
 Try again.
 Fail again. Fail better.
 
 Samuel Beckett 
**
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
**

Execution Control Buttons in V15R5 Debugger

2016-10-17 Thread Douglas von Roeder
4D:

"because we can" is *not* a good reason to change the sequence of buttons
in the debugger.

*Please* — put the buttons back the way they were OR add a compatibility
setting OR allow us to configure the button bar.

Thank you.
--
Douglas von Roeder
949-336-2902
**
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
**

Editing object arrays in dynamically built columns

2016-10-17 Thread truegold
Hey Wendell,

Glad it helped. I know how frustrating it was!

John...

> HI John.
> 
> I got stuck on this issue for a half day before seeing your response below. 
> Thanks for pointing it out.
> 
> Wendell Turner
> 
>> On 25 Sep 2016, at 22:43, truegold  wrote:
>> 
>> Hey All,
>> 
>> Never mind! I found it.
>> 
>> Need to make sure that the listbox property Entry->Focusable is clicked. 
>> Change the “Focusable” property in design and now the column is editable.
>> 
>> Ugggh! Spent 1/2 day diagnosing that.
>> 
>> John...
>> 
>>> In fact I have added another column that is just an array of text values 
>>> and I cannot change it into an edit mode either? So is there something 
>>> about having an object array in a listbox…?

**
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: HTML Tag Mismatch Finder!

2016-10-17 Thread John DeSoi
Not a WYSIWYG editor, but BBEdit has a nice document syntax checker.

John DeSoi, Ph.D.


> On Oct 16, 2016, at 7:49 PM, Sujit Shah  wrote:
> 
> Has anyone got suggestions on WYSIWYG editors other than DW and MS Visual
> Web? Something more basic..

**
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: Spacebar doesn't advance cursor

2016-10-17 Thread Keith Culotta
Only in the case of a right justified text field, but I don't know of a 
solution.

Keith - CDI

> On Oct 17, 2016, at 1:59 PM, David Rose  wrote:
> 
> In a 4D v15 client/server db on Windows 7, more than one user has reported 
> that when typing in any alpha or text field they press the spacebar one or 
> more times, the cursor does not advance. Only when they type any other 
> character (following the spacebars) does the cursor jump ahead.
> 
> Anyone else experiencing this and have a fix?
> David 
> 
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
> 
> **
> 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
**

Spacebar doesn't advance cursor

2016-10-17 Thread David Rose
In a 4D v15 client/server db on Windows 7, more than one user has reported 
that when typing in any alpha or text field they press the spacebar one or 
more times, the cursor does not advance. Only when they type any other 
character (following the spacebars) does the cursor jump ahead.


Anyone else experiencing this and have a fix?
David 



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

**
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: HTTP Request not working on macOS Sierra (4D 13.5)

2016-10-17 Thread Spencer Hinsdale
Hi Peter,

I think there is a bug in 13.5, fixed in 13.6, that HTTP Authenticate only 
sends 38 characters of password...



> On Oct 17, 2016, at 11:27 AM, Peter-Christian Miest  wrote:
> 
> Can anybody confirm that the command HTTP Request works correctly on macOS
> Sierra 10.12 with 4D 13.5?
> It simply get an empty response. Same code works on macOS El Capitan
> 10.11.4.
> 
> Thank you very much for any hint.
> Peter

**
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
**