问:
Liquibase incremental snapshots
We've got a rather interesting use-case where we're using Liquibase to deploy a database for our application but we're not actually in control of the database. This means that we've got to add in a lot of extra logic around each time we run Liquibase to avoid encountering any errors during the actual run. One way we've done that is that we're generating snapshots of what the DB should look like for each release of our product and then comparing that snapshot with the running DB to know that it's in a compatible state. The snapshot files for our complete database aren't gigantic but if we have to have a full one for every possible release that could cause our software package to get large in the future with dead weight.

We've looked at using the Linux patch command to create offset files as the deltas between these files will typically be very small (i.e. 1 column change, etc.) but the issues are the generated IDs in the snapshot that are not consistent across runs:

```<code>    "snapshotId": "aefa109",
    "table": "liquibase.structure.core.Table#aefa103"
</code>```

Is there any way to force the IDs to be consistent or attack this problem in a different way?

Thanks!

答:
Perhaps we should change how we think about PROD deployments.  When I read:

This means that we've got to add in a lot of extra logic around each time we run Liquibase to avoid encountering any errors during the actual run.

This is sort of an anti-pattern in the world of Liquibase.  Typically, Liquibase is used in a CI/CD pipeline and deployments of SQL are done on "lower environments" to practice for the PROD deployment (which many do not have control over, so your situation is a common one).

When we try to accommodate the possible errors during a PROD deployment, I feel we already are in a bad place with our deployment automation.  We should have been testing the deploys on lower environmets that look like PROD.

For example your pipeline for your DB could look like:

DEV->QA->PROD

Create SQL for deployment in a changelog

DEV & QA seeded with restore from current state of PROD (maybe minus the row data)

You would have all control in DEV (the wild west)

Less control of QA (typically only by QA)

Iterate till you have no errors in your DEV & QA env

Deploy to PROD

If you still have errors, I would argue that you must root cause why and resolve so you can have a pipeline that is automatable.

Hope that helps,

Ronak

Title: Liquibase incremental snapshots

Body:
We've got a rather interesting use-case where we're using Liquibase to deploy a database for our application but we're not actually in control of the database. This means that we've got to add in a lot of extra logic around each time we run Liquibase to avoid encountering any errors during the actual run. One way we've done that is that we're generating snapshots of what the DB should look like for each release of our product and then comparing that snapshot with the running DB to know that it's in a compatible state. The snapshot files for our complete database aren't gigantic but if we have to have a full one for every possible release that could cause our software package to get large in the future with dead weight.

We've looked at using the Linux patch command to create offset files as the deltas between these files will typically be very small (i.e. 1 column change, etc.) but the issues are the generated IDs in the snapshot that are not consistent across runs:

    "snapshotId": "aefa109",
    "table": "liquibase.structure.core.Table#aefa103"

Is there any way to force the IDs to be consistent or attack this problem in a different way?

Thanks!


来源: stackexchange

问:
Cast and Case statement with query in Oracle SQL
I am currently editing a view and trying to cast the field "Doctorate" as Yes, No, or Unknown, based on a case statement that is joined by 2 tables, then joined to the view.

I have an error near the from clause "Expecting ) or AS" but I still get an error when adding those characters. Any help is appreciated! Thanks

Please see the excerpt of my code below:

```<code> CAST (
            CASE
                WHEN D.DEGREE_HIERARCHY >= 40
                    THEN 'Yes'

                WHEN D.DEGREE_HIERARCHY < 40
                    THEN 'No'

                WHEN D.DEGREE_HIERARCHY IS NULL
                    THEN 'Unknown'
                ELSE
                    NULL
            END

        FROM DEGREE_CROSSWALK D, VPAA V
            WHERE
                V.FACULTY_DEGREE_CODE = D.DEGREE_CODE
                   AND V.PERSON_SKEY = SRC.PERSON_SKEY
                   AND V.CURRENT_DEGREE = '1'

        AS VARCHAR2 (50))
                DOCTORATE,
</code>```

答:
I am not sure why you are using the whole query inside CAST, but your problem can be resolved if you use SELECT and () as follows: (see the inline comments in the code)

```<code>SELECT CAST (
            (SELECT CASE -- added ( and SELECT here
                WHEN D.DEGREE_HIERARCHY >= 40
                    THEN 'Yes'

                WHEN D.DEGREE_HIERARCHY < 40
                    THEN 'No'

                WHEN D.DEGREE_HIERARCHY IS NULL
                    THEN 'Unknown'
                ELSE
                    NULL
            END

        FROM DEGREE_CROSSWALK D, VPAA V
            WHERE
                V.FACULTY_DEGREE_CODE = D.DEGREE_CODE
                   AND V.PERSON_SKEY = SRC.PERSON_SKEY
                   AND V.CURRENT_DEGREE = '1') -- added ending bracket ) here

        AS VARCHAR2 (50)) FROM DUAL
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am currently editing a view and trying to cast the field "Doctorate" as Yes, No, or Unknown, based on a case statement that is joined by 2 tables, then joined to the view.

I have an error near the from clause "Expecting ) or AS" but I still get an error when adding those characters. Any help is appreciated! Thanks

Please see the excerpt of my code below:

 CAST (
            CASE
                WHEN D.DEGREE_HIERARCHY >= 40
                    THEN 'Yes'

                WHEN D.DEGREE_HIERARCHY < 40
                    THEN 'No'

                WHEN D.DEGREE_HIERARCHY IS NULL
                    THEN 'Unknown'
                ELSE
                    NULL
            END

        FROM DEGREE_CROSSWALK D, VPAA V
            WHERE
                V.FACULTY_DEGREE_CODE = D.DEGREE_CODE
                   AND V.PERSON_SKEY = SRC.PERSON_SKEY
                   AND V.CURRENT_DEGREE = '1'

        AS VARCHAR2 (50))
                DOCTORATE,

Body:
I am not sure why you are using the whole query inside CAST, but your problem can be resolved if you use SELECT and () as follows: (see the inline comments in the code)

SELECT CAST (
            (SELECT CASE -- added ( and SELECT here
                WHEN D.DEGREE_HIERARCHY >= 40
                    THEN 'Yes'

                WHEN D.DEGREE_HIERARCHY < 40
                    THEN 'No'

                WHEN D.DEGREE_HIERARCHY IS NULL
                    THEN 'Unknown'
                ELSE
                    NULL
            END

        FROM DEGREE_CROSSWALK D, VPAA V
            WHERE
                V.FACULTY_DEGREE_CODE = D.DEGREE_CODE
                   AND V.PERSON_SKEY = SRC.PERSON_SKEY
                   AND V.CURRENT_DEGREE = '1') -- added ending bracket ) here

        AS VARCHAR2 (50)) FROM DUAL


问:
Inconsistent scope in python
I have tried creating a function like this:

```<code>n = ["one", "two"]
result=""
def join_strings(words):
  for word in words:
    result+=word
  return result
print (join_strings(n))
</code>```

This does not work and outputs:

```<code>UnboundLocalError: local variable 'result' referenced before assignment
</code>```

The result variable has to be inside the function for it to work.

However, when I have this simple function:

```<code>x=3
def price():
  return (x+3)
print (price())
</code>```

This works and prints the price, even though x is outside of the function. Why is this happening?

答:
Actually there is no inconsistency as the examples you gave are different from each other. It would still fail in the second function if you have tried to assign x to itself, like:

```<code>>>> x = 3
>>> def price():
...     x +=3
...     return x
...
>>> price()
UnboundLocalError: local variable 'x' referenced before assignment
</code>```

Instead of assigning back to x if you choose another name, it would run with no problem:

```<code>>>> def price():
...     y  = x + 3
...     return y
...
>>> price()
6
</code>```

But, why it happens?

It's because Python's scoping rules. You can read the value of a variable outside of function but you can't change it**. When you do x += 3, which is same as x = x + 3 for integers, that means "I have a variable x that I have write access to it in the current scope." You don't have such variable, thus as the error says: you are referencing a "local variable" before assignment.

Is there a way to modify them in the function?

Yes. You can use global keyword, changes will be applied to your global variable:

```<code>>>> x = 3
>>> def price():
...     global x
...     x += 3
...     return x
...
>>> x
3
>>> price()
6
>>> x
6
</code>```

** By changing, I mean assigning something else to it so it's id will change.

Title: Inconsistent scope in python

Body:
I have tried creating a function like this:

n = ["one", "two"]
result=""
def join_strings(words):
  for word in words:
    result+=word
  return result
print (join_strings(n))

This does not work and outputs:

UnboundLocalError: local variable 'result' referenced before assignment

The result variable has to be inside the function for it to work.

However, when I have this simple function:

x=3
def price():
  return (x+3)
print (price())

This works and prints the price, even though x is outside of the function. Why is this happening?

Body:
Actually there is no inconsistency as the examples you gave are different from each other. It would still fail in the second function if you have tried to assign x to itself, like:

>>> x = 3
>>> def price():
...     x +=3
...     return x
...
>>> price()
UnboundLocalError: local variable 'x' referenced before assignment

Instead of assigning back to x if you choose another name, it would run with no problem:

>>> def price():
...     y  = x + 3
...     return y
...
>>> price()
6

But, why it happens?

It's because Python's scoping rules. You can read the value of a variable outside of function but you can't change it**. When you do x += 3, which is same as x = x + 3 for integers, that means "I have a variable x that I have write access to it in the current scope." You don't have such variable, thus as the error says: you are referencing a "local variable" before assignment.

Is there a way to modify them in the function?

Yes. You can use global keyword, changes will be applied to your global variable:

>>> x = 3
>>> def price():
...     global x
...     x += 3
...     return x
...
>>> x
3
>>> price()
6
>>> x
6

** By changing, I mean assigning something else to it so it's id will change.


问:
sorting of a set in python
can someone explain to me how the print command in python orders a set? I know that the order of a set is random, but why do I get a different output if I call the set by its name or by the print command? For example:
test = {1,32,0,5,84,9}
testhas the output {0, 1, 5, 9, 32, 84}
but
print(test)
has the output {32, 1, 0, 5, 9, 84}

Thank you for your answers!

答:
Dictionary key & value pairs have no order within the Dictionary. The order they are listed when printed out is completely arbitrary. You can't index or create slices from Dictionaries.

They are unordered collections like Sets; unlike Lists and Tuples where order matters.

Hope you find this helpful

Title: sorting of a set in python


问:
How can this MYSQL query be better
I have a table that has all the photos from a user. For some reason (dont care why) some users can be deleted (using DELETE FROM) from the users table, but the photos are kept on the photos tables.

I need to know how many photos are from users that actually exists on the users table.

The first solution I came up with is this:

```<code>SELECT COUNT(DISTINCT user_id) FROM photos WHERE user_id IN (SELECT id FROM users)
</code>```

But I'm not sure if doing two Queries is the best one. Is there a better way to do this?

答:
First of all, your query does not return the number of photos added by users that actually exist in the users table - instead, it returns the number of users from the users table having at least one matching row in the photos table.

This query should be equivalent (might be better, might be worse performance-wise though):

```<code>SELECT COUNT(DISTINCT user_id)
FROM photos, users
WHERE photos.user_id = users.id
</code>```

If you really need the number of photos added by users that exist in the users table:

```<code>SELECT COUNT(*)
FROM photos, users
WHERE photos.user_id = users.id
</code>```

assuming you don't have duplicate user ids.

ContentLicense: CC BY-SA 3.0

Title: How can this MYSQL query be better

Body:
I have a table that has all the photos from a user. For some reason (dont care why) some users can be deleted (using DELETE FROM) from the users table, but the photos are kept on the photos tables.

I need to know how many photos are from users that actually exists on the users table.

The first solution I came up with is this:

SELECT COUNT(DISTINCT user_id) FROM photos WHERE user_id IN (SELECT id FROM users)

But I'm not sure if doing two Queries is the best one. Is there a better way to do this?

Body:
First of all, your query does not return the number of photos added by users that actually exist in the users table - instead, it returns the number of users from the users table having at least one matching row in the photos table.

This query should be equivalent (might be better, might be worse performance-wise though):

SELECT COUNT(DISTINCT user_id)
FROM photos, users
WHERE photos.user_id = users.id

If you really need the number of photos added by users that exist in the users table:

SELECT COUNT(*)
FROM photos, users
WHERE photos.user_id = users.id

assuming you don't have duplicate user ids.


问:
Butterfly pattern appears in random walk using srand(), why?
About 3 years ago I coded a 2D random walk togheter with a coleague in C++, first it seemed to work properly as we obtained a diferent pattern each time. But whenever we decided to increase the number of steps above some threshold an apparent butterfly pattern appeared, we noticed that with each run of the code the pattern would repeat but starting on a different place of the butterfly. We concluded and reported then that it was due to the pseudorandom generator associated with srand() function, but today I found again this report and there are still some things that I would like to understand. I would like to understand better how the pseudorandom generator works in order to obtain this sort of symmetry and ciclic pattern. The pattern I'm talking about is this (The steps are color coded in a rainbow sequence to apreciate the progression of the walk):

EDIT:

I'm adding the code used to obtain this figure:

```<code>#include<iostream>
#include<cmath>
#include<stdlib.h>
#include<time.h>
#include <fstream>
#include <string.h>
#include <string>
#include <iomanip>

using namespace std;

int main ()
{
srand(time(NULL));
int num1,n=250000;

ofstream rnd_coordinates("Random2D.txt");
float x=0,y=0,sumx_f=0,sumy_f=0,sum_d=0,d_m,X,t,d;
float x_m,y_m;

x=0;
y=0;

for(int i=0;i<n;i++){

    t=i;
    num1= rand()%4;

    if(num1==0){
        x++;
    }
    if(num1==1){
        x--;
    }
    if(num1==2){
        y++;
    }
    if(num1==3){
        y--;
    }

    rnd_coordinates<<x<<','<<y<<','<<t<<endl;

}

rnd_coordinates.close();

return 0;
}
</code>```

答:
You never hit rand()'s period, but keep in mind you don't actually use the entire rand() range that in its entirety guarantees a 2^32 period.

With that in mind, you have 2 options:

Use all the bits. rand() returns 2 bytes (16 bits), and you need 2 bits (for 4 possible values). Split that 16 bit output into chunks of 2 bits and use them all in sequence.

At the very least if you insist on using the lazy %n way, choose a modulo that's not a divisor of your period. For example choose 5 instead of 4, since 5 is prime, and if you get the 5th value reroll.

Body:
About 3 years ago I coded a 2D random walk togheter with a coleague in C++, first it seemed to work properly as we obtained a diferent pattern each time. But whenever we decided to increase the number of steps above some threshold an apparent butterfly pattern appeared, we noticed that with each run of the code the pattern would repeat but starting on a different place of the butterfly. We concluded and reported then that it was due to the pseudorandom generator associated with srand() function, but today I found again this report and there are still some things that I would like to understand. I would like to understand better how the pseudorandom generator works in order to obtain this sort of symmetry and ciclic pattern. The pattern I'm talking about is this (The steps are color coded in a rainbow sequence to apreciate the progression of the walk):

EDIT:

I'm adding the code used to obtain this figure:

#include<iostream>
#include<cmath>
#include<stdlib.h>
#include<time.h>
#include <fstream>
#include <string.h>
#include <string>
#include <iomanip>

using namespace std;

int main ()
{
srand(time(NULL));
int num1,n=250000;

ofstream rnd_coordinates("Random2D.txt");
float x=0,y=0,sumx_f=0,sumy_f=0,sum_d=0,d_m,X,t,d;
float x_m,y_m;

x=0;
y=0;

for(int i=0;i<n;i++){

    t=i;
    num1= rand()%4;

    if(num1==0){
        x++;
    }
    if(num1==1){
        x--;
    }
    if(num1==2){
        y++;
    }
    if(num1==3){
        y--;
    }

    rnd_coordinates<<x<<','<<y<<','<<t<<endl;

}

rnd_coordinates.close();

return 0;
}


问:
Know if signal is triggered from django admin
I need to send a mail only when the model is saved from django admin, I was trying with sender.user.is_superuser but i couldn't find the specific method

答:
Not Possible:

Accessing the user's request in a post_save signal

"Can't be done. The current user is only available via the request, which is not available when using purely model functionality. Access the user in the view somehow."

"Django's model signals are intended to notify other system components about events associated with instances and their respected data"

Possible Solution:

https://stackoverflow.com/a/35145746/3466907


问:
Does NAudio support converting MP3 to WAV in a .Net Core api running in Linux?
I am trying to find a way to convert a mp3 file to wav in a .net core 3.1 api running in Linux. Can I make use of the NAudio library to do that? I know they support Windows, but not sure about Linux</p>

答:
Looks like NAudio support only Windows, related open issue https://github.com/naudio/NAudio/issues/184

UPD 2020-06-26. Thank for comment from Tim Davis, you can use NLayer (https://github.com/naudio/NLayer)+NAudio to convert mp3.


问:
localhost, 127.0.0.1 and hosts file are not working on a specific port
I'm struggling with this problem for a while.

When I enter http://localhost:680/local in chrome's address bar, the web page is loaded and everything works as expected. But when I enter anything else including http://127.0.0.1:680/local I get an error: ERR_INVALID_HTTP_RESPONSE.

update: Today localhost stopped working as well.

My backend code isn't called and there is nothing received as I see in the DevTools:

This was working yesterday, and I don't know what has changed in my system.

If I change my port to 681 it works.

This is particularly important because I need to open the web page with URL prefix such as admin.mysite.net:680/local or user.mysite.net:680/local but adding these names to the hosts file doesn't do anything.

What I have tried:

ping:

When I ping 127.0.0.1 it tells me the IPv6: Reply from ::1: time<1ms and I've disabled IPv6 in registry but still it's showing ::1:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DisabledComponents = 0x20

I can ping all names in hosts they all resolve to 127.0.0.1 and I can see them all in ipconfig /displaydns

hosts:

I followed these instructions

I can edit C:\Windows\System32\drivers\etc\hosts but it doesn't make any difference. When I add or remove 127.0.0.1 localhost or other value I always get the same result. I created a new single line ANSI file with this content 127.0.0.1 aaa but aaa:680/local gives me the same error.

other:

I also tried ipconfig /flushdns and ipconfig /registerdns.

I executed netsh http add iplisten 127.0.0.1 and it added the IP address.

I tried incognito and I cleared chrome data.

I read that there was a bug with http-server so I tried npm uninstall http-server and
npm install http-server@0.9.0.

I have no proxy, no automatic configuration script in LAN settings, no firewall.

I'm out of ideas. What else can I try?

答:
It could be related to resource sharing or as Mohith mentioned CROS (cross-origin resource sharing).

There was another service in background which was somehow blocking some resources (probably port 680) denying access to the backend. Stopping the service fixed the issue.


问:
Handling expired token in Laravel
What is the best way to handle expired tokens in laravel 5.

I mean I have a page and it has some links which perform ajax requests. They work fine when the page is loaded but when I wait for sometime then I get a TOKEN MISMATCH error.

Now, I have to refresh the page to make it work again. BUT, I don't want to refresh the page. I want some way to refresh the token or some other work around to make it fix.

I hope you got my point.

答:
try this in your main layout file</p>

```<code>@guest
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="refresh" content="{{config('session.lifetime') * 60}}">
@endguest
</code>```

Title: Handling expired token in Laravel

Body:
try this in your main layout file

@guest
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="refresh" content="{{config('session.lifetime') * 60}}">
@endguest


问:
How to get Actor list by UActorComponent?
I want to get all scene actors filtered by a list of actor components.

Kismet library has this.

```<code>static void GetActorListFromComponentList
(
    const TArray < class UPrimitiveComponent * > & ComponentList,
    UClass * ActorClassFilter,
    TArray < class AActor * > & OutActorList
)
</code>```

But what I need is something like this:

```<code>static void GetActorListFromActorComponentList
(
    const TArray < class UActorComponent * > & ComponentList, // Note the TArray<> element type
    UClass * ActorClassFilter,
    TArray < class AActor * > & OutActorList
)
</code>```

Are there any functions in the Kismet which has similar functionality?

答:
Primitive component is actually an actor component so you can just copy implementation of this function into your code and replace UPrimitiveComponent entries with UActorComponent.

```<code>void GetActorListFromComponentList(const TArray<UActorComponent*>& ComponentList, UClass* ActorClassFilter, TArray<class AActor*>& OutActorList)
{
    OutActorList.Empty();
    for (int32 CompIdx=0; CompIdx<ComponentList.Num(); ++CompIdx)
    {
        UActorComponent* const C = ComponentList[CompIdx];
        if (C)
        {
            AActor* const Owner = C->GetOwner();
            if (Owner)
            {
                if ( !ActorClassFilter || Owner->IsA(ActorClassFilter) )
                {
                    OutActorList.AddUnique(Owner);
                }
            }
        }
    }
}
</code>```

or event make a template

```<code>template<typename TComponent, typename TAllocator>
void GetActorListFromComponentList(const TArray<TComponent*, Allocator>& ComponentList, UClass* ActorClassFilter, TArray<class AActor*>& OutActorList)
{
    OutActorList.Empty();
    for (int32 CompIdx=0; CompIdx<ComponentList.Num(); ++CompIdx)
    {
        TComponent* const C = ComponentList[CompIdx];
        if (C)
        {
            AActor* const Owner = C->GetOwner();
            if (Owner)
            {
                if ( !ActorClassFilter || Owner->IsA(ActorClassFilter) )
                {
                    OutActorList.AddUnique(Owner);
                }
            }
        }
    }
}
</code>```

Body:
I want to get all scene actors filtered by a list of actor components.

Kismet library has this.

static void GetActorListFromComponentList
(
    const TArray < class UPrimitiveComponent * > & ComponentList,
    UClass * ActorClassFilter,
    TArray < class AActor * > & OutActorList
)

But what I need is something like this:

static void GetActorListFromActorComponentList
(
    const TArray < class UActorComponent * > & ComponentList, // Note the TArray<> element type
    UClass * ActorClassFilter,
    TArray < class AActor * > & OutActorList
)

Are there any functions in the Kismet which has similar functionality?

Body:
Primitive component is actually an actor component so you can just copy implementation of this function into your code and replace UPrimitiveComponent entries with UActorComponent.

void GetActorListFromComponentList(const TArray<UActorComponent*>& ComponentList, UClass* ActorClassFilter, TArray<class AActor*>& OutActorList)
{
    OutActorList.Empty();
    for (int32 CompIdx=0; CompIdx<ComponentList.Num(); ++CompIdx)
    {
        UActorComponent* const C = ComponentList[CompIdx];
        if (C)
        {
            AActor* const Owner = C->GetOwner();
            if (Owner)
            {
                if ( !ActorClassFilter || Owner->IsA(ActorClassFilter) )
                {
                    OutActorList.AddUnique(Owner);
                }
            }
        }
    }
}

or event make a template

template<typename TComponent, typename TAllocator>
void GetActorListFromComponentList(const TArray<TComponent*, Allocator>& ComponentList, UClass* ActorClassFilter, TArray<class AActor*>& OutActorList)
{
    OutActorList.Empty();
    for (int32 CompIdx=0; CompIdx<ComponentList.Num(); ++CompIdx)
    {
        TComponent* const C = ComponentList[CompIdx];
        if (C)
        {
            AActor* const Owner = C->GetOwner();
            if (Owner)
            {
                if ( !ActorClassFilter || Owner->IsA(ActorClassFilter) )
                {
                    OutActorList.AddUnique(Owner);
                }
            }
        }
    }
}


问:
Fluent UI DetailsList - Is there a way to add filters to each column
I am using Fluent UI DetailsList. My table looks like below:

I need filters below every column (text or drop-down) as shown below:

Please let me know if this is possible? Or maybe a way to display custom header (using html) ?

答:
This actually turned out to be easier than I thought it'd be...

If you're ok with clicking the column header to reveal the choices (vs having the dropdown  directly under the title) then this can be achieved using the ContextualMenu component in conjunction with DetailsList. I got it working by tweaking from the variable row height example in the official docs: https://developer.microsoft.com/en-us/fluentui#/controls/web/detailslist/variablerowheights.

Add a ContextualMenu underneath your DetailsList:

```<code><DetailsList
    items={items}
    columns={columns}
/>
{this.state.contextualMenuProps && <ContextualMenu {...this.state.contextualMenuProps} />}
</code>```

Inside your column definition, set the hasDropdown action so the user gets a UI indicator that they can/should click the header, and call a contextMenu method (note I'm using onColumnContextMenu as well as onColumnClick so it doesn't matter if they left or right click the header:

```<code>{
    key: 'dept',
    name: 'Department',
    fieldName: 'dept',
    minWidth: 125,
    maxWidth: 200,
    onColumnContextMenu: (column, ev) => {
        this.onColumnContextMenu(column, ev);
    },
    onColumnClick: (ev, column) => {
        this.onColumnContextMenu(column, ev);
    },
    columnActionsMode: ColumnActionsMode.hasDropdown,
}
</code>```

When the onColumnContextMenu method gets invoked, we need to build the context menu properties that will get consumed by the ContextualMenu component. Note the dismissal method as well, which clears out the state so the menu is hidden.

```<code>private onContextualMenuDismissed = (): void => {
    this.setState({
        contextualMenuProps: undefined,
    });
}

private onColumnContextMenu = (column: IColumn, ev: React.MouseEvent<HTMLElement>): void => {
    if (column.columnActionsMode !== ColumnActionsMode.disabled) {
        this.setState({
            contextualMenuProps: this.getContextualMenuProps(ev, column),
        });
    }
};
</code>```

Finally, inside of getContextualMenuProps you need to determine what the options should be for the user to click. In this example, I'm simply giving sort options (you'll need to add an onClick handler to actually do something when the user clicks the item), but I'll use the column to determine what those items should actually be and paint the filters into the items collection so the user can select one to filter.

```<code>private getContextualMenuProps = (ev: React.MouseEvent<HTMLElement>, column: IColumn): IContextualMenuProps => {
    const items: IContextualMenuItem[] = [
        {
            key: 'aToZ',
            name: 'A to Z',
            iconProps: { iconName: 'SortUp' },
            canCheck: true,
            checked: column.isSorted && !column.isSortedDescending,
        },
        {
            key: 'zToA',
            name: 'Z to A',
            iconProps: { iconName: 'SortDown' },
            canCheck: true,
            checked: column.isSorted && column.isSortedDescending,
        }
    ];

    return {
        items: items,
        target: ev.currentTarget as HTMLElement,
        directionalHint: DirectionalHint.bottomLeftEdge,
        gapSpace: 10,
        isBeakVisible: true,
        onDismiss: this.onContextualMenuDismissed,
    }
}
</code>```

Note the target on the ContextualMenuProps object, which is what tells the ContextualMenu where to lock itself onto (in this case, the column header that you clicked to instantiate the menu.

Body:
This actually turned out to be easier than I thought it'd be...

If you're ok with clicking the column header to reveal the choices (vs having the dropdown  directly under the title) then this can be achieved using the ContextualMenu component in conjunction with DetailsList. I got it working by tweaking from the variable row height example in the official docs: https://developer.microsoft.com/en-us/fluentui#/controls/web/detailslist/variablerowheights.

Add a ContextualMenu underneath your DetailsList:

<DetailsList
    items={items}
    columns={columns}
/>
{this.state.contextualMenuProps && <ContextualMenu {...this.state.contextualMenuProps} />}

Inside your column definition, set the hasDropdown action so the user gets a UI indicator that they can/should click the header, and call a contextMenu method (note I'm using onColumnContextMenu as well as onColumnClick so it doesn't matter if they left or right click the header:

{
    key: 'dept',
    name: 'Department',
    fieldName: 'dept',
    minWidth: 125,
    maxWidth: 200,
    onColumnContextMenu: (column, ev) => {
        this.onColumnContextMenu(column, ev);
    },
    onColumnClick: (ev, column) => {
        this.onColumnContextMenu(column, ev);
    },
    columnActionsMode: ColumnActionsMode.hasDropdown,
}

When the onColumnContextMenu method gets invoked, we need to build the context menu properties that will get consumed by the ContextualMenu component. Note the dismissal method as well, which clears out the state so the menu is hidden.

private onContextualMenuDismissed = (): void => {
    this.setState({
        contextualMenuProps: undefined,
    });
}

private onColumnContextMenu = (column: IColumn, ev: React.MouseEvent<HTMLElement>): void => {
    if (column.columnActionsMode !== ColumnActionsMode.disabled) {
        this.setState({
            contextualMenuProps: this.getContextualMenuProps(ev, column),
        });
    }
};

Finally, inside of getContextualMenuProps you need to determine what the options should be for the user to click. In this example, I'm simply giving sort options (you'll need to add an onClick handler to actually do something when the user clicks the item), but I'll use the column to determine what those items should actually be and paint the filters into the items collection so the user can select one to filter.

private getContextualMenuProps = (ev: React.MouseEvent<HTMLElement>, column: IColumn): IContextualMenuProps => {
    const items: IContextualMenuItem[] = [
        {
            key: 'aToZ',
            name: 'A to Z',
            iconProps: { iconName: 'SortUp' },
            canCheck: true,
            checked: column.isSorted && !column.isSortedDescending,
        },
        {
            key: 'zToA',
            name: 'Z to A',
            iconProps: { iconName: 'SortDown' },
            canCheck: true,
            checked: column.isSorted && column.isSortedDescending,
        }
    ];

    return {
        items: items,
        target: ev.currentTarget as HTMLElement,
        directionalHint: DirectionalHint.bottomLeftEdge,
        gapSpace: 10,
        isBeakVisible: true,
        onDismiss: this.onContextualMenuDismissed,
    }
}

Note the target on the ContextualMenuProps object, which is what tells the ContextualMenu where to lock itself onto (in this case, the column header that you clicked to instantiate the menu.


问:
How to implement (char-ready?) in C
I'm currently implementing Scheme R5RS in C, and I am stuck trying to implement the (char-ready?) function.

I have the specs for the function quoted below. The function is guaranteed not to block. The standard C functions like fgetc() all block on input when called when there is no input ready.

Does anyone know if there is way to implement this in a nice simple way, without spawning a dedicated IO thread?

Edit:
My input stream type is a FILE*, which could be stdin or a file opened with fopen().

(char-ready?) procedure

(char-ready? port) procedure

Returns #t if a character is ready on the input port and returns #f otherwise. If char-ready returns #t then the next read-char operation on the given port is guaranteed not to hang. If the port is at end of file then char-ready? returns #t. Port may be omitted, in which case it defaults to the value returned by current-input-port.

Rationale:

Char-ready? exists to make it possible for a program to accept characters from interactive ports without getting stuck waiting for input. Any input editors associated with such ports must ensure that characters whose existence has been asserted by char-ready? cannot be rubbed out. If char-ready? were to return #f at end of file, a port at end of file would be indistinguishable from an interactive port that has no ready characters.

答: Perhaps this solution would work for you: How to check if stdin is still opened without blocking?</p>

Title: How to implement (char-ready?) in C


问:
hey guys how to use spring boot session with angular project
how to use spring boot session with angular project
i want to send the login and password with that requet POST in the second picture

enter image description here

答:
angular  is a frontend framework. After build you get static html, css and js. You can put this on every server (nginx, tomcat, whatever).  See Communicating with backend services using HTTP

You can 'connect' you angular via ajax calls with spring boot. But you have to set CORS in your spring boot backend. See: spring boot and cors

This is a good article how to use jwt in angular and spring boot: angular-spring-boot-jwt-auth


问:
How to Convert "space" into "%20" with R
Referring the title, I'm figuring how to convert space between words to be %20 .

For example,

```<code>> y <- "I Love You"
</code>```

How to make y = I%20Love%20You

```<code>> y
[1] "I%20Love%20You"
</code>```

Thanks a lot.

答:
I like URLencode() but be aware that sometimes it does not work as expected if your url already contains a %20 together with a real space, in which case not even the repeated option of URLencode() is doing what you want.

In my case, I needed to run both URLencode() and gsub consecutively to get exactly what I needed, like so:

```<code>a = "already%20encoded%space/a real space.csv"

URLencode(a)
#returns: "encoded%20space/real space.csv"
#note the spaces that are not transformed

URLencode(a, repeated=TRUE)
#returns: "encoded%2520space/real%20space.csv"
#note the %2520 in the first part

gsub(" ", "%20", URLencode(a))
#returns: "encoded%20space/real%20space.csv"
</code>```

In this particular example, gsub() alone would have been enough, but URLencode() is of course doing more than just replacing spaces.

Body:
Referring the title, I'm figuring how to convert space between words to be %20 .

For example,

> y <- "I Love You"

How to make y = I%20Love%20You

> y
[1] "I%20Love%20You"

Thanks a lot.

Body:
I like URLencode() but be aware that sometimes it does not work as expected if your url already contains a %20 together with a real space, in which case not even the repeated option of URLencode() is doing what you want.

In my case, I needed to run both URLencode() and gsub consecutively to get exactly what I needed, like so:

a = "already%20encoded%space/a real space.csv"

URLencode(a)
#returns: "encoded%20space/real space.csv"
#note the spaces that are not transformed

URLencode(a, repeated=TRUE)
#returns: "encoded%2520space/real%20space.csv"
#note the %2520 in the first part

gsub(" ", "%20", URLencode(a))
#returns: "encoded%20space/real%20space.csv"

In this particular example, gsub() alone would have been enough, but URLencode() is of course doing more than just replacing spaces.


问:
How To Get Latitude & Longitude with python
I am trying to retrieve the longitude & latitude of a physical address ,through the below script .But I am getting the error. I have already installed googlemaps.

```<code>#!/usr/bin/env python
import urllib,urllib2

"""This Programs Fetch The Address"""

from googlemaps import GoogleMaps

address='Mahatma Gandhi Rd, Shivaji Nagar, Bangalore, KA 560001'

add=GoogleMaps().address_to_latlng(address)
print add
</code>```

Output:

```<code>Traceback (most recent call last):
  File "Fetching.py", line 12, in <module>
    add=GoogleMaps().address_to_latlng(address)
  File "/usr/local/lib/python2.7/dist-packages/googlemaps.py", line 310, in address_to_latlng
    return tuple(self.geocode(address)['Placemark'][0]['Point']['coordinates'][1::-1])
  File "/usr/local/lib/python2.7/dist-packages/googlemaps.py", line 259, in geocode
    url, response = fetch_json(self._GEOCODE_QUERY_URL, params=params)
  File "/usr/local/lib/python2.7/dist-packages/googlemaps.py", line 50, in fetch_json
    response = urllib2.urlopen(request)
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 407, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 520, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 445, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 528, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden
</code>```

答:
For a Python script that does not require an API key nor external libraries you can query the Nominatim service which in turn queries the Open Street Map database.

For more information on how to use it see https://nominatim.org/release-docs/develop/api/Search/

A simple example is below:

```<code>import requests
import urllib.parse

address = 'Shivaji Nagar, Bangalore, KA 560001'
url = 'https://nominatim.openstreetmap.org/search/' + urllib.parse.quote(address) +'?format=json'

response = requests.get(url).json()
print(response[0]["lat"])
print(response[0]["lon"])
</code>```

Body:
I am trying to retrieve the longitude & latitude of a physical address ,through the below script .But I am getting the error. I have already installed googlemaps.

#!/usr/bin/env python
import urllib,urllib2

"""This Programs Fetch The Address"""

from googlemaps import GoogleMaps

address='Mahatma Gandhi Rd, Shivaji Nagar, Bangalore, KA 560001'

add=GoogleMaps().address_to_latlng(address)
print add

Output:

Traceback (most recent call last):
  File "Fetching.py", line 12, in <module>
    add=GoogleMaps().address_to_latlng(address)
  File "/usr/local/lib/python2.7/dist-packages/googlemaps.py", line 310, in address_to_latlng
    return tuple(self.geocode(address)['Placemark'][0]['Point']['coordinates'][1::-1])
  File "/usr/local/lib/python2.7/dist-packages/googlemaps.py", line 259, in geocode
    url, response = fetch_json(self._GEOCODE_QUERY_URL, params=params)
  File "/usr/local/lib/python2.7/dist-packages/googlemaps.py", line 50, in fetch_json
    response = urllib2.urlopen(request)
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 407, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 520, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 445, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 528, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden

Body:
For a Python script that does not require an API key nor external libraries you can query the Nominatim service which in turn queries the Open Street Map database.

For more information on how to use it see https://nominatim.org/release-docs/develop/api/Search/

A simple example is below:

import requests
import urllib.parse

address = 'Shivaji Nagar, Bangalore, KA 560001'
url = 'https://nominatim.openstreetmap.org/search/' + urllib.parse.quote(address) +'?format=json'

response = requests.get(url).json()
print(response[0]["lat"])
print(response[0]["lon"])


问:
pandas data frame KeyError oop
The purpose of this script is to read a csv file.

The file contains forex data.

The file has 7 columns Date, Time, Open, High, Low, Close and Volume, and around 600k rows.

After scraping the date and time the script must will make some date time calculation like month and day.

Then some technical analysis using TA-LIB library.

Here is the code:

```<code>import pandas as pd
import talib

class Data:
    def __init__(self):
        self.df = pd.DataFrame()
        self.names = ['Date', 'Time', 'Open', 'High', 'Low', 'Close', 'Volume']
        self.open = self.df['Open'].astype(float)
        self.high = self.df['High'].astype(float)
        self.low = self.df['Low'].astype(float)
        self.close = self.df['Close'].astype(float)

    def file(self, file):
        self.df = pd.read_csv(file, names=self.names,
                              parse_dates={'Release Date': ['Date', 'Time']})
        return self.df

    def date(self):
        self.df['Release Date'] = pd.to_datetime(self.df['Release Date'])

    def year(self):
        self.df['year'] = pd.to_datetime(self.df['Release Date']).dt.year

    def month(self):
        self.df['year'] = pd.to_datetime(self.df['Release Date']).dt.month

    def day(self):
        self.df['year'] = pd.to_datetime(self.df['Release Date']).dt.day

    def dema(self):
        # DEMA - Double Exponential Moving Average
        self.df['DEMA'] = talib.DEMA(self.close, timeperiod=30)

    def ema(self):
        # EMA - Exponential Moving Average
        self.df['EMA'] = talib.EMA(self.close, timeperiod=30)

    def HT_TRENDLINE(self):
        # HT_TRENDLINE - Hilbert Transform - Instantaneous Trendline
        self.df['HT_TRENDLINE '] = talib.HT_TRENDLINE(self.close)

    def KAMA(self):
        # KAMA - Kaufman Adaptive Moving Average
        self.df['KAMA'] = talib.KAMA(self.close, timeperiod=30)

    def ma(self):
        # MA - Moving average
        self.df['MA'] = talib.MA(self.close, timeperiod=30, matype=0)

    def print(self):
        return print(self.df.head())

x = Data()
x.file(r"D:\Projects\Project Forex\USDJPY.csv")
x.print()
</code>```

Here is the error:

```<code>Traceback (most recent call last):

  File "C:\Users\Sayed\miniconda3\lib\site-packages\pandas\core\indexes\base.py", line 2646, in get_loc
    return self._engine.get_loc(key)

  File "pandas\_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc

  File "pandas\_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc

  File "pandas\_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item

  File "pandas\_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Open'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "C:/Users/Sayed/PycharmProjects/project/Technical Analysis.py", line 55, in <module>
    x = Data()

  File "C:/Users/Sayed/PycharmProjects/project/Technical Analysis.py", line 9, in __init__
    self.open = self.df['Open'].astype(float)

  File "C:\Users\Sayed\miniconda3\lib\site-packages\pandas\core\frame.py", line 2800, in __getitem__
    indexer = self.columns.get_loc(key)

  File "C:\Users\Sayed\miniconda3\lib\site-packages\pandas\core\indexes\base.py", line 2648, in get_loc
    return self._engine.get_loc(self._maybe_cast_indexer(key))

  File "pandas\_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc

  File "pandas\_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc

  File "pandas\_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item

  File "pandas\_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item

KeyError: 'Open'
</code>```

答:
In the __init__ function you are initializing empty DataFrame without any columns. But 1 line after, you are trying to convert Open column of the DataFrame to float.

```<code>def __init__(self):
    self.df = pd.DataFrame() # No columns
    self.names = ['Date', 'Time', 'Open', 'High', 'Low', 'Close', 'Volume']
    self.open = self.df['Open'].astype(float) # ERROR: 'Open' column does not exist
    self.high = self.df['High'].astype(float)
    self.low = self.df['Low'].astype(float)
    self.close = self.df['Close'].astype(float)
</code>```

Change you init function to this and it should work!

```<code>def __init__(self):
    self.names = ['Date', 'Time', 'Open', 'High', 'Low', 'Close', 'Volume']
    self.df = pd.DataFrame(columns=self.names) # Empty dataframe with columns
    self.open = self.df['Open'].astype(float) # Now 'Open' column exists
    self.high = self.df['High'].astype(float)
    self.low = self.df['Low'].astype(float)
    self.close = self.df['Close'].astype(float)
</code>```

Title: pandas data frame KeyError oop

Body:
The purpose of this script is to read a csv file.

The file contains forex data.

The file has 7 columns Date, Time, Open, High, Low, Close and Volume, and around 600k rows.

After scraping the date and time the script must will make some date time calculation like month and day.

Then some technical analysis using TA-LIB library.

Here is the code:

import pandas as pd
import talib

class Data:
    def __init__(self):
        self.df = pd.DataFrame()
        self.names = ['Date', 'Time', 'Open', 'High', 'Low', 'Close', 'Volume']
        self.open = self.df['Open'].astype(float)
        self.high = self.df['High'].astype(float)
        self.low = self.df['Low'].astype(float)
        self.close = self.df['Close'].astype(float)

    def file(self, file):
        self.df = pd.read_csv(file, names=self.names,
                              parse_dates={'Release Date': ['Date', 'Time']})
        return self.df

    def date(self):
        self.df['Release Date'] = pd.to_datetime(self.df['Release Date'])

    def year(self):
        self.df['year'] = pd.to_datetime(self.df['Release Date']).dt.year

    def month(self):
        self.df['year'] = pd.to_datetime(self.df['Release Date']).dt.month

    def day(self):
        self.df['year'] = pd.to_datetime(self.df['Release Date']).dt.day

    def dema(self):
        # DEMA - Double Exponential Moving Average
        self.df['DEMA'] = talib.DEMA(self.close, timeperiod=30)

    def ema(self):
        # EMA - Exponential Moving Average
        self.df['EMA'] = talib.EMA(self.close, timeperiod=30)

    def HT_TRENDLINE(self):
        # HT_TRENDLINE - Hilbert Transform - Instantaneous Trendline
        self.df['HT_TRENDLINE '] = talib.HT_TRENDLINE(self.close)

    def KAMA(self):
        # KAMA - Kaufman Adaptive Moving Average
        self.df['KAMA'] = talib.KAMA(self.close, timeperiod=30)

    def ma(self):
        # MA - Moving average
        self.df['MA'] = talib.MA(self.close, timeperiod=30, matype=0)

    def print(self):
        return print(self.df.head())

x = Data()
x.file(r"D:\Projects\Project Forex\USDJPY.csv")
x.print()

Here is the error:

Traceback (most recent call last):

  File "C:\Users\Sayed\miniconda3\lib\site-packages\pandas\core\indexes\base.py", line 2646, in get_loc
    return self._engine.get_loc(key)

  File "pandas\_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc

  File "pandas\_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc

  File "pandas\_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item

  File "pandas\_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Open'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "C:/Users/Sayed/PycharmProjects/project/Technical Analysis.py", line 55, in <module>
    x = Data()

  File "C:/Users/Sayed/PycharmProjects/project/Technical Analysis.py", line 9, in __init__
    self.open = self.df['Open'].astype(float)

  File "C:\Users\Sayed\miniconda3\lib\site-packages\pandas\core\frame.py", line 2800, in __getitem__
    indexer = self.columns.get_loc(key)

  File "C:\Users\Sayed\miniconda3\lib\site-packages\pandas\core\indexes\base.py", line 2648, in get_loc
    return self._engine.get_loc(self._maybe_cast_indexer(key))

  File "pandas\_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc

  File "pandas\_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc

  File "pandas\_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item

  File "pandas\_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item

KeyError: 'Open'

Body:
In the __init__ function you are initializing empty DataFrame without any columns. But 1 line after, you are trying to convert Open column of the DataFrame to float.

def __init__(self):
    self.df = pd.DataFrame() # No columns
    self.names = ['Date', 'Time', 'Open', 'High', 'Low', 'Close', 'Volume']
    self.open = self.df['Open'].astype(float) # ERROR: 'Open' column does not exist
    self.high = self.df['High'].astype(float)
    self.low = self.df['Low'].astype(float)
    self.close = self.df['Close'].astype(float)

Change you init function to this and it should work!

def __init__(self):
    self.names = ['Date', 'Time', 'Open', 'High', 'Low', 'Close', 'Volume']
    self.df = pd.DataFrame(columns=self.names) # Empty dataframe with columns
    self.open = self.df['Open'].astype(float) # Now 'Open' column exists
    self.high = self.df['High'].astype(float)
    self.low = self.df['Low'].astype(float)
    self.close = self.df['Close'].astype(float)


问:
python-jira login without password? Any possible way to create encrypted token and use in lieu password?
Below is python test code to login jira using username and password and it works fine.

```<code>from jira import JIRA

jira = JIRA('http://xxx')
jira = JIRA(basic_auth=('username','password'),options={'server': 'http://xxx'})

issue = jira.issue('XXXX-762')

print "For task", issue,", summary is-", issue.fields.summary
</code>```

Now I require to log in jira without using password.
can anyone help?

Aim of this is to hide the password in general script and also make the script independent of jira password expiry.

Jira version used: JIRA v7.5.2

Thank you.

答:
I just set the password in an environment variable and have the script read it.</p>

```<code>from jira import JIRA

jira_user = os.environ.get("JIRA_USERNAME", None)
jira_password = os.environ.get("JIRA_PASSWORD", None)
jira_server = {'server': "https://jiraserver.url"}
jira = JIRA(options=jira_server, basic_auth=(jira_user, jira_password))
</code>```

Body:
Below is python test code to login jira using username and password and it works fine.

from jira import JIRA

jira = JIRA('http://xxx')
jira = JIRA(basic_auth=('username','password'),options={'server': 'http://xxx'})

issue = jira.issue('XXXX-762')

print "For task", issue,", summary is-", issue.fields.summary

Now I require to log in jira without using password.
can anyone help?

Aim of this is to hide the password in general script and also make the script independent of jira password expiry.

Jira version used: JIRA v7.5.2

Thank you.

Body:
I just set the password in an environment variable and have the script read it.

from jira import JIRA

jira_user = os.environ.get("JIRA_USERNAME", None)
jira_password = os.environ.get("JIRA_PASSWORD", None)
jira_server = {'server': "https://jiraserver.url"}
jira = JIRA(options=jira_server, basic_auth=(jira_user, jira_password))


问:
Can I block a thread and its children in C++
I have a code like this

```<code>Create thread_1 and bind task 1 to that;
Create thread_2 and bind task 2 to that;
Create thread_3 and it monitors the keyboards and work as follow:
     while(true){
       get the next key;
       if (the next key == 'p')
            pause_the_code();
       if (the next key == 'r')
            resume_the_code();
       if(the next key == 'q'
            exit the while loop
      }
// can I here block the Thread_1 and _Thread_2 with all of their children
//with wait() when I call pause_the_code(); or notify them when I call resume_the_code();
</code>```

Please note that hread_1 and Thread_2 each one can dynamically create different bunch of threads.

答:
No you cannot reach out from one thread and pause or block another thread. Not in any safe way.

What you do is create a way for the threads to block themselves, by checking for it.

You could use an atomic boolean variable named something like running and when it was false run a small loop with a sleep in it.

You could use a condition variable and a mutex protecting a boolean named running and when it was false wait for a condition notification.

You could have each worker thread lock on a mutex. If thread_3 holds the mutex instead, they cannot take it and must wait until it is released.

Body:
I have a code like this

Create thread_1 and bind task 1 to that;
Create thread_2 and bind task 2 to that;
Create thread_3 and it monitors the keyboards and work as follow:
     while(true){
       get the next key;
       if (the next key == 'p')
            pause_the_code();
       if (the next key == 'r')
            resume_the_code();
       if(the next key == 'q'
            exit the while loop
      }
// can I here block the Thread_1 and _Thread_2 with all of their children
//with wait() when I call pause_the_code(); or notify them when I call resume_the_code();

Please note that hread_1 and Thread_2 each one can dynamically create different bunch of threads.


问:
ClassNotFoundException for javax.xml.bind.JAXBException with Spring Boot when switch to Java 9
Initialized the project using start.spring.io

Added WEB,JPA,H2 dependencies then tried to run the MainApplication.java using Jdk 9 and got the following error log

```<code>  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.10.RELEASE)

2018-02-26 16:23:33.973  INFO 3860 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication v0.0.1-SNAPSHOT on RAJAT-PC with PID 3860 (C:\Users\devra\Downloads\Compressed\demo\target\demo-0.0.1-SNAPSHOT.jar started by rajat in C:\Users\devra\Downloads\Compressed\demo\target)
2018-02-26 16:23:33.973  INFO 3860 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2018-02-26 16:23:34.254  INFO 3860 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1aa7ecca: startup date [Mon Feb 26 16:23:34 IST 2018]; root of context hierarchy
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (jar:file:/C:/Users/devra/Downloads/Compressed/demo/target/demo-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/spring-core-4.3.14.RELEASE.jar!/) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2018-02-26 16:23:38.429  INFO 3860 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$1c55a85e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-02-26 16:23:39.856  INFO 3860 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2018-02-26 16:23:39.888  INFO 3860 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2018-02-26 16:23:39.903  INFO 3860 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.27
2018-02-26 16:23:40.247  INFO 3860 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-02-26 16:23:40.247  INFO 3860 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 6024 ms
2018-02-26 16:23:40.622  INFO 3860 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-02-26 16:23:40.622  INFO 3860 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-02-26 16:23:40.622  INFO 3860 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-02-26 16:23:40.622  INFO 3860 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2018-02-26 16:23:40.622  INFO 3860 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2018-02-26 16:23:40.622  INFO 3860 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2018-02-26 16:23:40.622  INFO 3860 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'webServlet' to [/h2-console/*]
2018-02-26 16:23:42.200  INFO 3860 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-02-26 16:23:42.263  INFO 3860 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
        name: default
        ...]
2018-02-26 16:23:42.591  INFO 3860 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.0.12.Final}
2018-02-26 16:23:42.607  INFO 3860 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2018-02-26 16:23:42.607  INFO 3860 --- [           main] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2018-02-26 16:23:42.653  WARN 3860 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
2018-02-26 16:23:42.669  INFO 3860 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2018-02-26 16:23:42.716  INFO 3860 --- [           main] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-02-26 16:23:42.747 ERROR 3860 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) ~[spring-context-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.10.RELEASE.jar!/:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.10.RELEASE.jar!/:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.10.RELEASE.jar!/:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.10.RELEASE.jar!/:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.10.RELEASE.jar!/:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.10.RELEASE.jar!/:1.5.10.RELEASE]
        at com.example.demo.DemoApplication.main(DemoApplication.java:10) [classes!/:0.0.1-SNAPSHOT]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
        at org.hibernate.boot.spi.XmlMappingBinderAccess.<init>(XmlMappingBinderAccess.java:43) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
        at org.hibernate.boot.MetadataSources.<init>(MetadataSources.java:87) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:179) ~[hibernate-entitymanager-5.0.12.Final.jar!/:5.0.12.Final]
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:149) ~[hibernate-entitymanager-5.0.12.Final.jar!/:5.0.12.Final]
        at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:54) ~[spring-orm-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:360) ~[spring-orm-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:382) ~[spring-orm-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:371) ~[spring-orm-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:336) ~[spring-orm-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        ... 24 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466) ~[na:na]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563) ~[na:na]
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94) ~[demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496) ~[na:na]
        ... 35 common frames omitted
</code>```

Then I switched to jdk 8 and it working fine.

The same happening with Spring-boot 2.0.0 RC2

Why this happening when spring doc mentioned the required Java version for it to be 8 or 9.

答:
The accepted answer is right, just wanted to point out I was having the same issue during Tomcat 9 startup while migrating a web project to OpenJDK11. In my case got the following stack trace:

```<code>SEVERE [main] com.sun.faces.config.ConfigureListener.contextInitialized Critical error during deployment:
       java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
               at java.base/java.lang.Class.getDeclaredFields0(Native Method)
               at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3061)
               at java.base/java.lang.Class.getDeclaredFields(Class.java:2248)
               at com.sun.faces.application.annotation.ManagedBeanConfigHandler.collectAnnotatedFields(ManagedBeanConfigHandler.java:245)
               at com.sun.faces.application.annotation.ManagedBeanConfigHandler.getBeanInfo(ManagedBeanConfigHandler.java:154)
               at com.sun.faces.application.annotation.ManagedBeanConfigHandler.process(ManagedBeanConfigHandler.java:140)
               at com.sun.faces.application.annotation.ManagedBeanConfigHandler.push(ManagedBeanConfigHandler.java:126)
               at com.sun.faces.application.annotation.AnnotationManager.applyConfigAnnotations(AnnotationManager.java:234)
               at com.sun.faces.config.processor.AbstractConfigProcessor.processAnnotations(AbstractConfigProcessor.java:449)
               at com.sun.faces.config.processor.ManagedBeanConfigProcessor.process(ManagedBeanConfigProcessor.java:245)
               at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
               at com.sun.faces.config.processor.ValidatorConfigProcessor.process(ValidatorConfigProcessor.java:121)
               at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
               at com.sun.faces.config.processor.ConverterConfigProcessor.process(ConverterConfigProcessor.java:127)
               at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
               at com.sun.faces.config.processor.ComponentConfigProcessor.process(ComponentConfigProcessor.java:118)
               at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
               at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:403)
               at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
               at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:138)
               at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
               at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:246)
               at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:443)
               at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:237)
               at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4684)
               at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5147)
               at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
               at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
               at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
               at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
               at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:978)
               at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1848)
               at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
               at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
               at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
               at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)
               at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:773)
               at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
               at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1576)
               at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
               at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
               at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
               at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
               at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:936)
               at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
               at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
               at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
               at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
               at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
               at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
               at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
               at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
               at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
               at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
               at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
               at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
               at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
               at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
               at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
               at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
               at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
               at java.base/java.lang.reflect.Method.invoke(Method.java:566)
               at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
               at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
       Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
               at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365)
               at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188)
               ... 65 more
</code>```

Hope it helps

Body:
Initialized the project using start.spring.io

Added WEB,JPA,H2 dependencies then tried to run the MainApplication.java using Jdk 9 and got the following error log

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.10.RELEASE)

2018-02-26 16:23:33.973  INFO 3860 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication v0.0.1-SNAPSHOT on RAJAT-PC with PID 3860 (C:\Users\devra\Downloads\Compressed\demo\target\demo-0.0.1-SNAPSHOT.jar started by rajat in C:\Users\devra\Downloads\Compressed\demo\target)
2018-02-26 16:23:33.973  INFO 3860 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2018-02-26 16:23:34.254  INFO 3860 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1aa7ecca: startup date [Mon Feb 26 16:23:34 IST 2018]; root of context hierarchy
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (jar:file:/C:/Users/devra/Downloads/Compressed/demo/target/demo-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/spring-core-4.3.14.RELEASE.jar!/) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2018-02-26 16:23:38.429  INFO 3860 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$1c55a85e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-02-26 16:23:39.856  INFO 3860 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2018-02-26 16:23:39.888  INFO 3860 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2018-02-26 16:23:39.903  INFO 3860 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.27
2018-02-26 16:23:40.247  INFO 3860 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-02-26 16:23:40.247  INFO 3860 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 6024 ms
2018-02-26 16:23:40.622  INFO 3860 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-02-26 16:23:40.622  INFO 3860 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-02-26 16:23:40.622  INFO 3860 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-02-26 16:23:40.622  INFO 3860 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2018-02-26 16:23:40.622  INFO 3860 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2018-02-26 16:23:40.622  INFO 3860 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2018-02-26 16:23:40.622  INFO 3860 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'webServlet' to [/h2-console/*]
2018-02-26 16:23:42.200  INFO 3860 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-02-26 16:23:42.263  INFO 3860 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
        name: default
        ...]
2018-02-26 16:23:42.591  INFO 3860 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.0.12.Final}
2018-02-26 16:23:42.607  INFO 3860 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2018-02-26 16:23:42.607  INFO 3860 --- [           main] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2018-02-26 16:23:42.653  WARN 3860 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
2018-02-26 16:23:42.669  INFO 3860 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2018-02-26 16:23:42.716  INFO 3860 --- [           main] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-02-26 16:23:42.747 ERROR 3860 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) ~[spring-context-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.10.RELEASE.jar!/:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.10.RELEASE.jar!/:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.10.RELEASE.jar!/:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.10.RELEASE.jar!/:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.10.RELEASE.jar!/:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.10.RELEASE.jar!/:1.5.10.RELEASE]
        at com.example.demo.DemoApplication.main(DemoApplication.java:10) [classes!/:0.0.1-SNAPSHOT]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
        at org.hibernate.boot.spi.XmlMappingBinderAccess.<init>(XmlMappingBinderAccess.java:43) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
        at org.hibernate.boot.MetadataSources.<init>(MetadataSources.java:87) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:179) ~[hibernate-entitymanager-5.0.12.Final.jar!/:5.0.12.Final]
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:149) ~[hibernate-entitymanager-5.0.12.Final.jar!/:5.0.12.Final]
        at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:54) ~[spring-orm-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:360) ~[spring-orm-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:382) ~[spring-orm-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:371) ~[spring-orm-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:336) ~[spring-orm-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
        ... 24 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466) ~[na:na]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563) ~[na:na]
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94) ~[demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496) ~[na:na]
        ... 35 common frames omitted

Then I switched to jdk 8 and it working fine.

The same happening with Spring-boot 2.0.0 RC2

Why this happening when spring doc mentioned the required Java version for it to be 8 or 9.

Body:
The accepted answer is right, just wanted to point out I was having the same issue during Tomcat 9 startup while migrating a web project to OpenJDK11. In my case got the following stack trace:

SEVERE [main] com.sun.faces.config.ConfigureListener.contextInitialized Critical error during deployment:
       java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
               at java.base/java.lang.Class.getDeclaredFields0(Native Method)
               at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3061)
               at java.base/java.lang.Class.getDeclaredFields(Class.java:2248)
               at com.sun.faces.application.annotation.ManagedBeanConfigHandler.collectAnnotatedFields(ManagedBeanConfigHandler.java:245)
               at com.sun.faces.application.annotation.ManagedBeanConfigHandler.getBeanInfo(ManagedBeanConfigHandler.java:154)
               at com.sun.faces.application.annotation.ManagedBeanConfigHandler.process(ManagedBeanConfigHandler.java:140)
               at com.sun.faces.application.annotation.ManagedBeanConfigHandler.push(ManagedBeanConfigHandler.java:126)
               at com.sun.faces.application.annotation.AnnotationManager.applyConfigAnnotations(AnnotationManager.java:234)
               at com.sun.faces.config.processor.AbstractConfigProcessor.processAnnotations(AbstractConfigProcessor.java:449)
               at com.sun.faces.config.processor.ManagedBeanConfigProcessor.process(ManagedBeanConfigProcessor.java:245)
               at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
               at com.sun.faces.config.processor.ValidatorConfigProcessor.process(ValidatorConfigProcessor.java:121)
               at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
               at com.sun.faces.config.processor.ConverterConfigProcessor.process(ConverterConfigProcessor.java:127)
               at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
               at com.sun.faces.config.processor.ComponentConfigProcessor.process(ComponentConfigProcessor.java:118)
               at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
               at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:403)
               at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
               at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:138)
               at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
               at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:246)
               at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:443)
               at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:237)
               at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4684)
               at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5147)
               at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
               at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
               at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
               at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
               at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:978)
               at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1848)
               at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
               at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
               at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
               at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)
               at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:773)
               at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
               at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1576)
               at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
               at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
               at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
               at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
               at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:936)
               at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
               at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
               at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
               at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
               at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
               at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
               at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
               at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
               at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
               at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
               at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
               at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
               at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
               at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
               at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
               at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
               at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
               at java.base/java.lang.reflect.Method.invoke(Method.java:566)
               at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
               at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
       Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
               at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365)
               at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188)
               ... 65 more

Hope it helps


问:
Lua arrays question
I'm a PHP guy so I don't know how to solve this problem. I know how I'd do this in PHP but I have no clue what the constraints are for Lua regarding this problem.

```<code>T = {
  clocktable = {},
  beancabinet = {},
  --...etc
}

T.clocktable[674] = 1
T.clocktable[660] = 1
--...etc
</code>```

Q: How would I loop through "T" to quickly know that the clocktable key includes the extended keys "674" and "660", only knowing "clocktable"?

Note: please be careful of overhead as the "T" table will be very loaded with data and this is in a performance environment.

答:
I'm not sure what the question exactly is. If you know the key, ponzao's answer is right, otherwise use a for loop:</p>

```<code>for key, value in pairs(T.clocktable) do
    -- do something with key and value
end
</code>```

Title: Lua arrays question

Body:
I'm a PHP guy so I don't know how to solve this problem. I know how I'd do this in PHP but I have no clue what the constraints are for Lua regarding this problem.

T = {
  clocktable = {},
  beancabinet = {},
  --...etc
}

T.clocktable[674] = 1
T.clocktable[660] = 1
--...etc

Q: How would I loop through "T" to quickly know that the clocktable key includes the extended keys "674" and "660", only knowing "clocktable"?

Note: please be careful of overhead as the "T" table will be very loaded with data and this is in a performance environment.

Body:
I'm not sure what the question exactly is. If you know the key, ponzao's answer is right, otherwise use a for loop:

for key, value in pairs(T.clocktable) do
    -- do something with key and value
end


问:
sorting of a set in python
can someone explain to me how the print command in python orders a set? I know that the order of a set is random, but why do I get a different output if I call the set by its name or by the print command? For example:
test = {1,32,0,5,84,9}
testhas the output {0, 1, 5, 9, 32, 84}
but
print(test)
has the output {32, 1, 0, 5, 9, 84}

Thank you for your answers!

答:
When you call test, it defaults orders the elements in list in an ascending manner, but when it prints, it has random order.

The reason is basically, whenever you try to print an unordered set, the normal print command or even if you iterate using loop, it will give you this kind of erroneous output.

Read more on this here, Python Sets

Title: sorting of a set in python