问:
Vue reactivity issue
I am trying to concat 2 arrays of arrays, but there is no effect because of async fetching one of them.

```<code>this.subcategories = [...this.subcategories, ...[ this.$store.getters['categories/subcategoriesOfCurrent'] ]];
</code>```

Getter above is being set after some ms (server response) so when this assignment is triggered, getter is empty. When state is set (server responded), array 'subcategories' should be updated but it is not (but getter is). How to solve it?

More code:

getter:

```<code>subcategoriesOfCurrent: (state: CategoriesState, getters: any) => {
        return (getters.current && getters.current.subcategoryIds) ?
            getters.current.subcategoryIds.map((id: string) => getters.all[id]) : [];
    }
</code>```

actions:

```<code>setCategory: ({ commit, dispatch }: ActionArgs, categoryId: string) => {
        commit('setCategory', categoryId); //sets current category Id
        dispatch('fetchSubcategories', categoryId); //fetching from server which commits updateCategorySubcategories
    },

fetchSubcategories: ({ dispatch, commit }: ActionArgs, parentId: string): void => {
            HttpService.getInstance().get(`/categories?parent_id=${parentId}`).subscribe(
                result => {
                    commit('updateCategories', result.data);
                    commit('updateCategorySubcategories', { parentId, categories: result.data });
                }
            );
        },
</code>```

mutation which updates subcategoryIds:

```<code>updateCategorySubcategories: (state: CategoriesState, { parentId, categories }: { parentId: string; categories: Category[] }): void => {
        Vue.set(state.categories[state.currentCategoryId], 'subcategoryIds', categories.map(category => category.id));
    },
</code>```

答:
Create a computed for the subcategories:

```<code>computed: {
    subcategories() {
        return [...this.subcategories, ...[ this.$store.getters['categories/subcategoriesOfCurrent'] ]];
    }
}
</code>```

since computed props are reactive, it will change the result each time the getter changes

Title: Vue reactivity issue

Body:
I am trying to concat 2 arrays of arrays, but there is no effect because of async fetching one of them.

this.subcategories = [...this.subcategories, ...[ this.$store.getters['categories/subcategoriesOfCurrent'] ]];

Getter above is being set after some ms (server response) so when this assignment is triggered, getter is empty. When state is set (server responded), array 'subcategories' should be updated but it is not (but getter is). How to solve it?

More code:

getter:

subcategoriesOfCurrent: (state: CategoriesState, getters: any) => {
        return (getters.current && getters.current.subcategoryIds) ?
            getters.current.subcategoryIds.map((id: string) => getters.all[id]) : [];
    }

actions:

setCategory: ({ commit, dispatch }: ActionArgs, categoryId: string) => {
        commit('setCategory', categoryId); //sets current category Id
        dispatch('fetchSubcategories', categoryId); //fetching from server which commits updateCategorySubcategories
    },

fetchSubcategories: ({ dispatch, commit }: ActionArgs, parentId: string): void => {
            HttpService.getInstance().get(`/categories?parent_id=${parentId}`).subscribe(
                result => {
                    commit('updateCategories', result.data);
                    commit('updateCategorySubcategories', { parentId, categories: result.data });
                }
            );
        },

mutation which updates subcategoryIds:

updateCategorySubcategories: (state: CategoriesState, { parentId, categories }: { parentId: string; categories: Category[] }): void => {
        Vue.set(state.categories[state.currentCategoryId], 'subcategoryIds', categories.map(category => category.id));
    },

Body:
Create a computed for the subcategories:

computed: {
    subcategories() {
        return [...this.subcategories, ...[ this.$store.getters['categories/subcategoriesOfCurrent'] ]];
    }
}

since computed props are reactive, it will change the result each time the getter changes


来源: stackexchange

问:
How to catch node TimeoutError and log the request?
I'm writing an application in node in which I do many websocket requests to a remote service (using the ws library). So the remote service is the server, and my node application is the client. It works quite well, but occasionally I suddenly get a long list of the following TimeoutError:

```<code>Unhandled rejection TimeoutError: ResourceRequest timed out
    at ResourceRequest._fireTimeout (/Users/kramer65/repos/mmj/node_modules/generic-pool/lib/ResourceRequest.js:58:17)
    at Timeout.bound (/Users/kramer65/repos/mmj/node_modules/generic-pool/lib/ResourceRequest.js:8:15)
    at ontimeout (timers.js:386:11)
    at tryOnTimeout (timers.js:250:5)
    at Timer.listOnTimeout (timers.js:214:5)
</code>```

Since I do many different websocket calls I now wonder for which call this error occurs. I tried wrapping the ws.send() in a try/catch as I pasted below, but that doesn't seem to do anything.

```<code>try {
    ws.send(request_json);
} catch(e) {
    console.log('WEBSOCKET ERROR', e);
    console.log('WEBSOCKET JSON', request_json);
}
</code>```

Does anybody know how I can catch the TimeoutError and log the request contents? All tips are welcome!

[EDIT]
As suggested by @Mark_M I added a callback to the ws.send() method as follows:

```<code>ws.send(JSON.stringify(request_obj)), (error)=>{
    console.log('WEBSOCKET ERROR', request_obj.action, error);
});
</code>```

Unfortunately I still get the same errors as I posted on the top of this question.

[EDIT2]
I also tried the suggestion made by @wrangler:

```<code>ws.send(JSON.stringify(request_obj));
ws.onerror = function(event) {
    console.log('WEBSOCKET ONERROR', request_obj.action, event);
};
ws.onclose = function (event){
    console.log('WEBSOCKET ONCLOSE', request_obj.action, event);
};
</code>```

but unfortunately this also doesn't seem to work. I still get the same errors as I posted on the top of this question.

Any other ideas?

答:
Ok, stupid me. After looking at the initial error a bit better I found that it was an error in the generic-pool package. On its npm page it says it's

a Promise based API, which can be used to reuse or throttle usage of
  expensive resources such as database connections

The problem turned out to be my database connection (which is used extensively). I solved it using this tip on github, which suggests to set the sequelize init pool settings as follows:

pool: {max: 5, min: 0, idle: 20000, acquire: 20000}

That solved it for me.

Thanks to the answers, I now have proper websocket error reporting though.. :-)

ContentLicense: CC BY-SA 3.0

Body:
I'm writing an application in node in which I do many websocket requests to a remote service (using the ws library). So the remote service is the server, and my node application is the client. It works quite well, but occasionally I suddenly get a long list of the following TimeoutError:

Unhandled rejection TimeoutError: ResourceRequest timed out
    at ResourceRequest._fireTimeout (/Users/kramer65/repos/mmj/node_modules/generic-pool/lib/ResourceRequest.js:58:17)
    at Timeout.bound (/Users/kramer65/repos/mmj/node_modules/generic-pool/lib/ResourceRequest.js:8:15)
    at ontimeout (timers.js:386:11)
    at tryOnTimeout (timers.js:250:5)
    at Timer.listOnTimeout (timers.js:214:5)

Since I do many different websocket calls I now wonder for which call this error occurs. I tried wrapping the ws.send() in a try/catch as I pasted below, but that doesn't seem to do anything.

try {
    ws.send(request_json);
} catch(e) {
    console.log('WEBSOCKET ERROR', e);
    console.log('WEBSOCKET JSON', request_json);
}

Does anybody know how I can catch the TimeoutError and log the request contents? All tips are welcome!

[EDIT]
As suggested by @Mark_M I added a callback to the ws.send() method as follows:

ws.send(JSON.stringify(request_obj)), (error)=>{
    console.log('WEBSOCKET ERROR', request_obj.action, error);
});

Unfortunately I still get the same errors as I posted on the top of this question.

[EDIT2]
I also tried the suggestion made by @wrangler:

ws.send(JSON.stringify(request_obj));
ws.onerror = function(event) {
    console.log('WEBSOCKET ONERROR', request_obj.action, event);
};
ws.onclose = function (event){
    console.log('WEBSOCKET ONCLOSE', request_obj.action, event);
};

but unfortunately this also doesn't seem to work. I still get the same errors as I posted on the top of this question.

Any other ideas?


问:
JSON stub string delivered via php
I would like to make a web service stub where I can test my client. I have written down
some JSON like this:

```<code>{
    "response": {
        "success": true,
        "meta" : "tags",
        "data": [
            {
                "first_name" : "John",
                "last_name" : "Doe",
                "age" : 30
            },
            {
                "first_name" : "Jane",
                "last_name" : "Doe",
                "age" : 25
            }
        ]
    }
}
</code>```

I have no PHP experience to talk about.
How can I make a

webserver.com/get_names.php?first_name=john&last_name=doe&age=30

script that returns the above JSON.

It should not do any evaluation on the parameters, that is just how it will end up being called when implemented against a server, I would just like it to return the JSON string correctly so my JSON parser can run through it as if it was the actual server response.

Hope someone can help me out, thank you in advance.

答:
Save the JSON string as-is and call the file get_names.php. Don't forget to pick UTF-8 in your editor's save as dialogue. Nothing will be parsed as PHP if there isn't a single <?php string in the file.

You may also want to put this on top of the file:

```<code><?php
header('Content-Type: application/json');
?>
</code>```

ContentLicense: CC BY-SA 2.5

Title: JSON stub string delivered via php

Body:
I would like to make a web service stub where I can test my client. I have written down
some JSON like this:

{
    "response": {
        "success": true,
        "meta" : "tags",
        "data": [
            {
                "first_name" : "John",
                "last_name" : "Doe",
                "age" : 30
            },
            {
                "first_name" : "Jane",
                "last_name" : "Doe",
                "age" : 25
            }
        ]
    }
}

I have no PHP experience to talk about.
How can I make a

webserver.com/get_names.php?first_name=john&last_name=doe&age=30

script that returns the above JSON.

It should not do any evaluation on the parameters, that is just how it will end up being called when implemented against a server, I would just like it to return the JSON string correctly so my JSON parser can run through it as if it was the actual server response.

Hope someone can help me out, thank you in advance.

Body:
Save the JSON string as-is and call the file get_names.php. Don't forget to pick UTF-8 in your editor's save as dialogue. Nothing will be parsed as PHP if there isn't a single <?php string in the file.

You may also want to put this on top of the file:

<?php
header('Content-Type: application/json');
?>


问:
catch IndexOutOfBoundsException Exception
I'm trying to catch made up IndexOutOfBoundsException  error in catch block. But every time its returning -1 and not going into catch block

May I know please why its happening ? I want to reach to catch block.

```<code>  public class Mars {

    public int Setname(String Input) {

        int output = 0;

        try {
            output = Input.indexOf("L");
            System.out.println("Error:" + Input.indexOf("L"));

            if (output == -1){

                throw new IndexOutOfBoundsException();
            }

        }

        catch (IndexOutOfBoundsException e) {

            System.out.println("Error:2" + e.getStackTrace());
        }

        return output;

    }

    public static void main(String[] args) {

        Mars O = new Mars();
        O.Setname("London");

    }

}
</code>```

Second thing is: When we write IndexOutOfBoundsException e in catch block, its creating an instance of IndexOutOfBoundsException class ?Am I right ?

So why we can't write like in below manner ? It could be a really silly question, but just for curiosity I want to know.

```<code>catch(IndexOutOfBoundsException e = new IndexOutOfBoundsException())
</code>```

答:
The indexOf() method of String returns the index within this string of the first occurrence of the specified character or -1, if the character does not occur. In your case, your character does not occur, that's why you are getting -1.

So what you should do is to force that exception like this:

```<code>if(output == -1){
    throw new IndexOutOfBoundsException()
}
</code>```

Body:
I'm trying to catch made up IndexOutOfBoundsException  error in catch block. But every time its returning -1 and not going into catch block

May I know please why its happening ? I want to reach to catch block.

  public class Mars {

    public int Setname(String Input) {

        int output = 0;

        try {
            output = Input.indexOf("L");
            System.out.println("Error:" + Input.indexOf("L"));

            if (output == -1){

                throw new IndexOutOfBoundsException();
            }

        }

        catch (IndexOutOfBoundsException e) {

            System.out.println("Error:2" + e.getStackTrace());
        }

        return output;

    }

    public static void main(String[] args) {

        Mars O = new Mars();
        O.Setname("London");

    }

}

Second thing is: When we write IndexOutOfBoundsException e in catch block, its creating an instance of IndexOutOfBoundsException class ?Am I right ?

So why we can't write like in below manner ? It could be a really silly question, but just for curiosity I want to know.

catch(IndexOutOfBoundsException e = new IndexOutOfBoundsException())

Body:
The indexOf() method of String returns the index within this string of the first occurrence of the specified character or -1, if the character does not occur. In your case, your character does not occur, that's why you are getting -1.

So what you should do is to force that exception like this:

if(output == -1){
    throw new IndexOutOfBoundsException()
}


问:
how to filter hashmap and find 1st occurance
i have converted my hashmap to json as i dont know what itt looks like in java

so my hashmap looks like

```<code>{"1":[true,false],
"2":[true,true],
"3":[true]}
</code>```

i need to get the first occurance of all true in the array list in a single key

in this case its 2 is the 1st occurance

so if there is an occurance   ///do something   else //do somethig else

```<code>   hm.forEach((key, value) -> {

            for (Object object : value) {

                   boolean b = (boolean)object;
                   if(!b){
                   break;
                    }else{
                       System.out.println(key+"->"+b);
                   }

            }
});
</code>```

i tried something like this but im getting lost in the mix  here its testing alotall the cases

any help would be greatly appreciated

答:
Clearly you need a filter to check for an all-true boolean array, a findFirst to find the first one and a get to handle the fact that findFirst returns an Optional.

```<code>public void test(String[] args) {
    Map<String, Boolean[]> hm = new HashMap<>();
    hm.put("1", new Boolean[]{true, false});
    hm.put("2", new Boolean[]{true, true});
    hm.put("3", new Boolean[]{true});
    Map.Entry<String, Boolean[]> first = hm.entrySet().stream()
            .filter(es -> allTrue(es.getValue()))
            .findFirst()
            .orElse(null);
    System.out.println(first.getKey()+" -> "+ Arrays.toString(first.getValue()));
}

private boolean allTrue(Boolean[] a) {
    for (Boolean b : a) {
        if (!b) return false;
    }
    return true;
}
</code>```

prints

2 -> [true, true]

BTW: The order of iteration of a Map is not defined so you are relying on undocumented features by trying to capture the first one.

Body:
i have converted my hashmap to json as i dont know what itt looks like in java

so my hashmap looks like

{"1":[true,false],
"2":[true,true],
"3":[true]}

i need to get the first occurance of all true in the array list in a single key

in this case its 2 is the 1st occurance

so if there is an occurance   ///do something   else //do somethig else

   hm.forEach((key, value) -> {

            for (Object object : value) {

                   boolean b = (boolean)object;
                   if(!b){
                   break;
                    }else{
                       System.out.println(key+"->"+b);
                   }

            }
});

i tried something like this but im getting lost in the mix  here its testing alotall the cases

any help would be greatly appreciated

Body:
Clearly you need a filter to check for an all-true boolean array, a findFirst to find the first one and a get to handle the fact that findFirst returns an Optional.

public void test(String[] args) {
    Map<String, Boolean[]> hm = new HashMap<>();
    hm.put("1", new Boolean[]{true, false});
    hm.put("2", new Boolean[]{true, true});
    hm.put("3", new Boolean[]{true});
    Map.Entry<String, Boolean[]> first = hm.entrySet().stream()
            .filter(es -> allTrue(es.getValue()))
            .findFirst()
            .orElse(null);
    System.out.println(first.getKey()+" -> "+ Arrays.toString(first.getValue()));
}

private boolean allTrue(Boolean[] a) {
    for (Boolean b : a) {
        if (!b) return false;
    }
    return true;
}

prints

2 -> [true, true]

BTW: The order of iteration of a Map is not defined so you are relying on undocumented features by trying to capture the first one.


问:
Doctrine schema:update generates the same SQL again and again
Running bin/console doctrine:schema:update --force again and again, it always output 39 queries executed even after clearing cache/restarting php-fpm. So it always execute the same SQL requests again and again...

The SQL looks likes (from --dump-sql)

```<code>ALTER TABLE apply_queue CHANGE cv_id cv_id INT DEFAULT NULL, CHANGE team_id team_id INT DEFAULT NULL;
....
</code>```

And a lot of lines similar to this.

The ApplyQueue class look like:

```<code>/**
 * AppBundle\Entity\ApplyQueue.
 *
 * @ORM\Entity(repositoryClass="AppBundle\Entity\ApplyQueueRepository")
 * @ORM\Table(name="apply_queue")
 */
class ApplyQueue
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Cv")
     * @ORM\JoinColumn(name="cv_id", referencedColumnName="id", onDelete="CASCADE")
     */
    protected $cv;

    /**
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Team")
     * @ORM\JoinColumn(name="team_id", referencedColumnName="id", onDelete="CASCADE")
     */
    protected $team;

    ...
</code>```

}

DBAL config :

```<code>doctrine:
    dbal:
        driver:   "%database_driver%"
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset: utf8mb4
        default_table_options:
            charset: utf8mb4
            collate: utf8mb4_unicode_ci
        types:
            json: Sonata\Doctrine\Types\JsonType
            review_status: AppBundle\Model\Enum\ReviewStatusEnumType
        mapping_types:
            review_status: string
</code>```

The structure of the table:

This is an "old" project that has been upgraded to Symfony 3.4 and MariaDB 10.2.

Thanks

答:
check your database table type - i had a problem where the database type didnt support the feature doctrine trying to set.

Maybe run the sql on the database server and see if it 'works' / changes anything, then re-run

Body:
Running bin/console doctrine:schema:update --force again and again, it always output 39 queries executed even after clearing cache/restarting php-fpm. So it always execute the same SQL requests again and again...

The SQL looks likes (from --dump-sql)

ALTER TABLE apply_queue CHANGE cv_id cv_id INT DEFAULT NULL, CHANGE team_id team_id INT DEFAULT NULL;
....

And a lot of lines similar to this.

The ApplyQueue class look like:

/**
 * AppBundle\Entity\ApplyQueue.
 *
 * @ORM\Entity(repositoryClass="AppBundle\Entity\ApplyQueueRepository")
 * @ORM\Table(name="apply_queue")
 */
class ApplyQueue
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Cv")
     * @ORM\JoinColumn(name="cv_id", referencedColumnName="id", onDelete="CASCADE")
     */
    protected $cv;

    /**
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Team")
     * @ORM\JoinColumn(name="team_id", referencedColumnName="id", onDelete="CASCADE")
     */
    protected $team;

    ...

}

DBAL config :

doctrine:
    dbal:
        driver:   "%database_driver%"
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset: utf8mb4
        default_table_options:
            charset: utf8mb4
            collate: utf8mb4_unicode_ci
        types:
            json: Sonata\Doctrine\Types\JsonType
            review_status: AppBundle\Model\Enum\ReviewStatusEnumType
        mapping_types:
            review_status: string

The structure of the table:

This is an "old" project that has been upgraded to Symfony 3.4 and MariaDB 10.2.

Thanks


问:
Excel Browsing a folder and Automating Data Entry into a default template
I been reading up codes available on the net from various sources and have debug with self-taught programming to make it work but I'm having difficulty proceeding on.

As you can see, it comes from a source. Browsing a folder & reading the files works fine with the code, I need to copy values from this folder & paste it into the default template as assigned in the code & save the file with with a default format and alongside values from a cell(O1) & (O11) assign in the code.

As you can see, is not saved as xlsx and neither is it saving with the values from cell specified.

Next, automating data entry to assigned field. Only first 3 files are able to copy exactly what I want. The rest inputs wrong data, as shown in the image below. Additionally, I also need to copy values from cell N15:O83 read from files in  folder, into template Column AA & AB starting from row 6 respectively.

Thanks in advance for any assistance provided.

Sample Source File

Correct Automation

Wrong Automation

Macro Code

```<code>Sub LoopAllExcelFilesInFolder()
'PURPOSE: To loop through all Excel files in a user specified folder and             perform a set task on them
'SOURCE: www.TheSpreadsheetGuru.com

Dim wb As Workbook
Dim myPath As String
Dim myFile As String
Dim myExtension As String
Dim FldrPicker As FileDialog
Dim InstID As String
Dim InstDate As Date
Dim InstBR As String

'Optimize Macro Speed
  Application.ScreenUpdating = False
  Application.EnableEvents = False
  Application.Calculation = xlCalculationManual

'Retrieve Target Folder Path From User
  Set FldrPicker = Application.FileDialog(msoFileDialogFolderPicker)

With FldrPicker
  .Title = "Select A Target Folder"
  .AllowMultiSelect = False
    If .Show <> -1 Then GoTo NextCode
    myPath = .SelectedItems(1) & "\"
End With

'In Case of Cancel
NextCode:
  myPath = myPath
  If myPath = "" Then GoTo ResetSettings

    'Target File Extension (must include wildcard "*")
  myExtension = "*.xls*"

  'Target Path with Ending Extention
  myFile = Dir(myPath & myExtension)

'Loop through each Excel file in folder
  Do While myFile <> ""
'Set variable equal to opened workbook
  Set wb = Workbooks.Open(Filename:=myPath & myFile)

'Ensure Workbook has opened before moving on to next line of code
  DoEvents

'Input Code Here

  InstID = Range("O1")
  InstDate = Range("O11")
  InstBR = "Base Reading"

  wb.Worksheets(1).Range("B15:E83").Copy
  Workbooks.Add template:="C:\Users\PC1\Desktop\Daily data file\Inc\TestTemplate.xlsx"
  Sheets(ActiveSheet.Index + 1).Activate
  If Err.Number <> 0 Then Sheets(1).Activate
  Range("M6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

    Range("E6:F76") = InstID
    Range("K6:K76") = InstDate
    Range("J6") = InstBR

ChDir ("C:\Users\PC\Desktop\Daily data file\Inc\INC22001 - Copy\Test Save") ' Directory you need to save the file as xlsm
Filename = ("Test_Data_ ") & Range("O1").Value & ";" &     Range("O11").Value
ActiveWorkbook.SaveAs Filename:=Filename, FileFormat:=xlOpenXMLWorkbook

'Save and Close Workbook
  wb.Close SaveChanges:=True

'Ensure Workbook has closed before moving on to next line of code
  DoEvents

'Get next file name
  myFile = Dir
  Loop

'Message Box when tasks are completed
  MsgBox "Task Complete!"

ResetSettings:
  'Reset Macro Optimization Settings
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

End Sub
</code>```

答:
This looks problematic

```<code>Filename = ("Test_Data_ ") & Range("O1").Value & ";" &     Range("O11").Value
ActiveWorkbook.SaveAs Filename:=Filename, FileFormat:=xlOpenXMLWorkbook
</code>```

you need to add

```<code>& ".xlsx"
</code>```

to the end of the top line to correctly form the workbook filename.

Body:
I been reading up codes available on the net from various sources and have debug with self-taught programming to make it work but I'm having difficulty proceeding on.

As you can see, it comes from a source. Browsing a folder & reading the files works fine with the code, I need to copy values from this folder & paste it into the default template as assigned in the code & save the file with with a default format and alongside values from a cell(O1) & (O11) assign in the code.

As you can see, is not saved as xlsx and neither is it saving with the values from cell specified.

Next, automating data entry to assigned field. Only first 3 files are able to copy exactly what I want. The rest inputs wrong data, as shown in the image below. Additionally, I also need to copy values from cell N15:O83 read from files in  folder, into template Column AA & AB starting from row 6 respectively.

Thanks in advance for any assistance provided.

Sample Source File

Correct Automation

Wrong Automation

Macro Code

Sub LoopAllExcelFilesInFolder()
'PURPOSE: To loop through all Excel files in a user specified folder and             perform a set task on them
'SOURCE: www.TheSpreadsheetGuru.com

Dim wb As Workbook
Dim myPath As String
Dim myFile As String
Dim myExtension As String
Dim FldrPicker As FileDialog
Dim InstID As String
Dim InstDate As Date
Dim InstBR As String

'Optimize Macro Speed
  Application.ScreenUpdating = False
  Application.EnableEvents = False
  Application.Calculation = xlCalculationManual

'Retrieve Target Folder Path From User
  Set FldrPicker = Application.FileDialog(msoFileDialogFolderPicker)

With FldrPicker
  .Title = "Select A Target Folder"
  .AllowMultiSelect = False
    If .Show <> -1 Then GoTo NextCode
    myPath = .SelectedItems(1) & "\"
End With

'In Case of Cancel
NextCode:
  myPath = myPath
  If myPath = "" Then GoTo ResetSettings

    'Target File Extension (must include wildcard "*")
  myExtension = "*.xls*"

  'Target Path with Ending Extention
  myFile = Dir(myPath & myExtension)

'Loop through each Excel file in folder
  Do While myFile <> ""
'Set variable equal to opened workbook
  Set wb = Workbooks.Open(Filename:=myPath & myFile)

'Ensure Workbook has opened before moving on to next line of code
  DoEvents

'Input Code Here

  InstID = Range("O1")
  InstDate = Range("O11")
  InstBR = "Base Reading"

  wb.Worksheets(1).Range("B15:E83").Copy
  Workbooks.Add template:="C:\Users\PC1\Desktop\Daily data file\Inc\TestTemplate.xlsx"
  Sheets(ActiveSheet.Index + 1).Activate
  If Err.Number <> 0 Then Sheets(1).Activate
  Range("M6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

    Range("E6:F76") = InstID
    Range("K6:K76") = InstDate
    Range("J6") = InstBR

ChDir ("C:\Users\PC\Desktop\Daily data file\Inc\INC22001 - Copy\Test Save") ' Directory you need to save the file as xlsm
Filename = ("Test_Data_ ") & Range("O1").Value & ";" &     Range("O11").Value
ActiveWorkbook.SaveAs Filename:=Filename, FileFormat:=xlOpenXMLWorkbook

'Save and Close Workbook
  wb.Close SaveChanges:=True

'Ensure Workbook has closed before moving on to next line of code
  DoEvents

'Get next file name
  myFile = Dir
  Loop

'Message Box when tasks are completed
  MsgBox "Task Complete!"

ResetSettings:
  'Reset Macro Optimization Settings
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

End Sub

Body:
This looks problematic

Filename = ("Test_Data_ ") & Range("O1").Value & ";" &     Range("O11").Value
ActiveWorkbook.SaveAs Filename:=Filename, FileFormat:=xlOpenXMLWorkbook

you need to add

& ".xlsx"

to the end of the top line to correctly form the workbook filename.


问:
Convert dynamic rows to columns with sql select (Mysql Server)?
I have a table "Organisation" :

And table when we find the other setting of organisation "setting" (is not fixed):

And the last table is "setting_value"  where we found the value of the 3 organisation :

I need to create a view to give me this result

```<code>IdOrganisation | LibelleOrganisation | DateCreation | DateModification | Mail | Tel | Pays | Code Postal | Ville | Adresse | Logo | Secteur

62 | Prevealys | 2016-10-11 10:40:24| 2016-10-11 10:40:24 | mail@gmail.com  | 002122222222 | NULL | NULL | NULL | NULL | NULL | NULL

68 | Solutions Conduite d'activité | 2016-11-01 15:06:32 | 2016-11-01 15:06:32 | NULL | NULL | Tunisie | NULL | NULL | Borj Baccouche Ariana | NULL | NULL
</code>```

Thx,

答: What have you tried? You may want to take a look to the PIVOT operator.

Body:
I have a table "Organisation" :

And table when we find the other setting of organisation "setting" (is not fixed):

And the last table is "setting_value"  where we found the value of the 3 organisation :

I need to create a view to give me this result

IdOrganisation | LibelleOrganisation | DateCreation | DateModification | Mail | Tel | Pays | Code Postal | Ville | Adresse | Logo | Secteur

62 | Prevealys | 2016-10-11 10:40:24| 2016-10-11 10:40:24 | mail@gmail.com  | 002122222222 | NULL | NULL | NULL | NULL | NULL | NULL

68 | Solutions Conduite d'activité | 2016-11-01 15:06:32 | 2016-11-01 15:06:32 | NULL | NULL | Tunisie | NULL | NULL | Borj Baccouche Ariana | NULL | NULL

Thx,


问:
look for match from a different array in ruby
I have a base array like this

```<code>base_array=[0,3,5]
</code>```

There is a

```<code>second_array=[4,5,6,0,5,4]
</code>```

What I want is create a new array from second_array but filter out the values missing in base_array

So new array will look like this

```<code>new_array=[5,0,5]
</code>```

How can I do this in ruby?
Thank you.

答:
If you just want the values and don't care about number of occurences you could use the intersection:

```<code>base_array & second_array
=> [0, 5]
</code>```

Otherwise just select them like this:

```<code>second_array.select { |v| base_array.include?(v) }
=> [5, 0, 5]
</code>```

Body:
I have a base array like this

base_array=[0,3,5]

There is a

second_array=[4,5,6,0,5,4]

What I want is create a new array from second_array but filter out the values missing in base_array

So new array will look like this

new_array=[5,0,5]

How can I do this in ruby?
Thank you.

Body:
If you just want the values and don't care about number of occurences you could use the intersection:

base_array & second_array
=> [0, 5]

Otherwise just select them like this:

second_array.select { |v| base_array.include?(v) }
=> [5, 0, 5]


问:
ssl.wrap_socket alert SSLV3_ALERT_HANDSHAKE_FAILURE
I'm trying to establish a secure socket connection in Python, but i had a handshake failure.This is what i've been trying:

```<code>import socket
import ssl

# CREATE SOCKET
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# WRAP SOCKET
wrappedSock = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_SSLv23, ciphers="ADH-AES256-SHA")

# CONNECT AND PRINT REPLY
wrappedSock.connect(('www.google.com.hk', 443))
wrappedSock.send('''GET / HTTP/1.1
Host: www.google.com.hk
Connection: close
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7
''')

buf = wrappedSock.recv(1024)
while len(buf):
    print buf
    buf = wrappedSock.recv(1024)
</code>```

Alert error is:

```<code>Traceback (most recent call last):
  File "C:/Users/Administrator/Desktop/test.py", line 8, in <module>
    wrappedSock.connect(('www.google.com.hk', 443))
  File "C:\Python27\lib\ssl.py", line 876, in connect
    self._real_connect(addr, False)
  File "C:\Python27\lib\ssl.py", line 867, in _real_connect
    self.do_handshake()
  File "C:\Python27\lib\ssl.py", line 840, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:661)
</code>```

My environment is:

```<code>Python 2.7.13
pyOpenSSL (16.2.0)
ndg-httpsclient (0.4.3)
pyasn1 (0.2.2)
pyasn1-modules (0.0.8)
</code>```

I also tried "ssl_version=ssl.PROTOCOL_TLSv1" and it had the same error. Hope somebody can help.

答:
```<code>wrappedSock = ssl.wrap_socket(... ciphers="ADH-AES256-SHA")
...
wrappedSock.connect(('www.google.com.hk', 443))
</code>```

The server you are trying to access does not support the cipher you are specifying. Almost no server is supporting ADH ciphers since these don't authenticate the server and are thus open for easy man in the middle attacks.

It is unclear why you are trying to use specifically this cipher. But I recommend that you simply skip the ciphers argument so that it will use the default ciphers.

Body:
I'm trying to establish a secure socket connection in Python, but i had a handshake failure.This is what i've been trying:

import socket
import ssl

# CREATE SOCKET
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# WRAP SOCKET
wrappedSock = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_SSLv23, ciphers="ADH-AES256-SHA")

# CONNECT AND PRINT REPLY
wrappedSock.connect(('www.google.com.hk', 443))
wrappedSock.send('''GET / HTTP/1.1
Host: www.google.com.hk
Connection: close
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7
''')

buf = wrappedSock.recv(1024)
while len(buf):
    print buf
    buf = wrappedSock.recv(1024)

Alert error is:

Traceback (most recent call last):
  File "C:/Users/Administrator/Desktop/test.py", line 8, in <module>
    wrappedSock.connect(('www.google.com.hk', 443))
  File "C:\Python27\lib\ssl.py", line 876, in connect
    self._real_connect(addr, False)
  File "C:\Python27\lib\ssl.py", line 867, in _real_connect
    self.do_handshake()
  File "C:\Python27\lib\ssl.py", line 840, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:661)

My environment is:

Python 2.7.13
pyOpenSSL (16.2.0)
ndg-httpsclient (0.4.3)
pyasn1 (0.2.2)
pyasn1-modules (0.0.8)

I also tried "ssl_version=ssl.PROTOCOL_TLSv1" and it had the same error. Hope somebody can help.

Body:
wrappedSock = ssl.wrap_socket(... ciphers="ADH-AES256-SHA")
...
wrappedSock.connect(('www.google.com.hk', 443))

The server you are trying to access does not support the cipher you are specifying. Almost no server is supporting ADH ciphers since these don't authenticate the server and are thus open for easy man in the middle attacks.

It is unclear why you are trying to use specifically this cipher. But I recommend that you simply skip the ciphers argument so that it will use the default ciphers.


问:
Integration of D3 chart with Angular 4
I am using D3 charting library to create parallel coordinates visualization  chart in my Angular 4 application and i have already installed npm package of D3 in my application. D3 version is 4 Following is what I am trying.

```<code>import { Component, OnInit,ViewEncapsulation } from '@angular/core';
import * as d3 from 'd3';
import * as scale from 'd3-scale';

@Component({
    moduleId: module.id,
    selector: 'app-pcp',
    template:`<div class="col s12" id='test'></div>`,
  styleUrls: ['./pcpstyle.css'],
  encapsulation: ViewEncapsulation.None

})
export class PCPComponent implements OnInit {
//dimensions:any;
private dimensions: Array<string>;
//private d:any;

  constructor() { }

  ngOnInit() {
    this.drawChart();
  }

 drawChart() {
  var m = [100, 10, 10, 60],
  w = 1000 - m[1] - m[3],
  h = 300 - m[0] - m[2];

//var x = d3.scalePoint().range([0, w]).padding(.1),
var x= d3.scaleBand().rangeRound([0, w]),
  y = {},
  dragging = {};

var line = d3.line(),
  background,
  foreground;

var svg = d3.select("#test").append("svg:svg")
  .attr("width", w + m[1] + m[3])
  .attr("height", h + m[0] + m[2])
  .append("svg:g")
  .attr("transform", "translate(" + m[3] + "," + m[0] + ")");

var data = [{

  "A": 200,
        "B": 3000,
        "C": 2300,
        "D": 4320,
        "E": 1230,
        "F": 7400,
        "G": 1431,
        "H": 1400,
        "I": 4300,
        "J": 6750
}, {

 "A": 1002,
        "B": 2003,
        "C": 2773,
        "D": 3432,
        "E": 1673,
        "F": 740,
        "G": 1231,
        "H": 1900,
        "I": 3000,
        "J": 675
}];

// Extract the list of dimensions and create a scale for each.
x.domain(this.dimensions = d3.keys(data[0]).filter(function(d) {
  if (d === "name") return false;
  if (d === "Plant" || d === "Chemical" || d === "Pathway" || d === "Gene" || d === "Disease") {
    y[d] = d3.scaleOrdinal()
      .domain(data.map(function(p) {
        return p[d];
      }))
      .range([h, 0]);
  } else {
    y[d] = d3.scaleLinear()
      .domain(d3.extent(data, function(p) {
        return +p[d];
      }))
      .range([h, 0]);
  }
  return true;
}));

// Add grey background lines for context.
background = svg.append("svg:g")
  .attr("class", "background")
  .selectAll("path")
  .data(data)
  .enter().append("svg:path")
  .attr("d", path);

// Add blue foreground lines for focus.
foreground = svg.append("svg:g")
  .attr("class", "foreground")
  .selectAll("path")
  .data(data)
  .enter().append("svg:path")
  .attr("d", path);

// Add a group element for each dimension.
var g = svg.selectAll(".dimension")
  .data(this.dimensions)
  .enter().append("svg:g")
  .attr("class", "dimension")
  .attr("transform", function(d) {
    return "translate(" + x(d) + ")";
  })

// Add an axis and title.
g.append("svg:g")
  .attr("class", "axis")
  .each(function(d) {
    d3.select(this).call(d3.axisLeft(y[d]));
  })
  .append("svg:text")
  .attr("text-anchor", "middle")
  .attr("y", -50)
  .attr("x",-10)
  .text(String);

function position(d) {
  var v = dragging[d];
  return v == null ? x(d) : v;
}

function transition(g) {
  return g.transition().duration(500);
}

// Returns the path for a given data point.
function path(d) {
  return line(this.dimensions.map(function(p) {
    return [position(p), y[p](d[p])];
  }));
}
    }
}
</code>```

After the integration of this i am getting below mentioned error:

ERROR TypeError: Cannot read property 'map' of undefined

What needs to be changed so this could work properly?

答:
the culprit for this is path(d) method  And calling it inside the attr() method:

```<code>.attr("d", path);
</code>```

Solution

```<code>.attr("d", path.bind(this));
</code>```

Title: Integration of D3 chart with Angular 4

Body:
I am using D3 charting library to create parallel coordinates visualization  chart in my Angular 4 application and i have already installed npm package of D3 in my application. D3 version is 4 Following is what I am trying.

import { Component, OnInit,ViewEncapsulation } from '@angular/core';
import * as d3 from 'd3';
import * as scale from 'd3-scale';

@Component({
    moduleId: module.id,
    selector: 'app-pcp',
    template:`<div class="col s12" id='test'></div>`,
  styleUrls: ['./pcpstyle.css'],
  encapsulation: ViewEncapsulation.None

})
export class PCPComponent implements OnInit {
//dimensions:any;
private dimensions: Array<string>;
//private d:any;

  constructor() { }

  ngOnInit() {
    this.drawChart();
  }

 drawChart() {
  var m = [100, 10, 10, 60],
  w = 1000 - m[1] - m[3],
  h = 300 - m[0] - m[2];

//var x = d3.scalePoint().range([0, w]).padding(.1),
var x= d3.scaleBand().rangeRound([0, w]),
  y = {},
  dragging = {};

var line = d3.line(),
  background,
  foreground;

var svg = d3.select("#test").append("svg:svg")
  .attr("width", w + m[1] + m[3])
  .attr("height", h + m[0] + m[2])
  .append("svg:g")
  .attr("transform", "translate(" + m[3] + "," + m[0] + ")");

var data = [{

  "A": 200,
        "B": 3000,
        "C": 2300,
        "D": 4320,
        "E": 1230,
        "F": 7400,
        "G": 1431,
        "H": 1400,
        "I": 4300,
        "J": 6750
}, {

 "A": 1002,
        "B": 2003,
        "C": 2773,
        "D": 3432,
        "E": 1673,
        "F": 740,
        "G": 1231,
        "H": 1900,
        "I": 3000,
        "J": 675
}];

// Extract the list of dimensions and create a scale for each.
x.domain(this.dimensions = d3.keys(data[0]).filter(function(d) {
  if (d === "name") return false;
  if (d === "Plant" || d === "Chemical" || d === "Pathway" || d === "Gene" || d === "Disease") {
    y[d] = d3.scaleOrdinal()
      .domain(data.map(function(p) {
        return p[d];
      }))
      .range([h, 0]);
  } else {
    y[d] = d3.scaleLinear()
      .domain(d3.extent(data, function(p) {
        return +p[d];
      }))
      .range([h, 0]);
  }
  return true;
}));

// Add grey background lines for context.
background = svg.append("svg:g")
  .attr("class", "background")
  .selectAll("path")
  .data(data)
  .enter().append("svg:path")
  .attr("d", path);

// Add blue foreground lines for focus.
foreground = svg.append("svg:g")
  .attr("class", "foreground")
  .selectAll("path")
  .data(data)
  .enter().append("svg:path")
  .attr("d", path);

// Add a group element for each dimension.
var g = svg.selectAll(".dimension")
  .data(this.dimensions)
  .enter().append("svg:g")
  .attr("class", "dimension")
  .attr("transform", function(d) {
    return "translate(" + x(d) + ")";
  })

// Add an axis and title.
g.append("svg:g")
  .attr("class", "axis")
  .each(function(d) {
    d3.select(this).call(d3.axisLeft(y[d]));
  })
  .append("svg:text")
  .attr("text-anchor", "middle")
  .attr("y", -50)
  .attr("x",-10)
  .text(String);

function position(d) {
  var v = dragging[d];
  return v == null ? x(d) : v;
}

function transition(g) {
  return g.transition().duration(500);
}

// Returns the path for a given data point.
function path(d) {
  return line(this.dimensions.map(function(p) {
    return [position(p), y[p](d[p])];
  }));
}
    }
}

After the integration of this i am getting below mentioned error:

ERROR TypeError: Cannot read property 'map' of undefined

What needs to be changed so this could work properly?

Body:
the culprit for this is path(d) method  And calling it inside the attr() method:

.attr("d", path);

Solution

.attr("d", path.bind(this));


问:
No provider for HttpClient
After upgrading from angular 4.4 to 5.0 and after updating all HttpModule and Http to HttpClientModule I started to get this error.

I also added HttpModule again to be sure it's not due to some dependency but it doesn't resolve the issue

In app.module, I have all correctly set

import { HttpModule } from '@angular/http';
import { HttpClientModule, HttpClient } from '@angular/common/http';
.
.
.
@NgModule({
    imports: [
        BrowserModule,
        HttpClientModule,
        HttpModule,
        BrowserAnimationsModule,
        FormsModule,
        AppRoutingModule,
.
.
.
```

<p>I don't know from where this error is coming, or I have no clue how to get inner of it. I also have a warning (put it below too) maybe its related.</p>

```Error: StaticInjectorError[HttpClient]:
  StaticInjectorError[HttpClient]:
    NullInjectorError: No provider for HttpClient!
    at _NullInjector.get (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5665)
    at resolveToken (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5953)
    at tryResolveToken (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5895)
    at StaticInjector.get (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5766)
    at resolveToken (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5953)
    at tryResolveToken (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5895)
    at StaticInjector.get (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5766)
    at resolveNgModuleDep (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:15328)
    at _createClass (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:15373)
    at _createProviderInstance$1 (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:15339)
```

<p>Warning Message:</p>

```./node_modules/@angular/Common/esm5/http.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* D:\XXX\node_modules\@angular\Common\esm5\http.js
    Used by 21 module(s), i. e.
    D:\XXX\node_modules\awesome-typescript-loader\dist\entry.js?silent=true!D:\XXX\node_modules\angular2-template-loader\index.js!D:\XXX\ClientApp\app\services\notification-endpoint.service.ts
* D:\XXX\node_modules\@angular\common\esm5\http.js
    Used by 1 module(s), i. e.
    D:\XXX\node_modules\awesome-typescript-loader\dist\entry.js?silent=true!D:\XXX\node_modules\angular2-template-loader\index.js!D:\XXX\ClientApp\app\app.module.ts
 @ ./node_modules/@angular/Common/esm5/http.js
 @ ./ClientApp/app/services/notification-endpoint.service.ts
 @ ./ClientApp/app/app.module.ts
 @ ./ClientApp/boot.browser.ts
 @ multi event-source-polyfill webpack-hot-middleware/client?path=__webpack_hmr&dynamicPublicPath=true ./ClientApp/boot.browser.ts
```

<h2>Current behavior</h2>

<p><code>StaticInjectorError[HttpClient]: StaticInjectorError[HttpClient]: NullInjectorError: No provider for HttpClient!
</code></p>

<h2>Environment</h2>

```Angular version: 5.0.0 and 5.0.1 (also 5.1 beta)

Browser:
- all

For Tooling issues:
- Node version: 8.5.0
- Platform:  windows
```

<pre class="lang-json prettyprint-override"><code>{
  "name": "X",
  "version": "1.0.0",
  "description": "X",
  "author": {
    "name": "X X",
    "email": "XX",
    "url": "X"
  },
  "homepage": "X",
  "dependencies": {
    "@angular/animations": "^5.1.0-beta.0",
    "@angular/common": "^5.1.0-beta.0",
    "@angular/compiler": "^5.1.0-beta.0",
    "@angular/compiler-cli": "^5.1.0-beta.0",
    "@angular/core": "^5.1.0-beta.0",
    "@angular/forms": "^5.1.0-beta.0",
    "@angular/http": "^5.1.0-beta.0",
    "@angular/platform-browser": "^5.1.0-beta.0",
    "@angular/platform-browser-dynamic": "^5.1.0-beta.0",
    "@angular/platform-server": "^5.1.0-beta.0",
    "@angular/router": "^5.1.0-beta.0",
    "@ngtools/webpack": "^1.8.0",
    "@ngx-translate/core": "^8.0.0",
    "@ngx-translate/http-loader": "^2.0.0",
    "@swimlane/ngx-datatable": "^11.0.3",
    "@types/jquery": "^3.2.16",
    "@types/webpack-env": "^1.13.2",
    "angular2-template-loader": "^0.6.2",
    "aspnet-webpack": "^2.0.1",
    "awesome-typescript-loader": "^3.3.0",
    "bootstrap": "^3.3.7",
    "bootstrap-datepicker": "^1.7.1",
    "bootstrap-select": "^1.12.4",
    "bootstrap-toggle": "^2.2.2",
    "bootstrap-vertical-tabs": "^1.2.2",
    "chart.js": "^2.7.1",
    "core-js": "^2.5.1",
    "css": "^2.2.1",
    "css-loader": "^0.28.7",
    "event-source-polyfill": "^0.0.11",
    "expose-loader": "^0.7.3",
    "extract-text-webpack-plugin": "^3.0.2",
    "file-loader": "^1.1.5",
    "font-awesome": "^4.7.0",
    "html-loader": "^0.5.1",
    "jquery": "^3.2.1",
    "json-loader": "^0.5.7",
    "ng2-charts": "^1.6.0",
    "ng2-toasty": "^4.0.3",
    "ngx-bootstrap": "^2.0.0-beta.8",
    "node-sass": "^4.6.0",
    "popper.js": "^1.12.6",
    "raw-loader": "^0.5.1",
    "rxjs": "^5.5.2",
    "sass-loader": "^6.0.6",
    "style-loader": "^0.19.0",
    "to-string-loader": "^1.1.5",
    "typescript": "^2.6.1",
    "url-loader": "^0.6.2",
    "web-animations-js": "^2.3.1",
    "webpack": "^3.8.1",
    "webpack-hot-middleware": "^2.20.0",
    "webpack-merge": "^4.1.1",
    "zone.js": "^0.8.18"
  },
  "devDependencies": {
    "@types/chai": "^4.0.4",
    "@types/jasmine": "^2.6.3",
    "chai": "^4.1.2",
    "jasmine-core": "^2.8.0",
    "karma": "^1.7.1",
    "karma-chai": "^0.1.0",
    "karma-chrome-launcher": "^2.2.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-webpack": "^2.0.5"
  },
  "scripts": {
    "dev-build": "node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js",
    "test": "karma start ClientApp/test/karma.conf.js"
  }
}
</code>```

webpack.config.js

const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const AotPlugin = require('@ngtools/webpack').AotPlugin;
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;

module.exports = (env) => {
    // Configuration in common to both client-side and server-side bundles
    const isDevBuild = !(env && env.prod);
    const sharedConfig = {
        stats: { modules: false },
        context: __dirname,
        resolve: { extensions: ['.js', '.ts'] },
        output: {
            filename: '[name].js',
            publicPath: 'dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
        },
        module: {
            rules: [
                { test: /\.ts$/, use: isDevBuild ? ['awesome-typescript-loader?silent=true', 'angular2-template-loader'] : '@ngtools/webpack' },
                { test: /\.html$/, use: 'html-loader?minimize=false' },
                { test: /\.css$/, use: ['to-string-loader', isDevBuild ? 'css-loader' : 'css-loader?minimize'] },
                { test: /\.scss$/, use: ['to-string-loader', isDevBuild ? 'css-loader' : 'css-loader?minimize', 'sass-loader'] },
                { test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' }
            ]
        },
        plugins: [new CheckerPlugin()]
    };

    // Configuration for client-side bundle suitable for running in browsers
    const clientBundleOutputDir = './wwwroot/dist';
    const clientBundleConfig = merge(sharedConfig, {
        entry: { 'main-client': './ClientApp/boot.browser.ts' },
        output: { path: path.join(__dirname, clientBundleOutputDir) },
        plugins: [
            new webpack.DllReferencePlugin({
                context: __dirname,
                manifest: require('./wwwroot/dist/vendor-manifest.json')
            })
        ].concat(isDevBuild ? [
            // Plugins that apply in development builds only
            new webpack.SourceMapDevToolPlugin({
                filename: '[file].map', // Remove this line if you prefer inline source maps
                moduleFilenameTemplate: path.relative(clientBundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
            })
        ] : [
                // Plugins that apply in production builds only
                new webpack.optimize.UglifyJsPlugin(),
                new AotPlugin({
                    tsConfigPath: './tsconfig.json',
                    entryModule: path.join(__dirname, 'ClientApp/app/app.module#AppModule')
                })
            ])
    });

    return [clientBundleConfig];
};
```

<p>webpack.config.vendor.js</p>

<pre class="lang-js prettyprint-override"><code>const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const merge = require('webpack-merge');
const treeShakableModules = [
    '@angular/animations',
    '@angular/common',
    '@angular/compiler',
    '@angular/core',
    '@angular/forms',
    '@angular/http',
    '@angular/platform-browser',
    '@angular/platform-browser-dynamic',
    '@angular/router',
    'zone.js',
];
const nonTreeShakableModules = [
    'bootstrap',
    'core-js/client/shim',
    'web-animations-js',
    'event-source-polyfill',
    'jquery',
    '@swimlane/ngx-datatable/release/assets/icons.css',
    'ng2-toasty',
    'ng2-toasty/bundles/style-bootstrap.css',
    'ng2-charts',
    'ngx-bootstrap/modal',
    'ngx-bootstrap/tooltip',
    'ngx-bootstrap/popover',
    'ngx-bootstrap/dropdown',
    'ngx-bootstrap/carousel',
    'bootstrap-vertical-tabs/bootstrap.vertical-tabs.css',
    'bootstrap-toggle/css/bootstrap-toggle.css',
    'bootstrap-toggle/js/bootstrap-toggle.js',
    'bootstrap-select/dist/css/bootstrap-select.css',
    'bootstrap-select/dist/js/bootstrap-select.js',
    'bootstrap-datepicker/dist/css/bootstrap-datepicker3.css',
    'font-awesome/css/font-awesome.css'
];
const allModules = treeShakableModules.concat(nonTreeShakableModules);

module.exports = (env) => {
    const extractCSS = new ExtractTextPlugin('vendor.css');
    const isDevBuild = !(env && env.prod);
    const sharedConfig = {
        stats: { modules: false },
        resolve: { extensions: ['.js'] },
        module: {
            rules: [
                { test: /\.(gif|png|woff|woff2|eot|ttf|svg)(\?|$)/, use: 'url-loader?limit=100000' }
            ]
        },
        output: {
            publicPath: 'dist/',
            filename: '[name].js',
            library: '[name]_[hash]'
        },
        plugins: [
            new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
            new webpack.ContextReplacementPlugin(/\@angular\b.*\b(bundles|linker)/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/11580
            new webpack.ContextReplacementPlugin(/angular(\\|\/)core(\\|\/)@angular/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/14898
            new webpack.IgnorePlugin(/^vertx$/) // Workaround for https://github.com/stefanpenner/es6-promise/issues/100
        ]
    };

    const clientBundleConfig = merge(sharedConfig, {
        entry: {
            // To keep development builds fast, include all vendor dependencies in the vendor bundle.
            // But for production builds, leave the tree-shakable ones out so the AOT compiler can produce a smaller bundle.
            vendor: isDevBuild ? allModules : nonTreeShakableModules
        },
        output: { path: path.join(__dirname, 'wwwroot', 'dist') },
        module: {
            rules: [
                { test: /\.css(\?|$)/, use: extractCSS.extract({ use: isDevBuild ? 'css-loader' : 'css-loader?minimize' }) }
            ]
        },
        plugins: [
            extractCSS,
            new webpack.DllPlugin({
                path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
                name: '[name]_[hash]'
            })
        ].concat(isDevBuild ? [] : [
            new webpack.optimize.UglifyJsPlugin()
        ])
    });

    return [clientBundleConfig];
}
</code>```

答:
You have not provided providers in your module:

import { HttpModule } from '@angular/http';
import { HttpClientModule, HttpClient } from '@angular/common/http';

@NgModule({
  imports: [
    BrowserModule,
    HttpClientModule,
    BrowserAnimationsModule,
    FormsModule,
    AppRoutingModule
  ],
  providers: [ HttpClientModule, ... ]
  // ...
})
export class MyModule { /* ... */ }
```

<h2>Using HttpClient in Tests</h2>

<p>You will need to add the <code>HttpClientTestingModule</code> to the TestBed configuration when running <code>ng test</code> and getting the "No provider for HttpClient" error:</p>

<pre class="lang-js prettyprint-override"><code>// Http testing module and mocking controller
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';

// Other imports
import { TestBed } from '@angular/core/testing';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';

describe('HttpClient testing', () => {
  let httpClient: HttpClient;
  let httpTestingController: HttpTestingController;

  beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [ HttpClientTestingModule ]
    });

    // Inject the http service and test controller for each test
    httpClient = TestBed.get(HttpClient);
    httpTestingController = TestBed.get(HttpTestingController);
  });

  it('works', () => {
  });
});
</code>```

ContentLicense: CC BY-SA 4.0

Title: No provider for HttpClient

Body:
After upgrading from angular 4.4 to 5.0 and after updating all HttpModule and Http to HttpClientModule I started to get this error.

I also added HttpModule again to be sure it's not due to some dependency but it doesn't resolve the issue

In app.module, I have all correctly set

import { HttpModule } from '@angular/http';
import { HttpClientModule, HttpClient } from '@angular/common/http';
.
.
.
@NgModule({
    imports: [
        BrowserModule,
        HttpClientModule,
        HttpModule,
        BrowserAnimationsModule,
        FormsModule,
        AppRoutingModule,
.
.
.

I don't know from where this error is coming, or I have no clue how to get inner of it. I also have a warning (put it below too) maybe its related.

Error: StaticInjectorError[HttpClient]:
  StaticInjectorError[HttpClient]:
    NullInjectorError: No provider for HttpClient!
    at _NullInjector.get (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5665)
    at resolveToken (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5953)
    at tryResolveToken (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5895)
    at StaticInjector.get (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5766)
    at resolveToken (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5953)
    at tryResolveToken (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5895)
    at StaticInjector.get (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5766)
    at resolveNgModuleDep (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:15328)
    at _createClass (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:15373)
    at _createProviderInstance$1 (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:15339)

Warning Message:

./node_modules/@angular/Common/esm5/http.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* D:\XXX\node_modules\@angular\Common\esm5\http.js
    Used by 21 module(s), i. e.
    D:\XXX\node_modules\awesome-typescript-loader\dist\entry.js?silent=true!D:\XXX\node_modules\angular2-template-loader\index.js!D:\XXX\ClientApp\app\services\notification-endpoint.service.ts
* D:\XXX\node_modules\@angular\common\esm5\http.js
    Used by 1 module(s), i. e.
    D:\XXX\node_modules\awesome-typescript-loader\dist\entry.js?silent=true!D:\XXX\node_modules\angular2-template-loader\index.js!D:\XXX\ClientApp\app\app.module.ts
 @ ./node_modules/@angular/Common/esm5/http.js
 @ ./ClientApp/app/services/notification-endpoint.service.ts
 @ ./ClientApp/app/app.module.ts
 @ ./ClientApp/boot.browser.ts
 @ multi event-source-polyfill webpack-hot-middleware/client?path=__webpack_hmr&dynamicPublicPath=true ./ClientApp/boot.browser.ts

Current behavior

StaticInjectorError[HttpClient]: StaticInjectorError[HttpClient]: NullInjectorError: No provider for HttpClient!

Environment

Angular version: 5.0.0 and 5.0.1 (also 5.1 beta)

Browser:
- all

For Tooling issues:
- Node version: 8.5.0
- Platform:  windows

{
  "name": "X",
  "version": "1.0.0",
  "description": "X",
  "author": {
    "name": "X X",
    "email": "XX",
    "url": "X"
  },
  "homepage": "X",
  "dependencies": {
    "@angular/animations": "^5.1.0-beta.0",
    "@angular/common": "^5.1.0-beta.0",
    "@angular/compiler": "^5.1.0-beta.0",
    "@angular/compiler-cli": "^5.1.0-beta.0",
    "@angular/core": "^5.1.0-beta.0",
    "@angular/forms": "^5.1.0-beta.0",
    "@angular/http": "^5.1.0-beta.0",
    "@angular/platform-browser": "^5.1.0-beta.0",
    "@angular/platform-browser-dynamic": "^5.1.0-beta.0",
    "@angular/platform-server": "^5.1.0-beta.0",
    "@angular/router": "^5.1.0-beta.0",
    "@ngtools/webpack": "^1.8.0",
    "@ngx-translate/core": "^8.0.0",
    "@ngx-translate/http-loader": "^2.0.0",
    "@swimlane/ngx-datatable": "^11.0.3",
    "@types/jquery": "^3.2.16",
    "@types/webpack-env": "^1.13.2",
    "angular2-template-loader": "^0.6.2",
    "aspnet-webpack": "^2.0.1",
    "awesome-typescript-loader": "^3.3.0",
    "bootstrap": "^3.3.7",
    "bootstrap-datepicker": "^1.7.1",
    "bootstrap-select": "^1.12.4",
    "bootstrap-toggle": "^2.2.2",
    "bootstrap-vertical-tabs": "^1.2.2",
    "chart.js": "^2.7.1",
    "core-js": "^2.5.1",
    "css": "^2.2.1",
    "css-loader": "^0.28.7",
    "event-source-polyfill": "^0.0.11",
    "expose-loader": "^0.7.3",
    "extract-text-webpack-plugin": "^3.0.2",
    "file-loader": "^1.1.5",
    "font-awesome": "^4.7.0",
    "html-loader": "^0.5.1",
    "jquery": "^3.2.1",
    "json-loader": "^0.5.7",
    "ng2-charts": "^1.6.0",
    "ng2-toasty": "^4.0.3",
    "ngx-bootstrap": "^2.0.0-beta.8",
    "node-sass": "^4.6.0",
    "popper.js": "^1.12.6",
    "raw-loader": "^0.5.1",
    "rxjs": "^5.5.2",
    "sass-loader": "^6.0.6",
    "style-loader": "^0.19.0",
    "to-string-loader": "^1.1.5",
    "typescript": "^2.6.1",
    "url-loader": "^0.6.2",
    "web-animations-js": "^2.3.1",
    "webpack": "^3.8.1",
    "webpack-hot-middleware": "^2.20.0",
    "webpack-merge": "^4.1.1",
    "zone.js": "^0.8.18"
  },
  "devDependencies": {
    "@types/chai": "^4.0.4",
    "@types/jasmine": "^2.6.3",
    "chai": "^4.1.2",
    "jasmine-core": "^2.8.0",
    "karma": "^1.7.1",
    "karma-chai": "^0.1.0",
    "karma-chrome-launcher": "^2.2.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-webpack": "^2.0.5"
  },
  "scripts": {
    "dev-build": "node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js",
    "test": "karma start ClientApp/test/karma.conf.js"
  }
}

webpack.config.js

const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const AotPlugin = require('@ngtools/webpack').AotPlugin;
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;

module.exports = (env) => {
    // Configuration in common to both client-side and server-side bundles
    const isDevBuild = !(env && env.prod);
    const sharedConfig = {
        stats: { modules: false },
        context: __dirname,
        resolve: { extensions: ['.js', '.ts'] },
        output: {
            filename: '[name].js',
            publicPath: 'dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
        },
        module: {
            rules: [
                { test: /\.ts$/, use: isDevBuild ? ['awesome-typescript-loader?silent=true', 'angular2-template-loader'] : '@ngtools/webpack' },
                { test: /\.html$/, use: 'html-loader?minimize=false' },
                { test: /\.css$/, use: ['to-string-loader', isDevBuild ? 'css-loader' : 'css-loader?minimize'] },
                { test: /\.scss$/, use: ['to-string-loader', isDevBuild ? 'css-loader' : 'css-loader?minimize', 'sass-loader'] },
                { test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' }
            ]
        },
        plugins: [new CheckerPlugin()]
    };

    // Configuration for client-side bundle suitable for running in browsers
    const clientBundleOutputDir = './wwwroot/dist';
    const clientBundleConfig = merge(sharedConfig, {
        entry: { 'main-client': './ClientApp/boot.browser.ts' },
        output: { path: path.join(__dirname, clientBundleOutputDir) },
        plugins: [
            new webpack.DllReferencePlugin({
                context: __dirname,
                manifest: require('./wwwroot/dist/vendor-manifest.json')
            })
        ].concat(isDevBuild ? [
            // Plugins that apply in development builds only
            new webpack.SourceMapDevToolPlugin({
                filename: '[file].map', // Remove this line if you prefer inline source maps
                moduleFilenameTemplate: path.relative(clientBundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
            })
        ] : [
                // Plugins that apply in production builds only
                new webpack.optimize.UglifyJsPlugin(),
                new AotPlugin({
                    tsConfigPath: './tsconfig.json',
                    entryModule: path.join(__dirname, 'ClientApp/app/app.module#AppModule')
                })
            ])
    });

    return [clientBundleConfig];
};

webpack.config.vendor.js

const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const merge = require('webpack-merge');
const treeShakableModules = [
    '@angular/animations',
    '@angular/common',
    '@angular/compiler',
    '@angular/core',
    '@angular/forms',
    '@angular/http',
    '@angular/platform-browser',
    '@angular/platform-browser-dynamic',
    '@angular/router',
    'zone.js',
];
const nonTreeShakableModules = [
    'bootstrap',
    'core-js/client/shim',
    'web-animations-js',
    'event-source-polyfill',
    'jquery',
    '@swimlane/ngx-datatable/release/assets/icons.css',
    'ng2-toasty',
    'ng2-toasty/bundles/style-bootstrap.css',
    'ng2-charts',
    'ngx-bootstrap/modal',
    'ngx-bootstrap/tooltip',
    'ngx-bootstrap/popover',
    'ngx-bootstrap/dropdown',
    'ngx-bootstrap/carousel',
    'bootstrap-vertical-tabs/bootstrap.vertical-tabs.css',
    'bootstrap-toggle/css/bootstrap-toggle.css',
    'bootstrap-toggle/js/bootstrap-toggle.js',
    'bootstrap-select/dist/css/bootstrap-select.css',
    'bootstrap-select/dist/js/bootstrap-select.js',
    'bootstrap-datepicker/dist/css/bootstrap-datepicker3.css',
    'font-awesome/css/font-awesome.css'
];
const allModules = treeShakableModules.concat(nonTreeShakableModules);

module.exports = (env) => {
    const extractCSS = new ExtractTextPlugin('vendor.css');
    const isDevBuild = !(env && env.prod);
    const sharedConfig = {
        stats: { modules: false },
        resolve: { extensions: ['.js'] },
        module: {
            rules: [
                { test: /\.(gif|png|woff|woff2|eot|ttf|svg)(\?|$)/, use: 'url-loader?limit=100000' }
            ]
        },
        output: {
            publicPath: 'dist/',
            filename: '[name].js',
            library: '[name]_[hash]'
        },
        plugins: [
            new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
            new webpack.ContextReplacementPlugin(/\@angular\b.*\b(bundles|linker)/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/11580
            new webpack.ContextReplacementPlugin(/angular(\\|\/)core(\\|\/)@angular/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/14898
            new webpack.IgnorePlugin(/^vertx$/) // Workaround for https://github.com/stefanpenner/es6-promise/issues/100
        ]
    };

    const clientBundleConfig = merge(sharedConfig, {
        entry: {
            // To keep development builds fast, include all vendor dependencies in the vendor bundle.
            // But for production builds, leave the tree-shakable ones out so the AOT compiler can produce a smaller bundle.
            vendor: isDevBuild ? allModules : nonTreeShakableModules
        },
        output: { path: path.join(__dirname, 'wwwroot', 'dist') },
        module: {
            rules: [
                { test: /\.css(\?|$)/, use: extractCSS.extract({ use: isDevBuild ? 'css-loader' : 'css-loader?minimize' }) }
            ]
        },
        plugins: [
            extractCSS,
            new webpack.DllPlugin({
                path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
                name: '[name]_[hash]'
            })
        ].concat(isDevBuild ? [] : [
            new webpack.optimize.UglifyJsPlugin()
        ])
    });

    return [clientBundleConfig];
}

Body:
You have not provided providers in your module:

<strike>import { HttpModule } from '@angular/http';</strike>
import { HttpClientModule, HttpClient } from '@angular/common/http';

@NgModule({
  imports: [
    BrowserModule,
    HttpClientModule,
    BrowserAnimationsModule,
    FormsModule,
    AppRoutingModule
  ],
  providers: [ HttpClientModule, ... ]
  // ...
})
export class MyModule { /* ... */ }

Using HttpClient in Tests

You will need to add the HttpClientTestingModule to the TestBed configuration when running ng test and getting the "No provider for HttpClient" error:

// Http testing module and mocking controller
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';

// Other imports
import { TestBed } from '@angular/core/testing';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';

describe('HttpClient testing', () => {
  let httpClient: HttpClient;
  let httpTestingController: HttpTestingController;

  beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [ HttpClientTestingModule ]
    });

    // Inject the http service and test controller for each test
    httpClient = TestBed.get(HttpClient);
    httpTestingController = TestBed.get(HttpTestingController);
  });

  it('works', () => {
  });
});


问:
Zipping multiple Files in C++
I need a zip library (or a function) that can zip\unzip a few files, i tried zlib or gzip I can't find a solution to archive more than one file in a single .zip (or .tar, or .gzip).

Does anyone have ideas?

答: Minizip could do that.</p>

Title: Zipping multiple Files in C++

Body: Minizip could do that.


问:
How are signals emitted through Q_PROPERTY caught?
http://doc.qt.io/qt-5/qtqml-cppintegration-exposecppattributes.html

```<code>class Message : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString author READ author WRITE setAuthor NOTIFY authorChanged)
public:
    void setAuthor(const QString &a) {
        if (a != m_author) {
            m_author = a;
            emit authorChanged();
        }
    }
    QString author() const {
        return m_author;
    }
signals:
    void authorChanged();
private:
    QString m_author;
};
</code>```

They have written emit authorChanged();.

I want to know where is the slot for this signal?

Which code will get changed when the authorChanged() signal is emitted?

答:
This code is an example of communication between QML (JavaScript) and C++. This code exposes the author property, so you can reach it from the JavaScript code. If you change the author property from the C++ side you have to inform the QML engine about it. The NOTIFY field of the Q_PROPERTY macro indicates a signal and when it is emitted the QML engine re-reads that property.

```<code>Message {
    id: msg
    author: "Me"        // this property was defined in c++ side with the
                        // Q_PROPERTY macro.
}

Text {
    width: 100; height: 100
    text: msg.author    // invokes Message::author() to get this value

    Component.onCompleted: {
        msg.author = "Jonah"  // invokes Message::setAuthor()
    }
}
</code>```

Body:
http://doc.qt.io/qt-5/qtqml-cppintegration-exposecppattributes.html

class Message : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString author READ author WRITE setAuthor NOTIFY authorChanged)
public:
    void setAuthor(const QString &a) {
        if (a != m_author) {
            m_author = a;
            emit authorChanged();
        }
    }
    QString author() const {
        return m_author;
    }
signals:
    void authorChanged();
private:
    QString m_author;
};

They have written emit authorChanged();.

I want to know where is the slot for this signal?

Which code will get changed when the authorChanged() signal is emitted?

Body:
This code is an example of communication between QML (JavaScript) and C++. This code exposes the author property, so you can reach it from the JavaScript code. If you change the author property from the C++ side you have to inform the QML engine about it. The NOTIFY field of the Q_PROPERTY macro indicates a signal and when it is emitted the QML engine re-reads that property.

Message {
    id: msg
    author: "Me"        // this property was defined in c++ side with the
                        // Q_PROPERTY macro.
}

Text {
    width: 100; height: 100
    text: msg.author    // invokes Message::author() to get this value

    Component.onCompleted: {
        msg.author = "Jonah"  // invokes Message::setAuthor()
    }
}


问:
TFS API and report performance: get test case results by test plan?
In a report, I need to present all test results for a certain test plan.

Currently I am using the following function:

```<code>foreach (TestCase testCase in testCasesByWorkItem)
{
    List<ITestCaseResult> testCaseResults = teamProject.TestResults.ByTestId(testCase.TestCaseId).Where(x => x.State == TestResultState.Completed).ToList();

    ....

}
</code>```

My understanding is that it returns all results for this test case, and one test case may belong to many test plans.

My problem is performance. The operation takes up to 25 seconds (in debug mode), and I have thousands of test cases.

I only need those test case results, that belong to a certain test plan.

For example, TestCaseX may have been executed for test plans Release1.0, Release2.0, .... Release20.0. And I am only interested in results for Release15.0.

Currently I retrieve results as above, and later filter by a correct test plan.

Is there a way to optimize performance by somehow only selecting test results that belong to a given test plan?

答:
You can use below sample to get test runs against a test plan id:

```<code>TfsTeamProjectCollection tfctc = new TfsTeamProjectCollection(new Uri("http://tfsservername:8080/tfs/DefaultCollection"));
        ITestManagementService testmanagementService = tfctc.GetService<ITestManagementService>();
        var teamproject = testmanagementService.GetTeamProject("teamprojectname");
        var testruns = testmanagementService.QueryTestRuns("select * From TestRun");
        List<ITestRun> testrunInPlan = new List<ITestRun>();
        foreach (var testrun in testruns)
        {
            if (testrun.TestPlanId==31) // in this case TestPlanId is 31
            {
                testrunInPlan.Add(testrun);
            }
        }
</code>```

And below sample to get test case result for  a particular test run:

```<code>ITestCaseResultCollection testcases = testrun.QueryResults();

            foreach (ITestCaseResult testcase in testcases)
            {
                Console.WriteLine("TestCase ID: " + testcase.TestCaseId);
                Console.WriteLine("TestCase Title: " + testcase.TestCaseTitle);
                Console.WriteLine("Error Message: " + testcase.ErrorMessage);
            }
</code>```

Please check this blog for the details on Test Management API: http://blogs.msdn.com/b/aseemb/archive/2012/08/07/code-snippets-on-test-management-apis.aspx

Body:
In a report, I need to present all test results for a certain test plan.

Currently I am using the following function:

foreach (TestCase testCase in testCasesByWorkItem)
{
    List<ITestCaseResult> testCaseResults = teamProject.TestResults.ByTestId(testCase.TestCaseId).Where(x => x.State == TestResultState.Completed).ToList();

    ....

}

My understanding is that it returns all results for this test case, and one test case may belong to many test plans.

My problem is performance. The operation takes up to 25 seconds (in debug mode), and I have thousands of test cases.

I only need those test case results, that belong to a certain test plan.

For example, TestCaseX may have been executed for test plans Release1.0, Release2.0, .... Release20.0. And I am only interested in results for Release15.0.

Currently I retrieve results as above, and later filter by a correct test plan.

Is there a way to optimize performance by somehow only selecting test results that belong to a given test plan?

Body:
You can use below sample to get test runs against a test plan id:

TfsTeamProjectCollection tfctc = new TfsTeamProjectCollection(new Uri("http://tfsservername:8080/tfs/DefaultCollection"));
        ITestManagementService testmanagementService = tfctc.GetService<ITestManagementService>();
        var teamproject = testmanagementService.GetTeamProject("teamprojectname");
        var testruns = testmanagementService.QueryTestRuns("select * From TestRun");
        List<ITestRun> testrunInPlan = new List<ITestRun>();
        foreach (var testrun in testruns)
        {
            if (testrun.TestPlanId==31) // in this case TestPlanId is 31
            {
                testrunInPlan.Add(testrun);
            }
        }

And below sample to get test case result for  a particular test run:

ITestCaseResultCollection testcases = testrun.QueryResults();

            foreach (ITestCaseResult testcase in testcases)
            {
                Console.WriteLine("TestCase ID: " + testcase.TestCaseId);
                Console.WriteLine("TestCase Title: " + testcase.TestCaseTitle);
                Console.WriteLine("Error Message: " + testcase.ErrorMessage);
            }

Please check this blog for the details on Test Management API: http://blogs.msdn.com/b/aseemb/archive/2012/08/07/code-snippets-on-test-management-apis.aspx


问:
displaying ajax results in textbox
From my code, it displays the hall input type tag inside the textbox.

I want only the value to be displayed.

ajax function:

```<code>function load_data(query)
 {
  $.ajax({
   url:"php_action/newfetchorder.php",
   method:"POST",
   data:{query:query},
   success:function(data)
   {

     $('#firstName').val(data);

   }

  });
 }
</code>```

html:

```<code><input  type="text" id="firstName" name="firstName"  />
</code>```

php:

```<code>if(isset($_POST["query"])) {
    $search = mysqli_real_escape_string($connect, $_POST["query"]);
    $query = "
    SELECT * FROM product
    WHERE Barcode LIKE '%".$search."%'
     ";

     $result1 = mysqli_query($connect, $query);
if(mysqli_num_rows($result1) > 0) {

  while($row = mysqli_fetch_array($result1)) {
     $output1 .= '<input type="text" name="item_name" value="'.$row["product_name"].'">';
     // $output2 .= '<input type="text" name="item_price" value="'.$row["Retail_price"].'">';
  }
  echo $output1;

}
else {
 echo 'Data Not Found';
}
}
</code>```

output:

expected output:

答:
change this code line

```<code> $output1 .= '<input type="text" name="item_name" value="'.$row["product_name"].'">';
</code>```

to

```<code>$output1 = $row["$product_name"];
</code>```

Title: displaying ajax results in textbox

Body:
From my code, it displays the hall input type tag inside the textbox.

I want only the value to be displayed.

ajax function:

function load_data(query)
 {
  $.ajax({
   url:"php_action/newfetchorder.php",
   method:"POST",
   data:{query:query},
   success:function(data)
   {

     $('#firstName').val(data);

   }

  });
 }

html:

<input  type="text" id="firstName" name="firstName"  />

php:

if(isset($_POST["query"])) {
    $search = mysqli_real_escape_string($connect, $_POST["query"]);
    $query = "
    SELECT * FROM product
    WHERE Barcode LIKE '%".$search."%'
     ";

     $result1 = mysqli_query($connect, $query);
if(mysqli_num_rows($result1) > 0) {

  while($row = mysqli_fetch_array($result1)) {
     $output1 .= '<input type="text" name="item_name" value="'.$row["product_name"].'">';
     // $output2 .= '<input type="text" name="item_price" value="'.$row["Retail_price"].'">';
  }
  echo $output1;

}
else {
 echo 'Data Not Found';
}
}

output:

expected output:

Body:
change this code line

 $output1 .= '<input type="text" name="item_name" value="'.$row["product_name"].'">';

to

$output1 = $row["$product_name"];


问:
specflow table.CreateSet<object> mapping column name mismatches
I am using specflow and  have a simple table:

```<code>FirstName | Surname|
Bob       | Dylan  |
</code>```

and a class as follows:

```<code>public class Person{
  public string FirstName {get;set;}
  public string LastName {get;set;}
}
</code>```

and the code i want to run is:

```<code>var people = table.CreateSet<Person>();
</code>```

Question:

How do I map surname from the table to LastName in the object?

Cheers

答:
Thanks to Andreas Willich who has said the ability to add the alias will be added in a future release.

Until then, i have looked at the signatures for the methods and it does allow you to specify a function which will allow a hard coded mapping as follows which isn't the clean solution i was looking for but it fixed what i needed it to do:

```<code>    var people = table.CreateSet<Person>(ConvertMethod);

..... //return type is the same as you want and method takes a Tablerow as a parameter
    public static Person ConvertMethod(TableRow row)
    {
        return new Person()
        {
            FirstName = row["firstName"],
            LastName = row["surname"]
        };
    }
</code>```

Body:
I am using specflow and  have a simple table:

FirstName | Surname|
Bob       | Dylan  |

and a class as follows:

public class Person{
  public string FirstName {get;set;}
  public string LastName {get;set;}
}

and the code i want to run is:

var people = table.CreateSet<Person>();

Question:

How do I map surname from the table to LastName in the object?

Cheers

Body:
Thanks to Andreas Willich who has said the ability to add the alias will be added in a future release.

Until then, i have looked at the signatures for the methods and it does allow you to specify a function which will allow a hard coded mapping as follows which isn't the clean solution i was looking for but it fixed what i needed it to do:

    var people = table.CreateSet<Person>(ConvertMethod);

..... //return type is the same as you want and method takes a Tablerow as a parameter
    public static Person ConvertMethod(TableRow row)
    {
        return new Person()
        {
            FirstName = row["firstName"],
            LastName = row["surname"]
        };
    }


问:
Module 'ssh2' already loaded in Unknown on line 0
I use the functions below to copy files from one server to another. It works most of the time, but sometimes I start getting this error in log files:

```<code>Module 'ssh2' already loaded in Unknown on line 0
</code>```

And it stops copying. Later for some reason, the error will stop and copying will start working again. What is the issue here?

```<code>function getConn($server,$username,$password)
{
    $connection = 0;

    if (function_exists("ssh2_connect"))
    {
        $connection = ssh2_connect($server, 3817);
        if($connection)
        {
            if(ssh2_auth_password($connection, $username, $password))
            {
                return $connection;
            }
        }
    }
    return 0;
}
function scp($server,$username,$password,$remotepath,$localpath)
{
    $connection = 0;
    $connection = $this->getConn($server,$username,$password);
    if($connection)
    {
        $ret = ssh2_scp_send($connection, $localpath, $remotepath, 0644);
        ssh2_exec($connection, 'exit');
    }
}
</code>```

答:
The error message Module 'ssh2' already loaded in Unknown on line 0 means that there's something off in your PHP configuration. Check to see if there's a line that says extension=ssh2.so in your php.ini. If so, remove it and check if everything is still working. Possibly, the extension=ssh2.so is loaded twice, meaning PHP will complain that the module is already loaded.

Good luck.

Body:
I use the functions below to copy files from one server to another. It works most of the time, but sometimes I start getting this error in log files:

Module 'ssh2' already loaded in Unknown on line 0

And it stops copying. Later for some reason, the error will stop and copying will start working again. What is the issue here?

function getConn($server,$username,$password)
{
    $connection = 0;

    if (function_exists("ssh2_connect"))
    {
        $connection = ssh2_connect($server, 3817);
        if($connection)
        {
            if(ssh2_auth_password($connection, $username, $password))
            {
                return $connection;
            }
        }
    }
    return 0;
}
function scp($server,$username,$password,$remotepath,$localpath)
{
    $connection = 0;
    $connection = $this->getConn($server,$username,$password);
    if($connection)
    {
        $ret = ssh2_scp_send($connection, $localpath, $remotepath, 0644);
        ssh2_exec($connection, 'exit');
    }
}


问:
Fragment in kotlin
i'm stuck in my application because i have to do a fragment with the navigation drawer in kotlin.. can anyone help? I have search a lot of things in web but i didn't find anything yet...
Down here is two items that i have do in main activity and i want  that is present in the fragment too.</p>

```<code>override fun onNavigationItemSelected(item: MenuItem): Boolean {
    // Handle navigation view item clicks here.
    when (item.itemId) {
        R.id.home -> {

        }
        R.id.subjects -> {
            val intent = Intent(this, SubjectsActivity::class.java)
            startActivity(intent)
        }
    }

    drawer_layout.closeDrawer(GravityCompat.START)
    return true
}
</code>```

答:
You can use this to replace your frame with HomeFragment()
mainDisplayFrame should be replace by your FrameID</p>

```<code>var fragmentTransaction = supportFragmentManager.beginTransaction()
fragmentTransaction.replace(R.id.mainDisplayFrame,HomeFragment()).commit()
mDrawerLayout!!.closeDrawers()
</code>```

Title: Fragment in kotlin

Body:
i'm stuck in my application because i have to do a fragment with the navigation drawer in kotlin.. can anyone help? I have search a lot of things in web but i didn't find anything yet...
Down here is two items that i have do in main activity and i want  that is present in the fragment too.

override fun onNavigationItemSelected(item: MenuItem): Boolean {
    // Handle navigation view item clicks here.
    when (item.itemId) {
        R.id.home -> {

        }
        R.id.subjects -> {
            val intent = Intent(this, SubjectsActivity::class.java)
            startActivity(intent)
        }
    }

    drawer_layout.closeDrawer(GravityCompat.START)
    return true
}

Body:
You can use this to replace your frame with HomeFragment()
mainDisplayFrame should be replace by your FrameID

var fragmentTransaction = supportFragmentManager.beginTransaction()
fragmentTransaction.replace(R.id.mainDisplayFrame,HomeFragment()).commit()
mDrawerLayout!!.closeDrawers()


问:
Determine major Java version across all Java releases
When determining the major Java version on Java 8 and before it was common to use the system property java.specification.version, drop 1., and parse the second digit:

on Java 8 this would yield "1.8" ~> "8" ~> 8

on Java 9 the same calls leads to NumberFormatException because the system property is "9"

What is a future-proof way to determine the major Java version? The goal is to get an int that can be if-ed or switch-ed over to decide which code path to take (e.g. in a library to activate a feature).

答:
Java 9 introduced the Runtime.Version class, which should hopefully be supported for some time to come. Pairing it with the old approach I got:

```<code>public static int getMajorVersion() {
    try {
        // use Java 9+ version API via reflection, so it can be compiled for older versions
        Method runtime_version = Runtime.class.getMethod("version");
        Object version = runtime_version.invoke(null);
        Method version_major = runtime_version.getReturnType().getMethod("major");
        return (int) version_major.invoke(version);
    // do not catch `ReflectiveOperationException` because it does not exist in Java <7
    } catch (Exception ex) {
        // before Java 9 system property 'java.specification.version'
        // is of the form '1.major', so return the int after '1.'
        String versionString = System.getProperty("java.specification.version");
        return Integer.parseInt(versionString.substring(2));
    }
}
</code>```

(I release this code under CC-0: You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.)

It works on my machine (haha), but I'm not sure whether this is the best solution, because I don't know whether either the new API or the system property have any corner cases that I'm not aware of.

See also Stephen's answer for why reducing the version to a single digit might not be a good idea in the first place.

Body:
Java 9 introduced the Runtime.Version class, which should hopefully be supported for some time to come. Pairing it with the old approach I got:

public static int getMajorVersion() {
    try {
        // use Java 9+ version API via reflection, so it can be compiled for older versions
        Method runtime_version = Runtime.class.getMethod("version");
        Object version = runtime_version.invoke(null);
        Method version_major = runtime_version.getReturnType().getMethod("major");
        return (int) version_major.invoke(version);
    // do not catch `ReflectiveOperationException` because it does not exist in Java <7
    } catch (Exception ex) {
        // before Java 9 system property 'java.specification.version'
        // is of the form '1.major', so return the int after '1.'
        String versionString = System.getProperty("java.specification.version");
        return Integer.parseInt(versionString.substring(2));
    }
}

(I release this code under CC-0: You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.)

It works on my machine (haha), but I'm not sure whether this is the best solution, because I don't know whether either the new API or the system property have any corner cases that I'm not aware of.

See also Stephen's answer for why reducing the version to a single digit might not be a good idea in the first place.


答:
If you're using this property from C++ you have to provide and connect the slots yourself, but in Qml if you read the rest:

In the above example, the associated NOTIFY signal for the author
  property is authorChanged, as specified in the Q_PROPERTY() macro
  call. This means that whenever the signal is emitted — as it is when
  the author changes in Message::setAuthor() — this notifies the QML
  engine that any bindings involving the author property must be
  updated, and in turn, the engine will update the text property by
  calling Message::author() again.

it says that the NOTIFY part of the macro informs the QML engine that it has to connect to this signal and update all bindings involving this property.

The Q_PROPERTY just exposes the property but the actual works happens in setAuthor which also emits the signal. QML also uses this this method if a property is set.

UPDATE:

Q: I want to know where is the slot for this signal?

The slots in QML are in the QML engine.

Q: Which code will get changed when the authorChanged() signal is emitted?

The QML updates all bindings involving the specified property.

Title: How are signals emitted through Q_PROPERTY caught?


问:
Can one determine the hostname of the Docker host from a Container?
This is kind of a duplicate question to this one. . But ironically, in spite of that question's title, all the answers say: Use an ENV variable.

My use case: I don't know if docker is running via docker-compose or swarm.  However, it will not be docker run!  I am trying to kick off an upgrade script that resides on the host.  Thus, from within a container I need the docker host name.  Is there any programmatic way to get this WITHOUT environment variables?

答:
Here is the feature request that has been implemented in 17.10 https://github.com/moby/moby/issues/30966

This is how you do it:

```<code>$ hostname testing123

$ docker service create \
  --name foo \
  --hostname "{{.Service.Name}}-{{.Task.Slot}}-{{.Node.Hostname}}" \
  nginx:alpine

 $ docker inspect foo.1.k51r3eclvcelsxy6jthtavkwa --format
   '{{.Config.Hostname}}'
   foo-1-testing123
</code>```

This should also work in docker-compose

```<code>services:
  nginx:
    image: nginx
    hostname: '{{.Node.Hostname}}'
</code>```

Body:
Here is the feature request that has been implemented in 17.10 https://github.com/moby/moby/issues/30966

This is how you do it:

$ hostname testing123

$ docker service create \
  --name foo \
  --hostname "{{.Service.Name}}-{{.Task.Slot}}-{{.Node.Hostname}}" \
  nginx:alpine

 $ docker inspect foo.1.k51r3eclvcelsxy6jthtavkwa --format
   '{{.Config.Hostname}}'
   foo-1-testing123

This should also work in docker-compose

services:
  nginx:
    image: nginx
    hostname: '{{.Node.Hostname}}'


问:
Limiting Claims by App in Azure AD B2C
We have 3 different applications requiring different sets of extension claims.
Application A - Claim A1, Claim A2, Claim A3
Application B - Claim B1, Claim B2, Claim B3

We defined the six Claims in TrustFrameworkExtensions, updated the various TechnicalProfiles to take the input from user and as well write it to directory.

To support the needs of the individual applications, we created 2 RP files, one for each Application and defined the User Journey's specific to the Apps.

The 6 claims are showing up for both Apps, and we want to restrict by App the Claims.

Tried to copy everything from TrustFrameworkExtensions into RP file, the RP does not load and throws an error as follows

Unable to upload policy. Reason : Validation failed: 3 validation error(s) found in policy "B2C_1A_1182017SIGNUP_SIGNIN" of tenant "XXXXXXXXX.onmicrosoft.com".

A required Metadata item with key "ApplicationObjectId" was not found in the TechnicalProfile with id "AAD-UserWriteUsingAlternativeSecurityId" in policy "B2C_1A_1182017signup_signin" of tenant "XXXXXXXXX.onmicrosoft.com".

A required Metadata item with key "ApplicationObjectId" was not found in the TechnicalProfile with id "AAD-UserWriteUsingLogonEmail" in policy "B2C_1A_1182017signup_signin" of tenant "XXXXXXXXX.onmicrosoft.com".

A required Metadata item with key "ApplicationObjectId" was not found in the TechnicalProfile with id "AAD-UserWriteProfileUsingObjectId" in policy "B2C_1A_1182017signup_signin" of tenant "XXXXXXXXX.onmicrosoft.com".

Appreciate advise and guidance to support multiple Apps with different claims.

答:
To use extension attributes in your custom policy you need to add some configuration to your file involving the b2c-extensions-app that is automatically created and registered in the Portal for each B2C tenant.

In your case, you seem to be missing the ApplicationObjectID and possibly the ClientId of the b2c-extensions-app in the Metadata key section of your AAD-Common technical profile.

The Next Steps section of the Create Custom Attribute documentation describes how to perform this configuration.

https://learn.microsoft.com/en-us/azure/active-directory-b2c/custom-policy-custom-attributes#modify-your-custom-policy

Open the extensions file of your policy. For example, SocialAndLocalAccounts/TrustFrameworkExtensions.xml.

Find the ClaimsProviders element. Add a new ClaimsProvider to the ClaimsProviders element.

Replace ApplicationObjectId with the Object ID that you previously recorded. Then replace ClientId with the Application ID that you previously recorded in the below snippet.

```<code>    <ClaimsProvider>
      <DisplayName>Azure Active Directory</DisplayName>
      <TechnicalProfiles>
        <TechnicalProfile Id="AAD-Common">
          <Metadata>
            <!--Insert b2c-extensions-app application ID here, for example: 11111111-1111-1111-1111-111111111111-->
            <Item Key="ClientId"></Item>
            <!--Insert b2c-extensions-app application ObjectId here, for example: 22222222-2222-2222-2222-222222222222-->
            <Item Key="ApplicationObjectId"></Item>
          </Metadata>
        </TechnicalProfile>
      </TechnicalProfiles>
    </ClaimsProvider>
</code>```

Title: Limiting Claims by App in Azure AD B2C

Body:
To use extension attributes in your custom policy you need to add some configuration to your file involving the b2c-extensions-app that is automatically created and registered in the Portal for each B2C tenant.

In your case, you seem to be missing the ApplicationObjectID and possibly the ClientId of the b2c-extensions-app in the Metadata key section of your AAD-Common technical profile.

The Next Steps section of the Create Custom Attribute documentation describes how to perform this configuration.

https://learn.microsoft.com/en-us/azure/active-directory-b2c/custom-policy-custom-attributes#modify-your-custom-policy

Open the extensions file of your policy. For example, SocialAndLocalAccounts/TrustFrameworkExtensions.xml.

Find the ClaimsProviders element. Add a new ClaimsProvider to the ClaimsProviders element.

Replace ApplicationObjectId with the Object ID that you previously recorded. Then replace ClientId with the Application ID that you previously recorded in the below snippet.

    <ClaimsProvider>
      <DisplayName>Azure Active Directory</DisplayName>
      <TechnicalProfiles>
        <TechnicalProfile Id="AAD-Common">
          <Metadata>
            <!--Insert b2c-extensions-app application ID here, for example: 11111111-1111-1111-1111-111111111111-->
            <Item Key="ClientId"></Item>
            <!--Insert b2c-extensions-app application ObjectId here, for example: 22222222-2222-2222-2222-222222222222-->
            <Item Key="ApplicationObjectId"></Item>
          </Metadata>
        </TechnicalProfile>
      </TechnicalProfiles>
    </ClaimsProvider>