Re: v13+ LEP permision issues.

2018-05-10 Thread Chip Scheide via 4D_Tech
That is great ..
I have always understood On Err Call to be a separate process

Thanks for the clarification
Chip

On Thu, 10 May 2018 15:29:11 +, Keisuke Miyako via 4D_Tech wrote:
> perhaps my comments about logging was unwarranted.
> 
> but I think my main points stand:
> 
> 1. no, method called on error is not executed in another process.
> you might be confusing it with method called on *event*
> 
> 2. no, it is not necessary to use IP. use can pass and return process 
> variables.
> 
> e.g.
> 
> EE:="before"
> 
> ON ERR CALL("E")
> DOCUMENT TO BLOB("";$blob)
> ON ERR CALL("")
> 
> ALERT(EE)
> 
> 
> where method "E" is
> 
> EE:=EE+"."+Current method name+".after"
> 
> 2018/05/10 23:32、Chip Scheide 
> <4d_o...@pghrepository.org> のメール
> :
> Case of
> : (error=-54) | (error=-49) | (error=-46) | (error=-45) | (error=-44) |
> (error=-5000)
> <>x_Error_Call_Error:="File, folder or volume locked, or already open
> for writing."
> 
> 
> 
> **
> 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
> **
---
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: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: v13+ LEP permision issues.

2018-05-10 Thread Keisuke Miyako via 4D_Tech
perhaps my comments about logging was unwarranted.

but I think my main points stand:

1. no, method called on error is not executed in another process.
you might be confusing it with method called on *event*

2. no, it is not necessary to use IP. use can pass and return process variables.

e.g.

EE:="before"

ON ERR CALL("E")
DOCUMENT TO BLOB("";$blob)
ON ERR CALL("")

ALERT(EE)


where method "E" is

EE:=EE+"."+Current method name+".after"

2018/05/10 23:32、Chip Scheide 
<4d_o...@pghrepository.org> のメール:
Case of
: (error=-54) | (error=-49) | (error=-46) | (error=-45) | (error=-44) |
(error=-5000)
<>x_Error_Call_Error:="File, folder or volume locked, or already open
for writing."



**
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: v13+ LEP permision issues.

2018-05-10 Thread Chip Scheide via 4D_Tech
Keisuke,
> isn't "Method called on error" executed in the same process as the 
> invoking method?
> 
> normally the code would only be interested in basic information such as OK,
> which changes the course of action (ignore, abort, retry).
> 
> even if more details were available,
> there is normally not much one can do on the spot.
> 
yes it probably is. However, I am not interested in what method is 
currently set to be invoked by On Err Call, I am interested in 
returning information FROM the method invoked by On Err Call - 
specifically - what error occurred.

So, in the below 2 lines of code I want to get information FROM 
'File_Error_Manager' detailing, as much as possible, what error(s) 
occurred.

ON Err Call("File_Error_Manager")
Open Document($Document)

The On error call method (File_Error_Manager) has something like this:

Case of
: (error=-54) | (error=-49) | (error=-46) | (error=-45) | (error=-44) | 
(error=-5000)
<>x_Error_Call_Error:="File, folder or volume locked, or already open 
for writing."
.
.
.
end case


As far as I am aware, when On Err Call invokes a method it runs in it's 
own process - separate from the process where the error actually 
occurred. Given this situation, there are limited ways in which to 
communicate the error information from the On Error Call process to the 
error generating process.  IP variables are a simple means of doing 
this.
The use of IP variables in an error method used by On Err Call and any 
process which, thru On Err Call usage,  uses these error methods 
becomes - thread unsafe.

Because of the way in which 4D manages file/disk access the only way to 
know that there was an error, and to get details of that/those errors, 
is to use On Err Call. 
Using LEP (for file manipulation) by passes this issue, as there is no 
need for On Err Call.

As I said, there are other reasons to use LEP for file manipulation, 
Thread safety is just one that I thought would be of interest to 
discuss. Speed is another, my experience so far, is that 4D's file 
manipulation functions are slower then the OS level functions.

As for alternate means of getting error information out of On Err Call, 
the only one that comes to mind would be to create a record in an 
'Error' table. Populate it with the error information, some sort of 
identifier (this might be an issue), and save it. 
Then in the process where an error *might* occur, query the table to 
determine *if* there was an error, and if there was, get the 
information from the record (and do whatever is appropriate), and 
delete the record.

Seems excessive, but I guess that would depend on how necessary it 
is/was to make a method thread safe.

Other means of getting error information out of the On Err Call 
process, and back to the error generating process are welcome.
:)

> 
> "Method called on error" can log (table or document) the date, time, 
> user, machine,
> error stack, error method, error formula, error line for later analysis.
> 
there is no indication that this is true according to the documentation 
for v13.  Maybe the function has been enhanced in later versions of 4D.

However, even if this is true, the need is to get error information 
during runtime to manage it.
In the above example, to know that the file was not able to be opened. 
Which in turn means that the action intended can not be done/completed, 
and make a decision about how to proceed. That decision maybe made in 
the same method in which the error occurred, or it may be passed back 
up the call chain; being able to analyze the issue later is not the 
intension/need.

Thanks
Chip

---
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: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: v13+ LEP permision issues.

2018-05-09 Thread Keisuke Miyako via 4D_Tech
isn't "Method called on error" executed in the same process as the invoking 
method?

normally the code would only be interested in basic information such as OK,
which changes the course of action (ignore, abort, retry).

even if more details were available,
there is normally not much one can do on the spot.

"Method called on error" can log (table or document) the date, time, user, 
machine,
error stack, error method, error formula, error line for later analysis.

2018/05/10 6:26、Chip Scheide via 4D_Tech 
<4d_tech@lists.4d.com> のメール:
the only way to get information BACK, such as what error occurred, from
the On err call method(s) is via IP var(s).



**
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: v13+ LEP permision issues.

2018-05-09 Thread Chip Scheide via 4D_Tech
Tim,
a bit late but...

There are other reasons, but one is:
Thread safety  :)

And while this is NOT an issue in v13, I am writing this code now, I 
might as well make as much of the code thread safe, and future proof, 
as is reasonable. 

Using 4D functions requires wrapping an On Err Call("method") On Err 
Call("") around the various disk access functions.
ex:
On Err Call("File_Errors")
Delete Document($Document)
On Err Call("")

Unless there is some way I am unaware of -- very possible  :)
the only way to get information BACK, such as what error occurred, from 
the On err call method(s) is via IP var(s).

Using LEP the calls for Disk access are natively thread safe (at least 
I would expect so -- NOT tested), and 
also they are MUCH faster.

The 4D code, in which LEP is called is (I believe) thread safe as most 
of the 'work' is text manipulation.
 

BTW: is there a list of either (or both) thread safe, and/or Thread 
unsafe 4D commands?

Thanks
Chip

On Fri, 20 Apr 2018 22:01:32 +, Timothy Penner via 4D_Tech wrote:
> Why use LEP for something that has been built into 4D since v6?
> http://doc.4d.com/4Dv15/4D/15.5/MOVE-DOCUMENT.301-3576481.en.html
> 
> -Tim
> 
> 
> 

---
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: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: v13+ LEP permision issues.

2018-04-23 Thread Chip Scheide via 4D_Tech
Jim,
Thanks!

That put me on the right track.
yes, mv needs a full destination path (at least when run through LEP).

The permission error was coming from LEP 'pointing' at the hard drive 
as the current directory; and as such LEP could not write to the 
location.

I had tried a full destination path, but wen I re-ran the code, I 
noticed a problem with the posix path name for the destination 
directory, which is why it failed previously.

Again, Thanks for pointing me in the right direction.


On Sun, 22 Apr 2018 09:14:03 -0400, Jim Crate via 4D_Tech wrote:
> On Apr 20, 2018, at 5:45 PM, Chip Scheide via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
>> Trying to rename a file.
> [snip]
>> when I execute the below line of (LEP) code I get a permissions error
>> mv /Volumes/Macintosh\ HD/Users/chip/Desktop/_Test\ File\ 
>> move/Some_Win_Name.txt2 Testing.txt
>> 
>> the exact error:
>> mv: rename /Volumes/Macintosh HD/Users/chip/Desktop/_Test File 
>> move/Some_Win_Name.txt2 to Testing.txt: Permission denied\n
> 
> Have you tried specifying the full destination path? With the path 
> specified as just filename it will probably to the current working 
> directory (I.e. as if you specified “./Testing.txt”), which is 
> probably different in Terminal and 4D/LEP.  Chances are you don’t 
> have write permissions in the 4D/LEP current working directory. You 
> can test that theory using the pwd command.
> 
> Jim Crate
> 
> **
> 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
> **
---
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: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: v13+ LEP permision issues.

2018-04-22 Thread Chip Scheide via 4D_Tech
thanks Jim,
I think I did that, but I will try again.

> On Apr 20, 2018, at 5:45 PM, Chip Scheide via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
>> Trying to rename a file.
> [snip]
>> when I execute the below line of (LEP) code I get a permissions error
>> mv /Volumes/Macintosh\ HD/Users/chip/Desktop/_Test\ File\ 
>> move/Some_Win_Name.txt2 Testing.txt
>> 
>> the exact error:
>> mv: rename /Volumes/Macintosh HD/Users/chip/Desktop/_Test File 
>> move/Some_Win_Name.txt2 to Testing.txt: Permission denied\n
> 
> Have you tried specifying the full destination path? With the path 
> specified as just filename it will probably to the current working 
> directory (I.e. as if you specified “./Testing.txt”), which is 
> probably different in Terminal and 4D/LEP.  Chances are you don’t 
> have write permissions in the 4D/LEP current working directory. You 
> can test that theory using the pwd command.
> 
> Jim Crate
> 
> **
> 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
> **

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: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: v13+ LEP permision issues.

2018-04-22 Thread Jim Crate via 4D_Tech
On Apr 20, 2018, at 5:45 PM, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> 
wrote:

> Trying to rename a file.
[snip]
> when I execute the below line of (LEP) code I get a permissions error
> mv /Volumes/Macintosh\ HD/Users/chip/Desktop/_Test\ File\ 
> move/Some_Win_Name.txt2 Testing.txt
> 
> the exact error:
> mv: rename /Volumes/Macintosh HD/Users/chip/Desktop/_Test File 
> move/Some_Win_Name.txt2 to Testing.txt: Permission denied\n

Have you tried specifying the full destination path? With the path specified as 
just filename it will probably to the current working directory (I.e. as if you 
specified “./Testing.txt”), which is probably different in Terminal and 4D/LEP. 
 Chances are you don’t have write permissions in the 4D/LEP current working 
directory. You can test that theory using the pwd command.

Jim Crate

**
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: v13+ LEP permision issues.

2018-04-22 Thread Keisuke Miyako via 4D_Tech
f.y.i.

https://github.com/miyako/4d-plugin-rename

2018/04/21 7:42、Chip Scheide via 4D_Tech 
<4d_tech@lists.4d.com> のメール:
(rename a folder for example)


**
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: v13+ LEP permision issues.

2018-04-20 Thread Chip Scheide via 4D_Tech
Ive written the code to do most of these actions in 4D.
4D's file/folder manipulation functions are FAR slower then the native 
OS commands. In addition to do some actions (rename a folder for 
example) requires coding though hoops to the job done.

I'll revisit this issue next week... maybe it is something simple 
(usually is)


 
On Fri, 20 Apr 2018 22:28:46 +, Timothy Penner wrote:
> There is also COPY DOCUMENT which does support folders, and then 
> there is the DELETE FOLDER command.
> 
> http://doc.4d.com/4Dv15/4D/15.5/COPY-DOCUMENT.301-3576478.en.html
> http://doc.4d.com/4Dv15/4D/15.5/DELETE-FOLDER.301-3576466.en.html
> 
> Do you get permission errors when using those?
> 
> -Tim
> 
> 
> 
> Timothy Penner
> Senior Technical Services Engineer
> 
> 4D Inc
> 95 S. Market Street, Suite #240
> San Jose,CA 95113
> United States
> 
> Telephone: +1-408-557-4600
> Fax:   +1-408-271-5080
> Email: tpen...@4d.com
> Web:   www.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: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: v13+ LEP permision issues.

2018-04-20 Thread Chip Scheide via 4D_Tech
also - rename is not the only thing I am trying to do, it just happens 
to be the one that came to the fore during testing.

On Fri, 20 Apr 2018 22:01:32 +, Timothy Penner via 4D_Tech wrote:
> Why use LEP for something that has been built into 4D since v6?
> http://doc.4d.com/4Dv15/4D/15.5/MOVE-DOCUMENT.301-3576481.en.html
> 
> -Tim
> 
> 
> 
> **
> 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
> **
---
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: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: v13+ LEP permision issues.

2018-04-20 Thread Timothy Penner via 4D_Tech
There is also COPY DOCUMENT which does support folders, and then there is the 
DELETE FOLDER command.

http://doc.4d.com/4Dv15/4D/15.5/COPY-DOCUMENT.301-3576478.en.html
http://doc.4d.com/4Dv15/4D/15.5/DELETE-FOLDER.301-3576466.en.html

Do you get permission errors when using those?

-Tim



**
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: v13+ LEP permision issues.

2018-04-20 Thread Chip Scheide via 4D_Tech
does work for folders

On Fri, 20 Apr 2018 22:01:32 +, Timothy Penner via 4D_Tech wrote:
> Why use LEP for something that has been built into 4D since v6?
> http://doc.4d.com/4Dv15/4D/15.5/MOVE-DOCUMENT.301-3576481.en.html
> 
> -Tim
> 
> 
> 
> **
> 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
> **
---
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: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: v13+ LEP permision issues.

2018-04-20 Thread Timothy Penner via 4D_Tech
Why use LEP for something that has been built into 4D since v6?
http://doc.4d.com/4Dv15/4D/15.5/MOVE-DOCUMENT.301-3576481.en.html

-Tim



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