Aligning instrument name followed by vertical I and II - lilypond

I am trying to specify instrumentName like this:
instrumentName = \markup {
"Oboe"
\center-column {
\line { "I" }
\line { "II" }
}
}
Which looks like this:
But I want the word "Oboe" vertically centered. How do I do that?

Maybe not the perfect solution, but it works:
\markup {
\column {
\vspace #0.5
"Oboe"
}
\center-column {
\line { "I" }
\line { "II" }
}
}

As pointed out by #OleV.V. in the comments above, the best way of handling this is using the \vcenter command. See example below:
\new Staff \with {
instrumentName = \markup {
\vcenter
"Oboe"
\center-column {
\line { "I" }
\line { "II" }
}
}
}
{
c'4 d'4 e'4 f'4
}
Producing:

Related

Tidy up some SCSS

I have some code that controls a charity area on a site. The charity area has many different charity sectors and these all have their own colours. I have attached my SCSS below but wondered if there is a better way to write and apply this. So far I just need each charity colour to be applied as a 'background-color' but be able to have a tint of each. My code works fine but I'm sure there is a better way of writing this.
Thank you for any help in advanced.
/**************************************
Charity Colours
****************************************/
$color-animals: #a9efea;
$color-babies: #fae08c;
$color-cancer: #f4c9c8;
$color-community: #b3ddf2;
$color-deaf: #9FC279;
$color-mental: #CB89D5;
$color-elderly: #CCDCD4;
$color-rescue: #F4BD88;
$color-medical: #D0879C;
$color-hospice: #F0D3FA;
$color-human: #D3E0AD;
$color-military: #CBC3AD;
$color-overseas: #96C0E5;
$color-sports: #939393;
.animals-bg {
background:$color-animals;
}
.babies-bg {
background:$color-babies;
}
.cancer-bg {
background:$color-cancer;
}
.community-bg {
background:$color-community;
}
.deaf-bg {
background:$color-deaf;
}
.mental-bg {
background:$color-mental;
}
.elderly-bg {
background:$color-elderly;
}
.rescue-bg {
background: $color-rescue;
}
.medical-bg {
background:$color-medical;
}
.hospice-bg {
background:$color-hospice;
}
.human-bg {
background:$color-human;
}
.military-bg {
background:$color-military;
}
.overseas-bg {
background:$color-overseas;
}
.sports-bg {
background:$color-sports;
}
// Colour Tint for Lighter Background
$color-tint: 0.3;
.animals-bg--tint {
background: rgba($color-animals, $color-tint);
}
.babies-bg--tint {
background: rgba($color-babies, $color-tint);
}
.cancer-bg--tint {
background: rgba($color-cancer, $color-tint);
}
.community-bg--tint {
background: rgba($color-community, $color-tint);
}
.deaf-bg--tint {
background: rgba($color-deaf, $color-tint);
}
.mental-bg--tint {
background: rgba($color-mental, $color-tint);
}
.elderly-bg--tint {
background: rgba($color-elderly, $color-tint);
}
.rescue-bg--tint {
background: rgba($color-rescue, $color-tint);
}
.medical-bg--tint {
background: rgba($color-medical, $color-tint);
}
.hospice-bg--tint {
background: rgba($color-hospice, $color-tint);
}
.human-bg--tint {
background: rgba($color-human, $color-tint);
}
.military-bg--tint {
background: rgba($color-military, $color-tint);
}
.overseas-bg--tint {
background: rgba($color-overseas, $color-tint);
}
.sports-bg--tint {
background: rgba($color-sports, $color-tint);
}
Modified SCSS:
$charity-colors: (
animals: #a9efea,
babies: #fae08c,
cancer: #f4c9c8,
community: #b3ddf2,
deaf: #9FC279,
mental: #CB89D5,
elderly: #CCDCD4,
rescue: #F4BD88,
medical: #D0879C,
hospice: #F0D3FA,
human: #D3E0AD,
military: #CBC3AD,
overseas: #96C0E5,
sports: #939393
);
#each $sector, $color in $charity-colors {
.#{$sector}-bg {
background: $color;
}
.#{$sector}-bg--tint {
background: rgba($color, $color-tint);
}
}

How do I set properties according to custom HTML attributes in CSS?

I'm working on Fractions.
My checkpoint is :
frac {
display: inline-block;
position: relative;
vertical-align: middle;
letter-spacing: 0.001em;
text-align: center;
}
frac {
display: block;
padding: 0.01em;
}
frac {
border-top: thin solid black;
}
It is working but I want to two things :
I want to set default values, i.e. 0 to num and 1 to den.
I want to do use this type of code to make things simple : <frac num="0" den="1"> Note :It should not have a closing tag.The num and den attributes should have their default values if not mentioned.
Btw, I only know CSS.
There is no <frac> element in HTML.
To create your own <frac-el num="3" den="4"></frac-el>, you can create a small web component, which must adhere to custom element naming rules (name must contain a -). It also will need a closing tag.
That being said, here we go:
class FractionElement extends HTMLElement {
numerator = document.createElement('sup');
denominator = document.createElement('sub');
style = document.createElement('style');
constructor(n = 0, d = 1) {
super().attachShadow({mode:'open'});
this.num = n;
this.den = d;
this.style.textContent = `
:host { display: inline-flex; flex-direction: column; text-align: center; }
sup { border-bottom: 1px solid #666; }
`;
this.shadowRoot.append(this.numerator, this.denominator, this.style);
}
get num() { return this.numerator.textContent; }
set num(val) { this.numerator.textContent = val; }
get den() { return this.denominator.textContent; }
set den(val) { this.denominator.textContent = val; }
static get observedAttributes() {
return ['num', 'den'];
}
attributeChangedCallback(attr, oldVal, newVal) {
if (oldVal === newVal) return; // nothing to do, no change
switch (attr) {
case 'num': this.num = newVal ?? 0; break;
case 'den': this.den = newVal ?? 1; break;
}
}
}
customElements.define('frac-el', FractionElement);
<frac-el num="3" den="4"></frac-el>
<frac-el num="11" den="27691"></frac-el>
<frac-el></frac-el>
<frac-el num="3x + 7" den="y"></frac-el>

Pass Less variable in to attribute selector

I have a task to write 100 styles for every of 10 columns in Less.
Code looks like this at the moment:
.loopingCellWidth (#index) when (#index > 0){
&[data-1-column-width="#{index}"] {
.exercise-table-row {
.exercise-table-row-part {
&:nth-child(1) {
width: percentage(#index * 0.01) !important;
}
}
}
}
&[data-2-column-width="#{index}"] {
.exercise-table-row {
.exercise-table-row-part {
&:nth-child(2) {
width: percentage(#index * 0.01) !important;
}
}
}
}
// ..... up to 10
.loopingCellWidth(#index - 1);
}
.loopingCellWidth(100);
I would like to create a variable #numberOfColumn and place it in the attribute selector, like this:
&[data-#{#numberOfColumn}-column-width="#{index}"] {
But this solution doesn't work.
Any ideas how it should be done? Of course if it's even possible.

How do you close a frame when using Swingbuilder?

Using groovy's swingbuilder I'd like to add a save and exit button, but I can't figure out how to close a frame with the swingbuilder? Since I don't have the frame assigned to an object I can't really do frame.dispose() or anything like that.
swingBuilder.edt {
frame(title: 'Calc Spell Checker', size: [800, 600],
show: true, locationRelativeTo: null,
defaultCloseOperation: 1) {
borderLayout(vgap: 5)
panel(constraints: BorderLayout.CENTER,
border: compoundBorder([emptyBorder(10), titledBorder("Spell Checking pole ${projProp.location} in project ${projProp.projectName}")])) {
tableLayout {
tr {
td {
label 'Comments: '
}
td {
scrollPane(verticalScrollBarPolicy:JScrollPane.VERTICAL_SCROLLBAR_ALWAYS) {
list listData: projProp.comments, fixedCellWidth: 600, visibleRowCount: 6
}
}
}
tr {
td {
label 'Suggestions: '
}
}
tr {
td {
button text: 'Replace'
}
td {
button text: 'Ignore'
}
td {
button text: 'Close', actionPerformed: {
f.SetVisible(false)
}
}
}
}
}
}
}
So, to do this, turns out you just need to set the frame to a variable in the builder, then call dispose() on it like so:
guiFrame = frame(title: 'Spell Checker', size: [800, 600],
show: true, locationRelativeTo: null,
defaultCloseOperation: 1) {
int commentIndex = 0
int remedyIndex = 0
borderLayout(vgap: 5)
panel(constraints: BorderLayout.CENTER,
border: compoundBorder([emptyBorder(10), titledBorder("Spell Checking pole ${projProp.location} in project ${projProp.projectName}")])) {
tableLayout {
tr {
td {
button text: 'Replace'
}
td {
button text: 'Ignore'
}
td {
button text: 'Close', actionPerformed: {
guiFrame.dispose()
}
}
}
}
}

Elasticsearch "span and"

I have an elasticsearch query:
"query": {
"bool": {
"minimum_should_match": 1,
"should": {
"span_not": {
"exclude": {
"span_or": {
"clauses": [{
"span_near": {
...
},
"span_near": {
...
}
}]
}
}...
I need to have in include clause something like:
"span_or": {
clauses: [
{
"span_near": {...}
}
,
{
"span_and": {
"clases": [
{
"span_near": {...}
}
,
{
"span_near": {...}
}
,
...
]
}
}
]
}
I mean, that i have "or" query:
(span_near or span_near or span_near or ...)
And i want to get "and" query:
(span_near or (span_near and span_near) or ...)
How can i do it? There is no tag "span_and". What tag can i you instead?
Update 1
I have tried this:
"span_or": {
clauses: [
{
"span_multi": {
"match": {
"regexp": {
"message": "путин.*"
}
}
}
}
,
{
"span_multi": {
"match": {
"bool": {
"must": [
{
"term" : { "message" : "test" }
},
{
"term" : { "message" : "rrr" }
}
]
}
}
}
}
]
}
but i have a error:
spanMultiTerm [match] must be of type multi term query
Would normal bool queries solve your problem?
{
"query": {
"bool": {
"must_not": {
"bool": {
"should": [
{
"regexp":{
"message": "путин.*"
}
},
{
"bool": {
"must": [
{
"span_near": {...}
},
{
"span_near": {...}
}
]
}
}
]
}
}
}
}
}
I using the following idea found here:
In certain situations, it can be convenient to have a SpanAndQuery. You can easily simulate this using a SpanNearQuery with a distance of Integer.MAX_VALUE.
"span_or": {
clauses: [
{
"span_multi": {
"match": {
"regexp": {
"message": "путин.*"
}
}
}
}
,
{
"span_near": {
"clauses": [
{
"span_term" : { "message" : "test" }
},
{
"span_term" : { "message" : "rrr" }
}
],
"slop": 2147483647,
"in_order": false
}
}
]
}