is there a way to list words in the current Red console - red

Is there an object like rebol/words available in the REPL build with console.red ?
I am using the red-master currently on github ( it says alpha and Latin-1 only but no other version id and I didn't see anything at top of console.red)
I was trying some functions but didn't have a listing of those available ( it may be right under my nose ... )
thanks

Use words-of system/words to get a list of all words defined in global context.
Use system/version to get the version and system/build/date for the build date.

Related

SerialSearch with Cursors

I am trying to use SerialSearch to identify about 800 titles with a single keyword. When I run:
serialSearch = SerialSearch(query={"title": "myKeyword"})
it gives me the first 200. I would like to get the remaining 600. I saw there is a start parameter that appears to be deprecated in favor of a cursor but I can't find any details on how to implement it. Is there a reference example for this?
With the current development version you can pass start=200 to the class, to get entries ranging from 200 to 399.
Install via
pip install git+https://github.com/pybliometrics-dev/pybliometrics
Then use
serialSearch = SerialSearch(query={"subject": "ECON"}, start=200, refresh=True)
The refresh=True bit is important, otherwise pybliometrics will use the old information.
Eventually Scopus implements pagination with cursors akin to the Scopus Search API, which would solve this problem.

Printing to console in VDM++?

How do I print text or values to the console to validate that my model is working correctly?
I would like to do something like this:
class Main
operations
public Run: () ==> ()
Run() ==
print "Text"
print mon.Func()
end Main
It seems to be possible, but I just cant figure out how to do it.
You need to use the VDM IO library. There are a couple of operations that do what you want - println (for printing fixed values) and printf, which has parameter substitution. So you would call IO`println("hello"), for example.
In the latest release of Overture and VDMJ, you can also use a VDM annotation to print values without adding anything to the "content" of the specification itself. Annotations are rather added as comments. See #Printf.
Nick Battle answered my question but for other beginners to VDM, there is missing a detail to his answer, how to include libraries.
Before one can use the IO library, you first have to include it.
I am using Overture and to include libraries into your project, you have to right-click on the project in the side menu and press New > Add VDM Library.
You can then choose which libraries you want to include in a menu that pops up.
Here you choose IO.
After this you should be able to print out values using the IO`println(val) function.

Sparx Enterprise Architect DocumentGenerator does not honour TaggedValues on Stereotype or values from SetProjectConstants and ReplaceField

maybe someone can help me on this. I am trying to generate a document via the DocumentGenerator interface. All in all this works well, except that the DocumentGenerator does not replace the Report Constants with actual values (which are defined on the report package stereotype.
This is the general flow of the document creation code (which generally works):
var gen = Repository.CreateDocumentGenerator();
gen.SetProjectConstant("ReportName", "My Project");
gen.NewDocument(string.Empty);
gen.ReplaceField("ReportName", "My Project");
gen.InsertCoverPageDocument(tags[REPORT_COVERPAGE]);
gen.InsertBreak(DocumentBreak.breakPage);
gen.InsertTOCDocument(tags[REPORT_TOC]);
gen.InsertBreak(DocumentBreak.breakPage);
gen.DocumentPackage((int)nativeId, 0, template);
gen.SaveDocument(fileName, DocumentType.dtDOCX);
I tried ReplaceField and SetProjectConstant both and one at a time before and after calls to NewDocument/InsertCoverPageDocument:
Strangely there is one constant that is being replaced: ReportSummary.
When I run the document generator via "F8" all constants are being replaced correctly.
Other project constants are being replaced correctly.
I can reproduce the behaviour on EA v14.1.1429 and v12.0.1215.
Does someone have a hint for further troubleshooting? Thanks in advance!
========== UPDATE ==========
When I use ReplaceField at the end (before the actual call to SaveDocument the following Report Constants get replaced: {ReportTitle} and {ReportName}
I discovered some workaround: when I manually remove the predefined {Report~} constants from the template and re-add them as Project Constants, their values get replaced correctly.
I will examine this further and give an update as
I did some further investigation on this and came to the following conclusion and workaround (as I have received no comments or answers on this):
I deleted all references to ReportConstants in my EA templates and replaced them by ProjectConstants with the same name.
In my code where I want to generate the documentation I (re)set all ProjectConstants with the actual values via SetProjectConstant and additionally added a call to ReplaceField to replace the constants with the actual values.
The previous mentioned calls are inserted directly before the call to SaveDocument document.
tags.ForEach(t =>
{
if (string.IsNullOrWhiteSpace(t.Key)) return;
generator.SetProjectConstant(t.Key, t.Value);
generator.ReplaceField(t.Key, t.Value);
});
generator.SaveDocument(fileName, DocumentType.dtDOCX);
If someone comes up with a better resonse or explanation for the behaviour I am happy to accept this as answer.
I have also found that when you call ReplaceField on these project constants in a CoverPage template, the formatting defined in the template is overwritten. It seems that some of the SetProjectConstant calls actually set the values as you would expect, and the rest do not.. hence the need to call both sets of APIs.

How to reliably detect os/platform in Go

Here's what I'm currently using, which I think gets the job done, but there's got to be a better way:
func isWindows() bool {
return os.PathSeparator == '\\' && os.PathListSeparator == ';'
}
As you can see, in my case all I need to know is how to detect windows but I'd like to know the way to detect any platform/os.
Play:
http://play.golang.org/p/r4lYWDJDxL
Detection at compile time
If you're doing this to have different implementations depending on the OS, it is more useful to
have separate files with the implementation of that feature and add build tags to each
of the files. This is used in many places in the standard library, for example in the os package.
These so-called "Build constraints" or "Build tags" are explained here.
Say you have the constant PATH_SEPARATOR and you want that platform-dependent, you
would make two files, one for Windows and one for the (UNIX) rest:
/project/path_windows.go
/project/path_unix.go
The code of these files would then be:
path_windows.go
// +build windows
package project
const PATH_SEPARATOR = '\\'
path_unix.go
// +build !windows
package project
const PATH_SEPARATOR = '/'
You can now access PATH_SEPARATOR in your code and have it platform dependant.
Detection at runtime
If you want to determine the operating system at runtime, use the runtime.GOOS
variable:
if runtime.GOOS == "windows" {
fmt.Println("Hello from Windows")
}
While this is compiled into the runtime and therefore ignores the environment,
you can nevertheless be relatively certain that the value is correct.
The reason for this is that every platform that is worth distinguishing needs
rebuilding due to different executable formats and thus has a new GOOS value.
Have you looked at the runtime package? It has a GOOS const: http://golang.org/pkg/runtime/#pkg-constants
It's 2022 and the correct answer for go 1.18+ is:
At runtime you want:
if runtime.GOOS == "windows" {
// windows specific code here...
}
If you need to determine the filesystem path separator character
Use: os.PathSeparator
Examples:
c:\program files
/usr/local/bin
If you need the Path List separator as used by the PATH environment variable
Use: os.PathListSeparator
Examples:
/usr/local/bin:/usr/local:
"C:\windows";"c:\windows\system32";
Since this is an older question and answer I have found another solution.
You could simply use the constants defined in the os package. This const returns a rune so you would need to use string conversion also.
string(os.PathSeparator)
string(os.PathListSeparator)
Example: https://play.golang.org/p/g6jnF7W5_pJ
I just stumbled on this looking for something else and noticed the age of this post so I'll add a more updated addition. If you're just trying to handle the correct filepath I would use filepath.Join(). Its takes all of the guesswork out of os issues. If there is more you need, other than just filepath, using the runtime constants (runtime.GOOS & runtime.GOARCH) are the way to go: playground example
I tested in Go 1.17.1 which really worked for me.
package main
import (
"fmt"
"runtime"
)
func main(){
fmt.Println(runtime.GOOS)
}
Output:
darwin
With regards to detecting the platform, you can use Distribution Detector project to detect the Linux distribution being run.
The first answer from #nemo is the most apropiate, i just wanted to point out that if you are currently a user of gopls language server the build tags may not work as intended.
There's no solution or workaround up to now, the most you can do is change your editor's lsp configs (vscode, neovim, emacs, etc) to select a build tag in order to being able to edit the files with that tag without errors.
Editing files with another tag will not work, and trying to select multiple tags fails as well.
This is the current progress of the issue github#go/x/tools/gopls

Is there any way to show all GitHub tickets without an assignee?

It seems kinda silly that this feature wouldn't be there. I feel like I am overlooking something obvious, but I haven't been able to Google any answer successfully.
#LyndenShields's answer doesn't seem to work anymore.
At this date (March 16, 2015), the way to search for issues that have no assignee is to use the no: qualifier in the issues Filter field:
no:assignee
Alternatively, you could use the following query string to achieve the same:
https://github.com/<username>/<repo>/issues?q=no%3Aassignee
EDIT: Note that I could not make it work if I only had one qualifier specified (ie. you may need to add another one and have it like no:assignee is:open).
EDIT #2 (March 16, 2016): the above edit is not accurate anymore (hence the strikethrough); GitHub now accepts search queries with one qualifier only.
EDIT #3 (July 26, 2017): removed the %01 from the end of the URL - it basically is an unused character, but I believe GitHub interpreted it as a space. Indeed, when you use it this way, GitHub will automatically add a space, I guess to make sure other qualifiers can easily be added. Strangely, though, it will add a %20 to the end of the URL today, but again, you can simply omit that part. The %3A between the words no and assignee is the character code for Colon. See a full list here.
EDIT #4 (June 30, 2020): this is now possible via the UI: simply go to your issues list (https://github.com/<username>/<repo>/issues) then choose Assigned to nobody from the Assignee dropdown:
Go to the issues list and show issues assigned to yourself. Look in the URL bar and change where it has your username to none just after 'assigned/' and press enter. The UI will look the same but the list will have only unassigned issues.
e.g.:
https://github.com/<username>/<repo>/issues/assigned/none
One workaround would be to compare:
the list of issues
with the list of issue assigned to anyone
(the difference being the list of issues not yet assigned)
See GitHub V3 Api "list-issues-for-a-repository" section:
assignee
String User login
none: for Issues with no assigned User.
*: for Issues with any assigned User.
2021 Update.
In the search bar you must type no:assignee and this will show all Github issues without an individual assigned to it.