问:
Right align button in form
I'm having some trouble using float: right; on a button.

Whatever I do, the button just doesn't wanna go to the right.
It's the second button, the one with the "advanced-search-button" class.

I'm using Bootstrap 4.

HTML

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/>

Opgaver

        <form action="" class="form-inline">

                <input type="text" class="form-control" placeholder="Rekvirent">

                <input type="text" class="form-control" placeholder="Tildelt til">

                <select name="select_Afsluttet" id="select_Afsluttet" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                    <option selected hidden value="">Afsluttet</option>
                    <option value="">Ja</option>
                    <option value="">Nej</option>
                    <option value="">Alle</option>
                </select>

                <select name="select_Godkendt" id="select_Godkendt" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                    <option selected hidden value="">Godkendt</option>
                    <option value="">Ja</option>
                    <option value="">Nej</option>
                    <option value="">Alle</option>
                </select>

                <button type="button" class="btn btn-success btn-sm" style="margin-right: 15px;">Søg</button>
                <button type="button" class="btn btn-primary btn-sm advanced-search-button" onclick="advancedSearch(this)">Avanceret søgning</button>

        </form>
        <form action="" class="form-inline form-custom advanced-search">

                <select name="select_Prioritet" id="select_Prioritet" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                    <option selected hidden value="">Prioritet</option>
                    <option value="">Lav</option>
                    <option value="">Middel</option>
                    <option value="">Høj</option>
                    <option value="">Straks</option>
                    <option value="">Driftfejl</option>
                </select>

                <select name="select_Opgavestatus" id="select_Opgavestatus" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                    <option selected hidden value="">Opgavestatus</option>
                    <option value="">Arkiveret</option>
                    <option value="">Sendt til DUC</option>
                    <option value="">Venter på bruger</option>
                    <option value="">Venter på kunde</option>
                    <option value="">Venter på AO</option>
                </select>

                <select name="select_Opgavetype" id="select_Opgavetype" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                    <option selected hidden value="">Opgavetype</option>
                    <option value="">Andet</option>
                    <option value="">Sendt til DUC</option>
                    <option value="">Venter på bruger</option>
                    <option value="">Venter på kunde</option>
                    <option value="">Venter på AO</option>
                </select>

                <select name="select_Underkategori" id="select_Underkategori" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                    <option selected hidden value="">Underkategori</option>
                    <option value="">Via telefon</option>
                    <option value="">Via email</option>
                    <option value="">Internet</option>
                    <option value="">Intranet</option>
                    <option value="">VMS</option>
                </select>

                <input type="text" class="form-control" placeholder="Søg efter">

        </form>

                    Dato
                    ID
                    Rekv
                    Tildelt
                    Beskrivelse
                    Type
                    Seneste log besked
                    Deadline

                    22-11-2017
                    70935
                    HJR
                    LUC
                    Docking Station...
                    Bestilling - Via Telefon
                    8 dage
                    22-11-2017

                    28-11-2017
                    71049
                    LLJ
                    LUC
                    Kan ikke scanne fra sin printe....
                    IT-Drift - Via Telefon
                    3 dage
                    28-11-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

```

I hope you can help me :)

I don't have any custom CSS for this part, I only use the classes for JS.

答:
You can do something like this with the Flexbox:

.flex-container {display:flex} /* displays children inline by default */

.flex-item {
 display: flex;
 justify-content: space-between; /* horizontal alignment / creates the max. horizontal space between the buttons */
 flex: 1 !important; /* takes all the remaining horizontal space / needs to have the !important keyword otherwise it doesn't work */
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>

<div class="box">
            <div class="box-title w-100">
                <h5>Opgaver</h5>
            </div>
            <div class="box-form w-100">
                <form action="" class="form-inline flex-container">
                    <div class="form-group form-group-custom">
                        <input type="text" class="form-control" placeholder="Rekvirent">
                    </div>
                    <div class="form-group form-group-custom">
                        <input type="text" class="form-control" placeholder="Tildelt til">
                    </div>
                    <div class="form-group form-group-custom">
                        <select name="select_Afsluttet" id="select_Afsluttet" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                            <option selected hidden value="">Afsluttet</option>
                            <option value="">Ja</option>
                            <option value="">Nej</option>
                            <option value="">Alle</option>
                        </select>
                    </div>
                    <div class="form-group form-group-custom">
                        <select name="select_Godkendt" id="select_Godkendt" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                            <option selected hidden value="">Godkendt</option>
                            <option value="">Ja</option>
                            <option value="">Nej</option>
                            <option value="">Alle</option>
                        </select>
                    </div>
                    <div class="form-group form-group-custom flex-item">
                        <button type="button" class="btn btn-success btn-sm" style="margin-right: 15px;">Søg</button>
                        <button type="button" class="btn btn-primary btn-sm advanced-search-button" onclick="advancedSearch(this)">Avanceret søgning</button>
                    </div>
                </form>

                <form action="" class="form-inline form-custom advanced-search">
                    <div class="form-group form-group-custom">
                        <select name="select_Prioritet" id="select_Prioritet" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                            <option selected hidden value="">Prioritet</option>
                            <option value="">Lav</option>
                            <option value="">Middel</option>
                            <option value="">Høj</option>
                            <option value="">Straks</option>
                            <option value="">Driftfejl</option>
                        </select>
                    </div>
                    <div class="form-group form-group-custom">
                        <select name="select_Opgavestatus" id="select_Opgavestatus" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                            <option selected hidden value="">Opgavestatus</option>
                            <option value="">Arkiveret</option>
                            <option value="">Sendt til DUC</option>
                            <option value="">Venter på bruger</option>
                            <option value="">Venter på kunde</option>
                            <option value="">Venter på AO</option>
                        </select>
                    </div>
                    <div class="form-group form-group-custom">
                        <select name="select_Opgavetype" id="select_Opgavetype" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                            <option selected hidden value="">Opgavetype</option>
                            <option value="">Andet</option>
                            <option value="">Sendt til DUC</option>
                            <option value="">Venter på bruger</option>
                            <option value="">Venter på kunde</option>
                            <option value="">Venter på AO</option>
                        </select>
                    </div>
                    <div class="form-group form-group-custom">
                        <select name="select_Underkategori" id="select_Underkategori" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                            <option selected hidden value="">Underkategori</option>
                            <option value="">Via telefon</option>
                            <option value="">Via email</option>
                            <option value="">Internet</option>
                            <option value="">Intranet</option>
                            <option value="">VMS</option>
                        </select>
                    </div>
                    <div class="form-group form-group-custom">
                        <input type="text" class="form-control" placeholder="Søg efter">
                    </div>
                </form>
            </div>

            <div class="box-content">
                <table class="table table-hover table-sm">
                    <thead>
                    <tr>
                        <th scope="col">Dato</th>
                        <th scope="col">ID</th>
                        <th scope="col">Rekv</th>
                        <th scope="col">Tildelt</th>
                        <th scope="col">Beskrivelse</th>
                        <th scope="col">Type</th>
                        <th scope="col">Seneste log besked</th>
                        <th scope="col">Deadline</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td>22-11-2017</td>
                        <td>70935</td>
                        <td>HJR</td>
                        <td>LUC</td>
                        <td>Docking Station...</td>
                        <td>Bestilling - Via Telefon</td>
                        <td>8 dage</td>
                        <td>22-11-2017</td>
                    </tr>
                    <tr>
                        <td>28-11-2017</td>
                        <td>71049</td>
                        <td>LLJ</td>
                        <td>LUC</td>
                        <td>Kan ikke scanne fra sin printe....</td>
                        <td>IT-Drift - Via Telefon</td>
                        <td>3 dage</td>
                        <td>28-11-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div></code>```

I've made it to work by adding two additional classes (.flex-container & .flex-item) and applying certain flex properties with appropriate values.

I applied the .flex-container class to the form element which is the parent of all the .form-group / .form-group-custom div's, and the .flex-item class to the parent of the buttons.

Title: Right align button in form

Body:
I'm having some trouble using float: right; on a button.

Whatever I do, the button just doesn't wanna go to the right.
It's the second button, the one with the "advanced-search-button" class.

I'm using Bootstrap 4.

HTML

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/>

Opgaver

        <form action="" class="form-inline">

                <input type="text" class="form-control" placeholder="Rekvirent">

                <input type="text" class="form-control" placeholder="Tildelt til">

                <select name="select_Afsluttet" id="select_Afsluttet" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                    <option selected hidden value="">Afsluttet</option>
                    <option value="">Ja</option>
                    <option value="">Nej</option>
                    <option value="">Alle</option>
                </select>

                <select name="select_Godkendt" id="select_Godkendt" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                    <option selected hidden value="">Godkendt</option>
                    <option value="">Ja</option>
                    <option value="">Nej</option>
                    <option value="">Alle</option>
                </select>

                <button type="button" class="btn btn-success btn-sm" style="margin-right: 15px;">Søg</button>
                <button type="button" class="btn btn-primary btn-sm advanced-search-button" onclick="advancedSearch(this)">Avanceret søgning</button>

        </form>
        <form action="" class="form-inline form-custom advanced-search">

                <select name="select_Prioritet" id="select_Prioritet" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                    <option selected hidden value="">Prioritet</option>
                    <option value="">Lav</option>
                    <option value="">Middel</option>
                    <option value="">Høj</option>
                    <option value="">Straks</option>
                    <option value="">Driftfejl</option>
                </select>

                <select name="select_Opgavestatus" id="select_Opgavestatus" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                    <option selected hidden value="">Opgavestatus</option>
                    <option value="">Arkiveret</option>
                    <option value="">Sendt til DUC</option>
                    <option value="">Venter på bruger</option>
                    <option value="">Venter på kunde</option>
                    <option value="">Venter på AO</option>
                </select>

                <select name="select_Opgavetype" id="select_Opgavetype" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                    <option selected hidden value="">Opgavetype</option>
                    <option value="">Andet</option>
                    <option value="">Sendt til DUC</option>
                    <option value="">Venter på bruger</option>
                    <option value="">Venter på kunde</option>
                    <option value="">Venter på AO</option>
                </select>

                <select name="select_Underkategori" id="select_Underkategori" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                    <option selected hidden value="">Underkategori</option>
                    <option value="">Via telefon</option>
                    <option value="">Via email</option>
                    <option value="">Internet</option>
                    <option value="">Intranet</option>
                    <option value="">VMS</option>
                </select>

                <input type="text" class="form-control" placeholder="Søg efter">

        </form>

                    Dato
                    ID
                    Rekv
                    Tildelt
                    Beskrivelse
                    Type
                    Seneste log besked
                    Deadline

                    22-11-2017
                    70935
                    HJR
                    LUC
                    Docking Station...
                    Bestilling - Via Telefon
                    8 dage
                    22-11-2017

                    28-11-2017
                    71049
                    LLJ
                    LUC
                    Kan ikke scanne fra sin printe....
                    IT-Drift - Via Telefon
                    3 dage
                    28-11-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

                    05-12-2017
                    71244
                    LYL
                    LUC
                    Printer med gul baggrund på hy....
                    IT-support - Via Telefon
                    1 dage
                    05-12-2017

I hope you can help me :)

I don't have any custom CSS for this part, I only use the classes for JS.

Body:
You can do something like this with the Flexbox:

.flex-container {display:flex} /* displays children inline by default */

.flex-item {
 display: flex;
 justify-content: space-between; /* horizontal alignment / creates the max. horizontal space between the buttons */
 flex: 1 !important; /* takes all the remaining horizontal space / needs to have the !important keyword otherwise it doesn't work */
}

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>

<div class="box">
            <div class="box-title w-100">
                <h5>Opgaver</h5>
            </div>
            <div class="box-form w-100">
                <form action="" class="form-inline flex-container">
                    <div class="form-group form-group-custom">
                        <input type="text" class="form-control" placeholder="Rekvirent">
                    </div>
                    <div class="form-group form-group-custom">
                        <input type="text" class="form-control" placeholder="Tildelt til">
                    </div>
                    <div class="form-group form-group-custom">
                        <select name="select_Afsluttet" id="select_Afsluttet" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                            <option selected hidden value="">Afsluttet</option>
                            <option value="">Ja</option>
                            <option value="">Nej</option>
                            <option value="">Alle</option>
                        </select>
                    </div>
                    <div class="form-group form-group-custom">
                        <select name="select_Godkendt" id="select_Godkendt" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                            <option selected hidden value="">Godkendt</option>
                            <option value="">Ja</option>
                            <option value="">Nej</option>
                            <option value="">Alle</option>
                        </select>
                    </div>
                    <div class="form-group form-group-custom flex-item">
                        <button type="button" class="btn btn-success btn-sm" style="margin-right: 15px;">Søg</button>
                        <button type="button" class="btn btn-primary btn-sm advanced-search-button" onclick="advancedSearch(this)">Avanceret søgning</button>
                    </div>
                </form>

                <form action="" class="form-inline form-custom advanced-search">
                    <div class="form-group form-group-custom">
                        <select name="select_Prioritet" id="select_Prioritet" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                            <option selected hidden value="">Prioritet</option>
                            <option value="">Lav</option>
                            <option value="">Middel</option>
                            <option value="">Høj</option>
                            <option value="">Straks</option>
                            <option value="">Driftfejl</option>
                        </select>
                    </div>
                    <div class="form-group form-group-custom">
                        <select name="select_Opgavestatus" id="select_Opgavestatus" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                            <option selected hidden value="">Opgavestatus</option>
                            <option value="">Arkiveret</option>
                            <option value="">Sendt til DUC</option>
                            <option value="">Venter på bruger</option>
                            <option value="">Venter på kunde</option>
                            <option value="">Venter på AO</option>
                        </select>
                    </div>
                    <div class="form-group form-group-custom">
                        <select name="select_Opgavetype" id="select_Opgavetype" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                            <option selected hidden value="">Opgavetype</option>
                            <option value="">Andet</option>
                            <option value="">Sendt til DUC</option>
                            <option value="">Venter på bruger</option>
                            <option value="">Venter på kunde</option>
                            <option value="">Venter på AO</option>
                        </select>
                    </div>
                    <div class="form-group form-group-custom">
                        <select name="select_Underkategori" id="select_Underkategori" class="custom-select mb-2 mr-sm-2 mb-sm-0">
                            <option selected hidden value="">Underkategori</option>
                            <option value="">Via telefon</option>
                            <option value="">Via email</option>
                            <option value="">Internet</option>
                            <option value="">Intranet</option>
                            <option value="">VMS</option>
                        </select>
                    </div>
                    <div class="form-group form-group-custom">
                        <input type="text" class="form-control" placeholder="Søg efter">
                    </div>
                </form>
            </div>

            <div class="box-content">
                <table class="table table-hover table-sm">
                    <thead>
                    <tr>
                        <th scope="col">Dato</th>
                        <th scope="col">ID</th>
                        <th scope="col">Rekv</th>
                        <th scope="col">Tildelt</th>
                        <th scope="col">Beskrivelse</th>
                        <th scope="col">Type</th>
                        <th scope="col">Seneste log besked</th>
                        <th scope="col">Deadline</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td>22-11-2017</td>
                        <td>70935</td>
                        <td>HJR</td>
                        <td>LUC</td>
                        <td>Docking Station...</td>
                        <td>Bestilling - Via Telefon</td>
                        <td>8 dage</td>
                        <td>22-11-2017</td>
                    </tr>
                    <tr>
                        <td>28-11-2017</td>
                        <td>71049</td>
                        <td>LLJ</td>
                        <td>LUC</td>
                        <td>Kan ikke scanne fra sin printe....</td>
                        <td>IT-Drift - Via Telefon</td>
                        <td>3 dage</td>
                        <td>28-11-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    <tr>
                        <td>05-12-2017</td>
                        <td>71244</td>
                        <td>LYL</td>
                        <td>LUC</td>
                        <td>Printer med gul baggrund på hy....</td>
                        <td>IT-support - Via Telefon</td>
                        <td>1 dage</td>
                        <td>05-12-2017</td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>

I've made it to work by adding two additional classes (.flex-container & .flex-item) and applying certain flex properties with appropriate values.

I applied the .flex-container class to the form element which is the parent of all the .form-group / .form-group-custom div's, and the .flex-item class to the parent of the buttons.


来源: stackexchange

问:
Jquery tagsinput not creating tags automatically on pasting input
I'm using jquery.tagsinput and would like to be able to paste a list of email addresses separated by comma or space. Using something like this https://github.com/xoxco/jQuery-Tags-Input/issues/22 but it doesn't add them until I press Enter - Tried triggering keypress Enter event but it doesn't work. No luck with blur event either (shown below). Any ideas?

The Flat-UI tags are based on this library and I'm trying to achieve a very similar behaviour.

```<code>var tidyTags = function(e) {
  var tags = (e.tags).split(/[ ,]+/);
  var target = $(e.target);

  for (var i = 0, z = tags.length; i<z; i++) {
      var tag = $.trim(tags[i]);
      if (!target.tagExist(tag)) {
          target.addTag(tag);
      }
  }
  $('#' + target[0].id + '_tag').trigger('focus');

  //This doesn't work.
  target.blur();

};

$("#tagsinput").tagsInput({
    onAddTag : function(tag){
      if(tag.indexOf(',') > 0) {
          tidyTags({target: '#tagsinput', tags : tag});
      }
    },
});
</code>```

答:
First of all you should import this files https://github.com/xoxco/jQuery-Tags-Input/tree/master/src

This is our script code.

```<code> $(function () {
        $("#EditorInputs").val($("#Editors").val());
        $('#EditorInputs').tagsInput({
            'height': '50px',
            'width': 'auto',
            'defaultText': 'Editor',
            'removeWithBackspace': true,
            'delimiter': [','],
            'onChange': function () {
                $("#Editors").val($('#EditorInputs').val());
            }
        });
    });
</code>```

if you are using MVC

```<code> <div class="form-group">
            @Html.LabelFor(m => m.Editors, new { @class = "col-md-2 control-label" })
            <div class="col-md-10">
                @Html.HiddenFor(m => m.Editors)
                <input id="EditorInputs" value="" />
                @Html.ValidationMessageFor(m => m.Editors, "", new { @class = "text-danger" })
            </div>
        </div>
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I'm using jquery.tagsinput and would like to be able to paste a list of email addresses separated by comma or space. Using something like this https://github.com/xoxco/jQuery-Tags-Input/issues/22 but it doesn't add them until I press Enter - Tried triggering keypress Enter event but it doesn't work. No luck with blur event either (shown below). Any ideas?

The Flat-UI tags are based on this library and I'm trying to achieve a very similar behaviour.

var tidyTags = function(e) {
  var tags = (e.tags).split(/[ ,]+/);
  var target = $(e.target);

  for (var i = 0, z = tags.length; i<z; i++) {
      var tag = $.trim(tags[i]);
      if (!target.tagExist(tag)) {
          target.addTag(tag);
      }
  }
  $('#' + target[0].id + '_tag').trigger('focus');

  //This doesn't work.
  target.blur();

};

$("#tagsinput").tagsInput({
    onAddTag : function(tag){
      if(tag.indexOf(',') > 0) {
          tidyTags({target: '#tagsinput', tags : tag});
      }
    },
});

Body:
First of all you should import this files https://github.com/xoxco/jQuery-Tags-Input/tree/master/src

This is our script code.

 $(function () {
        $("#EditorInputs").val($("#Editors").val());
        $('#EditorInputs').tagsInput({
            'height': '50px',
            'width': 'auto',
            'defaultText': 'Editor',
            'removeWithBackspace': true,
            'delimiter': [','],
            'onChange': function () {
                $("#Editors").val($('#EditorInputs').val());
            }
        });
    });

if you are using MVC

 <div class="form-group">
            @Html.LabelFor(m => m.Editors, new { @class = "col-md-2 control-label" })
            <div class="col-md-10">
                @Html.HiddenFor(m => m.Editors)
                <input id="EditorInputs" value="" />
                @Html.ValidationMessageFor(m => m.Editors, "", new { @class = "text-danger" })
            </div>
        </div>


问:
How to compute sum, average and product of three numbers using different functions
I need to create a program that accepts 3 numbers and find the sum, average and product. I only need to use main(), get_ABC(), compute() and display() functions. I did it right but im not getting the right output about my mathematical operations.

```<code>#include<conio.h>
#include<iostream.h>

float get_A(float A)
{
    cout<<"Enter First Number: ";
    cin>>A;
    return(A);
}

float get_B(float B)
{
    cout<<"Enter Second Number: ";
    cin>>B;
    return(B);
}

float get_C(float C)
{
    cout<<"Enter Third Number: ";
    cin>>C;
    return(C);
}

 float compute_sum(float A,float B,float C)
{
 float sum;

 sum = A + B + C;
 return(sum);

}

float compute_ave(float A,float B,float C)
{
    float ave;
    ave = (A + B + C) / 3;
    return (ave);
}

float compute_prod(float A,float B,float C)
{
    float prod;
    prod = A * B * C;
    return(prod);
}

void display(float sum,float ave,float prod)
{
    cout<<"The sum of three numbers is "<<sum<<".\n";
    cout<<"The average of three numbers is "<<ave<<".\n";
    cout<<"The product of three numbers is "<<prod<<".";
}

float main()
{
    float A,B,C;
    float sum;
    float ave;
    float pro;
    clrscr();
    get_A(A);
    get_B(B);
    get_C(C);
    sum = compute_sum(A,B,C);
    ave = compute_ave(A,B,C);
    pro = compute_prod(A,B,C);
    display(sum,ave,pro);
    getch();
    return(0);
}
</code>```

This is the output.

```<code>Enter First Number: 1
Enter Second Number: 2
Enter Third Number: 3
The sum of three numbers is 0.
The average of three numbers is 0.
The product of three numbers is 0.
</code>```

I really need help. My prof give me this problem without teaching how to code, so i only come up with basics, i really gave up and end up here. You can change, add or replace the codes(with basic codes) if you want and i'll appreciate it.

答:
Change this:

```<code>get_A(A);
get_B(B);
get_C(C);
</code>```

to this:

```<code>A = get_A(A);
B = get_B(B);
C = get_C(C);
</code>```

so that you use the return values of your functions.

Moreover, main() should return an int, not a float.

Furthermore, initialize your variables when you declare them, so that you avoid "is used uninitialized in this function" warnings.

Body:
I need to create a program that accepts 3 numbers and find the sum, average and product. I only need to use main(), get_ABC(), compute() and display() functions. I did it right but im not getting the right output about my mathematical operations.

#include<conio.h>
#include<iostream.h>

float get_A(float A)
{
    cout<<"Enter First Number: ";
    cin>>A;
    return(A);
}

float get_B(float B)
{
    cout<<"Enter Second Number: ";
    cin>>B;
    return(B);
}

float get_C(float C)
{
    cout<<"Enter Third Number: ";
    cin>>C;
    return(C);
}

 float compute_sum(float A,float B,float C)
{
 float sum;

 sum = A + B + C;
 return(sum);

}

float compute_ave(float A,float B,float C)
{
    float ave;
    ave = (A + B + C) / 3;
    return (ave);
}

float compute_prod(float A,float B,float C)
{
    float prod;
    prod = A * B * C;
    return(prod);
}

void display(float sum,float ave,float prod)
{
    cout<<"The sum of three numbers is "<<sum<<".\n";
    cout<<"The average of three numbers is "<<ave<<".\n";
    cout<<"The product of three numbers is "<<prod<<".";
}

float main()
{
    float A,B,C;
    float sum;
    float ave;
    float pro;
    clrscr();
    get_A(A);
    get_B(B);
    get_C(C);
    sum = compute_sum(A,B,C);
    ave = compute_ave(A,B,C);
    pro = compute_prod(A,B,C);
    display(sum,ave,pro);
    getch();
    return(0);
}

This is the output.

Enter First Number: 1
Enter Second Number: 2
Enter Third Number: 3
The sum of three numbers is 0.
The average of three numbers is 0.
The product of three numbers is 0.

I really need help. My prof give me this problem without teaching how to code, so i only come up with basics, i really gave up and end up here. You can change, add or replace the codes(with basic codes) if you want and i'll appreciate it.

Body:
Change this:

get_A(A);
get_B(B);
get_C(C);

to this:

A = get_A(A);
B = get_B(B);
C = get_C(C);

so that you use the return values of your functions.

Moreover, main() should return an int, not a float.

Furthermore, initialize your variables when you declare them, so that you avoid "is used uninitialized in this function" warnings.


问:
jquery themeroller - out of the box example does not grey the modal dialog backgound
I'm using the latest jquery themeroller - so far looks great.

Except the modal dialog example and out of the box functionality of modal dialog boxes does not display the transparent curtain behind the current dialog box.

Anyone know how to enable this?

Thanks in advance.

答:
Set the modal property to true in the dialog initialization</p>

```<code>$(selector).dialog({modal:true});
</code>```

ContentLicense: CC BY-SA 2.5

Body:
Set the modal property to true in the dialog initialization

$(selector).dialog({modal:true});


问:
Dynamic Named Range based on Another Cell Value
I have two columns, col A contains an ID number from 1 to 9999 and column B contains a list of names. I would like to create a dynamic named range for column B where the associated ID value is between 999 and 9000. Normally I would use the OFFSET function to define the named range. Is it possible to expand the functionality to exclude records in col B based on the value in col A?

I would like to avoid filtering, vba, pivot tables or manipulating the raw data if possible.

Thanks

答:
Here is a solution with only 1 limitation that your filter on ID column should result in continuous values, e.g. the filter can be ID >= 5 and/or ID<=1000

If this is acceptable, solution would be:

Along with ID (column A) & Name column (column B), create a third column (column C), e.g Name2 where

```<code>Name2 = =IF(AND($A2>=start_val,$A2<=end_val),B2,"")

ID  Name    Name2
1   A
2   B
3   C   C
4   D   D
5   E   E
6   F   F
7   G   G
8   H
9   I
10  J
</code>```

create two other name ranges for your filter

```<code>start_val   3
end_val     7
</code>```

finally, create a namedrange with formula:

```<code>xyz = OFFSET(Name2,MATCH(start_val,ID,0)-1,,1+MATCH(end_val,ID,0)-MATCH(start_val,ID,0),)
</code>```

Body:
Here is a solution with only 1 limitation that your filter on ID column should result in continuous values, e.g. the filter can be ID >= 5 and/or ID<=1000

If this is acceptable, solution would be:

Along with ID (column A) & Name column (column B), create a third column (column C), e.g Name2 where

Name2 = =IF(AND($A2>=start_val,$A2<=end_val),B2,"")

ID  Name    Name2
1   A
2   B
3   C   C
4   D   D
5   E   E
6   F   F
7   G   G
8   H
9   I
10  J

create two other name ranges for your filter

start_val   3
end_val     7

finally, create a namedrange with formula:

xyz = OFFSET(Name2,MATCH(start_val,ID,0)-1,,1+MATCH(end_val,ID,0)-MATCH(start_val,ID,0),)


问:
Symfony 4.0 Translator class not injected to controller
I got a problem in new symfony 4.

```<code><?php

namespace App\Controller;

use App\Entity\Flight;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use App\Form\FlightType;
use Symfony\Component\Translation\Translator;
use Symfony\Component\HttpFoundation\Request;

/**
 * Class DefaultController
 * @package App\Controller
 */
class DefaultController extends Controller
{
    /**
     *
     * @Route("/")
     * @Route("/{_locale}/", name="homepage", requirements={"_locale" = "%app.locales%"})
     *
     * @param Translator $translator
     * @param Request $request
     *
     * @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
     */
    public function index(Translator $translator, Request $request)
    {
        $translated = $translator->trans('Symfony is great');
</code>```

Error:
Controller "App\Controller\DefaultController::index()" requires that you provide a value for the "$translator" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.

Configs:
service.yaml

```<code>services:
    _defaults:
        autowire: true
        autoconfigure: true
        public: false

...
App\Controller\:
    autowire: true
    resource: '../src/Controller'
    tags: ['controller.service_arguments']
</code>```

translation.yaml

```<code>framework:
    default_locale: '%locale%'
    translator:
        paths:
            - '%kernel.project_dir%/translations'
        fallbacks: ['en']
</code>```

Whats wrong? Manual here:
http://symfony.com/doc/current/translation.html

答:
Found the answer.

bin/console cache:clear did not clear messages cache. Helped just hard remove var/cache folder.

I have used Action(TranslatorInterface $translator) for inject to controller action (Probably bug in docs)

$translator->trans('id') doesn't work with ids. It work when using trans-unit sourse tag.

Body:
I got a problem in new symfony 4.

<?php

namespace App\Controller;

use App\Entity\Flight;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use App\Form\FlightType;
use Symfony\Component\Translation\Translator;
use Symfony\Component\HttpFoundation\Request;

/**
 * Class DefaultController
 * @package App\Controller
 */
class DefaultController extends Controller
{
    /**
     *
     * @Route("/")
     * @Route("/{_locale}/", name="homepage", requirements={"_locale" = "%app.locales%"})
     *
     * @param Translator $translator
     * @param Request $request
     *
     * @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
     */
    public function index(Translator $translator, Request $request)
    {
        $translated = $translator->trans('Symfony is great');

Error:
Controller "App\Controller\DefaultController::index()" requires that you provide a value for the "$translator" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.

Configs:
service.yaml

services:
    _defaults:
        autowire: true
        autoconfigure: true
        public: false

...
App\Controller\:
    autowire: true
    resource: '../src/Controller'
    tags: ['controller.service_arguments']

translation.yaml

framework:
    default_locale: '%locale%'
    translator:
        paths:
            - '%kernel.project_dir%/translations'
        fallbacks: ['en']

Whats wrong? Manual here:
http://symfony.com/doc/current/translation.html


问:
Adb install failure: INSTALL_CANCELED_BY_USER
I try to install app via adb and get a error:

```<code>$ ./adb -d install /Users/dimon/Projects/one-place/myprogram/platforms/android/build/outputs/apk/android-debug.apk -r -g
3704 KB/s (4595985 bytes in 1.211s)
    pkg: /data/local/tmp/android-debug.apk
Failure [INSTALL_CANCELED_BY_USER]
</code>```

In device I do nothing in this moment.
Device is Xiaomi MI5, MIUI 7.2.13, Android 6.0. Developer mode enabled.
How to fix this?

The same error I get when try to run "ionic run android" command.

UPD

Here is logs from 'adb logcat' command getting in moment of installation program:

```<code>06-06 10:04:20.051   788   903 I DisplayFeatureService: void android::update_watchlist(const prop_info*, void*): sys.boot_completed: 1
06-06 10:04:20.063   788   903 I DisplayFeatureService: void android::update_watchlist(const prop_info*, void*): sys.boot_completed: 1
06-06 10:04:20.078 13397 13397 E ANDR-PERF-MPCTL: Unable to create control service (stage=2, rc=-1)
06-06 10:04:20.082   788   903 I DisplayFeatureService: void android::update_watchlist(const prop_info*, void*): sys.boot_completed: 1
06-06 10:04:20.079 13396 13396 W iop     : type=1400 audit(0.0:527): avc: denied { write } for name="socket" dev="tmpfs" ino=14686 scontext=u:r:dumpstate:s0 tcontext=u:object_r:socket_device:s0 tclass=dir permissive=0
06-06 10:04:20.088   788   903 I DisplayFeatureService: void android::update_watchlist(const prop_info*, void*): sys.boot_completed: 1
06-06 10:04:20.926 13400 13400 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
06-06 10:04:20.930 13400 13400 D AndroidRuntime: CheckJNI is OFF
06-06 10:04:20.966 13400 13400 D ICU     : No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
06-06 10:04:20.995 13400 13400 I Radio-JNI: register_android_hardware_Radio DONE
06-06 10:04:21.004 13400 13400 E         : WFDWhiteListing : library initialized successfully
06-06 10:04:21.020 13400 13400 D AndroidRuntime: Calling main entry com.android.commands.pm.Pm
06-06 10:04:21.027 13400 13400 I Timeline: Timeline: Activity_launch_request time:973226
06-06 10:04:21.028  1497  2996 I ActivityManager: START u0 {act=android.intent.action.VIEW dat=file:///data/local/tmp/android-debug.apk typ=application/vnd.android.package-archive flg=0x18000000 cmp=com.miui.securitycenter/com.miui.permcenter.install.AdbInstallActivity (has extras)} from uid 2000 on display 0
06-06 10:04:21.033  1497  2996 E         : WFDMMServiceClient ctor Context = 0x0, Cb = 0x0
06-06 10:04:21.033  1497  2996 E         : getWFDMMServiceInstance get new Instance
06-06 10:04:21.033  1497  2996 E         : Service not available yet
06-06 10:04:21.034  1497  2996 E         : WFDMMServiceClient::~WFDMMServiceClient
06-06 10:04:21.037  1497  2996 E         : WFDMMServiceClient ctor Context = 0x0, Cb = 0x0
06-06 10:04:21.037  1497  2996 E         : getWFDMMServiceInstance get new Instance
06-06 10:04:21.037  1497  2996 E         : Service not available yet
06-06 10:04:21.037  1497  2996 E         : WFDMMServiceClient::~WFDMMServiceClient
06-06 10:04:21.050  2875  3077 D PowerKeeperEventLogManager: notifyForegroundCompomentChanged ComponentInfo{com.miui.securitycenter/com.miui.permcenter.install.AdbInstallActivity}
06-06 10:04:21.051  2875  3036 D PowerKeeperExecutor: notify state normal_state enter...
06-06 10:04:21.051  2875  3036 D PowerKeeperExecutor: foreground_change:
06-06 10:04:21.051  2875  3036 D PowerKeeperExecutor: set_cpu_powermode(middle)
06-06 10:04:21.051  2875  3036 I PowerKeeperExecutor: no local quick execution method for set_cpu_powermode
06-06 10:04:21.051  2875  3036 D PowerKeeperExecutor: set_lcd_mode(ui)
06-06 10:04:21.051  2875  3036 I PowerKeeperExecutor: no local quick execution method for set_lcd_mode
06-06 10:04:21.049  2887  2887 W EventReader: type=1400 audit(0.0:528): avc: denied { search } for name="756" dev="proc" ino=16099 scontext=u:r:system_app:s0 tcontext=u:r:zygote:s0 tclass=dir permissive=0
06-06 10:04:21.049  2887  2887 W EventReader: type=1400 audit(0.0:529): avc: denied { search } for name="756" dev="proc" ino=16099 scontext=u:r:system_app:s0 tcontext=u:r:zygote:s0 tclass=dir permissive=0
06-06 10:04:21.051  3247  4440 I octvm_power: power mode [normal] start 1465200261
06-06 10:04:21.051  3247  4440 I octvm_power: Action: set_cpu_powermode(middle) for [foreground_change]
06-06 10:04:21.051  3247  4440 I octvm_drv: common drv: platform_set_power_profile -> platform not support
06-06 10:04:21.051  2533  2887 I octvm   : task pid 2113 have been add to group sys_standby.
06-06 10:04:21.051  3247  4440 I octvm_power: Action: set_lcd_mode(ui) for [foreground_change]
06-06 10:04:21.051  3247  4440 I octvm_drv: common drv: platform_set_lcd_mode -> platform not support
06-06 10:04:21.051  2533  2887 I octvm   : task pid 2900 have been add to group sys_standby.
06-06 10:04:21.049  2887  2887 W EventReader: type=1400 audit(0.0:530): avc: denied { search } for name="756" dev="proc" ino=16099 scontext=u:r:system_app:s0 tcontext=u:r:zygote:s0 tclass=dir permissive=0
06-06 10:04:21.051  2533  2887 I octvm   : task pid 4553 have been add to group sys_standby.
06-06 10:04:21.051  2533  2887 I octvm   : [sys_standby]cgroup_add_tasks max single write time: 0ms
06-06 10:04:21.051  2533  2887 I octvm   : [sys_standby]cgroup_add_tasks total time consume: 0ms
06-06 10:04:21.051  3247  4440 I octvm_power: onPowerModeChanged[normal] called
06-06 10:04:21.052  2875  3093 I FirstNotificationController: handleUnlockState: stoped
06-06 10:04:21.055  1497  2996 I Timeline: Timeline: App_transition_ready time:973254
06-06 10:04:21.055  1976  1976 V PhoneStatusBarPolicy: updateManagedProfile: mManagedProfileFocused: false mKeyguardVisible: true
06-06 10:04:21.055  1497  2996 I Timeline: Timeline: App_transition_stopped time:973255
06-06 10:04:21.059  1497  2996 E ActivityManager: Invalid thumbnail dimensions: 0x0
06-06 10:04:21.059  4553  4553 W .securitycenter: type=1400 audit(0.0:531): avc: denied { search } for name="tmp" dev="dm-0" ino=28 scontext=u:r:system_app:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
06-06 10:04:21.066  4553  4553 W asset   : Asset path /data/local/tmp/android-debug.apk is neither a directory nor file (type=0).
06-06 10:04:21.066  4553  4553 D AdbInstallActivity:  parsePackage is null , path ：/data/local/tmp/android-debug.apk
06-06 10:04:21.059  4553  4553 W .securitycenter: type=1400 audit(0.0:532): avc: denied { search } for name="tmp" dev="dm-0" ino=28 scontext=u:r:system_app:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
06-06 10:04:21.072  1497  2230 E         : WFDMMServiceClient ctor Context = 0x0, Cb = 0x0
06-06 10:04:21.072  1497  2230 E         : getWFDMMServiceInstance get new Instance
06-06 10:04:21.072  1497  2230 E         : Service not available yet
06-06 10:04:21.072  1497  2230 E         : WFDMMServiceClient::~WFDMMServiceClient
06-06 10:04:21.073  1497  2230 E         : WFDMMServiceClient ctor Context = 0x0, Cb = 0x0
06-06 10:04:21.073  1497  2230 E         : getWFDMMServiceInstance get new Instance
06-06 10:04:21.073  1497  2230 E         : Service not available yet
06-06 10:04:21.073  1497  2230 E         : WFDMMServiceClient::~WFDMMServiceClient
06-06 10:04:21.075  1497  2230 E ActivityManager: Invalid thumbnail dimensions: 0x0
06-06 10:04:21.076  2875  3077 D PowerKeeperEventLogManager: notifyForegroundCompomentChanged ComponentInfo{com.android.settings/com.android.settings.Settings$WifiSettingsActivity}
06-06 10:04:21.069  2887  2887 W EventReader: type=1400 audit(0.0:533): avc: denied { search } for name="756" dev="proc" ino=16099 scontext=u:r:system_app:s0 tcontext=u:r:zygote:s0 tclass=dir permissive=0
06-06 10:04:21.076  1497  2230 I Timeline: Timeline: App_transition_ready time:973275
06-06 10:04:21.076  1497  2230 I Timeline: Timeline: App_transition_stopped time:973275
06-06 10:04:21.076  2533  2887 I octvm   : task pid 2060 have been add to group sys_standby.
06-06 10:04:21.076  2533  2887 I octvm   : [sys_standby]cgroup_add_tasks max single write time: 0ms
06-06 10:04:21.076  2533  2887 I octvm   : [sys_standby]cgroup_add_tasks total time consume: 0ms
06-06 10:04:21.077  1976  1976 V PhoneStatusBarPolicy: updateManagedProfile: mManagedProfileFocused: false mKeyguardVisible: true
06-06 10:04:21.090 13400 13400 I art     : System.exit called, status: 1
06-06 10:04:21.090 13400 13400 I AndroidRuntime: VM exiting with result code 1.
06-06 10:04:21.100  2060  2130 V MI_STAT : disabled local event upload
</code>```

I see when android-debug.apk creates, but I don't understand why it's not installs. Maybe the key strings is:

```<code>06-06 10:04:21.066  4553  4553 W asset   : Asset path /data/local/tmp/android-debug.apk is neither a directory nor file (type=0).
06-06 10:04:21.066  4553  4553 D AdbInstallActivity:  parsePackage is null , path ：/data/local/tmp/android-debug.apk
</code>```

but this is not error strings, just warning and debug.
Also strange line:

```<code>06-06 10:04:21.059  1497  2996 E ActivityManager: Invalid thumbnail dimensions: 0x0
</code>```

but I don't know if it is a problem.

Also I tried to install via adb some other apps, not only self-written. But no results.

答:
I tried all the steps described above but failed.

Like, connect to the internet with Data connection, Turning off the MIUI optimization and reboot, Turning on Install via USB from Security settings etc.

Then I found a solution.

Steps:

Install PlexVPN.

set China-Shanghai server

Try turning on Install via USB from Developer option.

That's all.

Body:
I try to install app via adb and get a error:

$ ./adb -d install /Users/dimon/Projects/one-place/myprogram/platforms/android/build/outputs/apk/android-debug.apk -r -g
3704 KB/s (4595985 bytes in 1.211s)
    pkg: /data/local/tmp/android-debug.apk
Failure [INSTALL_CANCELED_BY_USER]

In device I do nothing in this moment.
Device is Xiaomi MI5, MIUI 7.2.13, Android 6.0. Developer mode enabled.
How to fix this?

The same error I get when try to run "ionic run android" command.

UPD

Here is logs from 'adb logcat' command getting in moment of installation program:

06-06 10:04:20.051   788   903 I DisplayFeatureService: void android::update_watchlist(const prop_info*, void*): sys.boot_completed: 1
06-06 10:04:20.063   788   903 I DisplayFeatureService: void android::update_watchlist(const prop_info*, void*): sys.boot_completed: 1
06-06 10:04:20.078 13397 13397 E ANDR-PERF-MPCTL: Unable to create control service (stage=2, rc=-1)
06-06 10:04:20.082   788   903 I DisplayFeatureService: void android::update_watchlist(const prop_info*, void*): sys.boot_completed: 1
06-06 10:04:20.079 13396 13396 W iop     : type=1400 audit(0.0:527): avc: denied { write } for name="socket" dev="tmpfs" ino=14686 scontext=u:r:dumpstate:s0 tcontext=u:object_r:socket_device:s0 tclass=dir permissive=0
06-06 10:04:20.088   788   903 I DisplayFeatureService: void android::update_watchlist(const prop_info*, void*): sys.boot_completed: 1
06-06 10:04:20.926 13400 13400 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
06-06 10:04:20.930 13400 13400 D AndroidRuntime: CheckJNI is OFF
06-06 10:04:20.966 13400 13400 D ICU     : No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
06-06 10:04:20.995 13400 13400 I Radio-JNI: register_android_hardware_Radio DONE
06-06 10:04:21.004 13400 13400 E         : WFDWhiteListing : library initialized successfully
06-06 10:04:21.020 13400 13400 D AndroidRuntime: Calling main entry com.android.commands.pm.Pm
06-06 10:04:21.027 13400 13400 I Timeline: Timeline: Activity_launch_request time:973226
06-06 10:04:21.028  1497  2996 I ActivityManager: START u0 {act=android.intent.action.VIEW dat=file:///data/local/tmp/android-debug.apk typ=application/vnd.android.package-archive flg=0x18000000 cmp=com.miui.securitycenter/com.miui.permcenter.install.AdbInstallActivity (has extras)} from uid 2000 on display 0
06-06 10:04:21.033  1497  2996 E         : WFDMMServiceClient ctor Context = 0x0, Cb = 0x0
06-06 10:04:21.033  1497  2996 E         : getWFDMMServiceInstance get new Instance
06-06 10:04:21.033  1497  2996 E         : Service not available yet
06-06 10:04:21.034  1497  2996 E         : WFDMMServiceClient::~WFDMMServiceClient
06-06 10:04:21.037  1497  2996 E         : WFDMMServiceClient ctor Context = 0x0, Cb = 0x0
06-06 10:04:21.037  1497  2996 E         : getWFDMMServiceInstance get new Instance
06-06 10:04:21.037  1497  2996 E         : Service not available yet
06-06 10:04:21.037  1497  2996 E         : WFDMMServiceClient::~WFDMMServiceClient
06-06 10:04:21.050  2875  3077 D PowerKeeperEventLogManager: notifyForegroundCompomentChanged ComponentInfo{com.miui.securitycenter/com.miui.permcenter.install.AdbInstallActivity}
06-06 10:04:21.051  2875  3036 D PowerKeeperExecutor: notify state normal_state enter...
06-06 10:04:21.051  2875  3036 D PowerKeeperExecutor: foreground_change:
06-06 10:04:21.051  2875  3036 D PowerKeeperExecutor: set_cpu_powermode(middle)
06-06 10:04:21.051  2875  3036 I PowerKeeperExecutor: no local quick execution method for set_cpu_powermode
06-06 10:04:21.051  2875  3036 D PowerKeeperExecutor: set_lcd_mode(ui)
06-06 10:04:21.051  2875  3036 I PowerKeeperExecutor: no local quick execution method for set_lcd_mode
06-06 10:04:21.049  2887  2887 W EventReader: type=1400 audit(0.0:528): avc: denied { search } for name="756" dev="proc" ino=16099 scontext=u:r:system_app:s0 tcontext=u:r:zygote:s0 tclass=dir permissive=0
06-06 10:04:21.049  2887  2887 W EventReader: type=1400 audit(0.0:529): avc: denied { search } for name="756" dev="proc" ino=16099 scontext=u:r:system_app:s0 tcontext=u:r:zygote:s0 tclass=dir permissive=0
06-06 10:04:21.051  3247  4440 I octvm_power: power mode [normal] start 1465200261
06-06 10:04:21.051  3247  4440 I octvm_power: Action: set_cpu_powermode(middle) for [foreground_change]
06-06 10:04:21.051  3247  4440 I octvm_drv: common drv: platform_set_power_profile -> platform not support
06-06 10:04:21.051  2533  2887 I octvm   : task pid 2113 have been add to group sys_standby.
06-06 10:04:21.051  3247  4440 I octvm_power: Action: set_lcd_mode(ui) for [foreground_change]
06-06 10:04:21.051  3247  4440 I octvm_drv: common drv: platform_set_lcd_mode -> platform not support
06-06 10:04:21.051  2533  2887 I octvm   : task pid 2900 have been add to group sys_standby.
06-06 10:04:21.049  2887  2887 W EventReader: type=1400 audit(0.0:530): avc: denied { search } for name="756" dev="proc" ino=16099 scontext=u:r:system_app:s0 tcontext=u:r:zygote:s0 tclass=dir permissive=0
06-06 10:04:21.051  2533  2887 I octvm   : task pid 4553 have been add to group sys_standby.
06-06 10:04:21.051  2533  2887 I octvm   : [sys_standby]cgroup_add_tasks max single write time: 0ms
06-06 10:04:21.051  2533  2887 I octvm   : [sys_standby]cgroup_add_tasks total time consume: 0ms
06-06 10:04:21.051  3247  4440 I octvm_power: onPowerModeChanged[normal] called
06-06 10:04:21.052  2875  3093 I FirstNotificationController: handleUnlockState: stoped
06-06 10:04:21.055  1497  2996 I Timeline: Timeline: App_transition_ready time:973254
06-06 10:04:21.055  1976  1976 V PhoneStatusBarPolicy: updateManagedProfile: mManagedProfileFocused: false mKeyguardVisible: true
06-06 10:04:21.055  1497  2996 I Timeline: Timeline: App_transition_stopped time:973255
06-06 10:04:21.059  1497  2996 E ActivityManager: Invalid thumbnail dimensions: 0x0
06-06 10:04:21.059  4553  4553 W .securitycenter: type=1400 audit(0.0:531): avc: denied { search } for name="tmp" dev="dm-0" ino=28 scontext=u:r:system_app:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
06-06 10:04:21.066  4553  4553 W asset   : Asset path /data/local/tmp/android-debug.apk is neither a directory nor file (type=0).
06-06 10:04:21.066  4553  4553 D AdbInstallActivity:  parsePackage is null , path ：/data/local/tmp/android-debug.apk
06-06 10:04:21.059  4553  4553 W .securitycenter: type=1400 audit(0.0:532): avc: denied { search } for name="tmp" dev="dm-0" ino=28 scontext=u:r:system_app:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
06-06 10:04:21.072  1497  2230 E         : WFDMMServiceClient ctor Context = 0x0, Cb = 0x0
06-06 10:04:21.072  1497  2230 E         : getWFDMMServiceInstance get new Instance
06-06 10:04:21.072  1497  2230 E         : Service not available yet
06-06 10:04:21.072  1497  2230 E         : WFDMMServiceClient::~WFDMMServiceClient
06-06 10:04:21.073  1497  2230 E         : WFDMMServiceClient ctor Context = 0x0, Cb = 0x0
06-06 10:04:21.073  1497  2230 E         : getWFDMMServiceInstance get new Instance
06-06 10:04:21.073  1497  2230 E         : Service not available yet
06-06 10:04:21.073  1497  2230 E         : WFDMMServiceClient::~WFDMMServiceClient
06-06 10:04:21.075  1497  2230 E ActivityManager: Invalid thumbnail dimensions: 0x0
06-06 10:04:21.076  2875  3077 D PowerKeeperEventLogManager: notifyForegroundCompomentChanged ComponentInfo{com.android.settings/com.android.settings.Settings$WifiSettingsActivity}
06-06 10:04:21.069  2887  2887 W EventReader: type=1400 audit(0.0:533): avc: denied { search } for name="756" dev="proc" ino=16099 scontext=u:r:system_app:s0 tcontext=u:r:zygote:s0 tclass=dir permissive=0
06-06 10:04:21.076  1497  2230 I Timeline: Timeline: App_transition_ready time:973275
06-06 10:04:21.076  1497  2230 I Timeline: Timeline: App_transition_stopped time:973275
06-06 10:04:21.076  2533  2887 I octvm   : task pid 2060 have been add to group sys_standby.
06-06 10:04:21.076  2533  2887 I octvm   : [sys_standby]cgroup_add_tasks max single write time: 0ms
06-06 10:04:21.076  2533  2887 I octvm   : [sys_standby]cgroup_add_tasks total time consume: 0ms
06-06 10:04:21.077  1976  1976 V PhoneStatusBarPolicy: updateManagedProfile: mManagedProfileFocused: false mKeyguardVisible: true
06-06 10:04:21.090 13400 13400 I art     : System.exit called, status: 1
06-06 10:04:21.090 13400 13400 I AndroidRuntime: VM exiting with result code 1.
06-06 10:04:21.100  2060  2130 V MI_STAT : disabled local event upload

I see when android-debug.apk creates, but I don't understand why it's not installs. Maybe the key strings is:

06-06 10:04:21.066  4553  4553 W asset   : Asset path /data/local/tmp/android-debug.apk is neither a directory nor file (type=0).
06-06 10:04:21.066  4553  4553 D AdbInstallActivity:  parsePackage is null , path ：/data/local/tmp/android-debug.apk

but this is not error strings, just warning and debug.
Also strange line:

06-06 10:04:21.059  1497  2996 E ActivityManager: Invalid thumbnail dimensions: 0x0

but I don't know if it is a problem.

Also I tried to install via adb some other apps, not only self-written. But no results.


问:
Dynamically updating basic_qos prefetch to prevent prefetched messages while workers remain busy after ack
I'm looking for performance concerns or other gotchas around dynamically adjusting the prefetch count. And of course I'm also welcoming better solutions.

In my scenario I have 10 worker threads to which my consumer distributes messages. Naturally, I have a prefetch count of 10 so that they may all receive work concurrently.

This is a problem if I want to ack the message early on and do a longer running task in the worker.  When my worker acks and proceeds to do more work, Rabbit will prefetch the next head message, potentially causing that message to be delayed while other workers (in a totally different process) are available to handle it.

I'm imagining a solution where my consumer decrements the prefetch count before distributing a message to a worker, and then incrementing it again once that worker completes.

To summarize the problem & proposed solution:

Workers may not become available right after ACKing a message, causing the next prefetched message to be needlessly delayed.

The consumer who distributes messages to workers can adjust the prefetch count based on the business of indvididual workers.

答:
It looks like performance tuning scenario. You need to understand

frequency of messages over a period of time.

processing time (time take by your worker threads in processing the message) variance. Whether the processing time is more or less same for each message or its uneven.

One logical solution that you could do is (if you are able to identify the number of worker threads waiting for processing message) that you reset the prefetch count to number of available threads and send a basic ack to rabbitmq. i.e. after every worker thread processing completion (i.e. worker thread becomes available) you send these

```<code>channel.basicQos(no_of_available_worker_threads);
channel.basicAck(envelope.getDeliveryTag(), false);
</code>```

e.g. Just assume a scenario where
You have just started with prefetch limit 10. You have received 4 messages. So now 4 worker threads are busy processing the messages. Then one of your completes processing and becomes available for next message. At this moment you have 7 worker threads waiting. Now, you will send

```<code>channel.basicQos(7);
channel.basicAck(envelope.getDeliveryTag(), false);
</code>```

Now your consumer receives 3 more messages from rabbitmq. You have now 4 worker threads waiting. Now one more worker thread becomes availble. Now, you will send

```<code>channel.basicQos(5);
channel.basicAck(envelope.getDeliveryTag(), false);
</code>```

After some time one more thread becomes available. Now, you will send

```<code>channel.basicQos(4);
channel.basicAck(envelope.getDeliveryTag(), false);
</code>```

and so on....

so your consumer will never receive more no of messages than available workers at that moment.

Update -

I am not sure which language client you are using. But if you are using java client (I tested with amqp-client5.0.0.jar), the consumer (created as in below code) always creates a new thread when it receives a new message, after processing the message the thread is destroyed. You don't have to manage threads for processing messages in parallel. So at any given time you will never have more threads than  the QOS limit you have set.

```<code>Consumer consumer = new DefaultConsumer(channel) {
              @Override
              public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body)
                  throws IOException {
                String message = new String(body, "UTF-8");
                System.out.println("Received '" + message + "'");
                //process message
        };
channelSet.basicConsume(queueName, true, consumer);
</code>```

Body:
It looks like performance tuning scenario. You need to understand

frequency of messages over a period of time.

processing time (time take by your worker threads in processing the message) variance. Whether the processing time is more or less same for each message or its uneven.

One logical solution that you could do is (if you are able to identify the number of worker threads waiting for processing message) that you reset the prefetch count to number of available threads and send a basic ack to rabbitmq. i.e. after every worker thread processing completion (i.e. worker thread becomes available) you send these

channel.basicQos(no_of_available_worker_threads);
channel.basicAck(envelope.getDeliveryTag(), false);

e.g. Just assume a scenario where
You have just started with prefetch limit 10. You have received 4 messages. So now 4 worker threads are busy processing the messages. Then one of your completes processing and becomes available for next message. At this moment you have 7 worker threads waiting. Now, you will send

channel.basicQos(7);
channel.basicAck(envelope.getDeliveryTag(), false);

Now your consumer receives 3 more messages from rabbitmq. You have now 4 worker threads waiting. Now one more worker thread becomes availble. Now, you will send

channel.basicQos(5);
channel.basicAck(envelope.getDeliveryTag(), false);

After some time one more thread becomes available. Now, you will send

channel.basicQos(4);
channel.basicAck(envelope.getDeliveryTag(), false);

and so on....

so your consumer will never receive more no of messages than available workers at that moment.

Update -

I am not sure which language client you are using. But if you are using java client (I tested with amqp-client5.0.0.jar), the consumer (created as in below code) always creates a new thread when it receives a new message, after processing the message the thread is destroyed. You don't have to manage threads for processing messages in parallel. So at any given time you will never have more threads than  the QOS limit you have set.

Consumer consumer = new DefaultConsumer(channel) {
              @Override
              public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body)
                  throws IOException {
                String message = new String(body, "UTF-8");
                System.out.println("Received '" + message + "'");
                //process message
        };
channelSet.basicConsume(queueName, true, consumer);


问:
Constructor on typescript enum?
We have a situation at the moment with our code where we are using Enums in our Java layer which store an id and a 'display value' with a constructor like below:

```<code>public enum Status implements EnumIdentity {

    Active(1, "Active"),
    AwaitingReview(2, "Awaiting Review"),
    Closed(3, "Closed"),
    Complete(4, "Complete"),
    Draft(5, "Draft"),
    InProcess(6, "In Process"),
    InReview(7, "In Review"),
    NotStarted(8, "Not Started"),
    PendingResolution(9, "Pending Resolution"),
    Rejected(10, "Rejected");

    private int id;
    private String displayValue;

    PlanStatus(final int id, String displayValue) {
        this.id = id;
        this.displayValue = displayValue;
    }

    /** {@inheritDoc} */
    @Override
    public int id() {
        return id;
    }

    public String getDisplayValue() {
        return displayValue;
    }
}
</code>```

and we would like something in typescript to match this to allow for displaying the status in a meaningful way for carrying out logic and for display the value to the user on the front end.
Is this possible? Is there a better way to handle this? We would like to avoid having to use logic such as does status.id() = 1 or status.name() = 'Active' hence for the push towards enums.

Thanks

答:
Typescript does not support expanded enums such as in java. You can achieve a similar effect using a class:</p>

```<code>interface EnumIdentity { }
class Status implements EnumIdentity {

    private static AllValues: { [name: string] : Status } = {};

    static readonly Active = new Status(1, "Active");
    static readonly AwaitingReview = new Status(2, "Awaiting Review");
    static readonly Closed = new Status(3, "Closed");
    static readonly Complete = new Status(4, "Complete");
    static readonly Draft = new Status(5, "Draft");
    static readonly InProcess = new Status(6, "In Process");
    static readonly InReview = new Status(7, "In Review");
    static readonly NotStarted = new Status(8, "Not Started");
    static readonly PendingResolution = new Status(9, "Pending Resolution");
    static readonly Rejected = new Status(10, "Rejected");

    private constructor(public readonly id: number, public readonly displayValue: string) {
        Status.AllValues[displayValue] = this;
    }

    public static parseEnum(data: string) : Status{
        return Status.AllValues[data];
    }

}
</code>```

Title: Constructor on typescript enum?

Body:
We have a situation at the moment with our code where we are using Enums in our Java layer which store an id and a 'display value' with a constructor like below:

public enum Status implements EnumIdentity {

    Active(1, "Active"),
    AwaitingReview(2, "Awaiting Review"),
    Closed(3, "Closed"),
    Complete(4, "Complete"),
    Draft(5, "Draft"),
    InProcess(6, "In Process"),
    InReview(7, "In Review"),
    NotStarted(8, "Not Started"),
    PendingResolution(9, "Pending Resolution"),
    Rejected(10, "Rejected");

    private int id;
    private String displayValue;

    PlanStatus(final int id, String displayValue) {
        this.id = id;
        this.displayValue = displayValue;
    }

    /** {@inheritDoc} */
    @Override
    public int id() {
        return id;
    }

    public String getDisplayValue() {
        return displayValue;
    }
}

and we would like something in typescript to match this to allow for displaying the status in a meaningful way for carrying out logic and for display the value to the user on the front end.
Is this possible? Is there a better way to handle this? We would like to avoid having to use logic such as does status.id() = 1 or status.name() = 'Active' hence for the push towards enums.

Thanks

Body:
Typescript does not support expanded enums such as in java. You can achieve a similar effect using a class:

interface EnumIdentity { }
class Status implements EnumIdentity {

    private static AllValues: { [name: string] : Status } = {};

    static readonly Active = new Status(1, "Active");
    static readonly AwaitingReview = new Status(2, "Awaiting Review");
    static readonly Closed = new Status(3, "Closed");
    static readonly Complete = new Status(4, "Complete");
    static readonly Draft = new Status(5, "Draft");
    static readonly InProcess = new Status(6, "In Process");
    static readonly InReview = new Status(7, "In Review");
    static readonly NotStarted = new Status(8, "Not Started");
    static readonly PendingResolution = new Status(9, "Pending Resolution");
    static readonly Rejected = new Status(10, "Rejected");

    private constructor(public readonly id: number, public readonly displayValue: string) {
        Status.AllValues[displayValue] = this;
    }

    public static parseEnum(data: string) : Status{
        return Status.AllValues[data];
    }

}


问:
Ignore Sundays from jQuery date range picker
I'm using the following jQuery date range picker library : http://longbill.github.io/jquery-date-range-picker/

I would like to remove / hide all Sundays from all date range pickers while keeping a normal behavior on the date range pickers.

I tried to do something with beforeShowDay option :

```<code>beforeShowDay: function(t) {
  var valid = t.getDay() !== 0; //disable sunday
  var _class = '';
  // var _tooltip = valid ? '' : 'weekends are disabled';
  return [valid, _class];
}
</code>```

but it only "disables" all Sundays whereas I want to remove / hide them:

Here's the fiddle I'm working on : https://jsfiddle.net/maximelafarie/dnbd01do/11/

EDIT:
Updated fiddle with @Swanand code: https://jsfiddle.net/maximelafarie/dnbd01do/18/

答:
You need do changes in two functions in your daterangepicker.js file:

createMonthHTML()

```<code>    function createMonthHTML(d) { var days = [];
    d.setDate(1);
    var lastMonth = new Date(d.getTime() - 86400000);
    var now = new Date();
    var dayOfWeek = d.getDay();
    if ((dayOfWeek === 0) && (opt.startOfWeek === 'monday')) {
        // add one week
        dayOfWeek = 7;
    }
    var today, valid;

    if (dayOfWeek > 0) {
        for (var i = dayOfWeek; i > 0; i--) {
            var day = new Date(d.getTime() - 86400000 * i);
            valid = isValidTime(day.getTime());
            if (opt.startDate && compare_day(day, opt.startDate) < 0) valid = false;
            if (opt.endDate && compare_day(day, opt.endDate) > 0) valid = false;
            days.push({
                date: day,
                type: 'lastMonth',
                day: day.getDate(),
                time: day.getTime(),
                valid: valid
            });
        }
    }
    var toMonth = d.getMonth();
    for (var i = 0; i < 40; i++) {
        today = moment(d).add(i, 'days').toDate();
        valid = isValidTime(today.getTime());
        if (opt.startDate && compare_day(today, opt.startDate) < 0) valid = false;
        if (opt.endDate && compare_day(today, opt.endDate) > 0) valid = false;
        days.push({
            date: today,
            type: today.getMonth() == toMonth ? 'toMonth' : 'nextMonth',
            day: today.getDate(),
            time: today.getTime(),
            valid: valid
        });
    }
    var html = [];
    for (var week = 0; week < 6; week++) {
        if (days[week * 7].type == 'nextMonth') break;
        html.push('<tr>');

        for (var day = 0; day < 7; day++) {
            var _day = (opt.startOfWeek == 'monday') ? day + 1 : day;
            today = days[week * 7 + _day];
            var highlightToday = moment(today.time).format('L') == moment(now).format('L');
            today.extraClass = '';
            today.tooltip = '';
            if (today.valid && opt.beforeShowDay && typeof opt.beforeShowDay == 'function') {
                var _r = opt.beforeShowDay(moment(today.time).toDate());
                today.valid = _r[0];
                today.extraClass = _r[1] || '';
                today.tooltip = _r[2] || '';
                if (today.tooltip !== '') today.extraClass += ' has-tooltip ';
            }

            var todayDivAttr = {
                time: today.time,
                'data-tooltip': today.tooltip,
                'class': 'day ' + today.type + ' ' + today.extraClass + ' ' + (today.valid ? 'valid' : 'invalid') + ' ' + (highlightToday ? 'real-today' : '')
            };

            if (day === 0 && opt.showWeekNumbers) {
                html.push('<td><div class="week-number" data-start-time="' + today.time + '">' + opt.getWeekNumber(today.date) + '</div></td>');
            }
            if(day == 0){
                html.push('<td class="hideSunday"' + attributesCallbacks({}, opt.dayTdAttrs, today) + '><div ' + attributesCallbacks(todayDivAttr, opt.dayDivAttrs, today) + '>' + showDayHTML(today.time, today.day) + '</div></td>');
            }else{
                html.push('<td ' + attributesCallbacks({}, opt.dayTdAttrs, today) + '><div ' + attributesCallbacks(todayDivAttr, opt.dayDivAttrs, today) + '>' + showDayHTML(today.time, today.day) + '</div></td>');
            }

        }
        html.push('</tr>');
    }
    return html.join('');
}
</code>```

In this function i have added class hideSunday while pushing the element.

The 2nd function is getWeekHead():

```<code>function getWeekHead() {
        var prepend = opt.showWeekNumbers ? '<th>' + translate('week-number') + '</th>' : '';
        if (opt.startOfWeek == 'monday') {
            return prepend + '<th>' + translate('week-1') + '</th>' +
                '<th>' + translate('week-2') + '</th>' +
                '<th>' + translate('week-3') + '</th>' +
                '<th>' + translate('week-4') + '</th>' +
                '<th>' + translate('week-5') + '</th>' +
                '<th>' + translate('week-6') + '</th>' +
                '<th class="hideSunday">' + translate('week-7') + '</th>';
        } else {
            return prepend + '<th class="hideSunday">' + translate('week-7') + '</th>' +
                '<th>' + translate('week-1') + '</th>' +
                '<th>' + translate('week-2') + '</th>' +
                '<th>' + translate('week-3') + '</th>' +
                '<th>' + translate('week-4') + '</th>' +
                '<th>' + translate('week-5') + '</th>' +
                '<th>' + translate('week-6') + '</th>';
        }
    }
</code>```

In this file, I have added class to week-7 header.

CSS:

```<code>.hideSunday{display:none;}
</code>```

Please note, I have not checked all the scenario but it will do trick for you.

Body:
I'm using the following jQuery date range picker library : http://longbill.github.io/jquery-date-range-picker/

I would like to remove / hide all Sundays from all date range pickers while keeping a normal behavior on the date range pickers.

I tried to do something with beforeShowDay option :

beforeShowDay: function(t) {
  var valid = t.getDay() !== 0; //disable sunday
  var _class = '';
  // var _tooltip = valid ? '' : 'weekends are disabled';
  return [valid, _class];
}

but it only "disables" all Sundays whereas I want to remove / hide them:

Here's the fiddle I'm working on : https://jsfiddle.net/maximelafarie/dnbd01do/11/

EDIT:
Updated fiddle with @Swanand code: https://jsfiddle.net/maximelafarie/dnbd01do/18/

Body:
You need do changes in two functions in your daterangepicker.js file:

createMonthHTML()

    function createMonthHTML(d) { var days = [];
    d.setDate(1);
    var lastMonth = new Date(d.getTime() - 86400000);
    var now = new Date();
    var dayOfWeek = d.getDay();
    if ((dayOfWeek === 0) && (opt.startOfWeek === 'monday')) {
        // add one week
        dayOfWeek = 7;
    }
    var today, valid;

    if (dayOfWeek > 0) {
        for (var i = dayOfWeek; i > 0; i--) {
            var day = new Date(d.getTime() - 86400000 * i);
            valid = isValidTime(day.getTime());
            if (opt.startDate && compare_day(day, opt.startDate) < 0) valid = false;
            if (opt.endDate && compare_day(day, opt.endDate) > 0) valid = false;
            days.push({
                date: day,
                type: 'lastMonth',
                day: day.getDate(),
                time: day.getTime(),
                valid: valid
            });
        }
    }
    var toMonth = d.getMonth();
    for (var i = 0; i < 40; i++) {
        today = moment(d).add(i, 'days').toDate();
        valid = isValidTime(today.getTime());
        if (opt.startDate && compare_day(today, opt.startDate) < 0) valid = false;
        if (opt.endDate && compare_day(today, opt.endDate) > 0) valid = false;
        days.push({
            date: today,
            type: today.getMonth() == toMonth ? 'toMonth' : 'nextMonth',
            day: today.getDate(),
            time: today.getTime(),
            valid: valid
        });
    }
    var html = [];
    for (var week = 0; week < 6; week++) {
        if (days[week * 7].type == 'nextMonth') break;
        html.push('<tr>');

        for (var day = 0; day < 7; day++) {
            var _day = (opt.startOfWeek == 'monday') ? day + 1 : day;
            today = days[week * 7 + _day];
            var highlightToday = moment(today.time).format('L') == moment(now).format('L');
            today.extraClass = '';
            today.tooltip = '';
            if (today.valid && opt.beforeShowDay && typeof opt.beforeShowDay == 'function') {
                var _r = opt.beforeShowDay(moment(today.time).toDate());
                today.valid = _r[0];
                today.extraClass = _r[1] || '';
                today.tooltip = _r[2] || '';
                if (today.tooltip !== '') today.extraClass += ' has-tooltip ';
            }

            var todayDivAttr = {
                time: today.time,
                'data-tooltip': today.tooltip,
                'class': 'day ' + today.type + ' ' + today.extraClass + ' ' + (today.valid ? 'valid' : 'invalid') + ' ' + (highlightToday ? 'real-today' : '')
            };

            if (day === 0 && opt.showWeekNumbers) {
                html.push('<td><div class="week-number" data-start-time="' + today.time + '">' + opt.getWeekNumber(today.date) + '</div></td>');
            }
            if(day == 0){
                html.push('<td class="hideSunday"' + attributesCallbacks({}, opt.dayTdAttrs, today) + '><div ' + attributesCallbacks(todayDivAttr, opt.dayDivAttrs, today) + '>' + showDayHTML(today.time, today.day) + '</div></td>');
            }else{
                html.push('<td ' + attributesCallbacks({}, opt.dayTdAttrs, today) + '><div ' + attributesCallbacks(todayDivAttr, opt.dayDivAttrs, today) + '>' + showDayHTML(today.time, today.day) + '</div></td>');
            }

        }
        html.push('</tr>');
    }
    return html.join('');
}

In this function i have added class hideSunday while pushing the element.

The 2nd function is getWeekHead():

function getWeekHead() {
        var prepend = opt.showWeekNumbers ? '<th>' + translate('week-number') + '</th>' : '';
        if (opt.startOfWeek == 'monday') {
            return prepend + '<th>' + translate('week-1') + '</th>' +
                '<th>' + translate('week-2') + '</th>' +
                '<th>' + translate('week-3') + '</th>' +
                '<th>' + translate('week-4') + '</th>' +
                '<th>' + translate('week-5') + '</th>' +
                '<th>' + translate('week-6') + '</th>' +
                '<th class="hideSunday">' + translate('week-7') + '</th>';
        } else {
            return prepend + '<th class="hideSunday">' + translate('week-7') + '</th>' +
                '<th>' + translate('week-1') + '</th>' +
                '<th>' + translate('week-2') + '</th>' +
                '<th>' + translate('week-3') + '</th>' +
                '<th>' + translate('week-4') + '</th>' +
                '<th>' + translate('week-5') + '</th>' +
                '<th>' + translate('week-6') + '</th>';
        }
    }

In this file, I have added class to week-7 header.

CSS:

.hideSunday{display:none;}

Please note, I have not checked all the scenario but it will do trick for you.