Re: Counting # of specific characters in string/text

2017-05-05 Thread Arnaud de Montard via 4D_Tech

> Le 5 mai 2017 à 22:48, Jeremy Roussak via 4D_Tech <4d_tech@lists.4d.com> a 
> écrit :
> 
> Position allows you to specify where in the text the search is to start. You 
> don’t need to use Replace string: just start searching from the last found 
> position+1.

For those interested I posted a version using Replace string optimisation when 
possible here:

(thank you, Vincent)

-- 
Arnaud de Montard 



**
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: Counting # of specific characters in string/text

2017-05-05 Thread Jeremy Roussak via 4D_Tech
Position allows you to specify where in the text the search is to start. You 
don’t need to use Replace string: just start searching from the last found 
position+1.

Jeremy


Jeremy Roussak
j...@mac.com



> On 4 May 2017, at 17:58, John Baughman via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Quick and dirty ideas…
> 
> $text:="Now is the time for all good men to come to the aid of their country"
> ARRAY TEXT($aWords;0)
> GET TEXT KEYWORDS($text;$aWords)
> $wordCount:=Count in array($aWords;"The")
> 
> COPY ARRAY($text;$textTest)
> $characterCount:=0
> While (Position("e";$textTest)>0)
>$characterCount:=$count+1
>$characterCount:=Replace string($textTest;"e";"";1)
> End while 
> 
> 
> John
> **
> 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: 4D World Tour - Denver

2017-05-05 Thread Tim Nevels via 4D_Tech
On May 5, 2017, at 2:00 PM, David Adams wrote:

> You seem excited about the event ;-) Keep in mind that not everyone can
> attend because they either live to far away, have a scheduling conflict, or
> are reading these posts in the future. Unless they invent a time travel
> machine, it won't be possible to attend...Ultimately, if information isn't
> in the docs (language ref, tech notes, tips, recorded sessions, etc.), it's
> easily lost or ignored.

I was trying to be silly, not serious. I guess I should have put a :) next to 
my post. 

And I am excited about the 2018 4D Summit. JPR says it is going to be big. He 
provided no details except for one little hint. So as not to offend and keep 
anything secret here is his comment. If you are using periods in variable 
names, you might want to stop doing that. You take from that comment whatever 
you want. I think I know what it coming and it’s something we had a discussion 
about in the last month here on the iNUG. Something that will definitely be 
interested in. But that’s just my opinion and speculation. It will be April 
2018 before we all know for sure what is coming.

And they also mentioned that the 4D Summit in Paris next year will also be done 
in English and French with translators available in all sessions. So if you 
can’t make it to America… there’s always France. 
 
> As far as the sequence of events goes, it's basic information that should
> be in the documentation. There's nothing advanced about it and it's nothing
> that should be secret. It's a bit of the mechanics that it's important to
> understand so that you don't tie yourself in knots. Here's how it works
> (I've posted it here before):
> 
> * When you call Open window (etc.) a 'queue' is created. This is *before*
> any form is shown. So, the queue is a property of the window, not the form.
> 
> * You can post code blocks to the queue via CALL FORM *as soon as the
> window reference is returned.*
> 
> * ...but then there's no form context to execute the command(s) you've
> supplied.
> 
> * Once you open the form, On Load runs. *Your queued commands are still in
> the queue.*
> 
> * After On Load, the queued commands are executed in order. The code you
> pass in through CALL FORM is held in a First In First Out structure. That's
> what a queue is. 4D's CALL WORKER and CALL FORM are 100% reliable about
> executing code in the sequence it was received. That's a promise and it
> makes things a lot simpler than they might otherwise be. Since this is
> FIFO, not truly asynchronous or a stack (LIFO), the code is executed in the
> order that you sent it. 

You are correct. This is exactly how JPR described it. 

Tim


Tim Nevels
Innovative Solutions
785-749-3444
timnev...@mac.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: 4D World Tour - Denver

2017-05-05 Thread Tim Nevels via 4D_Tech
On May 5, 2017, at 2:00 PM,Cannon Smith wrote:

> Well, I thought I was talking about workers in general, but that was under 
> the assumption that all processes have some kind of execution cycle. Are you 
> saying that a non-UI process (ex. pre-emptive thread) won’t have an execution 
> cycle?

Sure workers have an execution cycle. They constantly look in their mailbox for 
any messages. As soon as there is one, it executes the method in the message. 
When the method finishes executing it checks the mailbox for any more messages 
if there are some, it get the next one off the queue and executes that method. 
That continues until the message queue is empty. As far as I know there are no 
delays in the execution cycle. 

The only delay is if there is already a method executing. If there is, then the 
worker waits until the method has finished. Then it gets the next message off 
the queue and executes that. Methods are executed one at a time and in the 
order they were received in the worker message queue.

> In either case, the only place I can think of where this might matter is in a 
> worker process that has UI in it, so yes, CALL FORM is where the rubber meets 
> the road here. I was trying to be more exact, but maybe assumed too much?

Yes that is what JPR was trying to get across. The only delayed action is to 
redraw the window of a form.

Tim


Tim Nevels
Innovative Solutions
785-749-3444
timnev...@mac.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: Counting # of specific characters in string/text

2017-05-05 Thread Keith Culotta via 4D_Tech
I haven't tested this for speed or unexpected conditions, but...

$a:="now is the timetime for all good men to come to the aid of their country"
$l1:=Length($a)

$b:="time"
$lb:=Length($b)

$a:=Replace string($a;$b;"";*)
$l2:=Length($a)

$l3:=$l1-$l2/$lb

ALERT(String($l3))


Keith - CDI

> On May 4, 2017, at 7:22 AM, Jörg Knebel via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Hi all
> 
> I’m wondering if someone has a clever routine to count the number of 
> appearances of a specific character/word in a string/text and is willing to 
> share it.
> 
> Thanks
> 
> Cheers
> Jörg
> 
> 
> **
> 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
**

Dates and Conditional popup bugs in Query editor

2017-05-05 Thread truegold via 4D_Tech
Hi all,

4D v15.2 & 4D 15.4 (Mac)

It looks like 4D’s Query EDITOR (the one most of my users hate) has some 
issues. I’d like to confirm if others are seeing them.

Here’s what broke for us:

1. The app has a convention of default dates being set as “03/03/0300”. It goes 
back to late 80”s and needing a non-null value that was obvious to them. 
Anyway… This appears to be changed to “03/03/300” which I guess still works 
fine for them.

This has always worked for them up through 4D v12… I upgrade them to 4D v15 and 
this has been an issue. I believe it will allow us to us to type the date value 
in and even query on it. But when we save a query and then reload it the date 
is changed to “00/00/00”. So somewhere in the saving or in the loading 4D 
transform it into a bad date format.

Of course we could try and remember whenever we use a query to change this 
default value but that’s what saving a report is for. Create it, get it 
working, save it and then forget about how it works and just use it.

2. It looks like 4D will correctly save a query with the popup set to “AND or 
“OR” values. But if you then reload and change them and re-save them it looks 
like 4D either ignores them or doesn’t update them. Is anyone else seeing this 
issue?

If the new query editor worked perfectly it would still be disliked by most 
users. But with these bugs it’s almost intolerable.

But before I go through reporting them as bugs I want to make sure I’m not 
issuing anything.

BTW, it looks like Miyako’s version works correctly. Might just go with his 
Query component.

Thanks for your help,
John...
**
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
**