Using JavaScript in Less - less

#root: "/images";
#app-root: `"#{root}".toUpperCase()`;
#form {
background: url("#{app-root}/back.jpg");
}
Running this in LESS2CSS I get error:
SyntaxError: JavaScript evaluation error: Unexpected string from
""/images"".toUpperCase() on line 2, column 12:
1 #root: "/images"; 2 #app-root: "#{root}".toUpperCase(); 3
Supposedly all I need to run JS in LESS is a set of backticks. So, why does this fail?

Remove the double quotes, and you are good to go:
#app-root: `#{root}.toUpperCase()`;
check here

Related

PostgresSQL incompatible query between version 10 and 14

I have the following statement, which runs fine on PostgresSQL version 10
LINE 1: UPDATE tablename SET "cliPrefix"=encode(digest(gen_random_uuid()::text, 'sha512'), 'hex');
^
But on PostgresSQL version 14 this line gave me the error:
No function matches the given name and argument types. You might need to add explicit type casts
How to fix this?
Check if exists the required extension (pgcrypto)
select * from pg_extension;
if not
create extension pgcrypto;

PostgreSQL commands don't work until I try and run them again in psql shell

When I try to run a command in the psql shell, it doesn't work and I have to enter it again. For example, if I run SELECT * FROM flights;, it won't run and says
ERROR: syntax error at or near "SELECT"
LINE 2: SELECT * FROM flights;
^
But, when I try it again, it works completely fine. Help!
I'm using the windows version.
(It only works some times)
psql doesn't run the query when you hit "enter", it runs the query when it sees a semicolon. You're getting this error because you forgot the semicolon in the previous query.
For example:
test=> select 1
test-> select 1;
ERROR: syntax error at or near "select"
LINE 2: select 1;
^
The query sent to the server is select 1 select 1, hence the syntax error on LINE 2.
The hint that you're in the middle of an unterminated command is the terminal prompt, which changes from test=> to test-> after the first line.

Ansible docker invalid character %

I am writing some ansible to automate my docker deployments.
I am trying to set an env variable to be % but I get this error:
ERROR! Syntax Error while loading YAML.
found character that cannot start any token
The error appears to have been in '/vagrant/roles/zoneminder_docker/tasks/main.yml': line 21, column 24, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
MYSQL_ROOT_PASSWORD: mysqlpsswd
MYSQL_ROOT_HOST: %
^ here
Is there any way to escape this character? As if I exclude this line, my deployment fails.
Is there any way to escape this character? As if I exclude this line, my deployment fails.
The thing you are looking for is to make that value a string literal:
MYSQL_ROOT_PASSWORD: mysqlpsswd
MYSQL_ROOT_HOST: '%'

EOF error using input Python 3

I keep getting an EOF error but unsure as to why. I have tried with and without int() but it makes no difference. I'm using Pycharm 3.4 and Python 3.
Thanks,
Chris
while True:
try:
number = int(input("what's your favourite number?"))
print (number)
break
You must close a try statement because you are declaring that there might be an error and you want to handle it
while True:
try:
number = int(input("what's your favourite number?"))
print(number)
break
except ValueError as e:
print("Woah, there is an error: {0}".format(e))

Pig Filter Syntax error, unexpected symbol

inputData = LOAD '$input' AS (line:chararray);
statusLineFilter = FILTER smallData BY (line MATHCES '^.* AppWrite-Dispatcher: Status code: [0-9]+$');
This code, when I run it, yields this error: ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: Syntax error, unexpected symbol at or near 'line'
The log file says the exact same thing. I'm at a loss, because the exact same syntax is working in other scripts I've written.
In order to avoid misspelling of key words I recommend you to use an IDE or a Text-Editor like emacs with the pig-mode.el which add syntax highlight ;)