Pascal Foubert | 1 Aug 2010 03:36
Favicon

Re: v11 composite keys


> Hi there,
> 
>> How do you query using a composite key in v11
> 
> You can create a Composite index in 4D v11 SQL, if that's what you mean.  The query must use the fields in the
same order as what was defined for the index.  You can verify whether or not it's working by checking the
query path.
> 
>> How do you set unique attribute for key
> 
> Unique is a field attribute.  Composite indexes are...well...indexes.  So you can't enforce uniqueness
based on the index.
> 
> I think maybe you're looking at Composite indexes and thinking they are composite fields?  They are not.
> 

And in V12 ?
in DB2 and SQL you can set the primary key as unique even if the primary key is composite

So do you mean it's impossible to set the unique attribute on a composite primary key, but only on a field (so
not a combination of fields) ?**********************************************************************
Join 4D experts from around the world this October:
http://4d.com/company/events/summit2010.html 

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-Unsubscribe@...
(Continue reading)

David Adams | 1 Aug 2010 12:40
Picon

V11 import strategies

I need to regularly import an enormous file into 4D V11. This thing is
huge, a couple of GB of data in a text file. Depending on hardware, it
can take 4D about half an hour just to load the import editor. Having
spent no time comparing import methods in 4D since the 1980's, I'm
hoping someone can make a suggestion on the easiest way to do imports.
I can very easily make sure the source import file is always in the
same place, with known delimiters, and with known fields in a specific
order. The import file itself is the easy part.

The source file is text, not XML. I do _not_ want to write a custom
parser. I'm looking for something easy to implement and fast, if there
is such a thing.

For the moment, I'm not worrying about importing into an existing data
file - I may just create a fresh data file each time, so it's just as
good to think of this as a one-off import...that I do regularly.

I did manage a test import (it's about 20 fields with one index) and
was impressed at how well 4D did at searching across millions of rows.

Advice appreciated.
**********************************************************************
Join 4D experts from around the world this October:
http://4d.com/company/events/summit2010.html 

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-Unsubscribe@...
(Continue reading)

David Dancy | 1 Aug 2010 13:32
Picon

Re: V11 import strategies

Easy: check out the IMPORT TEXT command. All you need to make it work
is an INPUT FORM whose fields/variables are set up in the order of
fields in the input file. Change delimiters to suit, select an
appropriate character set (if the default UTF-8 isn't any good) and
you're done. Looks pretty simple, and from past experience I'm
reasonably sure it will still be reliable.

Fast: custom parser combined with a file buffer optimised for the disk
hardware/OS combination.

There may be a compromise somewhere in the middle, but since you've
asked for easy, I'd go for Easy first, then make a Fast import if Easy
isn't fast enough. :)

HTH

David Dancy
Sydney, Australia

On 1 August 2010 20:40, David Adams <dpadams@...> wrote:
> I need to regularly import an enormous file into 4D V11. This thing is
**********************************************************************
Join 4D experts from around the world this October:
http://4d.com/company/events/summit2010.html 

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-Unsubscribe@...
(Continue reading)

David Dancy | 1 Aug 2010 14:05
Picon

Re: Components and process vars

1. Yes.

2. Yes. Every component's variables are in their own memory space,
separated off from both other components and the host. I can have a
variable X in the host, and another variable also named X in the
component, and they will be different (they can also be of different
types even if they have the same name). Each host process will get a
copy of the host X; each component process will get a copy of the
component X. The variable is not shared among all components; it only
exists in the component in which it is defined. Components can't
access any host variables, and hosts can't access any component
variables either. The exception to this rule is when one (host or
component) passes a pointer that points to a variable in its own space
to the other (component or host). The recipient can use the pointer to
access the variable being referenced (but can't get at any other
variables through the pointer).

3. Process variables are initialised the same way for both host and
component. Running interpreted, the interpreter automatically
initialises non-array variables when each process (including the
User/Runtime process) starts up. The compiler generates code to do the
same thing for compiled mode. You can set the initial value for all
non-array variables in the compiler preferences. Arrays in both
situations must be specifically initialised and given a size, with the
ARRAY ... command. This is a bit of an oddity because there is no
"declaration" statement for arrays; the only way you can "declare" an
array is by initialising one with a particular size.

Bear in mind also that the host may be running interpreted while
component is running compiled. If the host runs compiled, and the
(Continue reading)

Ben Kershaw | 1 Aug 2010 16:33

Re: Components and process vars

Chris Belanger wrote:

>1) Do/can components create their own processes?
>2) Do components automatically get a set of their own process variables for each >process the host opens?
>2a) If so, how are they initialized?

>I realize that the variables used in a component are insulated from the ones used in >the host.
>I'm just wondering how process variables work in a component; whether they are >created automatically
whenever the host creates a process.

Chris,

1) Yes, they can create their own processes, and these processes look and act like processes created from
the host. However, if you want to run a host method via a New Process call from the component, the host method
must be shared with the component. Another way to do it would be to have a proxy method in the host that gets
called from the component, and have the proxy method actually launch the process. For example, let's say
you have a wrapper method for New Process that is in a component, and you pass it the method name to launch.
You have hundreds of calls to this wrapper method in your host, and you don't want to set the 'shared'
attribute for all those methods. You could have your wrapper method call EXECUTE
METHOD("MyHostProxyMethod";*;"MethodForNewProcess"). The "MyHostProxyMethod" method would take
"MethodForNewProcess" as the first parameter, and use it for the New Process call. This way, you don't
have to set the Shared attribute for all those methods in the host that will get launched from the component
(just make sure to set it for the proxy method).

2) The process variables exist for both the host and the component, but they are in different "namespaces"
(for lack of a better term) and will hold different values. For example, you could have a process variable
"MyLongintVar" in the host with a value of 10, and one in the component with a value of 2112. A better way to
handle it: don't use similar variables names in host and component methods. All of the methods in my
library start with "bk", as do the variables. Calling a "bk" method from the host is fine, but using a "bk"
variable from the host wouldn't make sense (nor would it work as far as accessing the component's variable
(Continue reading)

Justin Leavens | 1 Aug 2010 17:38
Picon

Re: Out Of Memory - quit as soon as possible


David Ringsmuth-3 wrote:
> 
> 4D 2003.8r2, Vista, compiled Client/Server, 4GB RAM, 15MB spawned process
> memory allocation. The non-picture manipulating spawned processes are
> usually about 96K in size.
> 

David,

Check the stack size in your picture process and I'm guessing it's really a
lot smaller than you think.

I had a problem like this recently in 2003 client/server, and to solve it I
ended up having to adjust the memory settings at each client. No matter what
memory settings I entered on the server, no matter what stack size I
specified for the spawned process, it used the values stored in the settings
available from Preferences menu item on the client. Thankfully it was
running interpreted, so I could go workstation to workstation and update
them. Not sure how you do it compiled - Customizer on the 4D Client, maybe?
--

-- 
View this message in context: http://4d.1045681.n5.nabble.com/Out-Of-Memory-quit-as-soon-as-possible-tp2260659p2261065.html
Sent from the 4D Tech mailing list archive at Nabble.com.
**********************************************************************
Join 4D experts from around the world this October:
http://4d.com/company/events/summit2010.html 

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
(Continue reading)

John DeSoi | 1 Aug 2010 20:07
Favicon

Re: Components and process vars

Unfortunately, it gives an error when 4D starts even if you don't call it. This makes it infeasible to have an
interpreted only component that is only used for development.

On Aug 1, 2010, at 8:05 AM, David Dancy wrote:

> I'm not sure what happens if the host is running compiled and the
> component can't do so. I think (don't quote me on it) that the host
> will refuse to call component code in that situation, but it would be
> worth checking to make sure.

John DeSoi, Ph.D.

**********************************************************************
Join 4D experts from around the world this October:
http://4d.com/company/events/summit2010.html 

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-Unsubscribe@...
**********************************************************************

Tim Nevels | 1 Aug 2010 22:29
Picon

Re: V11 import strategies


On Aug 1, 2010, at 2:00 PM, David Adams wrote:

> I need to regularly import an enormous file into 4D V11. This thing is
> huge, a couple of GB of data in a text file. Depending on hardware, it
> can take 4D about half an hour just to load the import editor. Having
> spent no time comparing import methods in 4D since the 1980's, I'm
> hoping someone can make a suggestion on the easiest way to do imports.
> I can very easily make sure the source import file is always in the
> same place, with known delimiters, and with known fields in a specific
> order. The import file itself is the easy part.
> 
> The source file is text, not XML. I do _not_ want to write a custom
> parser. I'm looking for something easy to implement and fast, if there
> is such a thing.
> 
> For the moment, I'm not worrying about importing into an existing data
> file - I may just create a fresh data file each time, so it's just as
> good to think of this as a one-off import...that I do regularly.
> 
> I did manage a test import (it's about 20 fields with one index) and
> was impressed at how well 4D did at searching across millions of rows.
> 
> Advice appreciated.

Hi David,

Based on what you have said, I would try the IMPORT DATA command.  It allows you to specify a "project file"
with import settings.  So use the 4D Import Editor to create and save the project to a BLOB and then save that
somewhere for later use.  You can write a very simple method that imports a selected file with these saved
(Continue reading)

David Ringsmuth | 1 Aug 2010 19:17
Picon

RE: V11 import strategies

David,

... easiest (fastest) way to do imports.
I can very easily make sure the source import file is always in the
same place, with known delimiters, and with known fields in a specific
order. The import file itself is the easy part....

I was going to suggest using an input form with matching fields to columns,
but David already did that.

For faster importing, make sure the target table has no indexes.

Hths,
David

**********************************************************************
Join 4D experts from around the world this October:
http://4d.com/company/events/summit2010.html 

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-Unsubscribe@...
**********************************************************************

David Lieb | 1 Aug 2010 23:30
Picon
Favicon

Re: Components and process vars

On Sun, Aug 1, 2010 at 3:00 PM, David Dancy wrote:

> 2. Yes. Every component's variables are in their own memory space,
> separated off from both other components and the host. I can have a
> variable X in the host, and another variable also named X in the
> component, and they will be different (they can also be of different
> types even if they have the same name). Each host process will get a
> copy of the host X; each component process will get a copy of the
> component X.
>

Someone correct me if I'm wrong, but there is no such thing as a host
process or a component process. Of course, as you said, there are host and
process VARIABLES, which are partitioned, but the processes themselves are
shared in the sense that host and component methods run in the same process.
If that weren't the case, you wouldn't be able to have a host method call a
component method or vice-versa. So in your example, I would say that any
process will have a copy of both the host X and the component X.

Does that make sense?

David L.
**********************************************************************
Join 4D experts from around the world this October:
http://4d.com/company/events/summit2010.html 

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
(Continue reading)


Gmane