Questions about the 'Sum' function

2017-04-12 Thread Peter Jakobsson via 4D_Tech
Hi

Occasionally I’d like to use the “Sum” function on a current selection but am 
hesitant because of distant memories of it only being supported in certain 
circumstances (e.g. in reports, on single user.not client server etc).

Do people use this outside of a report context and on any current selection ? 
e.g. can you safely just do this…

QUERY([INVOICE];[INVOICE]customer=2)
$total:=Sum([INVOICE]amount)

Is anyone aware of any circumstance where this won’t work ?

Thanks in advance !

Peter

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

Re: Questions about the 'Sum' function

2017-04-12 Thread Peter Jakobsson via 4D_Tech
On 12 Apr 2017, at 13:29, Sujit Shah via 4D_Tech <4d_tech@lists.4d.com> wrote:

> Sum has always worked on a series

Thanks Sujit. But what’s the definition of a ‘series’ ?

Does a field from a current selection qualify as a ‘series’ ?

Peter

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

Re: Migrating Tables with Relations Between Structures

2017-04-05 Thread Peter Jakobsson via 4D_Tech
Hi John

Thanks for that suggestion.

I tried that but in a complex structure it’s quite a footery and unsystematic 
process. You’ve got to identify tag blocks indirectly by UUID and so on and I 
found it didn’t save much time over just redrawing the relations manually. It 
probably works better when you’re transferring an entire structure rather than 
having to fish out the stuff you want from a superset.

Peter

On 5 Apr 2017, at 14:41, John DeSoi via 4D_Tech <4d_tech@lists.4d.com> wrote:

> You could export the XML structure definition and then edit it to only 
> include the tables and relations you want. Then import it into the target 
> structure.

**
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: Migrating Tables with Relations Between Structures

2017-04-06 Thread Peter Jakobsson via 4D_Tech

Many thanks Miyako !

I’ll look into both of those approaches. Very promising.

Peter

On 6 Apr 2017, at 02:37, Keisuke Miyako via 4D_Tech <4d_tech@lists.4d.com> 
wrote:

> when you copy multiple tables in the structure editor,
> you get the table as well as the relation.
> 
> pasting it back to the structure editor removes all ancillaries such as 
> indexes and links,
> but the plugin entry-point allows you to re-create them.
> 
> https://github.com/miyako/4d-plugin-structure-access
> 
> the IMPORT STRUCTURE command is also capable of restoring relations, as well 
> as the indexes.
> (the UI does not show bold at first but they are properly set. just re-open 
> the database)
> 
> http://doc.4d.com/4Dv16/4D/16/IMPORT-STRUCTURE.301-3036688.en.html
> 
> 
> 
> 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

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

Re: [OFF] Hardware advice Was: 4D World Tour 2017

2017-04-05 Thread Peter Jakobsson via 4D_Tech

On 5 Apr 2017, at 19:52, Jeffrey Kain via 4D_Tech <4d_tech@lists.4d.com> wrote:

> If it was my personal money, I'd probably find a used MacBook Pro from 2014 
> or 2015, fully loaded. If the purchase is part of a budget, I'd wait for the 
> forthcoming "Kaby Lake" revision to the MacBook Pro along with a dock/hub.   



Same here.

I’m still developing on my 2009 Core 2 Duo 8Mb. (Albeit with a swapped out 
mechanical drive for an SSD). The SSD + an Acer H277HK 27’’ monitor made more 
difference than 8 years of Apple advances and now runs like a dream ;)

Peter

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

Re: Clean Slate - Modern User Experience.

2017-04-16 Thread Peter Jakobsson via 4D_Tech
On 15 Apr 2017, at 09:49, rooftop99--- via 4D_Tech <4d_tech@lists.4d.com> wrote:

> Where could I go to see samples of what folks are doing with 4D which brings 
> the UI into the modern era? Any thoughts?

Doesn’t the O/S define ‘modern era’ ?

If you stick to vanilla 4D objects (i.e. just the raw button styles, list 
styles & fields etc) then the O/S will do all the work for you in keeping your 
screens up to date.

The only area I can think of where there’s room for creativity in this area is 
in toolbar icons. I find those a real headache because it’s very difficult to 
get hold of a set that’s:

A. intended for desktop, not web
B. comprehensive enough to cover all you need and doesn’t need too much 
Photoshop ‘hacking’
C. works on both Windows and Mac
D. covers at least 2 sizes - standard and ‘tiny’

Things to avoid:

Ambiguity (e.g. colour coded text)
Redundancy (e.g. buttons with both an icon AND a label)
Multiple Emphasis (e.g. giving priority to more than 1 function on a form)

As a general rule of thumb, the less distinguishable from the MacOS itself (or 
the Windows OS if thats your preferred) the more you know you’ve got the right 
solution.

Regards

Peter

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

Re: Components: How do you reuse utility code?

2017-04-21 Thread Peter Jakobsson via 4D_Tech

On 21 Apr 2017, at 02:44, Tim Nevels via 4D_Tech <4d_tech@lists.4d.com> wrote:

> I think we sometimes forget that 4D is not a 3GL programming language like C 
> or C++. 4D is a 4GL language. You don’t get all the feature, benefits and 
> capabilities of a 3GL language in a 4GL language. Remember why we all use 4D 
> instead of using C++. You can get so much more done with 4D in less time and 
> with less programming effort than doing it in C++.

Amen to that ;)  What a thread !

Great discussion.

I feel I must make at least an attempt to convert David’s component-pain to 
pleasure by recontextualising some of the interpretations of the archetype. Of 
course everyone has their personal priorities and preferences so it’s just my 
take, but I have spent 30% of my living existence doing components so I’ll get 
these points of my chest before any more of it passes me by (Life that is).

In general, I find 4D’s component model immensely powerful - still far more 
productive than its 3GL equivalents and there isn’t a lot I would change about 
it. I haven’t read the whole thread but some general points that spring to mind 
are these:

FLAT vs HIERACHICAL METHOD TIERS

In my view, 3GL - 4GL distinction isn’t to do with language, it’s to do with 
complexity.

In a 4GL (well at least in 4D’s implementation) we are always working within a 
unified top language tier which is flat. It’s therefore right that the 
developer should have to disambiguate between method names amongst components 
because the whole point of the component is that it provides a seamless 
extension to the host (flat) method namespace as opposed to some kind of 
hierarchical class-based extension.

DESIGN TIME vs RUNTIME ARCHITECTURAL CONTEXT
As such, it’s not comparable with say a class library or a DLL or other type of 
3GL code module since 4D components are only given an architectural context at 
runtime. This is a huge advantage over traditional coding structures because 
when we design and build components we’re always working in a host context. 
When we’re developing a component, we should not think like a component 
developer, we should think like a host developer because 4D will do the 
architectural contextualisation for us at runtime. If you start to think 
architecture when you’re building components you’ll get very confused because 
there is no architecture at design time. There are of course odd exceptions to 
this but a tiny number and they *are* exceptions, not the rule (See “NASTY 
STUFF” section at the end of this ramble).

NAMESPACES
Remember, 4D owes much of its productivity to implicit referencing, with the 
proverbial elephant in the room being of course the datafile itself. Current 
selections are implicit (within the scope of a process), globals are, methods 
are, form scripts are, form objects are and resources are to name but a few. 
There are no explicitly referencable namespaces anywhere in the language and 
the reason there aren’t any in components is because it would significantly 
disrupt this highly productive paradigm for very little gain and probably a 
measurable productivity loss. As Tim says, it also conflicts with 4D’s identity 
as a 4GL.

CASCADING DEPENDENCIES
Contrary to some of the concerns I’ve seen expressed, you can have components 
call other components in a hierarchy without any problem. In fact you can have 
2 types of coupling in that regard:

1: Tight Coupling
(Where a component references another component’s method explicitly). 
Advantages: compiler is made aware of all calls, compiles as reliably as if all 
methods were host native calls.

2: Loose Coupling
(Where EXECUTE METHOD is used). Advantages: components can be ‘unplugged’ 
without any compiler complaints.

The optimal choice can also depend on short/long term criteria. If your 
component is going to be used all over the place and potentially only 
occasionally, loose coupling can be better. If the component is a permanent 
resident (e.g. a bookkeeping library in an ERP) then I find tight coupling far 
more reliable.

DESKTOP CONFIG: ALL AT THE SAME LEVEL
The fact that a component doesn’t "on board” its dependencies is a GOOD thing, 
not a deficiency IMO. It confines the dependency hierarchy to the logic, not 
where they happen to be located on the desktop and again reflects the 4GL 
paradigm that all components are ultimately an extension of the host top layer. 
You’d end up with a version control nightmare if you had to install the same 
component in 6 different siblings instead of just once at the host level. So 
again, my view is that 4D have thought this through to give us the best of all 
worlds:

 • We have cascading hierarchical dependency supported
 • We have optimal desktop configuration
 • We have a choice of hard or soft coupling

RESOURCES
How 4D handles these is a thing of beauty IMO and is worth including into the 
overall architectural appraisal. When I researched this for my summit 
presentation I actually blew myself 

Copying forms between structures: No 'Use Object with Same Name' option

2017-04-14 Thread Peter Jakobsson via 4D_Tech
Hi

I’ve always wondered why this option is available when copying tables between 
structures but not when copying formats.

It would save an enormous amount of time since every time you copy a form you 
have to manually go through the same formats over & over again mapping them to 
the format "with the same name” in the destination database.

Anyone found a more optimal approach to this ?

Best Regards

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

Minute of Silence for the "Altura Toolbox"

2017-04-17 Thread Peter Jakobsson via 4D_Tech

Being something of a “4D fossil” myself as one of our more celebrated peers 
once put it, I couldn’t help raising an eyebrow at the quietly announced 
retirement (see 4D Blog) of an equally entrenched but possibly far more 
productive contemporary and felt I couldn’t let this news pass without at least 
a minor ceremonial hat tip ;)

As a bit of historical background, those who joined the community during the 
last 15 years are perhaps blissfully unaware of this piece of epic elastoplast 
which has held 4D’s cross-platform existence in place for the best part of a 
quarter of a century. As such, it only predates Google, Netscape Navigator, the 
Pentium Processor, DVDs and Windows 95 for starters.

But lets go back to 1994 and the pivotal ‘pre-rollout’ of the most advanced 
database in the universe at twin 4D Summits in the US and Europe (Lille, France 
was the one I attended). Running on Mac, Windows AND UNIX, it incorporated a 
virtual machine layer which meant the design team only had to code for 1 
platform. It also ticked just about every wishlist item anyone has had in the 
25 years since and - best of all - it wasn’t even vapourware. I actually saw LR 
in front of a Sun Spark workstation run a 10-second sequential search on 10,000 
records which probably represented the modern-day equivalent of mining a whole 
bitcoin to yourself in a single day.

There was only 1 problem.

Although 4D Universal’s resplendent virtualisation gymnastics would insulate it 
from hardware diversity, it wouldn’t insulate it from Mick Jagger who was about 
to launch the world’s most widely adopted O/S the following year. Nor would it 
mitigate the deafening clamor from impatient 4D users demanding Windows 
compliance yesterday - no last month - with full networking support for IPX/TCP 
and all known PC hardware and right now with no delay for postage or other 
unnecessary hold-ups.

Handily (or tragically depending on your point of view), something “turned up”. 
I vaguely remember a presentation the next year where it was announced…”we’ve 
actually stumbled upon a very handy tool that just lets us….”.

And so the world’s greatest database was put on ice and a new 25-year quest 
engaged known as “Escape from Altura Toolbox” that made an Indiana Jones tale 
look like a round of golf. Inexorably entwined with Apple’s own “Escape from 
O/S 9” trauma, subsequent abortive attempts at least delivered on symbolism 
with working titles such as “Goldfinger” and no-doubt several others that never 
even made it off The Laurent’s & Asmae’s dinner napkins.

That they’ve finally done it is a testament to perseverance of the 4th kind 
(and possibly some kind of clever programming too ;) ).

Congratulations to all concerned !

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

Arrays vs Object for Key/Value pair lookups

2017-07-17 Thread Peter Jakobsson via 4D_Tech
Hi

I remember at last year’s summit, JPR was emphasising how objects were far more 
optimised than arrays for doing lookups over large numbers of key value pairs.

e.g. we usually do this:

$x:=find in array(myKEYS;”product_code_x”)

if($x>0)
  $0:=myPRICES{$x}
end if

How do people prefer to do this with objects ? Enumerate the keys in some 
systematic way and then populate the object like this >

For($i;1;$SIZE)

  $key:=string($i)
  $value:=myarrayVAL{$i}
  OB SET($object;$key;$value)

End For

Then for retreiving:

$key:=string($1)

$0:=OB Get($object;$key)

…or was JPR suggesting we use object arrays and do some kind of “find” over the 
object arrays ?

Best Regards

Peter

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

Re: Arrays vs Object for Key/Value pair lookups

2017-07-17 Thread Peter Jakobsson via 4D_Tech

On 17 Jul 2017, at 17:03, Herr Alexander Heintz via 4D_Tech 
<4d_tech@lists.4d.com> wrote:

> so I queried for the language I needed and then
> apply to selection([dict];ob set(<>Dict;[dict]WordKey;[dict]Word)

Ah !

So you just ‘hoover up’ into your dictionary object.

Like a hoover ?

Peter

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

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread Peter Jakobsson via 4D_Tech

Well, I’m afraid I’ll have to take the pariah role here and politely disagree 
with you all :-)) - or at least present an alternative perspective in which 
“globals” play a very powerful and unique part.

Lets think this all through for a moment. As is relevant to this topic, we can 
notionally consider the data that an application ‘consumes’ in 2 distinct 
aspects:

 • persistent data structures
 • non-persistent data structures

The first of these are basically represented by pre-prepared classes which we 
call “tables". We can instantiate an instance of that class and manipulate that 
instance implicitly using commands like CREATE RECORD, QUERY and SAVE RECORD. 
The second are represented - on the one hand - by a library of pre-prepared 
classes that the ID gives us like forms, form controls, etc and on the other 
hand by the data oriented language elements, i.e. locals, interprocess globals 
and process globals (of which 4D data objects are a subset of each).

Now, if 4D gave us the facility to scope a process level global variable to an 
arbitrary set of methods (or even forced us to do so) then it would have 
effectively have re-invented the concept of the language class as appears in OO 
languages. You’d have to formally define the class, formally define its 
properties and methods, formally instantiate it and maintain a reference to the 
particular instance you’re using at a given moment. You would not be able to 
support user interface elements implicitly with the class’s data (as we can 
with native 4D), you’d have to either give your class its own UI and all the 
supporting methods it needed to drive it (which would only work from within 
that class) OR create the plumbing to connect an independent form class so that 
it can be driven by the data in your “tightly scoped” business logic module.

Remember, we already have ‘modules’ in 4D which have their own privately scoped 
variable space in the form of 4D components. So if - on top of that - 4D 
supported “components within components” I suggest we’d have an unmitigated 
architectural clutter who’s language structure became increasingly ambiguous 
and unwieldy. The “living hell” of globals being broadly scoped might actually 
seem like an attractive problem to have by comparison (for many of us anyway).

On 21 Jul 2017, at 14:32, David Adams via 4D_Tech <4d_tech@lists.4d.com> wrote:

> But, yeah, globals are bad. They make your life a living hell because
> someone changes something and now "unrelated" parts of the program break

David, I think you may be impacted by this ‘scoping issue’ disproportionately 
compared to many developers since you appear to do a lot of “Red Adair” type 
troubleshooting work where you’re parachuted into a crisis situation and have 
to start stabilising, refactoring and growing an existing codebase 'back to 
health’. (Just an observation from your posts - I may be completely wrong on 
that of course !). I can definitely see how a more formal modular environment 
would help in that situation. But how many of those databases would have 
existed in the first place if their original developers had been forced down 
the more formalised route ? In my own experience of visiting customer sites, 
not many. Also, I’d posit that your problem isn’t a lack of language support, 
it’s simply deficient design (by your predecessors) which would in fact have an 
even more adverse impact in an environment of the complexity you’re promoting.

On 21 Jul 2017, at 10:22, Nigel Greenlee via 4D_Tech <4d_tech@lists.4d.com> 
wrote:

> Most code i write now is ‘self contained’ -I attempt to set all values used 
> in the method is passed in to the code -either as parameters or an object or 
> a pointer to something so that i end up with something more like a javascript 
> function

Nigel - this would be an admirable objective for the most part if it weren’t 
for the one big elephant in the room that separates 4D’s “4GL” heritage from 
its 3GL contemporaries and that is its huge dependence on and leverage 
of……statefulness ! I urge people not to dismiss it because it’s where we get 
all our productivity from in the first place.

Having thought about this a great deal over the years, I came to the conclusion 
that we could split our entire codebase into 2 distinct types of method: 
stateless and stateful. In the case of the former, yes it is a good idea to do 
as you say and make the code as “self contained” as possible. However in the 
case of the latter, it’s positively counterproductive because we are dealing 
with an implicit non-persistent data structure and it’s more efficient just to 
make that data structure explicit to maintain state between methods. There are 
also other benefits:

 • the business logic more auditable because we’re decoupled the data from the 
code that manages it
 • we don’t need a myriad of parameters everywhere or random properties buried 
away in an object
 • the compiler sees it and can assist with formal 

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread Peter Jakobsson via 4D_Tech

On 21 Jul 2017, at 16:48, David Adams via 4D_Tech <4d_tech@lists.4d.com> wrote:

> * No. You do not need classes. Modules do not require OOP, OO came out of
> earlier work and embraced modules and extended them. I'm just talking about
> module-level scope and data hiding, not OO

Ok, you could be onto something there. 4D often find ways to implement greater 
degrees of articulation in a unique “4D way” that doesn’t come with a whole lot 
of productivity baggage. I’ll suspend judgement till I see the killer feature - 
I might like it ;)

> Don't really know what you mean by 3G and 4G languages


Basically: statefull vs stateless, high level vs low level, integrated 
(language/DB/UI) vs dis-integrated.

Regards

Peter

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

Re: Arrays vs Object for Key/Value pair lookups

2017-07-20 Thread Peter Jakobsson via 4D_Tech

On 20 Jul 2017, at 11:39, JPR via 4D_Tech <4d_tech@lists.4d.com> wrote:

> In case of an object, the properties are 'indexed' by using an internal Hash 
> table, so the access to one particular Property doesn't need a sequential 
> parsing of the list of values, but an almost direct access. I confirm what 
> Justin says, that is to say that the bigger will be the array, the more 
> efficient will be associative arrays compared with classic parsing of arrays.


Many thanks for refreshing your advice JPR !

Very useful.

Regards

Peter

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

Re: Nested transactions - most appreciated feature

2017-07-02 Thread Peter Jakobsson via 4D_Tech

On 2 Jul 2017, at 00:12, Alan Chan via 4D_Tech <4d_tech@lists.4d.com> wrote:

> It's a great feature if long transaction that holding up records isn't an 
> issue to your operation. Of course, make sure no one would take coffee in the 
> middle of a transaction:-)


Hi Alan

They execute in milliseconds as I never put user interfaces - or even alerts - 
inside transactions. Just a lot of error handling and then report the error 
after the final CANCEL TRANSACTION.

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

Re: Nested transactions - most appreciated feature

2017-07-02 Thread Peter Jakobsson via 4D_Tech
On 2 Jul 2017, at 18:44, Alan Chan via 4D_Tech <4d_tech@lists.4d.com> wrote:

> If there's no UI, why you need nested transaction?


I’ve never considered transactions as a UI tool (mainly because it’s a bit of a 
nightmare matching the scope of the opening and closing points) but I 
acknowledge many developers successfully use them as such.

Their primary use in my experience is for creating atomic database updates 
where one of a number of validations is carried out - usually in triggers on 
the server - during the course of the update.

The code in the update can span both distinct layers in the application 
architecture (e.g. host & components layers) as well as distinct database tiers 
(e.g. server & client). So it has to have some way of passing an error back 
through the call chain to the original update call and have it VALIDATE or 
CANCEL TRANSACTION.

The reason for the nested transactions in that case is that the update can call 
into some part of a modular codebase (such as a 4D component) which has its own 
transaction handling. This used to be problematic because pre-nested era, you’d 
have to support another parameter in that codebase to tell it whether 
transactions were being handled in the caller or if it should invoke its own 
transaction handling. (I suppose we could have tested “In Transaction” but 
that’s a bit nasty because it’s implicit and independent of the business logic 
being passed up and down the call chain).

Apart from anything else, if you have any error handling running on the server 
side at all, you need to run it in a transaction to not end up with data that’s 
left in an ambiguous state.

Peter

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

Nested transactions - most appreciated feature

2017-07-01 Thread Peter Jakobsson via 4D_Tech
Hi

Sorry to be late to the party on this.

It always takes me about 5 years to start using a new feature of 4D with gusto. 
I tend to believe that if I’ve worked around some deficiency for years then 
suddenly having to *not* do so is too good to be true and that there must be 
some catch.

In that regard I must register my total fan-approval for nested transactions. 
Not having to worry about what calls may be downstream of your big ‘transaction 
wrapper’ is absolute heaven.

However, just before I throw all caution to the wind, is anyone aware of any 
‘gotchas’ with transaction nesting that one should be aware of ? Or can we just 
nest stuff within stuff with exactly the same caviats as for a 1-level 
transaction and no more ?

Thanks for any contributions !

Peter

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

Re: Components: How do you reuse utility code?

2017-04-21 Thread Peter Jakobsson via 4D_Tech
Jim -

I read all of your post with interest. But with respect, IMHO it really does 
not do the least bit of justice to the real world applications that 4D’s 
component architecture is designed to address. Nor does it reflect the practice 
of a component based development paradigm.

For example the invocation of the ”domain specific” aspect of 4GL’s is of very 
little use practically because it doesn’t characterise 4D’s industrial context 
in any significant way. SQL has a user interface, an integrated database and a 
reporting function, but look how different it is from 4D in practice. It’s true 
that “4GL”s are a vaguely defined technological concept, but I did outline a 
specific interpretation as I saw relevant in my last post.

On 22 Apr 2017, at 00:47, James Crate via 4D_Tech <4d_tech@lists.4d.com> wrote:

> It’s difficult to imagine having 30 small independent components in a 4D 
> system, and in reality it would be unworkable because then each component 
> would need to include it’s own method to split a string to an array, or 
> descend into the problems of dependent components

Luckily, I have the benefit of not having to imagine the last 10 years of my 
professional life and the associated “descent” into the problems of dependent 
components. On the odd occasion, reality can turn out better than imagination ;)

> IMO that is one of the biggest reasons there is no significant code-sharing 
> or component community in 4D, as compared to almost any other language. There 
> would need to be a “standard library” component that other components could 
> depend on, or they all have to reinvent every wheel.


The “standard library’ you allude to already exists. It’s called the 4D 
language. The bulk of the world's 3GL “standard libraries” are trying to be the 
4D language and they never get anywhere near the level of consistency, version 
continuity or platform support that 4D does. (Otherwise I’d be using them !). 
Beyond that you’re into the business logic layer and the diversity that exists 
therein is the main reason for the lack of code sharing in the community. But 
that doesn’t mitigate the advantages of a formally implemented modular approach.

In that regard, the primary role of 4D components (in my experience) apart from 
re-useability is quality control.

A single developer needs to reproduce the same code over again for many 
applications. A component-based approach requires them to distill out and 
de-couple business logic so that it is explicitly addressed in areas that it is 
only implicitly addressed in a host-only project. This leads to a quantum leap 
in reliability as well as a huge increase in that developer’s capacity for 
addressing complex business problems.

> These are both tight coupling. This is compile-time vs runtime binding. 


Thanks very much ! That is indeed a more accurate description.

> Also, using the term “productive” is kind of amusing when primarily what 
> people would put into a component are the missing parts of the framework 
> (i.e. string trim/split, blob searching, array operations, making C_OBJECT 
> nicer to use)

Although that type of functionality is to be found in 4D component libraries, 
it doesn’t really qualify as ‘canned business logic’ which is where most of the 
benefit is to be had. A more useful (and in my experience typical) example of 
content domains might be:


FINANCIAL
 • double entry bookkeeping logic
 • multi-currency library for managing trial balances
 • dimensional analysis
 • consolidation libraries (multi-company)
 • credit control
 • period management
 • journalling properties
 • caching
 • sales tax

TRADING
 • inventory definition libraries
 • inventory registration
 • revision control
 • location and balance tracking libraries
 • property inheritance (for model-product hierarchies)
 • stock movement journalling definitions
 • trigger and stock error definition

ADDRESSING
 • address book API
 • library support for form embedding

SERVICES
 • http libraries
 • PAYPAL API clients
 • XLIFF generators
 • OAuth libraries
 • Google API clients

MARKUP
 • text processing

DOCUMENTS
 • all kinds of 4D Write wrappers and PDF production

SECURITY
 • generic logic for user logins
 • support for business logic level privileges
 • session tracking libraries
 • privilage-based form configuration support

TIME
 • period algebra libraries (second - day - week - month - year - calendar 
quarter - financial quarter)

MIGRATION
 • data migration/export import by various means (records, blobs, text etc)

UTILITIES
 • RFC support (e.g. 3986, 8601, 4217)
 • path functions (level navigation, multi-platform, joining, splitting)
 • version control
 • property bags (text, blob, object)
 • text DIFFING libraries
 • query canning (caching optimisations, counting, logic cans)
 • string functions  (this is where your string ‘trim/splt’ would go)
 • binary libraries (byte arithmetic, object opacity, colour addition, 
saturation, brightness etc)
 • CODECS
 • 

Re: Getting component to update

2017-04-24 Thread Peter Jakobsson via 4D_Tech
On 24 Apr 2017, at 22:50, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> wrote:

>  I opened another method to publication.

Hi Chip

When you made the change the first time, was the host structure still open ?

TRY:

 • open the component structure only
 • un-publish the method
 • re-publish it (click ‘Shared by components and host database’)
 • use an alternative function to check the “ Shared by components and host 
database” property (e.g. if you right-clicked in the method list the first time 
to access the property editor, then do the checking from the open method via 
“METHOD —> Method Properties…” (in menu bar)
 • once you’re sure it’s published, check it’s not invisible
 • go back to the host and check it’s not masked in the host by a method of the 
same name

If you’ve done all that I can’t think for the life of me why you’re not seeing 
it other than your alias is simply pointing to the wrong component structure.

h.t.h.

Regards

Peter

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

Re: How to trap a form save keystroke in an object method ?

2017-05-18 Thread Peter Jakobsson via 4D_Tech
On 18 May 2017, at 05:50, Jody Bevan via 4D_Tech <4d_tech@lists.4d.com> wrote:

> Get rid of the auto save action. Then you can handle what ever situations you 
> need to. We have not used auto action buttons for 25 years.

Hi Jody

I have actually done that. It isn’t the problem here though - the ‘save’ is 
being done under program control, it’s just that by the time the OK button 
script is executed the field-level script has reverted the modification so the 
form level validation returns true.

EXAMPLE:

 • Lets say the acceptable input range for a field is 4-8.
 • It currently holds the value = 5
 • User enters 9 and hits Return to save the form
 • 4D now does 2 events: 1=the field object “On Data Change” script sees that 9 
is out of range, shows an alert and reverts the value back to 5
 • 4D isn’t finished yet with its events. Having run the field level script it 
now has to run the default form accept button script (invoked by the user 
pressing return). It isn’t aware that the user’s entry was rejected at the 
field level, sees everything in range (because the field script reverted it) 
and does an ACCEPT

I think I probably need some kind of flag to let the form level validation know 
that it has to cancel the save action because it was invalidated at the field 
object level.

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

How to trap a form save keystroke in an object method ?

2017-05-17 Thread Peter Jakobsson via 4D_Tech
Hi

I rarely come across this problem.

Lets say you have a field with an “On Data Change” object method which does 
field level validation that rejects an entry.

Lets says the form has a default button and the user clicked the “Big Enter” 
key (on the numeric keypad) which invokes a ‘save’ action.

Here’s the problem:

 • the field level validation rejects the entry and restores the ‘in range’ 
value that was already there
 • but after executing the script 4D still ploughs on and tried to save the 
record
 • the form level validations don’t trap the error condition because it was 
‘put right’ at the field level, so 4D saves the form

How can the ‘save form’ keystroke be arrested if the field level validation 
fails ? It appears that FILTER KEYSTROKE(“”) only works if you place it in the 
“On Before keystroke” event. It doesn’t work retrospectively after the “On Data 
Change” script has validated at field level.

Peter

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

Re: Components: Running uncompiled?

2017-05-04 Thread Peter Jakobsson via 4D_Tech

On 4 May 2017, at 12:33, David Adams via 4D_Tech <4d_tech@lists.4d.com> wrote:

> I'm still working away on my components and I have another remedial
> question. I'd really like to be able to trace through a component while in
> the host. Sometimes this works, sometimes I get complaints

Hi David -

You should be able to trace through the component code while in the host no 
problem but if you are finding the compiled/interpreted mode switching a bit of 
a pain, one way to make this slightly less ambiguous is to arrange things as 
follows:

COMPONENT SOURCES/BUILDS
1. create a “component sources” folder and put all your component sources in 
there (if you really want to give them a folder each, then do that)
2. create a “component builds” folder and put all your builds in there

3 HOST MODES...
In the host structure, create 2 distinct component folders, one prefix “s” 
(indicates interpreted components) and one prefix “c” (indicates compiled). In 
those, place aliases to each of the compiled/interpreted component sources that 
the host wants to use.

1: INTERPRETED / INTERPRETED
Then, in debug mode, remove the prefix “s” and work in the host. You will then 
unambiguously be using interpreted host with interpreted components and will be 
able to step into the component code in the debug cycle. If you need to ‘fix’ a 
component, exit the host, open the component and fix (this is the “unit test”). 
Then quit, re-open the host and retest (this is the “in-situ” test). At all 
times you don’t need to move anything around on the desktop.

2: INTERPRETED / COMPILED
This is the most demanding and unforgiving mode because a compiled component 
will choke on any ambiguous parameters from the host whereas an interpreted on 
won’t. It’s definitely worth testing in this mode to get components solid. To 
activate this mode, restore the prefix “s’ on the interpreted components alias 
folder and remove the prefix “c” on the compiled components aliases folder.

You will now be working with compiled components and will not be able to step 
into them in debug mode.

3: COMPILED / COMPILED
This is production mode. To activate this debug mode, keep the compiled 
component aliases active (unprefixed), compiled the host and open in compiled 
mode.

I’d recommend working with a heterogeneous component object code - i.e. either 
all interpreted or all compiled, otherwise it can get very confusing to use the 
debugger and you get that situation where it sometimes steps in and sometimes 
doesn’t depending on what state you happen to have left the component code in. 
It’s also a reason to create distinct build targets for component compiled code 
as opposed to using the component source as a target for both compiled and 
uncompiled conditions.

Regards

Peter

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

Re: oh sweet

2017-10-06 Thread Peter Jakobsson via 4D_Tech

> On 6 Oct 2017, at 17:54, Nigel Greenlee via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> How long have i wanted this….

+1 Nigel !


**
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: [offish]Volume of mail

2017-10-06 Thread Peter Jakobsson via 4D_Tech

> On 5 Oct 2017, at 21:15, Jeffrey Kain via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> We have a lot of 4D developers working here, but I'm on the only who 
> participates actively in the list. Also, 4D has a lot fewer "issues" these 
> days than in the old days.

I’m probably in this category on both counts.

I hardly ever post on the list, yet I work in 4D every day.

Peter

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

Tip: Exporting to a target folder in a package

2017-10-24 Thread Peter Jakobsson via 4D_Tech
Hi

I have XLIFF applications that generate stuff like custom constants and 
language resources.

Unfortunately, if you use 4D’s desktop navigation commands like “Create 
Document(“”)” or Select Folder and the like, to allow the user (me !) to locate 
the target folder for the export, it doesn’t let you navigate inside a package 
(which is where all my destination folders are since they are in the Resource 
folder for the structure).

The only way I could do it was:

1. open the package in the MacOS desktop using the right-click contextual “Open 
Package” command
2. drag the resources folder to the sidebar shortcuts list
3. then use the sidebar shortcut as the target for the export path

This seems to work. The question is, is it a feature or a bug ? Will 4D patch 
this up once they discover it so that I can no longer use this workaround ?

Any comments, feel free !

Regards

Peter

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

Re: Saving an object array to disk

2017-12-05 Thread Peter Jakobsson via 4D_Tech


> On 5 Dec 2017, at 16:18, Peter Jakobsson via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> (I’m trying to migrate an entire table for processing selectively in another 
> structure. I packed each record into respective elements of an object array 
> then wrot eit to disk with SAVE VARIABLES. No I’m reading it back in with 
> LOAD VARIABLES but it crashes).

Ok, I think I can use "Selection to JSON" and "JSON PARSE ARRAY" at the other 
end for this.

Peter

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

Re: Saving an object array to disk

2017-12-06 Thread Peter Jakobsson via 4D_Tech

> On 5 Dec 2017, at 20:45, Timothy Penner via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> The docs say: "WARNING: This command does not support array variables. Use 
> the new BLOB commands instead."

Thanks Tim

Didn’t see that.
> 
> Why don't you just use SQL EXPORT SELECTION and SQL EXECUTE SCRIPT?


That’s an interesting approach. I will mentally bookmark it for future use

At the moment I’m using “Selection to JSON” to dump the data into a text 
variable and then SAVE VARIABLES to out it to disk. This is an absolutely 
awsome way to do it I’ve discovered if you’re migrating between heterogeneous 
table structures because you basically have the table at the other end in an 
object array where each source record is accessible at field level by name 
without requiring a temporary table to dump it do.

Cheers for the replies !

Peter

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

Saving an object array to disk

2017-12-05 Thread Peter Jakobsson via 4D_Tech
Hi

Has anyone used the SAVE VARIABLES command with an object array ? I am getting 
crashing when I try to read it back in with LOAD VARIABLES.

The test data is tiny so it isn’t size that’s the problem. Just wondering if 
anyone’s tried it.

(I’m trying to migrate an entire table for processing selectively in another 
structure. I packed each record into respective elements of an object array 
then wrot eit to disk with SAVE VARIABLES. No I’m reading it back in with LOAD 
VARIABLES but it crashes).

SAVE VARIABLE(docpath;arrObjects)

Thanks in advance for any tips.

regards

Peter

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

Re: Tip: Exporting to a target folder in a package

2017-10-24 Thread Peter Jakobsson via 4D_Tech

> On 24 Oct 2017, at 12:39, David Adams via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Have you tried Select document? It lets you navigate inside of packages.


> On 24 Oct 2017, at 12:48, Koen Van Hooreweghe via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> Select folder allows you to navigate into a package if you add the Package 
> open constant as ‘options’, third parameter.
> Same for Select document fourth parameter.

Ah. That’s the answer. More manual reading required. Many thanks !


> On 24 Oct 2017, at 15:57, Chuck Miller via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Why would you let users put stuff in resources folder

Chuck & Kirk -

It’s a developer utility so the “user” concerned isn’t an “end user” but a 
developer user (that would be myself ;) ).

Cheers

Peter

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

Re: Time Machine error -8003 when restoring 4D structures

2018-06-18 Thread Peter Jakobsson via 4D_Tech
Ah !

Good idea. That’s the kind of thing I’d think of for my clients but never 
myself ;)

Thanks for the tip Charles.

Regards

Peter

> On 18 Jun 2018, at 23:01, Chuck Miller via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> It does. How about using 4d backup and then backing that up.You could run it 
> every hour on your structure only.

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

Time Machine error -8003 when restoring 4D structures

2018-06-17 Thread Peter Jakobsson via 4D_Tech
Hi

MacOS 13.13.5, High Sierra on a recent Macbook Pro.

I’m getting this error when attempting to restore 4D structures from a Time 
Machine archive. It’s not just one - several of the archives have it but it 
only seems to apply to 4D structures. If I try to restore other things - like 
text docs - it works ok.

It has the appearance of a permissions type error because the structure file 
copies ok from the backup drive (i.e. the little watch icon “fills up”) but 
just when it gets to the end there’s a delay and eventually the -8003 error 
pops up, like it can’t let go of the file or something.

I’m wondering if it could be due to Time Machine backing up while I have the 
structure open in 4D. It’s not been a problem in previous years.

Can anyone else shed light on this phenomenon ?

Regards

Peter

**
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: Docs about "twinned" process and pre-emptive mode

2018-01-19 Thread Peter Jakobsson via 4D_Tech


> On 19 Jan 2018, at 04:10, Keisuke Miyako via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> are you familiar with the request log file?
> 
> you will see a P (for preemptive) or C (for cooperative) indicated for each 
> network request.

The log file seems to do this for everything *except* the SQL statements (which 
are the ones I’m interested in)…

https://s18.postimg.org/719e5wjjt/sql_Screenshot.png

Peter

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

Re: Docs about "twinned" process and pre-emptive mode

2018-01-19 Thread Peter Jakobsson via 4D_Tech
Ok, I dug out an old laptop which had a lot of interesting discussion on this 
from 2011. What I’m wondering is if triggers can now run pre-emptively (if they 
are compliant code-ways: no IP variables etc).

In 2011, David Dancy said that any regular 4D code whatsoever would force the 
method to run co-operatively. But then in 2016 there is a discussion that 
appears to imply that triggers can run preemptively IF they don’t run any 
non-complient code.

By the way, I found the documentation I was looking for: 
http://doc.4d.com/4D-Language-Reference-16.3/Processes/Preemptive-4D-processes.300-3651705.en.html
 


That seems to endorse the idea that triggers can run preemptively if they are 
compliant. I wonder when that feature arrived ?

Regards

Peter

> On 19 Jan 2018, at 04:10, Keisuke Miyako via 4D_Tech <4d_tech@lists.4d.com 
> > wrote:
> 
> you will see a P (for preemptive) or C (for cooperative) indicated for each 
> network request.

**
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: Docs about "twinned" process and pre-emptive mode

2018-01-18 Thread Peter Jakobsson via 4D_Tech
Thanks Miyako. That’s useful.

I basically was wanting to know if inline SQL used the “twinned” pre-emptive 
thread or not.

Peter

> On 19 Jan 2018, at 04:10, Keisuke Miyako via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> are you familiar with the request log file?
> 
> you will see a P (for preemptive) or C (for cooperative) indicated for each 
> network request.

**
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: Roy (Suzi) McGregor Paterson R.I.P

2018-09-10 Thread Peter Jakobsson via 4D_Tech
I am very sorry and taken aback to hear of this. I can only imagine that he was 
subject to illness as it seems premature.

I always chatted to Roy at meetups going right back to the 1992 summit in the 
Meridien Montparnasse at the launch of 4D server when I remember him telling me 
he was starting to "get his head around pointers”.

My condolences to those who were close to him.

Peter

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

Docs about "twinned" process and pre-emptive mode

2018-01-18 Thread Peter Jakobsson via 4D_Tech
Hi

I’ve been raking through the online documentation trying to find where the 
querying modes pre-emptive / co-operative are documented but have been 
unsuccessful.

What I’m specifically looking for is more background on what conditions SQL 
queries use the twinned pre-emptive process for example.

Can anybody point me to a link ?

Many thanks !

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

Re: 4D Summit 2018 Comments

2018-04-09 Thread Peter Jakobsson via 4D_Tech

> On 9 Apr 2018, at 21:25, Richard Wright via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I’ll be interested in learning how this differs from Views, not necessarily 
> 4D’s rather simplistic implementation, but something like Oracle’s, along 
> with their very powerful SQL implementation.


Hi Richard -

Isn’t the difference that 4D’s object model is seamless ? It extends from the 
language and continues into to structure and database engine in a way that SQL 
based technologies can only emulate. (i.e. you always have a discontinuity at 
some point where the SQL query has to “wrapped” to create the illusion of an 
active data object).

This is consistent with 4D’s legacy approach (which IMO was also a generation 
downstream from SQL) where we are able to use data structure objects directly 
in the language without having to “map” them to text-based query statements 
that we just cross our fingers and “hope” the DBMS understands.

Peter
**
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: [SAD NEWS] legendary developer and 4D base-rock Ortwin Zillgen

2018-02-28 Thread Peter Jakobsson via 4D_Tech
Hi Alexander

Thank you for passing on this news and I’d like to add my condolences and 
deeply felt sadness at the departure of such a creative and appreciated 
contributor to the 4D community.

I had occasion to liaise with Ortwin on a couple of projects and his input was 
always spirited, engaging and of course highly professional. He’s also left a 
huge legacy of techniques and tools, most of which he made freely available to 
the community on his website.

I’m truly sorry to hear of this and wish his family and close friends every 
comfort at what appears to be a very unexpected loss.

Regards

Peter Jakobsson


> On 27 Feb 2018, at 12:22, Herr Alexander Heintz via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> Fellow 4D developers,
> 
> it is with great sadness, that I have to inform you, that Ortwin Zillgen has 
> passed away end of last week.
> Suddenly, unexpectedly and far to early at the young age of 64.

**
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: Longing IDs or UUIDs as primary key?

2018-10-24 Thread Peter Jakobsson via 4D_Tech
> On 24 Oct 2018, at 16:52, Two Way Communications via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> The process seems quite cumbersome: to start, I need to remove the ‘primary 
> key’ flag from all the ID fields

Rudy -

Just to add to the many useful contributions made so far, I found a way to do 
this in a few seconds which makes the process almost painless. (Courtesy of the 
late but much celebrated Ortwin Zilgen).

The approach is:

1: run the code below to add keys to all tables. (This will keep 4D backup 
happy and let you do your replication)
2: carry on as usual using your IDs as “logical keys” or “business keys” as I 
call them, and remain blissfully ignorant of the UUID layer

Ortwin’s code that he sent me is posted below.

Best Regards

Peter

** Generate Primary Keys for All Tables **
`
`.By Ortwin Zilgen
***

C_LONGINT($i;$P_SIZE)
C_TEXT($tableName_t)

$fieldName:="pkUUID"

$P_SIZE:=Get last table number

For ($i;1;$P_SIZE)
If (Is table number valid($i))

$tableName_t:=Table name($i)
$statement_t:="ALTER TABLE ["+$tableName_t+"] ADD "+$fieldName+" UUID 
AUTO_GENERATE PRIMARY KEY;"

Begin SQL
EXECUTE IMMEDIATE:$statement_t;
End SQL

End if 
End for 
**
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
**

Backing up a VM - is it dangerous ?

2018-11-05 Thread Peter Jakobsson via 4D_Tech
Hi

One of my sites contracts out their server maintenance, procurement and general 
support to an IT contractor. The contractor is fairly adaptable and I have good 
professional relations with them, however I still have to work within certain 
“overall parameters”.

One of these is that their 5-user 4D accounts server runs on a VM (Virtual 
Machine). When I asked them about an external drive to hold the 4D backups, 
they replied “don’t worry, the whole VM gets backed up once per day and the 
backup is held on external drives”.

What are the implications of backing up the VM while 4D server is still running 
? On the old days this would have been a complete no-no because of un-flushed 
caches, locked datafiles and all sorts of issues. Is anybody running this 
particular configuration ?

Though I hopefully won’t be visiting the dentist anytime soon, Laurence 
Olivier's words to Dustin Hoffman spring to mind…..”is it safe !?”  ;)

regards

Peter
**
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: Backing up a VM - is it dangerous ?

2018-11-05 Thread Peter Jakobsson via 4D_Tech
Many thanks for the useful replies.

I’ve contacted the IT contractor to try to negotiate a new backup strategy.

Hopefully it will be less of a sweat than the China trade talks :-)

Peter

> On 5 Nov 2018, at 13:36, Jeffrey Kain via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Definitely not safe prior to v17.

**
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: Defining and documenting Objects

2018-10-10 Thread Peter Jakobsson via 4D_Tech
Hi

This is a good point made by Paul...

> On 5 Oct 2018, at 09:15, Paul Dennis via 4D_Tech <4d_tech@lists.4d.com> wrote:
> 
> With tables and records and the structure it's relatively
> straightforward to track through the code and work out what's going on. I
> can see this being a real problem with objects. There just doesn't seem to
> be any visibility. The data could be buried many layers down in an object
> let alone all the quotes, dots and semi colons involved


I also agree with Kirk’s last post about unncecessary redundancy when you have 
a perfectly working programming paradigm already - and they do indeed take some 
documenting (at least in the code) - and you can get yourself tied in knots, 
especially when you go even one level of object hierarchy.

Despite that, I have recently taken the leap to using objects as arguments in 
methods and passing parameters “by name” rather than using $1..$N.

I did this because Laurent Ribardierre and JPR recommended this approach so 
categorically at the last advanced developers class. Also, when they demoed the 
new features of v17 and I saw the roadmap I can kind of see why - 4D want to 
drastically loosen the coupling between the forms layer, the code and the 
database engine. So what I’m doing now is just using a single object to hold 
all form properties that I’d previously used globals for. Then just use globals 
where required for active objects like menus.

You can preserve some of the formality of the old “$1…$2” approach by writing 
wrappers to “receive” the object properties and simultaneously “define” the 
form parameters - so that an error can be thrown is something’s missing from 
the mandatory argument list for example. But one of the advantages of this new 
approach I’ve noticed is massive flexibility when it comes to initialising the 
form. It’s much easier to refactor or add/remove parameters. (Say you had a 
function that opened the form and that function took some initial states as 
$1…$n. Just passing a single object instead saves having to support the 
argument list right up and down the call chain.

Also, I’m still on v15 but at the end of the day the new dot notation 
referenced object properties will not be much different from the old global 
variable approach.

Peter

**
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: Defining and documenting Objects

2018-10-11 Thread Peter Jakobsson via 4D_Tech


> On 11 Oct 2018, at 08:49, Bernd Fröhlich via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> there are no globals required for menus (I assume here that you are talking 
> about popup menus in the form).
> Just give them an objectname, get a pointer in the "on load" phase with 
> Object Get Pointer and define the array using that pointer.

Hi Bernd

Thanks for that tip. I will experiment with your approach.

Out of interest, what advantages does this give you over using a global ? The 
advantage of a global to me is that it preserves state throughout the life of 
the form without any coding. (For example you don’t need to keep using Object 
get Pointer(“myPopUp”) all over the place to re-create the state). Also, using 
globals lets you do a lot of type-based debugging at compile time.

If we take this to its logical conclusion won’t we just end up with Delphi, 
.NET or Python instead of 4D ? (i.e. a low level environment that’s extremely 
versatile but far less productive).

Regards

Peter

**
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: Defining and documenting Objects

2018-10-11 Thread Peter Jakobsson via 4D_Tech


> On 11 Oct 2018, at 12:02, Bernd Fröhlich via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> All true, but with globals you can have hard to find side effects.
> E.g. i have a lot of buttons and other variables on a lot of forms use 
> "standard" global variables (bOK, bCancel, bSave, bPrint, bWhetever) so that 
> I don´t have to define new globals for each form.
> 
> Now and then it happened, that one form changed one of those variables that 
> was also used by another form. Good luck with finding those bugs because they 
> only happen now and then and are seldom reproducable.
> Using only dynamic variables in my forms saves me from those headaches.

Ok, thanks for that clarification - I can see your reasoning.

But just as a bit of philosophical fun, imagine if things were the other way 
around. Since v1 we had always been using objects and you needed to use 
accessor commands to do absolutely anything with either data or active form 
objects. Then one day 4D, after 25 years, 4D came along with this great new 
feature - a built in wrapper for the object accessors (called a “global 
variable") that sported a host of great productivity advantages:

 - maintains state for you without any coding (no laborious “sets” and “gets” 
anymore)
 - a single point of reference for the property instead of tens or hundreds of 
local variables capturing the same property, all with potentially different 
names and contexts
 - compiler support for typing to detect bugs “ahead of time”
 - design time find, replace and rename support - again with a single point of 
reference

I think I might happily pay the price of recreating the variable table for 
every process (since I never noticed any adverse effect of that) and use naming 
conventions to avoid conflicts to get those features ! ;)

The original selling point of 4D was that it was stateful and that 
statefullness is what gave us massive productivity gains. Lower level languages 
like the Microsoft developer platforms, Delphi and even Javascript/Python type 
environments had the versatility but you had to pay the price in coding 
according to the classic, stateless styles. 4D is now allowing us to do stuff 
you could do in these languages but there’s a great big banana skin potentially 
associated with that transition which is productivity. For example when I 
started building widgets in 4D, they could be “very nice” but my productivity 
absolutely plummeted since you need to spend most of the time on designing 
plumbing systems, event models and custom data structures instead of solving 
business problems which have traditionally been the 4D developer’s domain.

Just a thought.

Sometimes it’s difficult to tell novelty value and practical value apart. (Well 
it is for me at least :-) )

Regards

Peter

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

Amazon EDIFACT/X12 Gateway

2019-01-04 Thread Peter Jakobsson via 4D_Tech
Hi

A very happy new year everybody.

I have an ERP running at a customer site who is a big Amazon suppler (i.e. they 
sell products/services TO Amazon). Amazon want them to submit sales invoices 
via their EDIFACT (or X12) gateway.

I’m a bit out of my depth here as I haven’t done any EDI stuff before, although 
I have quite a lot of experience with interfaces in general - ftp, http, etc. 
Where to start !? Does anyone have experience of this that could point out the 
basics or direct me to some useful docs ?

The comms protocol is AS2 so it would seem that the actual connection is done 
over http. I presume it’s then a case of formatting the documents and sending 
them as an http attachment, but that’s as far as I’ve got so far.

Any tips welcome.

Best Regards

Peter

**
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: Subject: Re: Amazon EDIFACT/X12 Gateway

2019-01-09 Thread Peter Jakobsson via 4D_Tech
Hello Jim

I just saw this message. Thanks for replying - interesting case.

Regards

Peter

> On 7 Jan 2019, at 16:45, Jim Medlen via 4D_Tech <4d_tech@lists.4d.com> wrote:
> 
> We have an account with OpenText an EDI VAN (Value Added Network)
> We use their software to Send and receive EDI documents.

**
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: PDF generation on Windows - Latest Thinking

2018-09-12 Thread Peter Jakobsson via 4D_Tech
Many thanks for the replies.

I’ll attempt to go with the native PDF engine.

Regards

Peter

> On 12 Sep 2018, at 15:19, Chuck Miller via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I think it does run on windows 10

**
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 Write (v15) Images Slanted

2018-09-12 Thread Peter Jakobsson via 4D_Tech
Hi

I looked back in the archive for an answer to this one and found some useful 
posts regarding DPI etc. However when I paste an image into 4D Write (legacy 
version), the image appears slanted at a 30 degree angle (roughly). Have tried 
forcing the image into both 300 dpi and 600 dpi in Photoshop but still get the 
same result.

It’s a company logo for a document header, so no more than 1990’s feature set 
required.

Has anyone seen this phenomenon that can point me at what the cause is ?

Regards

Peter

**
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: PDF generation on Windows - Latest Thinking

2018-09-12 Thread Peter Jakobsson via 4D_Tech


> On 12 Sep 2018, at 21:22, Tim Nevels via 4D_Tech <4d_tech@lists.4d.com> wrote:
> 
> PDF Creator 1.7 works just fine on Windows 10. No problems. And it has many 
> more configuration options than the built in Window 10 PDF driver. And it 
> does not have a nuisance bug the Windows 10 driver has (see below). Now you 
> have a choice. 

Very interesting and useful post - thanks !

The 4D code is configured to use PDF Creator 1.7 at the moment. It would be 
good if I could just install PDF Creator on Windows 10 and have it work as 
before without any code modifications. I think I will try this.

Peter

**
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 Write (v15) Images Slanted

2018-09-12 Thread Peter Jakobsson via 4D_Tech
Hi

It appears I’ve solved this - it needed to be a JPEG. But I presume this won’t 
print too well.


> On 12 Sep 2018, at 22:05, Peter Jakobsson via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> appears slanted at a 30 degree angle

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

PDF generation on Windows - Latest Thinking

2018-09-12 Thread Peter Jakobsson via 4D_Tech
Hi

For years I used PDF creator to generate PDFs from 4D on Windows 7 - mainly 
because you didn’t have to type in a document title for every single page in a 
print run and this could be done from code. My customer has now upgraded to 
Windows 10 and it’s using the default PDF writer as I didn’t install creator. 
It works but it asks her to enter a title for each document instead of sending 
them all to disk directly.

Is PDF Creator still the preferred option on Windows 10 ?

Just wanted to see what people were using as their preferred choice.

Many thanks in advance !

Peter

**
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: Formatter that only shows decimals

2019-04-08 Thread Peter Jakobsson via 4D_Tech


> On 8 Apr 2019, at 00:19, Mark Katz via 4D_Tech <4d_tech@lists.4d.com> wrote:
> 
> Maybe (likely) I’m missing something but couldn’t you display the actual 
> value x 100 instead of the actual value?

Hi Mark

Yes, I could do that. I was just wondering if the formatter could do it because 
it would ideally be desire-able to not reprocess the original data in this 
case. (i.e. I just want to display the number of pence/cents that’s there not 
calculate them).

Peter

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

2019-02-26 Thread Peter Jakobsson via 4D_Tech
That is a stellar curriculum I must say.

Good luck with your new phase !

Peter

> On 26 Feb 2019, at 17:52, Tom Benedict via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I have recently left my long time employer and begun free-lance 4D 
> development work. 
> 
> I have 24+ years of experience scaling a 4D solution from a departmental 
> application into a full enterprise system.
**
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: Epoch time in milliseconds

2019-02-20 Thread Peter Jakobsson via 4D_Tech
Thanks Arnaud !

Very useful indeed. Bruno has been very productive in this area.

> On 20 Feb 2019, at 22:19, Arnaud de Montard via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> 
> You may be interested by 2 methods from Bruno Legay about epoch in the code 
> sharing zone:
>  >
>  >

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

2019-03-15 Thread Peter Jakobsson via 4D_Tech


> On 10 Mar 2019, at 09:51, Jeremy Roussak via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
>  The server I’m hoping to talk to is the Value Added Tax server at HMRC in 
> England (in a couple of months’ time, entering figures for VAT returns will 
> have to be done by software rather than online, by hand, at present).

Hi Jeremy

I am also doing this. I have a couple of sites using the same 4D application 
that I need to make MTD compliant by next month for VAT return filing.

I’ve done quite a bit of API work before but am just at the HMRC “hello world” 
stage just now.

Will post my approaches here when I know what I’m doing !

Regards

Peter Jakobsson

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

Caching URLs. Hashed or unhashed ?

2019-02-15 Thread Peter Jakobsson via 4D_Tech
Hi

I am caching the responses from a commercial API services to save costs. (i.e. 
the code does a lookup on a 4D table on the exact URL of the API call to see if 
we already have that response in the cache).

What is people’s opinion on best practice for storing and querying on URL’s ? 
Should we hash them (say with MD5 Digest or something) in case the URL has 
dodgy characters like back-slashes or @ that might screw up 4D's query algo and 
then search on the hash instead ?

Best Regards

Peter

**
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: HMAC SHA512 Signing - solved

2019-02-16 Thread Peter Jakobsson via 4D_Tech

The answer was hiding in plain sight !!

$isOk:=PHP 
Execute("";"hash_hmac";$P_dataSignature;"sha512";$P_dataRequestRaw;$P_apiSecret)

…and it works.

> On 16 Feb 2019, at 20:35, Peter Jakobsson via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I’ve spent about half a day researching this so far so thought I’d give the 
> NUG a try. Is anyone familiar with a way to do HMAC SHA512 signing in 4D ?
> 

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

HMAC SHA512 Signing

2019-02-16 Thread Peter Jakobsson via 4D_Tech
Hi

I’ve spent about half a day researching this so far so thought I’d give the NUG 
a try. Is anyone familiar with a way to do HMAC SHA512 signing in 4D ?

v17 now supports SHA512 in the Generate Digest command but that doesn’t do 
signing. I also tried NTK’s "NTK HMAC Text” (with the “SHA512” argument) and do 
get a result but it doesn’t work and when I compare the output with a reference 
site I’m using it’s completely different. (This is the reference site I’m using 
https://www.freeformatter.com/hmac-generator.html#ad-output).

I thought maybe someone might know of a “LAUNCH EXTERNAL PROCESS” solution or 
similar.

Regards

Peter

**
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: Epoch time in milliseconds

2019-02-20 Thread Peter Jakobsson via 4D_Tech


> On 20 Feb 2019, at 01:29, Keisuke Miyako via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> $P_timeString:=String(Current date(*);ISO date GMT;Current time(*))
> 
> does this not invoke 2 calls to the server in C/S mode?

Good point Miyako. (I stopped worrying about optimising for performance years 
ago).

Must try and upgrade to v17 - I keep coming up against increasing amounts of 
features which I need that it has.

Peter

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

Epoch time in milliseconds

2019-02-19 Thread Peter Jakobsson via 4D_Tech
Hi

Does anyone have an idea how to get the epoch time in milliseconds in native 4D 
?

The problem is that if I convert Current Date and Current Time to milliseconds 
there’s a precision error of up to a second and the API server’s I’m using 
think I’m out of sync. Is it another job for PHP ?

Regards

Peter

**
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: Epoch time in milliseconds

2019-02-19 Thread Peter Jakobsson via 4D_Tech

Actually I just realised this may be a timezone issue rather than a precision 
issue.

I’ve done it this way:

*** 1. Get UTC Time ***

$P_timeString:=String(Current date(*);ISO date GMT;Current time(*))

$P_timeString:=Replace string($P_timeString;"Z";””). <— Prevent it from 
reverting back to local time

$P_date:=Date($P_timeString)
$P_time:=time($P_timeString)


2. convert to Posix *

$P_baseDATE:=!01/01/1970! 

$P_countDAYS:=($P_date-$P_baseDATE)  // Gets the whole number od days 
elapsed
$P_countSECONDS:=($P_time +0)

$P_posixTIME:=(($P_countDAYS*86400)+$P_countSECONDS)

$0:=Int($P_posixTIME)*1000



> On 19 Feb 2019, at 23:25, Peter Jakobsson via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> The problem is that if I convert Current Date and Current Time to 
> milliseconds there’s a precision error of up to a second and the API server’s 
> I’m using think I’m out of sync

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

Formatter that only shows decimals

2019-04-06 Thread Peter Jakobsson via 4D_Tech
Hi

Does anyone know how to do a formatter that only shows (currency) decimals but 
that hides the decimal point ?

I have used ".00;-.00;00” which works ok except that the decimal point itself 
displays. I’d like to only display the numerics without the point if poss.

Thanks in advance for any tips.

Peter

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

Web area fail on accessing secure area

2019-06-01 Thread Peter Jakobsson via 4D_Tech
Hi

I’m slightly poking around in the dark here looking for a handle.

In a 4D Web Area, the a login “submit" button has no effect when submitting 
username and password to a secure area. The site concerned is the gov.uk (UK 
Government services).

i.e. we start here: https://www.gov.uk/log-in-register-hmrc-online-services
Then click the “Sign In” button which takes the user to the logon page. After 
that the subsequent submit action fails if done through a 4D Web Area on 
Windows (works fin on Mac). The perplexing thing is that a test version of this 
page works - even on Windows. (I am subscribed to the gov.uk HMRC Developer Hub 
which provides “sandbox” environments. The logon works fine in the sandbox with 
the 4D web area). By the way, I of course tested it with a regular browser and 
it works fine.

I don’t expect any instant solutions but if anyone has any bright ideas for 
further investigation I’d appreciate hearing them !

Specs are:

4D v15
Plain form with WebArea ("Use Internal Web Kit”=True)
No 4D methods involved except WA OPEN URL(web are;url)
Windows 7, Windows 10 tested

Best Regards

Peter

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

Miyako Excel Component

2019-05-24 Thread Peter Jakobsson via 4D_Tech
Hi

I have a one-off need to create 2 very small (about 9 rows each, 2 columns) 
spreadsheets from 4D in native Excel format.

Is Miyako’s component still available anywhere ? The sources.4d.com site seems 
to have gone away. (Or maybe I’m just not accessing it correctly…is it FTP ?)

Thanks

Peter

**
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: Miyako Excel Component

2019-05-24 Thread Peter Jakobsson via 4D_Tech


> On 24 May 2019, at 19:48, Arnaud de Montard via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> There are many xl things in Miyako's shop (I only know the freeXL one, it 
> reads .xls):
>  >
> 
> I'd use Rob Lavaux's XL plugin, the demo mode is enough for your need (and 
> it's worth it):
>  >

Thanks Arnaud !

Very helpful.

Peter

**
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: Capturing workstation timezone from the OS

2019-05-06 Thread Peter Jakobsson via 4D_Tech
Hi John

Many thanks. Nearly a decade old ! Should be well trodden.

Peter

> On 6 May 2019, at 18:03, John DeSoi via 4D_Tech <4d_tech@lists.4d.com> wrote:
> 
> This gives the number of seconds offset from GMT.
> 
> John DeSoi, Ph.D.

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

Capturing workstation timezone from the OS

2019-05-06 Thread Peter Jakobsson via 4D_Tech
Hi

I’ve been looking into capturing the OS timezone (i.e. GMT +01 etc) from the 4D 
language but have drawn a blank. I thought there might be some fancy footwork 
with String(?00:00:00?;ISO GMT) or something trick like that possible but I’ve 
been unsuccessful.

Has anyone done this without resorting to LAUNCH EXTERNAL PROCESS shell scripts 
and so on ?

Regards

Peter

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

Unexpected authentication window appears in web area

2019-04-25 Thread Peter Jakobsson via 4D_Tech
Hi

I have a very simple web area embedded in a 4D form for logging into an 
authenticated domain. I’m observing different behaviours in Mac and Windows:

Mac:
works fine. You enter user and password, click the web page submit button and 
authentication is successful. Next web page appears

Windows:
On clicking the submit button a small OS type window opens over the form with 
“User Name” and “Password” fields. It’s in French which makes me think it’s 
coming from the 4D web area plugin itself

Even if the correct user name and password are entered (for a second time) into 
this “secondary” authentication window, authentication fails.

See here for screenshot:

https://imgur.com/fQdtNYu

Anyone seen this or have any idea as to why this appears ?

Regards

Peter

**
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: More on 4D Objects and 'Inheritance'

2019-09-16 Thread Peter Jakobsson via 4D_Tech
Fascinating stuff Kirk.

Thanks for posting.

Peter

> On 16 Sep 2019, at 17:10, Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Not everyone is a fan and there are some good arguments to be made

**
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: More on 4D Objects and 'Inheritance'

2019-09-16 Thread Peter Jakobsson via 4D_Tech
rofl !  That was a very inspiring post.

Ok I think thats pushed me over the edge. OO 4D here I come.

> On 16 Sep 2019, at 22:23, Aparajita Fishman via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
>> Well my recommendation is not to use New formula ever.
> 
> Translation: “I’m not sure I can use them properly, therefore no one should.” 
>  
> 
> 
>> Even with properly
>> encapsulated code structured in a way that makes sense, it's still
>> impossible to get the context, source, or whether or not the method call
>> even exists in the object.
> 
> Not my experience at all.
> 
> 
>> It's basically just a dangerous feature at this
>> point just waiting to explode when your ".get()" isn't the same ".get()" as
>> you were expecting.
> 
> Not my experience at all.
> 
> 
>> 4D needs to add actual class structures for it to be
>> 1) Easy to document and lookup the source, or see the actual function
>> documentation like now when we mouseover a method call.
> 
> True, but I have found the benefits far outweigh those minor inconveniences. 
> Looking up the source is trivial if you use a good naming convention.
> 
> 
>> Right now there would be a lot of
>> overhead to design an object correctly so that New formula use doesn't
>> spiral out of control
> 
> Not my experience at all. I ported https://github.com/expressjs/express 
>  to 4D.
> 
> 
>> , and even then, time consuming to maintain.
> 
> Not my experience at all.
> 
> 
>> I tried applying it in another case
>> where there was no UI and a lot of processing in loops. It was slow.
> 
> Not my experience at all. I see no measurable slowdown.
> 
> - Aparajita
> 
> **
> 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: Object property inheritance - why does this this not work ?

2019-09-15 Thread Peter Jakobsson via 4D_Tech
That was a very inspiring post.


> On 15 Sep 2019, at 21:44, Aparajita Fishman via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
>> ORDA looks really interesting too but I haven't played with it yet, but I'm 
>> looking forward to experimenting with it soon.
> 
> It’s more than interesting, it’s bringing 4D into the 21st century. It’s the 
> way DB access has been on other platforms for a long time, and it's just way, 
> way superior to the legacy 4D way. Don’t ask me why, just start using it and 
> you’ll see why.
> 
> 
>> New formula (that you mentioned) has arrived with 17 R3.
> 
> This is probably the most significant addition to the language after objects. 
> Coming from a world outside 4D where functions are first class objects, 
> formulas *finally* let me do stuff that was easy to do in other languages but 
> was impossible to do in 4D. Don’t ask me how. Better to learn Javascript and 
> then see how techniques there can be applied to 4D.
> 
> 
>> File management with Path to object and Object to path are really great 
>> commands to finally have. 
> 
> Those are old school. Upgrade to R5 and use File and Folder.
> 
> 
>> Of course, what we still need is the ability to create OOP-like Classes in 
>> 4D with the associated capabilities like member variables and methods, 
>> object instantiation (may be even class reflection), etc.
> 
> I’m already doing everything you just mentioned. In fact, I’ve been able to 
> port several npm packages (including expressjs) to 4D. Don’t ask me how. If 
> you have a firm understanding of object oriented languages, just start 
> exploring the possibilities given by objects + formulas.
> 
> - Aparajita
> **
> 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: Object property inheritance - why does this this not work ?

2019-09-15 Thread Peter Jakobsson via 4D_Tech
Thanks Narinder.

Doesn’t this imply we need to change our entire style and approach to coding ? 
Language data structures, forms, the lot ?

Have you found you needed to do this ? (At least in terms of new code and 
optimal approaches).

Having attended the last couple of summits and various classes etc I’ve been 
aware of this looming in the background but the dot notation really is the 
breakthrough for me that warrants taking the leap across the “discontinuity 
gap” from old to new. It reminds me of working in Visual Basic years ago which 
used all this object oriented approach. 4D even lets you create a kind of 
“active object” now with “New Formula”.

Doesn’t this mean a complete revision of how we code form the ground up ? 
Finding new “best practice” approaches to absolutely everything ? (As we even 
have “collections” now so even the most fundamental aspect of 4D - current 
selections - is out of the window).

I might need to take a month off and read the whole manual again for the first 
time since 1988 !

Peter

> On 15 Sep 2019, at 12:52, Narinder Chandi via 4D_Tech <4d_tech@lists.4d.com 
> > wrote:
> 
> Yes, for legacy structures that are converted to v17 you have to explicitly 
> enable Unicode support and also enable the "Use object notation..." setting 
> under Compatibility
**
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
**

Object property inheritance - why does this this not work ?

2019-09-15 Thread Peter Jakobsson via 4D_Tech
Hi

Using the v17 dot notation I was unable to get one object to inherit another’s 
properties using the assignment operator. Also when I inspect $dog in the 
debugger after assigning the first property, it appears empty.

Code is:

C_OBJECT($animal;$dog;$cat)

$dog:=New object
$cat:=New object

$dog.sound:="bark"
$cat.sound:="meow"

$animal:=$dog
$getSound:=$animal.sound

Running this in the debugger, $dog and $cat return “{}”, yet hovering over 
$dog.sound with the cursor does display the property value. $animal.sound 
returns undefined.

Why does this not work ?

Regards

Peter

**
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: Object property inheritance - why does this this not work ?

2019-09-15 Thread Peter Jakobsson via 4D_Tech

> On 15 Sep 2019, at 14:32, Jeffrey Kain via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Don't try to fit a square peg into a round hole just yet

Fair enough, Jeff. I won’t, and your advice is of course wise re. “the real 
thing is coming”.

But it’s still interesting to explore the potential evolution in approach. For 
example even though a pure object oriented approach isn’t possible, an object 
based one is since we can create stateful data structures that at least mimic 
the behaviour of real class based ones and are therefore easier to manage in 
terms of documenting and auditing their behaviour.

Peter

**
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: Object property inheritance - why does this this not work ?

2019-09-15 Thread Peter Jakobsson via 4D_Tech
Hi Narinder

So it does. I created a brand new structure and it now works.

I did that example in a legacy upgraded structure so maybe there’s some 
compatibility setting that I needed to change to fully support the new object 
syntax.

Many thanks for taking the time to check it and respond !

Peter

> On 15 Sep 2019, at 12:41, Narinder Chandi via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I just tested your code exactly as-is and all the variables have the expected 
> values. I used 17.2 on Mac

**
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: Object property inheritance - why does this this not work ?

2019-09-15 Thread Peter Jakobsson via 4D_Tech
Hi Narinder

Thanks for posting your commentary. Very interesting.

Regards

Peter

> On 15 Sep 2019, at 13:58, Narinder Chandi via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I think our coding style will need to undergo an evolution rather than 
> revolution

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

More on 4D Objects and 'Inheritance'

2019-09-16 Thread Peter Jakobsson via 4D_Tech
Hi

Just expanding on that last thread, (“Why does this not work") there do appear 
to be some real object orientation aspects to the new 4D commands - at least 
from the point of view of what’s needed and useful in a high level environment 
like 4D.

The key is the new “This” self-referencing function because it now lets you 
create an active object as a class. I realise OO purists may not regard it as a 
class, but it’s as much of a class as I’ve ever used in OOP languages and I 
don’t see what else we’d want or need. It can contain both encapsulated 
properties AND methods. Also, we don’t need to keep passing it an object 
reference from an external call to execute those methods using the “internal” 
properties and we can create new instances of objects from that class using the 
OB Copy command (which basically does the same job as “New”).

Immense !

For example, try this (needs v17 R3 or greater):

C_OBJECT($animal;$dog;$cat;$pet)

// 1. Define a class

$animal:=New object("sound";"";"talk";Formula(ALERT(This.sound)))

// 2. Instantiate new objects from the class which inherit its properties and 
behaviours

$dog:=OB Copy($animal)
$cat:=OB Copy($animal)

// 3. Customise the objects

$dog.sound:="wooff"
$cat.sound:="meow"

// 4. Do stuff using the encapsulated object reference defined in the class

$pet:=$dog
$pet.talk()

$pet:=$cat
$pet.talk()

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

Windows OS level backup trashing 4D

2019-09-23 Thread Peter Jakobsson via 4D_Tech
Hi

I’m sure this is an age old issue but I thought I’d solicit some opinions on 
addressing it in case anyone cares to post their experiences.

The OS level backup is saving the operating system (which nobody cares about) 
and trashing 4D (which everybody cares about).

The site runs a mission critical 4D Server under 4D 2004 (it should be getting 
retired/replaced with a new 4D system in a month or two) which is under 3rd 
party contractural support that includes twice daily backups at OS level. Every 
week the server crashes when nobody is using it and I’m cure it’s because of 
the Windows backup process conflicting with 4D which has the datafile open. I 
think it’s one of these that freezes everything while it backs up and then 
“unfreezes” it.

It would be good to have 4D write its own backup to an external drive and than 
have the OS backup run on that one instead. But the contractor then feels 
exposed contracturally for not backing up the main OS so it’s like talking to a 
brick wall.

How do others address this ?

Regards

Peter

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

Windows network - cannot open structure of database {BaseName}

2019-11-11 Thread Peter Jakobsson via 4D_Tech
Hi

I’m slightly stumped by what appears to be a networking/firewall/permissions 
issue but I’m not really sure. (Ports are open).

A 4D Client connecting to 4D Server (v15) over a Windows LAN (Windows 10) 
connects but then dies while trying to download local resources. The error 
messages are:

1024 Can’t open structure of database ({BaseName})
1211 Cannot create connection
10035 Unknown error

The weird thing is that there is a perfectly serviceable version of exactly the 
same structure running on a different server which works fine (so it doesn’t 
seem to be an issue with permissions on the client side and 4D not being able 
to write to its local cache folder). Also, I have to connect to the failing 
server using the “Custom” tab as it doesn’t automatically show up in 
“Available” which the production server does.

I have opened the Windows firewall port 19813 on the server O/S, both inbound 
and outbound. Apart from that I can see no difference from the one that works 
(they are separately licensed).

Client O/S: Windows 10
Server O/S's (Both): Windows Server 2016 Standard

Server IPs:

192.168.0.249 (Works)
192.168.0.40 (Fails)

If anyone is familiar with this issue I’d appreciate any tips !

Regards

Peter

**
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: Windows network - cannot open structure of database {BaseName}

2019-11-11 Thread Peter Jakobsson via 4D_Tech
Hi

Amazing how just typing the problem out catalyses your brain !

It wasn’t enough to allow just TCP protocol in the firewall. It had to allow 
UDP as well. (In fact I just changed it to “All Protocols”).

Sorry for the noise :-)


Peter

**
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-04 Thread Peter Jakobsson via 4D_Tech
Hi Jeremy

In fact, with this approach there’s not even any need for the invisible buttons 
- just associate the [Return] key with the visible default button and the 
script can decide whether to execute the query or the default “Accept” action.

Regards

Peter

> On 4 Dec 2019, at 09:40, Jeremy Roussak  wrote:
> 
> Glad to have helped! FWIW, I don’t use invisible buttons; there’s no need. If 
> your form is sized relative to a bounding rectangle of some kind, you can 
> place the buttons outside that rectangle area and set their “Resizing 
> options" to "move". Makes them much easier to edit. Something like this: 

**
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-02 Thread Peter Jakobsson via 4D_Tech
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 query (like
>> Google style). But if the cursor is not in the filter field but
>> highlighting a row in the list then the return key should accept the form
>> (via regular default button action).
>> 
> 
> -- 
> 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
> **

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

O/S Replication and Backup interaction with 4D (2004, v15)

2019-12-04 Thread Peter Jakobsson via 4D_Tech
Hi

I have a legacy 4D server which appears to be getting trashed by the backup 
services in Windows 10 server.

The platform contractor cannot turn off any of the backup stuff and I can’t 
upgrade to v17 for several weeks due to…..reasons, so need to find a way round 
this. (There are 2 virtual machines running inside the host. One of these runs 
a 4D 2004 server, the other runs a 4D v15 server).

One thing the contractor said is that there are 2 levels of backup - the “Host 
replication” which runs every 15 minutes - and the guest backup (which I 
presume is Windows Shadow Copy Service) which runs once per evening.

Am I right in thinking that legacy 4D servers should be ok with the host 
replication but not with the guest backup (which causes file locking conflicts 
with 4D I imagine) ?

If that’s the case I’m thinking of finding a shell script to take the 4D server 
down in the evenings and put it back up early morning.

Regards

Peter

**
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: Doing a GOTO (widget) in the On Load event - stumped

2019-12-02 Thread Peter Jakobsson via 4D_Tech


> On 3 Dec 2019, at 00:58, Peter Jakobsson via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Thanks Canon

…sorry, I mean “Cannon” of course ;)
**
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
**

Doing a GOTO (widget) in the On Load event - stumped

2019-12-02 Thread Peter Jakobsson via 4D_Tech
Hi !

Back again with a related issue to my previous theme of user interface 
behaviours.

To move the cursor into a widget (in fact a derivative of Miyako’s “search” 
widget) I usually use a button with CTRL-F shortcut to call “EXECUTE IN 
SUBFORM($subform;”ACTION”) and then have the “ACTION” call a GOTO OBJECT in the 
context of the subform.

This works fine once the form is loaded but never works in the “On Load” event 
of the widget’s host form. (Nor in the widget’s on load event which I tried by 
way of completeness).

Think I’ve run out of leads so if anyone has any hints as to how to get this to 
work I’d appreciate it !

Regards

Peter

**
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: Doing a GOTO (widget) in the On Load event - stumped

2019-12-02 Thread Peter Jakobsson via 4D_Tech
Works a dream.

Thanks Canon. I had forgotten about SET TIMER. Suddenly these query forms are 
perfectly user-intuitive. Start off in filter. Execute query with Return, 
accept form with return also.

Could not be better…thanks for all the tips on here !

Peter

> On 3 Dec 2019, at 00:47, Cannon Smith  wrote:
> 
> Depending on how the subform is set up, it may not be loaded by then. But it 
> should work if you use SET TIMER(-1) and then call EXECUTE IN 
> SUBFORM($subform;”ACTION”) in the timer.

**
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 Jakobsson via 4D_Tech
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 query (like
>>>> Google style). But if the cursor is not in the filter field but
>>>> highlighting a row in the list then th

Re: O/S Replication and Backup interaction with 4D (2004, v15)

2019-12-04 Thread Peter Jakobsson via 4D_Tech
Hi Timothy

That post was very useful. Many thanks.

Regards

Peter

> On 4 Dec 2019, at 20:15, Timothy Penner via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> It sounds like you're dealing with a VM environment, possibly either Hyper-V 
> or VMWare ESxi

**
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 Jakobsson via 4D_Tech

> On 3 Dec 2019, at 21:47, Peter Bozek  wrote:

> But doing it again, I would go for something simpler.

…and that “something simpler” turns out to be Jeremy Roussak’s tip of removing 
the “Focusable” property from the default button on the form.

This is the key to everything, including:

1. The “Focus Object” function returns the object you’re interested in, not the 
one currently executing the script
2. No need for clumsy “On Getting Focus”, “On Losing Focus” tracking flags
3. The filter field’s behviour can be decoupled from the host form as users 
expect. It now has its own “Return” key without the host form disappearing from 
view in front of their faces
4. Any other common “hotkey” actions (such as opening the currently highlighted 
row in a list) having a “return” key shortcut can continue to work as normal 
wrapped with a generic exception testing function that works in any form
5. All object’s events can continue to be used as normal without form-specific 
exceptions

Superb ! And the forms all suddenly feel great to use. As intuitive as Google !

Peter

**
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: Capturing barcodes without a 'text' field

2019-10-16 Thread Peter Jakobsson via 4D_Tech
Hi Dougie

This is in fact what we do at the moment. (In fact it’s so simple I just use 
the 4D “Request” function to capture the barcode).

The only thing that would make a marked improvement while not complicating 
things too much would be for the capture to auto-enter itself after the scan 
(i.e. execute a TAB or CR). That would save them reaching for the keyboard 
every time between scans. I think the best way to do this seems to be to have 
the scanner send enclosing control characters to invoke the TAB as some have 
suggested. 

Peter

> On 16 Oct 2019, at 10:13, Douglas Cryer via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> My advice is try not to complicate it.  If there is a lot of things going on 
> in your screen make the user make a conscious choice to go into or come out 
> of scanning mode.

**
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: Capturing barcodes without a 'text' field

2019-10-16 Thread Peter Jakobsson via 4D_Tech
Thanks Jeff. Very useful information.

I also checked out your even more detailed responses on last year’s thread 
about this which were very informative.

Regards

Peter

> On 16 Oct 2019, at 00:54, Jeffrey Kain via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> If you want to use a USB barcode scanner and still have complete control, you 
> can use ON EVENT CALL to manage this. You'll need to program a prefix 
> character and a suffix character into the barcode scanner,

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

Trapping the 'return' key in list forms

2019-11-29 Thread Peter Jakobsson via 4D_Tech
Hi

Could anyone kindly bring me up to date me how we trap the [Return] key on a 
form these days with a default button when some other action is to be taken 
rather than accepting the form, depending on the last object that had the focus 
prior to executing the Default Button script ?

In otherwords how can the default button script “know” that the cursor was in a 
“filter list” widget just prior to executing and in that case cancel the 
form-acceptance action in favour of executing the list query.

This is so that users can hit the return key to execute a query (like Google 
style). But if the cursor is not in the filter field but highlighting a row in 
the list then the return key should accept the form (via regular default button 
action).

many thanks

Peter

**
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-11-30 Thread Peter Jakobsson via 4D_Tech
Thanks for that input Chip.

However I don’t see how this can work. How can the invisible button script know 
which field the cursor was in last ? (Or which object last had the focus prior 
to its own script being executed ?)

Regards

Peter


> On 29 Nov 2019, at 22:13, Chip Scheide <4d_o...@pghrepository.org> wrote:
> 
> invisible button with  as the activation key, which could then POST 
> KEY().
> or you know...
> User training  :)

**
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 Server Hosting - The Future ?

2019-10-10 Thread Peter Jakobsson via 4D_Tech
Hi !

I just finished a 1.5 hour phonecall with a support services manager at the 
technical services company who supply one of my customers with all their 
hardware/software/maintenance services.

He basically brought me up to date on “how things work” today which is 
essentially that everything to do with platforms is now virtualised to allow 
them to ‘tune’ resources to demand in realtime and provide seamless, no 
downtime backup. Basically, my 4d Server is now a “cloud service” without me 
even being aware of it, it’s just that the hardware involved happens to be 
located on the preises.

In particular we discussed backup configurations for 4D server and this was 
interesting because, while I requested independent drives for logfile 
(“journal”) and datafile purposes, he essentially told me to just stick 
everything on the same drive because it was virtual anyway and had multiple 
redundancy protection via raid, 15-minute snapshotting etc. He offered to 
“create” a C: and a D: drive to make me feel better, but pointed out that 
they’re not much more independent than 2 folders would have been.

CONCLUSON
I now realise that the “WAN” / “LAN” distinction is disappearing. He said the 
only reason the “cloud” solution wasn’t hosted off-site was that they had 
measured the bandwidth that the customer used and calculated that the cost 
would be astronomical if it was on AWS or something like that, but in all other 
respects it was a cloud solution.

I was wondering, how do other major 4D server deployers optimise their 
deployment strategies to take advantage of this ? It seems a great thing that 
we are being “floated out to the cloud” without actually having to do extra 
significant work, but what about things like the backup strategy ? I don’t 
really like the idea that the log file has the same redundancy system as the 
main datafile because the whole idea is that the corruption doesn’t get 
replicated (which is what a RAID system does) and it’s independent at the 
logical level.

We seem one step away from being able to supply server solutions where “our” 
customer doesn’t have to host the database server on premises. Is anybody doing 
this at an advanced level ? (e.g. connecting with 4D client native to a 4D 
server that’s 3rd-party hosted).

Regards

Peter

**
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 Server Hosting - The Future ?

2019-10-10 Thread Peter Jakobsson via 4D_Tech
Thanks for your post Kirk.

The guy I spoke to seemed to have it the other way around - the VM’s had 4-12 
cores and the “metal” about 32.

He also was of the categorical opinion that the only way to really keep 
applications “isolated” from each other (i.e. not bring everything else down 
when they crashed) was to give each mission critical application or service its 
own VM.

When I put to him “what about the natural O/S level multi-threading” he felt 
there were too many vulnerabilities and mentioned especially the “crypto 
viruses” and the Intel multi-threading bug. His approach was basically - if 
your VM needs ore resources then we can simply allocated more. He wasn’t really 
bothered by the idea of applications that were multi-threaded internally 
because it’s all the one big bucket and if something inside the bucket needs 
more power then just make the bucket bigger.

Peter


> On 10 Oct 2019, at 16:09, Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com>
> wrote:
> 
> The other thing about VM vs metal is the whole pre-emptive process
> benefit basically goes away. Thomas Maul has shown this at the Summit.
> Having n+ virtual cores doesn't do anything to actually increase processing
> speed because the VM is running on whatever is allocated to it.
> Theoretically you could have a VM with 4 cores running an instance with 32
> cores

**
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 Server Hosting - The Future ?

2019-10-10 Thread Peter Jakobsson via 4D_Tech


> On 10 Oct 2019, at 16:58, Chip Scheide <4d_o...@pghrepository.org> wrote:
> 
> that all is great until the hardware running the 4,382,619 VMs crashes

According to “the guy”, that’s all taken care of. Even if the “metal” melts 
down, the VM’s just “seamlessly” migrate themselves onto other metal without 
the users even knowing !

Don’t ask me quite how that works but he kept saying it wasn't a problem.

-P

**
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 Write Preview Fails on certain workstation (Windows)

2020-03-06 Thread Peter Jakobsson via 4D_Tech
Hi

I was wondering if anybody had encountered this issue.

4D Write document preview (created using "WR Build Preview”)  displays a blank 
picture only on one workstation on the entire network (there are 8 
workstations). There is nothing obviously distinct about that workstation:

4D v15 (Client-server)
Windows 10 Pro
Intel Core i7-7700 3.6 GHz

I might try "myPicture:=myPicture|myPicture” to create a bitmap and try 
displaying that. The preview is transient - does not get stored anywhere. The 
funny thing is that one type of document displays ok. The other’s don’t so it 
may be some bad character embedded in the document, however they all display 
fine on all other workstations.

If anybody has seen this I’d appreciate any hints !

Regards

Peter

**
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 and 4D Write Classic - does it work ?

2020-02-06 Thread Peter Jakobsson via 4D_Tech
Many thanks for that comprehensive and extensive commentary Tim !

Looks like I have my work cut out. All the 4D Write code I have is in a 
component and the component makes around 30 calls or so to 4D Write. There’s no 
raw host calls anywhere. Hopefully it will be do-able but will take your advice 
and read the manuals in depth.

Thanks again !

Regards

Peter

> On 5 Feb 2020, at 16:07, Tim Nevels via 4D_Tech <4d_tech@lists.4d.com> wrote:
> 
> Warning: You may not going like what I have to say below

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

v18 and 4D Write Classic - does it work ?

2020-02-05 Thread Peter Jakobsson via 4D_Tech
Hi

I’m going to be making the leap from v15 to v18. I think the biggest transition 
will be moving to 4D Write Pro as I have quite a lot of legacy 4D Write code to 
deal with.

In the meantime, does anybody have experience of migrating big 4D Write 
codebases ? What are the major gotchas ?

Will legacy 4D Write work in v18 in the meantime or do we need to migrate to 4D 
Write Pro to even run it ? (When I try it it invokes license privilege errors 
everywhere).

Many thanks for any tips

Peter

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

What constitutes high-perf. hardware for 4D server these days ?

2020-02-19 Thread Peter Jakobsson via 4D_Tech
…that is the question !

I have a site that I just launched - usual moderate-trauma of initial days  but 
basically holding up so far and improving by the day.

I now need to try and optimise it a bit as it’s still slightly sluggish and was 
wondering what people were running in terms of hardware. Everything at this 
place is on VM - nothing I can do about it as it’s contractor managed. (In fact 
they seem to be able to change the “hardware" without me even taking the server 
down - that’s something I never thought I’d see and am too old now to bother 
speculating how they do it :-) !).

I have quite a lot of trigger-code for doing journal posting and so on so I 
suppose that does a fair bit of “slowing” running in the co-operative thread. 
(The support guy at the contractor noticed it remotely…”hey your DB is all 
crammed into a single core !”. )

Specs are:

4D Server v15.
8 users.

Intel (R) Xeon (R) CPU, E5 2620 v4, 2.1 GHz
SSDs (Quite fast ones but not sure of the exact spec)
Windows 10 Server 64 Bit

Would increasing the CPU speed help with the trigger execution or is it all 
bandwith ?

I’m also going to do some logging-mode execution as I’m sure there are 
sequential searches going on in a few places as I usually try to keep indexes 
light to start with and wait till I see where I need them. I have a parallel 
server running on another machine with my partner license so I can try stuff 
out there.

Any tips and/or experiences appreciated !

Regards

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

  1   2   >