What is the syntax for adding multiple arguments onto the "Variables" parameter in sqlpackage.exe? - sql-server

I am using SqlPackage.exe for my deployment. I have read the documentation here for the usage of SqlPackage.exe.
The documentation only states the synax for one variable:
Specifies a name value pair for an action specific variable; {VariableName}={Value}. The DACPAC file contains the list of valid SQLCMD variables. An error will result if a value is not provided for every variable.
My problem is that the documentation does not say how to pass multiple arguments into the Variables parameter. For example, I want to do this:
sqlpackage.exe ...args go here... /Variables:VarToOverride=Value1,Var2ToOverride=Value2
Does anyone know the syntax for this?

I have managed to find something that works.
sqlpackage.exe ...args go here... /Variables:VarToOverride=Value1 /Variables:Var2ToOverride=Value2
It's not exactly what I was looking for, but it works.

Did you try separating using semi-colons rather than commas. i.e.:
sqlpackage.exe ...args go here... /Variables:VarToOverride=Value1;Var2ToOverride=Value2
Your other option is to use Publish Profile files.

You can specify the multiple arguments as below.
/p:CreateNewDatabase=True /p:Storage=File /p:DatabaseEdition=Standard /p:DatabaseServiceObjective=S3 /p:DatabaseMaximumSize=50
Giving space after each argument.

Related

Use Array of Values of Object in a Foreach Loop

I cannot seem to find anything about using the values of one property of an object in a foreach loop (without having the entire object placed into the loop).
I first create a function called UFGet-Servers that uses Get-ADComputer and returns the names of the servers in a specific OU in my environment and places them in an array. That's great, except that when I use the array in a foreach loop, each object that it grabs has #[Name=serverName] in it, which I cannot use in any useful manner. The following pseudo-code is an abbreviated example:
foreach($Computer in $ComputerNames){do code... code is adding the server name into a UNC path such as "\\$Computer\C$\"}
The problem with the above is that you can't add the whole object to a path -- it ends up looking like "\#[Name=serverNameHere]\C$\" which totally bombs out. How do I get rid of the "#[property=" part, and simply use the value as the $Computer in the loop?
What really weirds me out is that I can't find a straightforward article on this anywhere... would have thought everyone and their mom would have wanted to do something like this.
So, your issue isn't with ForEach loops, it is with string formatting. There are two ways that I know of to take care of what you need. First is going to be string formatting, which allows you to use {0}m {1} and so on to inject values into a string, providing that you follow the string with -f and a list of said values. Such as:
ForEach($Computer in $ComputerNames){
"The Server Path is \\{0}\Share$" -f $Computer.Name
}
The second way is a sub-expression (I'm sure somebody will correct me if I used the wrong term there). This one involves enclosing the variable and desired property (or a function, or whatever) inside $(). This will evaluate whatever is inside the parenthesis before evaluating the string. See my example:
ForEach($Computer in $ComputerNames){
"The Server Path is \\$($Computer.name)\Share$"
}

Add specified comment pattern in c

I'm wondoring if there exists a function of a software tool which allows me to add empty comment pattern to the variables defined in methods in c, for example /**...*/
I've tried using eclipse and vim. The best I can do is to add just comments for functions at the begining. I'd like to know if I could add such pattern wherever I want.
I know that use short cut key like Shift+Ctrl+/ can make a sentence as comment, but in the format of //. If there's a way for me to change this format to the one I want, that would be also a great help. Thanks!
In Notepad++ you can do that!
Check this link
In the web page search for Comment / uncomment section.
With The NERD Commenter, you can surround a selected text or variable with command delimiters via its <Leader>cc mapping:
[count]<Leader>cc NERDComComment
Comment out the current line or text selected in visual mode.
With
let NERDComInsertMap='<c-c>'
you can define an insert mode mapping that inserts the comment prefix and suffix at the current position, and puts the cursor in between. The comment syntax is filetype-specific and can be configured via the 'commentstring' option.
To change the comment prefix / suffix, you have to customize the plugin (in your ~/.vimrc), as described by :help NERDCustomDelimiters, e.g. for Java:
let g:NERDCustomDelimiters = {
\ 'java': { 'left': '/**', 'right': '*/' }
\ }
For unknown filetypes, you can also use 'commentstring', as this is what the plugin falls back to.

error in declaring higher-order functions in XPath 3.0: must declare return type?

Following #DimitreNovatchev's article Programming in XPath 3.0, and using BaseX GUI as the test environment, I tried some of the examples that define functions that accept functions as parameters. E.g. with
let $compose :=
function($f as function(), $g as function())
(The rest of the code isn't relevant to this error, but you can see it as the third example under Function Composition.)
I get this error from BaseX:
Error:
Stopped at 43-compose.xpath, 2/39:
[XPST0003] Expecting 'as', found ','.
The point where the error was detected was on the second line, just before the comma. Apparently, the processor expects the $f parameter declaration to say not just that $f should be a function, but also the return value of the function.
I don't know whether it's right for BaseX to expect that or not. Presumably, Dimitre's examples tested successfully before he made that presentation at Balisage. Maybe something changed in the XPath 3.0 spec between that article and when BaseX was released?
OK, found the answer. I got an evaluation key for Saxon EE, so I was able to try another processor. For future reference, this was the command line:
C:\Program Files\Saxon>java -cp saxon9ee.jar net.sf.saxon.Query -s:"input.xml" -
q:"ex5.xpath" -qversion:3.0
Note that -qversion:3.0 is currently required in order to get any 3.0 functionality.
Saxon throws an error at the same point, but gives a helpful suggestion on how to fix it:
Error on line 2 column 39 of ex5.xpath:
XPST0003 XQuery syntax error near #... function($f as function(), $#:
function() is no longer allowed for a general function type: must be function(*)
I changed function() to function(*) wherever a general function type was wanted, and the errors went away, both in BaseX and in Saxon.
So apparently BaseX was correct (but Saxon's error message was more helpful, as is often the case!). Sounds like something did change in the spec recently. I haven't been able to figure out what the relevant change was, from the change log. But regardless of what changed, the spec currently says that a FunctionTest must have either a * within the parentheses, or an as after them. (This applies to declarations of parameters that are functions, but does not apply to inline functions themselves.)

VIM syntax: conditional function coloring

I'm customizing the standard "c.vim" syntax file in order to tune the visualisation of my C code.
I would like to distinguish the color of the "called functions" from the one of the "declared functions".
Exemple:
int declared_function()
{
int m;
m = called_function();
return (m)
}
I read in depth the VIM documentation, and millions of forums and google results, but all the solutions I tried didn't work.
To resume, I did this:
I defined a region in a recursive way in order to consider all the code within the braces:
syn region Body start="{" end="}" contains=Body
Then I defined through VIM patterns a general function syntax:
syn match cFunction "\<\h\w*\>\(\s\|\n\)*("me=e-1 contains=cType,cDelimiter,cDefine
I did this because I thought I could combine the two in a "if else" condition in the .vimrc file... but after a whole day of failing tests I need the help of someone, who can tell me if it's possible and how to do it.
Thanks everybody.
You're very close. First, you don't need the recursive definition, but contain all other top-level C syntax elements in it, plus the special group you'll define for called functions:
:syn region Body start="{" end="}" contains=TOP,cFunctionUse
Actually, scratch that, the default $VIMRUNTIME/syntax/c.vim already defines a cBlock syntax group.
Then, define a different syntax group that is contained in the cBlock group.
:syn match cFunctionUse "\<\h\w*\>\(\s\|\n\)*("me=e-1 contained containedin=cBlock contains=cType,cDelimiter,cDefine
Finally, link or define a different highlight group for it, so that it actually looks different:
:hi link cFunctionUse Special
You can put those into ~/.vim/after/syntax/c.vim, so that they'll be added automatically to the default C syntax.

Fitnesse Slim: How to concatenate symbol

How would one concatenate a symbol with text on either side?
For example:
Prefix: "GAR_"
Variable: $todayDate
Suffix: "_1"
GAR_$todayDate_1
Which would evaluate to:
GAR_07202012_1
When running the test in fitnesse, it seems as though the concatenation is working (GAR_$todayDate->[07202012]_1). However, I am passing this value as a parameter to visual studio and I instead end up with the following text: GAR_$todayDate_1.
When I remove the suffix or put a space between $todayDate and "_1", everything works as expected.
Any help would be appreciated.
Things I have tried:
GAR_!-$todayDate-!_1
GAR_$todayDate!-_1-!
GAR_$todayDate${SUFFIX} - static variable defined
Thanks,
Mike
I am stuck with the same problem currently.
The only way I found was to:
create a StringSupport class with a String concatenate(String s1, String s2) method
import the package of that class in your FitNesse test
put StringSupport in the available libraries in your FitNesse test with the Library table
in your Script, you can now do: |$result=|concatenate;|$s1|$s2|
To fit your exact use case, you just have to do the same concatenate() with 3 strings instead of just one.

Resources