Re: Question about storing data outside of datafile

2017-02-16 Thread Peter Bozek via 4D_Tech
On Thu, Feb 16, 2017 at 4:55 PM, G-Mail via 4D_Tech <4d_tech@lists.4d.com>
wrote:

> We programmed in the management of the files outside of the database. We
> started doing this with 4D version 3.5 so we had to. We continued doing
> this since it worked very well. There was no need for us to change it, so
> we never really investigated having 4D manage this. Too many other things
> to work on.
>
>
Would you like to exchange your know-how? I did similar system, and there
are some tricky parts in case of C/S.


-- 

Peter Bozek
**
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: Question about storing data outside of datafile

2017-02-17 Thread Peter Bozek via 4D_Tech
On Thu, Feb 16, 2017 at 11:55 PM, G-Mail via 4D_Tech <4d_tech@lists.4d.com>
wrote:

> There is lots of decisions we made for our purposes, and there are
> different ways to do things for sure. We had to meet various security
> regulations therefore we changed some of the ways we did things over the 20
> or so years that we had built it. Of course new technologies came along too
> that permitted us to change that up.
>
> Is there something specific that you are wanting to discuss?
>

What I do is not pass the file to client when record is loaded, it is moved
to client only if needed. For example, if the file is an image, only
thumbnail is part of record and moved to client, the file is transferred
only if user wants to see image in original quality. There is a latency (I
saw a 100MB inserted) that requires a user feedback and error handling.
Then there are more complex cases, when user wants to edit file in external
app etc.

-- 

Peter Bozek
**
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: C-objects and memory use

2017-07-25 Thread Peter Bozek via 4D_Tech
On Tue, Jul 25, 2017 at 9:49 PM, Keith Culotta via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> It was mentioned at the introduction of CALL WORKER that not needing
> global variables was somehow in the mix.  Is C_Object the thing that
> enables this?  In other words, have a WORKER with a $myGlobals object.  As
> long as the WORKER is alive, that object is available to all methods.
>
> Keith - CDI
>
>
I asked 4D and was told that if object is passed to worker, worker gets
copy. Did not test that, but it makes sense.

-- 

Peter Bozek
**
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: JSON Tools Was: Re: C-objects and memory use

2017-07-26 Thread Peter Bozek via 4D_Tech
On Wed, Jul 26, 2017 at 12:09 PM, Benedict, Tom via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> David Adams dpad...@gmail.com writes:
>
> >Well, 4D's tools for manipulating JSON are sub-standard, if your goal is
> to parse/produce JSON freely. In this respect, the XML tools (external
> libraries built into 4D) are far more standard and comprehensive.
>
> Along these lines, is there a stable and maintained library for querying
> JSON similar to XPath? I looked for one a few years ago when I was
> developing my Simple Rules Engine but found that there wasn't anything
> mature yet, so I stuck with XML/XPath.
>
> This page http://orangevolt.blogspot.com/2012/12/8-ways-to-query-
> json-structures.html#!/2012/12/8-ways-to-query-json-structures.html
> mentions a number of tools. Anyone have any experience integrating them
> with 4D?
>
>
Note that 4D objects may not be internally not implemented as  JSON data,
but (probably) like hash table - something like std::map. These as standard
does not support even simple constucts like chained keys
(anObject.subObject.subsubObject.property.)


--

Peter Bozek
**
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: C-objects and memory use

2017-07-25 Thread Peter Bozek via 4D_Tech
On Tue, Jul 25, 2017 at 1:41 AM, Kirk Brooks via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> I want to make sure my understanding about how c-objects are handled in 4D
> memory. Mainly because it seems this understanding is cobbled together from
> a number of different sources few of which I can easily find again. So...
>
>

Kirk,

Here is how I understand objects. Not sure if it is correct, and while I
use object a bit, I cannot claim I tested all my assertions, so they can be
wrong. Anyway, it may be interesting to compare our views:


> 1) c-objects are created within the 3 4D scopes: IP, process or local.
>

As I understand it, there is one 'heap' of objects, what means all objects
are IP (where by object I mean here data structures containing data).
Object variables are local, process or IP, but they are just references to
this global object heap.

You mention that variables are something like pointers, I prefer to
consider them a references (like 'fifth object from the right') for the
following reason:
Objects are ref-counted. This means that each (global) object keeps count
how many variables (local, process and IP) is referencing this object. When
that count get to 0, object is deleted.


>
> 2) but they share some characteristics with hLists and menuRefs in that
> once created they can be referred to by different instances. For example,
> if I create an process object called "prosObj" as:
>
> { obj1: {name: Kirk, ID: 1234},
>
>obj2: {name: Joe, ID: 5678}}
>
> In this case, object heap will contain three objects, each with refcount
of 1:
{name: Kirk, ID: 1234}
{name: Joe, ID: 5678}
{obj1: reference to first object, obj2: reference to second object}


>
> I can create a local obj as:
>
> $obj:=OB GET(prosObj;"obj1")
>

you create a local (object) variable referencing first object, and refcount
of this object is increased to 2.

3) My first point of clarification is that $obj is simply referencing
> prosObj so it's not significantly increasing the amount of memory used.
>

yes, object variables are just references to objects (data structures
containing object data.)

>
> 4) Conversely if I created $obj using the copy command it would. So
>
> $obj:=OB COPY(OB GET(prosObj;obj1))
>
> would create a full copy of obj1 and take up more memory.
>

More interesting case is what happens if you copy the main object
containing references to other objects. I believe references are not
coppied, it means you will get another object with object references to
original objects (And refcounts of original objects will be increased.


>
> 5) This referencing feature also applies to objects in arrays. It's easy to
> discover this inadvertently:
>
> ARRAY OBJECT($aObjs;0)
>
> OB SET($obj;key;"new value")
>
> APPEND TO ARRAY($aObjs;$obj)
> APPEND TO ARRAY($aObjs;$obj)
> APPEND TO ARRAY($aObjs;$obj)
>
> $aObjs has 3 element each containing: {key;"new Value"}.
>

As I understand it, you have only one object  {key;"new value"} with for
variables referencing it: $obj, $aObjs{1}; $aObjs{2} and $aObjs{3}.


> If I modify $obj:
>
> OB SET($obj;key;"defined value")
>
> ​each element of $aObjs is now ​
>  {key;"new Value"}
>

you mean {key;"defined value"}?


> ​Again, I'm assuming $obj only exists in memory one time with each element
> of $aObjs referring to it.
>

Yes, this is my understanding as well.


> 6) I can clear $obj without erasing the referenced values by calling:
>
> $obj:=JSON PARSE("{}")
>

yes, this creates a new (empty) object storage and stores reference to it
into $obj, and decreases refcount to original object by one. In this
example, original object data are still references by three array elements.
When method ends and local array $aObjs is cleared, the data will be
cleared.


> 7) ​And unlike menus and hLists ​the memory occupied by $obj is released
> when the process end.
>

No, objects are released - in the sense the memory occupied by it is
cleared - when their refcount is 0. Ending method clears references from
local object variables, ending process clears references from process
variables. But if you have


C_OBJECT($obj)
OB SET($obj;key;"value")

<>ipObj:=$obj

object {key;"value"} will not be cleared when method or process ends.

​
>
> 8) Passing objects as parameters is essentially equivalent to passing
> pointers to c-obj vars EXCEPT when working with a method called with
> Execute on server - object references don't propagate when moving between
> the twin and local process. So let's say myMethod
> does this:
>

Yes, when you pass object to server process or method executed on server,
object is serialized, send to other side and there recreated.

The same seems to hold if you pass object to worker, but this I have not
tested (but if it would not be true, we would have values shared with
workers.)



>  ​
> SET($1->;"name";"Kirk")
>
> ​then myMethod will work the same way on the client or EOS. However I
> suspect the time to dereference a pointer adds some time on the client side
> that wouldn't 

POST with Server Name Indication

2017-05-10 Thread Peter Bozek via 4D_Tech
I am sending data to web server using POST protocol. Recently, web server
changed its URL and attempts to send data resulted in error -403 with
reason "The client software did not provide a hostname using Server Name
Indication (SNI), which is required to access this server"

It seems that the request may need some additional header fields. Did
anybody run into this problem?

-- 

Peter Bozek
**
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: POST with Server Name Indication

2017-05-10 Thread Peter Bozek via 4D_Tech
On Wed, May 10, 2017 at 6:08 PM, Timothy Penner via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> > "The client software did not provide a hostname using Server Name
> Indication (SNI), which is required to access this server"
> > Did anybody run into this problem?
>
> Yes, here is a feature request for "Support for TLS / SNI extension":
> http://forums.4d.fr/Post/FR/18160614/1/18160615#18160615


OK, from discussion it is not sure if 15R4 would work - I am testing with
15.4, so I gather that no. cURL called with LEP seems like a workaround, at
least on Mac.


-- 

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

Bug when printing to preview on Mac

2017-05-17 Thread Peter Bozek via 4D_Tech
I run into strange behavior, probably bug, when printing from 4D v15.4.
Maybe somebody has a feedback or workaround.

I made a single printing code

PRINT SETTINGS
$l:=Print form("printTest")
PAGE BREAK

called from button script (printTest form fontain just one static test.)
Clicking on button prints a page with text. Everything is fine until I
select "Open PDF in Preview" in print dialog - from that moment, any print
to any destination goes to preview.

GET PRINT OPTION(Destination option;$l) returns 1 and
SET PRINT OPTION(Destination option;1) does not help.

Bug does not seem to be in v16.


--


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

Storing an using Print sttings

2017-06-22 Thread Peter Bozek via 4D_Tech
I have a database that use AP Print settings to BLOB /  AP BLOB to print
settings. After complains from users appeared recently, I did some testing,
and found out that the commands do not work reliably. For example, using
the same printer, on Mac I get about 20kB blob from AP Print settings to
BLOB and when passed back, stored settings are correctly applied. On
Windows, AP Print settings to BLOB returns a blob of only 194 bytes that
seems empty, and when using it, nothing happens (default settings are used.)

Both calls on all platforms return 1 - no error. Do somebody uses these
commands successfully and are thee known problems (with a workaround?)
Could it be that commands stopped to work on Windows 10?

Tested on Mac OS 10.12, Windows 10 and 4D 15.4 with API Pack 15.4.

--

Peter Bozek
**
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: Storing an using Print sttings

2017-06-23 Thread Peter Bozek via 4D_Tech
On Fri, Jun 23, 2017 at 7:12 AM, Keisuke Miyako via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> There used to be a compatibility issue onWin10 and 15.2 (ACI0095543)
> but that should be fixed now.
>

I believe I upgraded to lat 4D Pack(15.4 build 15.208269) before testing,
but will retest again.

-- 

Peter Bozek
**
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: Help with Regex

2017-05-29 Thread Peter Bozek via 4D_Tech
On Mon, May 29, 2017 at 8:29 PM, Tim Nevels via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> $regexPattern_t:="what do I put here"
>

with a timi little bit of playing,

$regexPattern_t:="SP_(\\D{3}|)(?>_|)(\\d{2})(\\d{2})(\\d{2})"

catches prefix (INS) without "_".

-- 

Peter Bozek
**
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: Help with Regex

2017-05-29 Thread Peter Bozek via 4D_Tech
On Mon, May 29, 2017 at 8:29 PM, Tim Nevels via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> $regexPattern_t:="what do I put here"
>

Tim,

Try

SP_(\D{3}_|)(\d{2})(\d{2})(\d{2})
with properly escaped backslashes, it means
regexPattern_t:="SP_(\\D{3}_|)(\\d{2})(\\d{2})(\\d{2})"

This should catch for groups, first is empty or INS_ (with trailing _, was
lazy to remove it) and three groups of two digits each.
Test following code:
ARRAY TEXT($at;6)

$at{1}:="SP_050317"
$at{2}:="SP_050417"
$at{3}:="SP_050517"
$at{4}:="SP_INS_050317"
$at{5}:="SP_INS_050417"
$at{6}:="SP_INS_050517"

ARRAY LONGINT($start;0)
ARRAY LONGINT($len;0)

For ($i;1;6)
  $b:=Match
regex("SP_(\\D{3}_|)(\\d{2})(\\d{2})(\\d{2})";$at{$i};1;$start;$len)
  If ($b)
$prefix:=Substring($at{$i};$start{1};$len{1}
$day:=Substring($at{$i};$start{2};$len{2})
$month:=Substring($at{$i};$start{3};$len{3})
$year:=Substring($at{$i};$start{4};$len{4})
  End if
End for

-- 

Peter Bozek
**
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: The language is letting you down (Was: Re: Custom comments: Lots of tips, more wanted!)

2017-06-05 Thread Peter Bozek via 4D_Tech
On Mon, Jun 5, 2017 at 11:15 AM, David Adams via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> In order of complexity:
>

I would add my favorite two:
* return statement - yes, Pascal does not have a return statement, but it
is so useful and need so little effort to implement that having 'clean'
Pascal cannot be an excuse to not implementing it.
* passing parameters by reference. Now we have object parameters that work
like this, but it would be much nicer if we can declare which parameters
are passed by value and which by reference - for objects, too.

-- 

Peter Bozek
**
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 and Sage

2017-06-13 Thread Peter Bozek via 4D_Tech
On Tue, Jun 13, 2017 at 1:17 PM, Pat Bensky via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Basically we need to:
> - Extract data into our 4D database
> - Push data from 4D to Sage
>

I did export of accounting info from 4D based CRM system to Sage (German).
It is quite simple, export - import of plain text files.


-- 

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

Time stamp with milliseconds

2017-09-20 Thread Peter Bozek via 4D_Tech
I would like to implement my own event logging with millisecond resolution
- like 2017-05-12 20:52:50,147 to use for sorting of events. There is
Milliseconds command, but thus provide information I need.

If it is not possible, did somebody tested single alternative like
incrementing global variable that is reset each second? Something like

$currentTime:=Current time
If($currentTime > <>fsLastTime)
  <>fsCounter:=0
  <>fsLastTime:= $currentTime
End if
<> fsCounter:=<> fsCounter +1
$0:=<> fsCounter

--

Peter Bozek
**
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: Time stamp with milliseconds

2017-09-20 Thread Peter Bozek via 4D_Tech
On Wed, Sep 20, 2017 at 10:03 AM, Christian Sakowski <
christian.sakow...@heubach-media.de> wrote:

> Why not using the command „Timestamp“?
> It returns exactly what you need:
>
>
Because I did not know this command exists. Thanks for pointing out. I look
it is available from 16R2, project is not there yet, but will create
wrapper that will be replaced by actual command when the project is
upgraded.

--

Peter Bozek
**
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: VOIP caller ID interface

2017-10-08 Thread Peter Bozek via 4D_Tech
On Sun, Oct 8, 2017 at 2:11 AM, Joe Dombroski via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Has anyone extracted caller ID from a VOIP phone and used it to open a
> client record in 4D?
>
>
>
I am now solving same problem so would be interested in answer as well.

I am able to communicate with certain routers (Fritzbox, which are quite
nice German routers) that offer call monitoring, including VoIP calls,
through telnet - like interface where router writes all call events. But
need a solution that would work with any router.

It seems that SIP analyzers work by snipping the TCP communication, and I
do not want to go that way. I was looking at TR-069 protocol that can be
used to monitor router performance, but it seem that cannot be used to get
VoIP events in real time. There are some extensions of the protocol that
seems promising, but that would require a lot of investigation and testing.
As I did not found any description how to do it, it is open question if it
is even possible.

--

Peter Bozek
**
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: VOIP caller ID interface

2017-10-08 Thread Peter Bozek via 4D_Tech
On Sun, Oct 8, 2017 at 8:10 PM, Nigel Greenlee via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
> I have been writing an interface to the Asterisk VOIP software(Using PHP).
> At this point  I am waiting for the client to decide how they want the
> interface to work-if you are using Asterisk I can offer some assistance (I
> found there documentation somewhat obtuse and the sample 4D Code that was
> published as a tech-note a few years back needed some finesssing to get the
> full information on queues etc.
>

I would like to see details, though am not sure I will be able to use the
code. But at least I would know which direction make sense.

>
> My plan is to link telephone numbers to customers where the number may not
> be a number published on the record as a number to contact the customer on
> so when an incoming call comes we can look up the client and if not
> identified by the software allow the number to be ‘tagged’ to a customer-my
> thinking being that often customers call from personal mobiles or call from
> numbers external to the business-so Fred from Hokey Company 2000 may call
> from his 07 number..but we dont want sales people calling Hokey Company
> 2000 on the 07xxx number or to even show that number on the customer record.
>
>
I use system where any phone number entered into customer record (there are
several phone number fields) get into separate table through which incoming
call number lookup is executed. While only one is shown as 'customer phone
number', his record can be bound to any number of numbers.

--

Peter Bozek
**
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: QUERY BY ATTRIBUTE is slow af

2017-09-13 Thread Peter Bozek via 4D_Tech
On Tue, Sep 12, 2017 at 11:07 PM, Jeffrey Kain via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Yeah, so many caveats to object fields. Bite the bullet, use a related
> table...
>
>
Well, I  wrote that i am playing with it, Testing how it can be used, what
commands are available and where are limitation, and keeping eye on new
development. I am looking at object fields not as a JSON structures, but as
a name value pairs.

I want to test the idea of keeping denormalized fields in object (but not
necessarily only denormalized fields), and building some simple way to
maintain, show and search them. Now sure how it will work, maybe not well,
but without testing I will not know. I see few advantages: while I keep
some rules how to name fields in structure, I can (or plan to) give object
fields more user friendly names. I will have more flexibility to add /
remove / rename fields. I will have to adjust search and sort dialogues,
and I plan to do a simple ones using just one object field.

--

Peter Bozek
**
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: QUERY BY ATTRIBUTE is slow af

2017-09-12 Thread Peter Bozek via 4D_Tech
On Tue, Sep 12, 2017 at 7:10 PM, Herr Alexander Heintz via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Absolutely.
> I exclusively use object fields for additional data and storage of
> connected information to a specific data row, such as record and field
> history, specific item settings etc.
> All of these will NOT be queried on.
> There are cases where I use object fields for variable data structures,
> but limit this to basic 1-level objects that can be queried rapidly.
> Also bear in mind, that accessing data embedded in objects is far more
> complicated (for example for mass editing) than using a related table. It
> might sound like an intriguing concept to store, say keywords, in an object
> array, but even if these were quick to query, modifying a bunch a of
> keywords is far more complicated when they are stored in objects than just
> using an APPLY TO SELECTION for a „normal“ related table.
> Just my 2 ct, your mileage may vary
>


I am playing with idea to use object for values that are used only for
display / searching. I have structures with tables with tens of such fields
- mostly comments, flags or user defined fields. This would simplify
structure a bit. It would be nice if 4D provided some simple way how to
export / print values from objects (like supporting dot notation in source
field property.)

--

Peter Bozek
**
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: Is it possible to put a SVG file directly on a form?

2017-09-26 Thread Peter Bozek via 4D_Tech
On Mon, Sep 25, 2017 at 12:51 AM, Kirk Brooks via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> or does it have to be converted to a picture?
>
>
>
>
No, you can use SVG file as any other picture file (say PNG.) No need to
manipulate it in 4D, though you can.

--

Peter Bozek
**
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: SVG add object question

2017-10-22 Thread Peter Bozek via 4D_Tech
On Sat, Oct 21, 2017 at 8:48 PM, Kirk Brooks via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
> For example:
>
> $svgImg:=SVG_Open_file ($path+$aDocs{$n})
>
> $svg:=SVG_Copy ($svgImg)
> $pic1:=SVG_Export_to_picture ($svg;0)
> SVG_CLEAR ($svg)
>
> This works as expected.
>
> $svg:=SVG_New
> $newObj:=SVG_Add_object ($svg;$svgImg)
> $pic2:=SVG_Export_to_picture ($svg;0)
>
>
> This doesn't work. $pic2 is blank even though $svg has received the new
> object. I can see that by looking at $svg in the viewer.
>
> What am I missing here?
>

Kirk, I do not have answer as I do not use SVG component to manipulate SVG,
I handle them with XML commands. Note that SVG objects are just XML trees
and can be manipulated with XML  commands. For example, you can use command
DOM EXPORT TO FILE
to export SVG as XML file and explore it in text or XML editor.

In your case, I would guess that $svg is not properly formed as SVG image.

--

Peter Bozek
**
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 v6.8

2017-11-13 Thread Peter Bozek via 4D_Tech
On Mon, Nov 13, 2017 at 3:36 PM, Jody Bevan via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
> I need to convert a v 6.8 database up to v16. The problem I am
> encountering is that there are components and possibly some plugins in the
> structure. It has been so long ago that I dealt with that version. To
> remove plugins I gather I need to use 4D Insider. Is it the same for
> Components? The next question is in regard to anyone having 4D Insider for
> that old of a version. I should have all my old developer serial numbers so
> I am good to go there.
>
>
There were no components at that time and the only plugin that resided in
structure was 4D Chart, if I remember correctly. You will loose it in
conversion as it was inserted as a bunch of resources, and resources will
be lost in the conversion.


--

Peter Bozek
**
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: [Warning] Settings properties values on object field by object notation

2017-11-01 Thread Peter Bozek via 4D_Tech
On Wed, Nov 1, 2017 at 2:17 AM, Keisuke Miyako via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
> to explicitly indicate that the object has been modified, just use the line
>
> [myTable]myObjectField:=[myTable]myObjectField
>

YEs, I use wrapper around SAVE RECORD, so can put there

Field($passedTable;1)->:= Field($passedTable;1)-->

Clumsy, but will work.


> and you have total control of when to save the field,
> which results in better performance, immediately as well as in the long
> term.
>
> to me this sounds like a better deal than a blanket "save always" system
> (the real sloppy design choice, in my opinion)
>
>
I undertand this dilemma, it is well understood from other email in this
thread:

a direct assignment
via dot notation
via set object
via set (sub)object
via martians landing in Washington D.C

it should NOT matter how the modification occurred - a modification
occurred - save the change(s) if requested .



"Set via subobject" means something like
$subObject:=OB GET([Table]ObjectField;"subobject";is object)
subObject.property:="value"

or, in one line
OB SET(OB GET([Table]ObjectField;"subobject";is object);"property";"value")

Now, it is quite difficult to argue that this should set modifier flag to
true, even if it modifies object field (lazy to test, but I gather it would
not, so the point is moot.)

Problem is different: if developer modifies record and calls SAVE RECORD,
he awaits that the record is saved. If it means that records is saved when
it does not need to be, so be it. If the records is not saved when it needs
to be, it is a bug, not sloppy design choice (although understandable
sloppy design choice.)

--

Peter Bozek
**
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: Primary Key in 4Dv15

2017-10-24 Thread Peter Bozek via 4D_Tech
On Tue, Oct 24, 2017 at 11:49 AM, Ronnie Teo via 4D_Tech <
4d_tech@lists.4d.com> wrote:
>
>
> Need to seek some advice in converting a client’s database from v11 to v15.
>
> For one of the tables, 4D reported that the primary key contains NULL
> values upon conversion or that the primary key contains duplicate values.


Ronnie,

In such case it is simpler to write method that checks content of  the
primary Key in v11. To fill empty or non-existent values are simple, jsut
assign new UUID.

Duplicates may be bigger problem, there was a bug in 4D where, for
self-asigned UUID, when 4D duplicated record, it duplicated UUID field and
did not generated new UUID. You will have to find and fix it. In my case, I
was able to find all duplicated records and check uniqueness of primary key.


> The primary key was defined to be a UUID-type value.
>
> So if some of the records are blank for the primary key, how do we proceed
> from there?
> Also, if 4Dv15 is assigning the primary key when the database is first
> launched, how could it have generated duplicate values?
>

It should not, but 4D generates UUID values only for fields that were
created by migration assistant. Fields that already existed in previous
version are not changed.

>
>
> Is there an option to get 4D to re-generate the primary key field again
> for that table?
>
> Failing that, is there an option to instruct 4D to ignore and not track
> those tables?
>

Yes, if you open uncompiled database as designer, you can proceed and work
with the DB. This way, you can write method that checks / replaces PK in 4D
v15.


--

Peter Bozek
**
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: Bug reports?

2018-06-12 Thread Peter Bozek via 4D_Tech
On Mon, Jun 11, 2018 at 9:00 PM, Alan Chan via 4D_Tech <4d_tech@lists.4d.com
> wrote:

> Try
>
> http://forums.4d.com/Bugs/EN/
>
>
this just redirect me to http://forums.4d.com/MyHome/EN, so I gather it
does this to non-partners too.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Difference between OB Copy and :=

2018-06-13 Thread Peter Bozek via 4D_Tech
On Wed, Jun 13, 2018 at 3:26 AM, johnbdhPop via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Thanks Cannon,
>
> So maybe I want to use OB Copy when I load the record in an input
> form. That way I can make changes to the object without changing the object
> in the field. That way if the user cancels I don’t have to worry about the
> field.
>
> When the user saves the record, should I use OB Copy to save the
> object back to the field, or does it really matter?
>
> John
>
>
No and no, imho.

As I understand it, object field contain "serialized" object - it means
object is stored in some internal data structures, you can imagine it is
stored as JSON text (which is not the case, but is OK to visualize how it
works.) When you load the record, object is created (in memory)  from that
representation and reference to it assigned to field. When you save the
record, the object in memory is serialized (converted to JSON) and saved to
disk.

It means, when the record is loaded, you can work with object field as any
object variable (they ay be some exception for the rule, but nothing comes
to my mind now.) There is no need to copy the object field and then copy
object back - what you want to achieve, 4D does transparently.


--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Creating .docx files

2018-01-18 Thread Peter Bozek via 4D_Tech
On Thu, Jan 18, 2018 at 12:39 PM, Pat Bensky via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
> If the two folders (Brownies and Brownies-CB) contain the exact same
> contents, why would one work and the other, not?
>
> Note - there is one hidden file in the package and I checked to make sure
> that it gets copied over.
>
> Anybody got any suggestions?
>
>
>
>
If I remember correctly, zip archive is a stream of compressed files and a
directory structure.  Try to find a utility that can analyse the directory
structure - for example, there may be entries that do not have any
corresponding files, or some files may have attributes or comments that are
lost during decompression / compression.

--

Peter Bozek
**
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: Document capture

2018-01-25 Thread Peter Bozek via 4D_Tech
On Thu, Jan 25, 2018 at 6:39 PM, Kenneth Geiger via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
> If any of you have done something similar, I would really appreciate any
> feedback on my approach and would welcome any suggestions, pseudo-code, or
> code that you would be willing to share.
>

We did something similar,  and I would add few comments:

It seems that modern systems does not have problems with huge amount of
files in folders, so we do only two level structure - one for each client
and inside all client's files.

We store small preview of the document (500 x 500) in data file, compressed
it is few kB, but with lot of documents, database grows pretty fast (we
have instances of ~20GB files.)

We implemented preview of documents of individual client as a (scrollable)
SVG pictures build from data from database - preview, name, size, creation
date etc. Seems to work well even for large number of files, however we had
to handle such action as selection highlighting, D etc. We tested picture
arrays displayed by ALP and specialized plugins but this works for us quite
well.

Situation become more complex when user wants to edit stored documents in
third party applications. I have not found a good solution how to find out
when user ended editing. Ended up  displaying small dialog where user
clicks when has finished editing and then code moves document back to
storage.

-- 
Peter Bozek
**
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: "Goodbye 4D Write" email

2018-02-01 Thread Peter Bozek via 4D_Tech
On Thu, Feb 1, 2018 at 3:53 PM, Herr Alexander Heintz via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Come on you plugin developers, give us a real Word processing Plugin and
> there will be a market for it.
> Sadly this kind of development is out of my league, or i’d do it.
>
>
>
>
Definitely, do not do it. 4D plugins are currently cut out of system
interaction. 4D assumes that external area will receive all events - mouse,
keyboard etc - from 4D.

On other hand, it is not possible to write a decent text editor that does
not heavily depend on system services - from measuring text, multi language
support, font replacement, cursor placement and behaviour etc.. With modern
operating systems, it means providing system with callback that are called
as needed. That is extremely difficult, if not outright impossible, with 4D.

--

Peter Bozek
**
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: Picture in PagePro

2018-02-12 Thread Peter Bozek via 4D_Tech
On Mon, Feb 12, 2018 at 9:28 PM, David Ringmsuth  wrote:

> Peter,
>
>
>
> After opening the graphic, we must select a “Format” that makes it visible.
>
>
>
> It is working!
>
>
>
> THANKS!!
>
>
>
> David Ringsmuth
>
>
>


David,

I was testing various images to find the problem, and yes - this is
something I often forgot to mention - default display is plain non-scaled,
what means if you have image with high resolution, you see a small part of
upper left corner.  You need to select one of scaled formats to have image
scaled into visible area.

>
>

Regards,


--

Peter Bozek
**
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: PagePro picture

2018-02-09 Thread Peter Bozek via 4D_Tech
David,

I am looking at that problem, will let you know as soon as I know more.

Peter Bozek


On Fri, Feb 9, 2018 at 4:47 PM, David Ringsmuth via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> 4D v15.4
> PagePro 1.4.2 ©2009-2015
> Windows 10
> Source code
>
> I’m trying to add a picture to a PagePro report.
>
> Drag-n-drop, Camera tool, neither are working at this moment.
>
> Suggestions please!
>
> Thanks!
>
> David Ringsmuth
>
> **
> 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
> **




-- 
--

Peter Bozek
**
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: text2picture

2018-02-14 Thread Peter Bozek via 4D_Tech
On Wed, Feb 14, 2018 at 11:06 AM, Jörg Knebel via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
> > On 14 Feb 2018, at 21:03 AEDT, Herr Alexander Heintz via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> >
> > But why not use SVG if available?
> > Its blinding fast
>
>
> I’ll take a look into it.
>

Long time ago there was really a JPR code that used 4D Draw or some other
plugin. Currently, SVG can do that easily, look up  discussion of
"textarea" element.

--

Peter Bozek
**
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: Electronic Signature Pads

2017-12-28 Thread Peter Bozek via 4D_Tech
On Thu, Dec 28, 2017 at 12:57 AM, Jim Crate via 4D_Tech <
4d_tech@lists.4d.com> wrote:
>
> The ScripTel also integrates with Adobe Reader for cryptographically
signing PDF documents, if that’s necessary. I used 4D to create a PDF,
launch Adobe Reader with that PDF, monitor the file for an appropriate
number of changes (depending on how many signatures I needed), and email
the signed PDF to the appropriate recipients.
>

I would be interested to know how this part work for you. I did something
similar - 4D generates .fdf file, it is open in Acrobat Readed and then 4d
monitors changes in modification date. I tried to use lsof on Mac to
monitor if file is still open, but this seems unreliable. Checking
modification date has its shortcomings as well.


--

Peter Bozek
**
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: just a curiosity - pre emptive threads

2018-07-12 Thread Peter Bozek via 4D_Tech
On Thu, Jul 12, 2018 at 8:11 AM Alan Chan via 4D_Tech <4d_tech@lists.4d.com>
wrote:

> Simply put, preemptive triggers are not for client/server operations even
> all the codes are preemptive-compliant.
>
> - data entry UI and do entry data
> - click a button call a method that contains SAVE RECORD that invoke
> trigger in server and all codes in this method itself and codes in trigger
> are all preemptive-compliant
> - In this case, trigger won't be preemptive because the method above was
> called from UI.
>
> Am I correct?
>
>
I believe not.

UI cannot run in preemptive process, that is requirement of underlying OS
that require that all UI runs in the main thread. But there is no reason
why the trigger, running on server, could not run in a separate preemptive
thread.

I believe much of the confusion is caused by mixing up 4D-level processes
with OS-level threads. OS thread is preemptive or not and cannot switch
between two. 4D process runs in one OS thread and thus cannot switch
between preemptive and cooperative, but that does not hold for server
triggers. Even when invoked from non-preemptive 4D process, trigger runs on
its own OS-level thread on server machine and that thread can be preemptive.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: just a curiosity - pre emptive threads

2018-07-12 Thread Peter Bozek via 4D_Tech
On Thu, Jul 12, 2018 at 11:47 AM Alan Chan via 4D_Tech <4d_tech@lists.4d.com>
wrote:

> I'm a bit confused.
>
> When I just call SAVE RECORD in data entry form (cooperative process), I
> was told it's not OK because it's from a process that have UI. Now, your
> latest reply claimed it's OK. Or only if there's no trigger and transaction?
>
> Alan,

As I understand it, if you have a C/S, SAVE RECORD runs in its own
preemptive thread _on server_. It does not matter if 4D process that called
SAVE RECORD is preemptive or not. As clients does not run preemptive
processes, the whole point seems to be moot.

On single user, SAVE RECORD and the trigger(s) it executes runs in the same
system thread the process that called SAVE RECORD. It means that if you
want to save record in preemptive process, both the method that executes SAVE
RECORD and the trigger need to be able to run preemptively. In fact, as I
understand it, all triggers need to be able to run preemptively.

It means that to do what you described - pass record to worker to be saved
in preemptive thread - would make difference in single user only. But there
you would not gain anything from calling SAVE RECORD in a worker.
Additional messaging with another thread will rather slow the application
down.


> If I create a new process that contain "no" UI from application process,
> this is again, not OK.
>
> When 4D announced preemptive thread is supported in triggers as long as no
> IP variables, I thought this is game changer that 4D could move to
> enterprise solution. Obviously, it's just my illusion. It seems all these
> game changer features in 16 and
> 17 are only beneficial for 4D based web server but not traditional
> client/server solution developers.
>

That is not my understanding.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: just a curiosity - pre emptive threads

2018-07-12 Thread Peter Bozek via 4D_Tech
On Thu, Jul 12, 2018 at 1:57 PM Jeffrey Kain via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Does it make sense for most triggers? Usually you want to know for sure
> that code in a trigger has completed before doing anything else in the
> table/process, which is kind of the opposite of a preemptive thread.
>
>
Jeff,

I believe it should provide some speed improvement (to make triggers
preemptive.) IF they are not, triggers are executed sequentially at server,
one trigger executed after another. If they are preemptive, each trigger
can get their own preemptive thread, with several triggers executed (on
server) in parallel. However, disk speed as main bottleneck will not be
affected by this, so you can see significant or zero improvement.

That does not mess with order execution, triggers are started after client
calls SAVE RECORD and only after trigger finishes - does not matter if in
preemptive or cooperative thread - execution on client moves to next line.


> I suppose for some triggers it would be suitable.
>
>
As I understand, you have to make all triggers preemptive to work.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Collections

2018-03-22 Thread Peter Bozek via 4D_Tech
On Thu, Mar 22, 2018 at 1:16 AM, John DeSoi via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> In the 4D case and in the cases below (plus PHP), I suspect a collection
> is really just an "object" (hash table) with numeric keys instead of string
> keys. For example, if I write
>
> $collection := New collection()
> $collection[247] := "fred"
>
> I doubt that it creates 247 (indexes 0-246) empty elements in the
> collection. Would love to hear confirmation or denial from some one at 4D
> that knows the internals.
>
>
In fact, Collection has some object-like properties. It can be  passed to
method as parameters and return values, it is - like object - manipulated
by reference, and the content is not typed (it means collection[3] can be a
number, and few lines later it can be a string, jsut like a.b .)

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Scope of entity selection

2018-10-18 Thread Peter Bozek via 4D_Tech
On Thu, Oct 18, 2018 at 2:30 PM Christian Sakowski <
christian.sakow...@heubach-media.de> wrote:
>
> > I did not find a way how to do a shared collection from selection,
>
> You don’t need this. Just pass the object into the process. The object
will be copied.
> If you have performance problems, please let me know your benchmarks.


My testing data have now 15 record, so it will take a while.
>
>
> > creates unordered selection, so order is lost. ds.Table.fromCollection
may do that, but at a cost of significant overhead.
>
> Yes indeed.
>
> I create an ordered selection from a collection by doing this:
>
> ARRAY LONGINT($ids;0)
> COLLECTION TO ARRAY($collection;$ids)
>
> QUERY WITH ARRAY([table]ID;$ids)
> ORDER BY FORMULA([table];Find in array($ids;[table]ID))
>

Following code seems to work:

$selection:=ds.Table.newSelection(dk keep ordered)
For each ($id;$collection)
  $selection.add(ds.Table.get($id))
End for each

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Shared Object - NOT!

2018-10-22 Thread Peter Bozek via 4D_Tech
On Mon, Oct 22, 2018 at 5:10 PM Keith Culotta via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> If a method creates an object ($no:=new object), the object is destroyed
> when the method ends?
> and
> if a method creates a new shared object ($nso:=new shared object), the
> object continues to exist after the method ends, but the reference to it is
> lost?  Does 4D know to clear the object in this case?
>
>
Keith,

AFAIK, object - standard or shared -  is destroyed when it refcount is
zero, what means when there is nothing that references it anymore.

This means that when a method creates new object
$no:=New object
fact that $no is local variable matters to the extend that, when methods
ends, $no gets out of scope and the refcount of the object is decreased by
1. If no other variable refers to the object, it is destroyed. However,
there may be other variables that refer to that object, if you do something
like
procesVar:=$no
or
SomeMethod($no)

In this case, object exist till last variable stopp to reference it.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Shared Object - NOT!

2018-10-21 Thread Peter Bozek via 4D_Tech
On Sun, Oct 21, 2018 at 6:29 AM Keisuke Miyako via 4D_Tech <
4d_tech@lists.4d.com> wrote:
>
> the best way to share an object or collection between processes is to
pass a shared object or shared collection as a parameter.
> there is no need to use Storage, there is no need to use interprocess
variables.
> you just create a shared object or shared collection, and pass it as an
argument to another process or worker.
> the received object is not a copy, it is a shared reference to the same
shared object.
>

Keisuke,

is there a way how to convert non-shared collection to shared? Some
commands return normal collection, like
selection.toCollection("ID") or collection:=selection.ID
and I want to pass the collection to other process without duplication, but
have not found a way how to convert normal selection to shared one.

Tried
collection:=New shared collection
collection:=selection.ID
but it seems collection was reverted to normal one. When I tried

Use (Storage)
  Storage.collection:=New shared collection
  Storage.collection:=$settings.ID
End use

I got a runtime error. Even

Use (Storage)
  Storage.collection:=New shared collection
  Storage.collection:=$collection.copy()
End use

is not possible, although this is what I want to avoid.

Best would be to have shared entity selection - like interprocess named
selections - which would then generate shared collections.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Shared Object - NOT!

2018-10-21 Thread Peter Bozek via 4D_Tech
On Sun, Oct 21, 2018 at 12:41 PM Keisuke Miyako via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> you will probably not like my answer, but here goes.
>
> for creating a shared collection from a 4D array,
> ARRAY TO COLLECTION has a special syntax that does just that.
> the trick is to pass a New shared collection to the command.
>
> http://doc.4d.com/4Dv17/4D/17/ARRAY-TO-COLLECTION.301-3730916.en.html
>
>
it would be nice if assignment operator honored shared property as well and
constructs like
collection:=selection.ID
would keep collection a shared one if it was before (and similar to
assignment of collection created with .copy() .)


>
> I believe that such feature is in development and will be available pretty
> soon.
>




> but on entity collections, I don't understand why that would be necessary.
>
> first, I disagree with the interprocess named selection analogy.
>
> the request is more like,
> "I want to make a query in process B change the current selection of
> process A, and vice versa".
> why would you want that?
>

I am using interprocess sets and named selections - not very often, but I
still do in all at least a bit more complex projects.


>
> yet,  the "Use" and "End use" locking system would do nothing to protect
> data integrity,
> because any other process can update or delete an entity outside of the
> entity selection.
> I don't see any value in such a tortured system.
>

The same can be said about interprocess named selections and sets.   While
yes, there is a question of consistency, people understand that well and I
do not remember any complains regarding this. Note that you do not have to
have different processes - you can delete entity belonging to selection
within the same process and run into the same situation.

>
> if the goal is to share entity selections between windows,
> then it would make more sense to run those windows in the same process.
>

Yes, this is true and I was thinking about it. However, I feel that this is
currently not very well documented and there are not many example databases
that would  help me understand how to properly implement multiple active
windows in the same process. Do you have some suggestions what to look at?
(Yes, I know about DIALOG (... ;*) syntax.)


> the scope of an entity selection is the process which has practical
> benefits.
> there must be a really strong argument to justify breaking that rule.
>


I do not fully understand what is the benefit 9or difference) of having, in
one process, two windows showing and manipulating the same entity
selection, or two selections cloned with .copy() command, and having two
windows in two processes displaying two synchronized selections.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Shared Object - NOT!

2018-10-21 Thread Peter Bozek via 4D_Tech
On Sun, Oct 21, 2018 at 7:36 PM Kirk Brooks via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
>
> Personally I have a lot of concepts about how to do code operation in 4D
> that are strongly rooted in what it was possible to do in 4D. ORDA
> frequently goes in a different direction and the optimal ORDA solutions
> look much different than I'm accustomed to. Usually cleaner, tighter and
> less code. Not always, but usually.
>
>
Kirk,

I think you misunderstood what is in my opinion very good discussion. The
question was not how to refactor some 4D code to ORDA, rather how to solve
some problems (that can be solved with interprocess named selection and
sets) in ORDA. The discussion split to several venues - would it be wise to
implement, can it be circumvented by redesigning the problem and if not,
how to implement it?

While discussion si (I hope) not finished, it seems to me that currently
ORDA does not offer efficient solution - although the situation can change
in the future - and it is wise to try to avoid sharing selections by using
another new feature, support for several active windows within one process.
Such solution may have its own problems, though.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Scope of entity selection

2018-10-18 Thread Peter Bozek via 4D_Tech
On Sat, Oct 13, 2018 at 10:29 PM Christian Sakowski via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
>
> like:
> $object.myIDs:=$entitySelection.toCollection("ID“).extract(„ID“)
> new process(…;$object)
>
> and in the new process just create the new entity selection:
>
> ds.Table.query(„ID IN :1“;$object.myIDs)


I tried simpler (but I believe identical) solution:

$collection:=$selection.ID
$err:=New process("aaExecuteProcess";0;"test";$collection)
... in the process

$selection:=ds.Table.query("ID IN :1";$collection)

There are several problems with it: first, I did not find a way how to do a
shared collection from selection, there is no "New shared collection form
selection". So passing collection to another process probably copies the
collection (I could not find in in documentation.) But more serious problem
for me is there is no way how to pass ordered selection - line

$selection:=ds.Table.query("ID IN :1";$collection)

creates unordered selection, so order is lost. ds.Table.fromCollection may
do that, but at a cost of significant overhead.

So, it seems ORDA is nice, but for more advanced functionality, named
selections are way to go.

>
> >> I am trying to do something like global named selection. Examples that,
> >> say, pass selections to workers pass a condition to build a selection.
This
> >> seems to restricting.
> >>
> >> Am I overlooking something obvious?


--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Scope of entity selection

2018-10-13 Thread Peter Bozek via 4D_Tech
On Sat, Oct 13, 2018 at 10:29 PM Christian Sakowski via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> $object.myIDs:=$entitySelection.toCollection("ID“).extract(„ID“)
> new process(…;$object)
>
> and in the new process just create the new entity selection:
>
> ds.Table.query(„ID IN :1“;$object.myIDs)
>
>

Christian,

Thanks for idea, will look at it. I want to pass a sorted selection, not
sure if the above query will work. I have a code that does this with
interprocess selection, and that works OK, but thought ORDA will provide
more elegant solution.

I could achieve it with  LONGINT ARRAY FROM SELECTION - CREATE SELECTION
FROM ARRAY commands, and it resembles your suggestion (and the sort order
will be transferred) but wanted to avoid creating potentially huge array.
Interprocess named selection seems to have very low overhead (and, BTW, the
same argument as against shared entity selections can be used against
interprocess named selections.)

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Scope of entity selection

2018-10-13 Thread Peter Bozek via 4D_Tech
This may be related to other thread - Defining and documenting objects - as
it is related to scope of new objects: I am playing a bit with 4D v17, and,
if I understand it correctly, I can pass around shared objects and shared
collection between processes (and workers, but I am not that far yet.)

However, how I pass around entity selections? It does not seems I can pass
them as a parameter (new process will get null.) I tested to declare entity
selection as shared object, but it does not work either.

I am trying to do something like global named selection. Examples that,
say, pass selections to workers pass a condition to build a selection. This
seems to restricting.

Am I overlooking something obvious?

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: ORDA Entity From

2018-10-23 Thread Peter Bozek via 4D_Tech
On Tue, Oct 23, 2018 at 10:23 PM Dennis, Neil via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Is there a way to determine where an entity is from? In the debugger it
> shows in the value "Entity () from ", but I can't fine a way to
> get  using a method from code. Does such a method exist?
>
> Neil
>

Neil,

Do not have answer, but, as a workaround, what I did was insert (wrapp)
selection as a property of another  object that holds information about
table (plus few other attributes I found usefull.)

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: 2 Factor Authentication

2018-09-19 Thread Peter Bozek via 4D_Tech
On Wed, Sep 19, 2018 at 7:49 PM Timothy Penner via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
> Did you go to the 4D Summit?
>
> If so, then you should have access to this:
> http://kb.4d.com/assetid=78020
>
> -



Hmm, I went to Summit in Paris and do not have access to the article.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Coding/Development Style Guide?

2018-12-16 Thread Peter Bozek via 4D_Tech
On Sun, Dec 16, 2018 at 10:15 PM B.Bippus via 4D_Tech <4d_tech@lists.4d.com>
wrote:

> Begin each variable name with a character to specify what type it is:
> · String: s
> · Text: t
> · Boolean: y
>
> To add the Variable Type to the Variablename is a big help. I started many
> years ago to prepend the Type. And I am using the "4D Pop Marco
> Declaration" to automatically declare every variable. (I have a complete
> Regex Setup for prepending the Type if someone need it).
>
> But in the last days I am thinking if it would have been better to append
> the Type: For example: $t_Name  vs.  $Name_t.
> So if you are starting with a variable-name convention: Think about it
> first.
>
> And because of the Object-Tag names are case-sensitive, it makes sense to
> have a convention for the Object-Tag names too. I use: every Name-Part
> starts with a uppercase character and the rest is lowercase. Example Tags :
> "Last_Changed" , "Simple_Tag".
>
> My variable naming conventions :
> C_LONGINT($l_WinRef)
> C_OBJECT($o_parameter_3)
> C_REAL($r_Amount)
> C_TEXT($t_Customer_Code)
> C_BOOLEAN($b_ok)
> C_DATE($d_Budgets_End_Date)
> C_OBJECT($o_Parameter)
> C_POINTER($p_Table)
> C_Blob($bl_Var)
>
> ARRAY LONGINT($al_Budgets_Code;0)
> ARRAY REAL($ar_Sum_of_Trades;0)
>

I will offer a contrarian view: Some time ago, I was using the same
notation (Camel one, but that is detail) but now I decided against it.

I maintain several databases for a long time, so so I have a lot of
variables with 's' prefix, what is now text. This is not a big problem, I
can understand that 's' and 't' means the same, but it still disturb me a
bit. But with integer prefix i had a dilemma, as integer arrays still
exists and need to be used with integer fields, so I rather redeclared and
renamed all integer variables and arrays with 'l', but are still unsure
when I see 'ai' prefix in some old code - did I forgot to redeclare and
rename it, or is it still an integer (and should it be changed to longint?)

Second, as I often work with code written by different developer, mix of
various styles lead to not really well readable code. And I hate variable
names like $day_D (or, even better, $d_D) or $index_L etc. It provides no
information and makes the code ugly and unreadable. (Besides, does not 4D
now show variable type as cursor hoover above it?)

I now try to provide clear and readable variable names, without prefixes or
postfixes. This means I would have
C_LONGINT($winRef)
C_REAL($amount)
C_TEXT($customerCode)

I still use prefix when the type of variable is different from what the
name would suggest, but I prefer, when possible, names like $tablePtr;
$tableNo and $tableName to $p_table, $l_table and $t_table. I would still
use
C_BOOLEAN($bOK) but
C_LONGINT($OK)

I would still use
C_OBJECT($oParameter2)
but would try avoid such names.

Such names lead to readable code - like
For($index;1;$size)
  $sum:=$sum+$amount
...
works well with other notations, and are easier to write.

-- 

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: [off-ish] Regex help

2018-11-28 Thread Peter Bozek via 4D_Tech
On Wed, Nov 28, 2018 at 7:30 PM Chip Scheide via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Thanks Kirk,
>
> According to Wiki :
> . - matches any single character
> ( ) - defines a marked subexpression
> * - matches the preceding element zero or more times
> so... as I read the definitions...
> "(.*:)"
>
> match any character(s), before a ":"
> a file path (on a Mac) is  :  :  ... : 
>
> Match Regex says:
> "...If you pass arrays, the command returns the position and length of
> the occurrence in the element zero of the arrays and the positions and
> lengths of the groups captured by the regular expression in the
> following elements."
>
> so I would expect(ed)
> Match regex($folderPathMotif;$File_Path;1;$path_pos;$path_len)
>
> to populate the arrays with each occurrence of ":", as your supplied
> code appears to do,
> OR
> if the Match Regex does not find/report all occurrences of ":" to
> report the FIRST instance of a ":", not the last.
>

Regex behaves like that because, by default, its matching is greedy, what
means it tries to match the pattern to as many characters as possible. In
your case, it tries to find longest run that match pattern .*; - and the
run consist of all characters up to last :.

If you want the match stop on first occurrence of : you need to make
operator * ungreedy by attaching ? to it. If you try pattern (.*?:) it
should return substring up to first :. While pattern .*: says "find the
longest run of characters ending with :" pattern .*?: means "find the
shortest run of characters ending with :

Size of array is number of matching groups, in your case 1. This is how it
works, IMHO. If the whole pattern repeats itself several times, you need to
run Match regex in loop.

HTH,

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: not enough space in memory

2019-04-16 Thread Peter Bozek via 4D_Tech
On Tue, Apr 16, 2019 at 8:15 PM Peter Mew via 4D_Tech <4d_tech@lists.4d.com>
wrote:

> Hi
> I'm trying to load a large, 1.5G, audio file into a blob using document to
> blob, and Im getting a not enough spce in memory error. I can load a file
> that is 1G ok.
> Is there a setting I can change to stop this error. The Machine has 16G of
> Ram installed.
> thanks
> -pm



Peter,  important question is if you try it with 32-bit or 64-bit version
of 4D. For 32-bit 4D, the file is too big - with 32 bits, application can
use at most 2GB of memory, so 1.5GB file would not fit. With 64-bit
systems, ti should be possible to read such a file.
--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Dialog (;*) question

2019-06-25 Thread Peter Bozek via 4D_Tech
I maybe already asked this question, but anyway I am still a bit confused:

I wanted to use DIALOG with * as an additional parameter, but have problem
to make it work. I have app that display several info windows - like
palettes, progress messages, communication statuses etc.Currently, I often
need 2 processes for each task: one does the work as background task,
another display it status / progress.  So instead of running a separate
process for each window, why not to use one process that will display
whatever windows application wants to display? Or display status from
inside background process that do communication or lengthy task.

My original idea was to call

OPEN FORM WINDOW
DIALOG(;*)
PAUSE PROCESS

but that does not work, as the process execution is "standing" at PAUSE
PROCESS and no code is executed (and CALL FORM is either not executed or
window is not redrawn.)

When I remove PAUSE PROCESS, process ends and DIALOG window is closed.

According to documentation, it would work of I do
OPEN FORM WINDOW
DIALOG(;*)
DIALOG()

but that is quite ugly, and would cause some problems, as I want the
process that calls DIALOG(;*) periodically evaluate which windows are open
and close itself if none.

Another possibility is just to open window and call DIALOG(), then call
DIALOG(;*) from inside the form method of the first DIALOG() form. That
would (probably) work, form can use On timer event to check what is open,
open additional dialogs etc. but I do not like the idea either.

Is there a way how to use DIALOG(;*)  from a process that does not have any
other window open?

Regards,

-- 


Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Dialog (;*) question

2019-06-25 Thread Peter Bozek via 4D_Tech
Kirk,

Yes, this is a good idea, and the schema when there is central UI process
(worker) displaying a toolbar, and all other windows are created with
DIALOG(;*) by clicks on toolbar buttons / menu items is interesting, but in
this particular case not doable, as I work with existing application that I
do not want - and cannot - rewrite.
I just want to straightforward some tasks - modern apps are more and more
about communication, data exchange and synchronisation. Where I used to
have one background process, I now have many, with much more complex UI
they need to be able to interact with. It would be nice if I could open a
window anywhere that will - from the beginning - be able to process events
while code in its process is still executing. I thought that DIALOG(;*) is
just such commands, but it seems more complex than I thought.

Regards,

On Tue, Jun 25, 2019 at 9:41 PM Kirk Brooks via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Hi Peter,
>
> When you call DIALOG(*) the dialog opens in the current process. But as you
> saw execution continues on. The solution is to make a DIALOG call by itself
> first and open the subsequent windows from there.
>
> The suggestions I've heard are to think about having a single UI process.
> This initial dialog could be something really simple, like a small palette
> or it could be a big window. That doesn't really matter. The change in
> thinking is we open new windows from here for things that we would spin up
> a separate process for in 4D classic.
>
> What about memory management? you may think. Well, this approach is
> probably best suited for working with ORDA and minimal reliance on process
> variables. If you are using ORDA the great majority of the data you are
> working with are actually references and 4D is super optimized for working
> with this.
>
> Hope this helps.
>
> On Tue, Jun 25, 2019 at 6:45 AM Peter Bozek via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
>
> > I maybe already asked this question, but anyway I am still a bit
> confused:
> >
> > I wanted to use DIALOG with * as an additional parameter, but have
> problem
> > to make it work. I have app that display several info windows - like
> > palettes, progress messages, communication statuses etc.Currently, I
> often
> > need 2 processes for each task: one does the work as background task,
> > another display it status / progress.  So instead of running a separate
> > process for each window, why not to use one process that will display
> > whatever windows application wants to display? Or display status from
> > inside background process that do communication or lengthy task.
> >
> > My original idea was to call
> >
> > OPEN FORM WINDOW
> > DIALOG(;*)
> > PAUSE PROCESS
> >
> > but that does not work, as the process execution is "standing" at PAUSE
> > PROCESS and no code is executed (and CALL FORM is either not executed or
> > window is not redrawn.)
> >
> > When I remove PAUSE PROCESS, process ends and DIALOG window is closed.
> >
> > According to documentation, it would work of I do
> > OPEN FORM WINDOW
> > DIALOG(;*)
> > DIALOG()
> >
> > but that is quite ugly, and would cause some problems, as I want the
> > process that calls DIALOG(;*) periodically evaluate which windows are
> open
> > and close itself if none.
> >
> > Another possibility is just to open window and call DIALOG(), then call
> > DIALOG(;*) from inside the form method of the first DIALOG() form. That
> > would (probably) work, form can use On timer event to check what is open,
> > open additional dialogs etc. but I do not like the idea either.
> >
> > Is there a way how to use DIALOG(;*)  from a process that does not have
> any
> > other window open?
> >
> > Regards,
> >
> > --
> >
> >
> > Peter Bozek
> > **
> > 4D Internet Users Group (4D iNUG)
> > Archive:  http://lists.4d.com/archives.html
> > Options: https://lists.4d.com/mailman/options/4d_tech
> > Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> > **
>
>
>
> --
> Kirk Brooks
> San Francisco, CA
> ===
>
> What can be said, can be said clearly,
> and what you can’t say, you should shut up about
>
> *Wittgenstein and the Computer *
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Encrypt & decrypt blobs

2019-04-20 Thread Peter Bozek via 4D_Tech
Chip,

How you found that text is 2 bytes longer? If you wrote the text to file,
4D would put BOM before text, which is 2 bytes. Normally, BOM is used by
text editors and is not displayed, to check if there is BOM prepended I had
to use hex editor and look at the file.

While most text editors know what to do with BOM, I have run into programs
where that caused problems.

Regards,

Peter Bozek

On Sat, Apr 20, 2019 at 12:14 AM Chip Scheide via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> I am putting text into a blob
>   TEXT TO BLOB($Text_Ptr->;$Blob;Mac text without length)
> I encrypt the blob
>   ENCRYPT BLOB($Blob;$Private_Key)
>
> I later extract this text
>   DECRYPT BLOB($Blob;$Public_Key)
>   $Destination->:=BLOB to text($Blob;Mac text without length)
>
> The text is extracted - and APPEARS to be the same, however
> the length of the extracted text is 2 characters longer then the
> original text.
> The extra 2 characters are:
> Character code = 0
> And are appended to end of the extracted text.
>
> Anyone have an Idea??
>
> Thanks
> Chip
> ---
> Gas is for washing parts
> Alcohol is for drinkin'
> Nitromethane is for racing
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: _ as first character in Method Name [was 64 bit...]

2019-08-20 Thread Peter Bozek via 4D_Tech
On Mon, Aug 19, 2019 at 9:58 PM Keisuke Miyako via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> 4D already uses some private property names,
>
> e.g.
>
> __LockerID
> __NEW
> __KEY
>
>
> https://doc.4d.com/4Dv17R5/4D/17-R5/dataClassfromCollection.305-4128671.en.html
>
> https://doc.4d.com/4Dv17R5/4D/17-R5/Shared-objects-and-shared-collections.300-4128430.en.html
>
> so beware.
>

That is how I understand it - 4D internal objects can have hidden
properties with underscores, so it is better to not use underscore as a
first char in field and table names. But method names starting with
underscore  should be OK (for now.)

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: 4D 2003 export structure

2019-09-04 Thread Peter Bozek via 4D_Tech
This is method I used in older version of 4D, not sure if it will work in
4D 2003 but it should:

  // ==
//exporting procedure for structure

C_TIME($refNum)
C_STRING(3;$cr;$tb)
C_STRING(31;$s)
C_LONGINT($table;$field;$len;$type;$ot;$of;$cf)
C_BOOLEAN($invisible;$trig1;$trig2;$trig3;$trig4;$ind;$uni;$inv;$ao;$am)

$cr:=Char(Carriage return)
$tb:=Char(Tab)

$refNum:=Create document("";"TEXT")
If (OK=1)
For ($table;1;Get last table number)
  //export table info
SEND PACKET($refNum;Table name($table)+$tb)

GET TABLE PROPERTIES($table;$inv;$trig1;$trig2;$trig3;$trig4)
If ($inv)
SEND PACKET($refNum;"I"+$tb)
End if
If ($trig1)
SEND PACKET($refNum;"N")
End if
If ($trig2)
SEND PACKET($refNum;"S")
End if
If ($trig3)
SEND PACKET($refNum;"D")
End if
If ($trig4)
SEND PACKET($refNum;"L")
End if


SEND PACKET($refNum;$cr+$cr)

For ($field;1;Get last field number($table))
SEND PACKET($refNum;Field name($table;$field)+$tb)
GET FIELD PROPERTIES($table;$field;$type;$len;$ind;$uni;$inv)
Case of
: ($type=Is Alpha Field)
$s:="S"+String($len)
: ($type=Is Real)
$s:="R"
: ($type=Is Text)
$s:="T"
: ($type=Is Picture)
$s:="P"
: ($type=Is LongInt)
$s:="L"
: ($type=Is BLOB)
$s:="O"
: ($type=Is Boolean)
$s:="B"
: ($type=Is Date)
$s:="D"
: ($type=Is Time)
$s:="T"
: ($type=Is Subtable)
$s:="X"

End case
SEND PACKET($refNum;$s+$tb)

If ($ind)
SEND PACKET($refNum;"I")
End if
If ($uni)
SEND PACKET($refNum;"U")
End if
If ($inv)
SEND PACKET($refNum;"N")
End if

SEND PACKET($refNum;$tb)


GET RELATION PROPERTIES($table;$field;$ot;$of;$cf;$ao;$am)

If ($ot#0)
SEND PACKET($refNum;"->")
SEND PACKET($refNum;Field name($ot;$of)+$tb)

If ($ao)
SEND PACKET($refNum;"O")
End if
If ($am)
SEND PACKET($refNum;"M")
End if


End if

SEND PACKET($refNum;$cr)

End for
SEND PACKET($refNum;$cr+$cr)

End for
CLOSE DOCUMENT($refNum)
End if

// ==

Regards,

Peter Bozek

On Wed, Sep 4, 2019 at 2:20 PM Narinder Chandi via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Tony,
>
> Are you able to open the structure with a later version of 4D? In v14 the
> EXPORT STRUCTURE command was introduced:
> https://doc.4d.com/4Dv17/4D/17.2/EXPORT-STRUCTURE.301-4386049.en.html
> which would get you the quickest representation of your structure, albeit
> in XML.
>
> Otherwise it should only take a few minutes to crank out a custom method
> to produce an text output representation of your structure using the
> structure access commands:
> https://doc.4d.com/4Dv17/4D/17.2/Structure-Access.201-4385958.en.html
>
> Unfortunately I don't have such method to hand though.
>
> Regards,
>
> Narinder Chandi,
> ToolBox Systems Ltd.
> --
>
> -Original Message-
> From: 4D_Tech <4d_tech-boun...@lists.4d.com> on behalf of 4D Tech Mailing
> List <4d_tech@lists.4d.com>
> Reply-To: 4D Tech Mailing List <4d_tech@lists.4d.com>
> Date: Wednesday, 4 September 2019 at 13:04
> To: 4D Tech Mailing List <4d_tech@lists.4d.com>
> Cc: "Wright, Tony" 
> Subject: 4D 2003  export structure
>
> Hi
>
> Does anyone have a method I can use to create a text file
> With information of each table and info about each attubute
>
> i.e.
>
> Table name = patients
> Fields
> Surname Alpha 30
> Forename alpha 30
> DOB = Date
>
> Etc etc
>
> This DB was using 4D 2003 in its days
>
> Many thanks
>
> Tony
>
>
>
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: v17 obsolete commands SET DOCUMENT CREATOR / SET DOCUMENT TYPE

2019-08-08 Thread Peter Bozek via 4D_Tech
Dňa št, 8. aug 2019, 7:13 Jörg Knebel via 4D_Tech <4d_tech@lists.4d.com>
napísal(a):

> G’day All,
>
> Does someone has already developed a replacement (LEP or other) for both
> platforms?
>

I believe they are obsolete as they are no longer used and supported by
macOS and document type is defined by extension.

--
Peter Bozek

>
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: FORMAT NUMBER

2019-08-06 Thread Peter Bozek via 4D_Tech
Dňa ut, 6. aug 2019, 0:31 Chuck Miller via 4D_Tech <4d_tech@lists.4d.com>
napísal(a):

> Read my previous note. You will need to convert the array to text array
> and fill as a formatted number using code I already supplied
>

Format "### ###. 00;### ###. 00;" (format for positive, negative, zero)
should display empty string for 0.

--
Peter Bozek

>
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: [repost - desperate]What runs before ON STARTUP?

2019-10-01 Thread Peter Bozek via 4D_Tech
On Tue, Oct 1, 2019 at 5:11 PM Chip Scheide via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
>
> I am at a loss.
>
>
Any plugins? They are initialised before On startup runs.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Difference between loading a compiled and interpreted component

2019-10-02 Thread Peter Bozek via 4D_Tech
On Wed, Oct 2, 2019 at 7:37 PM Chip Scheide via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Repair, Compact, Repair of Host structure, and Repair of Host data file
> Does not solve the problem.
>
> Chip
>

This is rather very far-fetched idea, but once I run into similar problems
when I had a variable in master database that had identical name as a
method in component (or vice versa?) It seem that scope separation between
component and master database does not take such possibilities into account.

However, I got a crash only when I tried to display form containing the
variable.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Edit menu support in ListBoxes

2019-11-05 Thread Peter Bozek via 4D_Tech
I would like to implement Edit menu functionality in ListBoxes, where user
would be able to copy lines and paste it into different listbox. However,
it seems that 4D handles enabling / disabling of edit menu and I have not
find a way how it could be overridden.

A workaround would be to do a separate menu bar with edit menu items that
do not have automatic action associated, and switch it on getting / losing
focus, but maybe there is a simpler way.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Trapping the 'return' key in list forms

2019-12-03 Thread Peter Bozek via 4D_Tech
Sorry to enter the thread late, but tried to implement similar
functionality several years ago. Ended up with variable set in On getting /
on loosing focus. Button that handled Enter checked value of the variable
and either processed script or saved record.

Final implementation was more complex, it had event handler method that
stored last pressed key and everything was handled in On loosing focus
event, executing different code for leaving with enter, tab or mouse click.
But doing it again, I would go for something simpler.

Peter Bozek

On Tue, Dec 3, 2019 at 4:21 PM Peter Jakobsson via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Hi Chip
>
> Thanks for the reply. I’ve seen that approach on some web based systems.
>
> Could be good, could be bad. I see some users loving it and others hating
> it. The machine trying to “second guess” that the user has typed enough
> into the filter field sometimes makes it feel flaky because it’s not
> immediately apparent what invoked the sudden query unless you happen to
> know about the “timed action". At least with “type-ahead” the user knows
> that the keystroke will invoke a filter at every character.
>
> Having said that, I watched a user show me their product lookup on a
> manufacturer’s booking site the other day - it had a timer just like the
> one you described. He really liked it. But he also wanted the filter to be
> invoked with the return key.
>
> Regards
>
> Peter
>
>
> > On 3 Dec 2019, at 15:12, Chip Scheide <4d_o...@pghrepository.org> wrote:
> >
> > have you considered using a timer to auto search for the user?
> >
> > i.e. user types: "App"
> > and after a brief delay the searches auto executed using the user
> > entered information?  I use 120 ticks.
> >
> > then they do not have to hit return at all
> >
> >
> > On Tue, 3 Dec 2019 00:26:24 +, Peter Jakobsson via 4D_Tech wrote:
> >> Many thanks Kirk, and to those who responded to this thread.
> >>
> >> I’ve tried a variety of approaches in a virgin structure. The
> >> simplest appears to be one that was first suggested by Jeremy Rusak
> >> but others also alluded to: simply remove the “Focusable” property
> >> from the default button (or a button with the Return key shortcut
> >> attached).
> >>
> >> That allows the “Focus Object” functions to return the last object
> >> instead of the current one. Hurrah !!
> >>
> >> By the way, the reason this is coming up is because users tend to
> >> regard the “Search” widget as a form in its own right. So they
> >> expect to be able to hit the return key to execute a query, then use
> >> tab to move between form object in the host form (which contains both
> >> the list and the search widget), then use the return key again to
> >> accept the form…..IF the cursor is not in the search widget, in
> >> which case they expect “return” to execute the query again and not
> >> accept the form.
> >>
> >> Regards
> >>
> >> Peter
> >>
> >>
> >>
> >>> On 2 Dec 2019, at 15:58, Kirk Brooks via 4D_Tech
> >>> <4d_tech@lists.4d.com> wrote:
> >>>
> >>> Hey Peter,
> >>> I was just reading through your question and the answers and I noticed
> the
> >>> solutions get sort of complicated. I think the reason is the task
> you're
> >>> describing a little unusual. Having one keystroke, the return key,
> perform
> >>> two very different actions can result in a non-intuitive UI. Consider,
> on a
> >>> web page hitting the return key NEVER closes the page. In fact it open
> a
> >>> new one.
> >>>
> >>> I've inadvertently set up this sort of thing on forms of my own and
> it's
> >>> really annoying. When I want to use the Return or Enter key for
> anything
> >>> besides accepting the form (eg. initiating a query, moving around on a
> >>> listbox, etc. ) I put an invisible button on the form to trap the
> keystroke
> >>> and then post an event, typically a TAB. This way I can still trap in
> the
> >>> current object. For adding a CR to a text field I enable the After
> >>> keystroke form event and trap the keystroke there.
> >>>
> >>> With this setup you will still handle the query stuff in the context
> of the
> >>> relevant object. I think someone else mentioned using the loosing focus
> >>> form event. That's good because some users will probably get used to
> using
> >>> the TAB key to move around. There's nothing to stop your code from
> >>> reselecting the search input object when it looses focus. The user
> won't
> >>> know the difference. But if you do that how does the user get out of
> the
> >>> field?
> >>>
> >>> For closing forms, not alerts, confirms or requests, with a given key I
> >>> like to decide on some consistent action and stick to it on every
> form. You
> >>> could use Shift key + Enter. Whatever you choose matters less, I think,
> >>> than applying it consistently throughout the database.
> >>>
> >>> On Fri, Nov 29, 2019 at 1:44 PM Peter Jakobsson via 4D_Tech <
> >>> 4d_tech@lists.4d.com> wrote:
> >>>
>  This is so that users can hit the return key to execute a 

Re: How one does RELATE MANY with ORDA

2019-10-21 Thread Peter Bozek via 4D_Tech
On Mon, Oct 21, 2019 at 9:39 AM Christian Sakowski <
christian.sakow...@heubach-media.de> wrote:

> Normally, just call entity.reload() to refresh an entity and its related
> selections.
> --
>
>
That would work, but  wanted to avoid that as I would loose changes done to
the edited record, or loose the record when it is new. It seems I will have
to do
.save()
.reload()

which complicates stuff quite a bit.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Web Area, 4D method Parameters

2019-11-11 Thread Peter Bozek via 4D_Tech
On Mon, Nov 11, 2019 at 10:29 PM Mitchell Shiller via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
>
> BUT, $1 is blank. Anyone know why $1 does not pick up the “Row 1” or “Row
> 2”?
>
> Thanks. Probably pretty basic but I am very novice with HTML.
>
>
It probably should be


--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: selecting pixels

2019-10-10 Thread Peter Bozek via 4D_Tech
On Thu, Oct 10, 2019 at 2:57 PM Peter Mew via 4D_Tech <4d_tech@lists.4d.com>
wrote:

> Thanks
> Could you expand a bit on your reply
> Thanks
> -pm
>


What exactly you want to achieve? You want to allow user to drag something
or draw on screen? Over some area, or outside the 4D window as well?

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: v15 - Array Object and Append array

2019-10-03 Thread Peter Bozek via 4D_Tech
On Thu, Oct 3, 2019 at 10:55 PM Chip Scheide via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> ok..
> why does this not work???
>
> in a loop
> For ($i;1;$Column_Count)
>   INSERT IN ARRAY($Columns;1)
>   OB SET($Columns{$i};)
> end for
>

How it could? Line
  INSERT IN ARRAY($Columns;1)

tries to insert a real value of 1 as first element of array $Columns. If
$Columns is and object array, you should get an error, but uncompiled will
probably just retype array to array real?

This could work
ARRAY OBJECT($Columns;$Column_Count)
For ($i;1;$Column_Count)
  OB SET($Columns{$i};)
end for

but did not tried that.


I would rather do
ARRAY OBJECT($Columns;$Column_Count)
For ($i;1;$Column_Count)
  $Columns{$i}:=New Object()
end for

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: v15 - Array Object and Append array

2019-10-03 Thread Peter Bozek via 4D_Tech
On Thu, Oct 3, 2019 at 10:26 PM Chip Scheide via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> is it possible to use append array with an object array?
>
>
I forgot - append to array works fine as well:
ARRAY OBJECT($ao;0)
C_OBJECT($o)
OB SET($o;"property";$value)
APPEND TO ARRAY($ao;OB COPY($o))
OB SET($o;"property";$newValue)
APPEND TO ARRAY($ao;OB COPY($o))

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: v15 - Array Object and Append array

2019-10-03 Thread Peter Bozek via 4D_Tech
On Thu, Oct 3, 2019 at 10:26 PM Chip Scheide via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> is it possible to use append array with an object array?
>
>
Sure, I started to use it in v15 and code seems to be working in v17
without problem


> I was playing, and I do not see a way to get this to work.
>

Are you inserting a copy of object into the array? If you do

ARRAY OBJECT($ao;2)
C_OBJECT($o)
OB SET($o;"property";$value)
$ao{1}:=$o
OB SET($o;"property";$newValue)
$ao{2}:=$o

you will end with one object referenced by 3 variables - $o, $ao{1} and
$ao{2}. If you tlater touch $o, both array elements will change (because
all point to the same object data.)

You need something like
ARRAY OBJECT($ao;2)
C_OBJECT($o)
OB SET($o;"property";$value)
$ao{1}:=OB COPY($o)
OB SET($o;"property";$newValue)
$ao{2}:=OB COPY($o)

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: stack error - again

2019-10-11 Thread Peter Bozek via 4D_Tech
Again giant PITA, I know, but what other choices do you have?
>
>
if it is a machine specific problem,  rebuilding structure may not help.
More useful may be to reinstall system - which is PITA, too.

What may help in such case (and is still PITA) is install Win developer
tools. Then crash should trigger low-level debugger and then it would be
possible to look which code crashed. That may point to particular plugin or
to 4D code. Not sure if it can point to component or component method,
though.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: SVG Eetracted to clip or png

2020-02-28 Thread Peter Bozek via 4D_Tech
Just use a XML commands and copy the node to another SVG files. AS SVG
files are XML documents, you can use any XML DOM commands to manipulate SVG
files.

Something like
$group:=DOM Find XML element by ID(oldSVGImage;$groupID)
If (OK=1)
  $newEl:=DOM Append XML element(newSVGImage;$group)
end if

Peter Bozek

On Fri, Feb 28, 2020 at 5:08 PM John J Foster via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Hi All,
>
> I have an SVG Doc which contains many  grouped objects. Each group has
> a unique ID (name).
>
> Sometimes I’d like to click on a part of the document, corresponding to a
> grouped object, and have it sent to the clipboard or saved as a png. Just
> the part of the document clicked on.
>
> Is there a technique to easily extract a  object into it’s own SVG doc
> so I can save just the selected group as an png?
>
> Yes, I could redraw each object that was selected but like to save that
> time if it’s possible.
>
> Thanks,
> John…
>
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: SVG Extracted to clip or png

2020-02-28 Thread Peter Bozek via 4D_Tech
On Fri, Feb 28, 2020 at 5:50 PM John J Foster via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Hi Peter,
>
> Ah yes thanks, I tend to forget that an SVG doc is in XML format.
>
> Sometimes the solution winds up being so simple in 4D.
>
> If the SVG doc uses  for displaying various glyphs in the  object
> I would assume that I need to also bring those into the doc?
>
>
Yes, then you need to handle that as well. What I do is parse properties of
objects that are copied - like "mask", "fill" or "clip-path" properties -
if they contain "url(id)" value,  and if 'url' is used, I 1. find defs
element with given id, 2. move it to target as well and 3. change id of
defs and value of url to new, unique value (alternatively you could check
if defs with given 'id' was already moved and not move it.)

If you have control over how are SVG generated, you can make sure that defs
are included within the same group, and make sure all defs have unique
id's. Then you just copy the group. I did not have control over SVG, so had
to use more complex approach.

Peter Bozek

Appreciate,
> John…
>
>
> > Just use a XML commands and copy the node to another SVG files. AS SVG
> files are XML documents, you can use any XML DOM commands to manipulate SVG
> files.
> >
> > Something like
> > $group:=DOM Find XML element by ID(oldSVGImage;$groupID)
> > If (OK=1)
> >   $newEl:=DOM Append XML element(newSVGImage;$group)
> > end if
> >
> > Peter Bozek
> >
> > On Fri, Feb 28, 2020 at 5:08 PM John J Foster via 4D_Tech <
> 4d_tech@lists.4d.com > wrote:
> > Hi All,
> >
> > I have an SVG Doc which contains many  grouped objects. Each group
> has a unique ID (name).
> >
> > Sometimes I’d like to click on a part of the document, corresponding to
> a grouped object, and have it sent to the clipboard or saved as a png. Just
> the part of the document clicked on.
> >
> > Is there a technique to easily extract a  object into it’s own SVG
> doc so I can save just the selected group as an png?
> >
> > Yes, I could redraw each object that was selected but like to save that
> time if it’s possible.
> >
> > Thanks,
> > John…
>
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

2020-02-04 Thread Peter Bozek via 4D_Tech
I believe this is related to other topic that was discussed here, namely
that you cannot get pointer to object properties. So there is no way how to
get a pointer pointing to Form.LB.Browser.en_edit.FirstName.

As you noticed, you can still manipulate such form objects with commands
that accept object name, but there are no such commands that would allow to
get / set object value.

What you maybe could do is, for example, is to use the same object name as
is the property name, and then you could use
Form[OBJECT Get name] := newValue

but the generic method for properties like
Form.LB.Browser.en_edit.FirstName would be a bit complex.

Peter Bozek


On Tue, Feb 4, 2020 at 4:35 AM Chris Belanger via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> What a weird ’subject’ for this question. Sorry. Seems quite confusing.
>
> 
>
> Say that the “variable or expression” for a on-screen object is
>  Form.LB.Browser.en_edit.FirstName
> This is entirely reasonable, as 4D’s ORDA has taught us to use such
> ‘expressions’ for the fields
>
> BUT in the script for this, there is no way to use Self (as there would be
> if it was a 4D variable) because it is an ATTRIBUTE of an object.
>
> This is stupid.
> It makes it impossible to write a script as simple as:
>
> Self->:= Uppercase(Self->)
>
> Because Self returns a nil pointer.
>
> So how on earth do we retrieve and set the value under these
> circumstances? [GENERICALLY; I do not want to use the object’s “expression”
> in the script]
>
> There is no such 4D method as   OBJECT Get Value( ) OBJECT SET VALUE( )
> If there were, we could write:
>
> OBJECT SET VALUE(*; OBJECT Get Name; Uppercase( OBJECT Get Value(Object
> Get Name) ) )  // really cumbersome, but is hypothetical because there is
> no ‘OBJECT GET / SET VALUE’ command.
>
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

2020-02-05 Thread Peter Bozek via 4D_Tech
On Wed, Feb 5, 2020 at 7:04 PM Add Komoncharoensiri via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Just a little modification from Peter's code
>
> Instead of defining an object attribute in the Variable and Expression,
> leave it blank so 4D will generate a dynamic variable for it. In the object
> method, you just need to execute the following when the On Data Change
> occurs.
>
> Case of
>: (FORM Event=On Data Change)
>   Form.en_edit.contact:=Self->
> End case
>
>
The second part of my code deal with initialisation of dynamic variable
from Form.en_edit.contact.

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

2020-02-05 Thread Peter Bozek via 4D_Tech
On Tue, Feb 4, 2020 at 9:58 PM Chris Belanger via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
> So I had to resort to creating a FORMULA OBJECT that gets executed to do
> the update of the .storeLoc
>
> $formula:=Formula from string($storeLoc+":="+Qu ($UUID))  // $storeLoc is
> the full ‘path’ of the attribute, such asForm.en_edit.contact
>
>   // $UUID is the value that needs to
> be put into that attribute (i.e. field)
> $formula.call()  // ...this updates it into the entity’s attribute
>
> Seems cumbersome to need to go about it that way, but it was the only way
> I could find to accomplish it. But at least it worked.
>

Another possibility - I have not tested it, so I am not 100% sure it would
work - would be not to assign  Form property to object, and rather leave
the expression empty. Then you would have Self-> and could get pointer to
object with OBJECT Get pointer (object named;) call.

However, you would have to bind the object to the form property yourself,
with code like

case of
  :((form event=on load) | (form event=on outside call))
 Self->:=Form.en_edit.contact
  :(form event=on data change)
  Form.en_edit.contact:=Self->
end case

Peter Bozek


> The complexity is that when I define the comboBox specs, the storeLoc must
> be text, like “Form.en_edit.contact"
>
> Seems counter-intuitive to need to resort to a similar mechanism just to
> coerce a way to update a value of a form object (i.e. a ‘variable’ on a
> form).
>
> Chris
>
>
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Dates and 4 digit years.

2020-01-17 Thread Peter Bozek via 4D_Tech
On Fri, Jan 17, 2020 at 10:33 PM Eric Naujock via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> I am running with 4d V17R5 and am seeing some odd date behaviors. When I
> search for a record with a date prior to 1921 I get all records in the
> database. Though most of the records are have dates newer than 1985. This
> is rather odd. I am not sure if this is due to 4D playing games with the
> pivot year that
>

May not be related, but note that, as far as I remember,  4D docs for SET
DEFAULT CENTURY command used to contain as example
SET DEFAULT CENTURY(19;20)

I have seen this code in several databases. This line causes change of
behaviour at 1.1.2020.

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Reading and writing large arrays to disk

2020-01-06 Thread Peter Bozek via 4D_Tech
Mitch,

If the speed is the issue, you may try to write/read array elements to disk
using SEND PACKET / RECEIVE PACKET. If you want to speed up reading, insert
number of elements into first line, like

Create document
SEND PACKET(file;Size of array(arrayElement)+"\n")
loop for all elements in array
  SEND PACKET(file;arrayElement{}+"\n")
end loop
Close Document

and vice versa

Open document
RECEIVE PACKET(file;$t;"\n")
arraySize:=Num($t)
array text(arrayElement;arraySize)
for 1..arraySize
  RECEIVE PACKET(file;$t;"\n")
  arrayElement{}:=$t
end for
Close Document

The above should avoid a part, where you (or 4D) is resizing a big memory
block to insert additional array elements.

--
Peter Bozek


On Mon, Jan 6, 2020 at 5:09 AM Mitchell Shiller via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Hi,
>
> I have large string arrays (about 200 k elements).
> I need to write and read them to disk.
> Speed is the most important criteria.
>
> Options
> 1) Create a text variable (loop with CR delimiter) and then TEXT TO
> DOCUMENT.
> 2) VARIABLE TO BLOB, COMPRESS BLOB, BLOB TO DOCUMENT
> 3) OB SET ARRAY, JSON STRINGIFY, TEXT TO DOCUMENT
>
> Obviously using the reverse commands to read from disk.
> Option one seems by far the slowest.
>
> Anyone know if 2 or 3 is faster?
> Does the COMPRESS BLOB help? The resultant file is about 2 MB in size
> without compression.
> If yes to COMPRESS BLOB , Any différence from native 4D vs. GZIP
> compression?
>
> Thanks as always.
>
> Mitch
>
>
>
> Sent from my iPad
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Active Listbox/Form while listbox dynamically built

2020-03-09 Thread Peter Bozek via 4D_Tech
We did something similar with colleague, some time ago, not in 4D, but idea
would be similar:

1. we initialised arrays to proper size (amount of data was know
beforehand). At that moment, user would see an area with empty lines
2. we run a process that calculated the lines and updated arrays and area.
3. as a optimisation, we did not calculated all lines, only a small part
(256?) so the area would display something immediately. When the user
scrolled down, process started to calculate lines from scroll position.

Implementing it in 4D would be quite straightforward: process that display
LB wold initialise empty arrays and will launch process or worker that
calculates values. Worker then calls CALL FORM periodically with values -
per line or group of lines -  and called method inserts calculated values
into displayed arrays. 4D would handle the update of LB, process with LB
would not be frozen and user would be able to see how are the values
filling the area.

Using workers would allow implementation of point 3. quite straightforward,
but it may not be necessary. As a first  step, I would let worker calculate
all lines. Only if calculation takes too long (minutes) I would try to
adjust worker call so it calculates only displayed lines.

HTH,

Peter Bozek


On Sun, Mar 8, 2020 at 7:38 PM John J Foster via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Hi All,
>
> 4D v17 R5 (Mac and Windows single user standalone)
>
> I have a list box that needs to be built and available before the
> calculation is complete. In this case I have some searches looking for
> particular conditions and when found add them to the listbox. They could
> easily take a few seconds to I’m guessing a  minute or more. The searching
> could span 50-60 sub searches within a 100 years of daily data (Think daily
> stock market data but it’s not for the stock market).
>
> So I would like a strategy:
>
> - so that list box remains available as it’s being built.
>
> - the screen is not frozen as it’s being built.
>
> - The list box fills as each row is found/added and can be seen
> rebuilding.
>
> I’ve seen this kind of thing in a windows app (not 4D) and I’d like to
> emulate the behavior.
>
> I need a strategy I’m guessing that involves another process which knows
> how to communicate back to this form/listbox. Is this where workers could
> be helpful?
>
> Does anyone have some snippets of code I could see to visualize the
> process?
>
> Appreciate,
> John…
>
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Active Listbox/Form while listbox dynamically built

2020-03-09 Thread Peter Bozek via 4D_Tech
On Mon, Mar 9, 2020 at 4:46 PM John J Foster via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Hi Olivier,
>
> I think I’m so use to thinking of a process, aka CALL WORKER, as being
> independent. The variables are of the process. So in this case that would
> have to mean that the listbox and arrays are seen and updated in both the
> form and the process.
>
> Is that right?
>

In fact, worker cannot share variables with another process (think of
worker as another process running on another processor, not sharing the
memory with main process.) But worker can call a method with CALL FORM and
pass a parameters to that call, and the parameter can be, for example, an
object with embedded values.

Peter Bozek

>
> John...
>
>
> > Try to see CALL FORM as "execute this project method in the context of
> this form", similar to EXECUTE METHOD IN SUBFORM
> >
> > So, the method you execute should update/fill the listbox.
> >
> > e.g. CALL FORM ($WinRef;"MyListboxUpdateMethod";$ObjectWithData)
> >
> > Best,
> >
> > Olivier
> >
> >> On Mar 9, 2020, at 6:33 AM, John J Foster 
> wrote:
> >>
> >> Hi Jeremy,
> >>
> >> OK, conceptually then:
> >>
> >> LB Form (array based - 5-8 arrays) -> Search button spawns CALL WORKER
> >>
> >> So then CALL WORKER searches and as it finds a match it returns them
> via CALL FORM (perhaps in an object) and then the listbox rows are
> processed…
> >>
> >> So the question is - since CALL FORM doesn’t seem to cause an event and
> since the search data found and returned is from another process - how does
> the Listbox “know” to build (append to array) itself or add to itself as
> data arrives? How is the Listbox updated?
> >>
> >> Reviewed the few examples in the KB and HDI and I’m not seeing what I
> need to do. Probably too simple and I’m thinking more complicated.
> >>
> >> Any further code fragment or small examples?
> >>
> >> Appreciate the feedback,
> >> John…
> >>
> >>
> >>>
> >>> Have a look at CALL WORKER and CALL FORM.
> >>>
> >>> Start the data build in a new process using CALL WORKER.
> >>> Have the worker process prod the form into updating the listbox from
> time time using CALL FORM.
> >>>
> >>> I’ve implemented something much more trivial and it works nicely.
> >>>
> >>> Jeremy
> >>>
>  Hi All,
> 
>  4D v17 R5 (Mac and Windows single user standalone)
> 
>  I have a list box that needs to be built and available before the
> calculation is complete. In this case I have some searches looking for
> particular conditions and when found add them to the listbox. They could
> easily take a few seconds to I’m guessing a  minute or more. The searching
> could span 50-60 sub searches within a 100 years of daily data (Think daily
> stock market data but it’s not for the stock market).
> 
>  So I would like a strategy:
> 
>  - so that list box remains available as it’s being built.
> 
>  - the screen is not frozen as it’s being built.
> 
>  - The list box fills as each row is found/added and can be seen
> rebuilding.
> 
>  I’ve seen this kind of thing in a windows app (not 4D) and I’d like
> to emulate the behavior.
> 
>  I need a strategy I’m guessing that involves another process which
> knows how to communicate back to this form/listbox. Is this where workers
> could be helpful?
> 
>  Does anyone have some snippets of code I could see to visualize the
> process?
> 
>  Appreciate,
>  John…
> 
> 
> >>>
> >
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Active Listbox/Form while listbox dynamically built

2020-03-09 Thread Peter Bozek via 4D_Tech
On Mon, Mar 9, 2020 at 5:52 PM John J Foster via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Hi Peter,
>
> I haven’t used CALL WORKED/CALL FORM yet. I’ve seen some tutorials by John
> Baughman which made sense when I watched them. But a different context I
> think.
>
>
Idea is as follows: you cannot share memory (variables...) between worker
and another process. But you can pass parameters to method running in
another process.

So you need one method, that calculated content of displayed array, and
packs the calculated values into object with, say, OB Set array, and this
method runs in the worker, and another method that receives the object as a
parameter, extracts the values from objects and inserts them into arrays
displayed by LB.

CALL WORKER is called with first method as second parameter and runs inside
worker, second method is passed as a second parameter to  CALL FORM and
runs in the process of the form.

I guess that’s why my brain is not seeing this clearly yet.
>
> My search form has a bunch of variables including a date range, a source
> and target arrays that it needs to loop through and a mother array list.
> The search will go something like:
>
> Loop through Source array
> for this Source{index}...
>Loop through Target array
>for this Target{index}...
>   Loop through Aspect array
>   for this Aspect{index}…
>  Call this search method for tis date range…
>  As rows are found build the listbox   <--
>

instead of this line, you would, after, say, each N lines, pack the data
into object and call CALL FORM

Another method (2nd parameter of CALL FORM will unpack data and build
listbox.

 Pseudocode would be:

Method_Worker:
receives window reference in $1
loop through data
  each 50 records
calculate values
  end each
  pack last 50 lines into object
  CALL FORM(window reference;"Method_Form";object)
end loop

Method_Form
receives object in $1
extract object into arrays
loop through values in arrays
  insert values from passed arrays into listbox
end loop

then form in On load, calls
CALL WORKER("worker name;"Method_Worker";window reference of itself)

Form method does not call Method_Form or do anything.

HTH,

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Active Listbox/Form while listbox dynamically built

2020-03-09 Thread Peter Bozek via 4D_Tech
On Mon, Mar 9, 2020 at 6:22 PM John J Foster via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
> Ref: "An easier way to think of CALL FORM is to look at it as the old ON
> OUTSIDE CALL event in a form, but with the added bonus of being able pass
> data to the form as parameters from the calling process, without using
> global variables."
>
> I kind of get that but can’t see where the form captures as event (we
> don't have On Call Form) so I know where to append to the listbox with the
> new rows/data as it’s being returned.
>

It does not. Method specified in CALL FORM is called in the form  just like
form method, but is not part of form method, nor is it called from form
method.

pB


>
> Does that make sense? That’s where my confusion lies.
>
> John…
>
>
>
> > On Mar 9, 2020, at 9:42 AM, John J Foster  wrote:
> >
> > Hi Peter,
> >
> > Yea, that’s what I thought!
> >
> > So trying to understand (aka, visualize in my minds eye before I code)
> how to correctly get back the rows being returned from another process. I
> am thinking of some sort of object.
> >
> > I’m still trying to follow Olivier’s explanation “try to see CALL FORM
> as "execute this project method in the context of this form", similar to
> EXECUTE METHOD IN SUBFORM”.
> >
> > Anyway, reviewing your previous thoughts.
> >
> > Appreciate,
> > John…
> >
> >
> >> On Mar 9, 2020, at 9:24 AM, Peter Bozek  wrote:
> >>
> >> In fact, worker cannot share variables with another process (think of
> worker as another process running on another processor, not sharing the
> memory with main process.) But worker can call a method with CALL FORM and
> pass a parameters to that call, and the parameter can be, for example, an
> object with embedded values.
> >
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Longitude Index: B-Tree or Cluster

2020-04-14 Thread Peter Bozek via 4D_Tech
John,

 I do not think using text for dat that can be represented by number is a
good idea. It require more memory - do not forget that Unicode uses 2 bytes
for each character - and manipulation of bigger data structures is slower,
but, especially, string manipulation, including comparison, depends on a
locale, and is using a build-in ICU library. It means that, instead of
comparing two numbers, you have all the overhead of calling a library
function that applies potentially multi-pass comparison algorithm using
mapping tables to two strings. Definitely, much slower.

Second, regarding standard and cluster index: as I understand it - and I
may be wrong, 4D in general does not publish technical info - B-Trees
(there are several types of them) offer optimal performance when result of
search contains few records, can well do a range search, as traversing the
tree is reasonably fast, but may be less effective when returning a big
selection, as building a selection can be time consuming. How much slower
depends, but IMHO it will be still pretty fast, unless the selection is
huge.

Cluster index is suitable when the result of search is a (potentially
large) selection. While B-tree node stores a reference to a record, Cluster
index node stores a selection, so no selection building is needed. However,
if I would design such an index, I would use hash table for cluster index.
Hash table is much faster when you need to find one particular value, but
is totally unsuitable for range searches, as it cannot be effectively
traversed. That make a perfect sense for foreign key indexes - when loading
1-record, you have immediately a selection of N-records available, and you
(almost) never do a search for range of foreign keys (with UUID keys, such
search would not make any sense.)

So my advice would be to go for representation of position with reals and
use standard index. Although speed difference may be small for middle-size
data (how many locations there may be?)

HTH,

Peter Bozek

On Tue, Apr 14, 2020 at 9:17 PM John J Foster via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Hi Arnaud,
>
> I have split out the longitudes into a text and real component. I have
> formatted the longitudes as “000” and if west of GMT prefixed with “-“ and
> if east prefixed with “+“. I'll do something similar with latitudes and
> then try building some radial searches and see.
>
> Since all string is text is there a still a way to tell 4D that a field
> and thus an index is a fixed size?
>
> Anyway we shall see if theory and implementation matches!
>
> Appreciate,
> John…
>
>
>
> > On Apr 14, 2020, at 12:00 PM, 4d_tech-requ...@lists.4d.com wrote:
> >
> > From: Arnaud de Montard mailto:arn...@init5.fr>>
> > Subject: Re: Longitude Index: B-Tree or Cluster
> > Date: April 14, 2020 at 2:23:26 AM PDT
> > To: 4D iNug Technical <4d_tech@lists.4d.com  >>
> >
> >
> >
> >> Le 13 avr. 2020 à 19:36, Bernard Escaich via 4D_Tech <
> 4d_tech@lists.4d.com > a écrit :
> >>
> >> Hi John,
> >>
> >> From the top of my head, indexes on long are less efficient than on
> text values ; I have a doubt, perhaps only for updating.
> >
> > I'd think the opposite, an index based on a "fixed length" field is
> always more efficient (search, update…) than one based on a "variable
> length" field.
> >
> > --
> > Arnaud de Montard
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Longitude Index: B-Tree or Cluster

2020-04-21 Thread Peter Bozek via 4D_Tech
On Tue, Apr 14, 2020 at 11:12 PM Tim Nevels via 4D_Tech <
4d_tech@lists.4d.com> wrote:

>
> > traversed. That make a perfect sense for foreign key indexes - when
> loading
> > 1-record, you have immediately a selection of N-records available, and
> you
> > (almost) never do a search for range of foreign keys (with UUID keys,
> such
> > search would not make any sense.)
>
> Many years ago at a 4D Summit I remember someone asking Laurent a question
> of how Cluster B-Tree indexes were implemented. He gave a fairly detailed
> answer.
>
> Cluster B-Tree indexes are a B-Tree index, but there is only 1 node for
> each index value. The data in the node can be several different things.
>
> - It could be a reference to a single record like you would have in a
> traditional B-Tree index. It’s just a record number.
>

From this it seems that Cluster index is an improved  standard index,
reverting back to record-per-leaf standard B-tree in case of unique values.
I would almost say that this should be the default setting for all indexes,
as it does not seems to have any drawbacks.

Did LR said why we should use the standard index at all?


--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Worker and UI

2020-03-27 Thread Peter Bozek via 4D_Tech
On Fri, Mar 27, 2020 at 5:29 PM Jeremy Roussak via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> v18.1, Mac
>
> What can a worker process do by way of UI? Are there any restrictions?
>

I am not sure what you want to achieve, but yes, there is a restriction: no
UI for worker. None.  Worker cannot display anything.

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Worker and UI

2020-03-27 Thread Peter Bozek via 4D_Tech
On Fri, Mar 27, 2020 at 8:01 PM Douglas von Roeder 
wrote:

> Peter:
>
> "Worker cannot display anything.”
> Why do you say that?
>

My understanding of a worker is a process that can (potentially) run on
different core or processor - what means, communicating with other
processes with messages only, limited ability to share data, no
interprocess variables, no GET / SET PROCESS VARIABLE and no UI.

However, thinking about it, as user process is a worker, and it should be
able to display UI, collaborative workers may be able to display UI. But
all 4D examples of worker's code use CALL FORM to display UI, so I would
not try to display UI from a worker.

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Worker and UI

2020-03-27 Thread Peter Bozek via 4D_Tech
On Fri, Mar 27, 2020 at 9:14 PM Douglas von Roeder 
wrote:

> Peter:
>
>  "My understanding of a worker is a process that can (potentially) run on
> different core or processor - what means, communicating with other
> processes with messages only, limited ability to share data, no
> interprocess variables, no GET / SET PROCESS VARIABLE and no UI.”
> I don’t see anything that indicates that the means by which a process is
> created impacts whether or not that process runs preemptively. Most UI
> commands are not preemptive.
>

I believe that above commands cannot be used with workers even if worker
does not run preemptive method.


> "However, thinking about it, as user process is a worker, and it should be
> able to display UI, collaborative workers may be able to display UI.”
> Process 1 will display UI in V18, compiled.
>
> "But all 4D examples of worker's code use CALL FORM to display UI, so I
> would not try to display UI from a worker."
> Call form is a means of communicating with a form. It doesn’t tie back to
> how a process is invoked.
>

In the examples, worker never displays UI, rather uses CALL FORM to display
its status in form displayed in another process. As I understand it, it is
not just because examples wanted to demonstrate communication between
worker and another process, but a feature of worker - it needs another
process to display UI. But will try to do a simple test database to check
it out.

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Using the length parameter in a ORDA query.

2020-04-27 Thread Peter Bozek via 4D_Tech
On Mon, Apr 27, 2020 at 6:54 PM Eric Naujock via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> I am trying to preform an unusual query. I em effectively thing to find
> all the records in a parent where the parent has children. Any suggestions
> other than build a collection of records primary keys and use an “in”
> conditional. Which feels dirty.
>
>
> This this case I have a table “cases” with records and a Child table with
> records. There is a one to many relationship from child to parent with a
> return path of “childReference_return” I am looking for all the parents who
> have children. There is more to the query but I am only looking at this
> parent child element.
>

Not sure if I understand it, but why not to select all children and map
them to parents?  You would have something like this:

$records:=ds.Children.all().parentReference

where parentReference is name of relation from Children to Parents tables.

HTH,

Peter Bozek



>
>
> I have tried using something like.
>
> $records:=ds.Parents.query (“childReference_return.length>0”)
>
> But when I do this I get null back.
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Using the length parameter in a ORDA query.

2020-04-27 Thread Peter Bozek via 4D_Tech
On Mon, Apr 27, 2020 at 8:19 PM Eric Naujock  wrote:

> Thanks Peter.
> That could be considered but the part I asked about was only part of the
> query, In reality it had more parts to the query. Where essayWordCount is
> an long integer.
>
> $records:= ds.Parent.query (“essayWordCount >100 and
> parentReference_return #null)
>

Eric,

yes, that was clear that this is just simpified case, but still, cannot you
use something like

records:=ds.Children.query(essayWordCount >100 &
otherChildCondition).parentReference.query("conditions for parent...")

Peter Bozek


>
> I have one monster query that is generated by concatenating strings to
> build the query part and Objects creating the parameters passed to the
> query.
>
> I have used code like you example in my parking lot function.
>
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: V18 ORDA — What is the Best substitution option for BLOB fields

2020-04-24 Thread Peter Bozek via 4D_Tech
Look at BASE64 ENCODE / DECODE

https://doc.4d.com/4Dv17/4D/17.4/BASE64-DECODE.301-4882388.en.html

Peter Bozek


On Fri, Apr 24, 2020 at 9:05 AM Chris Belanger via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> ORDA does not support BLOB fields. So I need a different way of storing
> things that would normally be BLOBS as TEXT.
> (in particular, system DOCUMENTS such as PDFS, JPGS, etc).
>
> I am trying to work-around by converting BLOB -> TEXT -> BLOB
> 
> The key statements to work around the ‘BLOB’ problem are:
> $en_Lib.UpdBLOBText:=Convert to text($blob_File;"UTF-16")   // To save
> the BLOB as a TEXT field
>
> CONVERT FROM TEXT([Lib]UpdBLOBText;"UTF-16";$Blob)  // to
> convert the TEXT back into a BLOB, so it can be written as a system document
> 
>
> I am not actually storing the documents in the database, but wanting to
> have a mechanism to ‘transport’ a document to the 4D Server so it can
> manage the document creation ‘on disk’ in the TRIGGER. Basically, I am
> managing a ‘LIBRARY’ of documents that are stored on the machine hosting 4D
> Server.
>
> My methodology seems to works fine:
>
> EXPLANATION:
> • on CLIENT:   Document is read from Disk [as a BLOB], converted to a TEXT
> field and SAVED.  [Lib]
> • on 4D SERVER: In the [Lib] Trigger method, if there are contents in
> [Lib]UpdBLOBText, then the update is made in the document library
> then, the [Lib]UpdBLOBText field is BLANKED OUT so reduce data
> size, obviously.
>
> // ON THE CLIENT MACHINE:
> // READ THE CONTENTS OF A FILE FROM DISK, STORING IT INTO THE
> [Lib]UpdBLOBText field to be processed by its TRIGGER on SAVE
>
> $droppedFile is a FILE OBJECT made withFile( path ). The object is
> good. I use the ‘Folder’ methodology:
> $blob_File:=$droppedFile.getContent()   //
> get the contents of the disk file as a BLOB (which was dropped onto a drop
> variable)
> $en_Lib.UpdBLOBText:=Convert to text($blob_File;"UTF-16")   // update
> this to the UpdBLOBText.
>
>
> // WHEN A [Lib] RECORD IS SAVED, THEN IN THE [Lib] TRIGGER the following
> is done on the 4D Server machine:
> //
> …..
>
> $theFile:=File(Storage.folder_docLibrary.path+$localPath)   //
> set up the DESTINATION ON DISK for this file
> CONVERT FROM TEXT([Lib]UpdBLOBText;"UTF-16";$Blob)  // convert
> the TEXT back into a BLOB
> $theFile.setContent($Blob)
>   // deposit the BLOB into the disk File
> [Lib]UpdBLOBText:=“”
>   // CLEAR OUT ITS CONTENTS
>
> 
>
> For a number of file types, this works fine. But for MS Word documents I
> get a warning when I open them up:
> "Word found unreadable content in "2002001A Permit 1 Chris Belanger
> IS-821A.docx". Do you want to recover the contents of this document? If you
> trust the source of this document, click Yes.”
>
> When I Click YES, the document appears to be fine: no visible mess-up.
> But I suspect my BLOB Work-Around is messing with the file contents in
> some way.
>
> What are the best parameters to use for converting BLOB -> TEXT -> BLOB ?
>
> Thanks,
> Chris
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Drag and drop replacement command(s)?

2020-09-14 Thread Peter Bozek via 4D_Tech
On Mon, Sep 14, 2020 at 12:35 AM Keith Goebel via 4D_Tech
<4d_tech@lists.4d.com> wrote:
>
> So, if I am understanding you correctly, we need to replace the command with:
> - create an object during On Begin Drag Over (source object)
> - store the source listbox variable (pointer/name?) and its current 
> element in the object (will test if dragged element is known at this point)
> - store the stringified object onto text pasteboard
> - trap On Drop event for target listbox and extract source info from text 
> pasteboard
> - load JSON object back from text pasteboard
> - extract source listbox (pointer/name?) and dragged element from object
> - continue process as usual

It seems complex, but it is not. Pseudocode would look like this:

In sourcce object:

: (Form event code=On Begin Drag Over)
C_BLOB($x)
CLEAR PASTEBOARD
... pack data you want to move to $x
APPEND DATA TO PASTEBOARD("my.unique.signature";$x)

: (Form event code=On Drag Over)
GET PASTEBOARD DATA TYPE($signatures;$nativeTypes;$formatNames)
If (Find in array($nativeTypes;"my.unique.signature")#-1)
  $0:=0  //The drop is accepted
Else
  $0:=-1  //The drag is refused
End if

In target object:

: (Form event code=On Drop)
GET PASTEBOARD DATA TYPE($signatures;$nativeTypes;$formatNames)
If (Find in 
array($nativeTypes;"ch.prozessTeam.dentalProzess.Mitarbeiter.unused")#-1)
  GET PASTEBOARD DATA("my.unique.signature";$x)
  ... unpack $x into data and insert / do whatever is needed
End if

This is, in fact, much simpler approach - you do not need to care
about process / interprocess D, with command SET FILE TO PASTEBOARD
you can D to system or other application etc. You can decide from /
to which object data can me dragged by selecting your own signatures,
or do a generic D by putting text / files to pasteboard.


--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
New Forum: https://discuss.4D.com
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: SFTP & PGP Encryption

2020-10-13 Thread Peter Bozek via 4D_Tech
On Wed, Oct 14, 2020 at 3:03 AM Tarawerkz via 4D_Tech
<4d_tech@lists.4d.com> wrote:

> 1.  to provide an external facing SFTP through which the enterprise SAP can 
> connect to ?

SFTP is a protocol running under SSH, and while 4D contains OpenSSL
library, to provide SSH functionality is far outside the scope of data
/ application / web server, what 4D is. But both Mac and Windows OS
should contain support of SSH and thus SFTP. All that user will have
to do is enable and configure it, on Mac it is matter of checking a
checkbox in preferences, on Windows it may be a bit more complex, see
https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview
. With older Windows versions, client may have to install third-party
SSH server.

>
> 2.  to support this connection via PGP encryption (to pick up files which the 
> 4D application will generate in CSV format) ?

PGP is a specific (open-source) implementation of public key
encryption. While 4D supports public key encryption, it may be simpler
to instal PGP on user's machine and let 4D encrypt the exported files
with PGP command line interface.

>
> Is the new version of 4D (or v18) able to support such features?

Not as something developer can switch on with a checkbox. Both SFTP
(SSH) and PGP are not very user friendly, and require some knowledge
how to set it up and use, but this is not that hard and what your
client requests should be definitely doable.

HTH,

Peter Bozek
**
4D Internet Users Group (4D iNUG)
New Forum: https://discuss.4D.com
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

4D View Pro question

2020-07-12 Thread Peter Bozek via 4D_Tech
Or rather, two: I play with conversion of 4D View to 4D View pro, and while
it seems it goes OK, I run into one problem: in 4D View it was to possible
to set column headers with PV SET COLUMN HEADER call. I did not found the
way how to set column headers in View Pro, and did not found a way how to
do that through UI, but converted areas have renamed column headers, so it
is possible.

One way that should work is to manipulate view pro object properties. But
call Import from / Export to object seems to be quite slow, so maybe there
is a better way?

And second question: as View Pro is extended LB area, is that posiible to
use LB calls to manipulate View Pro area? If yes, in what part of
documentation I can find which calls work?

Regards


--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
New Forum: https://discuss.4D.com
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Attempt to read beyond end of stream

2020-12-03 Thread Peter Bozek via 4D_Tech
On Thu, Dec 3, 2020 at 4:59 PM Tarawerkz via 4D_Tech
<4d_tech@lists.4d.com> wrote:
>
> Thanks Chip,
>
> I’ll try that, hopefully can find a version from not too far back.
>
> Any idea what could have caused this?

My info is not very recent, but few years ago I analysed structure of
data and structure file. There are many auxiliary structures, but
actual data are stored in blocks, where each block have a prefix,
containing, between other, size of the block. If this field got
corrupted and contained some ridiculous big value, 4D would crash when
reading the data with the "Attempt to read beyond end of file ..."
error,

This error was hard to fix, because restore did not help (when it did
not read content of blocks) or crashed as well (when it did.) When
problem was in data file, error happened when 4D accessed particular
record, then it was possible to find that record in file and fix it
with hex file editor. With structure this would be much harder.

So, if this is the case, I am afraid you probably do not have other
solution then go to stable backup and then try to copy changes, if you
can open structure without crash. What I would suggest is to try to
exclude all other sources of problem, maybe moving the structure to
new empty folder, no plugins, components, settings or logs.

Regards,

Peter Bozek


>
> Regards,
> Ronnie
> Tarawerkz
>
>
>
**
4D Internet Users Group (4D iNUG)
New Forum: https://discuss.4D.com
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: 4D scanning

2021-06-19 Thread Peter Bozek via 4D_Tech
On Thu, Jun 17, 2021 at 5:55 PM Peter Mew via 4D_Tech <4d_tech@lists.4d.com>
wrote:

> Hi
> I havent done any of this for a while so Im a bit! rusty.
> I looking to download Miyakos twain plug in, Where do I find it? or is
> there a better plugin that will capture scans and work with 4D v13 mac and
> PC preferably free
> thanks
>

I tried different ways how to communicate with scanner, and currently I am
using ability of most scanners to pass the scanned file to selected
application. So user set 4D app to receive scanned document, and 4D process
dropped file in application On drop method.

This works fine when it is 4D application that mostly communicates with
scanner - for example when scanner is used as document scanner for DB
application.

QR code scanner was able to insert  scanned text into pasteboard, this
makes communication immer simpler.

-- 

Peter Bozek
**
4D Internet Users Group (4D iNUG)
New Forum: https://discuss.4D.com
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: [4D v18.3; Mac {10.13.6} + {10.15.7}] LEP-voodoo

2021-03-04 Thread Peter Bozek via 4D_Tech
On Thu, Mar 4, 2021 at 1:59 PM Jörg Knebel via 4D_Tech
<4d_tech@lists.4d.com> wrote:
>
> $FoDoPath:=Get 4D folder(Current resources folder)
> $FoDoPath:=Convert path system to POSIX($FoDoPath)
>
> $cmd:=$FoDoPath+"./imagesnap -w 2.0 "

Jörg,

what seems suspicious to me is the "./" in above.

"./" is used as a "current folder" path, so IMHO it should not be used
when you construct a full path. You should execute
"/DATA/4Dƒ/TTTCorev18/TTTCorev18.4dbase/Resources/imagesnap -w 2.0"

BTW, you should enclose path in parenthesis, in case your path contains spaces.

Second thing, what I found sometimes useful, especially when I need
several command to execute, is write commands in separate .sh file and
then execute the commands with LEP command "sh pathToFle.sh".

Regards,

-- 

Peter Bozek
**
4D Internet Users Group (4D iNUG)
New Forum: https://discuss.4D.com
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Search & menu questions

2021-10-29 Thread Peter Bozek via 4D_Tech
On Fri, Oct 29, 2021 at 1:25 AM Stephane Potvin via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Hello all.
>
> Hoping someone can help me.
>
> I have two questions.
>
> 1. My partner provides piano tuning services and I built a DB for us to
> keep track of her clients, their pianos, and the tuning/services she
> provided on each piano.
> Main table is client information, linked table for services provided.
>
> So that I can contact clients who have not had their piano tuned in a year
> of more, I want to search for only those clients whose last service was a
> year or more ago.
>
> Is there a not too complicated method that will accomplish that?
>

Stephane,

I would do the task in several steps:
1. Find out all clients that are eligible for tuning service - maybe this
are all clients, maybe you may want to restrict them to active   clients
(say, ordered some service in last 5 years.)
2. Find all treatments after specified date, and project selection of
treatments into Client table - this will create a set of clients that
had tuning service after specific date.
3. make a difference between two sets.

The actual code becomes exceptional simple with ORDA, where it would look
like (coode not tested)

var $allClients; $tunedClients; $notTunedClients : cs.ClientSelection

$allClients := ds.Client.all()
$tunedClients := ds.Tuning.query("TuningDate >=
:1";$tunedAfterDate).TuningToClientRelation
$notTunedClients := $allClients.minus($tunedClients)

Client and Tuning are names of tables, TuningToClientRelation is the name
of the relation from Tuning to Client table.

The same can be achieved with old syntax, using sets.


> 2. Having migrated my db to v. 18, the File, Edit, and User menus display
> numbers instead of text menu items. (see attached)
>
> How can I get the menus to display properly in MacOSX 10.14.6?
>

Menus should work properly, I converted several DBs. You have not included
screenshot, but just screenshot probably is not sufficient to find out
where is the problem.

HTH,

-- 

Peter Bozek
**
4D Internet Users Group (4D iNUG)
New Forum: https://discuss.4D.com
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**