问:
Changing a UIImageView image with a slider
I have a view with one UIImageView and a slider. Slider Min 1 Max 10. When slider is moved UIImageView should display a different image. Slider is 1 test1.png will display, slider is 2 test2.png will display, slider is 3 test3.png will display etc...

In Interface Builder I have connected IBOutlet slider to Horizontal slider, IBOutlet image to Image View, & IBAction changeImage to Horizontal slider "Value Changed"

I've cast slider float to int. Placed an NSLog statement in IBAction changeImage to make sure method is being called, It is. I receive no error messages on build. However, when i build & Run and move slider in simulator image in UIImageView does not change. The problem must be "logic" I've hit a wall and can not figure it out.

```<code>#import <UIKit/UIKit.h>

@interface SliderViewController : UIViewController {

    IBOutlet UISlider *slider;
    IBOutlet UIImageView *image;

}

@property (nonatomic, retain) IBOutlet UISlider *slider;

@property (nonatomic, retain) IBOutlet UIImageView *image;

- (IBAction)changeImage;

@end

#import "SliderViewController.h"

@implementation SliderViewController

@synthesize slider;
@synthesize image;

- (IBAction)changeImage {

    NSLog(@"changeImage method being called!!!!");

    int intSlider = (int)(slider.value);

    if (intSlider == 0) {

                image.image = [UIImage imageNamed:@"ash1.png"];
    }

    if (intSlider == 1) {

        image.image = [UIImage imageNamed:@"ash2.png"];
    }

    if (intSlider == 2) {

        image.image = [UIImage imageNamed:@"ash3.png"];
    }

    if (intSlider == 3) {

        image.image = [UIImage imageNamed:@"ash4.png"];
    }

    if (intSlider == 4) {

        image.image = [UIImage imageNamed:@"ash5.png"];
    }

    if (intSlider == 5) {

        image.image = [UIImage imageNamed:@"ash6.png"];
    }

    if (intSlider == 6) {

        image.image = [UIImage imageNamed:@"ash7.png"];
    }

    if (intSlider == 7) {

        image.image = [UIImage imageNamed:@"ash8.png"];
    }

    if (intSlider == 8) {

        image.image = [UIImage imageNamed:@"ash9.png"];
    }

    if (intSlider == 9) {

        image.image = [UIImage imageNamed:@"ash10.png"];
    }

    if (intSlider == 10) {

        image.image = [UIImage imageNamed:@"ash11.png"];
    }

}
</code>```

答:
changing image using  valued slider in objective c

.h

```<code>@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIImageView *imageview;

@property (weak, nonatomic) IBOutlet UISlider *sldrimg;

- (IBAction)slider:(id)sender;
</code>```

.m

```<code>- (IBAction)slider:(id)sender {

    int a = (int) self.sldrimg.value;
    if(a<=20)
    {
        _imageview.image = [UIImage imageNamed:@"nature.png"];
    }

    if(a>20 && a<=40)
    {
        _imageview.image = [UIImage imageNamed:@"bike.png"];
    }

    if(a>40 && a<=60)
    {
        _imageview.image = [UIImage imageNamed:@"minion.png"];
    }

    if(a>60 && a<=80)
    {
        _imageview.image = [UIImage imageNamed:@"woods.png"];
    }

    if(a>80 && a<=100)
    {
        _imageview.image = [UIImage imageNamed:@"trees.png"];
    }
</code>```

Body:
I have a view with one UIImageView and a slider. Slider Min 1 Max 10. When slider is moved UIImageView should display a different image. Slider is 1 test1.png will display, slider is 2 test2.png will display, slider is 3 test3.png will display etc...

In Interface Builder I have connected IBOutlet slider to Horizontal slider, IBOutlet image to Image View, & IBAction changeImage to Horizontal slider "Value Changed"

I've cast slider float to int. Placed an NSLog statement in IBAction changeImage to make sure method is being called, It is. I receive no error messages on build. However, when i build & Run and move slider in simulator image in UIImageView does not change. The problem must be "logic" I've hit a wall and can not figure it out.

#import <UIKit/UIKit.h>

@interface SliderViewController : UIViewController {

    IBOutlet UISlider *slider;
    IBOutlet UIImageView *image;

}

@property (nonatomic, retain) IBOutlet UISlider *slider;

@property (nonatomic, retain) IBOutlet UIImageView *image;

- (IBAction)changeImage;

@end

#import "SliderViewController.h"

@implementation SliderViewController

@synthesize slider;
@synthesize image;

- (IBAction)changeImage {

    NSLog(@"changeImage method being called!!!!");

    int intSlider = (int)(slider.value);

    if (intSlider == 0) {

                image.image = [UIImage imageNamed:@"ash1.png"];
    }

    if (intSlider == 1) {

        image.image = [UIImage imageNamed:@"ash2.png"];
    }

    if (intSlider == 2) {

        image.image = [UIImage imageNamed:@"ash3.png"];
    }

    if (intSlider == 3) {

        image.image = [UIImage imageNamed:@"ash4.png"];
    }

    if (intSlider == 4) {

        image.image = [UIImage imageNamed:@"ash5.png"];
    }

    if (intSlider == 5) {

        image.image = [UIImage imageNamed:@"ash6.png"];
    }

    if (intSlider == 6) {

        image.image = [UIImage imageNamed:@"ash7.png"];
    }

    if (intSlider == 7) {

        image.image = [UIImage imageNamed:@"ash8.png"];
    }

    if (intSlider == 8) {

        image.image = [UIImage imageNamed:@"ash9.png"];
    }

    if (intSlider == 9) {

        image.image = [UIImage imageNamed:@"ash10.png"];
    }

    if (intSlider == 10) {

        image.image = [UIImage imageNamed:@"ash11.png"];
    }

}

Body:
changing image using  valued slider in objective c

.h

@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIImageView *imageview;

@property (weak, nonatomic) IBOutlet UISlider *sldrimg;

- (IBAction)slider:(id)sender;

.m

- (IBAction)slider:(id)sender {

    int a = (int) self.sldrimg.value;
    if(a<=20)
    {
        _imageview.image = [UIImage imageNamed:@"nature.png"];
    }

    if(a>20 && a<=40)
    {
        _imageview.image = [UIImage imageNamed:@"bike.png"];
    }

    if(a>40 && a<=60)
    {
        _imageview.image = [UIImage imageNamed:@"minion.png"];
    }

    if(a>60 && a<=80)
    {
        _imageview.image = [UIImage imageNamed:@"woods.png"];
    }

    if(a>80 && a<=100)
    {
        _imageview.image = [UIImage imageNamed:@"trees.png"];
    }


来源: stackexchange

问:
Large database 500 milion records
A solution of one of our business problems would be to store about 500 milion records into a database.
Each record would have about 40 to 50 columns.

I have a text file containing all of this data and it is about 150 GB.
(a 3rd of my harddisk)

If I were to load (somehow) all of this data into a db (ORACLE ?) how well would it perform ?

A colleague of mine insists that it would be absolutely fine.
And I could even index all of the 40 to 50 columns and then it is a matter of writing some sql to get  data out.

is he right ?
or is 500 milion records too much for a db ?

p.s.
Just adding more information following some very good answers:
The 40 to 50 columns will hold small strings and/or numbers.
For small strings I intend something smaller than 64 characters.

答:
Without any information about the RDBMS you're using, how it is hosted and what kind of data this is (large text, small numbers and such), a solid answer ain't easy.

The pure amount of records should not be an issue, almost every modern RDBMS will easily cope with 500 million records and more.

It'll get more interesting how the data is stored upon your RDBMS, p.e. what kind of filesystem it is using, how much disk space is available for the table, how the table is spread out on the hard disk(s) and such, which all should be taken into consideration.

Generally speaking I recommend only to index the columns which really are necessary for the applications and queries the data is used for, otherwise they'll just slow your inserts down, use precious disk space and don't help you at all.

Here are a few SO links which might help you further:

Just what is 'A big database'?

What's TOO BIG for a database?

How does database indexing work?

ContentLicense: CC BY-SA 3.0

Title: Large database 500 milion records


问:
How to use MongoDB with codesandbox?
I have been following an Udemy course to learn mongodb, and since the tutor uses a cloud based ide (cloud9), I have also decided to use the same. However, since cloud9 now requires AWS account I thought of using CodeSandbox. But I can't figure out how to start Mongo server on it.
After installing both Mongod and MongoDB, if I try to run the app.js, it gives me error:

```<code>    (node:1297) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:27017] on firstconnect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]
    at Pool.<anonymous> (/sandbox/node_modules/mongodb/lib/core/topologies/server.js:433:11)
    at Pool.emit (events.js:198:13)
    at createConnection (/sandbox/node_modules/mongodb/lib/core/connection/pool.js:577:14)
    at connect (/sandbox/node_modules/mongodb/lib/core/connection/pool.js:1007:11)
    at makeConnection (/sandbox/node_modules/mongodb/lib/core/connection/connect.js:31:7)
    at callback (/sandbox/node_modules/mongodb/lib/core/connection/connect.js:247:5)
    at Socket.err (/sandbox/node_modules/mongodb/lib/core/connection/connect.js:276:7)
    at Object.onceWrapper (events.js:286:20)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:1297) UnhandledPromiseRejectionWarning: Unhandled promise rejection. Thiserror originated either by throwing inside of an async function without a catchblock, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1297) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
</code>```

If I try to run mongod, it says

```<code>mongod: command not found
</code>```

This is my app.js

```<code>var express = require("express");
var app = express();
var bodyParser = require("body-parser");
var mongoose = require("mongoose");

mongoose.connect("mongodb://localhost/yelp_camp");
</code>```

I have tried installing mongo and mongod using codesandbox's UI , using terminal (npm install), and doing what cloud9's docs say (I know it should not work but I can't find any Codesandbox documentation)

Is it possible to do this in codesandbox or will I have to use MongoAtlas?
Thanks in advance!

答: CodeSandbox has a starter for connecting to hosted MongoDB like Atlas - see https://codesandbox.io/s/mongodb-database-example-starter-v3ker</p>

ContentLicense: CC BY-SA 4.0

Title: How to use MongoDB with codesandbox?

Body:
I have been following an Udemy course to learn mongodb, and since the tutor uses a cloud based ide (cloud9), I have also decided to use the same. However, since cloud9 now requires AWS account I thought of using CodeSandbox. But I can't figure out how to start Mongo server on it.
After installing both Mongod and MongoDB, if I try to run the app.js, it gives me error:

    (node:1297) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:27017] on firstconnect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]
    at Pool.<anonymous> (/sandbox/node_modules/mongodb/lib/core/topologies/server.js:433:11)
    at Pool.emit (events.js:198:13)
    at createConnection (/sandbox/node_modules/mongodb/lib/core/connection/pool.js:577:14)
    at connect (/sandbox/node_modules/mongodb/lib/core/connection/pool.js:1007:11)
    at makeConnection (/sandbox/node_modules/mongodb/lib/core/connection/connect.js:31:7)
    at callback (/sandbox/node_modules/mongodb/lib/core/connection/connect.js:247:5)
    at Socket.err (/sandbox/node_modules/mongodb/lib/core/connection/connect.js:276:7)
    at Object.onceWrapper (events.js:286:20)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:1297) UnhandledPromiseRejectionWarning: Unhandled promise rejection. Thiserror originated either by throwing inside of an async function without a catchblock, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1297) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

If I try to run mongod, it says

mongod: command not found

This is my app.js

var express = require("express");
var app = express();
var bodyParser = require("body-parser");
var mongoose = require("mongoose");

mongoose.connect("mongodb://localhost/yelp_camp");

I have tried installing mongo and mongod using codesandbox's UI , using terminal (npm install), and doing what cloud9's docs say (I know it should not work but I can't find any Codesandbox documentation)

Is it possible to do this in codesandbox or will I have to use MongoAtlas?
Thanks in advance!


问:
how to load data from AWS RDS to Google BigQuery in streaming mode?
how to load data from AWS RDS to Google BigQuery in streaming mode?
Description: I have data in RDS (SQL Server), and wanted to load this data into Google BigQuery in real-time.</p>

答:
You can use the Cloud Storage Transfer Service that manages and schedules load jobs into BigQuery. This is the recommended migration method for this use case. Firstly you need to load data from AWS RDS to CSV files, then move it to S3. Amazon S3 transfers are a two step process:

Transfer Service is used to bring data from S3 into GCS.

BQ load job is used to load the data into BigQuery.

Another interesting solution that I found is about using AWS Data Pipeline to export data from MySQL and feed it to BigQuery.

Moreover, you can use one of the ETL tools (see here) which have integration with Amazon RDS and BigQuery to perform transfer of the data to BigQuery. One of the best is Fivetran.

I hope it helps you.


问:
Passing Extra Parameters in Vuetify Rules Definition
My goal is to define my rules once and then reuse them for all of my fields. To do this, I need to pass extra parameters to my rules, like maxlength of 20 on one v-text-field, but a maxlength of 50 on another. From what I see, only the value is getting passed. How can I add extra parameters to my rules?</p>

```<code><template>
  <v-input :rules=[rules.max(20)] v-model="field1" />
  <v-input :rules=[rules.max(50)] v-model="field2" />
</template>
<script>
  data() {
    rules: {
      max(v, maxnum) { //maxnum is the parameter I want to add so that I can pass different values and reuse the same rule on multiple fields
        return (v || '').length <= maxnum || 'Max exceeded';
      }
    }
  }
</script>
</code>```

答:
just pass v-model variable as second parameter to your rule.</p>

```<code><template>
  <v-input :rules=[rules.max(20, field1)] v-model="field1" />
  <v-input :rules=[rules.max(50, field1)] v-model="field2" />
</template>

<script>
  data() {
    rules: {
      max(maxnum, v) {
        return (v || '').length <= maxnum || 'Max exceeded';
      }
    }
  }
</script>
</code>```

Body:
My goal is to define my rules once and then reuse them for all of my fields. To do this, I need to pass extra parameters to my rules, like maxlength of 20 on one v-text-field, but a maxlength of 50 on another. From what I see, only the value is getting passed. How can I add extra parameters to my rules?

<template>
  <v-input :rules=[rules.max(20)] v-model="field1" />
  <v-input :rules=[rules.max(50)] v-model="field2" />
</template>

Body:
just pass v-model variable as second parameter to your rule.

<template>
  <v-input :rules=[rules.max(20, field1)] v-model="field1" />
  <v-input :rules=[rules.max(50, field1)] v-model="field2" />
</template>

<script>
  data() {
    rules: {
      max(maxnum, v) {
        return (v || '').length <= maxnum || 'Max exceeded';
      }
    }
  }
</script>


问:
How To Use A Directive In A Custom Input With ControlValueAccessor Angular
I've been create a simple custom input component in my angular app use ControlValueAccessor. So, when I want to create a form input element, I don't have to call <input />, only call <my-input>.

I have a problem, when I use <input />, I can use myDirective. For example:

<input type="text" class="form-control" formControlName="name" myDirective />
```

<p>But, when I use <code>my-input</code>, then I can't use <code>myDirective</code>. For example:</p>

<pre class="lang-html prettyprint-override"><code><my-input formControlName="name" myDirective></my-input>
</code>```

myDirective dosn't work in my-input

This is my-input component use ControlValueAccessor code:

import { Component, forwardRef } from '@angular/core';
import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';

@Component({
  selector: 'my-input',
  templateUrl: './my-input.component.html',
  styleUrls: ['./my-input.component.scss'],
  providers: [
    {
      provide: NG_VALUE_ACCESSOR,
      useExisting: forwardRef(()  => MyInputComponent ),
      multi: true
    }
  ]
})

export class MyInputComponent implements ControlValueAccessor {

  onChange: () => void;
  onTouched: () => void;

  value: string;

  writeValue(value: string): void {
    this.value = value ? value : '';
  }

  registerOnChange(fn: any): void {
    this.onChange = fn;
  }

  registerOnTouched(fn: any): void {
    this.onTouched = fn;
  }
}
```

<p><strong>Updated:</strong> <code>myDirective</code> code:</p>

<pre class="lang-js prettyprint-override"><code>import { Directive, HostListener } from '@angular/core';
import { FormControlName } from '@angular/forms';

@Directive({
    selector: '[myDirective]'
})

export class MyDirective{
    constructor(private formControlName: FormControlName) { }

    @HostListener('input', ['$event'])
    onInputChange() {
        this.formControlName.control.setValue(this.formControlName.value.replace(/[^0-9]/g, ''));
    }
}
</code>```

Is there a way for myDirective to be used in themy-input component?

Thanks in advance.

答:
There're a problem with your directive. Inject a NgControl and control this ngControl

```<code>export class MyDirective{
    constructor(private control: NgControl) { } //<--inject NgControl

    @HostListener('input', ['$event'])
    onInputChange() {
        this.control.control.setValue(this.control.value.replace(/[^0-9]/g, ''));
    }
}
</code>```

You can see in stackblitz

NOTE: Don't forget include in the module declarations

```<code>@NgModule({
  imports:      [ BrowserModule, FormsModule,ReactiveFormsModule ],
  declarations: [ AppComponent, MyInputComponent,MyDirective ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }
</code>```

Body:
I've been create a simple custom input component in my angular app use ControlValueAccessor. So, when I want to create a form input element, I don't have to call <input />, only call <my-input>.

I have a problem, when I use <input />, I can use myDirective. For example:

<input type="text" class="form-control" formControlName="name" myDirective />

But, when I use my-input, then I can't use myDirective. For example:

<my-input formControlName="name" myDirective></my-input>

myDirective dosn't work in my-input

This is my-input component use ControlValueAccessor code:

import { Component, forwardRef } from '@angular/core';
import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';

@Component({
  selector: 'my-input',
  templateUrl: './my-input.component.html',
  styleUrls: ['./my-input.component.scss'],
  providers: [
    {
      provide: NG_VALUE_ACCESSOR,
      useExisting: forwardRef(()  => MyInputComponent ),
      multi: true
    }
  ]
})

export class MyInputComponent implements ControlValueAccessor {

  onChange: () => void;
  onTouched: () => void;

  value: string;

  writeValue(value: string): void {
    this.value = value ? value : '';
  }

  registerOnChange(fn: any): void {
    this.onChange = fn;
  }

  registerOnTouched(fn: any): void {
    this.onTouched = fn;
  }
}

Updated: myDirective code:

import { Directive, HostListener } from '@angular/core';
import { FormControlName } from '@angular/forms';

@Directive({
    selector: '[myDirective]'
})

export class MyDirective{
    constructor(private formControlName: FormControlName) { }

    @HostListener('input', ['$event'])
    onInputChange() {
        this.formControlName.control.setValue(this.formControlName.value.replace(/[^0-9]/g, ''));
    }
}

Is there a way for myDirective to be used in themy-input component?

Thanks in advance.

Body:
There're a problem with your directive. Inject a NgControl and control this ngControl

export class MyDirective{
    constructor(private control: NgControl) { } //<--inject NgControl

    @HostListener('input', ['$event'])
    onInputChange() {
        this.control.control.setValue(this.control.value.replace(/[^0-9]/g, ''));
    }
}

You can see in stackblitz

NOTE: Don't forget include in the module declarations

@NgModule({
  imports:      [ BrowserModule, FormsModule,ReactiveFormsModule ],
  declarations: [ AppComponent, MyInputComponent,MyDirective ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }


问:
Grails Domain Classes Dates
For some reason, i would like to be able to add a reference date, like 0-0-0, which will represent 'no date'. Any way of doing that ? And will 0/0/0 work?</p>

答:
If you want to represent "no date" that please do that by explicitly setting it to "no date" which in Groovy is simply done by assigning a null value to a date variable.</p>

```<code>Date someDate = new Date()
print someDate //prints current date
someDate = null
print someDate //prints null - you can test for that
</code>```

Title: Grails Domain Classes Dates

Body:
If you want to represent "no date" that please do that by explicitly setting it to "no date" which in Groovy is simply done by assigning a null value to a date variable.

Date someDate = new Date()
print someDate //prints current date
someDate = null
print someDate //prints null - you can test for that


问:
SQL Validation Check
I am trying to implement data check validation control in Sql.

Similar to if I have PA12345 - Output I am looking for is CCNNNNN.

In my head, I am think of using replace function but not sure what will be the optimised procedure for it

答:
If I followed you correctly, you can use regexp_replace() twice:

```<code>select regexp_replace(regexp_replace(col, '[a-z]', 'C', 1, 0, 'i'), '\d', 'N') newcol from t
</code>```

The inner invokation turnes all alphabetics characters to 'C', then the outer invokation turns digits to 'N'.

Demo on DB Fiddle:

```<code>with t as (select 'PA12345' col from dual)
select regexp_replace(regexp_replace(col, '[a-z]', 'C', 1, 0, 'i'), '\d', 'N') newcol from t
</code>```

```
| NEWCOL  |
| :------ |
| CCNNNNN |
```

Note, however, that this is not validation, but rather transcoding. If what you want is validate that the format of the string matches a predefined pattern, then you would rather use regexp_like():

```<code>regexp_like(col, '[a-z]{2}\d{5}', 'i')
</code>```

Title: SQL Validation Check

Body:
If I followed you correctly, you can use regexp_replace() twice:

select regexp_replace(regexp_replace(col, '[a-z]', 'C', 1, 0, 'i'), '\d', 'N') newcol from t

The inner invokation turnes all alphabetics characters to 'C', then the outer invokation turns digits to 'N'.

Demo on DB Fiddle:

with t as (select 'PA12345' col from dual)
select regexp_replace(regexp_replace(col, '[a-z]', 'C', 1, 0, 'i'), '\d', 'N') newcol from t

| NEWCOL  |
| :------ |
| CCNNNNN |

Note, however, that this is not validation, but rather transcoding. If what you want is validate that the format of the string matches a predefined pattern, then you would rather use regexp_like():

regexp_like(col, '[a-z]{2}\d{5}', 'i')


问:
unable to use apt or apt-get with the error message
I am using WSL on Windows. I am unable to use

```<code>apt
</code>```

or

```<code>apt-get
</code>```

Here is the error message I have when I try to use apt or apt-get.

```<code>~$ apt
apt: error while loading shared libraries: libapt-private.so.0.0: cannot open shared object file: No such file or directory
</code>```

Is there any way I can make it work again? I do not want to re-install WSL just because of this issue.

答:
Ok at first find out what is your distribution.
In my case:

```<code>lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:        18.04
Codename:       bionic
</code>```

Then visit and download ".deb" file to your PC accordingly:

Next run command sudo dpkg -i <XYZ>.deb . In my case:

```<code>sudo dpkg -i apt_1.6.1_amd64.deb
</code>```

Then you just need to do:

```<code>apt --fix-broken install
</code>```

Hope that helped ;)

Body:
I am using WSL on Windows. I am unable to use

apt

or

apt-get

Here is the error message I have when I try to use apt or apt-get.

~$ apt
apt: error while loading shared libraries: libapt-private.so.0.0: cannot open shared object file: No such file or directory

Is there any way I can make it work again? I do not want to re-install WSL just because of this issue.

Body:
Ok at first find out what is your distribution.
In my case:

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:        18.04
Codename:       bionic

Then visit and download ".deb" file to your PC accordingly:

Next run command sudo dpkg -i <XYZ>.deb . In my case:

sudo dpkg -i apt_1.6.1_amd64.deb

Then you just need to do:

apt --fix-broken install

Hope that helped ;)


问:
Maven downloading a specific version, how can I force to download an other?
I'm struggling with this maven project.

When I try for example to clean or package the project I get an error like this

```<code>org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
</code>```

I already done a question about that but I realised that in my maven repository I don't have the 2.5 version I only have the 2.4.1 then maven go to the central repository to find that version and throws this error.

But I don't know why maven is looking for that 2.5 version, I'm not declaring it on the pom.xml so where I can change or force maven to look 2.4.1 version?

Also I need to say that this error happens in all my projects (there are all from the same domain)

This is the pom.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>dom.example.exampleframe</groupId>
        <artifactId>project-parent-exampleframe</artifactId>
        <version>0.0.11.c-SNAPSHOT</version>
    </parent>

    <groupId>dom.example.project</groupId>
    <artifactId>project</artifactId>
    <version>1.9.0-SNAPSHOT</version>
    <name>project</name>
    <packaging>pom</packaging>

    <description>Esquelet d'una aplicació BaseFrame</description>
    <url>http://pro-projectes.example.pro/projects/project</url>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <instrumentation>
                        <excludes>
                            <exclude>**/ejb/*.class</exclude>
                            <exclude>**/domain/*.class</exclude>
                            <exclude>**/services/*.class</exclude>
                            <exclude>**/*Exception.class</exclude>
                            <exclude>**/Constants*.class</exclude>
                            <exclude>**/IConstants*.class</exclude>
                        </excludes>
                        <ignores>
                            <ignore>.+logger\..+</ignore>
                        </ignores>
                    </instrumentation>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <!-- Perfils -->
    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <modules>
                <module>domain</module>
                <module>logic</module>
                <module>resources</module>
                <module>ejb</module>
                <module>ui</module>
                <module>citizen.ui</module>
                <module>ear</module>
            </modules>
        </profile>
        <profile>
            <id>citizen</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <modules>
                <module>domain</module>
                <module>logic</module>
                <module>resources</module>
                <module>ejb</module>
                <module>ui</module>
                <module>citizen.ui</module>
                <module>ear</module>
            </modules>
        </profile>
        <profile>
            <id>difuse</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <modules>
                <module>domain</module>
                <module>logic</module>
                <module>resources</module>
                <module>ejb</module>
                <module>ear</module>
            </modules>
        </profile>
    </profiles>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <customBundle>${project.exampledir}/src/site/resources/project-info-report_ca.properties</customBundle>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>index</report>
                            <report>dependency-info</report>
                            <report>project-team</report>
                            <report>summary</report>
                            <report>scm</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.14.1</version>
                <configuration>
                    <aggregate>true</aggregate>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <!-- Només s'ha d'incloure-hi la definició -->
                    <excludePackageNames>dom.example.project.serveis.ejb;dom.example.project.serveis.impl;dom.example.project.ui</excludePackageNames>
                    <!-- No hem d'incloure-hi els arxius de test -->
                    <excludes>**/*Test.java</excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-changes-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <xmlPath>${exampledir}/src/site/changes.xml</xmlPath>
                    <issueLinkTemplatePerSystem>
                        <Redmine2><![CDATA[%URL%/issues/%ISSUE%]]></Redmine2>
                    </issueLinkTemplatePerSystem>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>changes-report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <aggregate>true</aggregate>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>cobertura</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

    <distributionManagement>
        <site>
            <id>mavendocs-example</id>
            <name>mavendocs.example.dom</name>
            <url>${example.url.mavendocs}</url>
        </site>
    </distributionManagement>

    <modules>
        <module>domain</module>
        <module>recources</module>
        <module>logic</module>
        <module>ejb</module>
        <module>ui</module>
        <module>citizen.ui</module>
        <module>ear</module>
        <module>test</module>
    </modules>

    <dependencies>
        <dependency>
            <groupId>dom.example.tip</groupId>
            <artifactId>tip.domain</artifactId>
            <version>1.7.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.sca</groupId>
            <artifactId>sca.domain</artifactId>
            <version>1.3.4-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.gea</groupId>
            <artifactId>gea.domain</artifactId>
            <version>2.5.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>examplegd</groupId>
            <artifactId>examplegd.domain</artifactId>
            <version>1.2.0</version>
            <scope>provided</scope>
        </dependency>
        <!-- Dependències del servei de registre. -->
        <dependency>
            <groupId>dom.example.res</groupId>
            <artifactId>res.domain</artifactId>
            <version>1.14.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <!-- Dependències del mòdul d'ASF. -->
        <dependency>
            <groupId>dom.example.exampleframe.modules.asf</groupId>
            <artifactId>bf-modul-asf</artifactId>
            <version>0.0.2-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.alerts</groupId>
            <artifactId>alerts.domain</artifactId>
            <version>0.0.3-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.gmc</groupId>
            <artifactId>gmc.domain</artifactId>
            <version>1.5.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.gmc</groupId>
            <artifactId>gmc.recursos</artifactId>
            <version>1.5.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.exampleframe</groupId>
            <artifactId>exampleframe-transicio</artifactId>
            <version>[0.12.,1.0)</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>
</code>```

答:
You look into child pom, look into a parent pom</p>

```<code><parent>
    <groupId>dom.example.exampleframe</groupId>
    <artifactId>project-parent-exampleframe</artifactId>
    <version>0.0.11.c-SNAPSHOT</version>
</parent>
</code>```

Body:
I'm struggling with this maven project.

When I try for example to clean or package the project I get an error like this

org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5

I already done a question about that but I realised that in my maven repository I don't have the 2.5 version I only have the 2.4.1 then maven go to the central repository to find that version and throws this error.

But I don't know why maven is looking for that 2.5 version, I'm not declaring it on the pom.xml so where I can change or force maven to look 2.4.1 version?

Also I need to say that this error happens in all my projects (there are all from the same domain)

This is the pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>dom.example.exampleframe</groupId>
        <artifactId>project-parent-exampleframe</artifactId>
        <version>0.0.11.c-SNAPSHOT</version>
    </parent>

    <groupId>dom.example.project</groupId>
    <artifactId>project</artifactId>
    <version>1.9.0-SNAPSHOT</version>
    <name>project</name>
    <packaging>pom</packaging>

    <description>Esquelet d'una aplicació BaseFrame</description>
    <url>http://pro-projectes.example.pro/projects/project</url>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <instrumentation>
                        <excludes>
                            <exclude>**/ejb/*.class</exclude>
                            <exclude>**/domain/*.class</exclude>
                            <exclude>**/services/*.class</exclude>
                            <exclude>**/*Exception.class</exclude>
                            <exclude>**/Constants*.class</exclude>
                            <exclude>**/IConstants*.class</exclude>
                        </excludes>
                        <ignores>
                            <ignore>.+logger\..+</ignore>
                        </ignores>
                    </instrumentation>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <modules>
                <module>domain</module>
                <module>logic</module>
                <module>resources</module>
                <module>ejb</module>
                <module>ui</module>
                <module>citizen.ui</module>
                <module>ear</module>
            </modules>
        </profile>
        <profile>
            <id>citizen</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <modules>
                <module>domain</module>
                <module>logic</module>
                <module>resources</module>
                <module>ejb</module>
                <module>ui</module>
                <module>citizen.ui</module>
                <module>ear</module>
            </modules>
        </profile>
        <profile>
            <id>difuse</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <modules>
                <module>domain</module>
                <module>logic</module>
                <module>resources</module>
                <module>ejb</module>
                <module>ear</module>
            </modules>
        </profile>
    </profiles>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <customBundle>${project.exampledir}/src/site/resources/project-info-report_ca.properties</customBundle>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>index</report>
                            <report>dependency-info</report>
                            <report>project-team</report>
                            <report>summary</report>
                            <report>scm</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.14.1</version>
                <configuration>
                    <aggregate>true</aggregate>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>

                    <excludePackageNames>dom.example.project.serveis.ejb;dom.example.project.serveis.impl;dom.example.project.ui</excludePackageNames>

                    <excludes>**/*Test.java</excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-changes-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <xmlPath>${exampledir}/src/site/changes.xml</xmlPath>
                    <issueLinkTemplatePerSystem>
                        <Redmine2><![CDATA[%URL%/issues/%ISSUE%]]></Redmine2>
                    </issueLinkTemplatePerSystem>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>changes-report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <aggregate>true</aggregate>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>cobertura</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

    <distributionManagement>
        <site>
            <id>mavendocs-example</id>
            <name>mavendocs.example.dom</name>
            <url>${example.url.mavendocs}</url>
        </site>
    </distributionManagement>

    <modules>
        <module>domain</module>
        <module>recources</module>
        <module>logic</module>
        <module>ejb</module>
        <module>ui</module>
        <module>citizen.ui</module>
        <module>ear</module>
        <module>test</module>
    </modules>

    <dependencies>
        <dependency>
            <groupId>dom.example.tip</groupId>
            <artifactId>tip.domain</artifactId>
            <version>1.7.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.sca</groupId>
            <artifactId>sca.domain</artifactId>
            <version>1.3.4-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.gea</groupId>
            <artifactId>gea.domain</artifactId>
            <version>2.5.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>examplegd</groupId>
            <artifactId>examplegd.domain</artifactId>
            <version>1.2.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>dom.example.res</groupId>
            <artifactId>res.domain</artifactId>
            <version>1.14.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>dom.example.exampleframe.modules.asf</groupId>
            <artifactId>bf-modul-asf</artifactId>
            <version>0.0.2-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.alerts</groupId>
            <artifactId>alerts.domain</artifactId>
            <version>0.0.3-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.gmc</groupId>
            <artifactId>gmc.domain</artifactId>
            <version>1.5.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.gmc</groupId>
            <artifactId>gmc.recursos</artifactId>
            <version>1.5.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.exampleframe</groupId>
            <artifactId>exampleframe-transicio</artifactId>
            <version>[0.12.,1.0)</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>

Body:
You look into child pom, look into a parent pom

<parent>
    <groupId>dom.example.exampleframe</groupId>
    <artifactId>project-parent-exampleframe</artifactId>
    <version>0.0.11.c-SNAPSHOT</version>
</parent>


问:
Export table data into csv file option not there in SQL Developer (Version 3.1.07)
Export table data into csv file option not there in SQL Developer (Version 3.1.07). can anyone please help me to export the one table data into csv file using SQL Developer?</p>

答: Just need to scroll up to see option for csv file under export in sql developer.</p>


问:
Cannot set priority of namenode process xxxxx
I'm trying to install hadoop on my mac.

What I did are

```<code>brew install hadoop
*in hadoop-env.sh: set JAVA_HOME and HADOOP_OPTS*
</code>```

Then, I tried start-dfs.sh, but the following error came up:

AL01299205:hadoop user$ /usr/local/Cellar/hadoop/3.2.1/sbin/start-dfs.sh

Starting namenodes on [AL01299205.local]

AL01299205.local: ERROR: Cannot set priority of namenode process 24897

Starting datanodes Starting secondary namenodes [AL01299205.local]

AL01299205.local: ERROR: Cannot set priority of secondarynamenode process 25147

2020-02-19 18:06:08,843 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

How can I fix this error?

答:
I additionally edited some files as follows:

hadoop-evn.sh

```<code>export HADOOP_OPTS="$HADOOP_OPTS -Djava.net.preferIPv4Stack=true -Djava.security.krb5.realm= -Djava.security.krb5.kdc="
</code>```

core-site.xml

```<code><configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/Cellar/hadoop/hdfs/tmp</value>
<description>A base for other temporary directories.</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
</code>```

mapred-site.xml

```<code><configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9010</value>
</property>
</configuration>
</code>```

hdfs-site.xml

```<code><configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
</code>```

Then the errors were gone.

Body:
I'm trying to install hadoop on my mac.

What I did are

brew install hadoop
*in hadoop-env.sh: set JAVA_HOME and HADOOP_OPTS*

Then, I tried start-dfs.sh, but the following error came up:

AL01299205:hadoop user$ /usr/local/Cellar/hadoop/3.2.1/sbin/start-dfs.sh

Starting namenodes on [AL01299205.local]

AL01299205.local: ERROR: Cannot set priority of namenode process 24897

Starting datanodes Starting secondary namenodes [AL01299205.local]

AL01299205.local: ERROR: Cannot set priority of secondarynamenode process 25147

2020-02-19 18:06:08,843 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

How can I fix this error?

Body:
I additionally edited some files as follows:

hadoop-evn.sh

export HADOOP_OPTS="$HADOOP_OPTS -Djava.net.preferIPv4Stack=true -Djava.security.krb5.realm= -Djava.security.krb5.kdc="

core-site.xml

<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/Cellar/hadoop/hdfs/tmp</value>
<description>A base for other temporary directories.</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>

mapred-site.xml

<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9010</value>
</property>
</configuration>

hdfs-site.xml

<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>

Then the errors were gone.


问:
Select parent selector in SASS/SCSS
I have a small missunderstanding in SCSS syntax. Creating small component using BEM methodology and got a problem in SCSS.
HTML:

```<code><div class="message message--success">
        <div class="message__title">
          BEM Example
        </div>
        <div class="message__content">
          <p>BEM Example text</p>
        </div>
      </div>
</code>```

SCSS:

```<code>.message {
  display: block;
  width: 300px;
  border-radius: 5px;
  border: 2px solid #000;
  padding: 10px;

  &__title {
    font-size: 18px;
    line-height: 1;
    color: #000;
    margin-bottom: 10px;
  }

  &__content {
    font-size: 15px;
    color: #000;
  }

  &--success {
    border-color: #3f9442;

    &__title {
      color: #3f9442;
    }

    &__content {
      color: #3f9442;
    }
  }
}
</code>```

As you can see, I have .message--success class and inside &--success the direct styles(border-color) works, but stylyng for title and content not. How to select .message* as parent for **&__title and &__content inside &--success

答:
Try this way

```<code>.message {
  display: block;
  width: 300px;
  border-radius: 5px;
  border: 2px solid #000;
  padding: 10px;

  &__title {
    font-size: 18px;
    line-height: 1;
    color: #000;
    margin-bottom: 10px;
  }

  &__content {
    font-size: 15px;
    color: #000;
  }

  &--success {
    border-color: #3f9442;
    .message{
      &__title {
        color: #3f9442;
      }

      &__content {
        color: #3f9442;
      }
    }
  }
}
</code>```

https://jsfiddle.net/lalji1051/21b3cksm/4/

Title: Select parent selector in SASS/SCSS

Body:
I have a small missunderstanding in SCSS syntax. Creating small component using BEM methodology and got a problem in SCSS.
HTML:

          BEM Example

BEM Example text

SCSS:

.message {
  display: block;
  width: 300px;
  border-radius: 5px;
  border: 2px solid #000;
  padding: 10px;

  &__title {
    font-size: 18px;
    line-height: 1;
    color: #000;
    margin-bottom: 10px;
  }

  &__content {
    font-size: 15px;
    color: #000;
  }

  &--success {
    border-color: #3f9442;

    &__title {
      color: #3f9442;
    }

    &__content {
      color: #3f9442;
    }
  }
}

As you can see, I have .message--success class and inside &--success the direct styles(border-color) works, but stylyng for title and content not. How to select .message* as parent for **&__title and &__content inside &--success

Body:
Try this way

.message {
  display: block;
  width: 300px;
  border-radius: 5px;
  border: 2px solid #000;
  padding: 10px;

  &__title {
    font-size: 18px;
    line-height: 1;
    color: #000;
    margin-bottom: 10px;
  }

  &__content {
    font-size: 15px;
    color: #000;
  }

  &--success {
    border-color: #3f9442;
    .message{
      &__title {
        color: #3f9442;
      }

      &__content {
        color: #3f9442;
      }
    }
  }
}

https://jsfiddle.net/lalji1051/21b3cksm/4/


问:
While running ng serve command i'm getting this error

Package.jon file

```<code>{
  "name": "architectui-angular-free",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular-redux/store": "^9.0.0",
    "@angular/animations": "^7.2.11",
    "@angular/cdk": "^7.3.6",
    "@angular/common": "^7.2.11",
    "@angular/compiler": "^7.2.11",
    "@angular/core": "^7.2.11",
    "@angular/forms": "^7.2.11",
    "@angular/platform-browser": "^7.2.11",
    "@angular/platform-browser-dynamic": "^7.2.11",
    "@angular/router": "^7.2.11",
    "@ng-bootstrap/ng-bootstrap": "^4.1.1",
    "@ngx-loading-bar/core": "^4.2.0",
    "@ngx-loading-bar/router": "^4.2.0",
    "angular-font-awesome": "^3.1.2",
    "animate-sass": "^0.8.2",
    "bootstrap": "4.3.1",
    "chart.js": "^2.8.0",
    "chartjs-adapter-luxon": "^0.1.1",
    "chartjs-plugin-annotation": "^0.5.7",
    "chartjs-plugin-datalabels": "^0.6.0",
    "font-awesome": "^4.7.0",
    "lodash-es": "^4.17.11",
    "ng-bootstrap": "^1.6.3",
    "ng2-charts": "^2.2.2",
    "ngx-perfect-scrollbar": "^7.2.1",
    "pe7-icon": "^1.0.4",
    "redux": "4.0.0",
    "sass-loader": "^7.0.1",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.13.9",
    "@angular/cli": "^9.0.2",
    "@angular/compiler-cli": "^7.2.11",
    "@angular/language-service": "^7.2.11",
    "@fortawesome/fontawesome-free": "^5.8.1",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.5.0",
    "cross-env": "^5.0.5",
    "increase-memory-limit": "^1.0.3",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.1.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^2.0.5",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.2.2"
  }
}
</code>```

ERROR

```<code>ERROR in ./src/styles.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/dist/cjs.js??ref--14-3!./src/styles.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'includePaths'. These properties are valid:
   object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    at validate (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:85:11)
    at Object.loader (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\dist\index.js:36:28)
ERROR in ./node_modules/font-awesome/scss/font-awesome.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/dist/cjs.js??ref--14-3!./node_modules/font-awesome/scss/font-awesome.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'includePaths'. These properties are valid:
   object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    at validate (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:85:11)
    at Object.loader (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\dist\index.js:36:28)
ERROR in ./src/app/DemoPages/Charts/chartjs/examples/pie-chart/pie-chart.component.scss
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'includePaths'. These properties are valid:
   object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    at validate (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:85:11)
    at Object.loader (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\dist\index.js:36:28)
ERROR in ./src/app/DemoPages/Charts/chartjs/examples/polar-area-chart/polar-area-chart.component.scss
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'includePaths'. These properties are valid:
   object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    at validate (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:85:11)
    at Object.loader (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\dist\index.js:36:28)
ERROR in ./src/app/DemoPages/Charts/chartjs/examples/radar-chart/radar-chart.component.scss
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'includePaths'. These properties are valid:
   object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    at validate (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:85:11)
    at Object.loader (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\dist\index.js:36:28)
ERROR in ./src/app/DemoPages/Charts/chartjs/examples/scatter-chart/scatter-chart.component.scss
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'includePaths'. These properties are valid:
   object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    at validate (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:85:11)
    at Object.loader (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\dist\index.js:36:28)
</code>```

答:
May be something wrong in your packages.

Option1: Update all packages.

Option2: Re install all packages. Delete your node_modules folder and run npm-i from command-line.

Body:
Package.jon file

{
  "name": "architectui-angular-free",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular-redux/store": "^9.0.0",
    "@angular/animations": "^7.2.11",
    "@angular/cdk": "^7.3.6",
    "@angular/common": "^7.2.11",
    "@angular/compiler": "^7.2.11",
    "@angular/core": "^7.2.11",
    "@angular/forms": "^7.2.11",
    "@angular/platform-browser": "^7.2.11",
    "@angular/platform-browser-dynamic": "^7.2.11",
    "@angular/router": "^7.2.11",
    "@ng-bootstrap/ng-bootstrap": "^4.1.1",
    "@ngx-loading-bar/core": "^4.2.0",
    "@ngx-loading-bar/router": "^4.2.0",
    "angular-font-awesome": "^3.1.2",
    "animate-sass": "^0.8.2",
    "bootstrap": "4.3.1",
    "chart.js": "^2.8.0",
    "chartjs-adapter-luxon": "^0.1.1",
    "chartjs-plugin-annotation": "^0.5.7",
    "chartjs-plugin-datalabels": "^0.6.0",
    "font-awesome": "^4.7.0",
    "lodash-es": "^4.17.11",
    "ng-bootstrap": "^1.6.3",
    "ng2-charts": "^2.2.2",
    "ngx-perfect-scrollbar": "^7.2.1",
    "pe7-icon": "^1.0.4",
    "redux": "4.0.0",
    "sass-loader": "^7.0.1",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.13.9",
    "@angular/cli": "^9.0.2",
    "@angular/compiler-cli": "^7.2.11",
    "@angular/language-service": "^7.2.11",
    "@fortawesome/fontawesome-free": "^5.8.1",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.5.0",
    "cross-env": "^5.0.5",
    "increase-memory-limit": "^1.0.3",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.1.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^2.0.5",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.2.2"
  }
}

ERROR

ERROR in ./src/styles.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/dist/cjs.js??ref--14-3!./src/styles.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'includePaths'. These properties are valid:
   object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    at validate (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:85:11)
    at Object.loader (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\dist\index.js:36:28)
ERROR in ./node_modules/font-awesome/scss/font-awesome.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/dist/cjs.js??ref--14-3!./node_modules/font-awesome/scss/font-awesome.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'includePaths'. These properties are valid:
   object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    at validate (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:85:11)
    at Object.loader (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\dist\index.js:36:28)
ERROR in ./src/app/DemoPages/Charts/chartjs/examples/pie-chart/pie-chart.component.scss
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'includePaths'. These properties are valid:
   object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    at validate (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:85:11)
    at Object.loader (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\dist\index.js:36:28)
ERROR in ./src/app/DemoPages/Charts/chartjs/examples/polar-area-chart/polar-area-chart.component.scss
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'includePaths'. These properties are valid:
   object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    at validate (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:85:11)
    at Object.loader (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\dist\index.js:36:28)
ERROR in ./src/app/DemoPages/Charts/chartjs/examples/radar-chart/radar-chart.component.scss
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'includePaths'. These properties are valid:
   object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    at validate (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:85:11)
    at Object.loader (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\dist\index.js:36:28)
ERROR in ./src/app/DemoPages/Charts/chartjs/examples/scatter-chart/scatter-chart.component.scss
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'includePaths'. These properties are valid:
   object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    at validate (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:85:11)
    at Object.loader (C:\Users\YASH\AppData\Roaming\npm\architectui-angular-free-theme\architectui-angular-free-theme\node_modules\sass-loader\dist\index.js:36:28)


问:
Dictionary<StudentType, List<Student>> to IDictionary<StudentType, IList<Student>>?
Please consider the following code:

```<code>class Student
{
}

enum StudentType
{
}

static void foo(IDictionary<StudentType, IList<Student>> students)
{
}

static void Main(string[] args)
{
    Dictionary<StudentType, List<Student>> studentDict =
                     new Dictionary<StudentType, List<Student>>();

    foo(studentDict);

    ...
}
</code>```

There is the error:

error CS1503: Argument '1': cannot
  convert from
  'System.Collections.Generic.Dictionary>'
  to
  'System.Collections.Generic.IDictionary>'

Is there any way to call foo function?

答:
change the creation of studentDict to be:</p>

```<code>Dictionary<StudentType, IList<Student>> studentDict = new Dictionary<StudentType, IList<Student>>();
</code>```

Body:
Please consider the following code:

class Student
{
}

enum StudentType
{
}

static void foo(IDictionary<StudentType, IList<Student>> students)
{
}

static void Main(string[] args)
{
    Dictionary<StudentType, List<Student>> studentDict =
                     new Dictionary<StudentType, List<Student>>();

    foo(studentDict);

    ...
}

There is the error:

error CS1503: Argument '1': cannot
  convert from
  'System.Collections.Generic.Dictionary>'
  to
  'System.Collections.Generic.IDictionary>'

Is there any way to call foo function?

Body:
change the creation of studentDict to be:

Dictionary<StudentType, IList<Student>> studentDict = new Dictionary<StudentType, IList<Student>>();


问:
JMeter throws error 'Signature doesn't match' while uploading file to s3
Can anyone help me figure out what is happening?

I am trying to load test an application where a user can upload and download files.

Journey:

Step-1:When a user choose a file from disk (POST request) it creates a fileID and path with uuid.

Response looks like:
{"id":"FILE-VX-1234","path":"uuid/filename.jpg","uri":["s3://{location}/{uuid}/{filename}?endpoint=s3.dualstack.eu-west-1.amazonaws.com"],"state":"OPEN","size":-1,"timestamp":"2020-02-13T10:59:43.146+0000","refreshFlag":1,"storage":"STORAGEID","metadata":{}

Step-2:Using these (POST request) which responds with a s3 uri with assesskeyID, secretaccesskey and sessionToken.

Response looks like:
{"uri":["s3://{accesskeyID}:{secretaccesskey}@{storage location}/{uuid}/{filename}?endpoint=s3.dualstack.eu-west-1.amazonaws.com&sessionToken={security token}"]}

Step-3:Using these and added temporary parameters (date), a PUT request uploads a file in s3 bucket.

Header looks like:

```<code>Accept: */*

Accept-Encoding: gzip, deflate, br

Accept-Language: en-GB,en-US;q=0.9,en;q=0.8

Authorization: AWS4-HMAC-SHA256 Credential=${accesskeyID}/${currentDate}/{region}/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token;x-amz-user-agent, Signature=${secretaccesskey}

Connection: keep-alive

Content-Length: 145541

Content-Type: image/jpeg

Host: <the host address>

Origin: https://{url}

Referer: https://{url}/upload/

Sec-Fetch-Mode: cors

Sec-Fetch-Site: cross-site

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36

X-Amz-Content-Sha256: UNSIGNED-PAYLOAD

X-Amz-Date:${currentDateInUTC}

x-amz-security-token: ${sessionToken}

X-Amz-User-Agent: aws-sdk-js/2.409.0 callback
</code>```

Error:
<Error>SignatureDoesNotMatch<Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>

I have verified that the signature(secretaccesskey), accesskeyID and sessionToken which are passed in PUT request are correct.

Note: Additional parameters date and "{region}/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token;x-amz-user-agent" in Authorisation error are hardcoded.

答:
It is impossible to provide any assistance without seeing how do you generate the signature for the request, to wit this Authorization header

As per Signing and Authenticating REST Requests article

The Amazon S3 REST API uses a custom HTTP scheme based on a keyed-HMAC (Hash Message Authentication Code) for authentication. To authenticate a request, you first concatenate selected elements of the request to form a string. You then use your AWS secret access key to calculate the HMAC of that string. Informally, we call this process "signing the request," and we call the output of the HMAC algorithm the signature, because it simulates the security properties of a real signature. Finally, you add this signature as a parameter of the request by using the syntax described in this section.

Here is a pseudo-code demonstrating how the header needs to be generated:

```<code>Authorization = "AWS" + " " + AWSAccessKeyId + ":" + Signature;

Signature = Base64( HMAC-SHA1( YourSecretAccessKey, UTF-8-Encoding-Of( StringToSign ) ) );

StringToSign = HTTP-Verb + "\n" +
    Content-MD5 + "\n" +
    Content-Type + "\n" +
    Date + "\n" +
    CanonicalizedAmzHeaders +
    CanonicalizedResource;

CanonicalizedResource = [ "/" + Bucket ] +
    <HTTP-Request-URI, from the protocol name up to the query string> +
    [ subresource, if present. For example "?acl", "?location", "?logging", or "?torrent"];

CanonicalizedAmzHeaders = <described below>
</code>```

You can check How to Handle Dynamic AWS SigV4 in JMeter for API Testing article for example implementation.

Body:
Can anyone help me figure out what is happening?

I am trying to load test an application where a user can upload and download files.

Journey:

Step-1:When a user choose a file from disk (POST request) it creates a fileID and path with uuid.

Response looks like:
{"id":"FILE-VX-1234","path":"uuid/filename.jpg","uri":["s3://{location}/{uuid}/{filename}?endpoint=s3.dualstack.eu-west-1.amazonaws.com"],"state":"OPEN","size":-1,"timestamp":"2020-02-13T10:59:43.146+0000","refreshFlag":1,"storage":"STORAGEID","metadata":{}

Step-2:Using these (POST request) which responds with a s3 uri with assesskeyID, secretaccesskey and sessionToken.

Response looks like:
{"uri":["s3://{accesskeyID}:{secretaccesskey}@{storage location}/{uuid}/{filename}?endpoint=s3.dualstack.eu-west-1.amazonaws.com&sessionToken={security token}"]}

Step-3:Using these and added temporary parameters (date), a PUT request uploads a file in s3 bucket.

Header looks like:

Accept: */*

Accept-Encoding: gzip, deflate, br

Accept-Language: en-GB,en-US;q=0.9,en;q=0.8

Authorization: AWS4-HMAC-SHA256 Credential=${accesskeyID}/${currentDate}/{region}/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token;x-amz-user-agent, Signature=${secretaccesskey}

Connection: keep-alive

Content-Length: 145541

Content-Type: image/jpeg

Host: <the host address>

Origin: https://{url}

Referer: https://{url}/upload/

Sec-Fetch-Mode: cors

Sec-Fetch-Site: cross-site

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36

X-Amz-Content-Sha256: UNSIGNED-PAYLOAD

X-Amz-Date:${currentDateInUTC}

x-amz-security-token: ${sessionToken}

X-Amz-User-Agent: aws-sdk-js/2.409.0 callback

Error:
<Error>SignatureDoesNotMatch<Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>

I have verified that the signature(secretaccesskey), accesskeyID and sessionToken which are passed in PUT request are correct.

Note: Additional parameters date and "{region}/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token;x-amz-user-agent" in Authorisation error are hardcoded.

Body:
It is impossible to provide any assistance without seeing how do you generate the signature for the request, to wit this Authorization header

As per Signing and Authenticating REST Requests article

The Amazon S3 REST API uses a custom HTTP scheme based on a keyed-HMAC (Hash Message Authentication Code) for authentication. To authenticate a request, you first concatenate selected elements of the request to form a string. You then use your AWS secret access key to calculate the HMAC of that string. Informally, we call this process "signing the request," and we call the output of the HMAC algorithm the signature, because it simulates the security properties of a real signature. Finally, you add this signature as a parameter of the request by using the syntax described in this section.

Here is a pseudo-code demonstrating how the header needs to be generated:

Authorization = "AWS" + " " + AWSAccessKeyId + ":" + Signature;

Signature = Base64( HMAC-SHA1( YourSecretAccessKey, UTF-8-Encoding-Of( StringToSign ) ) );

StringToSign = HTTP-Verb + "\n" +
    Content-MD5 + "\n" +
    Content-Type + "\n" +
    Date + "\n" +
    CanonicalizedAmzHeaders +
    CanonicalizedResource;

CanonicalizedResource = [ "/" + Bucket ] +
    <HTTP-Request-URI, from the protocol name up to the query string> +
    [ subresource, if present. For example "?acl", "?location", "?logging", or "?torrent"];

CanonicalizedAmzHeaders = <described below>

You can check How to Handle Dynamic AWS SigV4 in JMeter for API Testing article for example implementation.


问:
How to implement selenium to run in headless mode in linux cloud
When I use WebDriver driver = new HtmlUnitDriver(); to run selenium test cases in headless mode on Windows machine then it works fine. But it doesn't work on Linux cloud.
Do I need xvfb frame buffer, sample code and steps to implement this will be really helpful.

答:
first install xvfb with below command

apt-get install xvfb firefox

Now run your test file using xvfb as

xvfb-run ruby test.rb


问:
Crud Generator with Laravel
Since 2 weeks I work in a projet of devlopment of a application. I must creat many CRUD and it may take many times. Now I want to know if I can use a free crud generator laravel.If yes, which generator?
Need your Help please.</p>

答:
Command:

```<code>php artisan make:model User -mrc
</code>```

RESTful Resource controller

A RESTful resource controller sets up some default routes for you and even names them.

```<code>Route::resource('users', 'UsersController');
</code>```

Gives you these named routes:

```<code>Verb          Path                        Action  Route Name
GET           /users                      index   users.index
GET           /users/create               create  users.create
POST          /users                      store   users.store
GET           /users/{user}               show    users.show
GET           /users/{user}/edit          edit    users.edit
PUT|PATCH     /users/{user}               update  users.update
DELETE        /users/{user}               destroy users.destroy
</code>```

And you would set up your controller something like this (actions = methods)

```<code>class UsersController extends BaseController {

    public function index() {}

    public function show($id) {}

    public function store() {}

}
</code>```

You can also choose what actions are included or excluded like this:

```<code>Route::resource('users', 'UsersController', [
    'only' => ['index', 'show']
]);

Route::resource('monkeys', 'MonkeysController', [
    'except' => ['edit', 'create']
]);
</code>```

RESTful Resource Controller documentation

Implicit controller

An Implicit controller is more flexible. You get routed to your controller methods based on the HTTP request type and name. However, you don't have route names defined for you and it will catch all subfolders for the same route.

```<code>Route::controller('users', 'UserController');
</code>```

Would lead you to set up the controller with a sort of RESTful naming scheme:

```<code>class UserController extends BaseController {

    public function getIndex()
    {
        // GET request to index
    }

    public function getShow($id)
    {
        // get request to 'users/show/{id}'
    }

    public function postStore()
    {
        // POST request to 'users/store'
    }

}
</code>```

Implicit Controller documentation

It is good practice to use what you need, as per your preference. I personally don't like the Implicit controllers, because they can be messy, don't provide names and can be confusing when using php artisan routes. I typically use RESTful Resource controllers in combination with explicit routes.

Title: Crud Generator with Laravel

Body:
Command:

php artisan make:model User -mrc

RESTful Resource controller

A RESTful resource controller sets up some default routes for you and even names them.

Route::resource('users', 'UsersController');

Gives you these named routes:

Verb          Path                        Action  Route Name
GET           /users                      index   users.index
GET           /users/create               create  users.create
POST          /users                      store   users.store
GET           /users/{user}               show    users.show
GET           /users/{user}/edit          edit    users.edit
PUT|PATCH     /users/{user}               update  users.update
DELETE        /users/{user}               destroy users.destroy

And you would set up your controller something like this (actions = methods)

class UsersController extends BaseController {

    public function index() {}

    public function show($id) {}

    public function store() {}

}

You can also choose what actions are included or excluded like this:

Route::resource('users', 'UsersController', [
    'only' => ['index', 'show']
]);

Route::resource('monkeys', 'MonkeysController', [
    'except' => ['edit', 'create']
]);

RESTful Resource Controller documentation

Implicit controller

An Implicit controller is more flexible. You get routed to your controller methods based on the HTTP request type and name. However, you don't have route names defined for you and it will catch all subfolders for the same route.

Route::controller('users', 'UserController');

Would lead you to set up the controller with a sort of RESTful naming scheme:

class UserController extends BaseController {

    public function getIndex()
    {
        // GET request to index
    }

    public function getShow($id)
    {
        // get request to 'users/show/{id}'
    }

    public function postStore()
    {
        // POST request to 'users/store'
    }

}

Implicit Controller documentation

It is good practice to use what you need, as per your preference. I personally don't like the Implicit controllers, because they can be messy, don't provide names and can be confusing when using php artisan routes. I typically use RESTful Resource controllers in combination with explicit routes.


问:
Does ASP.NET Core JWT Authentication support multiple symmetric signing keys?
Some libraries like https://www.nuget.org/packages/JWT support the concept of multiple symmetric signing keys.

https://github.com/jwt-dotnet/jwt/blob/6d922587515831f3bc17740db4cc42fa4d49de39/src/JWT/JwtValidator.cs#L123

https://github.com/jwt-dotnet/jwt/blob/6d922587515831f3bc17740db4cc42fa4d49de39/src/JWT/JwtDecoder.cs#L101

I would like to use the MS Provided Microsoft.AspNetCore.Authentication.JwtBearer implementation if possible. Does that implementation support multiple symmetric signing keys?

The SymmetricSecurityKey class appears to only support a single key.

Multiple calls to JwtBearerExtensions.AddJwtBearer throw an exception: InvalidOperationException: Scheme already exists: Bearer

The reason for wanting to support multiple signing keys is to support a rolling keys scenario.

答:
The JwtBearerOptions TokenValidationParameters property contains a IssuerSigningKeys property that allows you to provide multiple SecurityKeys

https://learn.microsoft.com/en-us/dotnet/api/microsoft.identitymodel.tokens.tokenvalidationparameters.issuersigningkeys?view=azure-dotnet#Microsoft_IdentityModel_Tokens_TokenValidationParameters_IssuerSigningKeys

```<code>services
    .AddAuthentication("Bearer")
    .AddJwtBearer("Bearer", options =>
    {
        options.TokenValidationParameters = new TokenValidationParameters()
        {
            IssuerSigningKeys = new[]
            {
                new RsaSecurityKey(signingKey01),
                new RsaSecurityKey(signingKey02),
            },
        };
    });
</code>```

Body:
The JwtBearerOptions TokenValidationParameters property contains a IssuerSigningKeys property that allows you to provide multiple SecurityKeys

https://learn.microsoft.com/en-us/dotnet/api/microsoft.identitymodel.tokens.tokenvalidationparameters.issuersigningkeys?view=azure-dotnet#Microsoft_IdentityModel_Tokens_TokenValidationParameters_IssuerSigningKeys

services
    .AddAuthentication("Bearer")
    .AddJwtBearer("Bearer", options =>
    {
        options.TokenValidationParameters = new TokenValidationParameters()
        {
            IssuerSigningKeys = new[]
            {
                new RsaSecurityKey(signingKey01),
                new RsaSecurityKey(signingKey02),
            },
        };
    });


问:
Using a Website-specific ConnectionString with a DLL
The Setup:

I have a DLL that uses a ConnectionString to connect to a SQL database.  When I add the DLL to my website i have to add the connectionstring into my web.config in order for my DLL to function properly (this is by design).  Once I add it into the web.config then everything works fine (as expected).

The Problem:

The problem begins when I want to move the connectionstring into my Website's ASP.NET Application settings found in IIS > Default Website > Properties > ASP.NET tab > Edit Global Configuration... > Connection string manager

If I remove it from my web.config and put it there my DLL fails to work.  If I use the connectionstring anywhere else in my website (and not from a DLL) I can access the database just fine through this method but for some reason my DLL can only access it if it's in the web.config.

The Question:

How can I get my DLL to use the connectionstring that's listed in the ASP.NET Configuration Settings Connection String Manager instead of the web.config?

答:
You have to look for the section from the general ASP.Net configuration settings, which can be retrieved through the WebConfigurationManager class, rather than looking for a connection string via ConfigurationManager.ConnectionStrings.</p>

```<code>    // Get the connectionStrings section.
ConnectionStringsSection connectionStringsSection =
    WebConfigurationManager.GetSection("connectionStrings")
    as ConnectionStringsSection;

// Get the connectionStrings key,value pairs collection.
ConnectionStringSettingsCollection connectionStrings =
    connectionStringsSection.ConnectionStrings;

// Get the collection enumerator.
IEnumerator connectionStringsEnum =
    connectionStrings.GetEnumerator();
</code>```

OwnerDisplayName: EdenMachine

ContentLicense: CC BY-SA 2.5

Body:
You have to look for the section from the general ASP.Net configuration settings, which can be retrieved through the WebConfigurationManager class, rather than looking for a connection string via ConfigurationManager.ConnectionStrings.

    // Get the connectionStrings section.
ConnectionStringsSection connectionStringsSection =
    WebConfigurationManager.GetSection("connectionStrings")
    as ConnectionStringsSection;

// Get the connectionStrings key,value pairs collection.
ConnectionStringSettingsCollection connectionStrings =
    connectionStringsSection.ConnectionStrings;

// Get the collection enumerator.
IEnumerator connectionStringsEnum =
    connectionStrings.GetEnumerator();

OwnerDisplayName: jro


问:
AppWidget in Android Activity
I would like to show AppWidget in Android Activity to make drap and drop facility and I would like to create some kind of floor plan with some widgets, how can I do this?</p>

答: You cannot readily "show AppWidget in Android Activity". An app widget has nothing whatsoever to do with "drap and drop facility".</p>

Title: AppWidget in Android Activity


问:
How should I use TLS on Akka 2.6.3 Scala?
I was using following TLS class for Akka 2.5.0, but the AkkaSSLConfig is deprecated on Akk 2.6.0 and above.

```<code>case class TlsContext(
                       sslContext: SSLContext,
                       sslConfig: Option[AkkaSSLConfig] = None,
                       enabledCipherSuites: Option[immutable.Seq[String]] = None,
                       enabledProtocols: Option[immutable.Seq[String]] = None,
                       clientAuth: Option[TLSClientAuth] = None,
                       sslParameters: Option[SSLParameters] = None) {

  def firstSession =
    NegotiateNewSession(
      enabledCipherSuites, enabledProtocols, clientAuth, sslParameters)
}
</code>```

How should I change above code to use for upgraded Akka version

答:
The deprecated AkkaSSLConfig should be replaced by constructing a javax.net.ssl.SSLEngine in you own code.

The specific parameters from NegotiateNewSession are applied using the following methods on SSLEngine

```<code>SSLEngine#setEnabledCipherSuites
SSLEngine#setEnabledProtocols
SSLEngine#setNeedClientAuth
SSLEngine#setSSLParameters
</code>```

There is a sample for TLS streams in the Akka docs showing how to first construct an SSLContext and then a SSLEngine from that here: https://doc.akka.io/docs/akka/current/stream/stream-io.html#tls

Body:
I was using following TLS class for Akka 2.5.0, but the AkkaSSLConfig is deprecated on Akk 2.6.0 and above.

case class TlsContext(
                       sslContext: SSLContext,
                       sslConfig: Option[AkkaSSLConfig] = None,
                       enabledCipherSuites: Option[immutable.Seq[String]] = None,
                       enabledProtocols: Option[immutable.Seq[String]] = None,
                       clientAuth: Option[TLSClientAuth] = None,
                       sslParameters: Option[SSLParameters] = None) {

  def firstSession =
    NegotiateNewSession(
      enabledCipherSuites, enabledProtocols, clientAuth, sslParameters)
}

How should I change above code to use for upgraded Akka version

Body:
The deprecated AkkaSSLConfig should be replaced by constructing a javax.net.ssl.SSLEngine in you own code.

The specific parameters from NegotiateNewSession are applied using the following methods on SSLEngine

SSLEngine#setEnabledCipherSuites
SSLEngine#setEnabledProtocols
SSLEngine#setNeedClientAuth
SSLEngine#setSSLParameters

There is a sample for TLS streams in the Akka docs showing how to first construct an SSLContext and then a SSLEngine from that here: https://doc.akka.io/docs/akka/current/stream/stream-io.html#tls


问:
Using a custom type discriminator to tell JSON.net which type of a class hierarchy to deserialize
Suppose I have the following class hierarchy:

```<code>public abstract class Organization
{
    /* properties related to all organizations */
}

public sealed class Company : Organization
{
     /* properties related to companies */
}

public sealed class NonProfitOrganization : Organization
{
     /* properties related to non profit organizations */
}
</code>```

Is it possible to have json.net use property (say "type" or "discriminator") to determine which type the object when it deserializes the organization? For example, the following should deserialize an instance of Company.

```<code>{
   "type": "company"
   /* other properties related to companies */
}
</code>```

And the following should deserialize an instance of NonProfitOrganization.

```<code>{
   "type": "non-profit"
   /* other properties related to non profit */
}
</code>```

When I call the following:

```<code>Organization organization = JsonConvert.DeserializeObject<Organization>(payload);
</code>```

where payload is the above JSON snippets.  I had a look at setting the "TypeNameHandling" on properties or classes but it serializes the whole .NET type, which isn't "portable" between the client and server when the classes are defined in different namespaces and assemblies.

I'd rather define the type is a neutral manner which clients written in any language can use to determine the actual type of the object type being serialized.

答:
Use this JsonKnownTypes, it's very similar way to use, add couple of attribute:

```<code>[JsonConverter(typeof(JsonKnownTypeConverter<Organization>))]
[JsonDiscriminator(Name = "discriminator")]
[JsonKnownType(typeof(Company), "company")]
[JsonKnownType(typeof(NonProfitOrganization), "non-profit")]
public abstract class Organization
{
    /* properties related to all organizations */
}

public sealed class Company : Organization
{
     /* properties related to companies */
}

public sealed class NonProfitOrganization : Organization
{
     /* properties related to non profit organizations */
}
</code>```

And serialize:

```<code>var json = JsonConvert.SerializeObject(youObject)
</code>```

Output json:

```<code>{..., "discriminator":"non-profit"} //if object was NonProfitOrganization
</code>```

Deserialization:

```<code>var organization = JsonConvert.DeserializeObject<Organization>(payload);
</code>```

Body:
Suppose I have the following class hierarchy:

public abstract class Organization
{
    /* properties related to all organizations */
}

public sealed class Company : Organization
{
     /* properties related to companies */
}

public sealed class NonProfitOrganization : Organization
{
     /* properties related to non profit organizations */
}

Is it possible to have json.net use property (say "type" or "discriminator") to determine which type the object when it deserializes the organization? For example, the following should deserialize an instance of Company.

{
   "type": "company"
   /* other properties related to companies */
}

And the following should deserialize an instance of NonProfitOrganization.

{
   "type": "non-profit"
   /* other properties related to non profit */
}

When I call the following:

Organization organization = JsonConvert.DeserializeObject<Organization>(payload);

where payload is the above JSON snippets.  I had a look at setting the "TypeNameHandling" on properties or classes but it serializes the whole .NET type, which isn't "portable" between the client and server when the classes are defined in different namespaces and assemblies.

I'd rather define the type is a neutral manner which clients written in any language can use to determine the actual type of the object type being serialized.

Body:
Use this JsonKnownTypes, it's very similar way to use, add couple of attribute:

[JsonConverter(typeof(JsonKnownTypeConverter<Organization>))]
[JsonDiscriminator(Name = "discriminator")]
[JsonKnownType(typeof(Company), "company")]
[JsonKnownType(typeof(NonProfitOrganization), "non-profit")]
public abstract class Organization
{
    /* properties related to all organizations */
}

public sealed class Company : Organization
{
     /* properties related to companies */
}

public sealed class NonProfitOrganization : Organization
{
     /* properties related to non profit organizations */
}

And serialize:

var json = JsonConvert.SerializeObject(youObject)

Output json:

{..., "discriminator":"non-profit"} //if object was NonProfitOrganization

Deserialization:

var organization = JsonConvert.DeserializeObject<Organization>(payload);


问:
How may I add background color to dynamically added child rows in Datatables?
I am adding child rows dynamically to datatables to show data fetched dynamically. Here is the code for that:

```<code>var oTable = $('#myTable5').DataTable();
var tr = $('#'+id).closest('tr');
var row = oTable.row( tr );
console.log(row);
if ( row.child.isShown() ) {
    // This row is already open - close it
    row.child.hide();
    tr.removeClass('shown');
}
else {
    // Open this row
    row.child( format(dataSet) ).show();
    tr.addClass('shown');
}
</code>```

But for the life of me I cannot figure out how to add a background color to this child row!! I have tried a lot of things and nothing has worked. If you have successfully achieved this, please help.
Posting on datatable forums yielded no working response.

TIA.

答:
You can set background for child row as below. rowBackground is a css class.

Working fiddle here

```<code>row.child("child row",'rowBackground').show();
</code>```

Body:
I am adding child rows dynamically to datatables to show data fetched dynamically. Here is the code for that:

var oTable = $('#myTable5').DataTable();
var tr = $('#'+id).closest('tr');
var row = oTable.row( tr );
console.log(row);
if ( row.child.isShown() ) {
    // This row is already open - close it
    row.child.hide();
    tr.removeClass('shown');
}
else {
    // Open this row
    row.child( format(dataSet) ).show();
    tr.addClass('shown');
}

But for the life of me I cannot figure out how to add a background color to this child row!! I have tried a lot of things and nothing has worked. If you have successfully achieved this, please help.
Posting on datatable forums yielded no working response.

TIA.

Body:
You can set background for child row as below. rowBackground is a css class.

Working fiddle here

row.child("child row",'rowBackground').show();


问:
Why register storage class is explicitly deprecated
In numerical computation in mind, it seems to me that register storage class (which is currently deprecated and removed from the standard) was a good hint for optimization. Was there any specific reason for explicitly removing it from the standard? </p>

答:
From Wikipedia:

register is essentially meaningless in modern compilers due to optimization which will place variables in a register if appropriate regardless of whether the hint is given

EDIT:

C++ Standard Defect reports

The register keyword serves very little function, offering no more than a hint that a note says is typically ignored. It should be deprecated in this version of the standard, freeing the reserved name up for use in a future standard, much like auto has been re-used this time around for being similarly useless.