问:
Leaflet map renderer L.svg changed already existing canvas markers
I have set renderer value L.svg with a padding of 100 for map as shown below

Before setting this option canvas markers were visible like this

After setting renderer option markers are visible like this

Code to render canvas marker is as follows

```<code>(function () {
var proto = L.Canvas.prototype;
var prev = proto._updateCircle;

proto._updateCircle = function (layer) {
    // only circleMARKER, not the standard circle
    if (layer instanceof L.Circle)
        return prev.call(this, layer);

    if (!this._drawing || layer._empty()) {
        return;
    }

    var p = layer._point,
        ctx = this._ctx,
        r = Math.max(Math.round(layer._radius), 1)
    //,s = (Math.max(Math.round(layer._radiusY), 1) || r) / r;

    var options = layer.options;

    var scale = Math.pow(2, this._map.getZoom()) * 256 / Math.PI / 6378137;
    scale = Math.pow(scale, options.boostExp) * options.boostScale;
    r = r * scale;
    if (!options.boostType) {
        ctx.beginPath();
        ctx.arc(p.x, p.y, r, 0, Math.PI * 2, false);
        this._fillStroke(ctx, layer);
    }
    else switch (options.boostType) {
        case 'ball':
            if (options.fill) {
                if (options.stroke && options.weight !== 0)
                    r = r + options.weight * 0.5 * scale;
                let grd = ctx.createRadialGradient(p.x - r / 2, p.y - r / 2, 0, p.x, p.y, 1.5 * r);
                grd.addColorStop(0, options.fillColor);
                grd.addColorStop(1, options.color);
                ctx.beginPath();
                ctx.fillStyle = grd;
                ctx.arc(p.x, p.y, r, 0, Math.PI * 2, false);
                ctx.fill(options.fillRule || 'evenodd');
            }
            break;
        case 'balloon':
            if (options.fill) {
                if (options.stroke && options.weight !== 0)
                    r = r + options.weight * 0.5 * scale;
                // this condition is used to identify if employee is at suggested location and draw a star on top of marker
                let grd = ctx.createRadialGradient(p.x - r / 2, p.y - r / 2 - 2 * r, 0, p.x, p.y - 2 * r, 2.5 * r);
                grd.addColorStop(0, options.fillColor);
                grd.addColorStop(1, options.color);
                ctx.beginPath();
                ctx.fillStyle = grd;
                ctx.moveTo(p.x, p.y);
                ctx.lineTo(p.x - r, p.y - 2 * r);
                ctx.lineTo(p.x + r, p.y - 2 * r);
                ctx.lineTo(p.x, p.y);
                ctx.arc(p.x, p.y - 2 * r, r, 0, Math.PI * 2, false);
                ctx.closePath();
                ctx.fill(options.fillRule = 'nonzero');
                if(options.suggestedLocation)
                    drawStar(p.x, p.y - 2 * r, 5, 3, 1.5, ctx);
            }
            break;
        case 'borderedball':
            if (options.fill) {
                if (options.stroke && options.weight !== 0)
                    r = r + options.weight * 0.5 * scale;
                let grd = ctx.createRadialGradient(p.x - r / 2, p.y - r / 2, 0, p.x, p.y, 1.5 * r);
                grd.addColorStop(0, options.fillColor);
                grd.addColorStop(1, options.color);
                ctx.beginPath();
                drawStar(p.x, p.y, 5, r, r, ctx);
                ctx.fillStyle = grd;
                ctx.arc(p.x, p.y, r, 0, Math.PI * 2, false);
                ctx.fill(options.fillRule || 'evenodd');
            }
            break;
        default:
            if (options.stroke && options.weight !== 0) {
                ctx.beginPath();
                ctx.arc(p.x, p.y, r + options.weight * 0.5 * scale, 0, Math.PI * 2, false);
                ctx.fillStyle = options.color;
                ctx.fill(options.fillRule || 'evenodd');
            }

            if (options.fill) {
                ctx.beginPath();
                ctx.arc(p.x, p.y, r - ((options.stroke && options.weight !== 0) ? options.weight * 0.5 * scale : 0), 0, Math.PI * 2, false);
                ctx.fillStyle = options.fillColor || options.color;
                ctx.fill(options.fillRule || 'evenodd');
            }
    }
};

var xproto = L.CircleMarker.prototype;
var xprev = xproto._containsPoint;

xproto._containsPoint = function (p) {
    if (this instanceof L.Circle)
        return xprev.call(this, p);

    var r = this._radius;

    var options = this.options;
    var scale = Math.pow(2, this._map.getZoom()) * 256 / Math.PI / 6378137;
    scale = Math.pow(scale, options.boostExp) * options.boostScale;
    r = r * scale;
    r = r + (this.options.stroke ? this.options.weight * scale / 2 : 0);

    if (options.boostType === 'balloon')
        p = new L.Point(p.x, p.y + 2 * r);

    return p.distanceTo(this._point) <= r + this._clickTolerance();
    // clickTolerance only for mobile! (seems to be fixed with LL1.4)
    // return p.distanceTo(this._point) <= r + ((L.Browser.touch && L.Browser.mobile) ? 10 : 0);
};

var cproto = L.Layer.prototype;
var cprev = cproto._openPopup;
cproto._openPopup = function (e) {
    var layer = e.layer || e.target;

    if (!(layer instanceof L.CircleMarker) || (layer instanceof L.Circle))
        return cprev.call(this, e);

    if (!this._popup) {
        return;
    }

    if (!this._map) {
        return;
    }

    // prevent map click
    L.DomEvent.stop(e);
    // treat it like a marker and figure out
    // if we should toggle it open/closed
    if (this._map.hasLayer(this._popup) && this._popup._source === layer) {
        this.closePopup();
    } else {
        this.openPopup(layer._latlng);
        layer.on('preclick', L.DomEvent.stopPropagation);
    }
};

var pproto = L.Popup.prototype;
var p_getAnchor = pproto._getAnchor;
pproto._getAnchor = function () {
    if (!(this._source instanceof L.CircleMarker) || this._source instanceof L.Circle)
        return p_getAnchor.call(this);
    var r = this._source._radius;
    var options = this._source.options;
    //var zoomScale;
    var scale = Math.pow(2, this._map.getZoom()) * 256 / Math.PI / 6378137;
    scale = Math.pow(scale, options.boostExp) * options.boostScale;
    if (options.boostType === 'balloon')
        r = 2.5 * r * scale;
    else
        r = 0.5 * r * scale;
    // Where should we anchor the popup on the source layer?
    return L.point(this._source && this._source._getPopupAnchor ? this._source._getPopupAnchor() : [0, -r]);
};
})();

function drawDiamond(context, x, y, width, height) {
context.moveTo(x, y);
// top left edge
context.lineTo(x - width / 2, y + height / 2);
// bottom left edge
context.lineTo(x, y + height);
// bottom right edge
context.lineTo(x + width / 2, y + height / 2);
}

function drawStar(cx, cy, spikes, outerRadius, innerRadius, ctx) {
var rot = Math.PI / 2 * 3;
var x = cx;
var y = cy;
var step = Math.PI / spikes;
ctx.beginPath();
ctx.moveTo(cx, cy - outerRadius)
for (let i = 0; i < spikes; i++) {
    x = cx + Math.cos(rot) * outerRadius;
    y = cy + Math.sin(rot) * outerRadius;
    ctx.lineTo(x, y)
    rot += step

    x = cx + Math.cos(rot) * innerRadius;
    y = cy + Math.sin(rot) * innerRadius;
    ctx.lineTo(x, y)
    rot += step
}
ctx.lineTo(cx, cy - outerRadius);
ctx.closePath();
ctx.lineWidth = 5;
ctx.strokeStyle = 'blue';
ctx.stroke();
ctx.fillStyle = 'skyblue';
ctx.fill();
}
</code>```

Please suggest a solution to render canvas markers as they were before setting renderer value to L.svg.

Body:
I have set renderer value L.svg with a padding of 100 for map as shown below

Before setting this option canvas markers were visible like this

After setting renderer option markers are visible like this

Code to render canvas marker is as follows

(function () {
var proto = L.Canvas.prototype;
var prev = proto._updateCircle;

proto._updateCircle = function (layer) {
    // only circleMARKER, not the standard circle
    if (layer instanceof L.Circle)
        return prev.call(this, layer);

    if (!this._drawing || layer._empty()) {
        return;
    }

    var p = layer._point,
        ctx = this._ctx,
        r = Math.max(Math.round(layer._radius), 1)
    //,s = (Math.max(Math.round(layer._radiusY), 1) || r) / r;

    var options = layer.options;

    var scale = Math.pow(2, this._map.getZoom()) * 256 / Math.PI / 6378137;
    scale = Math.pow(scale, options.boostExp) * options.boostScale;
    r = r * scale;
    if (!options.boostType) {
        ctx.beginPath();
        ctx.arc(p.x, p.y, r, 0, Math.PI * 2, false);
        this._fillStroke(ctx, layer);
    }
    else switch (options.boostType) {
        case 'ball':
            if (options.fill) {
                if (options.stroke && options.weight !== 0)
                    r = r + options.weight * 0.5 * scale;
                let grd = ctx.createRadialGradient(p.x - r / 2, p.y - r / 2, 0, p.x, p.y, 1.5 * r);
                grd.addColorStop(0, options.fillColor);
                grd.addColorStop(1, options.color);
                ctx.beginPath();
                ctx.fillStyle = grd;
                ctx.arc(p.x, p.y, r, 0, Math.PI * 2, false);
                ctx.fill(options.fillRule || 'evenodd');
            }
            break;
        case 'balloon':
            if (options.fill) {
                if (options.stroke && options.weight !== 0)
                    r = r + options.weight * 0.5 * scale;
                // this condition is used to identify if employee is at suggested location and draw a star on top of marker
                let grd = ctx.createRadialGradient(p.x - r / 2, p.y - r / 2 - 2 * r, 0, p.x, p.y - 2 * r, 2.5 * r);
                grd.addColorStop(0, options.fillColor);
                grd.addColorStop(1, options.color);
                ctx.beginPath();
                ctx.fillStyle = grd;
                ctx.moveTo(p.x, p.y);
                ctx.lineTo(p.x - r, p.y - 2 * r);
                ctx.lineTo(p.x + r, p.y - 2 * r);
                ctx.lineTo(p.x, p.y);
                ctx.arc(p.x, p.y - 2 * r, r, 0, Math.PI * 2, false);
                ctx.closePath();
                ctx.fill(options.fillRule = 'nonzero');
                if(options.suggestedLocation)
                    drawStar(p.x, p.y - 2 * r, 5, 3, 1.5, ctx);
            }
            break;
        case 'borderedball':
            if (options.fill) {
                if (options.stroke && options.weight !== 0)
                    r = r + options.weight * 0.5 * scale;
                let grd = ctx.createRadialGradient(p.x - r / 2, p.y - r / 2, 0, p.x, p.y, 1.5 * r);
                grd.addColorStop(0, options.fillColor);
                grd.addColorStop(1, options.color);
                ctx.beginPath();
                drawStar(p.x, p.y, 5, r, r, ctx);
                ctx.fillStyle = grd;
                ctx.arc(p.x, p.y, r, 0, Math.PI * 2, false);
                ctx.fill(options.fillRule || 'evenodd');
            }
            break;
        default:
            if (options.stroke && options.weight !== 0) {
                ctx.beginPath();
                ctx.arc(p.x, p.y, r + options.weight * 0.5 * scale, 0, Math.PI * 2, false);
                ctx.fillStyle = options.color;
                ctx.fill(options.fillRule || 'evenodd');
            }

            if (options.fill) {
                ctx.beginPath();
                ctx.arc(p.x, p.y, r - ((options.stroke && options.weight !== 0) ? options.weight * 0.5 * scale : 0), 0, Math.PI * 2, false);
                ctx.fillStyle = options.fillColor || options.color;
                ctx.fill(options.fillRule || 'evenodd');
            }
    }
};

var xproto = L.CircleMarker.prototype;
var xprev = xproto._containsPoint;

xproto._containsPoint = function (p) {
    if (this instanceof L.Circle)
        return xprev.call(this, p);

    var r = this._radius;

    var options = this.options;
    var scale = Math.pow(2, this._map.getZoom()) * 256 / Math.PI / 6378137;
    scale = Math.pow(scale, options.boostExp) * options.boostScale;
    r = r * scale;
    r = r + (this.options.stroke ? this.options.weight * scale / 2 : 0);

    if (options.boostType === 'balloon')
        p = new L.Point(p.x, p.y + 2 * r);

    return p.distanceTo(this._point) <= r + this._clickTolerance();
    // clickTolerance only for mobile! (seems to be fixed with LL1.4)
    // return p.distanceTo(this._point) <= r + ((L.Browser.touch && L.Browser.mobile) ? 10 : 0);
};

var cproto = L.Layer.prototype;
var cprev = cproto._openPopup;
cproto._openPopup = function (e) {
    var layer = e.layer || e.target;

    if (!(layer instanceof L.CircleMarker) || (layer instanceof L.Circle))
        return cprev.call(this, e);

    if (!this._popup) {
        return;
    }

    if (!this._map) {
        return;
    }

    // prevent map click
    L.DomEvent.stop(e);
    // treat it like a marker and figure out
    // if we should toggle it open/closed
    if (this._map.hasLayer(this._popup) && this._popup._source === layer) {
        this.closePopup();
    } else {
        this.openPopup(layer._latlng);
        layer.on('preclick', L.DomEvent.stopPropagation);
    }
};

var pproto = L.Popup.prototype;
var p_getAnchor = pproto._getAnchor;
pproto._getAnchor = function () {
    if (!(this._source instanceof L.CircleMarker) || this._source instanceof L.Circle)
        return p_getAnchor.call(this);
    var r = this._source._radius;
    var options = this._source.options;
    //var zoomScale;
    var scale = Math.pow(2, this._map.getZoom()) * 256 / Math.PI / 6378137;
    scale = Math.pow(scale, options.boostExp) * options.boostScale;
    if (options.boostType === 'balloon')
        r = 2.5 * r * scale;
    else
        r = 0.5 * r * scale;
    // Where should we anchor the popup on the source layer?
    return L.point(this._source && this._source._getPopupAnchor ? this._source._getPopupAnchor() : [0, -r]);
};
})();

function drawDiamond(context, x, y, width, height) {
context.moveTo(x, y);
// top left edge
context.lineTo(x - width / 2, y + height / 2);
// bottom left edge
context.lineTo(x, y + height);
// bottom right edge
context.lineTo(x + width / 2, y + height / 2);
}

function drawStar(cx, cy, spikes, outerRadius, innerRadius, ctx) {
var rot = Math.PI / 2 * 3;
var x = cx;
var y = cy;
var step = Math.PI / spikes;
ctx.beginPath();
ctx.moveTo(cx, cy - outerRadius)
for (let i = 0; i < spikes; i++) {
    x = cx + Math.cos(rot) * outerRadius;
    y = cy + Math.sin(rot) * outerRadius;
    ctx.lineTo(x, y)
    rot += step

    x = cx + Math.cos(rot) * innerRadius;
    y = cy + Math.sin(rot) * innerRadius;
    ctx.lineTo(x, y)
    rot += step
}
ctx.lineTo(cx, cy - outerRadius);
ctx.closePath();
ctx.lineWidth = 5;
ctx.strokeStyle = 'blue';
ctx.stroke();
ctx.fillStyle = 'skyblue';
ctx.fill();
}

Please suggest a solution to render canvas markers as they were before setting renderer value to L.svg.


来源: stackexchange

问:
How to pass file parameters to upstream pipeline job in build step plugin
```<code>def BUILD_USER = currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')
pipeline {
    agent {label "master"}
    parameters {
        string(name: 'BUILD', defaultValue: '123')
        booleanParam(name: 'Deploy', defaultValue: 'true')
        booleanParam(name: 'Upgrade_Config', defaultValue: 'true')
        booleanParam(name: 'SchemaComparison', defaultValue: 'false')
        booleanParam(name: 'Publish_Server', defaultValue: 'false')
    }

    stages {
        stage ('Start Deployment') {
            agent {label "master"}
            steps{
                script{
                    sh '''
                        rm -rf /params/parameters
                        cd /params
                        echo $BUILD_USER
                        python3 buildParameters.py --Build=$BUILD --Publish_VM=$Publish_Server --userName=BUILD_USER --Upgrade_Config=$Upgrade_Config
                '''
                file = readFile('/params/parameters.txt')
                }
            }
        }
        stage ('UpgradeConfigurations') {
            when {
                expression { params.Deploy == true }
            }
            agent {label "master"}
            environment {
                          file = "${file}"
                        }
            steps{
                script{
                    println("${file}")
                build(job: 'UpgradeConfigurations', parameters: [ file(name: 'parameters', file: "${file}"), string(name: 'build_uniqe_id' , value: "${BUILD_USER}") , booleanParam(name: 'Deploy' , value: "${Deploy}") , booleanParam(name: 'SchemaComparison' , value: "${SchemaComparison}")], propagate: false, wait: false )

               }
            }
         }
    }
}

</code>```

buildParameters.py file generate some additional parameters in parameters.txt file on master vm and I am trying to pass it to the upstream job UpgradeConfigurations

Upstream job UpgradeConfigurations is getting started but file parameters are not getting passed as parameters to it.

I have tried using base64file as well but no luck.

Referred Build Plugin doc:
https://www.jenkins.io/doc/pipeline/steps/pipeline-build-step/

ContentLicense: CC BY-SA 4.0

Body:
def BUILD_USER = currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')
pipeline {
    agent {label "master"}
    parameters {
        string(name: 'BUILD', defaultValue: '123')
        booleanParam(name: 'Deploy', defaultValue: 'true')
        booleanParam(name: 'Upgrade_Config', defaultValue: 'true')
        booleanParam(name: 'SchemaComparison', defaultValue: 'false')
        booleanParam(name: 'Publish_Server', defaultValue: 'false')
    }

    stages {
        stage ('Start Deployment') {
            agent {label "master"}
            steps{
                script{
                    sh '''
                        rm -rf /params/parameters
                        cd /params
                        echo $BUILD_USER
                        python3 buildParameters.py --Build=$BUILD --Publish_VM=$Publish_Server --userName=BUILD_USER --Upgrade_Config=$Upgrade_Config
                '''
                file = readFile('/params/parameters.txt')
                }
            }
        }
        stage ('UpgradeConfigurations') {
            when {
                expression { params.Deploy == true }
            }
            agent {label "master"}
            environment {
                          file = "${file}"
                        }
            steps{
                script{
                    println("${file}")
                build(job: 'UpgradeConfigurations', parameters: [ file(name: 'parameters', file: "${file}"), string(name: 'build_uniqe_id' , value: "${BUILD_USER}") , booleanParam(name: 'Deploy' , value: "${Deploy}") , booleanParam(name: 'SchemaComparison' , value: "${SchemaComparison}")], propagate: false, wait: false )

               }
            }
         }
    }
}

buildParameters.py file generate some additional parameters in parameters.txt file on master vm and I am trying to pass it to the upstream job UpgradeConfigurations

Upstream job UpgradeConfigurations is getting started but file parameters are not getting passed as parameters to it.

I have tried using base64file as well but no luck.

Referred Build Plugin doc:
https://www.jenkins.io/doc/pipeline/steps/pipeline-build-step/


问:
spring Hystrix command causing exception org.springframework.dao.InvalidDataAccessApiUsageException: detached entity passed to persist
i have Hystrix command written on controller class

```<code>@HystrixCommand(groupKey = "sctGroup", commandKey = "createStandaloneController", threadPoolKey = "create-sct-pool",
  ignoreExceptions = {BadRequestException.class})
</code>```

i have a repository.save written in the service for an entity with one to one mapping.

hystrix is causing exception

```<code>org.springframework.dao.InvalidDataAccessApiUsageException: detached entity passed to persist:
</code>```

when i remove the Hystrix command annotation the functionality is working as expected. however failing with hystrix.

Body:
i have Hystrix command written on controller class

@HystrixCommand(groupKey = "sctGroup", commandKey = "createStandaloneController", threadPoolKey = "create-sct-pool",
  ignoreExceptions = {BadRequestException.class})

i have a repository.save written in the service for an entity with one to one mapping.

hystrix is causing exception

org.springframework.dao.InvalidDataAccessApiUsageException: detached entity passed to persist:

when i remove the Hystrix command annotation the functionality is working as expected. however failing with hystrix.


问:
Transform rotate is not working in custom angular accordion
I want to rotate icon as Transform: rotate(180deg). This property is not working but background-color: blue; is working perfectly.
The classname iconUp is active while click accordion button. eg: [class.iconUp]="id === 'f1'".

```<code><div class="pricing-accordion">
    <div class="pricing-accordion__item pb-30">
        <div class="pricing-accordion__item--header" id="f1" (click)="openAccordion('f1')" [class.iconUp]="id === 'f1'">
            <button>This is a title <span><i class="flaticon-down-arrow"></i></span></button>
        </div>
        <div class="pricing-accordion__item--body" *ngIf="id === 'f1'">
            <p>
                Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime, voluptas   quaerat, vitae quisquam
                aperiam, consequuntur neque consequatur esse nesciunt cupiditate corporis minima nulla magni
                repellendus. Repellendus optio asperiores similique! Magnam.
            </p>
        </div>
    </div>

    <div class="pricing-accordion__item pb-30">
        <div class="pricing-accordion__item--header" id="f2" (click)="openAccordion('f2')" [class.iconUp]="id === 'f2'">
            <button>This is a title <span><i class="flaticon-down-arrow"></i></span></button>
        </div>
        <div class="pricing-accordion__item--body" *ngIf="id === 'f2'">
            <p>
                Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime, voluptas quaerat, vitae quisquam
                aperiam, consequuntur neque consequatur esse nesciunt cupiditate corporis minima nulla magni
                repellendus. Repellendus optio asperiores similique! Magnam.
            </p>
        </div>
    </div>
</div>

</code>```
```<code>.iconUp {
    button {
        span {
            i {
                transform: rotate(20deg);
                -webkit-transform: rotate(20deg);
                -moz-transform: rotate(20deg);
                background-color: blue;
                font-size: 30px;
            }
        }

    }
}
</code>```
```<code>id:any = 'f1';

    openAccordion (ids:any) {
        console.log(ids);
        if(this.id == ids) {
            this.id = '';
        }
        else {
            this.id = ids;
        }
    }
</code>```

Body:
I want to rotate icon as Transform: rotate(180deg). This property is not working but background-color: blue; is working perfectly.
The classname iconUp is active while click accordion button. eg: [class.iconUp]="id === 'f1'".

            <button>This is a title </button>

                Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime, voluptas   quaerat, vitae quisquam
                aperiam, consequuntur neque consequatur esse nesciunt cupiditate corporis minima nulla magni
                repellendus. Repellendus optio asperiores similique! Magnam.

            <button>This is a title </button>

                Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime, voluptas quaerat, vitae quisquam
                aperiam, consequuntur neque consequatur esse nesciunt cupiditate corporis minima nulla magni
                repellendus. Repellendus optio asperiores similique! Magnam.

.iconUp {
    button {
        span {
            i {
                transform: rotate(20deg);
                -webkit-transform: rotate(20deg);
                -moz-transform: rotate(20deg);
                background-color: blue;
                font-size: 30px;
            }
        }

    }
}

id:any = 'f1';

    openAccordion (ids:any) {
        console.log(ids);
        if(this.id == ids) {
            this.id = '';
        }
        else {
            this.id = ids;
        }
    }


问:
How to find the AWS glue job transform( visual mapping tool)
In earlier version of AWS glue jobs there was a visual mapping tool that you can map source field to the target fields like below

I can’t find the same feature in the latest version.

How can I get the same view or what is the alternative way of mapping the source to target visually?


问:
error: Field "launch" of type "com.example.spacex.models.launch.LaunchModel" is not supported REALM
i'm trying to do an application that save/get data from realm. My problem is when I declare a realm object with a custom field variable. When I try to run the application the IDE give me this error :

error: Field "launch" of type "com.example.spacex.models.launch.LaunchModel" is not supported.
public final class NextLaunchConfiguration extends io.realm.RealmObject {

this is my custom Realm database class:

`class RealmDatabase(context: Context, selectedConfiguration: Int) {

```<code>private var realm: Realm

init {
    Realm.init(context)
    realm = Realm.getInstance(setUpConfiguration(selectedConfiguration))
    realm.beginTransaction()
}

private fun setUpConfiguration(selectedConfiguration: Int) : RealmConfiguration {
    return RealmConfiguration.Builder()
        .name(getConfiguration(selectedConfiguration)).build()
}

private fun getConfiguration(selectedConfiguration: Int) : String{
    when(selectedConfiguration){
        1 -> return Constants.NEXT_LAUNCH_REALM
    }

    return ""
}

//save and get data for next Launch
fun saveNextLaunch(launch: LaunchModel) {
    val saveLaunch = realm.createObject(NextLaunchConfiguration::class.java)
    saveLaunch.launch.let { launch }
    realm.commitTransaction()
}

fun getNextLaunch() : LaunchModel {
    val data = realm.where(NextLaunchConfiguration::class.java).findAll()
    return data[0]?.launch!!
}

fun closeDatabase() {
    realm.close()
}
</code>```

}`

this is the realmObject :

```<code>`@RealmClass(embedded = true)
class NextLaunchRealmObject : RealmObject() {
    var launch: LaunchModel?= null
}`
</code>```

and this is my LaunchModel:

```<code>class LaunchModel(
    var details: String,
    var id: String,
    var isTentative: Boolean,
    var launchDateLocal: Date,
    var launchDateUnix: Date,
    var launchDateUtc: Date,
    var launchSite: LaunchSiteModel,
    var launchSuccess: Boolean,
    var launchYear: String,
    var links: LaunchLinksModel,
    var missionId: List<String>,
    var missionName: String,
    var rocket: LaunchRocketModel,
    var staticFireDateUnix: Date,
    var staticFireDateUtc: Date,
    var telemetry: LaunchTelemetryModel,
    var tentativeMaxPrecision: String,
    var upComing: Boolean,
    var ships : List<ShipModel>,
)
</code>```

I tried to implement custom embedded object like in the guide ok realm but it doesn't work and I can't change the model because I'm using it for retrofit api call.

Body:
i'm trying to do an application that save/get data from realm. My problem is when I declare a realm object with a custom field variable. When I try to run the application the IDE give me this error :

error: Field "launch" of type "com.example.spacex.models.launch.LaunchModel" is not supported.
public final class NextLaunchConfiguration extends io.realm.RealmObject {

this is my custom Realm database class:

`class RealmDatabase(context: Context, selectedConfiguration: Int) {

private var realm: Realm

init {
    Realm.init(context)
    realm = Realm.getInstance(setUpConfiguration(selectedConfiguration))
    realm.beginTransaction()
}

private fun setUpConfiguration(selectedConfiguration: Int) : RealmConfiguration {
    return RealmConfiguration.Builder()
        .name(getConfiguration(selectedConfiguration)).build()
}

private fun getConfiguration(selectedConfiguration: Int) : String{
    when(selectedConfiguration){
        1 -> return Constants.NEXT_LAUNCH_REALM
    }

    return ""
}

//save and get data for next Launch
fun saveNextLaunch(launch: LaunchModel) {
    val saveLaunch = realm.createObject(NextLaunchConfiguration::class.java)
    saveLaunch.launch.let { launch }
    realm.commitTransaction()
}

fun getNextLaunch() : LaunchModel {
    val data = realm.where(NextLaunchConfiguration::class.java).findAll()
    return data[0]?.launch!!
}

fun closeDatabase() {
    realm.close()
}

}`

this is the realmObject :

`@RealmClass(embedded = true)
class NextLaunchRealmObject : RealmObject() {
    var launch: LaunchModel?= null
}`

and this is my LaunchModel:

class LaunchModel(
    var details: String,
    var id: String,
    var isTentative: Boolean,
    var launchDateLocal: Date,
    var launchDateUnix: Date,
    var launchDateUtc: Date,
    var launchSite: LaunchSiteModel,
    var launchSuccess: Boolean,
    var launchYear: String,
    var links: LaunchLinksModel,
    var missionId: List<String>,
    var missionName: String,
    var rocket: LaunchRocketModel,
    var staticFireDateUnix: Date,
    var staticFireDateUtc: Date,
    var telemetry: LaunchTelemetryModel,
    var tentativeMaxPrecision: String,
    var upComing: Boolean,
    var ships : List<ShipModel>,
)

I tried to implement custom embedded object like in the guide ok realm but it doesn't work and I can't change the model because I'm using it for retrofit api call.


问:
How can I compare 2 result
I want to compare 2 results.

I want to check if there is a difference between predicate = 'description' and predicate = '#shortDescription' (to avoid duplicates especially).

here is my ddl (I did not manage to declare the variable). https://dbfiddle.uk/o7cHpbBl

I don't understand why the except doesn't work when I applied the same logic as here

thank you

Title: How can I compare 2 result


问:
I want to be able to add items from a DataTemplate (CollectionView) into an ObservableCollection
I am trying to add some Addons to my Booking Checkout page,

Screenshot of Wireframe

The Addons are displayed in a CollectionView, based on what addons are available for that office they are trying to book:

BookingInfo.xaml

```<code><CollectionView x:Name="AddonSelection" ItemsSource="{Binding OfficeAddons}" SelectionMode="None">
                <CollectionView.EmptyView>
                    <Label Text="No Addons for this Office" TextColor="Gray" HorizontalOptions="Center" VerticalOptions="Center"/>
                </CollectionView.EmptyView>
                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <StackLayout Spacing="10" Orientation="Vertical" Padding="10, 10, 10, 10">
                            <Image Source="{Binding ImgName}" Aspect="AspectFill" HorizontalOptions="FillAndExpand" />
                            <StackLayout Orientation="Horizontal">
                                <Label Text="{Binding Name}" FontSize="Micro"/>
                                <Label Text="{Binding Price}" FontSize="Micro" FontAttributes="Bold"/>
                            </StackLayout>
                            <StackLayout Orientation="Vertical" HorizontalOptions="Center">
                                <Label x:Name="AddonQuantity" Text="{Binding SelectedQuantity}"/>
                                <Stepper x:Name="AddonQuantityStepper" Minimum="0" Maximum="{Binding Quantity}" Increment="1" Value="{Binding StepperValue}" HorizontalOptions="Center" />
                            </StackLayout>
                        </StackLayout>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>
</code>```

The issue I have is that I want to create an observable collection of Addon to my Booking Model, to record what addons and quantity the user has added to their booking.

My goal is to foreach loop in every datatemplate 'stacklayout' created in my collection view, check if stepper value > 0 and add the Binding ImgName, Name, Price and StepperValue (Quantity) to my new observablecollection.

This is what I have so far in my SaveBooking() in the ViewModel fro my BookingInfo.

BookingInfoVM.cs

```<code> public int SaveBooking()
    {
        int addstatus = 0;

        double numhours = CalculateBookingHourLenght();
        bool isActive = IsBookingActive();

        Models.Booking newbooking = new Models.Booking();
        ...

        // Addons

        foreach (Models.Addon OfficeAddon in OfficeAddons)
            // foreach (StackLayout Data in CollectView:AddonSelection)
        {
            // if steppervalue >=1 then ...
            newbooking.BookedAddons.Add(new Models.Addon
            {
                ImgName = OfficeAddon.ImgName,
                Name = OfficeAddon.Name,
                Price = OfficeAddon.Price,
                Quantity = StepperValue //Stuck
            });
        }
        globalref.TempBooking = newbooking;

        //addstatus = DBInstance.AddBooking(newbooking);

        return addstatus;
    }
</code>```

Booking Model
Booking.cs

```<code>public class Booking
{
    [PrimaryKey, AutoIncrement]
    public int BID { get; set; }
    public DateTime Start_datetime { get; set; }
    //public TimeSpan Start_time { get; set; }
    public DateTime End_datetime { get; set; }
    //public TimeSpan End_time { get; set; }
    public bool isActive { get; set; }
    public double Total_hours { get; set; }
    public int NumGuests { get; set; }
    public string Activity { get; set; }
    public string TimePeriod { get; set; }
    //Payment

    // Foregin key to Booked Office
    public int OID { get; set; }
    public int HID { get; set; }
    public string OName { get; set; }
    public string OLocation { get; set; }

    // list of booked selected addons
    public ObservableCollection<Models.Addon> BookedAddons { get; set; }

    //public double TotalAddonPrice { get; set; }

    // Foregin key to Guest User
    public int UID { get; set; }
    public string GName { get; set; }

    public double OfficePrice { get; set; } // Office Hourly * Total_hours
    public double ServiceFee { get; set; } // set equal to (addon price + office price) * 0.15
    public double FinalPrice { get; set; } // equal to office + addon + service

}
</code>```

Addon Model Addon.cs

```<code>    public class Addon
{
    [PrimaryKey, AutoIncrement]
    public int AID { get; set; }
    [Unique]
    public string Name { get; set; }
    public int Quantity { get; set; }
    public double Price { get; set; }
    public string ImgName { get; set; }

    // link to Office by ID
    public int OID { get; set; }
}
</code>```

Any help or suggestions would be greatly appreciated!

EDIT:

I need help with creating the foreach loop to iterate through each stacklayout in my collection view, to then save the values of the labels to an observablecollection of addons in the booking.

Body:
I am trying to add some Addons to my Booking Checkout page,

Screenshot of Wireframe

The Addons are displayed in a CollectionView, based on what addons are available for that office they are trying to book:

BookingInfo.xaml

<CollectionView x:Name="AddonSelection" ItemsSource="{Binding OfficeAddons}" SelectionMode="None">
                <CollectionView.EmptyView>

                </CollectionView.EmptyView>
                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <StackLayout Spacing="10" Orientation="Vertical" Padding="10, 10, 10, 10">
                            <Image Source="{Binding ImgName}" Aspect="AspectFill" HorizontalOptions="FillAndExpand" />
                            <StackLayout Orientation="Horizontal">

                            </StackLayout>
                            <StackLayout Orientation="Vertical" HorizontalOptions="Center">

                                <Stepper x:Name="AddonQuantityStepper" Minimum="0" Maximum="{Binding Quantity}" Increment="1" Value="{Binding StepperValue}" HorizontalOptions="Center" />
                            </StackLayout>
                        </StackLayout>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>

The issue I have is that I want to create an observable collection of Addon to my Booking Model, to record what addons and quantity the user has added to their booking.

My goal is to foreach loop in every datatemplate 'stacklayout' created in my collection view, check if stepper value > 0 and add the Binding ImgName, Name, Price and StepperValue (Quantity) to my new observablecollection.

This is what I have so far in my SaveBooking() in the ViewModel fro my BookingInfo.

BookingInfoVM.cs

 public int SaveBooking()
    {
        int addstatus = 0;

        double numhours = CalculateBookingHourLenght();
        bool isActive = IsBookingActive();

        Models.Booking newbooking = new Models.Booking();
        ...

        // Addons

        foreach (Models.Addon OfficeAddon in OfficeAddons)
            // foreach (StackLayout Data in CollectView:AddonSelection)
        {
            // if steppervalue >=1 then ...
            newbooking.BookedAddons.Add(new Models.Addon
            {
                ImgName = OfficeAddon.ImgName,
                Name = OfficeAddon.Name,
                Price = OfficeAddon.Price,
                Quantity = StepperValue //Stuck
            });
        }
        globalref.TempBooking = newbooking;

        //addstatus = DBInstance.AddBooking(newbooking);

        return addstatus;
    }

Booking Model
Booking.cs

public class Booking
{
    [PrimaryKey, AutoIncrement]
    public int BID { get; set; }
    public DateTime Start_datetime { get; set; }
    //public TimeSpan Start_time { get; set; }
    public DateTime End_datetime { get; set; }
    //public TimeSpan End_time { get; set; }
    public bool isActive { get; set; }
    public double Total_hours { get; set; }
    public int NumGuests { get; set; }
    public string Activity { get; set; }
    public string TimePeriod { get; set; }
    //Payment

    // Foregin key to Booked Office
    public int OID { get; set; }
    public int HID { get; set; }
    public string OName { get; set; }
    public string OLocation { get; set; }

    // list of booked selected addons
    public ObservableCollection<Models.Addon> BookedAddons { get; set; }

    //public double TotalAddonPrice { get; set; }

    // Foregin key to Guest User
    public int UID { get; set; }
    public string GName { get; set; }

    public double OfficePrice { get; set; } // Office Hourly * Total_hours
    public double ServiceFee { get; set; } // set equal to (addon price + office price) * 0.15
    public double FinalPrice { get; set; } // equal to office + addon + service

}

Addon Model Addon.cs

    public class Addon
{
    [PrimaryKey, AutoIncrement]
    public int AID { get; set; }
    [Unique]
    public string Name { get; set; }
    public int Quantity { get; set; }
    public double Price { get; set; }
    public string ImgName { get; set; }

    // link to Office by ID
    public int OID { get; set; }
}

Any help or suggestions would be greatly appreciated!

EDIT:

I need help with creating the foreach loop to iterate through each stacklayout in my collection view, to then save the values of the labels to an observablecollection of addons in the booking.


问:
MSSQL Multiple FKs in table: cannot have multiple cascade/set nulls?
I have a fairly simple design, as follows:

What I want to achieve in my grouping_individual_history is marked in red:

when a session is deleted, I want to cascade delete the grouping_history....

when a grouping is deleted, I just want the child field to be nullified

It seems that MSSQL will not allow me to have more than one FK that does something else than no action ... It'll complain with:

Introducing FOREIGN KEY constraint 'FK_grouping_individual_history_grouping' on table 'grouping_individual_history' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.

I've already read this post (https://www.mssqltips.com/sqlservertip/2733/solving-the-sql-server-multiple-cascade-path-issue-with-a-trigger/), although it's not quite the same scenario it seems to me.

I've tried doing a INSTEAD OF DELETE trigger on my grouping table, but it wont accept it, because in turn, my grouping table has another FK (fkSessionID) that does a cascade delete... So, the fix would be to change it all, in all affected tables with FKs. The chain is long though, and we cannot consider it.

For one thing, can someone explain to me why SQL Server is giving me the issue for this very simple scenario in the first place? I just don't understand it.

Is there another workaround I could use (besides just removing the foreign key link from my grouping_individual_history table)?


问:
Dynamically changing "config" values in Jodit editor
I would like to change "config" values in existing Jodit editor instances. I have following code:

```<code>var editor = Jodit.make(textarea,{allowResizeY: false, showCharsCounter: false,
                                  showWordsCounter: false,
                                  showXPathInStatusbar: false,
                                  inline: isDisabled,
                                  defaultLineHeight: 1,
                                  minHeight: 40,
                                  style: { fontFamily: 'monospace'}});
</code>```

Let's say later I would like to add and have effect: style: { backgroundColor: "white" } or minHeight: 100. What should be correct approach to do that ?

Body:
I would like to change "config" values in existing Jodit editor instances. I have following code:

var editor = Jodit.make(textarea,{allowResizeY: false, showCharsCounter: false,
                                  showWordsCounter: false,
                                  showXPathInStatusbar: false,
                                  inline: isDisabled,
                                  defaultLineHeight: 1,
                                  minHeight: 40,
                                  style: { fontFamily: 'monospace'}});

Let's say later I would like to add and have effect: style: { backgroundColor: "white" } or minHeight: 100. What should be correct approach to do that ?


问:
Is there a markdown to use the Dropox integration in Notion?
I want to generate a Notion page containing a document preview from my dropbox account.

I need to write a markdown file that will be imported into Notion, but I don't know if there is such a Markdown instruction in the Notion Markdown.

Of course, if I had to use the GUI, the same result could be achieved by typing "/Dropbox"


问:
WebClient configuration with Spring Cloud LoadBalancer considering zone preference
I am configuring a WebClient Bean using Spring Cloud Load Balancer with Multi-AZ configurations (e.g. A and B Zone), and I want to request A Zone first, and if I cannot connect to A Zone, I want to request it to B Zone.
What form should it be in at this time?

Configuration.java

@Bean
public WebClient webClient(ReactorLoadBalancerExchangeFilterFunction loadBalancerFilterFunction) {
  ...
  return WebClient.builder()
                  .filter(loadBalancerFilterFunction)
                  .baseUrl("http://[a?b?]")
                  .build();
}
```
<p><code>application.yml</code></p>
<pre class="lang-yaml prettyprint-override"><code>spring:
  cloud:
    discovery:
      client:
        simple:
          instances:
            a:
              // ServiceInstances
            b:
              // ServiceInstances
</code>```

Body:
I am configuring a WebClient Bean using Spring Cloud Load Balancer with Multi-AZ configurations (e.g. A and B Zone), and I want to request A Zone first, and if I cannot connect to A Zone, I want to request it to B Zone.
What form should it be in at this time?

Configuration.java

@Bean
public WebClient webClient(ReactorLoadBalancerExchangeFilterFunction loadBalancerFilterFunction) {
  ...
  return WebClient.builder()
                  .filter(loadBalancerFilterFunction)
                  .baseUrl("http://[a?b?]")
                  .build();
}

application.yml

spring:
  cloud:
    discovery:
      client:
        simple:
          instances:
            a:
              // ServiceInstances
            b:
              // ServiceInstances


问:
To decrease the ANDROID13(AOSP) .img memory sizes
I have cloned the AOSP master source code and compiled it. All required .img files are generated in the OUT directory and the size of the overall image is 14.1GB.

Now I am trying to decrease the .img files to as much as possible.

Removed preinstalled apps, but not getting much effect on the sizes.

Can you please suggest/clue me, which is the better way to decrease the image size?

Note: My target device's memory size is too small(Less than 4GB) because of this I am trying to discrete the memory size. I just need to flash android not required all features like AB OTA, BT, camera, etc...


问:
CK Editor does not format newline characters like \n
CK Editor is not formatting some string with html \n. The string containing \n are not coming in new line.

Ex:
text = "hello \n test";

In my CKEditor it displays as follows Text "hellotest"

Any inputs on this one please.


问:
Loading srfi in guile scheme
I found out that the srfi's already used
live under /user/guile/3.0/srfi/. This is also in the load-path variable.
Now I go into /user/guile/3.0/srfi/ and 'git clone github-link-to-srfi-25' but I can not load the code via

```<code>(use-module
    (srfi srfi-25))
</code>```

in geiser.
I noticed that the other srfi's living there don't consist of
git projects and also sometimes are 100 % html code so I am really
confused right now on how to use code in the srfi. Do I have to
define the module myself?

Title: Loading srfi in guile scheme

Body:
I found out that the srfi's already used
live under /user/guile/3.0/srfi/. This is also in the load-path variable.
Now I go into /user/guile/3.0/srfi/ and 'git clone github-link-to-srfi-25' but I can not load the code via

(use-module
    (srfi srfi-25))

in geiser.
I noticed that the other srfi's living there don't consist of
git projects and also sometimes are 100 % html code so I am really
confused right now on how to use code in the srfi. Do I have to
define the module myself?


问:
Wordpress hook that fires just before the data is stored to the database
I want to intercept the wordpress core "publish submit" form and I have tried few ways of doing it, but unfortunately none of them worked for me.

So, I can't change anything on the frontend since I am developing a plugin that is doing some checkups before the data is stored.

Hooks used:

save_post - fires after everything is stored

wp_insert_post_data - for some reason doesn't run properly

Any other way?

I have checked other questions on the SO, but none helped me.

Thanks


问:
passing date variable in urlopen library in python 3.x
I am trying to pass date value in format yyyymmdd to a url using urlopen library. The date keeps changing for the url which i am trying to hit.

i tried passing date as a variable

```<code>temp_date1 = 20221010

temp_date = str(temp_date1 )

url1 = urlopen('http://logindetails.fernville-factory.com:1098/api/getDetailEmployeeReports?type=loginTime&Date=20211010')
</code>```

i gave this:

```<code>url1 = 'http://logindetails.fernville-factory.com:1098/api/getDetailEmployeeReports?type=loginTime&Date=' + temp_date

url2 = urlopen('url1')
</code>```

AttributeError:

'str' object has no attribute 'read'
unknown url type: 'url1'

Note: i need to pass different date every time, probably future date, for a particular day.

I am new to python. Can anyone please let me know what am i doing wrong and how can i make urlopen work fo url2

Body:
I am trying to pass date value in format yyyymmdd to a url using urlopen library. The date keeps changing for the url which i am trying to hit.

i tried passing date as a variable

temp_date1 = 20221010

temp_date = str(temp_date1 )

url1 = urlopen('http://logindetails.fernville-factory.com:1098/api/getDetailEmployeeReports?type=loginTime&Date=20211010')

i gave this:

url1 = 'http://logindetails.fernville-factory.com:1098/api/getDetailEmployeeReports?type=loginTime&Date=' + temp_date

url2 = urlopen('url1')

AttributeError:

'str' object has no attribute 'read'
unknown url type: 'url1'

Note: i need to pass different date every time, probably future date, for a particular day.

I am new to python. Can anyone please let me know what am i doing wrong and how can i make urlopen work fo url2


问:
"inStream parameter is null" Server Error(REST API)
I want to convert an old application to a new one in which i make HTTP calls (GET/POST/DELETE). I have a model package where i have my POJO classes and i made a DTO package where i have Dto classes. When i make a simple GET method to take a String message as a response i dont have any problem but when i use dependency injection and i want to use GET or POST methods to see some details about my app i get in postman  this message: inStream parameter is null

OwnerResource.java

```<code>        @Path("ownerResource")
        public class OwnerResource {

            @GET
            public Response ping() {         // When i use only this method i dont have any problem and i can see the message
                return Response
                        .ok("pang")
                        .build();
            }

// When i use the below code i have problem in HTTP calls

            @Inject
            private OwnerService ownerService;

            @GET
            @Path("owner/{ownerId}")
            @Produces("application/json")
            public RestApiResult<PropertyOwnerDto> getOwner(@PathParam("ownerId") int ownerId) {
                return ownerService.getOwner(ownerId);

            }

            @POST
            @Path("owner")
            @Produces("application/json")
            @Consumes("application/json")
            public void createNewOwner(PropertyOwnerDto owner) {
            ownerService.createPropertyOwner(owner);

        }
}
</code>```

PropertyOwner.java

```<code>   @Data
    @NoArgsConstructor
    @Entity(name = "propertyowner")
    @Table
    public class PropertyOwner extends PersistentClass {
      // id is in PersistenceClass
      private int vat;
      private String name;
      private String surname;
      private String address;
      private String phoneNumber;
      private String email;
      private String username;
      private String password;
      @OneToMany(mappedBy = "owner", orphanRemoval = true)
      private List<Property> properties;

      public PropertyOwner(int vat, String name, String surname, String address, String phoneNumber, String email, String username, String password) {
        this.vat = vat;
        this.name = name;
        this.surname = surname;
        this.address = address;
        this.phoneNumber = phoneNumber;
        this.email = email;
        this.username = username;
        this.password = password;
  }

}
</code>```

PropertyOwnerDto.java

```<code>@Data@Getter@Setter
public class PropertyOwnerDto {

    private int vat;
    private String name;
    private String surname;
    private String address;
    private String phoneNumber;
    private String email;
    private String username;
    private String password;

    public PropertyOwnerDto() {

    }

    public PropertyOwnerDto(PropertyOwner propertyOwner) {
        this.vat = propertyOwner.getVat();
        this.name = propertyOwner.getName();
        this.surname = propertyOwner.getSurname();
        this.address = propertyOwner.getAddress();
        this.phoneNumber = propertyOwner.getPhoneNumber();
        this.email = propertyOwner.getEmail();
        this.username = propertyOwner.getUsername();
        this.password = propertyOwner.getPassword();

    }

    public PropertyOwner asOwner() {
        PropertyOwner propertyOwner = new PropertyOwner();
        propertyOwner.setVat(vat);
        propertyOwner.setName(name);
        propertyOwner.setSurname(surname);
        propertyOwner.setAddress(address);
        propertyOwner.setPhoneNumber(phoneNumber);
        propertyOwner.setEmail(email);
        propertyOwner.setUsername(username);
        propertyOwner.setPassword(password);
        return propertyOwner;

    }
</code>```

OwnerService.java

```<code>public interface OwnerService {

    void createPropertyOwner(PropertyOwnerDto ownerDto);

    RestApiResult<PropertyOwnerDto> getOwner(int ownerId);

}
</code>```

OwnerServiceImpl.java

```<code>public class OwnerServiceImpl implements OwnerService {

    private final Properties sqlCommands = new Properties();

    {
        final ClassLoader loader = getClass().getClassLoader();
        try ( InputStream config = loader.getResourceAsStream("sql.properties")) {
            sqlCommands.load(config);
        } catch (IOException e) {
            throw new IOError(e);
        }
    }
    private static final Logger logger = LogManager.getLogger(OwnerServiceImpl.class);

    @Inject
    private PropertyOwnerRepository propertyOwnerRepository;

    @Inject
    private PropertyRepository propertyRepository;

    @Inject
    private RepairRepository repairRepository;

// SOME OTHER CODE HERE //

   @Override
    public RestApiResult<PropertyOwnerDto> getOwner(int ownerId) {
        PropertyOwnerDto ownerDto = new PropertyOwnerDto(propertyOwnerRepository.findById(ownerId));
        return new RestApiResult<PropertyOwnerDto>(ownerDto, 0, "successful");
    }

    @Override
    public void registerNewPropertyDto(PropertyDto propertyDto) {
        propertyRepository.create(propertyDto.asProperty());
    }
}
</code>```

beans.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"
       bean-discovery-mode="all">
</beans>
</code>```

I use WILDFLY as application server.

Body:
I want to convert an old application to a new one in which i make HTTP calls (GET/POST/DELETE). I have a model package where i have my POJO classes and i made a DTO package where i have Dto classes. When i make a simple GET method to take a String message as a response i dont have any problem but when i use dependency injection and i want to use GET or POST methods to see some details about my app i get in postman  this message: inStream parameter is null

OwnerResource.java

        @Path("ownerResource")
        public class OwnerResource {

            @GET
            public Response ping() {         // When i use only this method i dont have any problem and i can see the message
                return Response
                        .ok("pang")
                        .build();
            }

// When i use the below code i have problem in HTTP calls

            @Inject
            private OwnerService ownerService;

            @GET
            @Path("owner/{ownerId}")
            @Produces("application/json")
            public RestApiResult<PropertyOwnerDto> getOwner(@PathParam("ownerId") int ownerId) {
                return ownerService.getOwner(ownerId);

            }

            @POST
            @Path("owner")
            @Produces("application/json")
            @Consumes("application/json")
            public void createNewOwner(PropertyOwnerDto owner) {
            ownerService.createPropertyOwner(owner);

        }
}

PropertyOwner.java

   @Data
    @NoArgsConstructor
    @Entity(name = "propertyowner")
    @Table
    public class PropertyOwner extends PersistentClass {
      // id is in PersistenceClass
      private int vat;
      private String name;
      private String surname;
      private String address;
      private String phoneNumber;
      private String email;
      private String username;
      private String password;
      @OneToMany(mappedBy = "owner", orphanRemoval = true)
      private List<Property> properties;

      public PropertyOwner(int vat, String name, String surname, String address, String phoneNumber, String email, String username, String password) {
        this.vat = vat;
        this.name = name;
        this.surname = surname;
        this.address = address;
        this.phoneNumber = phoneNumber;
        this.email = email;
        this.username = username;
        this.password = password;
  }

}

PropertyOwnerDto.java

@Data@Getter@Setter
public class PropertyOwnerDto {

    private int vat;
    private String name;
    private String surname;
    private String address;
    private String phoneNumber;
    private String email;
    private String username;
    private String password;

    public PropertyOwnerDto() {

    }

    public PropertyOwnerDto(PropertyOwner propertyOwner) {
        this.vat = propertyOwner.getVat();
        this.name = propertyOwner.getName();
        this.surname = propertyOwner.getSurname();
        this.address = propertyOwner.getAddress();
        this.phoneNumber = propertyOwner.getPhoneNumber();
        this.email = propertyOwner.getEmail();
        this.username = propertyOwner.getUsername();
        this.password = propertyOwner.getPassword();

    }

    public PropertyOwner asOwner() {
        PropertyOwner propertyOwner = new PropertyOwner();
        propertyOwner.setVat(vat);
        propertyOwner.setName(name);
        propertyOwner.setSurname(surname);
        propertyOwner.setAddress(address);
        propertyOwner.setPhoneNumber(phoneNumber);
        propertyOwner.setEmail(email);
        propertyOwner.setUsername(username);
        propertyOwner.setPassword(password);
        return propertyOwner;

    }

OwnerService.java

public interface OwnerService {

    void createPropertyOwner(PropertyOwnerDto ownerDto);

    RestApiResult<PropertyOwnerDto> getOwner(int ownerId);

}

OwnerServiceImpl.java

public class OwnerServiceImpl implements OwnerService {

    private final Properties sqlCommands = new Properties();

    {
        final ClassLoader loader = getClass().getClassLoader();
        try ( InputStream config = loader.getResourceAsStream("sql.properties")) {
            sqlCommands.load(config);
        } catch (IOException e) {
            throw new IOError(e);
        }
    }
    private static final Logger logger = LogManager.getLogger(OwnerServiceImpl.class);

    @Inject
    private PropertyOwnerRepository propertyOwnerRepository;

    @Inject
    private PropertyRepository propertyRepository;

    @Inject
    private RepairRepository repairRepository;

// SOME OTHER CODE HERE //

   @Override
    public RestApiResult<PropertyOwnerDto> getOwner(int ownerId) {
        PropertyOwnerDto ownerDto = new PropertyOwnerDto(propertyOwnerRepository.findById(ownerId));
        return new RestApiResult<PropertyOwnerDto>(ownerDto, 0, "successful");
    }

    @Override
    public void registerNewPropertyDto(PropertyDto propertyDto) {
        propertyRepository.create(propertyDto.asProperty());
    }
}

beans.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"
       bean-discovery-mode="all">
</beans>

I use WILDFLY as application server.


问:
How can I do tree shaking for Chakra UI in NextJS?
I write the code as shown in the documentation:

```<code>import {Box} from '@chakra-ui/react';
</code>```

But when I run build, my page imports the entire library instead of one component.

I found a post where a user says this works with webpack5
https://github.com/chakra-ui/chakra-ui/discussions/2291

But in the latest updates NextJS switched to SWC, I tried to turn it off by reverting to .babelrc, but I still can't get the result of tree-shaking.

Body:
I write the code as shown in the documentation:

import {Box} from '@chakra-ui/react';

But when I run build, my page imports the entire library instead of one component.

I found a post where a user says this works with webpack5
https://github.com/chakra-ui/chakra-ui/discussions/2291

But in the latest updates NextJS switched to SWC, I tried to turn it off by reverting to .babelrc, but I still can't get the result of tree-shaking.


问:
Lazy import React Router Loader
After spending some time going through ReactJs and React Router (^v6) tutorials and docs, I stumbled upon a question - how can I lazy (lazily) import loaders and actions for Routes?

Here I have an EditContact component which is a default export. The same file has an async function for the react router loader and it is only a named export. When I import this component, I can import it lazily as this is the default export. However, that is not the case with my loader function.

I understand that "React.lazy currently only supports default exports" and am aware of the workaround to use an intermediate module for named exports. Can anyone please advise if my approach below to import loader function and lazy import only components is OK?

EditContact.jsx:

```<code>import React from "react";

export async function loader({ params }) {
  console.log("Contact Id =>", params.contactId);
  // Fetch contact details for the contact id
}

export default function EditContact() {
  return (
    <div>Todo: add/edit contact here</div>
  );
}
</code>```

Router.js

```<code>import React, { lazy } from "react";
import { createBrowserRouter } from "react-router-dom";
// import the loader
**import {loader as EditContactLoader} from "./Contact/EditContact";**

const Home = lazy(() => import("./Home"));
const Root = lazy(() => import("./Root"));

**const EditContact= lazy(() => import("./Contact/EditContact"));**

export const AppRoutes = createBrowserRouter([
  {
    path: '/',
    element: <Root />,
    errorElement: <MyError />,
    children: [
      {
        errorElement: <MyError />,
        children: [
          { index: true, element: <Home /> },
          ...
          {
            path: '/contact/:contactId/edit',
            element: <EditContact />,
            loader: EditContactLoader,
          },
          ...
        ],
      },
    ],
  },
]);
</code>```

App.js

```<code>import React from "react";
import './App.css';
import { RouterProvider } from "react-router-dom";
import { AppRoutes } from "./App/Router";
import './App.css';

export default function App() {
  return (
    <React.StrictMode>
      <RouterProvider router={AppRoutes} />
    </React.StrictMode>
  );
}
</code>```

Title: Lazy import React Router Loader

Body:
After spending some time going through ReactJs and React Router (^v6) tutorials and docs, I stumbled upon a question - how can I lazy (lazily) import loaders and actions for Routes?

Here I have an EditContact component which is a default export. The same file has an async function for the react router loader and it is only a named export. When I import this component, I can import it lazily as this is the default export. However, that is not the case with my loader function.

I understand that "React.lazy currently only supports default exports" and am aware of the workaround to use an intermediate module for named exports. Can anyone please advise if my approach below to import loader function and lazy import only components is OK?

EditContact.jsx:

import React from "react";

export async function loader({ params }) {
  console.log("Contact Id =>", params.contactId);
  // Fetch contact details for the contact id
}

export default function EditContact() {
  return (

Todo: add/edit contact here

  );
}

Router.js

import React, { lazy } from "react";
import { createBrowserRouter } from "react-router-dom";
// import the loader
**import {loader as EditContactLoader} from "./Contact/EditContact";**

const Home = lazy(() => import("./Home"));
const Root = lazy(() => import("./Root"));

**const EditContact= lazy(() => import("./Contact/EditContact"));**

export const AppRoutes = createBrowserRouter([
  {
    path: '/',
    element: <Root />,
    errorElement: <MyError />,
    children: [
      {
        errorElement: <MyError />,
        children: [
          { index: true, element: <Home /> },
          ...
          {
            path: '/contact/:contactId/edit',
            element: <EditContact />,
            loader: EditContactLoader,
          },
          ...
        ],
      },
    ],
  },
]);

App.js

import React from "react";
import './App.css';
import { RouterProvider } from "react-router-dom";
import { AppRoutes } from "./App/Router";
import './App.css';

export default function App() {
  return (
    <React.StrictMode>
      <RouterProvider router={AppRoutes} />
    </React.StrictMode>
  );
}


问:
Next.js i18n Sub-path Routing not working when deployed to Amplify
The sub-path routing is not applied once deployed to Amplify

Given the following next.config.js

```<code>    i18n: {
      defaultLocale: 'en',
      localeDetection: false,
      locales: ['en', 'it'],
    },
</code>```

For example on localhost, if I have locale "it" I will be redirected to localhost/it
Same situation doesn't redirect to the appropriate locale, even if the same "accept-language" are sent

Body:
The sub-path routing is not applied once deployed to Amplify

Given the following next.config.js

    i18n: {
      defaultLocale: 'en',
      localeDetection: false,
      locales: ['en', 'it'],
    },

For example on localhost, if I have locale "it" I will be redirected to localhost/it
Same situation doesn't redirect to the appropriate locale, even if the same "accept-language" are sent


问:
I need to make a Pre Trained Tokenizer (Hugging Face) safer for privacy
I am new to NLP and Transformers library. Perhaps my doubt is naive but I am not finding a good solution for it.

I have documents whose content in sensitive and it is a requirements of mine not to publish it clearly on cloud. However my model is running on a Cloud Virtual Machine.

My idea would be to perform OCR and Tokenization on premise and then uploading the results.

However, tokenization with PreTrainedTokenizer by Transformers library returns the ids of the token from its vocabulary, and everyone can decode it having the same pretrained model.

So here is the question: it is possible to fine-tune or just change the vocabulary index so that the tokenization can't be easily decoded?


问:
MatSlider toggle not changing value after change event in test cases
I have a slider toggle and its value is coming correctly whenever changing in its ts file. But in test cases, I have tried many options but still after calling onToggle() the toggled value is always coming as true instead of false

html

```<code><mat-slide-toggle class="toggle-slider" [(ngModel)]="toggleVal" (change)="onToggle()">YES/ NO</mat-slide-toggle>
</code>```

TS

```<code>public onToggle(): any {
 this.toggleChange.emit(this.toggleVal);
 }
</code>```

spec.ts

```<code>it('Should call onToggle method when slider changes', async () => {

spyOn(component.toggleChange, 'emit');
component.onToggle();
expect(component.toggleChange.emit).toHaveBeenCalled();
expect(component.toggleChange.emit).
toHaveBeenCalledWith(false);

 component.onToggle();
 expect(component.toggleChange.emit)
.toHaveBeenCalled();
 expect(component.toggleChange.emit)
.toHaveBeenCalledWith(true);

  });
</code>```

Body:
I have a slider toggle and its value is coming correctly whenever changing in its ts file. But in test cases, I have tried many options but still after calling onToggle() the toggled value is always coming as true instead of false

html

<mat-slide-toggle class="toggle-slider" [(ngModel)]="toggleVal" (change)="onToggle()">YES/ NO</mat-slide-toggle>

TS

public onToggle(): any {
 this.toggleChange.emit(this.toggleVal);
 }

spec.ts

it('Should call onToggle method when slider changes', async () => {

spyOn(component.toggleChange, 'emit');
component.onToggle();
expect(component.toggleChange.emit).toHaveBeenCalled();
expect(component.toggleChange.emit).
toHaveBeenCalledWith(false);

 component.onToggle();
 expect(component.toggleChange.emit)
.toHaveBeenCalled();
 expect(component.toggleChange.emit)
.toHaveBeenCalledWith(true);

  });


问:
Identify similar images in a folder based on an image from the scanner
I have a question that I can't figure out,I do not know where to begin.I use the following technologies: React Native (mobile application) and the backend application is built with Node Js.

What I'm trying to do is, the user takes a picture of a product, with the help of this mobile application the caption is saved in a directory on the server, let's say [image_phone],I managed to do this part,on the server I also have a directory [app_images] where I have images of products with a specific name.

What I want to do is create a function that will return from the folder [app_images] all the images similar to the one uploaded by the user in the folder [image_phone].

What did I try to do about it:

Following a tutorial on the Internet, I tried to solve this problem using the following modules.[jimp, pixelmatch, pngjs]

Code:

```<code>const Jimp = require('jimp');
const PNG = require('pngjs').PNG;
const pixelmatch = require('pixelmatch');

exports.compareImage = catchAsync(async(req,res,next)=>{

    const originalFile = imageRoot+'/imagine3.png';
    const compareFile = compareRoot+'/Screenshot_72.png';

    const createBufferImage = async (url) => {
        return new Promise(async (resolve, reject) => {
            await Jimp.read(url, async (err, image) => {
                if (err) {
                    console.log(`eroare la citirea imagini Jimp: ${err}`);
                    reject(err);
                }
                image.resize(400, 400);
                return image.getBuffer(jimp.MIME_PNG, (err, buffer) => {
                    if (err) {
                        console.log(`eroare convertire url in buffer: ${err}`);
                        reject(err);
                    }
                    resolve(buffer);
                });
            });
        });
    };

    const compareImageApp = async (
        capture,
        app_image
    ) => {
        try {
            console.log('> Start compare');
            const img1Buffer = await createBufferImage(capture);
            const img2Buffer = await createBufferImage(app_image);
            const img1 = PNG.sync.read(img1Buffer);
            const img2 = PNG.sync.read(img2Buffer);
            const { width, height } = img1;
            const diff = new PNG({ width, height });

            const difference = pixelmatch(
                img1.data,
                img2.data,
                diff.data,
                width,
                height,
                {
                    threshold: 0,
                }
            );

            const compatibility = 100 - (difference * 100) / (width * height);
            console.log(`${difference} diferenta pixel`);
            console.log(`Compatibilitate: ${compatibility}%`);
            console.log('< Misiune completa');
            return compatibility;
        } catch (error) {
            console.log(`Eroare la compararea imaginilor: ${error}`);
            throw error;
        }
    };

    compareImageApp(originalFile,
        compareFile
)

res.status(200).json({
    status:'succes'
})
 })
</code>```

Result:

But the accuracy does not really exist, there are images that do not resemble each other at all, but it gives me an accuracy of over 50%.

2)I tried to solve this problem using another module  https://www.npmjs.com/package/rembrandt but the same accuracy problem does not exist.

Now I'm trying to solve this problem using tensorFlow js, to make a kind of image recognition app, something like facial recognition.

Do you have any ideas on how to solve this problem, if you have faced it before.

Body:
I have a question that I can't figure out,I do not know where to begin.I use the following technologies: React Native (mobile application) and the backend application is built with Node Js.

What I'm trying to do is, the user takes a picture of a product, with the help of this mobile application the caption is saved in a directory on the server, let's say [image_phone],I managed to do this part,on the server I also have a directory [app_images] where I have images of products with a specific name.

What I want to do is create a function that will return from the folder [app_images] all the images similar to the one uploaded by the user in the folder [image_phone].

What did I try to do about it:

Following a tutorial on the Internet, I tried to solve this problem using the following modules.[jimp, pixelmatch, pngjs]

Code:

const Jimp = require('jimp');
const PNG = require('pngjs').PNG;
const pixelmatch = require('pixelmatch');

exports.compareImage = catchAsync(async(req,res,next)=>{

    const originalFile = imageRoot+'/imagine3.png';
    const compareFile = compareRoot+'/Screenshot_72.png';

    const createBufferImage = async (url) => {
        return new Promise(async (resolve, reject) => {
            await Jimp.read(url, async (err, image) => {
                if (err) {
                    console.log(`eroare la citirea imagini Jimp: ${err}`);
                    reject(err);
                }
                image.resize(400, 400);
                return image.getBuffer(jimp.MIME_PNG, (err, buffer) => {
                    if (err) {
                        console.log(`eroare convertire url in buffer: ${err}`);
                        reject(err);
                    }
                    resolve(buffer);
                });
            });
        });
    };

    const compareImageApp = async (
        capture,
        app_image
    ) => {
        try {
            console.log('> Start compare');
            const img1Buffer = await createBufferImage(capture);
            const img2Buffer = await createBufferImage(app_image);
            const img1 = PNG.sync.read(img1Buffer);
            const img2 = PNG.sync.read(img2Buffer);
            const { width, height } = img1;
            const diff = new PNG({ width, height });

            const difference = pixelmatch(
                img1.data,
                img2.data,
                diff.data,
                width,
                height,
                {
                    threshold: 0,
                }
            );

            const compatibility = 100 - (difference * 100) / (width * height);
            console.log(`${difference} diferenta pixel`);
            console.log(`Compatibilitate: ${compatibility}%`);
            console.log('< Misiune completa');
            return compatibility;
        } catch (error) {
            console.log(`Eroare la compararea imaginilor: ${error}`);
            throw error;
        }
    };

    compareImageApp(originalFile,
        compareFile
)

res.status(200).json({
    status:'succes'
})
 })

Result:

But the accuracy does not really exist, there are images that do not resemble each other at all, but it gives me an accuracy of over 50%.

2)I tried to solve this problem using another module  https://www.npmjs.com/package/rembrandt but the same accuracy problem does not exist.

Now I'm trying to solve this problem using tensorFlow js, to make a kind of image recognition app, something like facial recognition.

Do you have any ideas on how to solve this problem, if you have faced it before.


问:
Improvement of generic inferring of the type of a deeply nested property
eI have a generic function correctly inferring types of deeply-nested property, but only in the cases when the root object is passed into it.

Is there a way to improve the function to make it work without passing the root object (e.g. by defining the type of the object as a generic parameter)?

Here is the code (the working part and the non-working):

// WORKING PART

type Flatten<T, O = never> = Writable<Cleanup<T>, O> extends infer U ?
    U extends O ? U : U extends object ?
    ValueOf<{ [K in keyof U]-?: (x: PrefixKeys<Flatten, K, O>) => void }>
    | ((x: U) => void) extends (x: infer I) => void ?
    { [K in keyof I]: I[K] } : never : U : never;

type Writable<T, O> = T extends O ? T : {
    [P in keyof T as IfEquals<{ [Q in P]: T[P] }, { -readonly [Q in P]: T[P] }, P>]: T[P]
}

type IfEquals<X, Y, A = X, B = never> =
    (<T>() => T extends X ? 1 : 2) extends
    (<T>() => T extends Y ? 1 : 2) ? A : B;

type Cleanup<T> =
    0 extends (1 & T) ? unknown :
    T extends readonly any[] ?
    (Exclude<keyof T, keyof any[]> extends never ?
        { [k: `${number}`]: T[number] } : Omit<T, keyof any[]>) : T;

type PrefixKeys<V, K extends PropertyKey, O> =
    V extends O ? { [P in K]: V } : V extends object ?
    { [P in keyof V as
        `${Extract<K, string | number>}.${Extract<P, string | number>}`]: V[P] } :
    { [P in K]: V };

type ValueOf<T> = T[keyof T]

function lookup<T, K extends keyof Flatten<T>>(obj: T, key: K): Flatten<T>[K];
function lookup(obj: any, key: string) {
    const i = key.indexOf(".");
    return (i < 0) ? obj[key] : (lookup as any)(obj[key.substring(0, i)], key.substring(i + 1));
}

function lookupWithValue<ObjectType, DeepKeyType extends keyof Flatten<ObjectType>>(obj: ObjectType, key: DeepKeyType, value: Flatten<ObjectType>[DeepKeyType]): void {
    // SOME LOGIC
}

// SHOWCASE

const foo = {
    a: {
        b: {
            c: 10
        }
    },
    d: [
        0,
        {
            e: {
                f: "f"
            }
        },
        "20"
    ]
};

type FooType = typeof foo;

lookupWithValue(foo, "a.b.c", 10); // OK! Correct, because (number type == number type)
lookupWithValue(foo, "a.b.c", "10"); // ERROR! Correct, because (string type != number type)

// =====
// NOT WORKING PART
// =====

// Is there a way to create a method, which doesn't require the root object to be passed into ???
function lookupWithValueWithoutObject<ObjectType, ...>(key: ???, value: ???): void {
    // SOME LOGIC
}

lookupWithValueWithoutObject<FooType>("a.b.c", 10); // OK
lookupWithValueWithoutObject<FooType>("a.b.c", "10"); // ERROR
```

Link to playground

I've tried changing the working code in a way that the obj parameter is not needed, but the inferring part stops working: it either can't be compiled at all, or can't correctly find the error of different types in the passing value parameter and the deeply-nested property.

Body:
eI have a generic function correctly inferring types of deeply-nested property, but only in the cases when the root object is passed into it.

Is there a way to improve the function to make it work without passing the root object (e.g. by defining the type of the object as a generic parameter)?

Here is the code (the working part and the non-working):

// WORKING PART

type Flatten<T, O = never> = Writable<Cleanup<T>, O> extends infer U ?
    U extends O ? U : U extends object ?
    ValueOf<{ [K in keyof U]-?: (x: PrefixKeys<Flatten, K, O>) => void }>
    | ((x: U) => void) extends (x: infer I) => void ?
    { [K in keyof I]: I[K] } : never : U : never;

type Writable<T, O> = T extends O ? T : {
    [P in keyof T as IfEquals<{ [Q in P]: T[P] }, { -readonly [Q in P]: T[P] }, P>]: T[P]
}

type IfEquals<X, Y, A = X, B = never> =
    (<T>() => T extends X ? 1 : 2) extends
    (<T>() => T extends Y ? 1 : 2) ? A : B;

type Cleanup<T> =
    0 extends (1 & T) ? unknown :
    T extends readonly any[] ?
    (Exclude<keyof T, keyof any[]> extends never ?
        { [k: `${number}`]: T[number] } : Omit<T, keyof any[]>) : T;

type PrefixKeys<V, K extends PropertyKey, O> =
    V extends O ? { [P in K]: V } : V extends object ?
    { [P in keyof V as
        `${Extract<K, string | number>}.${Extract<P, string | number>}`]: V[P] } :
    { [P in K]: V };

type ValueOf<T> = T[keyof T]

function lookup<T, K extends keyof Flatten<T>>(obj: T, key: K): Flatten<T>[K];
function lookup(obj: any, key: string) {
    const i = key.indexOf(".");
    return (i < 0) ? obj[key] : (lookup as any)(obj[key.substring(0, i)], key.substring(i + 1));
}

function lookupWithValue<ObjectType, DeepKeyType extends keyof Flatten<ObjectType>>(obj: ObjectType, key: DeepKeyType, value: Flatten<ObjectType>[DeepKeyType]): void {
    // SOME LOGIC
}

// SHOWCASE

const foo = {
    a: {
        b: {
            c: 10
        }
    },
    d: [
        0,
        {
            e: {
                f: "f"
            }
        },
        "20"
    ]
};

type FooType = typeof foo;

lookupWithValue(foo, "a.b.c", 10); // OK! Correct, because (number type == number type)
lookupWithValue(foo, "a.b.c", "10"); // ERROR! Correct, because (string type != number type)

// =====
// NOT WORKING PART
// =====

// Is there a way to create a method, which doesn't require the root object to be passed into ???
function lookupWithValueWithoutObject<ObjectType, ...>(key: ???, value: ???): void {
    // SOME LOGIC
}

lookupWithValueWithoutObject<FooType>("a.b.c", 10); // OK
lookupWithValueWithoutObject<FooType>("a.b.c", "10"); // ERROR

<a href="https://www.typescriptlang.org/play?#code/PTAEHUHkCUGkEkByBxUAFAgtAKgKFwC4CeADgKagBiANgIYEFkB2APNgDSiSgC8oTZAG5kATgD5eEEQEsCtAEbUyLAMJLaTAK4k2YzpAlkAHoyYATAM6hpTAGajQAVVAB+XKA9PQx05a6uvAC4vH2Y-AHt5ACsyAGMCV3dPADVaak0ySFsWAG9QAG1YayZQAGsyInDbJwBdAFoXYIAKI2C0ETJbaSNYCosWGnpTFkdCmv09UFgJgEpeCUFw6TNQAF8xJI8AH1AmluDHOZ4FpbM50PMrfeL7EVB4I5PlxM9QPMLisoqq+5rg+DGa1AwQEwjuB2B-CEogA3PhiOQpLIFEo2BNJNhvCYwlZuC5QJjgjlNgU0J9ypVqpjaFZ4LYAKIAR00aX67wAip80H8CfluWtOHk6h1aGZwkxqEQCpybOgedg+TUBegxPLFbhVvDSBQ6UyWdR+gANTgATU4GEkxtAACFJKDRBIeCSmromo8CVjfFZDQEAIyQgBM52xl2drvdmIufhNfsDc3xFuC1rhhG1oDUZA02l0vBJAAZPTjdv6AGQE+OgTRMUpMcIAdxKgRJkZDfhFYolUo0RHySrcrya9KMsXSZmUFJ+HC+lNA3d7hlbVntd37r0871KwQABgASHJaAC28lEqy3asPx5EStWkMgB9kaOnPznNTEc2C2BTCIo7U63V6RD9MknBFFGVjtOE5AiMQAHok6rzJIWlz+Pi7xkrKsA8ohN7BIhYGgJEMTxC866kuS3zVIhNIkq8u45EOBAiLQ8QsNMoAWIxNgAOagDsF4OqsAB0e4MUxLFoJwHEyEwPF8ZoR4CWeuGKkCTavGhnyYbhaxfmmqTpJk2TYI6vITlSNT4LYVbxNI4qgNQ4ThKU2ZTqBi5PtUgwMMwuhiE0hEfpwFLBLAMzBF5wzGWMcJWUwNl2Q5TnaP50TBN2QUVMEUncXMxKvLE4ocdYkgUoJNhjkYWRNAARIJ1UzHCrwdAQmgiCUTTSKALCgHmFaEfkFJKs0iXOSQs5WN2MwpVEA0VIJFiaPI2UyU0eacNIMzjNO82LctXEdaAADUoC+jMDUapZ1kELZJQjdo4CyAAFvpGQsJA0RxAQ2DapwAAiZBkCQAHfYi+FmVQdDeaw71EV92piH5AVcB98Qg2QGVEME-2A8DP2gIIaQZOFkPDDDn1o2I+TY0DFRozUYX46cbwkiAoAAMqQAAsvSoAADKQMg8AqBduCs2zAASkDgCoGBs-S+AFUwRW2I5kh5Z4tBEjRnjyFra766AsTBL6ebax4mqvKs7AkmYwT5GbPXWwbzPO68ZB667+u2ME1W2NVDuWw7VsO9VAZ5v7rwWasumIpQjlo5I34-Cr4QpndJAPQQz2E2QTQp5w1W0IJ8iCbE1WcCbDWgKzkCwAAhOm4QiB08ScMesS0JoFgUE0-F3N+vB8H3oDfjMuDp5n2cGXnjkF0XJdlwXJv1TC1dgPS0DQDADcqE3LcEG3cSd93ux7SPaZ10P8mXuf5Bj6LYA8E-T8P6AiCQJiUBwEgqCYDgr-Pxfq-eAVgs6iAoLQUAdZaBSgIOEQ2IpGCzlAAeMgWdwhmE4HWR60hYiPVAB2AA5AkAQZAVhgIIijBIcDQDHlACQGk3cVg2BoS4NhuBYrxVuo5Uak8XpkEnuETQBAyYsVEXDcgnBBLSL8sFVwbDOAEwMsENhLgGaLGeOrDwYsuY835oLYWmpx48Puk9fhgjhHiIGPHeGNV56l3LidXqq8a6wGMUlDOZic4WJEVQ6x4QKZ2OLg4pe4cq6sw3lvaAuAgA" rel="nofollow noreferrer">Link to playground

I've tried changing the working code in a way that the obj parameter is not needed, but the inferring part stops working: it either can't be compiled at all, or can't correctly find the error of different types in the passing value parameter and the deeply-nested property.