​Re: UUID vs Longint primary key

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

​Re: UUID vs Longint primary key

4D Tech mailing list
On Tue, Aug 8, 2017 at 11:00 AM,

Chip Scheide <[hidden email]> wrote:

>
> Worse, I've found that the same product, from the same vendor in
> differing purchase amounts (1 vs case) is the same part number, but
> different pricing! So.. even a check on part numbers is insufficient to
> stop duplicate entries.
>
> ​Well I believe there are "dupes" and then there are dupes. There are
unacceptable dupes and there are dupes you have to or need to live with.
And then there are "near dupes". Like your example above. That is not
"really" a dupe because there is one field/col, pack size, that is NOT
duplicated (case vs 1). On and on.

This all started with David making a broad blanket statement about "data
integrity" and "row duplication" and how using "synthetic" record ID keys
ruined the ability to automatically​

​filter out "dupes". (I _think_ that was your point David. Please correct
me if not.) And in that strict sense, if a "row" is really actually
absolutely duplicated, that is _probably_ bad. Or maybe not if you didn't
include that "pack size" field that would have changed the row to unique.
Or all the other examples cited on this thread about duplicate names that
were not _really_ duplications; they just needed a little more information
included in the "row" to better define it. In fact we all used to
experience it right here nearly daily with our Walt Nelson(Guam) vs Walt
Nelson(Seattle) signatures. Constantly confusing without that one little
added tidbit.

So my point was, ​it all depends. And sometimes you have to design your own
system differently or provide tools within your current system to suss out
what, how, why and when a "dupe" occurred. And how to - or IF to - fix it
or prevent it or even find it.

I too am definitely a convert to using
 UUID over longint
​. AND in using them in preference to some construction using row data
itself which may well change as the business grows/changes and will NOT
play well when you absorb new data sources (buy a competitor for example
with nearly identical inventory items or combine existing standalone data
installations into one big common enterprise bucket, or decide for all
kinds of business reasons to extract a certain batch and combine it with
another batch in a different bucket, etc.etc.etc. Data duplication of one
sort or another are bound to occur in many of these "growth" scenarios and
more often than not the merging and cleaning of those dupes is not
reducible to some sort of algorithm without human hands to help. Or
whatever.

As ​
Neil succinctly describe
​d
:

 - UUID is faster (do to "random" data in the index)
>  - UUID solves problems with distributed systems that sync
>  - UUID fixes the home grown sequence problem with transactions
>  - UUID is not easily readable by human and keeps me from being tempted to
> expose them :)
>
> ​And to Chip's point, I DO sometimes expose those UUIDs as read only info
on certain Admin Review pages. I sometimes place a button to "copy to
pasteboard" if it is appropriate that the admin might desire to do some
searching with that UUID - for as we all know​, they are hellishly
difficult to type. And in many projects I retain that seq longint idea
because it really IS a useful human marker that is easier than a date:time
stamp to read and quickly sort on and in general "glom" as you scan down
long lists of rows. But I've been burned way too many times to ever use it
again as a unique recordID. I now consider it a user interface type aid
only, still useful as a ProductID or some such in many cases. But not as a
Unique-Unvarying-Forever-Regardless-Of-Source-Or-Destination-Record-Key.

Steve Simpson
**********************************************************************
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:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ​Re: UUID vs Longint primary key

4D Tech mailing list
> This all started with David making a broad blanket statement about "data
> integrity" and "row duplication" and how using "synthetic" record ID keys
> ruined the ability to automatically​ ​filter out "dupes". (I _think_ that
> was your point David. Please correct me if not.) And in that strict sense,
> if a "row" is really actually

I've been a bit taken aback at how this thread has gone, to be honest.

My point was really basic: Bolding on a random number field makes a row
unique, it doesn't make the underlying *data* unique.

That's it. That's more-or-less me using one of my standard techniques:

1) Find the obvious.
2) Draw a circle around it.
3) Declare it mine.

Patent pending...

Seriously, I'm saying something that just shouldn't be even the tiniest bit
contentious. That point is nothing but an established principle from
database design, it's not something I'd normally consider debatable. I'd
put it in the same category as when someone says, "Race condition? I've
figured out a shortcut." No you haven't. That's pretty much in line with
things the patent office won't even review:

* Perpetual motion machines.

* Squirrel-proof bird feeders.

Until such time as the fundamental laws of nature change, neither of those
inventions can work.

A lot of the stuff about duplicates doesn't bear on the design question
about the table's columns.

Keller 123
Keller 123
Keler 123

How many rooms are there? You have no way to know. It could be 1, 2, or 3:

1: You've got a pure duplicate and a typo-based duplicate.
2: You've got a pure duplicate and two buildings with very similar names.
3: You've got two buildings with very similar names *and you are missing
enough data to identify rows uniquely.*

In that last case,there's a design question. If you haven't identified
enough columns of *data* from the real world to uniquely identify each row,
you don't have a data model that can be implemented in a relational
database. I mean, sure, you can use a tool to store the data - but I don't
see how you model that. What makes each row unique? I mean out in the real
world. Perhaps there's a floor, or a direction, or some kind of vernacular
detail that actual people use to distinguish rooms. In which case, you've
found a missing field! That's part of the point of modeling. But what if
there really is nothing? Well, then it's pretty common to add something,
like a number. But that then (generally) needs to flow out into the real
world. So, you synthesize data in the database, add it to the row *and* to
the real world. Serial numbers are a perfect example of this. Same with
account numbers, customer numbers, etc. And UUIDs are functionally serial
numbers. They have nothing at all to do with the data in the row, they're
purely an implementation-level convenience.

As some people seem to be getting the impression I'm against UUIDs, that's
incorrect. I'm glad they're native (I used them sooner than that), I've got
nothing against them. But they are what they are and not more. Any
complaints I had about how they were implemented in 4D is irrelevant now as
it's been since V14. Too old to matter. I also have been getting the
impression when people say "primary key", they don't always appreciate what
a "key" really is - an attribute or set of attributes that are entirely
about the row of data that also uniquely identify a row. That's a key...off
the top of my head, I'm sure there's a better summary out there. The 4D
world has long had a peculiarly hostile relationship to normalization,
starting with 4D itself (subtables, wrong examples in the manuals, etc.)
I've seen the same cropping up again with how object fields are being
promoted. (Slapping some JSON in a text field and calling your system NoSQL
isn't necessarily helpful...)

But just slapping a random-but-unique number (sequential or not) onto the
row? That easily masks real duplicates. And why other databases prominently
support multi-field constraints on tables - for precisely this reason.
Again, you *can* do this in 4D with a compound index set to unique. So, the
feature exists, I just haven't seen it being used widely. Perhaps it
because engine-level errors feel disproportionately painful to deal with in
4D? That could just be me. Sincerely, I may be more allergic to 4D
engine-level errors than others. I pretty much turn off the unique
attribute and check uniqueness myself. Hmmm. I might be missing upping my
game here. I kind of remember that years ago hitting a duplicate error
wasn't easy to trap for and got ugly. I can't swear that's true, I just
remember having that impression. Long story shorter, I probably
haven't tried 4D's uniqueness controls in years. Do people use them? How
are they in V16? Since I'm doing some Postgres stuff these days, yeah, over
there I set up multi-column constraints, no question.

There are lots of other kinds of duplicates out there that can crop up,
even if you have a good model behind your tables. Life is hard. But it's
important and helpful to keep in mind the distinction between the issues
around the design of the table and the issues around data entry. They're
not all the same.

As far as duplicate matching goes, that's a different topic and one I
enjoy, but it's a different topic.
**********************************************************************
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:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Relative path in SVG DOM

4D Tech mailing list
I am trying to use a relative path to a picture file that is stored locally, in the database folder.

According to the documentation:

A relative URL ("../picture.png"). This is particularly useful in client/server mode, when files are stored in the "Resources" folder. Relatives URLs can begin with:
"/", to indicate the "~/Resources/SVG/" path
"./", to indicate the "~/Resources/" path
"../", to indicate the database folder.
However, if I put this inside the xlink:href attribute of the image, it does not show up in the SVG.

Has anyone come across this?

I am using 16R4 at the moment.


Kind regards,

Rudy Mortier
Two Way Communications bvba  -----------------



**********************************************************************
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:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Relative path in SVG DOM

4D Tech mailing list
is your SVG image itself a file inside the Resources folder?

> 2017/08/09 2:45、Two Way Communications via 4D_Tech <[hidden email]> のメール:
> However, if I put this inside the xlink:href attribute of the image, it does not show up in the SVG.




**********************************************************************
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:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Relative path in SVG DOM

4D Tech mailing list
Hi Keisuke,

No, it isn’t. It is created with ’SVG_New’.
The picture is inside a folder ‘Map_pictures’ inside the database folder.

When I use either the full path to the picture file, or embed it inside the SVG, the picture shows.

But for obvious reasons I want to use a relative path. I have tried:

“../“, “..//“, “file:../“, “file:..//“

… but nothing seems to work.


Kind regards,

Rudy Mortier
Two Way Communications bvba  -----------------



> On 09 Aug 2017, at 02:16, Keisuke Miyako via 4D_Tech <[hidden email]> wrote:
>
> is your SVG image itself a file inside the Resources folder?
>
>> 2017/08/09 2:45、Two Way Communications via 4D_Tech <[hidden email]> のメール:
>> However, if I put this inside the xlink:href attribute of the image, it does not show up in the SVG.
>
>
>
>
> **********************************************************************
> 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:[hidden email]
> **********************************************************************

**********************************************************************
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:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Relative path in SVG DOM

4D Tech mailing list
the doc could have been worded better, I suppose.

relative path means relative to the SVG image file.
the doc assumes your SVG is itself inside the Resources folder, in fact at the top level.

> 2017/08/09 18:55、Two Way Communications via 4D_Tech <[hidden email]> のメール:
> No, it isn’t. It is created with ’SVG_New’.




**********************************************************************
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:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Relative path in SVG DOM

4D Tech mailing list
Hi Keisuke,

Ok, that puts it into perspective ;-)

The thing is that the SVG is actually an interactive map.

So when I load the SVG from a blob field, then where does it go to find the file with the relative path ‘../Image.jpg’ ?


Regards,

Rudy Mortier
Two Way Communications bvba  -----------------



> On 09 Aug 2017, at 21:59, Keisuke Miyako via 4D_Tech <[hidden email]> wrote:
>
> the doc could have been worded better, I suppose.
>
> relative path means relative to the SVG image file.
> the doc assumes your SVG is itself inside the Resources folder, in fact at the top level.
>
>> 2017/08/09 18:55、Two Way Communications via 4D_Tech <[hidden email]> のメール:
>> No, it isn’t. It is created with ’SVG_New’.
>
>
>
>
> **********************************************************************
> 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:[hidden email]
> **********************************************************************

**********************************************************************
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:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Relative path in SVG DOM

4D Tech mailing list
In reply to this post by 4D Tech mailing list
> The thing is that the SVG is actually an interactive map.
>
> So when I load the SVG from a blob field, then where does it go to find the file with the relative path ‘../Image.jpg’ ?

if the SVG is displayed in a webarea, save the SVG to disk in a location appropriate to the relative path and use
WA OPEN URL instead of WA SET PAGE CONTENT

otherwise you probably end up using
SVG_New_embedded_image
<http://doc.4d.com/4Dv16R4/4D/16-R4/SVG-New-embedded-image.301-3454763.en.html>


Regards
O r t w i n  Z i l l g e n
---------------------------------------------
<mailto:[hidden email]>   <http://dddd.mettre.de/wp/?4713>
<feed://dddd.mettre.de/dddd.xml> <https://twitter.com/Ozett>
member of developer-network <http://www.die4Dwerkstatt.de>

**********************************************************************
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:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Relative path in SVG DOM

4D Tech mailing list
In reply to this post by 4D Tech mailing list
unless there is a way to define the base URL,
I don't think it is possible to specify relative paths in SVG which is itself not a file on disk.

my guess would be that the path is considered a name,
searched in the current directory of the executable.

unless the SVG is a file on disk,
I think you have no choice but to put the image data in <defs> and reference it with <use>.

> 2017/08/11 1:28、Two Way Communications via 4D_Tech <[hidden email]> のメール:
> So when I load the SVG from a blob field, then where does it go to find the file with the relative path ‘../Image.jpg’ ?




**********************************************************************
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:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Relative path in SVG DOM

4D Tech mailing list
Thanks Keisuke.

I will need to find a way of storing the picture files in the database and extracting them and writing them to a file when needed.
I especially have some concerns when working in client-server mode.


Regards,

Rudy Mortier
Two Way Communications bvba  -----------------



> On 10 Aug 2017, at 23:11, Keisuke Miyako via 4D_Tech <[hidden email]> wrote:
>
> unless there is a way to define the base URL,
> I don't think it is possible to specify relative paths in SVG which is itself not a file on disk.
>
> my guess would be that the path is considered a name,
> searched in the current directory of the executable.
>
> unless the SVG is a file on disk,
> I think you have no choice but to put the image data in <defs> and reference it with <use>.
>
>> 2017/08/11 1:28、Two Way Communications via 4D_Tech <[hidden email]> のメール:
>> So when I load the SVG from a blob field, then where does it go to find the file with the relative path ‘../Image.jpg’ ?
>
>
>
>
> **********************************************************************
> 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:[hidden email]
> **********************************************************************

**********************************************************************
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:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Relative path in SVG DOM

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Hi Ortwin,

Thanks.

The embedded image would do the trick. The problem is that the image can be selected by the end-user, and that image can get quite big. And then, drawing or refreshing the SVG will be very, very slow.

Regards,

Rudy Mortier
Two Way Communications bvba  -----------------



> On 10 Aug 2017, at 21:20, Ortwin Zillgen via 4D_Tech <[hidden email]> wrote:
>
>> The thing is that the SVG is actually an interactive map.
>>
>> So when I load the SVG from a blob field, then where does it go to find the file with the relative path ‘../Image.jpg’ ?
>
> if the SVG is displayed in a webarea, save the SVG to disk in a location appropriate to the relative path and use
> WA OPEN URL instead of WA SET PAGE CONTENT
>
> otherwise you probably end up using
> SVG_New_embedded_image
> <http://doc.4d.com/4Dv16R4/4D/16-R4/SVG-New-embedded-image.301-3454763.en.html>
>
>
> Regards
> O r t w i n  Z i l l g e n
> ---------------------------------------------
> <mailto:[hidden email]>   <http://dddd.mettre.de/wp/?4713>
> <feed://dddd.mettre.de/dddd.xml> <https://twitter.com/Ozett>
> member of developer-network <http://www.die4Dwerkstatt.de>
>
> **********************************************************************
> 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:[hidden email]
> **********************************************************************

**********************************************************************
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:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

4D Write PRO how to ...

4D Tech mailing list
Using the old 4D Write, I loop through all the frames (frames 1-> 7), using ‘WR SET FRAME’ . Then I resolve the expressions.
This way, all the references in the headers, text frames and footers are resolved before printing.

I have opened an 4D Write document in 4D Write PRO, and everything is there, including headers and footers.

However, I can’t find out how to select the headers and footers, so, when I use the command ST FREEZE EXPRESSIONS, and pass the 4D Write PRO area as object, only the references in the text part are resolved. The header keeps showing the references.

How do I select the header frame in 4D Write PRO?


Regards,

Rudy Mortier
Two Way Communications bvba  -----------------

**********************************************************************
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:[hidden email]
**********************************************************************
Loading...