substitution

Maven: property substitution not done for /project/version tag of pom?

三世轮回 提交于 2019-12-17 18:18:26
问题 http://maven.apache.org/pom.html#Properties says property "values are accessible anywhere within a POM". Should this read "are accessible in most places within a POM"? I can specify the version of a dependency no problem like so: <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> But what about the version of the project itself like so: <project xmlns="http://maven.apache.org/POM/4.0.0" ...> <modelVersion

sed error: “invalid reference \1 on `s' command's RHS”

我的梦境 提交于 2019-12-17 17:53:19
问题 I run several substitution commands as the core of a colorize script for maven. One of the sed commands uses a regular expression which works find in the shell as discussed here. The current (not working) implementation can be found here. When I include one of the variants of the command into the script different behavior occurs: Variant 1: $ sed -re "s/([a-zA-Z0-9./\\ :-]+)/\1/g" Adapted to the script: -re "s/WARNING: ([a-zA-Z0-9./\\ :-]+)/${warn}WARNING: \1${c_end}/g" \ Error: The shell

How do I create a “macro” for regressors in R?

喜你入骨 提交于 2019-12-17 06:51:52
问题 For long and repeating models I want to create a "macro" (so called in Stata and there accomplished with global var1 var2 ... ) which contains the regressors of the model formula. For example from library(car) lm(income ~ education + prestige, data = Duncan) I want something like: regressors <- c("education", "prestige") lm(income ~ @regressors, data = Duncan) I could find is this approach. But my application on the regressors won't work: reg = lm(income ~ bquote(y ~ .(regressors)), data =

How to use a variable in the replacement side of the Perl substitution operator?

空扰寡人 提交于 2019-12-17 02:22:29
问题 I would like to do the following: $find="start (.*) end"; $replace="foo \1 bar"; $var = "start middle end"; $var =~ s/$find/$replace/; I would expect $var to contain "foo middle bar", but it does not work. Neither does: $replace='foo \1 bar'; Somehow I am missing something regarding the escaping. I fixed the missing 's' 回答1: On the replacement side, you must use $1, not \1. And you can only do what you want by making replace an evalable expression that gives the result you want and telling s/

Why does my bash code fail when I run it with sh?

南笙酒味 提交于 2019-12-16 22:52:27
问题 I have a line of code that works fine in my terminal: for i in *.mp4; do echo ffmpeg -i "$i" "${i/.mp4/.mp3}"; done Then I put the exact same line of code in a script myscript.sh : #!/bin/sh for i in *.mp4; do echo ffmpeg -i "$i" "${i/.mp4/.mp3}"; done However, now I get an error when running it: $ sh myscript.sh myscript.sh: 2: myscript.sh: Bad substitution Based on other questions I tried changing the shebang to #!/bin/bash , but I get the exact same error. Why can't I run this script? 回答1:

Substitute LHS of = in R

六月ゝ 毕业季﹏ 提交于 2019-12-14 03:28:24
问题 I would like to replace the LHS of "=" in a expression in R. In my personal case, I need it to make sure the following creates a variable that does not already exist in the data frame df %>% mutate(v = mean(w)) I tried eval(substitute()) but the LHS is not substituted eval(substitute(df %>% mutate(v = mean(w)), list(v = as.name("id")))) #similarly in a list eval(substitute(l <- list(v=1:10),list(v=as.name("id")))) l $v [1] 1 2 3 4 5 6 7 8 9 10 Why can't v substituted throught eval/substitute?

bash substitutions in vimscript

喜夏-厌秋 提交于 2019-12-13 20:53:23
问题 How can I use bash substitutions in mapped commands in vimscript ? Vim does work well with && operator but it does not like bash $(command) operator and backticks operator. In my .vimrc I have such a simplified line: nnoremap SOME_KEY :!java $(echo % | sed 's/\.java//') <CR> I would expect running java Test command on pressing SOME_KEY if my current file is Test.java . Instead it results in the following error E492: Not an editor command: sed 's/\.java//') What is the correct way to use bash

Python, substitution cipher [closed]

↘锁芯ラ 提交于 2019-12-13 11:25:34
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I need to write a substitution cipher for the digits 0,1,2,3,...,9 substitutes each digit in 0,1,2,3,...,9. It can be represented as a 10 digit string specifying how each digit in 0,1,2,3,...,9 is substituted.

Caesar cypher in Python

蹲街弑〆低调 提交于 2019-12-13 09:54:16
问题 I am new to python and I want to write a program that asks for a line of input (each number will be separated by a single space.) It would use a simple letter-number substitution cipher. Each letter will be appointed a number. So 1 = a, 2 = b and 3 = c until it reaches 26 = z. From there, however, the cipher would continue on so; 27 = a, 28 = b etc. 0's will be a space. The program will only use 0's and positive numbers. It would also print out the decryption of the message. For example:

Sphinx substitution with a container

纵然是瞬间 提交于 2019-12-12 13:10:35
问题 How can I substitute a container directive ? The following doesn't work: .. |sub| container:: Some text here .. image:: img/some_image.png Some other text here The error message is WARNING: Substitution definition "sub" empty or invalid. 回答1: This is not possible. ReST substitutions apply to inline text (single paragraphs), but a container is a block element. And if you try .. |sub| replace:: container:: Some text here .. image:: img/some_image.png Some other text here you will get ERROR: