Uno=1
Dos=2
# aquí la salida es S
if (( Uno < Dos )); then echo S; else echo N; fi
# aquí la salida es N
if [[ Uno < Dos ]]; then echo S; else echo N; fi
I need to sort this data to display it in a DataGridView
C#.
In SQL Server
I have the following table:
Día Descripción
----------------
1 Domingo
2 Lunes
3 Martes
4 Miércoles
5 Jueves
6 Viernes
7 Sábado
But in the query I can't sort the day with asc
or desc
, because it won't be sorted correctly:
select * from dias_semana order by dia asc
select * from dias_semana order by dia desc
How can I modify the query to display it sorted like this?
Día Descripción
----------------
2 Lunes
3 Martes
4 Miércoles
5 Jueves
6 Viernes
7 Sábado
1 Domingo
Note: The table contains much more data, but the field dia
is the only one for which I can set an order in the statement select
.
Recently, I've been looking at various C++ code examples where you have something like the following:
//líneas de código
for (i = 0; i < n; i++)
{
if((alguna_condición))
{
//más código
break;
}
}
//siguen más líneas de código
In my C++ classes I have only used the statement break
with the conditional structure switch
and so I was a bit surprised by the use of break
with the repetitive structure for
. Searching in Google I found the following links , however the only thing that I have achieved is to confuse me. From what I've read, for some break
there's nothing wrong with using, but for others it's just as bad as using the infamous goto
.
Basically my question, as the title suggests, is it okay to use break
in repetitive control structures, and if not, is it as "harmful" as using goto
?.
Thanks in advance for comments and/or responses.
I found a design of some stars here . How to create three stars plus one middle star without :hover?
I'm using the same design, only the smaller stars, when changing the image to smaller ones, the design has been messed up despite having changed the values, I can't get it to be ordered correctly.
What value should I change so that it adapts in the same way as that design, only that the stars are smaller.
.c-rating {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
list-style: none;
margin: 0;
padding: 0;
}
.c-rating__item {
-webkit-box-flex: 0;
-webkit-flex: 0 0 12px;
-ms-flex: 0 0 12px;
flex: 0 0 12px;
height: 18px;
background-position: -10px 0px;
background-image: url(http://svgshare.com/i/4U0.svg);
cursor: pointer;
}
.c-rating__item.left {
background-position: 0px 0px;
}
.c-rating__item.is-active,
.c-rating__item:before {
background-position: -33px 0;
}
.c-rating__item.left.is-active,
.c-rating__item.left:before {
background-position: -21px 0;
}
<ul class="c-rating">
<li class="c-rating__item is-active left" data-index="0"></li>
<li class="c-rating__item is-active" data-index="1"></li>
<li class="c-rating__item is-active left" data-index="2"></li>
<li class="c-rating__item is-active" data-index="3"></li>
<li class="c-rating__item is-active left" data-index="4"></li>
<li class="c-rating__item is-active" data-index="5"></li>
<li class="c-rating__item is-active left" data-index="6"></li>
<li class="c-rating__item" data-index="7"></li>
<li class="c-rating__item left" data-index="8"></li>
<li class="c-rating__item" data-index="9"></li>
</ul>
In this case, what is the difference of using | or use double || ?
if (char.IsNumber(e.KeyChar) | e.KeyChar == (char)8 | e.KeyChar == (char)Keys.Escape)
{
e.Handled = false;
return;
}
else
{
e.Handled = true;
return;
}