Re: Scope of entity selection

2018-10-13 Thread Alan Chan via 4D_Tech
Hi Peter,

I haven't touched v17 yet. There might be easier way. If not, you could try 
LONGINT ARRY FROM SELECTION and pack the array into shared object.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>This may be related to other thread - Defining and documenting objects - as
>it is related to scope of new objects: I am playing a bit with 4D v17, and,
>if I understand it correctly, I can pass around shared objects and shared
>collection between processes (and workers, but I am not that far yet.)
>
>However, how I pass around entity selections? It does not seems I can pass
>them as a parameter (new process will get null.) I tested to declare entity
>selection as shared object, but it does not work either.
>
>I am trying to do something like global named selection. Examples that,
>say, pass selections to workers pass a condition to build a selection. This
>seems to restricting.
>
>Am I overlooking something obvious?
>
>--
>
>Peter Bozek
>

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

Re: Scheduled ISP Maintenance @ 4D Office (France)

2018-08-07 Thread Alan Chan via 4D_Tech
I guess most engineers of its ISP were on vacation (the famous French summer 
vacation).

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>I have been trying to get licensing since Friday Still no luck.
>
>dave
>
>On Tue, Aug 7, 2018 at 4:26 AM, Pat Bensky via 4D_Tech
><4d_tech@lists.4d.com> wrote:
>> I'm still unable to register a licence as of Tuesday 11 AM UK time ...
>>
>> On Mon, 6 Aug 2018 at 15:24, Tai Bui via 4D_Tech <4d_tech@lists.4d.com>
>> wrote:
>>
>>> Hi,
>>>
>>> For some reason it appears that the internet has been down since the ISP
>>> performed their maintenance.
>>> The ISP has been informed and should be working on it.
>>>
>>> Apologies for the inconvenience.
>>>
>>> Best Regards,
>>> -Tai B.
>>>
>>>
>>>
>>> **
>>> 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
>>> **
>>
>>
>>
>> --
>> *
>> CatBase - Top Dog in Data Publishing
>> tel: +44 (0) 207 118 7889
>> w: http://www.catbase.com
>> skype: pat.bensky
>> *
>> **
>> 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
>> **
>
>
>
>-- 
>David Nasralla
>Clean Air Engineering
>**
>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: v16 & 17 components and plugins

2018-07-18 Thread Alan Chan via 4D_Tech
Quote
"Over the course of different versions, the most useful 4D Pack routines were 
progressively integrated into 4D itself, while those that became obsolete were 
removed. Starting with 4D v16 R2, the 4D Pack plug-in is no longer provided in 
versions of
4D"
end quote

http://livedoc.4d.com/What-s-new/Deprecated-and-Removed-Features-17/Deprecated-or-removed-features-in-v17-product-range.200-3761903.en.html

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Hi All,
>
>I am starting upgrade and can not see to find the following in install image
>
>4D POP
>4D Pack
>
>Any ideas where that they might be, or have they been deprecated 
>
>Thanks and regards
>
>Chuck
>
> Chuck Miller Voice: (617) 739-0306
> Informed Solutions, Inc. Fax: (617) 232-1064   
> mailto:cjmillerinformed-solutions.com 
> Brookline, MA 02446 USA Registered 4D Developer
>   Providers of 4D and Sybase connectivity
>  http://www.informed-solutions.com  
>
>This message and any attached documents contain information which may be 
>confidential, subject to privilege or exempt from disclosure under applicable 
>law.  These materials are intended only for the use of the intended recipient. 
>If you are not the
>intended recipient of this transmission, you are hereby notified that any 
>distribution, disclosure, printing, copying, storage, modification or the 
>taking of any action in reliance upon this transmission is strictly 
>prohibited.  Delivery of this
>message to any person other than the intended recipient shall not compromise 
>or waive such confidentiality, privilege or exemption from disclosure as to 
>this communication. 
>
>**
>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: What do you use to monitor your offsite servers?

2018-07-16 Thread Alan Chan via 4D_Tech
We use RealVNC on all servers but use TeamViewer for client machines. We used 
to use LogMeIn for client machines but our support guys prefer Teamviewer and I 
didn't ask why.

Alan Chan

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

Re: just a curiosity - pre emptive threads

2018-07-13 Thread Alan Chan via 4D_Tech
Oops... I reply too fast. You've answered your question.

Alan Chan

Chip Scheide <4d_o...@pghrepository.org> writes:
>(I think that to get around the Set process variable you would use 
>'Storage')

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

Re: just a curiosity - pre emptive threads

2018-07-12 Thread Alan Chan via 4D_Tech
May be using Shared Object to replace variable.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>1 - doesn't this idea 'break' with preemptive code (using Set Process 
>Variable)?
>(I think that to get around the Set process variable you would use 
>'Storage')
>2 - how does 4D know/stop/manage code lie the following from doing 
>executing Set Process Variable into a preemptive process?

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

Re: just a curiosity - pre emptive threads

2018-07-12 Thread Alan Chan via 4D_Tech
Why not? It isn't supported? I just checked In Transaction in trigger is a 
preemptive compliant. It means, preemptive mode does expect transaction. Any 
hidden constraint?

Without transaction, trigger is meaningless. When a trigger invoked, mulitple 
tables might be updated inside the trigger. When trigger was rejected, other 
updated tables won't roll back except the trigger invoking table. This would 
cause serious
data integrity issue.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>transactional data entry is kind of task you would typically want to avoid 
>using preemptive mode.

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

Re: just a curiosity - pre emptive threads

2018-07-12 Thread Alan Chan via 4D_Tech
I don't need preemptive client side on data updates. I care about server side 
only. Data entry/updates are human works in our case, one at a time (one entry 
per second through barcode scanner). If triggers on server could be completed 
in less time
even when server loading is heavy, it won't drag down data entry on client 
side. Say 200 users are doing data entries through barcode in multiple shops, 
200 triggers in every second and each trigger update multiple tables. Customers 
are queueing
long lines on POS counters, it's not fun. Hong Kong is a crazy city, shops are 
packed of people even in LV shops. In some cases, shops do crowd control:-(

For me, preemptive 4D Remote (if it's available) might be helpful on progress 
bar update in tight loop operations. Redrawing progress bar in cooperative 
process take up way more time than actual loop.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Does it make sense for most triggers? Usually you want to know for sure that 
>code in a trigger has completed before doing anything else in the 
>table/process, which is kind of the opposite of a preemptive thread.

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

Re: just a curiosity - pre emptive threads

2018-07-12 Thread Alan Chan via 4D_Tech
That's what I understand in the first place as following.

- do data entry in a form (UI in application process)
- in the form, I click a button call SAVE RECORD (in the same applicaation 
process)
- As long as all codes in the trigger are preemptive compliant, the trigger 
would be running in preemptive mode in server.

However, Miyako San said it won't work on first reply due to UI but seems OK on 
2nd reply (because of my unclear description). Just want to confirm before I 
rewrite all trigger codes (not trivial) and move away all IP variables.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>As I understand it, if you have a C/S, SAVE RECORD runs in its own
>preemptive thread _on server_. It does not matter if 4D process that called
>SAVE RECORD is preemptive or not. As clients does not run preemptive
>processes, the whole point seems to be moot.
>
>On single user, SAVE RECORD and the trigger(s) it executes runs in the same
>system thread the process that called SAVE RECORD. It means that if you
>want to save record in preemptive process, both the method that executes SAVE
>RECORD and the trigger need to be able to run preemptively. In fact, as I
>understand it, all triggers need to be able to run preemptively.
>
>It means that to do what you described - pass record to worker to be saved
>in preemptive thread - would make difference in single user only. But there
>you would not gain anything from calling SAVE RECORD in a worker.
>Additional messaging with another thread will rather slow the application
>down.

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

Re: just a curiosity - pre emptive threads

2018-07-12 Thread Alan Chan via 4D_Tech
I'm a bit confused.

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

If I create a new process that contain "no" UI from application process, this 
is again, not OK.

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

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>DB4D requests (19814) are all preemptive since v11,
>so if you call the command SAVE RECORD on the client side (a cooperative 
>process),
>the request is still processed on the server side in preemptive mode (i.e. you 
>don't congest the server).
>
>it sort of becomes a moot point that you are calling the command in 
>cooperative mode,
>because the bulk of the work (marshalling data and exchanging it via the 
>network) is done in preemptive mode any way. same for Begin SQL/End SQL, which 
>is not thread safe, but of course SQL requests (19812) are all preemptive 
>since v11.

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

Re: just a curiosity - pre emptive threads

2018-07-12 Thread Alan Chan via 4D_Tech
Thanks. OK. Forget about the syntax, just the idea.

- open data entry dialog
- check button value
- if button value is validate, save all new value in an object, then call 
worker with object and form window process as parameters
- the worker process create new/load an existing record and modify based on 
value in object and do SAVE RECORD in transaction
- worker process call form to notify the entry dialog if transaction if OK or 
rejected

Would it be OK?

Alan Chan


4D iNug Technical <4d_tech@lists.4d.com> writes:
>UI cannot run in preemptive process, that is requirement of underlying OS
>that require that all UI runs in the main thread. But there is no reason
>why the trigger, running on server, could not run in a separate preemptive
>thread.
>
>I believe much of the confusion is caused by mixing up 4D-level processes
>with OS-level threads. OS thread is preemptive or not and cannot switch
>between two. 4D process runs in one OS thread and thus cannot switch
>between preemptive and cooperative, but that does not hold for server
>triggers. Even when invoked from non-preemptive 4D process, trigger runs on
>its own OS-level thread on server machine and that thread can be preemptive.

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

Re: just a curiosity - pre emptive threads

2018-07-12 Thread Alan Chan via 4D_Tech
Simply put, preemptive triggers are not for client/server operations even all 
the codes are preemptive-compliant.

- data entry UI and do entry data
- click a button call a method that contains SAVE RECORD that invoke trigger in 
server and all codes in this method itself and codes in trigger are all 
preemptive-compliant
- In this case, trigger won't be preemptive because the method above was called 
from UI.

Am I correct?

TIA

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>I agree it would be nice to eventually have preemptive mode on the client 
>side, but I also think the subject needs to be discussed in context.
>
>Preemptive mode makes it possible to run multiple processes independent of 
>each other concurrently, so the primary benefactor should be the server.
>
>After all, preemptive processes can't have a UI, neither can it sync with 
>other processes (without using semaphores etc.), so in many ways its like a 
>stored procedure (and not a method with the “execute on server” property.)
>
>2018/07/12 13:36、Alan Chan via 4D_Tech 
><4d_tech@lists.4d.com<mailto:4d_tech@lists.4d.com>>のメール:
>Of course, SAVE RECORD, DELETE RECORD is needed to invoke trigger. However, 
>the method that call SAVE RECORD would be executed in 4D Remote and 4D Remote 
>isn't supported. A dead lock?
>
>
>
>**
>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
>**

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

Re: just a curiosity - pre emptive threads

2018-07-11 Thread Alan Chan via 4D_Tech
Of course, SAVE RECORD, DELETE RECORD is needed to invoke trigger. However, the 
method that call SAVE RECORD would be executed in 4D Remote and 4D Remote isn't 
supported. A dead lock?

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>there is no "thread safe" property for triggers.
>
>however,
>
>if you use commands like SAVE RECORD, DELETE RECORD
>from a method chain that is marked as thread safe,
>then the call chain of that table's trigger is checked for thread safety at 
>compile time.
>
>in fact the compiler is smart enough to resolve expressions such as Table(n)->
>(all triggers are inspected for such expressions, so actually its better to 
>use absolute tokens)
>
>2018/07/12 12:20、Alan Chan via 4D_Tech 
><4d_tech@lists.4d.com<mailto:4d_tech@lists.4d.com>> のメール:
> I'm just wondering does anyone try that out on triggers?
>
>

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

Re: just a curiosity - pre emptive threads

2018-07-11 Thread Alan Chan via 4D_Tech
Hopefully, 4D remote could be supported in 4D 18:-(

However, 4D server (thus triggers) is supported. I'm just wondering does anyone 
try that out on triggers?

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Are you doing all this in single user mode?
>
>I think a lot of people don't realize that preemptive threads aren't supported 
>on 4D Remote at all.

**
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: "Your password does not allow you to use this form"

2018-05-24 Thread Alan Chan via 4D_Tech
May be trying to use Char(1) instead of "xxx".

Char(1) works well for us.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>On v13.5:
>
>Forever, we've had a Labels option with this code:
>
>PRINT LABEL(Table(iTableNumber)->;"xxx")
>
>​This has always worked as expected: it opens the Label Editor with a blank
>label, and a list of fields form the table specified by iTableNumber.
>
>But it now displays the alert "Your password does not allow you to use this
>form" instead of opening the label editor. This happens no matter how the
>user is logged in - even when I'm logged in as Designer.
>
>Note that it works OK in v16.
>
>Any ideas? I can't find any place where access to the label editor can be
>controlled.

**
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: Preventing Return and Enter from Closing a Dialog

2018-05-20 Thread Alan Chan via 4D_Tech
In additions to what you did in your link, did you also do the following :

1) Set standard action to no action instead of accept
2) Set form event to on clicked
3) Add a method in button to do your search or whatever and make sure no 
command of ACCEPT being used.

It has been working for us for decades.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Thanks for everyone's help. I couldn't get the Database Settings 
>solution to work. Very weird. I set it to this and still "Enter" closed 
>the window.
>https://www.dropbox.com/s/drzxr3othn8dti8/Screenshot%202018-05-20%2016.11.58.png?dl=0

**
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: Preventing Return and Enter from Closing a Dialog

2018-05-20 Thread Alan Chan via 4D_Tech
Our system has all default Accept/Cancel shortcut unchecked in Database Design 
Interface setting. We disabled it 20+ years ago:-) It was a tough call back 
then.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>It gets weird if you have an application-wide default close and cancel key. 
>Even with no-action buttons, if you disable the button it passes through to 
>the default behavior for the application. So if you have a dialog with an OK 
>button of type
>Default Button which should only enable in certain cases, if you don't either 
>write an event handler or write a lot of code and show/hide invisible buttons, 
>that enter key will dismiss the form no matter what the state of the button is.
>
>It would be great if you could override that for specific forms.  In a big old 
>application that was developed with Enter/Cmd+. set decades ago as the 
>application default it's very difficult to clear these without retesting every 
>single form.


**
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: Preventing Return and Enter from Closing a Dialog

2018-05-20 Thread Alan Chan via 4D_Tech
Would setting the Standard Action to No Action be OK in button properties?

Then add a method in button to do whatever you like.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Aloha,
>
>I'm playing with the "proper" way to open up a form. Here's what I have:
> Open form window([ARInvoice_Payments];"Invoice_Payment_List";Plain 
>form window;On the left;Vertically centered)
> DIALOG([ARInvoice_Payments];"Invoice_Payment_List")
>
>It works fine, but if a user presses "Enter" the window closes. I 
>actually want "Return" and "Enter" to activate a search button. But that 
>doesn't happen either.
>
>If I make the search button the search button, the default button, that 
>traps the "Return" key from closing the window.
>
>An invisible button to trap the "Enter" key doesn't work.
>Assigning a shortcut of "Enter" to my search button doesn't work
>
>Am I missing something simple?
>
>
>
>Sannyasin Siddhanathaswami

**
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: 4d servers down

2018-04-22 Thread Alan Chan via 4D_Tech
We can't access it either:-(

Very unstable recently.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>livedoc, taow, 4dbb web servers do not respond. 
>So do you? 
>
>-- 
>Arnaud de Montard 
>
>
>
>**
>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
>**

**
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: Error Code reserved by 4D

2018-02-03 Thread Alan Chan via 4D_Tech
Hmm... I didn't see -20002 there.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>which should logically exclude predefined error codes,
>but even then, you are not prohibited from using a certain range.
>
>http://doc.4d.com/4Dv16R4/4D/16-R4/Error-Codes.200-3316679.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
**

Re: Error Code reserved by 4D

2018-02-02 Thread Alan Chan via 4D_Tech
Thanks for the info.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>adding to Tim's comments:
>
>you can return an arbitrary error code from on backup startup / shutdown
>
>http://doc.4d.com/4Dv16R4/4D/16-R4/On-Backup-Startup-database-method.301-3316874.en.html
>http://doc.4d.com/4Dv16R4/4D/16-R4/On-Backup-Shutdown-database-method.301-3316859.en.html
>
>which should logically exclude predefined error codes,
>but even then, you are not prohibited from using a certain range.
>
>http://doc.4d.com/4Dv16R4/4D/16-R4/Error-Codes.200-3316679.en.html
>
>2018/02/02 18:36、Alan Chan via 4D_Tech 
><4d_tech@lists.4d.com<mailto:4d_tech@lists.4d.com>> のメール:
>Could anyone tell if 4D changes error code range reserved by 4D?
>
>

**
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: Error Code reserved by 4D

2018-02-02 Thread Alan Chan via 4D_Tech
Hi Tim,

I meant under -15000 not 15000. 4D or OS reserved error code above -15000 if my 
memory serve me right. I'm not talking real system crash and just 2 error codes 
collide and cause confusion. We trap and also generate various error codes 
returning from
triggers when it doesn't meet specific business rules. The error codes would be 
converted to verbose form to users. We use error code from -15001 to -2.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Alan,
>
>Are you thinking about plugin id numbers?
>ftp://ftp.4d.com/ACI_TECHNICAL_NOTES/2009/MacOS/TN_2009_01-04_(JAN)/09-02_4D_Plug-in_Dev_Guide_-_Part_1.pdf
>{" You should pick a number between 15000 and 32767."}
>
>How would retuning a similar error code cause a crash?
>How are you returning the error code?
>
>-Tim
>
>
>-Original Message-
>From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Alan Chan via 
>4D_Tech
>Sent: Friday, February 02, 2018 1:36 AM
>To: 4d_tech@lists.4d.com
>Cc: Alan Chan <a...@belhk.com>
>Subject: Error Code reserved by 4D
>
>I thought error codes under -15000 were not reserved by 4D. Now it produces 
>error -20002 that might crash with user generated error for business rules 
>control.
>
>Could anyone tell if 4D changes error code range reserved by 4D?
>
>TIA.
>
>Alan Chan
>
>4D iNug Technical <4d_tech@lists.4d.com> writes:
>>I just today got the -20002 error in a compiled database.
>>The issue is/was pointers.
>
>
>>I still have to use a different method to handle the error because I
>>get a -20002 (accessing a parameter that does not exist) error in compiled 
>>mode. I think this -20002 error is related to my usage of $0 in the normal 
>>context of this method ($0 is not used in the error handler context).  It 
>>looks like you also
>return a Boolean in $0 but you do not mention seeing the -20002 error; weird. 
>Have you have provoked your error handler in compiled mode?
>

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

Error Code reserved by 4D

2018-02-02 Thread Alan Chan via 4D_Tech
I thought error codes under -15000 were not reserved by 4D. Now it produces 
error -20002 that might crash with user generated error for business rules 
control.

Could anyone tell if 4D changes error code range reserved by 4D?

TIA.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>I just today got the -20002 error in a compiled database.
>The issue is/was pointers.


>I still have to use a different method to handle the error because I get a 
>-20002 (accessing a parameter that does not exist) error in compiled mode. I 
>think this -20002 error is related to my usage of $0 in the normal context of 
>this method ($0 is
>not used in the error handler context).  It looks like you also return a 
>Boolean in $0 but you do not mention seeing the -20002 error; weird. Have you 
>have provoked your error handler in compiled mode?

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

Re: "Goodbye 4D Write" email

2018-02-01 Thread Alan Chan via 4D_Tech
Omnis is still around and very alive.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>How many of you
>used to work using Foxbase, dBase, Omnis, to name a few. Just be greatful
>that the company has been able to keep up with the times and is still a
>viable product.

**
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 v13 and Windows 10

2018-01-28 Thread Alan Chan via 4D_Tech
We don't know about 13.5. However, with 13.6, we haven't encountered any issue 
on Windows 10 so far.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Hey everyone - in a nutshell, what's the current wisdom on 4D v13.5 
>compatibility with the different flavors of Windows 10? I've been in a 
>Mac-only universe for the past few years (so nice... lol) and haven't been 
>keeping up with the Windows side
>of things.
>
>Thanks...
>
>--
>Jeffrey Kain
>jeffrey.k...@gmail.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
>**

**
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: localisation (again)

2017-12-13 Thread Alan Chan via 4D_Tech
Alternative simplified version of Num for this situation

C_REAL($0;$num)  //same as ES_num yet support decimal
C_TEXT($1)
C_LONGINT($len;$i;$k;$j)
$num:=0
$len:=Length($1)
For ($i;$len;1;-1)
$k:=Character code($1[[$i]])
If (($k>47) & ($k<58))
$num:=$num+(($k-48)*(10^($len-$i-$j)))
Else 
If ($k=46)  //decimal
$num:=$num*(10^-($len-$i-$j))
$len:=$i
$j:=1  //$j+1
Else 
$len:=$len-1
End if 
End if 
End for 
If ($k=45)
$num:=$num*-1
End if 
$0:=$num

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Hi
>But Thats what I'm doing, and its not working.
>
>The string looks like "12345.12345" and the Conversion looks like
>
>C_REAL($Number)
>C_TEXT($NumString)
>$NumString:-"12345.12345"
>$Number:=Num($NumString;".")
>
>On a UK system $Number = 12345.12345
>On a German system $Number = 12345
>
>any ideas would be very welcome
>Im considering using replace string on $numString to replace "." with the
>local separator, in this case ","
>
>thanks
>-pm
>
>On Wed, Dec 13, 2017 at 2:32 AM, Chuck Miller via 4D_Tech <
>4d_tech@lists.4d.com> wrote:
>
>> Much better than my choice which was substring till the period and then num
>>
>> Regards
>>
>> Chuck
>> 
>> 
>>  Chuck Miller Voice: (617) 739-0306
>>  Informed Solutions, Inc. Fax: (617) 232-1064
>>  mailto:cjmillerinformed-solutions.com
>>  Brookline, MA 02446 USA Registered 4D Developer
>>Providers of 4D and Sybase connectivity
>>   http://www.informed-solutions.com
>> 
>> 
>> This message and any attached documents contain information which may be
>> confidential, subject to privilege or exempt from disclosure under
>> applicable law.  These materials are intended only for the use of the
>> intended recipient. If you are not the intended recipient of this
>> transmission, you are hereby notified that any distribution, disclosure,
>> printing, copying, storage, modification or the taking of any action in
>> reliance upon this transmission is strictly prohibited.  Delivery of this
>> message to any person other than the intended recipient shall not
>> compromise or waive such confidentiality, privilege or exemption from
>> disclosure as to this communication.
>>
>> > On Dec 12, 2017, at 7:22 PM, Keisuke Miyako via 4D_Tech <
>> 4d_tech@lists.4d.com> wrote:
>> >
>> > the second "separator" argument for Num() has existed and has been a
>> "must use" feature since v11 for i18n.
>> >
>> > http://doc.4d.com/4Dv16/4D/16.3/Num.301-3651255.en.html <
>> http://doc.4d.com/4Dv16/4D/16.3/Num.301-3651255.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
>**

**
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: poor performance LISTBOX INSERT COLUMN

2017-12-04 Thread Alan Chan via 4D_Tech
4D iNug Technical <4d_tech@lists.4d.com> writes:
>Maybe it does matter how many listboxes are on the form?

I assumed you built LB with one method per LB.
>
>Maybe LISTBOX INSERT COLUMN becomes slower when more columns are inserted?

I assumed that you were "appending" column instead of inserting column before 
existing columns.

Optimization is fun although some developers are against it.

Health warning : Optimization could be highly addictive and hazardous to your 
mentality.

Alan Chan

**
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: poor performance LISTBOX INSERT COLUMN

2017-12-03 Thread Alan Chan via 4D_Tech
I just tested LISTBOX INSERT COLUMN command on array based LB that takes only 0 
to 1 ms to complete on my MBP 2.90GHZ with 16G memory. I'm not sure if size of 
array is the factor.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>The LISTBOX INSERT COLUMN command takes on average 0.0286 seconds to complete, 
>tested on a Intel Core i7-4710MQ 2.50GHz laptop

**
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: poor performance LISTBOX INSERT COLUMN

2017-12-03 Thread Alan Chan via 4D_Tech
If your customer want to be king, he/she has to act like one, spend like one.

Did your customer try to put up more resources on hardware? Investing 32G+ 
memory on 4.0Ghz+ machine with great grahic chip for big monitor to run your 
application might be helpful especially populating 27 listbox with total 477 
columns (unknow
number of rows).

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>When customers ask for showing 10 listboxes at once on screen, with each 
>listbox having 20 columns I don't know if it is reasonable, but as you 
>probably know customer is king.

**
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: Connection is broken, cannot receive request reply

2017-11-14 Thread Alan Chan via 4D_Tech
Just curious, 4 seconds for idle connections timeout?

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>SET DATABASE PARAMETER(54;4)// Idle connections timeout

**
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: Gridline for header in Listbox

2017-11-11 Thread Alan Chan via 4D_Tech
I agree with your taste:-) In fact, we originally used alternate color that 
looks really good and I love it. This is the case in "most" scenario except 
those contains so many columns and rows in a limited sized LB. This would make 
it so cramped.
Finally, we have 2 desgins - one with alternate color for LB with only few 
columns or the LB could be spared with more space on screen, mostly in 
accounting module. The rest stay with non-alternate-color approach.

The conclusion are result of votes from our engineers and a few of our major 
clients. Afterall, we are company of democracy . except on pricing:-)

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>really no alternating color??
>it makes reading the listboxes SO much easier.
>
>I use a pale green and white (like the old tractor fed paper), but let my 
>users select their own color if they desire. 
>If they pick something like BRIGHT ELECTRIC RED they are the ones to have to 
>live with it  :)
>(I do have reset to default color button) for when the users make it too 
>bright to look at.  :)
>
>
>> Hi Keith,
>> 
>> Good trick. For the moment, we didn't use zebra stripes for other 
>> reasons. We might simply draw a line under the header for Windows 10 
>> users with Miyako's approach.
>> 
>> Alan Chan
>> 
>> 4D iNug Technical <4d_tech@lists.4d.com> writes:
>>> Alan, I noticed this too - it does look odd - and I couldn’t find a 
>>> command to do it, so I found a work-around…
>>> 
>>> Because my listboxes have the zebra stripes (every 2nd row has a 
>>> light grey background), I simply reversed the order of the row 
>>> colour in the design window - the grey ones now come first so there 
>>> “seems” to be a header border.
>>> HTH, Keith
>>> 
 Any idea how to set horizontal gridline only for header but not 
 rows in Listbox in 4D 15.5?
 
 On Mac, there’s horizontal line for header automatically which 
 looks good. However, on Windows 10, no line for header which looks 
 odd...
>>> **
>>> 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
>> **
>
>Hell is other people 
> Jean-Paul Sartre
>**
>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: Gridline for header in Listbox

2017-11-10 Thread Alan Chan via 4D_Tech
Hi Keith,

Good trick. For the moment, we didn't use zebra stripes for other reasons. We 
might simply draw a line under the header for Windows 10 users with Miyako's 
approach.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Alan, I noticed this too - it does look odd - and I couldn’t find a command to 
>do it, so I found a work-around…
>
>Because my listboxes have the zebra stripes (every 2nd row has a light grey 
>background), I simply reversed the order of the row colour in the design 
>window - the grey ones now come first so there “seems” to be a header border.
>HTH, Keith
>
>> Any idea how to set horizontal gridline only for header but not rows in 
>> Listbox in 4D 15.5?
>> 
>> On Mac, there’s horizontal line for header automatically which looks good. 
>> However, on Windows 10, no line for header which looks odd...
>**
>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: Gridline for header in Listbox

2017-11-10 Thread Alan Chan via 4D_Tech
I never thought of adding a line there. Smart:-)

Thanks.

Alan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>the header simply inherits the standard Windows 10 menubar design.
>
>in that sense, it is not "odd".
>
>but if you must, you could try something like this:
>
>https://github.com/4D-JP/4d-tips-listbox-header-border
>
>> 2017/11/10 17:47、Alan Chan via 4D_Tech <4d_tech@lists.4d.com> のメール:
>> no line for header which looks odd.
>
>

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

Gridline for header in Listbox

2017-11-10 Thread Alan Chan via 4D_Tech
Any idea how to set horizontal gridline only for header but not rows in Listbox 
in 4D 15.5?

On Mac, there’s horizontal line for header automatically which looks good. 
However, on Windows 10, no line for header which looks odd.

I tried LISTBOX SET GRID and none of followings works:-(

LISTBOX SET GRID($pheader->;true;true)
LISTBOX SET GRID(*;$headerName;true;true)

Any clue?

TIA

Alan Chan


**
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: Normalization question

2017-11-08 Thread Alan Chan via 4D_Tech
Table
Project Master
Employee Master
Project member

Project master <- Project member -> Employee master

Project member table contains Role (integer) 0=regular member; 1=role A; 2=role 
B; 3=whatever role

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Given a Project table and an Employee table where Employees can be Project 
>Principles, Project Managers, and Project Supervisors, what would be the 
>proper way to create a normalized table structure in 4D. In the end an 
>assigned employee’s
>information, like name for example, would automatically be displayed in the 
>project’s output form for each of these assignments.
>
>I am pretty sure using the proper Select/Join commands in SQL this could 
>easily be done, but I am falling short with 4D as none of these structures 
>work...
>
>[Employees]ID  <——— [Projects]PrincipleEmployeeID
> <——— [Projects]ProjectMangeEmplyeerID 
> <——— [Projects]SupervisorEmployeeID
>
>OR using linked tables….
>   (There is only one record in each linking table for 
> each employee assigned a role)
>[Employees]ID  
><———[Principles]EmployeeID<———---[Projects]PrincipleEmployeeID
><———[ProjectManagers]EmployeeID <——— 
> [Projects]ProjectMangeEmplyeerID
><———[Supervisors]EmployeeID <——— 
> ---[Projects]SupervisorEmployeeID
>
>The only way I can see to make it work is to denormalize it and put the 
>pertinent data from the Employee table into the linking tables in which case 
>the relationship between the employee table and the linking tables become 
>irrelevant. 
>
>I have no problem denormalizing, but thought this might be a good exercise to 
>retain a few more cells in my aging brain. ;-)
>
>John
>
>
>John Baughman
>Kailua, Hawaii
>(808) 262-0328
>john...@hawaii.rr.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
>**

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

Re: [Warning] Settings properties values on object field by object notation

2017-11-02 Thread Alan Chan via 4D_Tech
I am not challenging how 4D feature request should be working. I'm just 
wondering if 4D support folks file the request with the link to this thread like
http://4d.1045681.n5.nabble.com/Warning-Settings-properties-values-on-object-field-by-object-notation-td5755088.html
 and 
http://4d.1045681.n5.nabble.com/Re-Warning-Settings-properties-values-on-object-field-by-object-notation-td5755127.html

I guess 4D does not allow internal staffs filing feature request.

Alan chan


4D iNug Technical <4d_tech@lists.4d.com> writes:
>These arguments should be posted on the feature request forum which is the 
>official place to request this kind of change.  This is especially important 
>because in this case we are talking about a feature that is currently in 
>preview.  The feature
>is not yet recommended for production use and "final implementation could be 
>slightly different”.  It is the ideal time to request changes in behavior and 
>I do not see a request for this posted yet. Please post it so that engineering 
>has a clear
>understanding of your concerns.

**
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: San Fransisco Font

2017-10-10 Thread Alan Chan via 4D_Tech
Interesting, we don't actual use stylesheet. Back to old days (non-unicode), we 
need to assign different font for different languages. Due to different OS 
version and platform, we allow users to set font but not font size and saved by 
machine. These
setting has been embedded in our system for decades and still in place after we 
switched to unicode years ago. So far it works well with Traditional Chinese 
and Simplified Chinese. All other forms (input, output and printings) are set 
during on load
with Object set Font based on object name style.

Of course, this is not in v16 and not there yet.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>changing the font according to what you get from this,
>or any other ways to obtain the system font name,
>is going to fail when the app starts to display and accept text outside the 
>latin alphabet.

**
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: v13 - replace string, odd slowness

2017-09-30 Thread Alan Chan via 4D_Tech
Just rewrite it not to use variable to blob which might be easier to read.

C_TEXT($0;$1;$2;$3;$source;$oldStr;$newStr;$result;$tempTxt)  
//ES_ReplaceStr($source;$oldString;$newString;{$count pointer})->Resulted text
C_POINTER($4)
C_LONGINT($oldLen;$newLen;$oldStrLen;$NewStrLen;$count;$offset;$offset2;$start;$pos;$n)
C_BLOB($blob;$blob2)  //this has been optimised for shrink and expand
$source:=$1
$oldLen:=Length($source)  //$source is the source text
$oldStr:=$2
$newStr:=$3
$oldStrLen:=Length($oldStr)
$newstrlen:=Length($newStr)

If ($NewStrLen>$oldStrLen)
$start:=1
$count:=0
Repeat 
$pos:=Position($oldstr;$source;$start;*)
If ($pos>0)
$start:=$pos+$oldStrlen
$count:=$count+1
End if 
Until ($pos=0)
$newLen:=$oldLen+(($NewStrLen-$oldStrLen)*$count)
SET BLOB SIZE($blob;$newlen*2;0)
Else 
SET BLOB SIZE($blob;$oldlen*2;0)
End if 

$offset:=0
$start:=1
$count:=0
Repeat 
$pos:=Position($oldstr;$source;$start;*)
If ($pos>0)
$tempTxt:=Substring($source;$start;$pos-$start)+$newStr
$n:=Length($tempTxt)
If ($n>0)
CONVERT FROM TEXT($tempTxt;1014;$blob2)
$offset2:=$n*2  //BLOB size($blob2)
COPY BLOB($blob2;$blob;0;$offset;$offset2)
$offset:=$offset+$offset2
End if 
$start:=$pos+$oldStrLen
$count:=$count+1
End if 
Until ($pos=0)

If ($count>0)
If ($start<=$oldlen)
$tempTxt:=Substring($source;$start)
$n:=Length($tempTxt)
If ($n>0)
CONVERT FROM TEXT($tempTxt;1014;$blob2)
$offset2:=$n*2  //BLOB size($blob2)
COPY BLOB($blob2;$blob;0;$offset;$offset2)
End if 
End if 

If ($oldStrlen>$NewStrLen)
$newLen:=$oldLen+(($NewStrLen-$oldStrLen)*$count)
SET BLOB SIZE($blob;$newlen*2)
End if 
$result:=Convert to text($blob;1014)
$0:=$result
Else 
$0:=$1
End if 

If (Count parameters>3)
$4->:=$count
End if 

4D iNug Technical <4d_tech@lists.4d.com> writes:
>C_TEXT($0;$1;$2;$3;$source;$oldStr;$newStr;$result;$tempTxt)  
>//ES_ReplaceStr_Expand($source;$oldString;$newString;{$count 
>pointer})->Resulted text
>C_POINTER($4)
>C_LONGINT($oldLen;$newLen;$oldStrLen;$NewStrLen;$count;$offset;$offset2;$start;$pos)
>C_BLOB($blob;$blob2)  //this has been optimised for shrink and expand
>$source:=$1
>$oldLen:=Length($source)  //$source is the source text
>$oldStr:=$2
>$newStr:=$3
>$oldStrLen:=Length($oldStr)
>$newstrlen:=Length($newStr)
>
>If ($NewStrLen>$oldStrLen)
>$start:=1
>$count:=0
>Repeat 
>$pos:=Position($oldstr;$source;$start;*)
>If ($pos>0)
>$start:=$pos+$oldStrlen
>$count:=$count+1
>End if 
>Until ($pos=0)
>$newLen:=$oldLen+(($NewStrLen-$oldStrLen)*$count)
>SET BLOB SIZE($blob;$newlen*2+9;0)
>Else 
>SET BLOB SIZE($blob;$oldlen*2+9;0)
>End if 
>
>$offset:=9
>$start:=1
>$count:=0
>Repeat 
>$pos:=Position($oldstr;$source;$start;*)
>If ($pos>0)
>$tempTxt:=Substring($source;$start;$pos-$start)+$newStr
>$start:=$pos+$oldStrLen
>If (Length($tempTxt)>0)
>$offset2:=0
>VARIABLE TO BLOB($tempTxt;$blob2;$offset2)
>COPY BLOB($blob2;$blob;9;$offset;$offset2-9)
>$offset:=$offset+$offset2-9
>End if 
>$count:=$count+1
>End if 
>Until ($pos=0)
>
>If ($count>0)
>
>If ($start<=$oldlen)
>$tempTxt:=Substring($source;$start)
>If (Length($tempTxt)>0)
>$offset2:=0
>VARIABLE TO BLOB($tempTxt;$blob2;$offset2)
>COPY BLOB($blob2;$blob;9;$offset;$offset2-9)
>End if 
>End if 
>
>If ($oldStrlen>$NewStrLen)
>$newLen:=$oldLen+(($NewStrLen-$oldStrLen)*$count)
>SET BLOB SIZE($blob;$newlen*2+9)
>End if 
>
>$blob{0x}:=Character code("R")
>$blob{0x0001}:=Character code("V")
>$blob{0x0002}:=Character code("L")
>$blob{0x0003}:=Character code("B")
>$blob{0x0004}:=0x0021
>$blob{0x0005}:=$newlen%256
>$blob{0x0006}:=($newlen\256)%256
>$blob{0x0007}:=($newlen\65536)%256
>$blob{0x0008}:=($newlen\16777216)
>$offset:=0
>BLOB TO VARIABLE($blob;$result;$offset)
>$0:=$result
>Else 
>$0:=$1
>End if 
>
>If (Count parameters>3)
>$4->:=$count
>End if 


**
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: v13 - replace string, odd slowness

2017-09-30 Thread Alan Chan via 4D_Tech
Hi Chip,

I forgot to mention that the method is for doc which is in utf16 format.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>To replace shorter old string with longer one, you could try the following:


**
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: v13 - replace string, odd slowness

2017-09-29 Thread Alan Chan via 4D_Tech
Hi Chip,

This is a known issue on v13. When old string and new string is of different 
length, it will become very slow if the file was large and large number of 
occurance. 4D has rewritten it on v15.

I posted a method on 
http://4d.1045681.n5.nabble.com/v13-Replace-String-warning-td5752820.html that 
was to replace old string with shorter new string such as replacing CRLF with 
CR.

To replace shorter old string with longer one, you could try the following:

C_TEXT($0;$1;$2;$3;$source;$oldStr;$newStr;$result;$tempTxt)  
//ES_ReplaceStr_Expand($source;$oldString;$newString;{$count 
pointer})->Resulted text
C_POINTER($4)
C_LONGINT($oldLen;$newLen;$oldStrLen;$NewStrLen;$count;$offset;$offset2;$start;$pos)
C_BLOB($blob;$blob2)  //this has been optimised for shrink and expand
$source:=$1
$oldLen:=Length($source)  //$source is the source text
$oldStr:=$2
$newStr:=$3
$oldStrLen:=Length($oldStr)
$newstrlen:=Length($newStr)

If ($NewStrLen>$oldStrLen)
$start:=1
$count:=0
Repeat 
$pos:=Position($oldstr;$source;$start;*)
If ($pos>0)
$start:=$pos+$oldStrlen
$count:=$count+1
End if 
Until ($pos=0)
$newLen:=$oldLen+(($NewStrLen-$oldStrLen)*$count)
SET BLOB SIZE($blob;$newlen*2+9;0)
Else 
SET BLOB SIZE($blob;$oldlen*2+9;0)
End if 

$offset:=9
$start:=1
$count:=0
Repeat 
$pos:=Position($oldstr;$source;$start;*)
If ($pos>0)
$tempTxt:=Substring($source;$start;$pos-$start)+$newStr
$start:=$pos+$oldStrLen
If (Length($tempTxt)>0)
$offset2:=0
VARIABLE TO BLOB($tempTxt;$blob2;$offset2)
COPY BLOB($blob2;$blob;9;$offset;$offset2-9)
$offset:=$offset+$offset2-9
End if 
$count:=$count+1
End if 
Until ($pos=0)

If ($count>0)

If ($start<=$oldlen)
$tempTxt:=Substring($source;$start)
If (Length($tempTxt)>0)
$offset2:=0
VARIABLE TO BLOB($tempTxt;$blob2;$offset2)
COPY BLOB($blob2;$blob;9;$offset;$offset2-9)
End if 
End if 

If ($oldStrlen>$NewStrLen)
$newLen:=$oldLen+(($NewStrLen-$oldStrLen)*$count)
SET BLOB SIZE($blob;$newlen*2+9)
End if 

$blob{0x}:=Character code("R")
$blob{0x0001}:=Character code("V")
$blob{0x0002}:=Character code("L")
$blob{0x0003}:=Character code("B")
$blob{0x0004}:=0x0021
$blob{0x0005}:=$newlen%256
$blob{0x0006}:=($newlen\256)%256
$blob{0x0007}:=($newlen\65536)%256
$blob{0x0008}:=($newlen\16777216)
$offset:=0
BLOB TO VARIABLE($blob;$result;$offset)
$0:=$result
Else 
$0:=$1
End if 

If (Count parameters>3)
$4->:=$count
End if 

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>v13 Mac on OS X 10.9.5
>
>I have the some code testing a utility.
>I create some text, and then replace specific characters in the text 
>(see below)
>When I replace a marker with Carriage return, no problem
>When I replace CR with linefeed, no problem
>when I replace linefeed with CrLf REPLACE STRING takes many times as 
>long to complete on otherwise the same text...
>
>any Ideas??
>snippets of code follows
>
>C_TEXT($Text_var;$Cr;$Lf;$CrLf;$Other)
>
>$Text_var:="a"*100+$Other+"B"*100+$Other+"C"*100+$Other
>$Text_var:=Replace string($Text_var;$Other;$Cr)  //instaneous
>$Text_var:=Replace string($Text_var;$Cr;$Lf)  //instaneous
>$Text_var:=Replace string($Text_var;$Lf;$CrLf)  //takes 6639 millisecond
>
>

**
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 v16.2 false record locks

2017-09-20 Thread Alan Chan via 4D_Tech
Hi Koen,

I think your case is very different and might be v16 issue as user was still on 
server list and you couldn't disconnet it.

The trigger issue (not actually an issue) I mentioned was the record was locked 
and the related user wasn't even on the server list.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>In the case I mentioned, there were no triggers involved. No fancy stuff 
>either. Just a record which is being automatically locked because it was 
>opened in an input form.
>But I don’t know how the user left the building…
>
>Koen

**
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 v16.2 false record locks

2017-09-19 Thread Alan Chan via 4D_Tech
If a record wasn't unloaded in trigger properly, the record would be locked 
even after the invoking client user left the system (no longer signed in). The 
only way is to restart the server.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>The client timeout will remove a dead user after that period of activity. In 
>these cases, the user isn't even showing in the list of connected users on the 
>server, yet 4D reports the lock in that user's name.
>
>It's pretty weird. I guess others have seen this before, but it's new to me. I 
>can understand a lock for a user that's still technically connected but 
>non-responsive (crashed, hanged, etc.) but not if the server isn't even 
>showing the user in the
>list.
>
>

**
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: Unable to Compile - Crash - looking for ideas - SOLVED

2017-08-21 Thread Alan Chan via 4D_Tech
Yes, this is highly recommended. "All Variables are typed" is one of greatest 
debug tool in 4D.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>I would also recommend changing the settings from
>   Generate Typing
>to
>   All Variables are typed


**
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 Alan Chan via 4D_Tech
Case sensitive comparison support in Find in array/Find in sorted array is long 
overdue. Even best, supported in string compariosn operator (or new operator 
for string)

$true:=($string1=*$string2)
$true:=($string1>*$string2)
$true:=($string1<*$string2)

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>the "Find" commands accept wild cards and evaluate using collation algorithms 
>(case-insensitive comparison plus some other locale specific rules)
>is it really fair to compare the two against object keys?

**
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: Quick report strange behavior

2017-07-11 Thread Alan Chan via 4D_Tech
We do use v13.6 on Windows 8 and 10 without your problem. Did you try 13.6 
instead of 13.3?

v11 of 4D does exhibit problem you mentioned. I'm not sure if the problem 
exists in 13.3 or not.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Hi all,
>
>No one use 4D V13 on windows 8?
>
>Thanks
>
>Ferdinando
>
>
>Il 11/07/2017 01:02, stardata.info ha scritto:
>>
>> Hi all,
>>
>> Quick report on 4D V13.3 on windows, work fine until windows 7.
>>
>> From Windows 8 quick report not work properly, like explained below.
>>
>> Someone have a solution?
>>
>> Thanks
>> Ferdinando
>>
>> Il 10/07/2017 16:18, 4d_tech-requ...@lists.4d.com ha scritto:
>>> Message: 11
>>> Date: Mon, 10 Jul 2017 14:14:15 +0200
>>> From: "stardata.info"
>>> To:4d_tech@lists.4d.com
>>> Subject: Quick report strange behavior
>>> Message-ID:<259a189d-28ac-3559-e814-54525f6e3...@stardata.info>
>>> Content-Type: text/plain; charset=utf-8; format=flowed
>>>
>>> Hi all,
>>>
>>> in one pc i use 4d v13 on windows and wheni create a report with Quick
>>> Report editor  i see the print in very little characters.
>>> On others pc is ok. If i use other softwares all is ok, and even if i
>>> create a report into the 4d application all is ok.
>>> The issue in only if i use 4D Quick Report.
>>>
>>> Someone have a solution?
>>>
>>> Thanks
>>> Ferdinando
>>
>
>**
>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: Interesting(?) Tales of Coding Was : Request for tech note

2017-07-11 Thread Alan Chan via 4D_Tech
I wrote a Get Prime routine in 56 lines of 4D code years ago for fun to 
generate prime number in array of whatever number users enter as parameter.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>https://i.redd.it/fjcv9evg6u8z.png

**
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: What exactly is the scope of the On err call between 4D server & Client?

2017-07-07 Thread Alan Chan via 4D_Tech
We always install new On err call on triggers.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>I don't remember...triggers?

**
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: Request : Text utilities

2017-07-06 Thread Alan Chan via 4D_Tech
Thanks. It's good to know.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Well observed. Aussies can be *way* to polite to tell someone when they're
>being rude, so, yeah, they might not complain about a little thing that
>they can live with.

**
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: Request : Text utilities

2017-07-06 Thread Alan Chan via 4D_Tech
We have been formatting Australia phone number like

(2) 3456 7899
434 567 899

Are these acceptable by Australian? So far, we haven't got any complaint (may 
be they're too nice to say anything).

TIA

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Note that local custom varies. For example, Australia has two digit area
>codes, like 02, 03, 04 and so on. But 04 is special...all mobile phones
>start with 04. Land lines are normally written like this:
>
>02 3456 7899
>
>Mobiles are normally (but not invariably) written like this:
>
>0434 567 899

**
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 Alan Chan via 4D_Tech
It's our standard design to do test "In Transaction" and Trigger Level in 
trigger. We never used cascade trigger either.

Error handling in trigger is also standard in our design. We have to create 
large error code base for error interpretion in multiple language.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>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.

**
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 Alan Chan via 4D_Tech
Yes, having UI in transaction is not ideal (at least in our design) and that's 
why we never used that approach. 

Update pricing is pretty routine for us as well (in our retail module) but we 
never need nested transaction.

if no ui is involved, 

Master transaction
nested transaction 1 for task 1
nested transaction n for task n
End Master transaction

or

Transaction
update task 1
update task n
End transaction

Any difference?

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>I have a slightly different take from Peter's - consider attempting to make
>changes in a database with many users who may or may not be 'touching' or
>accessing data involved in the chain of updating. Inventory updates are a
>classic example. Pricing can be another. Ideally these sorts of things
>would be done during off-hours but that's not always possible and a given
>update may take a few seconds to run sometimes. This is the sort of case
>where I find nested transactions really helpful. It's not possible to know
>ahead of time everything that might be touched and things may be changing
>in the meantime anyway. I like to break down a complex task into logical
>components each of which may be used in other situations so it makes sense
>to wrap each one in its own transaction and let the master transaction
>decide whether any of those subsidiary ones warrant cancelling the whole.
>
>To be honest I hadn't even considered the issue of working with components
>but Peter does a lot more of that than I do. Plus I rarely have components
>doing much of their own processing - just offering support and
>functionality to the parent db.
>
>I'll just add I think it's a bad idea to wrap any UI in a transaction. As
>Peter notes I know some folks do it and it works for them but my experience
>has never born that out.

**
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 Alan Chan via 4D_Tech
Hi Peter,

I never used component and have no idea what complication would it be in 
transaction. Nonetheless, we do a lot of updates from time to time. We only use 
normal transaction and trigger even for millions of records. We normally split 
into 5,000 to
10,000 records per transaction. I don't see nested transaction is required 
except the component part that I have no knowledge at all.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>
>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.
>
>

**
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 Alan Chan via 4D_Tech
If I understand nested transaction correctly, it's like creating an invoice 
master in a transaction (remain opened), then add invoice line item in nested 
transaction (start and end nested transaction in one go), add nth line of 
invoice items in new
nested transaction continously. Failure of one nested transaction won't affect 
other nested transaction. User simply correct the failed one and move on. At 
the end, if user cancel the invoice master (not line item) opened transaction, 
all completed
nested transactions would also be rolled back. It means as long as the invoice 
master transaction was not ended (validate or cancel), all other related 
records like inventory of those items or item master (if summary info was kept 
there) would be
locked. Other users might not be able to access them during the period.

If there's no UI, why you need nested transaction? It's all on assumption of my 
understanding on nested transaction and could be wrong.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>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.

**
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-01 Thread Alan Chan via 4D_Tech
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:-)

We could only afford single transaction started and ended within a short 
wrapper method.

Alan Chan


4D iNug Technical <4d_tech@lists.4d.com> writes:
>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 ?
>
>

**
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: v13 (+?) - Replace String [warning]

2017-06-27 Thread Alan Chan via 4D_Tech
Hi Chip,

Try the following and it should be done in a second or 2 (compiled).

  //ES_ReplaceStr_Shrink($source;$oldString;$newString;{$count 
pointer})->Resulted text
C_TEXT($0;$1;$2;$3;$source;$oldStr;$newStr;$result;$tempTxt)
C_POINTER($4)
C_LONGINT($oldLen;$newLen;$oldStrLen;$NewStrLen;$count;$offset;$offset2;$start;$pos)
C_BLOB($blob;$blob2)
$source:=$1
$oldLen:=Length($source)  //$source is the source text
$oldStr:=$2
$newStr:=$3
$oldStrLen:=Length($oldStr)
$newstrlen:=Length($newStr)

SET BLOB SIZE($blob;$oldlen*2+9;0)
$offset:=9
$start:=1
$count:=0
Repeat 
$pos:=Position($oldstr;$source;$start;*)
If ($pos>0)
$tempTxt:=Substring($source;$start;$pos-$start)+$newStr
$start:=$pos+$oldStrLen
If (Length($tempTxt)>0)
$offset2:=0
VARIABLE TO BLOB($tempTxt;$blob2;$offset2)
COPY BLOB($blob2;$blob;9;$offset;$offset2-9)
$offset:=$offset+$offset2-9
End if 
$count:=$count+1
End if 
Until ($pos=0)

If ($count>0)
If ($start<=$oldlen)
$tempTxt:=Substring($source;$start)
If (Length($tempTxt)>0)
$offset2:=0
VARIABLE TO BLOB($tempTxt;$blob2;$offset2)
COPY BLOB($blob2;$blob;9;$offset;$offset2-9)
End if 
End if 
If ($oldStrlen>$NewStrLen)
$newLen:=$oldLen+(($NewStrLen-$oldStrLen)*$count)
SET BLOB SIZE($blob;$newlen*2+9)
Else 
$newlen:=$oldLen
End if 

$blob{0x}:=Character code("R")
$blob{0x0001}:=Character code("V")
$blob{0x0002}:=Character code("L")
$blob{0x0003}:=Character code("B")
$blob{0x0004}:=0x0021
$blob{0x0005}:=$newlen%256
$blob{0x0006}:=($newlen\256)%256
$blob{0x0007}:=($newlen\65536)%256
$blob{0x0008}:=($newlen\16777216)
$offset:=0
BLOB TO VARIABLE($blob;$result;$offset)
$0:=$result

Else 
$0:=$1
End if 

If (Count parameters>3)
$4->:=$count
End if 

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>$Source:=Replace String($Source;Char(9);"";*)
>
>Doesn't look so bad, does it?
>Turns out there are over 550,000 tabs in the text.
>Replace String, did indeed (eventually) return, but it took about 30 
>minutes.

**
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 DATABASE from 4D client

2017-05-31 Thread Alan Chan via 4D_Tech
I might be missing something obvious. Why not simply using SQL login to access 
external database and the data could be accessed by multiple 4D clients.

SQL LOGIN($externaAddress;$user;$pswd;*)
If (OK=1)
Begin SQL
//do whatever SQL query
End SQL
SQL LOGOUT
End if 

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>If I have an external datafile held on the server how do I access it
>(purely for lookup) from a 4D client?

**
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: Compatibility Mode v12 (How to change to Unicode?)

2017-05-23 Thread Alan Chan via 4D_Tech
Hi Miyako San,

We know about multilang.txt but it didn't help in our cases. Languages were not 
tied to specific tables or fields. Instead, some users entered Simplied Chinese 
although they're advised to use Traditional Chinese or English in same field 
such as
addresses, description or remarks.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>there is a way to apply a specific encoding for each table during conversion
>
>ftp://ftp-public.4d.fr/Documents/Products_Documentation/LastVersions/Line_11/VIntl/PDF_Format/4D_v11_Upgrade.pdf
>
>see the description for "multilang.txt"
>
>> 2017/05/23 19:42、Alan Chan via 4D_Tech <4d_tech@lists.4d.com> のメール:
>>
>> However, data in other non-roman character sets couldn't be viewed correctly 
>> and
>> requires manual update (re-enter the field).
>

**
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: Compatibility Mode v12 (How to change to Unicode?)

2017-05-23 Thread Alan Chan via 4D_Tech
During conversion of our customers' data from 2003 to v11 in unicode mode, we 
did some trick to allow 4D convert data to unicode correctly. It only helps if 
your data contains only one type of non-roman character.

For instance, most of our users use Traditional Chinese (big5) in 2003. Before 
conversion, we change the regional setting of the server to Tradition Chinese 
in our case. Then launch the data in the server with new structure on v11. 
After the
conversion, quit the server and change the regional setting back to English. 
Launch the server again, all data in Traditional Chinese could be veiwed in new 
version. However, data in other non-roman character sets couldn't be viewed 
correctly and
requires manual update (re-enter the field). 

YMMV

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>3) How do I convert the existing text data in records (and indexes) to Unicode?

**
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: Corrupted index that won't fix

2017-05-21 Thread Alan Chan via 4D_Tech
If you have removed a table or field, then add new table or field, it might 
cause problem if the old data is still there.

Repair it might help. It won't harm if it doesn't.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>I verified a data file and MSC reported the data were fine but the indexes
>had some errors. No problem, I think, I'll just trash the index files,
>restart and let them rebuild. After doing this twice the indexes are still
>showing as :
>
>Cluster Index 167 on DOX_ATTACH._data , DOX_ATTACH.record_id
>(tableName_recordId) [OK]
>Checking index Cluster Index 167 on DOX_ATTACH._data , DOX_ATTACH.record_id
>(tableName_recordId) [OK]
>Checking index page addresses on Cluster Index 167 on DOX_ATTACH._data ,
>DOX_ATTACH.record_id (tableName_recordId) [OK]
>Checking clusters on Cluster Index 167 on DOX_ATTACH._data ,
>DOX_ATTACH.record_id (tableName_recordId) [OK]
>Checking list of deleted clusters on Cluster Index 167 on DOX_ATTACH._data
>, DOX_ATTACH.record_id (tableName_recordId) [OK]
>Checking index pages on Cluster Index 167 on DOX_ATTACH._data ,
>DOX_ATTACH.record_id (tableName_recordId) [200 errors]
>
>I'm not sure what else to do besides dropping the index. I'm assuming,
>perhaps incorrectly, that if the data are good the index should be able to
>write itself correctly.
>
>I'm hoping one of you can give me some insight into how to correct this.
>The server is running 15.3 on Win 7.
>
>

**
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: v13 - Send record

2017-05-17 Thread Alan Chan via 4D_Tech
Did you check OK variable after SET CHANNEL?

By the way, I prefer using Goto Selected Record instead of Next Record.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>SET CHANNEL(10;$File_Path)
>
>For ($i;1;Records in selection([Bug_Reporting]))
>SEND RECORD([Bug_Reporting])
>NEXT RECORD([Bug_Reporting])
>End for 
>SET CHANNEL(11)

**
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 detect EOL character in text file

2017-05-15 Thread Alan Chan via 4D_Tech
Replace String($text;lf;cr) -> all lf becomes cr including crlf becoming crcr
Replace string($text;crlf;cr) -> none would be found

That's why you need to run Replace String($text;crlf;cr) first.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>That should have read replace string of course
>if you change all the possible EOL characters to CR, then position will
>find all the CRs
>or have I missed something?
>pm
>
>On Sat, May 13, 2017 at 8:30 PM, James Crate via 4D_Tech <
>4d_tech@lists.4d.com> wrote:
>
>> On May 13, 2017, at 8:53 AM, Peter Mew via 4D_Tech <4d_tech@lists.4d.com>
>> wrote:
>> >
>> > Replace text($text;lf;cr)
>> > Replace text($text;crlf;cr)
>> > Position($text;cr)
>> > -pm
>>
>> This won’t detect the line endings, which is what was asked, it will
>> change them to CR. However, to properly normalize line endings you need to
>> replace CRLF first.
>>
>> Jim Crate
>

**
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: Schemes for record level access control

2017-05-15 Thread Alan Chan via 4D_Tech
Like I said, many developers don't like 4D access system, in fact, any 4D 
inbuilt-tools such as QR editor, Query Editor, Label Editor, Sequence Number, 
Triggers  etc. I'm weird and kept using them intensively even after 
developing on 4D for 27
years. I'm happily remained to be amature:-)

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Much like others have indicated, stay as far away as you can from the built in 
>4D access shit, it's for amatures.

**
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: Schemes for record level access control

2017-05-12 Thread Alan Chan via 4D_Tech
It would be a lot easier if 4D password system is activated. Just a new group 
"TeamAccess_Bypass". LIke I said before, 4D password system does great help on 
achieving this.

While we find 4D password system is invaluable, I know many developers don't 
like it.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Right - so the ultimate permission is the most permissive of all available.
>
>On Fri, May 12, 2017 at 4:56 PM, Alan Chan via 4D_Tech <4d_tech@lists.4d.com
>> wrote:
>
>> I assume a member might belongs to multiple teams but will a member
>> belongs to multiple clubs?
>>
>> Alan Chan
>>
>> 4D iNug Technical <4d_tech@lists.4d.com> writes:
>> >Hi Alan,
>> >Those are the go-to solutions. In my case we aren't using the 4D password
>> >system so I can't rely on that. Plus I need actual record level
>> >restriction. So to follow your example, I may want a Team to be able to
>> see
>> >themselves and other teams in their Club (just making this up) but not
>> >teams in other Clubs.
>> >
>> >
>

**
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: Schemes for record level access control

2017-05-12 Thread Alan Chan via 4D_Tech
If implemented correctly, performance hit could be minimum.

Do what query 
if(records in selection([WhateverTable]>0)
if(<>TeamAccessRequired)\\some customers do not need this feature
Query selection with array([WhateverTable]Team;<>CurTeam)
end if
end if

<>CurTeam is loaded from team member table at startup method.

Query selection with array is NOT preemptive in 4D 13/15 that might have 
performance hit on server. Based on v16 doc, this command would be preemptive 
and hopefully it does not have hidden limitation.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>That sounds like real DOD level stuff. Fortunately I don't need that level
>but it gives me some ideas.
>
>What kind of performance hit did you see as a result of all that extra
>processing?

**
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: Schemes for record level access control

2017-05-12 Thread Alan Chan via 4D_Tech
I assume a member might belongs to multiple teams but will a member belongs to 
multiple clubs?

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Hi Alan,
>Those are the go-to solutions. In my case we aren't using the 4D password
>system so I can't rely on that. Plus I need actual record level
>restriction. So to follow your example, I may want a Team to be able to see
>themselves and other teams in their Club (just making this up) but not
>teams in other Clubs.
>
>

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

Re: Counting # of specific characters in string/text

2017-05-08 Thread Alan Chan via 4D_Tech
Hi Chip,

Thanks for your advice. The discussion is about how optimized Replace String is 
in v16 especially  on * operation even comparing with position(*) which 
supposed to be very fast. It's not about how to design a 4D app with those 
commands.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>If all we are doing is talking about "how fast is this" then this 
>discussion has no relation to real world usage. 

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

Re: Counting # of specific characters in string/text

2017-05-06 Thread Alan Chan via 4D_Tech
Hi Chip

We have been talking about * all along. Without * has never been in my test.

My test always consider total length of text "and" total count of occurrence. 
My test is for 4,300,000 length text and 100,000 occurrence. It took 14ms on my 
machine.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>v13 testing
>position - no * find character (u + umlaut) end of 2,000,000 length text
>56ms +/- ms
>
>Position (*) - find same character at end of 2,000,000 length text
>3 ms +/- 1ms
>
>so... when you know that diacritcallity, or capitalization, is important 
>Position with * is MUCH faster -- at least in v13

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

Re: Counting # of specific characters in string/text

2017-05-06 Thread Alan Chan via 4D_Tech
Oops... my bad. Reading too fast. Please ignore this.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>I found out why your result is quite different from mine. In your code, you 
>evaluate the time once per execution of position. However, the replace string 
>was evaluated once per 10,000 replacement (per execution of replace string).


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

Re: Counting # of specific characters in string/text

2017-05-06 Thread Alan Chan via 4D_Tech
Hi Arnaud,

I found out why your result is quite different from mine. In your code, you 
evaluate the time once per execution of position. However, the replace string 
was evaluated once per 10,000 replacement (per execution of replace string).

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>since v15R3, using 'Replace string' for count seems always faster to me than 
>'Position' - even if [compiled+strict comparison] it's quite the same. Could 
>be a detail, but instead of measuring time to loop $i times, I often prefer to 
>count how much
>iterations are executed during a given time, it makes interpreted/compiled 
>switch easier. All results under are from compiled, all 32b versions except 
>v16 in 64b. 
>
>The little v12 test base I've used is here:
>

**
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: v13: what causes boolean fields to display radios instead of check boxes

2017-04-20 Thread Alan Chan via 4D_Tech
This was a known problem only happened on Mac. The issue seems fixed in 13.6.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Hi Walt,
>
>No, not grouped.
>
>I worked around it by using OBJECT SET FORMAT in the on load event. Which
>works but begs the question of why I have to.
>
>
>
>On Wed, Apr 19, 2017 at 6:50 PM, Walt Nelson via 4D_Tech <
>4d_tech@lists.4d.com> wrote:
>
>>
>> > On Apr 19, 2017, at 6:42 PM, Kirk Brooks via 4D_Tech <
>> 4d_tech@lists.4d.com > wrote:
>> >
>> > I set the fields to be checkboxes (included a title) but when the form is
>> > loaded it turns into radio buttons. I'm not intentionally changing them -
>> > so what would cause this?
>>
>> Kirk,
>>
>> Are they grouped together?
>>
>> Thanks,
>> Walt Nelson (Seattle)
>> New stuff coming!
>> www.foundationshell.com 
>> w...@foundationshell.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
>> **
>
>
>
>
>-- 
>Kirk Brooks
>San Francisco, CA
>===
>
>*The only thing necessary for the triumph of evil is for good men to do
>nothing.*
>
>*- Edmund Burke*
>**
>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: y2038 -- is 4D ready?

2017-03-29 Thread Alan Chan via 4D_Tech
I agree. Longint for sequence number would definitely outlast me:-(

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>last I knew (this could easily have changed)
>Sequence number range is +/- MAX LONGINT (so ~2.1 x 10^9)
>
>
>On Wed, 29 Mar 2017 18:38:56 +0800, Alan Chan via 4D_Tech wrote:
>> 4D would support 64bit integer by then. If not, sequence number (or 
>> auto-increment) would be the first one to get in trouble.
>> 
>> Alan Chan
>> 
>> 4D iNug Technical <4d_tech@lists.4d.com> writes:
>>> so code to convert date to epoch time like that one just recently discussed
>>> (Re: [4DTidbits Blog] Epoch & Unix Timestamp Conversion)
>>> could potentially have trouble...
>> 
>> **
>> 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
>> **
>---
>Gas is for washing parts
>Alcohol is for drinkin'
>Nitromethane is for racing 
>**
>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: y2038 -- is 4D ready?

2017-03-29 Thread Alan Chan via 4D_Tech
4D would support 64bit integer by then. If not, sequence number (or 
auto-increment) would be the first one to get in trouble.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>so code to convert date to epoch time like that one just recently discussed
>(Re: [4DTidbits Blog] Epoch & Unix Timestamp Conversion)
>could potentially have trouble...

**
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 v15.4: Sequence number issue / Duplicate key error

2017-03-08 Thread Alan Chan via 4D_Tech
We have been using Sequence Number for years without any problem. It depends 
how/when you use it

My suggestion is to make use of newer features such as Auto-increment on either 
UUID or Longint. If you don't want to use auto-increment for whatever reasons, 
you could call it at Trigger for new record. If you're paranoid like me, use 
following
codes to call sequence number.

ES_SequenceNo($error;->UniqueField) -> $error 

C_LONGINT($seqNo;$0;$1;$error;$F)
C_POINTER($2;$pSeqkey;$pTable)
$error:=CheckError_T ($1) //check if there's previous error
If ($error=0)
$pSeqkey:=$2
If ($pSeqkey->=0)  //only if auto-increment wasn't activated yet
$pTable:=FieldToFilePtr ($2)`return table pointer
$SeqNo:=Sequence number($pTable->)
$F:=Find in field($pSeqkey->;$SeqNo)
If ($F=-1)
$pSeqkey->:=$seqNo
Else 
$error:=SetError ($error;-17160)
End if 
End if 
End if 
$0:=$error

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>Hi all,
>
>I ran into an issue while using SEQUENCE NUMBER in 4D v15.4, in a 
>client-server setup.
>
>I put the result in a field called ‘ID’, which is the primary key for that 
>table, and by default is unique. Auto increment is off.
>The code is running in a transaction.
>
>Frequently, users get the error ‘Cannot save the record, DUPLICATE KEY’.
>Then, I go to the structure and rebuild the index on that field (ID).
>
>They try again, and the record is saved without a problem.
>
>After a while, though, and after other users have added records to this table, 
>the problem re-occurs.
>Rebuilding the index again fixes the problem.
>
>I have exported the data to a tab delimited file, truncated the table, and 
>imported the data. Problem is still there.
>I have compacted the data file. Same problem.
>
>Any ideas what can be the cause?
> 
>Kind regards,
>
>Rudy Mortier
>Two Way Communications bvba  -
>

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

Re: Sierra 10.12.3

2017-02-17 Thread Alan Chan via 4D_Tech
Hi David,

It WORKS like a charm!

THANKS for sharing the tips.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>We ran into the v13 / MacBook Pro with touchbar crashing issue in Sierra 
>10.12.1 and 10.12.2.  The fix was maddeningly simple - instead of attempting 
>to connect to a remote database if you first choose to open a local database, 
>then cancel the file
>open window displayed in Finder you will be able to open remote databases 
>without crashing.
>
>David Stevenson
>Synergist Express Ltd

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