substitution

VB.NET Is there a way to create a pre-processor constant that behaves as a simple text substitution?

与世无争的帅哥 提交于 2019-12-11 02:18:37
问题 VB.NET 2010, .NET 4 Hello, I would like to do (something like) the following: \#Const T = "Byte()" Public Class MyClass Inherits SomeGenericClass(Of T) .. other code .. End Class And have it act the same as if I'd typed Public Class MyClass Inherits SomeGenericClass(Of Byte()) .. other code .. End Class It's not so much that i have to do it this way, I'm just curious if such a thing is possible. Thanks in advance! Brian 回答1: No, this is not possible. The Visual Basic and C# designers decided

Replacing strings in lua containing special characters

烂漫一生 提交于 2019-12-11 00:54:49
问题 I want to replace string in lua. Here is the string. strng='\begin{matrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 10 \end{matrix}' I want to replace \begin{matrix} by {{ & by , \\ by },{ \end{matrix} by }} I also want to remove all spaces. So the output will be {{1,2,3},{4,5,6},{7,8,10}} I have written the following function to do this. function tempsubst(m1) m1 = matrixprint(m1) if type(m1) ~="string" then return m1 end m1 = string.gsub(m1,"\begin%{matrix%}","{{" ) m1 = string.gsub(m1,"\\","},{"

The dash ('-') in .htaccess

那年仲夏 提交于 2019-12-11 00:35:37
问题 Special string - (dash) in Substitution means no substitution and is useful when you need to apply the rule while leaving original URL untouched. So: RewriteRule ^(somefile|somedir|someotherfile) - [L] This tells mod_rewrite to leave the URL unchanged and quit processing rules if the requested subdirectory or file PREFIX is one of those in the alternate list. If the requested subdirectory is in the list, all the rules after this one get skipped. I don't understand why here we need the dash?

Escape all double quotes inside a single quoted string with Regex [duplicate]

不羁岁月 提交于 2019-12-10 09:46:20
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: Regular Expression to escape double quotes inside single quotes I need a regex (no other language!!, best would be perl syntax REGEX or PCRE syntax REGEX) to replace all double quotes " with a \" that are inside a single quoted string. This is an example string (part of a file): var baseUrl = $("#baseurl").html(); var head = '<div id="finishingDiv" style="background-image:url({baseUrl}css/userAd/images/out_main

using command substitution inside a sed script, with arguments

≯℡__Kan透↙ 提交于 2019-12-10 08:40:57
问题 I am trying to write a short script in which I use sed to search a stream, then perform a substitution on the stream based on the results of a shell function, which requires arguments from sed, e.g. #!/bin/sh function test { echo "running test" echo $1 } sed -n -e "s/.*\(00\).*/$(test)/p" < testfile.txt where testfile.txt contains: 1234 2345 3006 4567 (with newlines between each; they are getting removed by your sites formatting). So ok that script works for me (output "running test"), but

How can I make SQL Developer/SQL+ prompt only once for a substitution variable that occurs multiple times in a single statement?

霸气de小男生 提交于 2019-12-09 12:53:55
问题 I have a query roughly like this: select * from A_TABLE where A_COLUMN = '&aVariable' union select * from A_TABLE where B_COLUMN = '&aVariable'; But when I run it, SQL Developer prompts me for the variable twice, even though it's the same variable. If there's a way to make it prompt only once for a variable that is used twice, how do I do it? I do not want to use a script, it must be a single executable query. 回答1: As I was forming this post, I figured out how to do it: :a_var select * from A

Substituting everything from = to end of the line in VIM

谁都会走 提交于 2019-12-08 02:28:18
问题 Let's say I have several lines like: $repeat_on = $_REQUEST['repeat_on']; $opt_days = $_REQUEST['opt_day']; $opt_days = explode(",", $opt_days); ... and so on. Let's say I use visual mode to select all the lines: how can I replace everything from = to the end of the line so it looks like: $repeat_on = NULL; $opt_days = NULL; $opt_days = NULL; 回答1: With the block selected, use this substitute: s/=.*$/= NULL; The substitution regex changes each line by replacing anything between = and the end

Log4J – Runtime variable substitution

隐身守侯 提交于 2019-12-07 19:44:32
问题 Log4J appears to have an annoying restriction – at runtime, variable substitution does not appear to work. In this example File: Log4j.properties file_pattern=%d{ISO8601} %-5p %m%n log4j.rootLogger=DEBUG, FileAppender log4j.appender.FileAppender=org.apache.log4j.FileAppender log4j.appender.FileAppender.layout=org.apache.log4j.PatternLayout log4j.appender.FileAppender.layout.ConversionPattern=${file_pattern} log4j.appender.FileAppender.File=log4jtest1.log log4j.appender.FileAppender.Threshold

Monadic substitution under binders

怎甘沉沦 提交于 2019-12-07 16:32:47
问题 In the following Agda code, I have a term language based on de Bruijn indices. I can define substitution over terms in the usual de Bruijn indices way, using renaming to allow the substitution to proceed under a binder. module Temp where data Type : Set where unit : Type _⇾_ : Type → Type → Type -- A context is a snoc-list of types. data Cxt : Set where ε : Cxt _∷_ : Cxt → Type → Cxt -- Context membership. data _∈_ (τ : Type) : Cxt → Set where here : ∀ {Γ} → τ ∈ Γ ∷ τ there : ∀ {Γ τ′} → τ ∈ Γ

Adding a newline in a substitute() expression

家住魔仙堡 提交于 2019-12-07 13:51:49
问题 I'm trying to annotate a plot in ggplot with relevant data from a regression model. I've followed the suggestions in this SO post and tried to modify the function to have a couple additional items in a newline in the plot. This is my attempt at a new function: lm_eqn = function(m){ eq <- substitute(italic(y) == a %.% italic(x)^b*","~~italic(r)^2~"="~r2*","~~italic(n)~"="~nn*","~~italic(p-value)~"="~pv, list(a = format(exp(coef(m)[1]), digits = 3), b = format(coef(m)[2], digits = 3), r2 =