How to write the symbol for begin/end expression inside RichString? - xtend

How do I write the symbol » from within an Eclipse environment with Xtend, in order to obtain this code:
def writeLetterTo(Person p) '''
Dear «p.forename»,
bla bla foo
Yours sincerely,
Joe Developer
«signature»
'''

It's bound to CTRL+> and also available through code completion.
An a mac it's also bound to ALT+SHIFT+Q

On my linux,
CTRL+SHIFT+<
and
CTRL+SHIFT+>

Related

Having trouble compiling scribble document with `#lang scribble/html`

I'm trying to use Scribble (Racket v8.0 [cs]) to generate some HTML using #lang scribble/html and I've reduced my source file to only the lang statement (to isolate other issues):
#lang scribble/html
To run the code I'm using terminal:
% scribble test.scrbl
However, I'm running into the following error during compilation:
dynamic-require: name is not provided
name: 'doc
module: #<resolved-module-path:"/Users/josh/Desktop/blog architecture/00001 article name/test.scrbl">
context...:
.../private/map.rkt:40:19: loop
.../racket/cmdline.rkt:191:51
body of "/Applications/Racket v8.0/share/pkgs/scribble-lib/scribble/run.rkt"
Obviously something is missing - perhaps a require statement? I'm not sure. If you have a better approach to using #lang scribble/html I'm open to that as long as I can use the html tags.
Thank you!
Hello person from 6 months ago! I hope you have solved your problem, but for other travelers here's what worked for me:
Don't use the scribble binary, but directly use the racket executable.
So, instead of:
$ scribble test.scrbl
Do
$ racket test.scrbl
This seemed to work for me with scribble/text, and outputted exactly what I wanted (nothing weirdly processed, nothing "helpfully" escaped - just my text + my racket code executed)

Junit Console Launcher .. support for tag expressions

My junit-console-launcher command vaguely resembles,
java -jar ./junit-platform-console-standalone.jar -cp . -c pkg.Class1 -c pkg1.Class2 -t A --details=verbose
I do this because I need to send in my classes in a certain order. I needed help in using tag expressions which is documented here,
https://junit.org/junit5/docs/current/user-guide/#running-tests-tag-expressions
-t 'A & B' does not seems to be recognized by junit console launcher. I need to select tests which are tagged both A and B. Is this supported? Any ideas?
Copied from https://junit.org/junit5/docs/current/user-guide/#running-tests-console-launcher
-t, --include-tag=TAG
Provide a tag or tag expression to include only tests whose tags match. When this option is repeated, all patterns will be combined using OR semantics.
This indicates, that "tag expression" are supported.
You just need to convince your OS/shell command to pass the A&B string as a single argument without the quotes.
Note: you also need to pass a class name filter pattern that matches your test classes, something like --include-classname .*Class? Or wait until 1.7.0-M2 is released: https://github.com/junit-team/junit5/issues/2259

Execute search/replace in PhpStorm as action

I'm looking for a solution to:
store favorite "Find Occurrences of ..." and
execute them without any more questions by the UI in one stroke
I know the option ALT + 3 -> STRG + E to open the last Find Usages, but that are only "Find" and not "Replace in Path" actions
Maybe I need to develop a plugin - that could look like this:
DO REPLACEMENTS:
----------------------------------
[X] foo -> bar
[ ] bar -> foo
[X] ): boolean -> ): bool
----------------------------------
[add] [execute] [execute & review]
----------------------------------
but any other ideas are welcome!
Important is to use PhpStorm`s file scopes! Because I would like to use my own custom scope.
You can use "Structural Search Inspection". It's base on the "Structural Search and Replace" engine which is pretty powerful. Once configured you can run the inspection using the "Run Inspection by Name..." action with a custom scope. It has a quick fix which can be used to replace occurrences.

Is there a apply-function-to-region-lines in emacs?

A lot of my work involves searching and deleting unnecessary lines of code. So I create a macro, and then select all lines (C-x h) and then run the command (apply-macro-to-region-lines). I managed to save that command and placed it in my .emacs file; I called it cut_it_now. But now my function is not a macro anymore, so I can't use the (apply-macro-to-region-lines) function anymore.
Do you know if there is (apply-function-to-region-lines) implemented somewhere?
Many thanks,
D
The following function should do what you want:
(defun apply-function-to-region-lines (fn)
(interactive "aFunction to apply to lines in region: ")
(save-excursion
(goto-char (region-end))
(let ((end-marker (copy-marker (point-marker)))
next-line-marker)
(goto-char (region-beginning))
(if (not (bolp))
(forward-line 1))
(setq next-line-marker (point-marker))
(while (< next-line-marker end-marker)
(let ((start nil)
(end nil))
(goto-char next-line-marker)
(save-excursion
(setq start (point))
(forward-line 1)
(set-marker next-line-marker (point))
(setq end (point)))
(save-excursion
(let ((mark-active nil))
(narrow-to-region start end)
(funcall fn)
(widen)))))
(set-marker end-marker nil)
(set-marker next-line-marker nil))))
So, if you have the following function that you want to apply against lines in a buffer:
(defun test()
(insert "> "))
And, if your buffer contains the following contents:
Line 1: blah, blah
Line 2: blah, blah
Line 3: blah, blah
Line 4: blah, blah
If you select a region enclosing just lines 2 & 3, enter "M-x apply-function-to-region-lines", and enter "test" as the function name when prompted, you will get the following result in your buffer:
Line 1: blah, blah
> Line 2: blah, blah
> Line 3: blah, blah
Line 4: blah, blah
Note that you can still use apply-macro-to-region-lines with a macro generated from code, provided the macro is defined as a vector or string. With a custom apply-named-macro-to-region-lines[2], you can select the macro to use interactively.
Emacs has two ways of generating code from a keyboard macro, depending upon the method used to name it.
If you use kmacro-name-last-macro (bound to C-xC-kn), then Emacs generates a function from the macro, which is not directly useful for this particular purpose [1].
If you use name-last-kbd-macro to name your macro, it will be generated as a vector or string.
In either case, you then use insert-kbd-macro to obtain the code.
In fact the vector/string format is the default, so you could bypass the naming step and immediately ask for the code (typing RET at the name prompt to indicate the most recently-defined macro), and then manually edit the default name of the inserted code.
[1]: The vector form does appear to simply be embedded in the function definition, so you should be able to extract that from the code to manually re-define a macro function in vector format.
[2]: When I originally wrote this reply, I'd forgotten that this was a custom function. Sorry about that.
(defun apply-named-macro-to-region-lines (top bottom)
"Apply named keyboard macro to all lines in the region."
(interactive "r")
(let ((macro (intern
(completing-read "kbd macro (name): "
obarray
(lambda (elt)
(and (fboundp elt)
(or (stringp (symbol-function elt))
(vectorp (symbol-function elt))
(get elt 'kmacro))))
t))))
(apply-macro-to-region-lines top bottom macro)))
A simple solution is to define a macro that calls your function then use the good ol' apply-macro-to-region-lines.
Apart from that, I think that you could write a loop in a few lines of elisp that does exactly what you ask for. If you would like to be fancy, you can even prompt the user for the name of the function. I think this is a good exercise for elisp, I can help you with some pointers if you feel like you would like to try it yourself.
I agree with #Lindydancer's answer, and I'd also add that there might be an easier way to accomplish your goal. e.g. the built-in function delete-matching-lines. :-)
You could always copy the source to apply-macro-to-region-lines and tweak it to call a passed in function, and thus make your own version.

Need MUMPS Sample Code

I am working on an analysis tool for which I need MUMPS sample code. Can anyone provide me MUMPS live code or sample code? Also suggest some links for same.
This is some MUMPS i wrote for fun. I guess if you can analyze this, your tool works:
Q N R,Q,C,D,E,W,B,G,H,S,T,U,V,F,L,P,N,J,A S N=$G(N),Q='N,F=Q+Q,P=F+F,W=$L($T(Q))
S W=$E(W,Q),S='N_+N,W=W-F*S,L=$G(L),R=$C(Q_F_P),R(F)=$C(F+Q_F),R(P)=$C(W-F) W #
S T=$E($T(Q+F),F,W\S)_$C(W+S+F) X T S B=$P(T,$C(P_P),F),C=B\(W*W),D=B-(C*W*W)\W
F G=S-Q:F:S+F+Q S E=B-(C*W*W+(D*W)),H=$E($T(Q),G),#H=$S(#H<S:'Q,Q:N)_#H,T=C_D_E
F A=Q:Q:W\S S J=$E(T,A),C(F)=$S(J>(F+Q)&(J<(S-F)):Q,Q:+N),C(P)=$S(J#F:Q,Q:+N) D
.S C(Q)=$S(J<(S-F):+N,Q:Q),C(F+Q)=$S(J>Q&(J<(S-F))&(J'=(P+'L))&(J'=(P)):Q,Q:+N)
.S H('L)=L F S H(N?.E)=$O(C(H('$G(N)))) Q:H('+L)=L S F(A,H('L))=C(H(W[(W\S)))
F U=Q:Q:P W !,R F V=Q:Q:P+F W $S(F(V,U):'Q,Q:$C(P_(W\S))) W:'(V#F) $C('N_F_F+F)
W !!,R(F)_C_R(P)_D_R(P)_E_R(F) X $RE($E($T(Q),Q+F,P+Q))_R(P)_'N W # G:N=L Q+F Q
look ma, no literals!
This outputs a binary clock:
:D Q^ROU
|..|..|..|
|..|..|.0|
|..|.0|0.|
|..|00|..|
00:13:24
GitHub actually host many MUMPS software, but it unfortunatly get tagged as Objective-C or Matlab so it is not easy to search for MUMPS code over there. Here are some projects I know are done at least partially using MUMPS :
OSEHRA
Reynard GT.M Server
GT.M Term Size
GT.M POSIX Extension
Tetris in MUMPS
Juicy MUMPS Example
GT.M PCRE Extension
GT.M Digest Extension
DataBallet
Source KIDS
Software development tools for MUMPS
I don't think any of this will be enough for analysis purposes, but there are a lot of small examples at M[UMPS] by Example. There's also some lengthy samples on the MUMPS Wikipedia page. I don't know if they are stand alone or not. Haven't tested them myself.
VistA is an open source EMR for the Veteran's Administration written on MUMPS. You can download it off of the VistA wiki here: OpenVistA Download Page
I haven't tried to download it myself, so you may need to install MUMPS to get access to the source. Good Luck!
Look here:
http://www.faqs.org/faqs/m-technology-faq/part2/
Scroll down to (or search for) the section heading "Appendix 6" (without the double-quotes).
HTH
Nathan
Here is the sample piece of code, to loop though a global, traverse it
and print the data in the terminal.
TESTLOG
S TC=""
F S TC=$O(^TCLOG(TC)) Q:TC="" D
. S LogDT=""
. F S LogDT=$O(^TCLOG(TC,LogDT)) Q:LogDT="" D
. . S Type=""
. . F S Type=$O(^TCLOG(TC,LogDT,Type)) Q:Type="" D
. . . Q:Type'="UPDATE"
. . . S LogData=$G(^TCLOG(TC,LogDT,"UPDATE"))
. . . W !,LogData
Q
And find the below link for some more reference
http://www.vistapedia.com/index.php/MUMPS_Code_Examples
Here's "hello world": w "Hello world!",!
The w is an abbreviation of write - either is acceptable but the abbreviation is more idiomatic. The literal ! is a newline.
Here's a fibonacci implementation, first without abbreviations then with
innerFibonacci(value,cache)
if $data(cache(value))=1 quit cache(value)
set cache(value)=$$innerFibonacci(value-1,.cache)+$$innerFibonacci(value-2,.cache)
quit cache(value)
fibonacci(value)
new cache
set cache(0)=1
set cache(1)=1
quit $$innerFibonacci(value,.cache)
Here's the same thing with the more idiomatic abbreviations:
innerFibonacci(value,cache)
i $d(cache(value))=1 q cache(value)
s cache(value)=$$innerFibonacci(value-1,.cache)+$$innerFibonacci(value-2,.cache)
q cache(value)
fibonacci(value)
n cache
s cache(0)=1
s cache(1)=1
q $$innerFibonacci(value,.cache)
Now - recursion in MUMPS is a pretty dangerous thing to do because the MUMPS interpreter won't automatically convert tail recursions to iterations - so this could easily blow up for a large value.
Here's a little more "MUMPS-y" example, one that actually leverages MUMPS' single data structure, which is essentially a sorted array whose indices can be numbers or strings. Prefixing these arrays with ^ saves to disk. The $ things are functions built in to the language. The q: is a postcondition on the quit command, meaning 'quit if person is equal to ""'.
Here it is without abbreviations, then with:
peopleFoodCombinations(people,food)
new person
for set person=$order(people(person)) quit:person="" do
. set ^PEOPLE(person,"favoriteFood")=$get(food(person))
quit
Now with abbrevs:
peopleFoodCombinations(people,food)
n person
f s person=$o(people(person)) q:person="" d
. s ^PEOPLE(person,"favoriteFood")=$g(food(person))
q