text:
Q: timer library using JavaScript I have a timer library from EasyTimer.
Every time, i start my timer, it will start from 00:00:00
How do i make my timer to start timer from <?php echo $timer; ?>
For example start timer from 00:00.30.
$timer value comes from DB.
source code: https://albert-gonzalez.github.io/easytimer.js/#chronoHtml
PHP:

    Timer:

        <?php if ($update == true): ?>

<?php echo $timer; ?>

        <?php else: ?>

00:00:00

        <?php endif ?>

            <button type="button" class="startButton btn btn-default">Start</button>
            <button type="button" class="pauseButton btn btn-default">Pause</button>
            <button type="button" class="resetButton btn btn-default">Reset</button>

    <input type="hidden" id="timerdata" name="timer">

Easytimer.js:
    var timer = new Timer();
$('#chronoExample .startButton').click(function () {
    timer.start();
});
$('#chronoExample .pauseButton').click(function () {
    timer.pause();
});
$('#chronoExample .stopButton').click(function () {
    timer.stop();
});
$('#chronoExample .resetButton').click(function () {
    timer.reset();
});
timer.addEventListener('secondsUpdated', function (e) {
    $('#chronoExample .values').html(timer.getTimeValues().toString());
});
timer.addEventListener('started', function (e) {
    $('#chronoExample .values').html(timer.getTimeValues().toString());
});
timer.addEventListener('reset', function (e) {
    $('#chronoExample .values').html(timer.getTimeValues().toString());
});

Easytimer.min.js:
!function (t, n) {
    "object" == typeof exports && "undefined" != typeof module ? module.exports = n() : "function" == typeof define && define.amd ? define(n) : t.Timer = n()
}(this, function () {
    "use strict";

    function s(t, n, e) {
        var o = void 0, i = "";
        if (t.length > n) return t;
        for (o = 0; o < n; o += 1) i += String(e);
        return (i + t).slice(-i.length)
    }

    function P() {
        this.secondTenths = 0, this.seconds = 0, this.minutes = 0, this.hours = 0, this.days = 0, this.toString = function (t, n, e) {
            t = t || ["hours", "minutes", "seconds"], n = n || ":", e = e || 2;
            var o = [], i = void 0;
            for (i = 0; i < t.length; i += 1) void 0 !== this[t[i]] && ("secondTenths" === t[i] ? o.push(this[t[i]]) : o.push(s(this[t[i]], e, "0")));
            return o.join(n)
        }
    }

    var t = "undefined" != typeof window ? window.CustomEvent : void 0;
    "undefined" != typeof window && "function" != typeof t && ((t = function (t, n) {
        n = n || {bubbles: !1, cancelable: !1, detail: void 0};
        var e = document.createEvent("CustomEvent");
        return e.initCustomEvent(t, n.bubbles, n.cancelable, n.detail), e
    }).prototype = window.Event.prototype, window.CustomEvent = t);
    var q = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) {
            return typeof t
        } : function (t) {
            return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t
        }, I = "secondTenths", O = "seconds", z = "minutes", R = "hours", B = "days",
        F = {secondTenths: 100, seconds: 1e3, minutes: 6e4, hours: 36e5, days: 864e5},
        G = {secondTenths: 10, seconds: 60, minutes: 60, hours: 24},
        H = "undefined" != typeof module && module.exports && "function" == typeof require ? require("events") : void 0;

    function J() {
        return "undefined" != typeof document
    }

    function K() {
        return H
    }

    function N(t, n) {
        return (t % n + n) % n
    }

    return function () {
        var s = new P, r = new P, i = void 0,
            e = J() ? document.createElement("span") : K() ? new H.EventEmitter : void 0, u = !1, d = !1, c = void 0,
            a = void 0, f = void 0, v = {}, h = void 0, l = void 0, p = void 0, m = void 0, y = void 0, o = void 0,
            b = {detail: {timer: this}};

        function w(t, n) {
            var e, o, i = r[n];
            return o = U(t, F[e = n]), r[e] = o, s[e] = e === B ? o : 0 <= o ? N(o, G[e]) : G[e] - N(o, G[e]), r[n] !== i
        }

        function t() {
            n(), function () {
                for (var t in s) s.hasOwnProperty(t) && "number" == typeof s[t] && (s[t] = 0);
                for (var n in r) r.hasOwnProperty(n) && "number" == typeof r[n] && (r[n] = 0)
            }()
        }

        function n() {
            clearInterval(i), i = void 0, d = u = !1
        }

        function g(t) {
            var n, e, o;
            M() ? (y = E(), l = V(h.target)) : (c = "string" == typeof(e = (e = t) || {}).precision ? e.precision : O, f = "function" == typeof e.callback ? e.callback : function () {
            }, m = !0 === e.countdown, a = !0 === m ? -1 : 1, "object" === q(e.startValues) ? (o = e.startValues, p = L(o), s.secondTenths = p[0], s.seconds = p[1], s.minutes = p[2], s.hours = p[3], s.days = p[4], r = A(p, r)) : p = null, y = E(), S(), "object" === q(e.target) ? l = V(e.target) : m ? (e.target = {seconds: 0}, l = V(e.target)) : l = null, v = {
                precision: c,
                callback: f,
                countdown: "object" === (void 0 === e ? "undefined" : q(e)) && !0 === e.countdown,
                target: l,
                startValues: p
            }, h = e), n = F[c], C(j(Date.now())) || (i = setInterval(T, n), d = !(u = !0))
        }

        function E() {
            return j(Date.now()) - r.secondTenths * F[I] * a
        }

        function T() {
            var t, n = j(Date.now());
            (t = S())[I] && k("secondTenthsUpdated", b), t[O] && k("secondsUpdated", b), t[z] && k("minutesUpdated", b), t[R] && k("hoursUpdated", b), t[B] && k("daysUpdated", b), f(b.detail.timer), C(n) && (D(), k("targetAchieved", b))
        }

        function S() {
            var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : j(Date.now()),
                n = 0 < a ? t - y : y - t, e = {};
            return e[I] = w(n, I), e[O] = w(n, O), e[z] = w(n, z), e[R] = w(n, R), e[B] = w(n, B), e
        }

        function j(t) {
            return Math.floor(t / F[c]) * F[c]
        }

        function C(t) {
            return l instanceof Array && o <= t
        }

        function L(t) {
            var n, e, o, i, s, r = void 0;
            if ("object" === (void 0 === t ? "undefined" : q(t))) if (t instanceof Array) {
                if (5 !== t.length) throw new Error("Array size not valid");
                r = t
            } else r = [t.secondTenths || 0, t.seconds || 0, t.minutes || 0, t.hours || 0, t.days || 0];
            return n = r[0], e = r[1] + U(n, 10), o = r[2] + U(e, 60), i = r[3] + U(o, 60), s = r[4] + U(i, 24), r[0] = n % 10, r[1] = e % 60, r[2] = o % 60, r[3] = i % 24, r[4] = s, r
        }

        function U(t, n) {
            var e = t / n;
            return e < 0 ? Math.ceil(e) : Math.floor(e)
        }

        function V(t) {
            if (t) {
                var n = A(l = L(t));
                return o = y + n.secondTenths * F[I] * a, l
            }
        }

        function A(t, n) {
            var e = n || {};
            return e.days = t[4], e.hours = 24 * e.days + t[3], e.minutes = 60 * e.hours + t[2], e.seconds = 60 * e.minutes + t[1], e.secondTenths = 10 * e.seconds + t[[0]], e
        }

        function D() {
            t(), k("stopped", b)
        }

        function k(t, n) {
            J() ? e.dispatchEvent(new CustomEvent(t, n)) : K() && e.emit(t, n)
        }

        function x() {
            return u
        }

        function M() {
            return d
        }

        void 0 !== this && (this.start = function (t) {
            x() || (g(t), k("started", b))
        }, this.pause = function () {
            n(), d = !0, k("paused", b)
        }, this.stop = D, this.reset = function () {
            t(), g(h), k("reset", b)
        }, this.isRunning = x, this.isPaused = M, this.getTimeValues = function () {
            return s
        }, this.getTotalTimeValues = function () {
            return r
        }, this.getConfig = function () {
            return v
        }, this.addEventListener = function (t, n) {
            J() ? e.addEventListener(t, n) : K() && e.on(t, n)
        }, this.removeEventListener = function (t, n) {
            J() ? e.removeEventListener(t, n) : K() && e.removeListener(t, n)
        })
    }
});

A: The EasyTimer.js Docs has an example of setting the start time.
Essentially, you just need to pass the start time to the timer object

But you may have to change the way you store or echo the $timer in the


text:
Q: How to model a dimension table that link to several facts with different level of grain? I have a fact that store client's address. Problem is, the client can choose to insert information at state level, or county level, or street level. In the operation database, there is 1 table for streets, link to another table for counties, link to another table for states. The client table has 1 column for state, 1 column for county, 1 column for street that contain ID (so can link to higher object in the hierarchy)
How can I model the relationship between the fact and the dimension in a star-schema?
So I created one Location dimension with all states, all counties, all streets. The table look like this:

DIM_ID  | Level     | Street columns        | County columns        | State columns
1       | Street    | Bolsa                 | Westminton            | California
2       | County    | Westminton [county]   | Westminton            | California
3       | State     | [State of] California | [State of] California | California

If client disclose street then fact record link to row 1, client disclose county level then fact record link to row 2, client disclose only state then fact record link to row 3.
What do you think of that approach?

A: I would probably model these levels separately, as they are being treated as separate, i.e.:

*

*dim.Street

*dim.County

*dim.State

As for relating these to clients, I'd go for bridge tables, e.g.:
CREATE TABLE ClientStreet
(
    ClientID
    , StreetID
)

Etc.
And if you cannot provide a Street without providing a County and State, or provide a County without providing a State, I would have within dim.Street, CountyID, and within dim.County, StateID, i.e. a hierarchical structure.
EDIT
With regards to your client dimensions with 3 IDs, this could also be a good model.
With regards to my hierarchical structure, and data modelling in general, I feel the way you model it really needs to:

*

*Reflect reality (e.g., recording a client's Street as "[State of] California" seems inaccurate to me).

*Reflect the reality of what is possible in terms of incoming data, i.e. do your clients input their address once, or can they change it (do you want to track changes?)?

One thing I'm wondering is if whether your clients have to pick one and only one of these levels to record their address at. In this case, I'd have either the model I'd suggested above, or I'd have client dimension with 3 IDs, and a CHECK CONSTRAINT to ensure that only one of these was ever populated. This would then be supported be the fact that a Street would have a CountyID, etc. So you would determine this kind of "channel" by which ID is populated in the client dimension.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Export to Excel on Angular 5 exportAsExcelFile(json: any[], excelFileName: string): void {
  const worksheet: XLSX.WorkSheet = XLSX.utils.table_to_sheet(json);
  const workbook: XLSX.WorkBook = {
    Sheets: {
      'data': worksheet
    },
    SheetNames: ['data']
  };
  XLSX.writeFile(workbook, `${excelFileName}_${new Date().toLocaleDateString()}.xlsx`);
}

I didn't download to file.I didn't encounter this problem on PC, I only have any problem with Tablet.

A:
This may help you

You need to created ExcelService
https://stackblitz.com/edit/angular6-export-xlsx

A: If you have an array
you can use json_to_sheet():
import {writeFileXLSX, utils} from 'xlsx';

///...

exportToExcel(): void {
    const data = this.data$.getValue();
    const excelBook = utils.book_new();
    const excelSheet = utils.json_to_sheet(data);
    utils.book_append_sheet(excelBook, excelSheet, 'sheet_name');
    writeFileXLSX(excelBook, "table.xlsx");
}


text:
Q: Implement Async validator on Angular FormControl I followed the short guide on Angular's website for Creating asynchronous validators that can be found at this url.
https://angular.io/guide/form-validation#implementing-a-custom-async-validator
As a result, I have this code:
import { AsyncValidator, AbstractControl, ValidationErrors } from '@angular/forms';
import { Observable, of } from 'rxjs';
import { map, catchError } from 'rxjs/operators';
import { CompanyService } from '../services/company/company.service';

@Injectable({ providedIn: 'root' });

export class UniqueCompanyNameValidator implements AsyncValidator {

  constructor(private companyService: CompanyService) { }

  validate(
    ctrl: AbstractControl
  ): Promise<ValidationErrors | null> | Observable<ValidationErrors | null> {
    return this.companyService.CheckName(ctrl.value).pipe(
      map(isTaken => (isTaken ? { uniqueCompanyName: true } : null)),
      catchError(() => of(null))
    );
  }
}

How do I add into my form control to actually use this custom validator? I tried to import the validator into my component and then adding it to the FormControl like the following code shows but got an error.
import { UniqueCompanyNameValidator } from '../../../shared/validators/custom.validators';

'company' : new FormControl(null, { validators: [Validators.required, Validators.minLength(2)], updateOn: 'blur' }, [UniqueCompanyNameValidator]),

The error that I got was the following:
Type 'typeof UniqueCompanyNameValidator' is not assignable to type 'AsyncValidatorFn'.
  Type 'typeof UniqueCompanyNameValidator' provides no match for the signature '(control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null>'.

(alias) class UniqueCompanyNameValidator
import UniqueCompanyNameValidator

A: It must be a function/validator instance, not injectable token (class/type). In your example to make it work you have to pass validate function, not Service token. Assuming that it is this.companyService it would be like
new FormControl(null, { validators: [Validators.required, Validators.minLength(2)], updateOn: 'blur' }, [this.comapnyService.validate.bind(this.companyService)]),

or maybe (I never use that variant)
new FormControl(null, { validators: [Validators.required, Validators.minLength(2)], updateOn: 'blur' }, [this.comapnyService]),

I would create a ValidatorFn factory method that takes required service as and argument and go from there.
export class MyValidators{

  static uniqueCompanyName(companyService:SompanyService){
     return (ctrl:AbstractControl)=>{
         return companyService.doCheCkeck(ctrl.value).pipe(
            map(isTaken => (isTaken ? { uniqueCompanyName: true } : null))
         );
      }

  }
}

and then
'company' : new FormControl(null, { validators: [Validators.required, Validators.minLength(2)], updateOn: 'blur' }, [MyValidators.uniqueCompanyName(companyServiceInstance)]),

A: I must admit that the guide you linked is misleading for beginners. You could use the given service to create a directive which will inject UniqueAlterEgoValidator.
like so:
@Injectable({ providedIn: 'root' })
export class UniqueAlterEgoValidator implements AsyncValidator {
  constructor(private heroesService: HeroesService) {}

  validate(
    ctrl: AbstractControl
  ): Promise<ValidationErrors | null> | Observable<ValidationErrors | null> {
    return this.heroesService.isAlterEgoTaken(ctrl.value).pipe(
      map(isTaken => (isTaken ? { uniqueAlterEgo: true } : null)),
      catchError(() => of(null))
    );
  }
}

@Directive({
  selector: '[myValidator]',
  providers: [{provide: NG_VALIDATORS, useExisting: MyValidatorDirective , multi: true}]
})
export class MyValidatorDirective implements AsyncValidator {

  constructor(private validator: UniqueAlterEgoValidator) {}

  validate(control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null> {
    return this.validator.validate(control);
  }
}

With a template driven form: create a Directive that implements AsyncValidator.
With a reactive form: create a function that returns a AsyncValidatorFn.
See the angular guide about custom validators.


text:
Q: Restrict Visual Studio Code -> Deploy to function app Deploying code directly to a function app through visual studio code extension is really handy feature but we want to restrict our team using this feature to follow strict CI/CD pipeline.
Is there any way we can block deployment to Function App through Visual Studio Code and allow deployment only through CI/CD pipeline?

A: It's a personal choice of a developer and sort of a practice that you need to follow within your team. There is no way to restrict publishing from VScode!


text:
Q: Aligning text inside a link, inside a div I have been trying for a long time.. But I can not align a section of text inside a link, which is inside a div.
This may sound really confusing. This is an example of what I have:
http://jsfiddle.net/caoj5c36/
As you can see when you scroll over "Pygame" I want the description "Coming Soon.." to be centered inside the button.
Any suggestions?
I have tried using
text-align: center;

in every possible combinations of html tags in my css script

A: It's because p is absolutely positioned. It makes it run out of the flow of the elements... So, you'll have to make it expand to 100% width of the parent a, and then you can use text-align: center
Updated JsFiddle
#button_layout #info_text {
    /*description is invisible until hover */
    font-size: 16px;
    visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    text-align: center;
}

A: Its simple:
#button_layout #info_text {
    width: 100%
}

So your Link has the width of the div to center the text in it.
You shouldn't use IDs like this. IDs should only be used once on a page, use classes instead.


text:
Q: Does Windows Media Foundation on UWP have a resampler? If so how do I use it? Using Win32 I have access to CLSID_CResamplerMediaObject which means I can reduce my channel count from say 6 to 2.
On UWP this is no longer defined and the only reference to a resampler I can find is CLSID_AudioResamplerMediaObject. When I create an instance of this class however, and pass it my MFMediaType_Float or MFMediaType_PCM type, it says that the provided types aren't supported...
ComPtr<IUnknown> pTransformUnknown = nullptr;
DxUtil::ThrowIfFailed(CoCreateInstance(CLSID_AudioResamplerMediaObject, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, &pTransformUnknown));
DxUtil::ThrowIfFailed(pTransformUnknown->QueryInterface(IID_PPV_ARGS(&mResampler)));

IMFMediaType* pInputType = nullptr;
DxUtil::ThrowIfFailed(MFCreateMediaType(&pInputType));
DxUtil::ThrowIfFailed(pInputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio));
DxUtil::ThrowIfFailed(pInputType->SetGUID(MF_MT_SUBTYPE, MFAudioFormat_PCM)); // Or MFAudioFormat_Float
DxUtil::ThrowIfFailed(pInputType->SetUINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, 16));
DxUtil::ThrowIfFailed(pInputType->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS, 6));
DxUtil::ThrowIfFailed(pInputType->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, 48000));
DxUtil::ThrowIfFailed(mAudioSourceReader->SetCurrentMediaType(MF_SOURCE_READER_FIRST_AUDIO_STREAM, nullptr, pInputType)); // Fails here!

As usual, Microsoft docs aren't helpful, I would appreciate any help!
Input file is Mp4 with 1 aac stream, 6 channels, 16 bit audio.

A: CLSID_AudioResamplerMediaObject and CLSID_CResamplerMediaObject are the same thing, same GUID of {f447b69e-1884-4a7e-8055-346f74d6edb3}.
The error you mentioned is not coming from audio resampler, you have it from Source Reader API. The error is presumably correctly reported indicating the situation that for given media source the reader cannot provide a conversion to supplied media type. There can be multiple reasons for this to happen.


text:
Q: mysqli_query() returns something that is NOT an Object i seem to have a problem with this code, im trying to use mysqli_connect() and mysqli_query() to query the Database, but the code is NOT returning a mysqli Object and i dont know why.
I Made my own code to format the Queries and im sure is not failing because im checking everytime:
( IM USING XAMPP, testing using localhost ), Could it be that the php installed is corrupt?? )
<?php
//error_reporting(~E_ALL);

require 'errorReporting.php';

$mysqli_host = 'localhost';
$mysqli_user = 'root';
$mysqli_pass = NULL;
$mysqli_name = 'gsistel';

$mysqli_link = mysqli_connect($mysqli_host, $mysqli_user, $mysqli_pass, $mysqli_name) or die('SQL ERROR COULD NOT CONNECT TO DB');

mysqli_select_db($mysqli_link, $mysqli_name) or die('SQL ERROR COULD NOT SELECT DB');

function fQuery($table, $operation, $selectionColumns, $iouValues, $whereColumns, $whereValues, $orderBy, $orderClause) {
    $operation = strtoupper($operation);
    switch($operation) {
        case 'SELECT':
            global $mysqli_link;
            $mysqli_query = 'SELECT ';
            $selection = '';

            for($i = 0; $i < count($selectionColumns); $i++) {
                if(count($selectionColumns) == 1) {
                    $selection = $selectionColumns[0];
                }else if($i == count($selectionColumns)-1) {
                    $selection = $selection . $selectionColumns[$i];
                }else {
                    $selection = $selection . $selectionColumns[$i] . ', ';
                }
            }
            $mysqli_query = $mysqli_query . $selection . ' FROM ' . $table . ' ';

            $whereSelection = '';
            if($whereColumns != null && (count($whereColumns == count($whereValues)))) {
                $mysqli_query = $mysqli_query . ' WHERE ';
                for($i = 0; $i < count($whereColumns); $i++) {
                    if(count($whereColumns) == 1) {
                        $whereSelection = $whereColumns[0] . '=\'' . $whereValues[0] . '\'';
                    }else if($i == 0){
                        $whereSelection = $whereSelection . $whereColumns[$i] . '=\'' . $whereValues[$i] . '\'';
                    }else {
                        $whereSelection = $whereSelection . ' AND ' . $whereColumns[$i] . '=\'' . $whereValues[$i] . '\'';
                    }
                }
                $mysqli_query = $mysqli_query . $whereSelection . ' ';
            }

            if($orderBy != null) {
                $mysqli_query = $mysqli_query . ' ORDER BY ' . $orderClause;
            }

            return $mysqli_result = mysqli_query($mysqli_link, $mysqli_query) or die(reportFriendlyError('SQL SELECT', 'ERROR: SQL QUERY FAILED
' . $mysqli_query));

            break;
        case 'INSERT':
            $mysqli_query = 'INSERT INTO ' . $table . ' VALUES (';
            for($i = 0; $i < count($iouValues); $i++) {
                if($i == count($iouValues)-1) {
                    if(strtoupper($iouValues[$i]) == 'NULL') {
                        $mysqli_query = $mysqli_query . $iouValues[$i] . ')';
                    }else {
                        $mysqli_query = $mysqli_query . '\'' . $iouValues[$i] . '\'' . ')';
                    }
                }else {
                    if(strtoupper($iouValues[$i]) == 'NULL') {
                        $mysqli_query = $mysqli_query . $iouValues[$i] . ', ';
                    }else {
                        $mysqli_query = $mysqli_query . '\'' . $iouValues[$i] . '\'' . ', ';
                    }
                }
            }
            return $mysqli_query;
            //TODO: Executa query
            break;
        case 'UPDATE':
            $mysqli_query = 'UPDATE ' . $table . ' SET ';
            for($i = 0; $i < count($selectionColumns); $i++) {
                if($i == count($selectionColumns)-1) {
                    $mysqli_query = $mysqli_query . $selectionColumns[$i] . '=\'' . $iouValues[$i] . '\'';
                }else {
                    $mysqli_query = $mysqli_query . $selectionColumns[$i] . '=\'' . $iouValues[$i] . '\', ';
                }
            }

            if($whereColumns != null && (count($whereColumns) == count($whereValues))) {
                $mysqli_query = $mysqli_query . ' WHERE ';
                for($i = 0; $i < count($whereColumns); $i++) {
                    if($i == count($whereColumns)-1) {
                        $mysqli_query = $mysqli_query . $whereColumns[$i] . '=\'' . $whereValues[$i] . '\'';
                    }else {
                        $mysqli_query = $mysqli_query . $whereColumns[$i] . '=\'' . $whereValues[$i] . '\', ';
                    }
                }
            }
            return $mysqli_query;
            //TODO: Execute query
            break;
        case 'DELETE':
            $mysqli_query = 'DELETE FROM ' . $table . ' WHERE ';
            for($i = 0; $i < count($whereColumns); $i++) {
                if($i == count($whereColumns)-1) {
                    $mysqli_query = $mysqli_query . $whereColumns[$i] . '=\'' . $whereValues[$i] . '\'';
                }else {
                    $mysqli_query = $mysqli_query . $whereColumns[$i] . '=\'' . $whereValues[$i] . '\', ';
                }
            }
            return $mysqli_query;
            //TODO: execute query
            break;
        default:
            return false;
            break;
    }
}

?>

im using the code here to test:
The mysqli_query() returns something other than false, but its not a mysqli Object.
I also get the warning:
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\Guardian2\login.php on line 19
<?php

require 'connect.php';

$mysqli_object = fQuery('users', 'SELECT', array('username'), null, array('username') , array('admin'), null, null);

if($mysqli_object === false) {
    echo 'FAIL';
}

if(is_object($mysqli_object)) {
    echo 'IS OBJECT';
}else {
    echo 'IS NOT OBJECT';
}

$user = '';

while($row = mysqli_fetch_array($mysqli_object)) {
    echo $user = $row['username'];
}

?>

A: Replace:
return $mysqli_result = mysqli_query($mysqli_link, $mysqli_query) or die(reportFriendlyError('SQL SELECT', 'ERROR: SQL QUERY FAILED
' . $mysqli_query));

with:
$mysqli_result = mysqli_query($mysqli_link, $mysqli_query) or die(reportFriendlyError('SQL SELECT', 'ERROR: SQL QUERY FAILED
' . $mysqli_query));
return $mysqli_result;

in your case 'SELECT' branch.


text:
Q: Bootstrap carousel is not working properly I am trying to use Bootstrap carousel in my website but I am not able to center the content in the carousel. I've tried using Grid but that didn't work out well. How can I solve this problem? Please take a look at my code and the image that has been provided below. I haven't used any CSS yet for the carousel.

                                                WEB DEVELOPMENT

Lorem
                                                ipsu dolor sit amet consectetur adipisicing
                                                elit.
                                                Consequatur perspiciatis quas exercitationem natus? Magnam molestiae
                                                unde
                                                praesentium, quidem soluta incidunt enim dolore veritatis at quis
                                                molestias
                                                corporis
                                                quod inventore porro!

                                                MARKETING

                                                Lorem
                                                ipsum dolor sit amet consectetur adipisicing
                                                elit.
                                                Consequatur perspiciatis quas exercitationem natus? Magnam molestiae
                                                unde
                                                praesentium, quidem soluta incidunt enim dolore veritatis at quis
                                                molestias
                                                corporis
                                                quod inventore porro!

Please check this image to see the carousel problem

A: You should be able to use position to do that.
If you add:
.carousel-item {
   position: relative;
}

.card {
   position: absolute;
   left: 50%;
   top: 50%;
   transform: translate(50%, 50%);
}

Your content should get centered in the middle of the slide. :)

A: Try the below one.. add style="margin:auto" to card

John Doe

Some example text.

      See Profile

A: Since you are using bootstrap classes:
Trying using d-flex justify-content-center align-items-center on parent div element.
Also, I strongly suggest you stop using css inline styling and put your css into a separate file.


text:
Q: Embed HTML in JSF I'm new to JSF. I'm having a problem with my JSF applciation.
I need to display user's input HTML contents (which created with Primefaces editor) in my application. Users need to print it out on papers with browser's "Print" function.
<h:outputText value="#{backingBean.htmlContents}" escape="false" />

Most of the time it works fine but sometimes the page does not render correctly. I suspect it was caused by mixing up JSF tags and HTML tags!?
I tried to use:
<p:editor disabled="true" value="#{backingBean.htmlContents}">

instead. But it does not display everything when the content is too long. and it seems that there is no way to make it auto resize its height based on the length of the content.
Does anyone have the same problem? how did you solve it?
Any help will be greatly appreciated.


text:
Q: How much text will end up on a page? ---Edit:
In response to David Carlisle's answer, here is an actual scenario where the problem occurs.
I have two Bible texts in two languages. Let's say English and Spanish.
The basic idea of presenting the text in parallel has been addressed by the following question. Syncing text on bilingual pages
The remaining problem is that I need to get the verses synced per page. The current proposed solution goes out of sync really quickly.
So that for instance Genesis chapter 20 verse 5 of the English and Spanish is on the same set of pages.
So I was thinking about adding a \pdfsavepos at the end of the verse and dumping it into an aux file. This would produce an aux file where the verses would be something like:
book01chapter01verse001=10000ypos
book01chapter01verse002=15000ypos
book01chapter01verse003=20000ypos

and then where a page break occurs:
book01chapter01verse009=50000ypos
book01chapter01verse010=10000ypos

But since I want full verses on each page I will have to do an "if yposCurrent > yposNext then insert \newpage before current verse" for every page. Then it gets messy since the aux file needs to be updated for this verse and the subsequent verses.
Then the compiler needs to be run again. And it will very likely find the same occurrence on the very next page.
So I'll probably end up doing about a thousand compiler runs just to produce the PDF.
---Original post:
In many of my past projects this question has arisen. How can I find out how much of the actual text will LaTeX place on the current page?
LaTeX obviously has a mathematical way of counting and distributing the letters/words (boxes) involved for the text. Using that to calculate how much to place on the page and spread it out to justify it etc.
So when page 1 is done it knows where in the original text to start for page 2, and when page 3 is done the same for page 4 and so on. So somehow it not only calculates these parameters but also keeps track of it.
Now, I want to know if it is possible for me to get a hold of these parameters to be able to parse my text through LaTeX and get this data stored in a variable of where exactly my text will be broken up? (Without hacking into TeX and having to rewrite parts of it, by the way...)
Previous suggested solutions mentioned writing certain "milestones/waypoints" to an aux "log" file which can be used on the next run to adjust your text, but that solution won't fully work for my problem. Since I use source texts which are very large and if you do it by means of a log file then you need a compilation run for every time you adjust any text on any page. And if any of the subsequent pages needs adjusting, then you need another compilation run for that page whilst writing the new "milestones" to the log file, which again requires another run to process and adjust the subsequent text. So on my book which is over a thousand pages, I'll be sitting all day having to compile it. Then if I need to go back to page 23 to fix a minor mistake in the text, I'll probably end up having to compile the whole thing over again about 900 times.
Therefore as far as I can see, I need the variable with the page break data, and be able to adjust this in one compilation run. So that I can then manually do the needed adjustments to my texts and then let LaTeX place it in the correct place.
A bit like a massive FOR loop working on the text in the variable...
In summary: The problem might seem a bit vague to you but I really just need to be able to figure out how much TeX would place on a page, and that's it.

A: The line breaking and page breaking in TeX work in two asynchronous passes and there is no feedback back from the page breaker to the line breaker. (I'm ignoring luatex in this answer as it makes some things I say wrong). So conceptually The document input is broken up at each paragraph end and placed on an infinite scroll, then every now and then the output routine is invoked which chops off sufficient part of the scroll to make up a page, adding in floating figures page head and foot etc. The thing to note here is that much of the next page (or pages) have already been set by this time.
Basically This assumption isn't true:

So when page 1 is done it knows where in the original text to start
  for page 2, and when page 3 is done the same for page 4 and so on. So
  somehow it not only calculates these parameters but also keeps track
  of it.

At the time of the page breaking TeX is only seeing a vertical list of boxes, it has no track of how those boxes relate to the original source.
If you could edit your question to be more specific about exactly what information you need to pass to each page we can probably help. Classic texniques such as \mark and writing to the aux file as you note can help, also \pdfsavepos is very useful in this context. Or, if luatex is an option, lua callbacks give far more control/information than has traditionally been available in TeX.


text:
Q: Is there a method to map screens I was creating a quiz app using react native. For that I need 10 screens with different questions and options(i.e. same layout. Only questions and options are changed). So for achieving this, is there any method to map through each element of array of questions and display it in each screen respectively ? Or do I need to achieve it manually?  (I am using stack navigator for navigation)

A: Pass current question number as index when you navigation to question/answers screen - first time pass 0.
Then show question like QuestionArray[index]. And when you want to go to next question just increase index by 1 and push same screen to navigation with index and so on. You can check current index value before pushing the screen to navigation stack that if value is already 9, calculate the result and replace stack with result screen

A: You can use Flatlist to map through each element
<Flatlist
 data={QuizArr}
 renderItem={({ Ques, Ans, onNext })=><RenderQuiz {...{ Ques, Ans, onNext }} />}
 keyExtractor={item => item.id}
/>

RenderQuiz=({ Ques, Ans, onNext })=>{
 return(
   // Your Code
 )
}


text:
Q: How come stack trace line numbers don't match source code line numbers? My app crashed with an NPE on my device. In the Stack trace received with ACRA, the line numbers refer to two source code classes, SQLiteStatement and SQLiteDatabase. For SQLiteDatabase, none of the line numbers match the lines numbers in any of the source code versions. My device doesn't have a custom ROM. It's a Galaxy S2 running Android 4.03.
Here's the stack trace:
java.lang.NullPointerException
at android.database.sqlite.SQLiteStatement.releaseAndUnlock(SQLiteStatement.java:290)
at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:96)
at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:2025)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1965)
at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:690)
at android.database.sqlite.SQLiteDatabase.beginTransactionNonExclusive(SQLiteDatabase.java:605)
at android.database.sqlite.SQLiteStatement.acquireAndLock(SQLiteStatement.java:247)
at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:112)
at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1844)
at com.mydomain.myapp.albums.AlbumsData.insertOrIgnore(AlbumsData.java:89)

If you look at the source for SQLiteDataBase in its different versions you can check for yourselves the numbers don't match.
For example, in Android 4.03's SQLiteDataBase source, executesql(...) is found on line 1892 whereas my stack trace says it is located on line 2025.
How is this possible?
(Please note I'm not asking about the source of the NPE)

A: All of the internal errors are being caused by this line in your code:
com.mydomain.myapp.albums.AlbumsData.insertOrIgnore(AlbumsData.java:89)

You need to go to that and figure out what is going on with it. I am in agreement with @323go you are probably passing it a null value of some sort. Once you get that taken care of the internal stuff should go away.
As to why the line numbers are different. You are looking at the bare bones stock system source code. By the time it makes it onto a device and into a consumers hands it will likely have been changed a fair bit, I don't know specifically why or what they would change in the SQLiteDatabase class but it appears they have changed something.

A: I wouldn't be sure official android sources matches android version on your phone. I think samsung may changed android for it's own purposes: samsung guys took android 4.0.3 sources, modified them, added some stuff to different classes (SQLiteDatabase seems to be one of them), then build it and got their own version of android. They didn't modify constants that shows version of android so you can see that it's 'still' 4.0.3.


text:
Q: Use 'dd' to split the binary apart and extract the parts I have firmware file in .bin format, but need to obtain the romimage.img and Kernel uImage files required to reflash a bricked device.
I used Binwalk to identify different parts of a firmware binary, $ binwalk firmware.bin
DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
392           0x188           uImage header, header size: 64 bytes, header CRC: 0xEF73A583, created: 1969-12-31 23:59:59, image size: 1572736 bytes, Data Address: 0x20008000, Entry Point: 0x20008000, data CRC: 0x3661C6EC, OS: Linux, CPU: ARM, image type: OS Kernel Image, compression type: none, image name: "SP2Xcybertan_rom_bin"
13596         0x351C          gzip compressed data, maximum compression, from Unix, last modified: 2019-04-03 05:25:36
1573192       0x180148        uImage header, header size: 64 bytes, header CRC: 0x9053B22D, created: 1969-12-31 23:59:59, image size: 8474624 bytes, Data Address: 0x0, Entry Point: 0x0, data CRC: 0xFC8655E0, OS: Linux, CPU: ARM, image type: Filesystem Image, compression type: none, image name: "SP2Xcybertan_rom_bin"
1573256       0x180188        Squashfs filesystem, little endian, non-standard signature, version 3.1, size: 8473072 bytes, 1028 inodes, blocksize: 131072 bytes, created: 2019-04-03 05:36:06

from boot log:
Loading from NAND 32MiB 3,3V 8-bit, offset 0x80000
   Image Name:   SP2Xcybertan_rom_bin
   Created:      1970-01-01   0:00:-1 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1572736 Bytes =  1.5 MB
   Load Address: 20008000
   Entry Point:  20008000
    ... ... ... ...

Creating 11 MTD partitions on "gen_nand":
0x00000000-0x00060000 : "u-boot"
0x00060000-0x00080000 : "u-bootenv"
0x00080000-0x01460000 : "ROMIMAGE"
0x01460000-0x01b60000 : "HALFIMAGE"
0x00200000-0x01460000 : "LINUX_ROOTFS"
   ... ... ... ...

Now I need to split the firmware image apart and extract the Rom Image romimage.img and kernel uImage from firmware.bin: how to make this properly use linux dd command?


text:
Q: Orientation lock doesn't work on iOS devices I'm using a Real Cookie Banner plugin for GDPR consent on Wordpress. Unfortunately, GDRP popup breaks the layout on horizontal mode on iOS devices when rotated. That's why I'm trying to lock screen on vertical mode (disabling rotation) when the GDPR popup is active. I feel like I've tried everything but iOS just doesn't seem to respect screen.orientation.lock. Here's my code:
if (document.body.classList.contains('isIOS')) {
document.requestFullscreen()
screen.orientation.lock('portrait');
}

And CSS:
@media only screen and (orientation:portrait) {
  body {
    height: 100vw;
    transform: rotate(90deg);
  }
}

It just doesn't work. Can anyone point me to the right direction? iOS is always the troublemaker...


text:
Q: When using a text field, im trying to get the keyboard to go away in IOS I am trying to make the number pad disappear in IOS. I have added the code below to accomplish this and it only kind of works. I have to select text or double press to get the keyboard to go away. Once I have done this, and I click back into the text box, then it works like it should.
- (IBAction)didBeginEditingPointsText:(id)sender
{
    self.tap = [[UITapGestureRecognizer alloc] initWithTarget:self

                                                       action:@selector(dismissKeyboard)];
    [self.view addGestureRecognizer:self.tap];
}

-(void)dismissKeyboard
{
    [self.pointsText resignFirstResponder];
    [self.view removeGestureRecognizer:self.tap];
}

A: Add this to your viewDidLoad
UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self.nameTextField action:@selector(resignFirstResponder)];
gestureRecognizer.cancelsTouchesInView = NO;
[self.view addGestureRecognizer:gestureRecognizer];


text:
Q: Does Facebook SDK support Swift 2.3/3.0? Ok, I can't figure out what's the catch here. I follow all the instructions to configure my new project using CocoaPods to use Facebook SDK. Once I open generated project workspace, Xcode offers me to convert some source code in Pods project to Swift 2.3 or Swift 3.0.
I tried twice - with converting to Swift 3.0 and converting to Swift 2.3. Neither works and both give me on average ~120 compilation-time errors.
What's the deal here? I can't find anyone with similar problems. They seem to support Swift 2.3, but it doesn't work actually.
Xcode 8.0, Deployment target 8.0, latest FB sdk available through pods - 4.16.1

A: Facebook version 0.2.0 has support for Swift 3.0. Make sure you do the following before installing the latest version of Facebook SDK:
1: Get the latest version of Cocapods:
gem install cocoapods
(or if the above fails)
sudo gem install cocoapods

2: Update your local specs repo by running:
pod repo update

3: And then update your pod file and run pod update or pod install
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'

I think your probably missing step 1.


text:
Q: How to define parent process from child when are having the same process id I am using C#.With this code I am trying to open a word document (WINWORD) and get notify when the specific file or file name that I have open from the software has close.
Right now if I open the x.docx file from the software and open another y.docx manualy and close the y.docx file my programs things that was the x.docx because are having the same process name WINWORD.
I have read a lot of articles but i couldn't find anything.Is it possible to do this in any way?
private void button1_Click(object sender, EventArgs e)
        {

            Process mydoc = new Process();
            mydoc.StartInfo.FileName = "op.docx";

            mydoc.StartInfo.WorkingDirectory = "C:\\";

            mydoc.Start();
            mydoc.WaitForExit();

            notifyIcon1.Visible = true;
            notifyIcon1.Icon = new System.Drawing.Icon(Path.GetFullPath(@"C:\Users\Marios\Desktop\down.ico"));

            notifyIcon1.BalloonTipTitle = "waiting...";
            notifyIcon1.BalloonTipText = "Word has has opened...";
            notifyIcon1.ShowBalloonTip(100);

            Displaynotify();
        }

   protected void Displaynotify()
        {
            try
            {
                var processes = Process.GetProcessesByName("WINWORD");
                notifyIcon1.Visible = true;
                notifyIcon1.Icon = new System.Drawing.Icon(Path.GetFullPath(@"C:\Users\Marios\Desktop\down.ico"));

                notifyIcon1.BalloonTipTitle = "exited.";
                notifyIcon1.BalloonTipText = "Word has exited...";
                notifyIcon1.ShowBalloonTip(100);
            }
            catch (Exception ex)
            {
            }
        }

Update 1 with links from the Answer
I have change my code and now i open it with this way but still i cant do what i want
 private void button1_Click(object sender, EventArgs e)
        {

        Word.Application oWord = new Word.Application();
   Microsoft.Office.Interop.Word.Document oDoc = oWord.Documents.Open("C:\\op.docx");
           oWord.Visible = true;

           ((Word._Document)oDoc).Close();
            // ((Word._Document)oDoc).Close();
           //((Word._Application)oWord).Quit();
          //Displaynotify();
}

A: You can automate Word from your C# application. In that case you will be able to check what documents are opened at the moment and handle the Close event of the Document class which is fired when a document is closed.
See How to automate Microsoft Word to create a new document by using Visual C# for more information and sample code in C#. Also you may find the C# app automates Word (CSAutomateWord) sample project helpful.
In that case there is no need to run a new process. All the job can be done using Word automation.


text:
Q: OSX codesign for a specific macho binary I have a simple C code that i can gcc on my OS X. (I'm using El Capitan beta.) I know there are many guides for signing apps in Xcode. But I just want to codesign for this specific macho binary.
Is there any way to do it? Also, do i have to have an apple developer account to codesign this program? I'm not planning to release the binary to anyone. I'm just studying OSX stuff.
Thanks!


text:
Q: How can i solve $\lim _{x\to +\infty } \left(\frac{3+x^{\alpha}}{2+x}\right)^{x}$ without de L'Hopital? I'm having some trouble with this limit:
$$\lim _{x\to +\infty } \left(\frac{3+x^{\alpha}}{2+x}\right)^{x}$$
The parameter $\alpha \in \mathbb{R}$. I've tried dividing the problem in three different cases: $\alpha = 1, \alpha < 1$ and $\alpha > 1$. For the first two the calculation looks pretty easy, as I, first, rewrite both numerator and denominator as the well known limit $(\theta/x + 1)^x \to e^\theta$:
$$\frac{\left( 3 + x \right)^x}{\left( 2 + x \right)^x} = \frac{\left( 3/x + 1 \right)^x}{\left( 2/x + 1 \right)^x}\to \frac{e^3}{e^2} = e .$$
Then I see that for $\alpha > 1$:
$$\left(\frac{3}{x^\alpha}+1\right)^x = \left(\frac{3}{x^\alpha} + 1 \right)^{x^\alpha x^{1-\alpha}}\to e^{3x^{1-\alpha}}\to1$$ and $$\left(\frac{2}{x^\alpha}+x^{1-\alpha}\right)^x \to 0.$$
The $\alpha < 1$ case, instead, gives me the indeterminate form $\frac\infty\infty$, which I'm unable to solve. This exercise is given in the "known limits" sections so I guess I can solve it without using de L'Hopital.

A: If $\alpha <1$,
$$\begin{align}\lim _{x\to \infty } \left(\frac{3+x^{\alpha}}{2+x}\right)^{x}
&=\lim _{x\to \infty } \left(\frac{\frac 3x+x^{\alpha-1}}{\frac 2x+1}\right)^{x}\\
&=\lim _{x\to \infty } \left(x^x\right)^{\alpha -1}\\
&=\lim _{x\to \infty } \frac{1}{\left(x^x\right)^{1-\alpha}}=0.
\end{align}$$

A: This step in your reasoning is not valid:
$$\left(\frac{3}{x^\alpha}+1\right)^x \to e^{x^{1-\alpha}}\to1$$
I assume your point is something like first rewrite $\left(\dfrac{3}{x^\alpha}+1\right)^x$ to $\left(\dfrac{3x^{1-\alpha}}{x}+1\right)^x$ (where did the 3 go, by the way?). However, the fact that you rely on next,
$$ \Bigl(1+\frac{\theta}{x}\Bigr)^x \to e^\theta \qquad\text{when }x\to\infty $$
is only valid when $\theta$ is a constant! Here it actually depends on $x$, and it is not reliable reasoning to let only some of the $x$s in the limit go to $\infty$ first and then handle the rest later.
If we could do that, we could -- with the same justification -- decide to let the denominator in $\frac xx$ go to $\infty$ first and erroneously conclude
$$ 1 = \frac xx = \frac1x\cdot x \to 0\cdot x \to 0 $$
as $x\to\infty$.

This is a case where trying to shoehorn your reasoning into purely symbolic rewrites makes things harder. In fact the $\alpha>1$ and $\alpha<1$ cases are both pretty easy:

*

*Suppose $\alpha>1$. Then $\frac{3+x^\alpha}{2+x}=\frac{3/x+x^{\alpha-1}}{2/x+1} \to \infty$ and therefore from a certain point onwards -- say, for $x>M$ -- we always have
$\frac{3+x^\alpha}{2+x}>2$. Therefore when $x>\max(M,0)$ we have
$$ \Bigl(\frac{3+x^\alpha}{2+x}\Bigr)^x > 2^x $$
which goes to $+\infty$.

*Suppose $\alpha<1$. Then the numerator of $\frac{3/x+x^{\alpha-1}}{2/x+1}$ goes to $0$ while the denominator goes to $1$, so from a certain point we always have $\frac{3+x^\alpha}{2+x}<\frac12$. Thus, from a certain point we'll have
$$ \Bigl(\frac{3+x^\alpha}{2+x}\Bigr)^x < (1/2)^x $$
which just as easily goes to $0$.
The only complicated case is $\alpha=1$. Then we have $\frac{3+x^\alpha}{2+x}\to 1$, and neither of the above tricks will make progress. Then and only then is it time to be clever:
$$ \Bigl(\frac{3+x}{2+x}\Bigr)^x = \Bigl(1+\frac{1}{2+x}\Bigr)^x
= \Bigl(1+\frac{1}{2+x}\Bigr)^{2+x}\Bigl(1+\frac{1}{2+x}\Bigl)^{-2} $$
Now switching variable to $t=x+2$ we have
$$ \lim_{x\to\infty}\Bigl(\frac{3+x}{2+x}\Bigr)^x
= \lim_{t\to\infty} (1+\tfrac1t)^t(1+\tfrac1t)^{-2}
= \big[\lim_{t\to\infty} (1+\tfrac1t)^t\big]\big[\lim_{t\to\infty}(1+\tfrac1t)^{-2}\big]
= e\cdot 1 = e $$


text:
Q: Trying hard but can't hide featured post/page from grid i have a theme where first a featured post is displayed. then there is a grid of posts. Problem is grid also displays the featured post. So, featured post appears twice.
Question is how to hide featured post from grid?
Note that a custom meta box has been added to mark post/page as featured.
loop that starts featured section is as below...
if ($featured->have_posts()): while($featured->have_posts()): $featured->the_post(); ?>

grid is formed from below code... (i need to hide featured post from this grid)
<?php
$counter = 1;

$grids = 3;

global $query_string;

query_posts($query_string . '&caller_get_posts=1&posts_per_page=12&cat=-' . get_cat_ID( 'News' ));

if(have_posts()) :  while(have_posts()) :  the_post();
?>

A: wp section of stackexchange really seems half dead.
you rarely get issue sorted.
have_posts checks whether there is any post, so add another condition that checks whether the post is featured or not.
if(have_posts()) :  while(have_posts()) :  the_post();

replace above with below
if(have_posts() && the_post() != $featured) :  while(have_posts()) :  the_post();

A: caller_get_posts is deprecated since version 3.1!
Use ignore_sticky_posts instead. Read More
And don't use query_post it's not a good practice, When should you use WP_Query vs query_posts() vs get_posts()?


text:
Q: Help with resolving warning "inferring latch(es) for signal or variable "..", which holds its previous value in one or more paths through the process" Below is the code for my branch unit implementation. This unit calculates the jump destination address and writes it into the PC register.
There are a few different types of jumps, etc, standard story.
library IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.NUMERIC_STD.ALL;
USE work.defPaket.all;

entity BR_UNIT is
Port (
    CLK                 : in  STD_LOGIC; -- clock
    RST                 :       in  STD_LOGIC;

    N                       : in  STD_LOGIC; -- negative
    Z                       : in  STD_LOGIC; -- zero
    C                       : in  STD_LOGIC; -- carry
    V                       : in  STD_LOGIC; -- overflow

    flushfifo           : out STD_LOGIC;
    pcOUT                   : out STD_LOGIC_VECTOR (31 downto 0);
    pcWrEn              : out STD_LOGIC;

    in1                 : in STD_LOGIC_VECTOR (31 downto 0); --input1
    in2                 : in STD_LOGIC_VECTOR (31 downto 0); --input1

    validOut                : out STD_LOGIC; --output
    wr_reg              : out STD_LOGIC;
    regOut              : out STD_LOGIC_VECTOR (4 downto 0);
    dataVal             : out STD_LOGIC_VECTOR (31 downto 0)
);

end BR_UNIT;

architecture Behavioral of BR_UNIT is

signal opc              : STD_LOGIC_VECTOR (4 downto 0);
signal newpc            : STD_LOGIC_VECTOR (31 downto 0);
signal offset           : STD_LOGIC_VECTOR (31 downto 0);

signal validOut_t       : STD_LOGIC;
signal wr_reg_t     : STD_LOGIC;
signal regOut_t     : STD_LOGIC_VECTOR (4 downto 0);
signal dataVal_t        : STD_LOGIC_VECTOR (31 downto 0);
signal pcOUT_t          : STD_LOGIC_VECTOR (31 downto 0);
signal pcWrEn_t     : STD_LOGIC;
signal flushfifo_t  : STD_LOGIC;

begin

clk_part : process (CLK)

begin

if (CLK'event and CLK = '1') then
    validOut <= validOut_t;
    wr_reg <= wr_reg_t;
    regOut <= regOut_t;
    dataVal <= dataVal_t;
    pcOUT <= pcOUT_t;
    pcWrEn <= pcWrEn_t;
    flushfifo <= flushfifo_t;
end if;

end process;

comb_part : process (in1, in2, N, Z, C, V)
    variable temp : signed(31 downto 0);

    begin

    if(
        (in1(31 downto 27) = OPC_BEQ) or
        (in1(31 downto 27) = OPC_BGT) or
        (in1(31 downto 27) = OPC_BHI) or
        (in1(31 downto 27) = OPC_BAL) or
        (in1(31 downto 27) = OPC_BLAL)
    ) then

        opc <= in1(31 downto 27);

    elsif(
        (in2(31 downto 27) = OPC_BEQ) or
        (in2(31 downto 27) = OPC_BGT) or
        (in2(31 downto 27) = OPC_BHI) or
        (in2(31 downto 27) = OPC_BAL) or
        (in2(31 downto 27) = OPC_BLAL)
    ) then

        opc <= in2(31 downto 27);

    end if;

    offset <= std_logic_vector(resize(signed(in1(26 downto 0)), 32));
    temp := signed(offset) + signed(in1(8 downto 1)) + 1;
    newpc <= std_logic_vector(signed(temp));

    regOut_t <= "00000";
    validOut_t <= '1';

        case opc is

            when OPC_BEQ =>
                if (Z = '1') then
                    flushfifo_t <= '1';
                    pcOUT_t <= newPC;
                    pcWrEn_t <= '1';
                end if;

            when OPC_BGT =>
                if (((N xor V) or Z) = '0') then
                    flushfifo_t <= '1';
                    pcOUT_t <= newPC;
                    pcWrEn_t <= '1';
                end if;

            when OPC_BHI =>
                if ((C or Z) = '0') then
                    flushfifo_t <= '1';
                    pcOUT_t <= newPC;
                    pcWrEn_t <= '1';
                end if;

            when OPC_BAL =>
                    flushfifo_t <= '1';
                    pcOUT_t <= newPC;
                    pcWrEn_t <= '1';

            when OPC_BLAL =>
                    flushfifo_t <= '1';
                    pcOUT_t <= newPC;
                    pcWrEn_t <= '1';

                    regOut_t <= "00000";
                    dataVal_t <= newpc;
                    wr_reg_t <= '1';

            when OTHERS =>
        end case;

end process;

end Behavioral;

Quartus altera throws the following warnings:

Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(94): signal "offset" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(100): signal "opc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(105): signal "newpc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(112): signal "newpc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(119): signal "newpc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(125): signal "newpc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(130): signal "newpc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(134): signal "newpc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "opc", which holds its previous value in one or more paths through the process
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "flushfifo_t", which holds its previous value in one or more paths through the process
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "pcOUT_t", which holds its previous value in one or more paths through the process
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "pcWrEn_t", which holds its previous value in one or more paths through the process
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "dataVal_t", which holds its previous value in one or more paths through the process
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "wr_reg_t", which holds its previous value in one or more paths through the process

Regarding these warnings about signals not being in the sensitivity list, how do I resolve that? Should I skip using them whenever possible or use variables where not possible?
The big and the main question is: what do these errors mean:

Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "opc", which holds its previous value in one or more paths through the process

What do they mean and what are your suggestions on how to resolve them?

A: I'm guessing that like me, you probably come from a software development background and are now learning HDL.
The when others case is empty; that's where you are implicity making all the latches. You clear this warning by explicitly setting the output's next value to its previous value, like x <= x;. Remember this is a Hardware Description Language, not a procedural computer programming language. So you have to think in terms of what actual hardware you expect each module to implement.
As a general rule, when you have a case statement, each clause (i.e. each "execution path" though that's the wrong terminology) -- should define the value of each of the statement's output ports, even if there is no change intended. There are certain code patterns that HDL synthesis tools recognize, and for best results you should try to stick with those forms whenever possible.

Response to the comment:
There's two kinds of warning mesasges here.
Warning # 10492 seems to indicate that an input signal is missing from the sensitivity list.
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(105): signal "newpc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list

In the delcaration
comb_part : process (in1, in2, N, Z, C, V)

the sensitivity list only declares in1, in2, N, Z, C, V as the available input signals. In terms of hardware, this is like declaring that comb_part is implemented with some hardware block that has these six inputs -- and then oh by the way, surprise, here's this other signal called offset, which looks like it was meant to be another input.
offset <= std_logic_vector(resize(signed(in1(26 downto 0)), 32));

So because this is a non-blocking assignment statement, offset must be some kind of signal, but is it an internal register or an output? The HDL compiler can't tell of that's what was intended, thus the error message.
Recommended fix is that you need to review your design and determine whether you need to add those inputs to the sensitivity list.
Warning # 10631 seems to indicate that an output signal has an inferred latch.
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "flushfifo_t", which holds its previous value in one or more paths through the process

In software it's assumed that variables hold their value until explicitly changed, but in HDL synthesis that requires a latch or a flip-flop. When you have an HDL module that describes code in terms of "behavioral" statements like if/else, or swtich/case, and there is at least one non-blocking assignment to a signal, then every "execution path" should explicity make a non-blocking assignment to that signal.
    case opc is

        when OPC_BEQ =>
            if (Z = '1') then
                flushfifo_t <= '1';
                pcOUT_t <= newPC;
                pcWrEn_t <= '1';
            end if;
        -- etc...
        when OPC_BLAL =>
                flushfifo_t <= '1';
                pcOUT_t <= newPC;
                pcWrEn_t <= '1';
                regOut_t <= "00000";
                dataVal_t <= newpc;
                wr_reg_t <= '1';
        when OTHERS =>
                -- [MarkU] here's the problem, missing non-blocking assignments should go here
                flushfifo_t <= flushfifo_t;
                pcOUT_t <= pcOUT;
                pcWrEn_t <=pcWrEn_t;
                -- [MarkU] and so on for all the non-blocking assignments that are unchanged in this case
    end case;


text:
Q: How can I call a method with variable arguments from the On Click Event of a blazor html object in my Blazor server app? I can call from the OnClick event a method with arguments in my Blazor razor page. It is working.
 for (var i = 0; i < Deltalogic.CNC_File_Array_lenght - 1; i++)
     {

         Read_CNC_Files("_N_MPF_DIR","_N_AUTO_MPF"))">@Deltalogic.CNC_File_Content

But if I write the arguments with variables, it is not working. Why?
 for (var i = 0; i < Deltalogic.CNC_File_Array_lenght - 1; i++)
     {

          Read_CNC_Files(Deltalogic.Selected_CNC_File_name,Deltalogic.CNC_File_Content_Array[i]))">@Deltalogic.CNC_File_Content_Array[i]

      }

I have validated that the variables have the same values, that I have written in example-1.


text:
Q: Dimension too large Error in bar drawing Here is my code. The following code returned 'Dimension too large' error. This error has different reasons since I cannot fix it after I surfed on the internet.
The code would be work if I 'change the turns' of values of x-axis and y-axis.
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\pagestyle{empty}

\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[
    y tick label style={
        /pgf/number format/1000 sep=},
    xlabel=Population,
    enlargelimits=0.05,
    legend style={at={(0.5,-0.15)},
        anchor=north,legend columns=1},
    xbar interval=1E-12,
    ymin=-1,
]
\addplot
    coordinates {(1E-3,1930) (1E-6,1940)
         (1E-9,1950) };
%
%\addplot
%   coordinates {(1930,38e6) (1940,42e6)
%       (1950,43e6) (1960,45e6) (1970,65e6)};
%
%\addplot
%   coordinates {(1930,15e6) (1940,12e6)
%       (1950,13e6) (1960,25e6) (1970,35e6)};
\legend{Far}
\end{semilogyaxis}
\end{tikzpicture}
\end{document}


text:
Q: Generics - Calling a method with a generic parameter I'm struggling here with generics.
To start things off, I want to return a list of objects via the following callback interface:
Callback interface:
public interface ArrayCallback<T> {
    public void onComplete(List<T> result);
}

So far so good. Now, using that callback, let's say I want to get a list of songs like so:
Using the callback to load a list of songs
public void loadSongs(ArrayCallback<Song> callback) {
    List<Song> songs = new ArrayList<Song>();
    ...
    callback.onComplete(songs);
}

No problems here. But now I want to load a list of SOME type of music item. It could be songs like before, but it could be albums, artists, etc. I've called the superclass of all of these types of things MusicItem. (Thus, Song has a super class of MusicItem) Here's where it falls over.
Aaaaand the following doesn't work
public void loadMusicItems(MusicItemType type, ArrayCallback<? extends MusicItem> callback) {
    switch (type) {
        case Songs:
            loadSongs(callback);
            break;
        case Albums:
            loadAlbums(callback);
            break;
        default:
            break;
}

The problem is on the loadSongs(callback) line. I can't call this method because the types are different.
loadSongs(ArrayCallback<Song>) in MusicSource cannot be applied to loadSongs(ArrayCallback<capture<? extends MusicItem>>)
From my understanding I can't just use type T and need to use a wildcard because of covariance problems.
Is what I'm doing even possible? After writing this question out, I suppose arguably it would look a bit strange to the compiler if I'm suddenly restricting the bounds on a method call. I'd still be interested in working out what I'm doing wrong apart from perhaps a crazy method design.

A: Generic type will only be applied during the compilation ( to ensure type safety ) and will disappear during the run-time. So your implementation is actually violating the usage of generic type. Eg. You can pass a Song type enum with ArrayCallback of Album type. (imagine your loadSongs method will be then receiving an ArrayCallback of Album type. No way!)


text:
Q: Writing an Integral in Different Form? Is it possible to write $\int_{-\infty}^\infty e^{-iqu}\left( \frac{A}{\sqrt{1-iau}}+\frac{B}{\sqrt{1-ibu}}\right)^Ndu$ in this form $\int\frac{e^{-iu}}{(\sqrt{1-iau})^n(\sqrt{1-ibu})^m}du$

A: Raskolnikov is absolutely right:
$$\int e^{-\mathrm{i} qu} \left( \frac{A}{\sqrt{1-\mathrm{i}au}} + \frac{B}{\sqrt{1-\mathrm{i}bu}} \right)^N du = \sum_{k=0}^N \binom{N}{k} \int e^{-\mathrm{i} qu} \left[ \frac{A}{\sqrt{1-\mathrm{i}au}}\right]^{N-k} \left[ \frac{B}{\sqrt{1-\mathrm{i}bu}} \right]^{k} du$$
See here.
Sincerely
Robert

A: In view of your recent question on MathOverflow, this new question is regarding (inversion of) characteristic functions. Let's begin with the characteristic function corresponding to the right integral. Suppose that $W \sim {\rm N}(0,1)$. Then $W^2$ has characteristic function of chi-square with $1$ degree of freedom:
$$
{\rm E}[e^{iuW^2 } ] = \frac{1}{{\sqrt {1 - 2iu} }}.
$$
From this it follows straightforwardly that the characteristic function of the sum
$$
{\frac{a}{2}} \sum\limits_{i = 1}^n  W_i^2  + {\frac{b}{2}} \sum\limits_{i = 1}^m  {\tilde W}_i^2,
$$
where $W_i$ and ${\tilde W}_i$ are independent copies of $W$, is given by
$$
{\rm E}\bigg[\exp \bigg(i\frac{{au}}{2}\sum\limits_{i = 1}^n {W_i^2 } \big)\bigg]{\rm E}\bigg[\exp \bigg(i\frac{{bu}}{2}\sum\limits_{i = 1}^m {{\tilde W}_i^2 } \bigg)\bigg] = \frac{1}{{(\sqrt {1 - iau} )^n }}\frac{1}{{(\sqrt {1 - ibu} )^m }}.
$$
As for the characteristic function corresponding to the left integral, define random variable $T$ as follows. With probability $A$, $T = (a/2)W_1^2$, and with probability $B(=1-A)$, $T = (b/2)W_2^2$, where $W_1$ and $W_2$ are independent ${\rm N}(0,1)$ rv's. Then, the characteristic function of $T$ is given by
$$
A{\rm E}\bigg[\exp \bigg(i\frac{{au}}{2}W_1^2 \bigg)\bigg] + B{\rm E}\bigg[\exp \bigg(i\frac{{bu}}{2}W_1^2 \bigg)\bigg] = \frac{A}{{\sqrt {1 - iau} }} + \frac{B}{{\sqrt {1 - ibu} }}.
$$
Thus, the characteristic function of the sum of $N$ independent copies of $T$ is given by
$$
\bigg(\frac{A}{{\sqrt {1 - iau} }} + \frac{B}{{\sqrt {1 - ibu} }}\bigg)^N.
$$


text:
Q: How to align inner html with other dynamic objects - javascript I have dynamic checkbox and textbox where it also display values through inner html. However, the values are not aligned with their proper textbox and checkbox which makes it confusing when choosing.
Is there a way to put a divider or border or align after every object to properly separate the values?
Here is the output image

function populate(model, destination) {
    var mod = document.getElementById(model);
    var des = document.getElementById(destination);
    var cri = document.getElementById("criteria");
    var qty = document.getElementById("qty");

    var optionArray = [];
    if (mod.value == "Model-A") {
        des.innerHTML = "";
        if (cri) cri.innerHTML = "";
        if (qty) qty.innerHTML = "";
        optionArray = ["Dog", "Cat"];
    } else if (mod.value == "Model-B") {
        des.innerHTML = "";
        if (cri) cri.innerHTML = "";
        if (qty) qty.innerHTML = "";
        optionArray = ["Fish", "Bird"];
    }

    for (var option in optionArray) {
        if (optionArray.hasOwnProperty(option)) {
            var pair = optionArray[option];
            var checkbox = document.createElement("input");
            checkbox.type = "checkbox";
            checkbox.name = pair;
            checkbox.value = pair;
            des.appendChild(checkbox);

            var label = document.createElement("label");
            label.htmlFor = pair;
            label.appendChild(document.createTextNode(pair));

            des.appendChild(label);
            des.appendChild(document.createElement("br"));
        }
    }

    updateCriteria();
}

function updateCriteria() {
    var text = "";
    var cri = document.getElementById("criteria").value;
    var models = document.getElementsByTagName("label");
    var model = "";
    var criteria = document.getElementById("criteria");
    var qty = document.getElementById("qty");

    for (var i = 0; i < models.length; i++) {
        var br = document.createElement("br");
        var qtytextbox = document.createElement("input");
        var wrapper = document.createElement("span");
        model = models[i].innerText;

        if (model == "Dog") {
            wrapper.className = model;
            qtytextbox.className = model;
            wrapper.innerText =
                "They can read our emotions—if we're happy, sad or angry.\n";
            criteria.appendChild(wrapper);
            criteria.appendChild(br);
            qty.appendChild(qtytextbox);
            qty.appendChild(br);
        } else if (model == "Cat") {
            wrapper.className = model;
            qtytextbox.className = model;
            wrapper.innerText =
                "They are inquisitive, friendly, playful, active, loving and independent.\n";
            criteria.appendChild(wrapper);
            criteria.appendChild(br);
            qty.appendChild(qtytextbox);
            qty.appendChild(br);
        }
    }
}

   Choose one:
      <select id="model" name="model" onchange="populate(this.id, 'destination')" >
        <option value="select">--Select Animal--</option>
        <option value="Model-A">Pets</option>
       <option value = "Model-B"> Model-B </option>
      </select>

   Animal:
   Characteristic:
   Others:

A: As suggested in the comments section, you need to append a new
 for each entity of selected model. To achieve that you could create an empty "template" row, clone it for each entity and fill its .destination, .criteria and .qty with appropriate data. I would do it like this:

const data = {
  "Model-A": {
    options: [
      { name: "Dog", characteristics: "They can read our emotions—if we're happy, sad or angry.\n" },
      { name: "Cat", characteristics: "They are inquisitive, friendly, playful, active, loving and independent.\n" }
    ]
  },
  "Model-B": {
    options: [
      { name: "Fish", characteristics: "Fish characteristics" },
      { name: "Bird", characteristics: "Bird characteristics" }
    ]
  },
}

function createRow(option, tableRowClassName) {
  const row = document.getElementById('template').cloneNode(true);
  const dest = row.querySelector('.destination');
  const cri = row.querySelector('.criteria');
  const qty = row.querySelector('.qty');

  createDestination(dest, option);
  createCharacteristics(cri, option);
  createQty(qty, option);

  row.id = `template_${option.name}`;
  row.classList.add(tableRowClassName);

  return row;
}

function createDestination(container, option) {
  const checkbox = document.createElement("input");
  const label = document.createElement("label");
  const id = `checkbox_${option.name}`;

  checkbox.type = "checkbox";
  checkbox.name = option.name;
  checkbox.value = option.name;
  checkbox.id = id;
  label.htmlFor = id;
  label.innerHTML = option.name;

  container.appendChild(checkbox);
  container.appendChild(label);
}

function createCharacteristics(container, option) {
  const wrapper = document.createElement("span");
  wrapper.innerHTML = option.characteristics;
  container.appendChild(wrapper);
}

function createQty(container, option) {
  const qtytextbox = document.createElement("input");
  qtytextbox.placeholder = option.name;
  qtytextbox.name = `qty_${option.name}`
  container.appendChild(qtytextbox);
}

function populate(value) {
  const model = data[value];
  const tableFragment = document.createDocumentFragment();
  const table = document.getElementById('result-table');
  const tableRowClassName = 'added-row';

  // reset table
  Array
    .from(table.querySelectorAll('.' + tableRowClassName))
    .forEach(row => row.remove());

  model.options.forEach((option) => {
    const row = createRow(option, tableRowClassName);
    tableFragment.appendChild(row);
  });

  table.appendChild(tableFragment);
}
#template {
  display: none;
}

#result-table {
  border-collapse: collapse;
}

#result-table td {
  border: 1px solid grey;
}

     Choose one:

      <select id="model" name="model" onchange="populate(this.value)" >
        <option value="select">--Select Animal--</option>
        <option value="Model-A">Pets</option>
        <option value = "Model-B"> Model-B </option>
      </select>

     Animal:
     Characteristic:
     Others:


text:
Q: Explaining a function from the JUNG tutorial, EdgePropertyDialog I am trying to implement some graph traversal algorithms in java while also creating a visual interface for them. I am using the JUNG library and used as a begging reference for my project this tutorial: http://www.grotto-networking.com/JUNG/JUNG2-Tutorial.pdf
The classes used in the tutorial:http://www.grotto-networking.com/JUNG/
The weird JDialog class: http://www.grotto-networking.com/JUNG/MouseMenu/EdgePropertyDialog.java
I understood most of it except a weird, presumably auto-generated function:
If someone could help me I would be very thankful. Thanks
private void initComponents() {
    jButton1 = new javax.swing.JButton();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    capFormattedTextField = new javax.swing.JFormattedTextField();
    wtFormattedTextField = new javax.swing.JFormattedTextField();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Edge Properties");
    jButton1.setText("OK");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            okButtonHandler(evt);
        }
    });

    jLabel1.setText("Capacity:");

    jLabel2.setText("Weight:");

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
        .add(layout.createSequentialGroup()
            .addContainerGap()
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                .add(jButton1)
                .add(layout.createSequentialGroup()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(jLabel1)
                        .add(jLabel2))
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(layout.createSequentialGroup()
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(capFormattedTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 69, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(wtFormattedTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 69, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))))
            .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
        .add(layout.createSequentialGroup()
            .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                .add(jLabel1)
                .add(capFormattedTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                .add(jLabel2)
                .add(wtFormattedTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(jButton1))
    );
    pack();
}// </editor-fold>//GEN-END:initComponents


text:
Q: How to create delay function in QML? I would like to create a delay function in javascript that takes a parameter of amount of time to delay, so that I could use it do introduce delay between execution of JavaScript lines in my QML application. It would perhaps look like this:
function delay(delayTime) {
  // code to create delay
}

I need the body of the function delay(). Note that setTimeout() of JavaScript doesn't work in QML.

A: As suggested in the comments to your question, the Timer component is a good solution to this.
function Timer() {
    return Qt.createQmlObject("import QtQuick 2.0; Timer {}", root);
}

timer = new Timer();
timer.interval = 1000;
timer.repeat = true;
timer.triggered.connect(function () {
    print("I'm triggered once every second");
})

timer.start();

The above would be how I'm currently using it, and here's how I might have implemented the example in your question.
function delay(delayTime) {
    timer = new Timer();
    timer.interval = delayTime;
    timer.repeat = false;
    timer.start();
}

(Which doesn't do anything; read on)
Though the exact way you are looking for it to be implemented suggests that you are looking for it to block until the next line of your program executes. But this isn't a very good way to go about it as it would also block everything else in your program as JavaScript only runs in a single thread of execution.
An alternative is to pass a callback.
function delay(delayTime, cb) {
    timer = new Timer();
    timer.interval = delayTime;
    timer.repeat = false;
    timer.triggered.connect(cb);
    timer.start();
}

Which would allow you to use it as such.
delay(1000, function() {
    print("I am called one second after I was started.");
});

Hope it helps!
Edit: The above assumes you're working in a separate JavaScript file that you later import into your QML file. To do the equivalent in a QML file directly, you can do this.
import QtQuick 2.0

Rectangle {
    width: 800
    height: 600

    color: "brown"

    Timer {
        id: timer
    }

    function delay(delayTime, cb) {
        timer.interval = delayTime;
        timer.repeat = false;
        timer.triggered.connect(cb);
        timer.start();
    }

    Rectangle {
        id: rectangle
        color: "yellow"
        anchors.fill: parent
        anchors.margins: 100
        opacity: 0

        Behavior on opacity {
            NumberAnimation {
                duration: 500
            }
        }
    }

    Component.onCompleted: {
        print("I'm printed right away..")
        delay(1000, function() {
            print("And I'm printed after 1 second!")
            rectangle.opacity = 1
        })
    }
}

I'm not convinced that this is the solution to your actual problem however; to delay an animation, you could use PauseAnimation.

A: Here's another variation which utilizes the Component object to house the Timer object.
Then we implement a setTimeout look-a-like function to dynamically create and invoke this Timer object.
N.B. The answer assumes Qt5.12.x which includes ECMAScript 7 (and therefore ECMAScript 6) to utilize parameter shortcuts, rest parameters and spread syntax:
    function setTimeout(func, interval, ...params) {
        return setTimeoutComponent.createObject(app, { func, interval, params} );
    }

    function clearTimeout(timerObj) {
        timerObj.stop();
        timerObj.destroy();
    }

    Component {
        id: setTimeoutComponent
        Timer {
            property var func
            property var params
            running: true
            repeat: false
            onTriggered: {
                func(...params);
                destroy();
            }
        }
    }

In the following snippet, we will invoke console.log(31), console.log(32), console.log(33) in a random time delay between 0-1000ms from now.

console.log("Started");
setTimeout(console.log, Math.floor(1000 * Math.random()), 31);
setTimeout(console.log, Math.floor(1000 * Math.random()), 32);
setTimeout(console.log, Math.floor(1000 * Math.random()), 33);

See also: https://community.esri.com/groups/appstudio/blog/2019/05/22/ecmascript-7-settimeout-and-arrow-functions

A: Marcus' answer does the job, but there is one big problem.
The problem is that the callback keeps connected to triggered signal even after triggered once. This means that if you use that delay function again, the timer will triggers all callbacks connected before again. So you should disconnect the callback after triggered.
This is my enhanced version of the delay function:
Timer {
    id: timer
    function setTimeout(cb, delayTime) {
        timer.interval = delayTime;
        timer.repeat = false;
        timer.triggered.connect(cb);
        timer.triggered.connect(function release () {
            timer.triggered.disconnect(cb); // This is important
            timer.triggered.disconnect(release); // This is important as well
        });
        timer.start();
    }
}

...

timer.setTimeout(function(){ console.log("triggered"); }, 1000);

A: The answer from Bumsik Kim is great, this answer changes it slightly so that the timer can be used on a repeating basis and then stopped and reused when desired.
The QML for the timer to add where required.
// Allow outside access (optional)
property alias timer: timer

Timer {
    id: timer

    // Start the timer and execute the provided callback on every X milliseconds
    function startTimer(callback, milliseconds) {
        timer.interval = milliseconds;
        timer.repeat = true;
        timer.triggered.connect(callback);
        timer.start();
    }

    // Stop the timer and unregister the callback
    function stopTimer(callback) {
        timer.stop();
        timer.triggered.disconnect(callback);
    }
}

This can be used as follows.
timer.startTimer(Foo, 1000); // Run Foo every 1 second
timer.stopTimer(Foo); // Stop running Foo

timer.startTimer(Bar, 2000); // Run Bar every 2 seconds
timer.stopTimer(Bar); // Stop running Bar

function Foo() {
    console.log('Executed Foo');
}

function Bar() {
    console.log('Executed Bar');
}

A: Here's my continued evolution of the prior answers https://stackoverflow.com/a/62051450/3220983 and https://stackoverflow.com/a/50224584/3220983...
Add this file / component to your project:
Scheduler.qml
import QtQuick 2.0

Timer {
    id: timer

    property var _cbFunc: null
    property int _asyncTimeout: 250

    // Execute the callback asynchonously (ommiting a specific delay time)
    function async( cbFunc )
    { delay( cbFunc, _asyncTimeout ) }

    // Start the timer and execute the provided callback ONCE after X ms
    function delay( cbFunc, milliseconds )
    { _start( cbFunc, milliseconds, false ) }

    // Start the timer and execute the provided callback repeatedly every X ms
    function periodic( cbFunc, milliseconds )
    { _start( cbFunc, milliseconds, true ) }

    function _start( cbFunc, milliseconds, isRepeat ) {
        if( cbFunc === null ) return
        cancel()
        _cbFunc        = cbFunc
        timer.interval = milliseconds
        timer.repeat   = isRepeat
        timer.triggered.connect( cbFunc )
        timer.start()
    }

    // Stop the timer and unregister the cbFunc
    function cancel() {
        if( _cbFunc === null ) return
        timer.stop()
        timer.triggered.disconnect( _cbFunc )
        _cbFunc = null
    }
}

Then, implement in another component like:
...
Scheduler { id: scheduler; }
scheduler.delay( function(){ console.log('Delayed'); }, 3000 );

You can use anonymous functions like shown here, or else callback into named functions. Use the simple async to fire off code in a non-blocking manner, if you aren't too concerned about the exact timing. Note that while it's tempting to use a 0 ms timeout for an "asynchronous" callback (as one would with a C++ QTimer), that is not the right approach with a QML Timer! These timers don't appear to queue events on an event loop where screen redraws are given priority. So, if your goal is to defer a given operation to achieve "instant" UI changes first, you need to dial up the delay interval as shown here.  Using 0ms will often cause the code to fire prior to redraws.
Note that one of these "Scheduler" instances can only be bound to one callback function, on one given interval, at a time.  Multiple instances are required if you need to "overlap" delayed events.

A: you can use QtTest
import QtTest 1.0
import QtQuick 2.9

ApplicationWindow{
    id: window

    TestEvent {
        id: test
    }

    function delay_ms(delay_time) {
        test.mouseClick(window, 0, 0, Qt.NoButton, Qt.NoModifier, delay_time)
    }
}

A: This should be sufficient:
void QmlUtils::singleShot(int msec, QJSValue callback)
{
    QTimer::singleShot(msec, this, [callback] () mutable {
        if (callback.isCallable())
            callback.call();
    });
}

then call it in QML, wherever you are:
qmlUtils.singleShot(5000, () => console.log("Hello!"))

Done.
If you want, you can use this without even writing it. Simply expose it to QML with:
ctx->setContextProperty("lqtUtils", new lqt::QmlUtils(qApp));


text:
Q: Why is this an empty space appearing inside of SVG element? I have the fiddle with this problem. If I set viewBox property on the symbol element, icon displayed correctly. But if I set viewBox with same value on svg element with use inside, around use element appears weird empty space, inside of SVG-container.
Viewport of first variant is the same with viewport of second variant - 35x35px size at 2.5x3.5px coords.
What's the reason of this behavior? Bug or my own mistake?
EDIT: Add picture with correct and incorrect areas.

#svg-icons {
  display: none;
}
.icon {
  display: inline-block;
  border: 1px solid red;
}
.icon + .icon {
  margin-left: 20px;
}
<svg version="1.1" id="svg-icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <symbol id="icon-1" viewBox="2.5 3.5 35 35">
    <rect x="2.5" y="3.5" stroke="#000000" stroke-miterlimit="10" width="35" height="35" />
    <circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="20" cy="21" r="14" />
  </symbol>
  <symbol id="icon-2">
    <rect x="2.5" y="3.5" stroke="#000000" stroke-miterlimit="10" width="35" height="35" />
    <circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="20" cy="21" r="14" />
  </symbol>
</svg>

<svg class="icon icon-1" width="100" height="100">
  <use xlink:href="#icon-1"></use>
</svg>

<svg class="icon icon-2" viewBox="2.5 3.5 35 35" width="100">
  <use xlink:href="#icon-2"></use>
</svg>

A: This probrem will be solved by thinking about how the use element is treated on drawing.
According to SVG 1.1 2nd edition, use element refers symbol element is treated as svg element on drawing. So the result by that svg structure is same as this.
<svg class="icon icon-2" viewBox="2.5 3.5 35 35" width="100">
    <g>
        <svg width="100%" height="100%">
            <rect x="2.5" y="3.5" stroke="#000000" stroke-miterlimit="10" width="35" height="35" />
            <circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="20" cy="21" r="14" />
        </svg>
    </g>
</svg>

Inner svg element has range of 100% width and height positioned at (0,0), and outer svg element has viewBox offset to (2.5, 3.5).
Thus shapes are cutoff by displacement of 2 svg element's rendering ranges.


text:
Q: How to put KerasClassifier, Hyperopt and Sklearn cross-validation together I am performing a hyperparameter tuning optimization (hyperopt) tasks with sklearn on a Keras models. I am trying to optimize KerasClassifiers using the Sklearn cross-validation, Some code follows:
def create_model():
    model = Sequential()
    model.add(
        Dense(output_dim=params['units1'],
              input_dim=features_.shape[1],
              kernel_initializer="glorot_uniform"))
    model.add(Activation(params['activation']))
    model.add(Dropout(params['dropout1']))
    model.add(BatchNormalization())
    ...
    model.compile(loss='binary_crossentropy',
                  optimizer='adam',
                  metrics=['accuracy'])

    return model

Now what I want to do is to pass the Hyperopt params to KerasClassifier using the following way
def objective(params, n_folds=N_FOLDS):
    """Objective function for Hyperparameter Optimization"""

    # Keep track of evals
    global ITERATION

    ITERATION += 1

    clf = KerasClassifier(build_fn=create_model,**params)

    start = timer()

    # Perform n_folds cross validation
    cv_results = cross_val_score(clf,
                                 features_,
                                 labels,
                                 cv=5
                                 ).mean()

    run_time = timer() - start

    # Loss must be minimized
    loss = -cv_results

    # Dictionary with information for evaluation
    return {
        'loss': loss,
        'params': params,
        'iteration': ITERATION,
        'train_time': run_time,
        'status': STATUS_OK
    }

I define the search space as:
space = {'units1': hp.choice('units1', [64, 128, 256, 512]),
    'units2': hp.choice('units2', [64, 128, 256, 512]),
    'dropout1': hp.choice('dropout1', [0.25, 0.5, 0.75]),
    'dropout2': hp.choice('dropout2', [0.25, 0.5, 0.75]),
    'batch_size': hp.choice('batch_size', [10, 20, 40, 60, 80, 100]),
    'nb_epochs': hp.choice('nb_epochs', [10, 50, 100]),
    'optimizer': opt_search_space,
    'activation': 'relu' }

Run optimization
best = fmin(fn = objective, space = space, algo = tpe.suggest,
            max_evals = MAX_EVALS, trials = bayes_trials, rstate = np.random.RandomState(50))

But it fails giving this error:

ValueError: activation is not a legal parameter

What's the right way to do it?

A: Make the hyper parameter as the input parameters for create_model function. Then you can feed params dict. Also change the key nb_epochs into epochs in the search space. Read more about the other valid parameter here.
Try the following simplified example of your's.
import numpy as np
import pandas as pd
from sklearn.datasets import make_classification
from sklearn.model_selection import cross_val_score
from tensorflow.keras import Sequential
from tensorflow.keras.wrappers.scikit_learn import KerasClassifier
from tensorflow.keras.callbacks import EarlyStopping
from tensorflow.keras.layers import Dense, Dropout

import time

def timer():
   now = time.localtime(time.time())
   return now[5]

X, y = make_classification(n_samples=1000, n_classes=2,
                           n_informative=4, weights=[0.7, 0.3],
                           random_state=0)

Defining keras model:
def create_model(units1, activation, dropout):
    model = Sequential()
    model.add(Dense(units1,
                    input_dim=X.shape[1],
                    kernel_initializer="glorot_uniform",
                    activation=activation))
    model.add(Dropout(dropout))
    model.add(Dense(1,activation='sigmoid'))

    model.compile(loss='binary_crossentropy',
                  optimizer='adam',
                  metrics=['accuracy'])

    return model

def objective(params, n_folds=2):
    """Objective function for Hyperparameter Optimization"""

    # Keep track of evals
    global ITERATION

    ITERATION += 1

    clf = KerasClassifier(build_fn=create_model,**params)

    start = timer()

    # Perform n_folds cross validation
    cv_results = cross_val_score(clf, X, y,
                                 cv=5,
                                 ).mean()

    run_time = timer() - start

    # Loss must be minimized
    loss = -cv_results

    # Dictionary with information for evaluation
    return {
        'loss': loss,
        'params': params,
        'iteration': ITERATION,
        'train_time': run_time,
        'status': STATUS_OK
    }

from hyperopt import fmin, tpe, hp, Trials, STATUS_OK

space = {'units1': hp.choice('units1', [12, 64]),
         'dropout': hp.choice('dropout1', [0.25, 0.5]),
         'batch_size': hp.choice('batch_size', [10, 20]),
         'epochs': hp.choice('nb_epochs', [2, 3]),
         'activation': 'relu'
        }

global ITERATION
ITERATION = 0

bayes_trials = Trials()

best = fmin(fn = objective, space = space, algo = tpe.suggest,
            max_evals = 5, trials = bayes_trials, rstate = np.random.RandomState(50))


text:
Q: Using ECS in a custom Unity package I have built a custom package for Unity called world-renderer. This is the folder structure.

Inside "Runtime" is all my source code. To use it inside a Unity project, I add this line into the manifest.json of that project.
"com.tamagames.extinction.word-renderer": "file:C:/Users/dbugger/projects/unity/world-renderer",

This has worked great so far, but now I want to start using ECS inside my custom package. so I add its namespace to one of the files:
using Unity.Entities;

and now when I return to the Unity Editor, I see the following error message:

CS0234: The type or namespace name 'Entities' does not exist in the namespace 'Unity' (are you missing an assembly reference?)

I figured I needed to add the dependency to the package.json of my custom package, so I wrote updated it like this:
{
  "name": "com.tamagames.extinction.word-renderer",
  "version": "1.0.4",
  "displayName": "Extinction - World renderer",
  "description": "World renderer for Extinction",
  "unity": "2019.1",
  "unityRelease": "0b5",
  "keywords": [],
  "dependencies": {
    "com.unity.entities": "0.1.1-preview" // Dependency added
 },
  "author": {
    "name": "Enrique Moreno Tent",
    "email": "enriquemorenotent@gmail.com",
    "url": "https://enriquemorenotent.com"
  }
}

But I still keep getting the same error.
What am I doing wrong?
UPDATE
I try adding the reference to the Assembly of my package, like this:
{
    "name": "Unity.com.tamagames.extinction.world-renderer-ecs",
    "optionalUnityReferences": ["com.unity.entities"],
    "includePlatforms": [],
    "excludePlatforms": [],
    "allowUnsafeCode": false,
    "overrideReferences": false,
    "precompiledReferences": [],
    "autoReferenced": true,
    "defineConstraints": [],
    "versionDefines": []
}

That did solve the problem with "Unity.Entities" not found, but now, in the Unity Project, the classes inside my source code cannot be found!

A: Well, I got it to work.
First of all, I should not have used optionalUnityReferences, but references.
But the big mistake is that, event though the dependeny in the package.json is called com.unity.entities, the one in the Assembly file should have been called Unity.Entities.

A: I suspect this has to do with Assembly Definitions: you can fix this by adding a reference in your code (in your Assembly Definition file - if you don't have one you will need to create one in your Runtime folder) to Unity.Entities.


text:
Q: Отправка сообщений в Telegramm Возможно ли написать скрипт (не важно на каком языке) который будет с моего аккаунта (не бота) отправлять с определённо периодичностью отправлять сообщения боту/пользователю.
И если это возможно дайте, пожалуйста, материалы которые помогут мне написать подобный скрипт.