I have this list of color variables:
//** Smoke
$smoke-hex-l-10: #504c51;
$smoke-hex-l-20: #575358;
$smoke-hex-l-25: #5b575c;
$smoke-hex-l-30: #5e5a60;
$smoke-hex-l-40: #656167;
$smoke-hex-l-50: #6d686e;
$smoke-hex-l-60: #746f76;
$smoke-hex-l-70: #7b767d;
$smoke-hex-l-75: #7f7981;
$smoke-hex-l-80: #827d84;
$smoke-hex-l-90: #89848b;
$smoke-hex-l-100: #908b92;
$smoke-hex-d-10: #423f43;
$smoke-hex-d-20: #3c3a3d;
$smoke-hex-d-25: #3a373b;
$smoke-hex-d-30: #383539;
$smoke-hex-d-40: #343135;
$smoke-hex-d-50: #302e31;
$smoke-hex-d-60: #2d2b2e;
$smoke-hex-d-70: #2b292b;
$smoke-hex-d-75: #29282a;
$smoke-hex-d-80: #282629;
$smoke-hex-d-90: #262427;
$smoke-hex-d-100: #242325
Is there a way to optimize this list in some way? I'm not very good a Sass, but I've read about Sass Maps, but I can't wrap my head around the concept.
Or if a list like that it's just the way to do it?
Thanks for your help.
Of course you can use sass maps to store these variables, it may look like this:
//** Smoke
$smoke-hex-l: (
10: #504c51,
20: #575358,
25: #5b575c,
30: #5e5a60,
40: #656167,
50: #6d686e,
60: #746f76,
70: #7b767d,
75: #7f7981,
80: #827d84,
90: #89848b,
100: #908b92,
);
$smoke-hex-d: (
10: #423f43,
20: #3c3a3d,
25: #3a373b,
30: #383539,
40: #343135,
50: #302e31,
60: #2d2b2e,
70: #2b292b,
75: #29282a,
80: #282629,
90: #262427,
100: #24232,
);
and can be accessed like: $smoke-color: map-get($smoke-hex-l, 10);
However it looks like these colors are just lighten / darken versions of common base color, something like #49464a. In this case you can simplify your code by using color manipulation functions that are available in Sass. In particular lighten() and darken() will be enough to replace whole set of colors that you have.
Related
I'have implemented a keras lstm network in R and I can train it and use correctly the fit function. But when I use "predict" function, I meet following errors:
pred <- base_model %>% predict(matchsetarray)
WARNING:tensorflow:Model was constructed with shape (96, 2, 26) for input KerasTensor(type_spec=TensorSpec(shape=(96, 2, 26), dtype=tf.float32, name='lstm_3_input'), name='lstm_3_input', description="created by layer 'lstm_3_input'"), but it was called on an input with incompatible shape (32, 2, 26).
Error in py_call_impl(callable, dots$args, dots$keywords) :
ValueError: in user code:
File "C:\Users\Utente\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\keras\engine\training.py", line 1801, in predict_function *
return step_function(self, iterator)
File "C:\Users\Utente\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\keras\engine\training.py", line 1790, in step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "C:\Users\Utente\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\keras\engine\training.py", line 1783, in run_step **
outputs = model.predict_step(data)
File "C:\Users\Utente\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\keras\engine\training.py", line 1751, in predict_step
return self(x, training=False)
File "C:\Users\Utente\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\
However the dimension of predict input is (96,2,26), but "predict" consider the input "matchsetarray" of dimension (32, 2, 26). Could I force predict to read teh correct format?
I tryed to verify the dimension of input "matchsetarray":
dim(matchsetarray)
[1] 96 2 26
It's the correct dimension expected by "predict" function.
Writing a simple octave code to find factorial and check Sterling's approximation,
$ vi test.oct
function y=f(x)
y = 1;
for i=1:x
y = y*i;
endfor
endfunction
for i=1:170
x(i)=log(f(i));
y(i)=i*log(i)-i;
z(i)=100.*(x(i)-y(i))/(x(i));
endfor
plot(z)
$ source test.oct
I get the error
syntax error near unexpected token `y'
bash: test.oct: line 4: `y = y*i;'
How do I resolve the syntax error in defining variable y
I have this code:
function var_leafdrop(var_inc, var_restpos)
If var_y >= var_restpos then
var_y = var_restpos
else
var_y = var_y + var_inc
end
return var_y
end
I get error:
error 18: '=' expected near 'var_y'
18 being the line:
If var_y >= var_restpos then
I've tried:
Changing the variable name
Changing its declaration
Removing the if then block
Moving the entire function to the beginning of the script file
This is using the built in script editor for Watchmaker.
I can't see any error!? I just don't get it. Is this some dumb idiosyncrasy with Watchmaker...?
As mentioned in the comments, Lua is case sensitive.
So use if instead of If.
Is there a key-combination to print out the current line number?
This would be really useful in conjunction with the multiple selection method (cmd+D).
I don't think there is a key binding or command do what you want, but I'm I'm unsure what it is that you mean by printing current line numbers in Sublime.
This is probably not at all what you want, but I'll leave it here for a while before I delete it. It might help you write a custom command for what you want.
Command
import sublime_plugin
class InsertLineNumberCommand(sublime_plugin.TextCommand):
def run(self, edit):
for sel in self.view.sel():
line_begin = self.view.rowcol(sel.begin())[0]
line_end = self.view.rowcol(sel.end())[0]
self.view.insert(edit, sel.end(), str(line_begin + 1))
Key Binding:
{
"keys": ["ctrl+i"],
"command": "insert_line_number"
}
Usage
1:
2: fizz|buzz
3:
Where | is the cursor, pressing ctrl+i:
1:
2: fizz2|buzz
3:
With a multiple selection:
1:
2: |fizz|2
3: buzz
4:
5: |fizz|5
6: buzz
7:
I try to implement inheritance with Oracle Objects :
CREATE OR REPLACE TYPE ENREG_320_BASE AS OBJECT ( .....) NOT FINAL
CREATE OR REPLACE TYPE ENREG_320_03 AS OBJECT UNDER ENREG_320_BASE( .....) FINAL
I have an error :
Error: ORA-06550: line 1, column 29: PLS-00103: Encountered the symbol
"UNDER" when expecting one of the following:
( not external JAVA_ BOUND_ The symbol "(" was substituted for
"UNDER" to continue. ORA-06550: line 2, column 17: PLS-00103:
Encountered the symbol "VARCHAR2" when expecting one of the following:
. ( ) , * # % & | = - + < / > at in is mod remainder not range
rem => .. <> or != or ~= >= <= <> and or like
LIKE2_ LIKE4_ LIKE ORA-06550: line 3, column 27: PLS-00103:
Encountered the symbol "VARCHAR2" when expecting one of the following:
Probably there is something I do wrong (first time trying inheritance in PLSQL). Can you help ?
PS : I work with Oracle 10
Thank you
We don't need AS OBJECT when creating sub-types. It's implied by the UNDER keyword.
You should bookmark the documentation in your browser. It's great for answrering questions like this. Find it here.