Size: 3698
Comment:
|
Size: 3659
Comment: New version
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
## page was renamed from UserCommands/Latest2 | |
Line 3: | Line 4: |
= User Command ScriptManager (Dyalog) = | = User Command "Latest" = |
Line 5: | Line 7: |
ScriptManager is a utility useful to manage scripts in a workspace. | |
Line 7: | Line 8: |
Obviously it makes sense to make ScriptManager available as a User Command. | This User Command prints the fully qualified names of functions and operators together with time stamps and the user names to the session, sorted by time stamp (oldest first). |
Line 9: | Line 10: |
This page offers a small class script `ScriptManager_UC.dyalog` which is designed to do exactly that. | Note that fns/opr in scripted namespaces are '''execluded'''. In the context of a command latest they don't offer real value since they all get the same time stamp when the script gets fixed. This is more often misleading than useful. |
Line 11: | Line 12: |
== Assumptions == In order to make `ADOC` available as a user command the script `ADOC_UC.dyalog` ("UC" for User Command) attached to this page must go somewhere where Dyalog is able to find it. There are to options: |
The following is a sample session taken in the workspace "CPro" (Causeway) a Dyalog installation is coming with at the time of writing (2012-03). |
Line 14: | Line 14: |
* Move it into `Salt\Spice` inside the Dyalog installation folder. That's where the Dyalog User Commands are located. * Create a particular folder for your own User Commands. |
An empty vector means ALL fns/opr: {{{ ]q←Latest2 ⍬ ⍴q 1832 3 }}} |
Line 17: | Line 21: |
Although the first option is certainly easier, it's actually the second one which is recommended. There are a couple of reasons: | A positive integer n is treated as "report n fns/opr changed most recently", therefore you get 6 or less objects printed to the session: {{{ ]Latest2 6 #.Class.Initialise 2008.02.22 18:40:42 Adrian #.Class.Qualify 2008.02.22 18:52:15 Adrian #.Class.PM.Refresh 2008.02.22 19:01:15 Adrian #.Class.IL.Refresh 2008.02.22 19:27:25 Adrian #.Class.IC.Refresh 2008.02.22 19:42:32 Adrian #.CPro.Fns.Exec0 2008.02.22 19:43:40 Adrian }}} |
Line 19: | Line 32: |
* Messing Dyalog scripts with your scripts is not a good idea. * When a new version of Dyalog arrives you are in trouble. * Having a separate folder for your own User Commands allows you to overwrite a Dyalog User Command with an improved version you are not going to loose in case of an update or a new version. |
A negative integer n is treated as "report all fns/opr changed during the nth recent days": {{{ ]Latest2 ¯2 #.CPro.Class.EventNumber 2008.01.24 14:46:02 Adrian #.Class.MakeBitmap 2008.02.22 18:37:41 Adrian #.Class.Initialise 2008.02.22 18:40:42 Adrian #.Class.Qualify 2008.02.22 18:52:15 Adrian #.Class.PM.Refresh 2008.02.22 19:01:15 Adrian #.Class.IL.Refresh 2008.02.22 19:27:25 Adrian #.Class.IC.Refresh 2008.02.22 19:42:32 Adrian #.CPro.Fns.Exec0 2008.02.22 19:43:40 Adrian }}} |
Line 23: | Line 45: |
To make your own User Command folder work you have to do a couple of things: | Note that you cannot specify the negative value as `-4` rather than `¯4` because Dyalog considers it to be a switch then and refuses to accept that. |
Line 25: | Line 47: |
1. Add the folder to the SALT search path. 1. Create another folder which is going to host the "real thing". A recommended name is "!UserCommandCode". 1. Copy the script `ADOC.dyalog` from the [[ADOC]] page into that folder. 1. Create a registry entry pointing to that new folder with the name `HKEY_CURRENT_USER\Software\Dyalog\Dyalog APL/W 12.1 Unicode\SALT\CodeFolder` |
For that reason there is also a `-d` switch which means that the integer shall be treated as a day. That way the value can be positive. |
Line 30: | Line 49: |
Note that the script attached to this page only deals with two issues: * Figure out what command the user wants to invoke, "Browse" or "List". * Find the real work horse and call it, see below. In order to achieve that the script `ADOC_UC.dyalog` reads the `HKEY_CURRENT_USER\Software\Dyalog\Dyalog APL/W 12.1 Unicode\SALT\CodeFolder` from the Windows registry. It then tries to load the "real" ADOC script from that folder. Note that not only our examples given on this page but also the code in `ADOC_UC.dyalog` all refer to version 12.1 Unicode of Dyalog. If your are using a different version of Dyalog of course you must change the script, otherwise it's not going to work. == Samples == Given that the two different ADOC scripts went into the right folders, this would be a sample session: |
By default `Latest` investigates `#`. With the optional switch `-s` one can change that. The following statement returns 6 fns/opr from the namespace `#.Class.IC`: |
Line 43: | Line 52: |
]?ADOC "??" for general help, "?CMD" for more specific info on command CMD |
]Latest2 ¯5 -s=#.Class.IC #.Class.IC.Caption 1997.07.31 18:13:06 Adrian #.Class.IC.Design 1997.07.31 23:38:26 Adrian #.Class.IC.Create 1997.08.01 11:50:52 Adrian #.Class.IC.onConfigure 1997.08.01 11:54:51 Adrian #.Class.IC.Read 1997.09.01 15:36:54 Adrian #.Class.IC.Fns 2008.01.23 12:51:28 Adrian #.Class.IC.Refresh 2008.02.22 19:42:32 Adrian }}} |
Line 46: | Line 62: |
Group Name Description ===== ==== =========== ADOC ADOC.Browse Creates full documentation and displayes it in the default browser. ADOC.HELP Displays help regarding ADOC. ADOC.List Prints syntax of all public stuff to the session. |
Occasionally it might be useful to include fns/opr from scripted namespaces as well. This can be achieved with the `-a` switch (for "all"). |
Line 52: | Line 64: |
]?ADOC.Browse Command "ADOC.Browse". Syntax: 1 arguments; accepts switches -b= Script location: ........\....\....\ADOC |
Let's create a scripted namespace in order to get something to bite into: |
Line 56: | Line 66: |
Gathers information from a class script, compiles an HTML page with these pieces of information and displays it in your default browser. |
{{{ ⎕fix ':Namespace Foo' '∇r←Hello' 'r←''World''' '∇' ':EndNamespace' ]Latest2 3 #.Class.IL.Refresh 2008.02.22 19:27:25 Adrian #.Class.IC.Refresh 2008.02.22 19:42:32 Adrian #.CPro.Fns.Exec0 2008.02.22 19:43:40 Adrian ]Latest2 3 -a #.Class.IC.Refresh 2008.02.22 19:42:32 Adrian #.CPro.Fns.Exec0 2008.02.22 19:43:40 Adrian #.Foo.Hello 2012.03.05 16:20:35 Kai |
Line 60: | Line 77: |
]?ADOC.List Command "ADOC.List". Script location: ........\...\...\ADOC |
}}} |
Line 64: | Line 79: |
Prints a list with all sorts of information to the session about all public stuff given in the script specified in the right argument ]ADOC.Help Watch your browser Shows extensive information about ADOC. It's basically doing `ADOC.Browse ADOC`. }}} |
|
Line 75: | Line 82: |
[[attachment:ADOC_UC.zip | Download]] the script. | [[attachment:Latest2.zip | Download]] the script and the workspace. |
Line 78: | Line 85: |
The script is version 1.2.0 from 2011-08-04 | The script is version 1.0.0 from 2012-03-05 |
Line 82: | Line 89: |
-- KaiJaeger <<DateTime(2011-08-04T19:54:50Z)>> | -- KaiJaeger <<DateTime(2012-03-05T14:37:53Z)>> |
Contents
User Command "Latest"
Overview
This User Command prints the fully qualified names of functions and operators together with time stamps and the user names to the session, sorted by time stamp (oldest first).
Note that fns/opr in scripted namespaces are execluded. In the context of a command latest they don't offer real value since they all get the same time stamp when the script gets fixed. This is more often misleading than useful.
The following is a sample session taken in the workspace "CPro" (Causeway) a Dyalog installation is coming with at the time of writing (2012-03).
An empty vector means ALL fns/opr:
]q←Latest2 ⍬ ⍴q 1832 3
A positive integer n is treated as "report n fns/opr changed most recently", therefore you get 6 or less objects printed to the session:
]Latest2 6 #.Class.Initialise 2008.02.22 18:40:42 Adrian #.Class.Qualify 2008.02.22 18:52:15 Adrian #.Class.PM.Refresh 2008.02.22 19:01:15 Adrian #.Class.IL.Refresh 2008.02.22 19:27:25 Adrian #.Class.IC.Refresh 2008.02.22 19:42:32 Adrian #.CPro.Fns.Exec0 2008.02.22 19:43:40 Adrian
A negative integer n is treated as "report all fns/opr changed during the nth recent days":
]Latest2 ¯2 #.CPro.Class.EventNumber 2008.01.24 14:46:02 Adrian #.Class.MakeBitmap 2008.02.22 18:37:41 Adrian #.Class.Initialise 2008.02.22 18:40:42 Adrian #.Class.Qualify 2008.02.22 18:52:15 Adrian #.Class.PM.Refresh 2008.02.22 19:01:15 Adrian #.Class.IL.Refresh 2008.02.22 19:27:25 Adrian #.Class.IC.Refresh 2008.02.22 19:42:32 Adrian #.CPro.Fns.Exec0 2008.02.22 19:43:40 Adrian
Note that you cannot specify the negative value as -4 rather than ¯4 because Dyalog considers it to be a switch then and refuses to accept that.
For that reason there is also a -d switch which means that the integer shall be treated as a day. That way the value can be positive.
By default Latest investigates #. With the optional switch -s one can change that. The following statement returns 6 fns/opr from the namespace #.Class.IC:
]Latest2 ¯5 -s=#.Class.IC #.Class.IC.Caption 1997.07.31 18:13:06 Adrian #.Class.IC.Design 1997.07.31 23:38:26 Adrian #.Class.IC.Create 1997.08.01 11:50:52 Adrian #.Class.IC.onConfigure 1997.08.01 11:54:51 Adrian #.Class.IC.Read 1997.09.01 15:36:54 Adrian #.Class.IC.Fns 2008.01.23 12:51:28 Adrian #.Class.IC.Refresh 2008.02.22 19:42:32 Adrian
Occasionally it might be useful to include fns/opr from scripted namespaces as well. This can be achieved with the -a switch (for "all").
Let's create a scripted namespace in order to get something to bite into:
⎕fix ':Namespace Foo' '∇r←Hello' 'r←''World''' '∇' ':EndNamespace' ]Latest2 3 #.Class.IL.Refresh 2008.02.22 19:27:25 Adrian #.Class.IC.Refresh 2008.02.22 19:42:32 Adrian #.CPro.Fns.Exec0 2008.02.22 19:43:40 Adrian ]Latest2 3 -a #.Class.IC.Refresh 2008.02.22 19:42:32 Adrian #.CPro.Fns.Exec0 2008.02.22 19:43:40 Adrian #.Foo.Hello 2012.03.05 16:20:35 Kai
Download
Download the script and the workspace.
Version
The script is version 1.0.0 from 2012-03-05
Author: KaiJaeger
-- KaiJaeger 2012-03-05 14:37:53