Material UI "&.Mui-selected" and "& .Mui-selected" - material-ui

What is the difference between "&.Mui-selected" and "& .Mui-selected" in material ui ? In case of "& .Mui-selected", There is a space between '&' and '.'.What is the significance of this space between '&' and '.' ?

Related

Running a PowerShell script file with path containing spaces from Jenkins Pipeline without using backtick

I want to run the following PowerShell script file from Jenkins Pipeline:
".\Folder With Spaces\script.ps1"
I have been able to do it with the following step definition:
powershell(script: '.\\Folder` With` Spaces\\script.ps1')
So I have to remember to:
escape the backslash with a double backslash (Groovy syntax)
escape the space with backtick (PowerShell syntax)
I would prefer to avoid at least some of this. Is it possible to avoid using the backtick escaping, for example? (Putting it between "" does not seem to work, for some reason.)
I found that it's possible to use the ampersand, or invoke, operator, like this:
powershell(script: "& '.\\Folder With Spaces\\script.ps1'")
That gets rid of the backtick escaping, and should make life a tiny bit easier.
To avoid escaping the backslashes you could use slashy strings or dollar slashy strings as follows. However you cannot use a backslash as the very last character in slashy strings as it would escape the /. Of course slashes as well would have to be escaped when using slashy strings.
String slashy = /String with \ /
echo slashy
assert slashy == 'String with \\ '
// won't work
// String slashy = /String with \/
String dollarSlashy = $/String with / and \/$
echo dollarSlashy
assert dollarSlashy == 'String with / and \\'
And of course you'll lose the possibility to include newlines \n and other special characters in the string using the \. However as both slashy and dollar slashy strings have multi line support at least newlines can be included like:
String slashyWithNewline = /String with \/ and \
with newline/
echo slashyWithNewline
assert slashyWithNewline == 'String with / and \\ \nwith newline'
String dollarSlashyWithNewline = $/String with / and \
with newline/$
echo dollarSlashyWithNewline
assert dollarSlashyWithNewline == 'String with / and \\ \nwith newline'
If you combine that with your very own answer you won't need both of the escaping.

VBScript Compilation Error, unable to resolve

So I'm trying to run a CMD prompt as a VBScript because I can't just drop this CMD Line.
Set cmdl = WScript.CreateObject("WScript.Shell")
cmdl.Run "cmd.exe ""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe""--app="https://app.powerbi.com/"""--kiosk""--fullscreen""--user-data-dir=c:/monitor1""
My dilemma is that every time I try and run this I get the following error:
Script: Script.vbs
Line: 2
Char: 90
Error: Expected end of statement
Code: 800A0401
Source: Microsoft VBScript compilation error
I've tried putting in quotes, taking out quotes, moving spaces, etc. and this dang thing is driving me crazy. Does anyone see where my mistake may lie?
Your command string is broken. In VBScript a string is defined by putting a character sequence between double quotes:
s = "some string"
If you want to use double quotes within a string you need to escape them by doubling them:
s = "some ""quoted"" string"
Also, you don't need cmd.exe for starting an executable via Run, but you do need whitespace between the parameters to the executable.
Change this:
cmdl.Run "cmd.exe ""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe""--app="https://app.powerbi.com/"""--kiosk""--fullscreen""--user-data-dir=c:/monitor1""
into this:
cmdl.Run """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"" --app=https://app.powerbi.com/ --kiosk --fullscreen --user-data-dir=c:/monitor1"
The rule is: Use "" to insert " in VBScript literals.
The first violation in your
"cmd.exe ""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe""--app="https://app.powerbi.com/"""--kiosk""--fullscreen""--user-data-dir=c:/monitor1""
is
--app="https
This
"cmd.exe ""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"" --app=""https://app.powerbi.com/"" --kiosk --fullscreen --user-data-dir=""c:/monitor1"""
may be what you want.
A better (scaling) approach is to use a quote function and an array for the parts/arguments:
Function qq(s)
qq = """" & s & """"
End Function
s = Join(Array( _
"cmd.exe" _
, qq("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") _
, "--app=" & qq("https://app.powerbi.com/") _
, "--kiosk" _
, "--fullscreen" _
, "--user-data-dir=" & qq("c:/monitor1") _
), " ")
WScript.Echo s
output:
cscript a.vbs
cmd.exe "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app="https://app.powerbi.com/" --kiosk
--fullscreen --user-data-dir="c:/monitor1"
This solution is based from #Ekkehard.Horner
So, i liked his method when using the join function with the array.
And, i tried it on my windows 7 (32 bits) and it works like a charme ;)
Function qq(s)
qq = chr(34) & s & chr(34)
End Function
s = Join(Array( _
"cmd /c start chrome" _
, "--app=" & qq("https://app.powerbi.com/") _
, "--kiosk" _
, "--fullscreen" _
, "--user-data-dir=" & qq("c:/monitor1") _
), " ")
WScript.Echo s
set ws = CreateObject("wscript.shell")
ws.run s,0,false

Break a replace string in powershell

I am using powershell to automaticly add lines of code to certain scripts. See example below:
$a -replace '<div class="ef-column1 bodyContent" id="column1">', '<div class="ef-column1 body-content" id="column1"> #RenderSection("ColumnMainHeader", false)'
The #RenderSection part should be on a new line. So i tried to add 'n in front of #RenderSection but this will create 'n#RenderSection instead of putting #RenderSection on a new line.
I also tried 'r'n#RenderSection, but this has the same effect. putting 'n between " " will work neither.
The issue is with the single quote at the front making the grave a literal one rather than escaping the 'n.
Try using double quotes and then escaping all of the double quotes in the expression:
$a -replace '<div class="ef-column1 bodyContent" id="column1">', "<div class=`"ef-column1 body-content`" id=`"column1`"> `n#RenderSection(`"ColumnMainHeader`", false)"

Format a command in powershell including a comma, can't find the right way to escape

I have a command that I need to run in a Powershell script, the command is :
".\pacli DELETEUSER DESTUSER='"dilip.v#astramwp`,com"' sessionid=333" | invoke-expression
The comma (,) in here :dilip.v#astramwp,com is not a mistake, and that's what is giving me the hard time.
I tried to escape the comma with ` (backtick) - but its not working.
How do I escape this ?
I get the error message :
parse error, expecting `';''
and in some variations :
Unexpected token 'dilip.v#astramwp`,com"`' sessionid=333"' in expression or statement.
At C:\CyberArk\Harel CyberArk WebService\deleteUser.ps1:6 char:70
+ ".\pacli DELETEUSER DESTUSER='"dilip.v#astramwp`,com"' sessionid=333" <<<< | invoke-expression
+ CategoryInfo : ParserError: (dilip.v#astramwp`,com"`' sessionid=333":String) [], ParseException
+ FullyQualifiedErrorId : UnexpectedToken
The command works when I use cmd.exe and just wrap it with "".
".\pacli DELETEUSER DESTUSER='"dilip.v#astramwp`,com"' sessionid=333"
You have double quotes in single quotes in double quotes, so the inner double quotes will terminate the string, so this will be parsed as three values:
".\pacli DELETEUSER DESTUSER='"
dilip.v#astramwp`,com
"' sessionid=333"
The answer is to escape, with a back tick (`), the inner double quotes:
".\pacli DELETEUSER DESTUSER='`"dilip.v#astramwp`,com`"' sessionid=333"
and thus those double quotes will be passed through to the command.
(As noted in the comments to the question, you'll also need to prefix the string with & to get PSH to treat it as a command.)

Adding prefix and suffix to every line in multiple files - using command line?

So I've been doing this with Notepad++ but it takes forever. I have a couple thousand files in a folder and need to add some text before and after every line in every file.
Is this even possible in command line?
For example this is a line:
This is my line.
And I want it to turn out like:
<text before>This is my line.<text after>
Any help would be appreciated!
Untested but should do the trick:
perl -pi -e 's/(.*)/<text before>$1<text after>/' *
The following pure native batch script will work, though it is relatively slow.
#echo off
setlocal disableDelayedExpansion
set "prefix=<text before>"
set "suffix=<text after>"
pushd "yourFolder"
for %%F in (*) do (
>"%%F.new" (
for /f "delims=" %%A in ('findstr /n "^" "%%F"') do (
set "ln=%%A"
setlocal enableDelayedExpansion
echo !prefix!!ln:*:=!!suffix!
endlocal
)
)
move /y "%%F.new" "%%F" >nul
)
I have written a hybrid JScript/Batch script that can be used to very efficiently process text files. Using my REPL.BAT utility, the script could be as simple as:
#echo off
pushd "yourFolder"
for %%F in (*) do (
type "%%F" | repl "^(.*)" "<text before>$1<text after>" >"%%F.new"
move /y "%%F.new" "%%F" >nul
)
popd
The REPL.BAT script should be somewhere in your PATH.
Here is the REPL.BAT script. It is compatible with all modern Windows versions from XP onward. The utility is surprisingly powerful and easy to use, considering how little code there is. Nearly half the script consists of embedded documentation. The documentation can be viewed by typing REPL /? from the command prompt.
#if (#X)==(#Y) #end /* Harmless hybrid line that begins a JScript comment
::************ Documentation ***********
:::
:::REPL Search Replace [Options [SourceVar]]
:::REPL /?
:::
::: Performs a global search and replace operation on each line of input from
::: stdin and prints the result to stdout.
:::
::: Each parameter may be optionally enclosed by double quotes. The double
::: quotes are not considered part of the argument. The quotes are required
::: if the parameter contains a batch token delimiter like space, tab, comma,
::: semicolon. The quotes should also be used if the argument contains a
::: batch special character like &, |, etc. so that the special character
::: does not need to be escaped with ^.
:::
::: If called with a single argument of /? then prints help documentation
::: to stdout.
:::
::: Search - By default this is a case sensitive JScript (ECMA) regular
::: expression expressed as a string.
:::
::: JScript syntax documentation is available at
::: http://msdn.microsoft.com/en-us/library/ae5bf541(v=vs.80).aspx
:::
::: Replace - By default this is the string to be used as a replacement for
::: each found search expression. Full support is provided for
::: substituion patterns available to the JScript replace method.
::: A $ literal can be escaped as $$. An empty replacement string
::: must be represented as "".
:::
::: Replace substitution pattern syntax is documented at
::: http://msdn.microsoft.com/en-US/library/efy6s3e6(v=vs.80).aspx
:::
::: Options - An optional string of characters used to alter the behavior
::: of REPL. The option characters are case insensitive, and may
::: appear in any order.
:::
::: I - Makes the search case-insensitive.
:::
::: L - The Search is treated as a string literal instead of a
::: regular expression. Also, all $ found in Replace are
::: treated as $ literals.
:::
::: E - Search and Replace represent the name of environment
::: variables that contain the respective values. An undefined
::: variable is treated as an empty string.
:::
::: M - Multi-line mode. The entire contents of stdin is read and
::: processed in one pass instead of line by line. ^ anchors
::: the beginning of a line and $ anchors the end of a line.
:::
::: X - Enables extended substitution pattern syntax with support
::: for the following escape sequences:
:::
::: \\ - Backslash
::: \b - Backspace
::: \f - Formfeed
::: \n - Newline
::: \r - Carriage Return
::: \t - Horizontal Tab
::: \v - Vertical Tab
::: \xnn - Ascii (Latin 1) character expressed as 2 hex digits
::: \unnnn - Unicode character expressed as 4 hex digits
:::
::: Escape sequences are supported even when the L option is used.
:::
::: S - The source is read from an environment variable instead of
::: from stdin. The name of the source environment variable is
::: specified in the next argument after the option string.
:::
::************ Batch portion ***********
#echo off
if .%2 equ . (
if "%~1" equ "/?" (
findstr "^:::" "%~f0" | cscript //E:JScript //nologo "%~f0" "^:::" ""
exit /b 0
) else (
call :err "Insufficient arguments"
exit /b 1
)
)
echo(%~3|findstr /i "[^SMILEX]" >nul && (
call :err "Invalid option(s)"
exit /b 1
)
cscript //E:JScript //nologo "%~f0" %*
exit /b 0
:err
>&2 echo ERROR: %~1. Use REPL /? to get help.
exit /b
************* JScript portion **********/
var env=WScript.CreateObject("WScript.Shell").Environment("Process");
var args=WScript.Arguments;
var search=args.Item(0);
var replace=args.Item(1);
var options="g";
if (args.length>2) {
options+=args.Item(2).toLowerCase();
}
var multi=(options.indexOf("m")>=0);
var srcVar=(options.indexOf("s")>=0);
if (srcVar) {
options=options.replace(/s/g,"");
}
if (options.indexOf("e")>=0) {
options=options.replace(/e/g,"");
search=env(search);
replace=env(replace);
}
if (options.indexOf("l")>=0) {
options=options.replace(/l/g,"");
search=search.replace(/([.^$*+?()[{\\|])/g,"\\$1");
replace=replace.replace(/\$/g,"$$$$");
}
if (options.indexOf("x")>=0) {
options=options.replace(/x/g,"");
replace=replace.replace(/\\\\/g,"\\B");
replace=replace.replace(/\\b/g,"\b");
replace=replace.replace(/\\f/g,"\f");
replace=replace.replace(/\\n/g,"\n");
replace=replace.replace(/\\r/g,"\r");
replace=replace.replace(/\\t/g,"\t");
replace=replace.replace(/\\v/g,"\v");
replace=replace.replace(/\\x[0-9a-fA-F]{2}|\\u[0-9a-fA-F]{4}/g,
function($0,$1,$2){
return String.fromCharCode(parseInt("0x"+$0.substring(2)));
}
);
replace=replace.replace(/\\B/g,"\\");
}
var search=new RegExp(search,options);
if (srcVar) {
WScript.Stdout.Write(env(args.Item(3)).replace(search,replace));
} else {
while (!WScript.StdIn.AtEndOfStream) {
if (multi) {
WScript.Stdout.Write(WScript.StdIn.ReadAll().replace(search,replace));
} else {
WScript.Stdout.WriteLine(WScript.StdIn.ReadLine().replace(search,replace));
}
}
}