问:
Overwrite resource file with maven assembly plugin
I use maven-assembly-plugin with "jar-with-dependencies" to package jar. There are 2 dependencies artifact having log-back.xml. The second artifact is depend on the first one. I want to have log-back.xml of the second artifact in final jar, but it always contain log-back.xml of the first one. So how can I control this?

Thanks

答:
Is the first artifact a module of your own project? If so, you could exclude the log-back.xml there in the resources section of the pom.xml.

```<code><resources>
  <resource>
    <directory>src/main/resources</directory>
    <excludes>
      <exclude>log-back.xml</exclude>
    </excludes>
  </resource>
  ...
</resources>
</code>```

However, this only works if this module does not require the log-back.xml by itself when it is built out of the scope of the overall jar.

Body:
Is the first artifact a module of your own project? If so, you could exclude the log-back.xml there in the resources section of the pom.xml.

<resources>
  <resource>
    <directory>src/main/resources</directory>
    <excludes>
      <exclude>log-back.xml</exclude>
    </excludes>
  </resource>
  ...
</resources>

However, this only works if this module does not require the log-back.xml by itself when it is built out of the scope of the overall jar.


来源: stackexchange

问:
Why Spring HandlerExecutionChain has both interceptors and interceptorList?
Why there are array type interceptors and list type interceptorList in spring source org.springframework.web.servlet.HandlerExecutionChain？ Is this necessary?

public class HandlerExecutionChain {

    private final Object handler;

    @Nullable
    private HandlerInterceptor[] interceptors;

    @Nullable
    private List<HandlerInterceptor> interceptorList;

    .....
}
```

答:
When you look in the source code you will see that only HandlerInterceptor[] interceptors is only returned outside the HandlerExecutionChain in:

public HandlerInterceptor[] getInterceptors() {
```

Also you can look at List<HandlerInterceptor> initInterceptorList( that is used to create List<HandlerInterceptor> interceptorList. It looks like the interceptorList is collection that helps in creating  the interceptors array that later is exposing outside.

ContentLicense: CC BY-SA 4.0

Body:
When you look in the source code you will see that only HandlerInterceptor[] interceptors is only returned outside the HandlerExecutionChain in:

public HandlerInterceptor[] getInterceptors() {

Also you can look at List<HandlerInterceptor> initInterceptorList( that is used to create List<HandlerInterceptor> interceptorList. It looks like the interceptorList is collection that helps in creating  the interceptors array that later is exposing outside.


问:
How to prevent initial load from Algolia instant search in react native?
I have a users collection which I want to query as the user types, but when I switch to the Search Users Screen, all the users have populated on the screen even the search is empty.

How can I prevent this and only send the results to the client when he/she types in the search box??

I found some other links and resources but either they were too old, difficult to understand for me or using React instead of React Native.

I am a beginner developer and if you would be elaborate with the solution then that would be great.

This is my code:

SEARCH_USER.JS:

import React, {Component} from 'react';
import {
  View,
  Text,
  TextInput,
  Alert,
  FlatList,
  ActivityIndicator,
} from 'react-native';

import firestore from '@react-native-firebase/firestore';
import algoliasearch from 'algoliasearch';
import {
  InstantSearch,
  connectSearchBox,
  connectInfiniteHits,
} from 'react-instantsearch-native';
import PropTypes from 'prop-types';
import InfiniteHits from '../components/Algolia Components/InfiniteHits';

class SearchAddBuddyScreen extends Component {
  constructor(props) {
    super(props);

    this.state = {
      loading: false,
      value: null,
    };
  }

  searchClient = algoliasearch(
    '########',
    '####################',
  );

  render() {
    return (
      <View>
        <SecondaryHeader secondaryHeaderTitle="Add Buddies" />
        <InstantSearch
          searchClient={this.searchClient}
          indexName="prod_USERSCOLLECTION"
          onSearchStateChange={searchState =>
            console.log('=====> ', searchState)
          }>
          <ConnectedSearchBox />
          <InfiniteHits navigation={this.props.navigation} />
        </InstantSearch>
      </View>
    );
  }
}

class SearchBox extends Component {
  render() {
    console.log('Connected Search Box called');
    return (
      <View
        style={[
          textInput.generalTextInput,
          {
            marginBottom: 24,
            alignSelf: 'center',
            justifyContent: 'center',
          },
        ]}>
        <TextInput
          placeholderTextColor="#333647"
          style={[textInput.generalTextInput, {alignSelf: 'center'}]}
          onChangeText={text => this.props.refine(text)}
          value={this.props.currentRefinement}
          placeholder={'Search'}
          clearButtonMode={'always'}
          spellCheck={false}
          autoCorrect={false}
          autoCapitalize={'none'}
        />
      </View>
    );
  }
}

SearchBox.propTypes = {
  refine: PropTypes.func.isRequired,
  currentRefinement: PropTypes.string,
};

const ConnectedSearchBox = connectSearchBox(SearchBox);
export default SearchUserScreen;
```

<p>InfiniteHits.js:</p>

<pre class="lang-js prettyprint-override"><code>import React, {Component} from 'react';
import {StyleSheet, Text, View, FlatList} from 'react-native';
import {connectInfiniteHits} from 'react-instantsearch-native';
import AddFriendComponent from '../AddFriend';

class InfiniteHits extends Component {
  constructor(props) {
    super(props);

    this.navigation = this.props.navigation;
  }
  _renderItem = ({item}) => {
    return (
      <AddFriendComponent
        username={item.username}
        fullName={item.fullName}
        onPressUserProfile={() =>
          this.props.navigation.navigate('UserProfile', {profileId: item.uid})
        }
      />
    );
  };

  render() {
    return (
      <FlatList
        data={this.props.hits}
        keyExtractor={item => item.objectID}
        // ItemSeparatorComponent={() => <View style={styles.separator} />}
        onEndReached={() => this.props.hasMore && this.props.refine()}
        renderItem={this._renderItem}
      />
    );
  }
}
export default connectInfiniteHits(InfiniteHits);
</code>```

答:
After reading through more material I found this https://www.algolia.com/doc/guides/building-search-ui/going-further/conditional-requests/react/

And made the following changes to my code and it succeeded.

conditionalQuery = {
    search(requests) {
      if (
        requests.every(({params}) => !params.query) ||
        requests.every(({params}) => params.query === ' ') ||
        requests.every(({params}) => params.query === '  ') ||
        requests.every(({params}) => params.query === '   ')
      ) {
        // Here we have to do something else
        console.log('Empty Query');
        return Promise.resolve({
          results: requests.map(() => ({
            hits: [],
            nbHits: 0,
            nbPages: 0,
            processingTimeMS: 0,
          })),
        });
      }
      const searchClient = algoliasearch(
        '########',
        '###################',
      );
      return searchClient.search(requests);
    },
  };
  render() {
    return (
      <View>
        <SecondaryHeader secondaryHeaderTitle="Add Buddies" />
        <InstantSearch
          searchClient={this.conditionalQuery}
          indexName="prod_USERSCOLLECTION"
          onSearchStateChange={searchState =>
            console.log('=====> ', searchState)
          }>
          <ConnectedSearchBox />
          <InfiniteHits navigation={this.props.navigation} />
        </InstantSearch>
      </View>
    );
  }

```

This solution can still be improved for the spaces typed, but I don't know how to do that.

Body:
I have a users collection which I want to query as the user types, but when I switch to the Search Users Screen, all the users have populated on the screen even the search is empty.

How can I prevent this and only send the results to the client when he/she types in the search box??

I found some other links and resources but either they were too old, difficult to understand for me or using React instead of React Native.

I am a beginner developer and if you would be elaborate with the solution then that would be great.

This is my code:

SEARCH_USER.JS:

import React, {Component} from 'react';
import {
  View,
  Text,
  TextInput,
  Alert,
  FlatList,
  ActivityIndicator,
} from 'react-native';

import firestore from '@react-native-firebase/firestore';
import algoliasearch from 'algoliasearch';
import {
  InstantSearch,
  connectSearchBox,
  connectInfiniteHits,
} from 'react-instantsearch-native';
import PropTypes from 'prop-types';
import InfiniteHits from '../components/Algolia Components/InfiniteHits';

class SearchAddBuddyScreen extends Component {
  constructor(props) {
    super(props);

    this.state = {
      loading: false,
      value: null,
    };
  }

  searchClient = algoliasearch(
    '########',
    '####################',
  );

  render() {
    return (
      <View>
        <SecondaryHeader secondaryHeaderTitle="Add Buddies" />
        <InstantSearch
          searchClient={this.searchClient}
          indexName="prod_USERSCOLLECTION"
          onSearchStateChange={searchState =>
            console.log('=====> ', searchState)
          }>
          <ConnectedSearchBox />
          <InfiniteHits navigation={this.props.navigation} />
        </InstantSearch>
      </View>
    );
  }
}

class SearchBox extends Component {
  render() {
    console.log('Connected Search Box called');
    return (
      <View
        style={[
          textInput.generalTextInput,
          {
            marginBottom: 24,
            alignSelf: 'center',
            justifyContent: 'center',
          },
        ]}>
        <TextInput
          placeholderTextColor="#333647"
          style={[textInput.generalTextInput, {alignSelf: 'center'}]}
          onChangeText={text => this.props.refine(text)}
          value={this.props.currentRefinement}
          placeholder={'Search'}
          clearButtonMode={'always'}
          spellCheck={false}
          autoCorrect={false}
          autoCapitalize={'none'}
        />
      </View>
    );
  }
}

SearchBox.propTypes = {
  refine: PropTypes.func.isRequired,
  currentRefinement: PropTypes.string,
};

const ConnectedSearchBox = connectSearchBox(SearchBox);
export default SearchUserScreen;

InfiniteHits.js:

import React, {Component} from 'react';
import {StyleSheet, Text, View, FlatList} from 'react-native';
import {connectInfiniteHits} from 'react-instantsearch-native';
import AddFriendComponent from '../AddFriend';

class InfiniteHits extends Component {
  constructor(props) {
    super(props);

    this.navigation = this.props.navigation;
  }
  _renderItem = ({item}) => {
    return (
      <AddFriendComponent
        username={item.username}
        fullName={item.fullName}
        onPressUserProfile={() =>
          this.props.navigation.navigate('UserProfile', {profileId: item.uid})
        }
      />
    );
  };

  render() {
    return (
      <FlatList
        data={this.props.hits}
        keyExtractor={item => item.objectID}
        // ItemSeparatorComponent={() => <View style={styles.separator} />}
        onEndReached={() => this.props.hasMore && this.props.refine()}
        renderItem={this._renderItem}
      />
    );
  }
}
export default connectInfiniteHits(InfiniteHits);

Body:
After reading through more material I found this https://www.algolia.com/doc/guides/building-search-ui/going-further/conditional-requests/react/

And made the following changes to my code and it succeeded.

conditionalQuery = {
    search(requests) {
      if (
        requests.every(({params}) => !params.query) ||
        requests.every(({params}) => params.query === ' ') ||
        requests.every(({params}) => params.query === '  ') ||
        requests.every(({params}) => params.query === '   ')
      ) {
        // Here we have to do something else
        console.log('Empty Query');
        return Promise.resolve({
          results: requests.map(() => ({
            hits: [],
            nbHits: 0,
            nbPages: 0,
            processingTimeMS: 0,
          })),
        });
      }
      const searchClient = algoliasearch(
        '########',
        '###################',
      );
      return searchClient.search(requests);
    },
  };
  render() {
    return (
      <View>
        <SecondaryHeader secondaryHeaderTitle="Add Buddies" />
        <InstantSearch
          searchClient={this.conditionalQuery}
          indexName="prod_USERSCOLLECTION"
          onSearchStateChange={searchState =>
            console.log('=====> ', searchState)
          }>
          <ConnectedSearchBox />
          <InfiniteHits navigation={this.props.navigation} />
        </InstantSearch>
      </View>
    );
  }

This solution can still be improved for the spaces typed, but I don't know how to do that.


问:
Uncaught ReferenceError: WebFont is not defined
I am testing the the pages for mobile friendly issues I am getting the page a mobile friendly but search console gives errors. I don't know why?

Uncaught ReferenceError: WebFont is not defined

I am getting this error as I test the page when I click view details as it shows some page loading issues. I am not able to figure out what it means?

答:
I had a similar problem and I solve embedding my font using e.g.:

```<code><link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
</code>```

Also, is important to load the CSS Asynchronously depending on your Font priority.

e.g. Webfont Lora 400

```<code><link href="https://fonts.googleapis.com/css?family=Lora:400&display=swap" rel="stylesheet" media="print" onload="if(media!='all') media='all'">
</code>```

Body:
I had a similar problem and I solve embedding my font using e.g.:

<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">

Also, is important to load the CSS Asynchronously depending on your Font priority.

e.g. Webfont Lora 400

<link href="https://fonts.googleapis.com/css?family=Lora:400&display=swap" rel="stylesheet" media="print" onload="if(media!='all') media='all'">


问:
click nav on position fixed with jquery
I have this CSS code by:
How can I get a fixed address-bar in Google Chrome for Android with javascript

Here is the preview image:
http://s7.picofile.com/file/8388260676/photo.jpg

When I scroll down the page, The code shows  ;

But when I click number one, The code shows

I want it to be 2268px when I click it.

My code (javascript):

```<code>$(window).scroll(function (event) {
    var sc = $(window).scrollTop();
    // console.log(sc);
    $("body main").css('top',sc);
});
$("header .nav-click").click(function(){
    $("body main").css('top',sc);
});
</code>```

答:
Your var cs is local variable. if you want to use it in another function,try to initialize it in the global scope.

Also, You should define it in 'px'. mean add px at the end when you assign it as css

```<code>var sc = $(window).scrollTop();

$(window).scroll(function (event) {
    sc = $(window).scrollTop();
    $("body main").css('top',sc + 'px');
});

$("header .nav-click").click(function(){
    $("body main").css('top',sc + 'px');
});
</code>```

Title: click nav on position fixed with jquery

Body:
I have this CSS code by:
How can I get a fixed address-bar in Google Chrome for Android with javascript

Here is the preview image:
http://s7.picofile.com/file/8388260676/photo.jpg

When I scroll down the page, The code shows  ;

But when I click number one, The code shows

I want it to be 2268px when I click it.

My code (javascript):

$(window).scroll(function (event) {
    var sc = $(window).scrollTop();
    // console.log(sc);
    $("body main").css('top',sc);
});
$("header .nav-click").click(function(){
    $("body main").css('top',sc);
});

Body:
Your var cs is local variable. if you want to use it in another function,try to initialize it in the global scope.

Also, You should define it in 'px'. mean add px at the end when you assign it as css

var sc = $(window).scrollTop();

$(window).scroll(function (event) {
    sc = $(window).scrollTop();
    $("body main").css('top',sc + 'px');
});

$("header .nav-click").click(function(){
    $("body main").css('top',sc + 'px');
});


问:
How to delete few middle commits in gitlab?
I need a help in git/gitlab.
I got gitlab with test repo e.g. 6 commits:
A->B->C->D->E->F
Commit A is first and F the last one.
How Can I do this: remove commits B,C,D,E?
I want to have only the first one and last one"
A->F
I do it because my repo weights a lot.
What commands shoul I enter?</p>

答:
Assuming that you're on branch master at the moment, and that no one else is working on that repo:

```<code>git checkout <hash-A>
git cherry-pick <hash-F>
git branch -f master
git checkout master
</code>```

Then if you are happy with the results you can:

```<code>git push -f origin master
</code>```

Remember that you will permanently lose all changes made in commits B to E.

Body:
Assuming that you're on branch master at the moment, and that no one else is working on that repo:

git checkout <hash-A>
git cherry-pick <hash-F>
git branch -f master
git checkout master

Then if you are happy with the results you can:

git push -f origin master

Remember that you will permanently lose all changes made in commits B to E.


问:
**How to select specified number of IMG tags from quantity input value**
Image example:

As you can see from clicking the image example link above, “EE” is the row and “8” is the item number.
I would like to select three of the following four IMG tag items located in the same row and echo the result.

```<code><div id="surface" style="width: 4567px; height: 4137px; left: -1850px; top: -1152px; cursor: default;">

<img src="https://media.memories.png" data-items="L:106|EE:5" data-pl="1" style="position: absolute; cursor: pointer; width: 14px; height: 14px; left: 2221px; top: 1561px; display: block;">

<img src="https://media.memories.png" data-items="L:106|EE:6" data-pl="1" style="position: absolute; cursor: pointer; width: 14px; height: 14px; left: 2237px; top: 1561px; display: block;">

<img src="https://media.memories.png" data-items="L:106|EE:7" data-pl="1" style="position: absolute; cursor: pointer; width: 14px; height: 14px; left: 2253px; top: 1561px; display: block;">

<img src="https://media.memories.png" data-items="L:106|EE:8" data-pl="1" style="position: absolute; cursor: pointer; width: 14px; height: 14px; left: 2269px; top: 1561px; display: block;">

</div>
</code>```

I figured out how to select one of the above img tags by specified row and item number using the following xpath, but how can select three items in the row “EE” after selecting the number 3 from a drop-down menu?

```<code>Xpath=//img[@data-items = ' L:106|EE:8']
</code>```

Example Drop-down Menu:

<!DOCTYPE html>

<meta name="viewport" content="width=device-width, initial-scale=1">

Select Quantity

Move the mouse over the button to open the dropdown menu.

  <button class="dropbtn">Item Count</button>

     1
     2
     3

```

答:
You can make a list of all images and then iterate only 3 images using sublist. Please have a look on below code.

```<code>WebDriverWait wait = new WebDriverWait(driver, 40);
List<WebElement> allImages = driver.findElements(By.cssSelector("div#surface > img"));
for (WebElement image : allImages.subList(1, allImages.size()))
    wait.until(ExpectedConditions.elementToBeClickable(image));
    image.click();
</code>```

Body:
Image example:

As you can see from clicking the image example link above, “EE” is the row and “8” is the item number.
I would like to select three of the following four IMG tag items located in the same row and echo the result.

I figured out how to select one of the above img tags by specified row and item number using the following xpath, but how can select three items in the row “EE” after selecting the number 3 from a drop-down menu?

Xpath=//img[@data-items = ' L:106|EE:8']

Example Drop-down Menu:

<!DOCTYPE html>

<meta name="viewport" content="width=device-width, initial-scale=1">

Select Quantity

Move the mouse over the button to open the dropdown menu.

  <button class="dropbtn">Item Count</button>

     1
     2
     3

Body:
You can make a list of all images and then iterate only 3 images using sublist. Please have a look on below code.

WebDriverWait wait = new WebDriverWait(driver, 40);
List<WebElement> allImages = driver.findElements(By.cssSelector("div#surface > img"));
for (WebElement image : allImages.subList(1, allImages.size()))
    wait.until(ExpectedConditions.elementToBeClickable(image));
    image.click();


问:
Provide a new token based on the refresh token without going to the client - JWT - Asp.net core
I have found many links but I didn't get the solution for my problem.

I am trying to implement the jwt refresh token in asp.net core.

For storing the refresh token, I have created the table.
Based on the jwt suggestion, for SPA application, we should not expose refresh token to the client. https://auth0.com/blog/refresh-tokens-what-are-they-and-when-to-use-them/

So I have planned like,

On user login, create the access token and share to the client

Create a refresh token for the access token and store it in the database and store it in HTTP only cookie

When user access to the authorized controller and action, If access token expire, I want to generate new token based on refresh token.

But,
In many places, I have found like, user will send a request. If it is unauthorised, then user will request for the new access token with the stored refresh token (local storage or something else) and again call to the valid api request.

I don't want to that as mentioned in the last paragraph(is that right one?).

When user send a request, if it is invalid, I want to validate the token in the server side itself and need to provide new access token and proceed with the last api call.

Is there any solution for this implementation like interpreting the authorize and validate?

答:
In my opinion , it is dangerous to use/keep refresh token in SPA apps. Refresh token is powerful instrument , which is almost as powerful as the password itself . Store it in cookies or localStorage and both of these options are inherently insecure as they’re vulnerable to CSRF or XSS attacks against the client application . So i think it's better to just keep access token and do silent sign-in to renew it when access token expires.

So i don't think it's a good idea to return and use refresh token if client app is  SPA application even using Code + PKCE .


问:
Filter list of dicts based on some condition
I have following list

```<code>[
<class 'supapi.classes.Offer'>: {'currency': 'RUR', 'date_from': '2020-02-18', 'rub_value': '62.00'},
<class 'supapi.classes.Offer'>: {'currency': 'RUR', 'date_from': '2020-02-16', 'rub_value': '50.00'},
<class 'supapi.classes.Offer'>: {'currency': 'RUR', 'date_from': '2020-02-30', 'rub_value': '0.00'},
<class 'supapi.classes.Offer'>: {'currency': 'RUR', 'date_from': '2019-11-25', 'rub_value': '5.00'}
]
</code>```

I would like to filter that list based on last date condition and not future date.
For example, after filtration i want get only [<class 'supapi.classes.Offer'>: {'currency': 'RUR', 'date_from': '2020-02-18', 'rub_value': '62.00'}] because it's last current date and not future date

I figure out that i can compare date using datetime.datetime.strptime(date_string, '%Y-%m-%d')

答:
If you just want to get the objects with date_from set to the current date, you can create a string with the same format and compare them.

```<code>this_day = datetime.date.today().strftime('%Y-%m-%d')
result = filter(lambda e: e.date_from == this_day, offers_list)
</code>```

Updated answer

If you want the object with the newest date_from you could first filter the future values out with filter and the use max to find the correct one.

```<code>from datetime import datetime, date
result = filter(lambda e: datetime.strptime(e.date_from, '%Y-%m-%d').date() <= date.today() , offers_list)
value = max(result, key=lambda e: datetime.strptime(e.date_from, '%Y-%m-%d'))
</code>```

Body:
I have following list

[
<class 'supapi.classes.Offer'>: {'currency': 'RUR', 'date_from': '2020-02-18', 'rub_value': '62.00'},
<class 'supapi.classes.Offer'>: {'currency': 'RUR', 'date_from': '2020-02-16', 'rub_value': '50.00'},
<class 'supapi.classes.Offer'>: {'currency': 'RUR', 'date_from': '2020-02-30', 'rub_value': '0.00'},
<class 'supapi.classes.Offer'>: {'currency': 'RUR', 'date_from': '2019-11-25', 'rub_value': '5.00'}
]

I would like to filter that list based on last date condition and not future date.
For example, after filtration i want get only [<class 'supapi.classes.Offer'>: {'currency': 'RUR', 'date_from': '2020-02-18', 'rub_value': '62.00'}] because it's last current date and not future date

I figure out that i can compare date using datetime.datetime.strptime(date_string, '%Y-%m-%d')

Body:
If you just want to get the objects with date_from set to the current date, you can create a string with the same format and compare them.

this_day = datetime.date.today().strftime('%Y-%m-%d')
result = filter(lambda e: e.date_from == this_day, offers_list)

Updated answer

If you want the object with the newest date_from you could first filter the future values out with filter and the use max to find the correct one.

from datetime import datetime, date
result = filter(lambda e: datetime.strptime(e.date_from, '%Y-%m-%d').date() <= date.today() , offers_list)
value = max(result, key=lambda e: datetime.strptime(e.date_from, '%Y-%m-%d'))


问:
How can I compare two arrays that matchmake each other in random order
```<code>let courts = [
    // dynamic
    { courtID: 1, court: "Onzie" },
    { courtID: 2, court: "Twozie" },
    { courtID: 3, court: "Threezie" },
    { courtID: 4, court: "Fourzie" }
];

let players = [
    // dynamic
    { player: "Bengt", id: 1, court: null },
    { player: "Robin", id: 2, court: null },
    { player: "Phil", id: 3, court: null },
    { player: "Pontus", id: 4, court: null }
];
</code>```

How can i combine these two arrays so that the player(s) are randomly matched with a corresponding court?

答:
Live demo
https://runkit.com/embed/e67flbg3miew

Update: According to the changes of the OP, use below updated snippet:

```<code>const rand = max =>  Math.floor(Math.random() * Math.floor(max));
let one = courts [rand(courts.length -1)];
let two = players.find(item =>
              courts.map(entry => entry.court).includes(item.court));
let output = Object.assign(Object.assign({}, one), two);
</code>```

Original:

```<code>const rand = max =>  Math.floor(Math.random() * Math.floor(max));

let one = courts [rand(courts.length -1)];
let two = players [rand(players.length -1)];

let output = Object.assign ( Object.assign({}, one), two);
</code>```

Body:
let courts = [
    // dynamic
    { courtID: 1, court: "Onzie" },
    { courtID: 2, court: "Twozie" },
    { courtID: 3, court: "Threezie" },
    { courtID: 4, court: "Fourzie" }
];

let players = [
    // dynamic
    { player: "Bengt", id: 1, court: null },
    { player: "Robin", id: 2, court: null },
    { player: "Phil", id: 3, court: null },
    { player: "Pontus", id: 4, court: null }
];

How can i combine these two arrays so that the player(s) are randomly matched with a corresponding court?

Body:
Live demo
https://runkit.com/embed/e67flbg3miew

Update: According to the changes of the OP, use below updated snippet:

const rand = max =>  Math.floor(Math.random() * Math.floor(max));
let one = courts [rand(courts.length -1)];
let two = players.find(item =>
              courts.map(entry => entry.court).includes(item.court));
let output = Object.assign(Object.assign({}, one), two);

Original:

const rand = max =>  Math.floor(Math.random() * Math.floor(max));

let one = courts [rand(courts.length -1)];
let two = players [rand(players.length -1)];

let output = Object.assign ( Object.assign({}, one), two);


问:
Set build failed when espresso fails
Gradle sets the build to failed when unit test failed, but set BUILD SUCCESSFUL when instrumented test fails(espresso in my case) anybody know how to force build to fail when espresso failed?

Ops: need this to integrate with Jenkins, so it must failed when unit test and espresso test failed and don't want to use Jenkins Text-finder plugin.

答:
This solution works for me.
Add this code to UI Test class:

```<code>// Use this TestRule to setup IdlingResource
@Rule
@JvmField
val mIdlingResourceTestRule = CustomIdlingResTestRule()
</code>```

This is code of CustomIdlingResTestRule:

```<code>import androidx.test.espresso.IdlingPolicies
import androidx.test.espresso.IdlingRegistry
import com.jakewharton.espresso.OkHttp3IdlingResource
import com.kasikorn.retail.mbanking.kplus.basemodule.AppModule
import com.kasikorn.retail.mbanking.kplus.util.OkHttpProvider
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
import java.util.concurrent.TimeUnit

/**
 * TestRule class help to setup IdlingResource
 */
class CustomIdlingResTestRule : TestRule {
    protected var mIdlingResource: CustomIdlingResource = CustomIdlingResource()

    val idlingResourceOkHttp: OkHttp3IdlingResource by lazy {
        OkHttp3IdlingResource.create(AppModule.APP_CONTEXT, OkHttpProvider.getOkHttpInstance())
    }

    override fun apply(base: Statement?, description: Description?): Statement {
        return object : Statement() {
            override fun evaluate() {
                IdlingPolicies.setMasterPolicyTimeout(60, TimeUnit.SECONDS)
                IdlingPolicies.setIdlingResourceTimeout(26, TimeUnit.SECONDS)
                IdlingRegistry.getInstance().register(idlingResourceOkHttp, mIdlingResource)
                //NOTE: use try cache to ignore UI Test Failures
                try {
                    base?.evaluate()
                } catch (e: Throwable) {
                    e.printStackTrace()
                }

                IdlingRegistry.getInstance().unregister(idlingResourceOkHttp, mIdlingResource)
            }

        }
    }
}

import android.app.Activity
import android.util.Log
import androidx.test.espresso.IdlingResource
import androidx.test.espresso.core.internal.deps.guava.collect.Iterables
import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry
import androidx.test.runner.lifecycle.Stage

class CustomIdlingResource() : IdlingResource {
    private var mIsIdle = false
    private var resourceCallback: IdlingResource.ResourceCallback? = null

    override fun getName(): String = this.javaClass.simpleName

    override fun isIdleNow(): Boolean {
        if (mIsIdle) return true
        val currentActivity = getCurrentActivity()
        Log.d("LOG", this.javaClass.simpleName + " | isIdleNow() | currentActivity: $currentActivity")
        if (currentActivity != null) {
            mIsIdle = true
            resourceCallback?.onTransitionToIdle()
        }
        return mIsIdle
    }

    override fun registerIdleTransitionCallback(callback: IdlingResource.ResourceCallback?) {
        this.resourceCallback = callback
    }

    private fun getCurrentActivity(): Activity? {
        val activity = arrayOfNulls<Activity>(1)
        val activities: Collection<Activity> = ActivityLifecycleMonitorRegistry.getInstance().getActivitiesInStage(Stage.RESUMED)
        activity[0] = Iterables.getOnlyElement(activities)
        return activity[0]
    }
}
</code>```

ContentLicense: CC BY-SA 3.0

Title: Set build failed when espresso fails

Body:
This solution works for me.
Add this code to UI Test class:

// Use this TestRule to setup IdlingResource
@Rule
@JvmField
val mIdlingResourceTestRule = CustomIdlingResTestRule()

This is code of CustomIdlingResTestRule:

import androidx.test.espresso.IdlingPolicies
import androidx.test.espresso.IdlingRegistry
import com.jakewharton.espresso.OkHttp3IdlingResource
import com.kasikorn.retail.mbanking.kplus.basemodule.AppModule
import com.kasikorn.retail.mbanking.kplus.util.OkHttpProvider
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
import java.util.concurrent.TimeUnit

/**
 * TestRule class help to setup IdlingResource
 */
class CustomIdlingResTestRule : TestRule {
    protected var mIdlingResource: CustomIdlingResource = CustomIdlingResource()

    val idlingResourceOkHttp: OkHttp3IdlingResource by lazy {
        OkHttp3IdlingResource.create(AppModule.APP_CONTEXT, OkHttpProvider.getOkHttpInstance())
    }

    override fun apply(base: Statement?, description: Description?): Statement {
        return object : Statement() {
            override fun evaluate() {
                IdlingPolicies.setMasterPolicyTimeout(60, TimeUnit.SECONDS)
                IdlingPolicies.setIdlingResourceTimeout(26, TimeUnit.SECONDS)
                IdlingRegistry.getInstance().register(idlingResourceOkHttp, mIdlingResource)
                //NOTE: use try cache to ignore UI Test Failures
                try {
                    base?.evaluate()
                } catch (e: Throwable) {
                    e.printStackTrace()
                }

                IdlingRegistry.getInstance().unregister(idlingResourceOkHttp, mIdlingResource)
            }

        }
    }
}

import android.app.Activity
import android.util.Log
import androidx.test.espresso.IdlingResource
import androidx.test.espresso.core.internal.deps.guava.collect.Iterables
import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry
import androidx.test.runner.lifecycle.Stage

class CustomIdlingResource() : IdlingResource {
    private var mIsIdle = false
    private var resourceCallback: IdlingResource.ResourceCallback? = null

    override fun getName(): String = this.javaClass.simpleName

    override fun isIdleNow(): Boolean {
        if (mIsIdle) return true
        val currentActivity = getCurrentActivity()
        Log.d("LOG", this.javaClass.simpleName + " | isIdleNow() | currentActivity: $currentActivity")
        if (currentActivity != null) {
            mIsIdle = true
            resourceCallback?.onTransitionToIdle()
        }
        return mIsIdle
    }

    override fun registerIdleTransitionCallback(callback: IdlingResource.ResourceCallback?) {
        this.resourceCallback = callback
    }

    private fun getCurrentActivity(): Activity? {
        val activity = arrayOfNulls<Activity>(1)
        val activities: Collection<Activity> = ActivityLifecycleMonitorRegistry.getInstance().getActivitiesInStage(Stage.RESUMED)
        activity[0] = Iterables.getOnlyElement(activities)
        return activity[0]
    }
}


问:
UITableView load more when scrolling to bottom like Facebook application
I am developing an application that uses SQLite. I want to show a list of users (UITableView) using a paginating mechanism. Could any one please tell me how to load more data in my list when the user scrolls to the end of the list (like on home page on Facebook application)? </p>

答:
Details

Swift 5.1, Xcode 11.3.1

Solution

Generic UITableView Extension For Loadmore.

add this UITableView + Extension in your new file

```<code>extension UITableView {

func indicatorView() -> UIActivityIndicatorView{
    var activityIndicatorView = UIActivityIndicatorView()
    if self.tableFooterView == nil {
        let indicatorFrame = CGRect(x: 0, y: 0, width: self.bounds.width, height: 80)
        activityIndicatorView = UIActivityIndicatorView(frame: indicatorFrame)
        activityIndicatorView.autoresizingMask = [.flexibleLeftMargin, .flexibleRightMargin]

        if #available(iOS 13.0, *) {
            activityIndicatorView.style = .large
        } else {
            // Fallback on earlier versions
            activityIndicatorView.style = .whiteLarge
        }

        activityIndicatorView.color = .systemPink
        activityIndicatorView.hidesWhenStopped = true

        self.tableFooterView = activityIndicatorView
        return activityIndicatorView
    }
    else {
        return activityIndicatorView
    }
}

func addLoading(_ indexPath:IndexPath, closure: @escaping (() -> Void)){
    indicatorView().startAnimating()
    if let lastVisibleIndexPath = self.indexPathsForVisibleRows?.last {
        if indexPath == lastVisibleIndexPath && indexPath.row == self.numberOfRows(inSection: 0) - 1 {
            DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
                closure()
            }
        }
    }
}

func stopLoading() {
    if self.tableFooterView != nil {
        self.indicatorView().stopAnimating()
        self.tableFooterView = nil
    }
    else {
        self.tableFooterView = nil
    }
}
}
</code>```

Now, just add following line of code in UITableViewDelegate Method willDisplay Cell in your ViewController and make sure tableView.delegate = self

```<code>func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
    // need to pass your indexpath then it showing your indicator at bottom
    tableView.addLoading(indexPath) {
        // add your code here
        // append Your array and reload your tableview
        tableView.stopLoading() // stop your indicator
    }
}
</code>```

Result

That's it.. Hope this helpful. Thank You

Body:
Details

Swift 5.1, Xcode 11.3.1

Solution

Generic UITableView Extension For Loadmore.

add this UITableView + Extension in your new file

extension UITableView {

func indicatorView() -> UIActivityIndicatorView{
    var activityIndicatorView = UIActivityIndicatorView()
    if self.tableFooterView == nil {
        let indicatorFrame = CGRect(x: 0, y: 0, width: self.bounds.width, height: 80)
        activityIndicatorView = UIActivityIndicatorView(frame: indicatorFrame)
        activityIndicatorView.autoresizingMask = [.flexibleLeftMargin, .flexibleRightMargin]

        if #available(iOS 13.0, *) {
            activityIndicatorView.style = .large
        } else {
            // Fallback on earlier versions
            activityIndicatorView.style = .whiteLarge
        }

        activityIndicatorView.color = .systemPink
        activityIndicatorView.hidesWhenStopped = true

        self.tableFooterView = activityIndicatorView
        return activityIndicatorView
    }
    else {
        return activityIndicatorView
    }
}

func addLoading(_ indexPath:IndexPath, closure: @escaping (() -> Void)){
    indicatorView().startAnimating()
    if let lastVisibleIndexPath = self.indexPathsForVisibleRows?.last {
        if indexPath == lastVisibleIndexPath && indexPath.row == self.numberOfRows(inSection: 0) - 1 {
            DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
                closure()
            }
        }
    }
}

func stopLoading() {
    if self.tableFooterView != nil {
        self.indicatorView().stopAnimating()
        self.tableFooterView = nil
    }
    else {
        self.tableFooterView = nil
    }
}
}

Now, just add following line of code in UITableViewDelegate Method willDisplay Cell in your ViewController and make sure tableView.delegate = self

func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
    // need to pass your indexpath then it showing your indicator at bottom
    tableView.addLoading(indexPath) {
        // add your code here
        // append Your array and reload your tableview
        tableView.stopLoading() // stop your indicator
    }
}

Result

That's it.. Hope this helpful. Thank You


问:
Inheriting and overriding ostream operator in C++
I've been trying to find an answer to this, but no one seems to have exactly the same problem as I do.

I am working with several derived classes. The ostream operator << for each of these should print out some things common to each, and some things specific to each.  Later on, I would like to further derive from these derived classes, and again the new derived classes need to print out some things that are in the "generations" above them.

For example:

The Base class .h file

```<code>class Base

{

 int FirstClassNumber;

//The declaration I'm currently working with, that a friend gave me
//I'm pretty sure my problem lies here.

public:

friend ostream& operator << (ostream& os, const Base &base)
{
    base << os ;

    return os;
}

virtual void operator << (ostream& os) const = 0;

};
</code>```

The Base.cpp file includes these lines:

```<code>void Base::operator << (ostream& os)
{
  os << FirstClassNumber;
}
</code>```

Then I derive: (FirstDerived.h)

```<code>class FirstDerived : Public Base

{

int SecondClassNumber;

};
</code>```

FirstDerived.cpp:

```<code>FirstDerived::operator << (ostream& os)
{
  os <<

  "The first Number is:

 //This is the line that isn't working - someone else gave me this syntax

  << Base::operator<<

  << "The second number is"

  << SecondClassNumber;
}
</code>```

Then I want to derive:

```<code>class SecondDerived: Public FirstDerived
{

int ThirdClassNumber;

};
</code>```

Second.cpp:

```<code>FirstDerived::operator << (ostream& os)
{
  os <<

 FirstDerived::operator<<

 << "The third number is "

 << ThirdClassNumber;

 }
</code>```

I think the problem is most likely either the declaration in the very start of the program, or the lines like Base::operator<<.

Another possibility is that I'm not redeclaring it in the .h file of every inherited class.  Should I be, and if so what syntax should I use?

It was suggested to me to use the static_cast method, but my professor (the one who wrote the assignment, and therefore won't give us too much help with it) said that there's a better way to do it.  Any suggestions?

答:
A simple technique for this is:</p>

```<code>class Base
{
    int FirstClassNumber;

    public:
        virtual void serialize(ostream& os) const
        {
             os << FirstClassNumber;
        }
};

// Implement the stream operator for the base class.
// All it does is call erialize which is a virtual method that
// will call the most derived version.
ostream& operator << (ostream& os, const Base &base)
{
    base.serialize(os);

    return os;
}

class FirstDerived:public Base
{
    int SecondClassNumber;

    public:
        // Override serialize to make it call the base version.
        // Then output any local data.
        virtual void serialize(ostream& os) const
        {
             Base::serialize(os);
             os << SecondClassNumber;
        }
};
</code>```

Body:
I've been trying to find an answer to this, but no one seems to have exactly the same problem as I do.

I am working with several derived classes. The ostream operator << for each of these should print out some things common to each, and some things specific to each.  Later on, I would like to further derive from these derived classes, and again the new derived classes need to print out some things that are in the "generations" above them.

For example:

The Base class .h file

class Base

{

 int FirstClassNumber;

//The declaration I'm currently working with, that a friend gave me
//I'm pretty sure my problem lies here.

public:

friend ostream& operator << (ostream& os, const Base &base)
{
    base << os ;

    return os;
}

virtual void operator << (ostream& os) const = 0;

};

The Base.cpp file includes these lines:

void Base::operator << (ostream& os)
{
  os << FirstClassNumber;
}

Then I derive: (FirstDerived.h)

class FirstDerived : Public Base

{

int SecondClassNumber;

};

FirstDerived.cpp:

FirstDerived::operator << (ostream& os)
{
  os <<

  "The first Number is:

 //This is the line that isn't working - someone else gave me this syntax

  << Base::operator<<

  << "The second number is"

  << SecondClassNumber;
}

Then I want to derive:

class SecondDerived: Public FirstDerived
{

int ThirdClassNumber;

};

Second.cpp:

FirstDerived::operator << (ostream& os)
{
  os <<

 FirstDerived::operator<<

 << "The third number is "

 << ThirdClassNumber;

 }

I think the problem is most likely either the declaration in the very start of the program, or the lines like Base::operator<<.

Another possibility is that I'm not redeclaring it in the .h file of every inherited class.  Should I be, and if so what syntax should I use?

It was suggested to me to use the static_cast method, but my professor (the one who wrote the assignment, and therefore won't give us too much help with it) said that there's a better way to do it.  Any suggestions?

Body:
A simple technique for this is:

class Base
{
    int FirstClassNumber;

    public:
        virtual void serialize(ostream& os) const
        {
             os << FirstClassNumber;
        }
};

// Implement the stream operator for the base class.
// All it does is call erialize which is a virtual method that
// will call the most derived version.
ostream& operator << (ostream& os, const Base &base)
{
    base.serialize(os);

    return os;
}

class FirstDerived:public Base
{
    int SecondClassNumber;

    public:
        // Override serialize to make it call the base version.
        // Then output any local data.
        virtual void serialize(ostream& os) const
        {
             Base::serialize(os);
             os << SecondClassNumber;
        }
};


问:
SOLR: How to get record with added on today's date in solr query
I'm Inserting and updating records in SOLR on a daily basis.

I want to get only today's records from solr.

I checked for range query ProductAddedOn:[NOW-1DAY TO NOW]

But it gives records from yesterday to today. I need only today's records.

答:
Try with ProductAddedOn: [2020-02-18T00:00:00Z TO 2020-02-18T23:59:59Z].

This would give you the expected result.


问:
How to use Azure function V3 with Entity Framework 6 (exception System.Data.SqlClient: System.Data.SqlClient is not supported on this platform)?
I have an Azure V3 app that must call DAL repos built on Entity Framework 6.4
On database initialize I am getting an exception:

System.Data.SqlClient: System.Data.SqlClient is not supported on this platform

That is coming from: System.Data.SqlClient 4.8

```<code>public sealed partial class SqlConnection : System.Data.Common.DbConnection, System.ICloneable
{
    public SqlConnection()
    {
        throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_DataSqlClient)
    }
}
</code>```

In similar threads the resolution was to downgrade System.Data.SqlClient to version 4.5.1, but in my case the dependency being added by Entity Framework.

Anyone having an idea if it is possible to use Entity Framework 6.4 in Azure function V3 app?

答:
It seems that it's still a .NET Core 3.0 SDK bug and the following is workaround you could refer to.

Right click on Function project and edit <FunctionAppName>.csproj, add items below to copy related assemblies to output dir.

```<code><ItemGroup>
    <None Include="$(USERPROFILE)\.nuget\packages\system.data.sqlclient\4.6.0\runtimes\win\lib\netcoreapp2.1\System.Data.SqlClient.dll">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
</ItemGroup>
</code>```

If you'd like to stilluse the .NET Core 3.0 SDK, or need this fix for Functions v3 as well:

```<code>  <Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <!-- https://github.com/Azure/azure-functions-host/issues/3568#issuecomment-461182536 -->
    <Exec Command="copy $(OutDir)$(ProjectName).deps.json $(OutDir)bin\function.deps.json" />
  </Target>
  <Target Name="PostPublish" BeforeTargets="Publish">
    <!-- https://github.com/Azure/azure-functions-host/issues/3568#issuecomment-461182536 -->
    <Exec Command="copy $(PublishDir)$(ProjectName).deps.json $(PublishDir)bin\function.deps.json" />
    <!-- https://github.com/Azure/azure-functions-vs-build-sdk/issues/333 -->
    <Exec Command="move $(PublishDir)\runtimes $(PublishDir)\bin" />
  </Target>
</code>```

Body:
I have an Azure V3 app that must call DAL repos built on Entity Framework 6.4
On database initialize I am getting an exception:

System.Data.SqlClient: System.Data.SqlClient is not supported on this platform

That is coming from: System.Data.SqlClient 4.8

public sealed partial class SqlConnection : System.Data.Common.DbConnection, System.ICloneable
{
    public SqlConnection()
    {
        throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_DataSqlClient)
    }
}

In similar threads the resolution was to downgrade System.Data.SqlClient to version 4.5.1, but in my case the dependency being added by Entity Framework.

Anyone having an idea if it is possible to use Entity Framework 6.4 in Azure function V3 app?

Body:
It seems that it's still a .NET Core 3.0 SDK bug and the following is workaround you could refer to.

Right click on Function project and edit <FunctionAppName>.csproj, add items below to copy related assemblies to output dir.

<ItemGroup>
    <None Include="$(USERPROFILE)\.nuget\packages\system.data.sqlclient\4.6.0\runtimes\win\lib\netcoreapp2.1\System.Data.SqlClient.dll">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
</ItemGroup>

If you'd like to stilluse the .NET Core 3.0 SDK, or need this fix for Functions v3 as well:

  <Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <!-- https://github.com/Azure/azure-functions-host/issues/3568#issuecomment-461182536 -->
    <Exec Command="copy $(OutDir)$(ProjectName).deps.json $(OutDir)bin\function.deps.json" />
  </Target>
  <Target Name="PostPublish" BeforeTargets="Publish">
    <!-- https://github.com/Azure/azure-functions-host/issues/3568#issuecomment-461182536 -->
    <Exec Command="copy $(PublishDir)$(ProjectName).deps.json $(PublishDir)bin\function.deps.json" />
    <!-- https://github.com/Azure/azure-functions-vs-build-sdk/issues/333 -->
    <Exec Command="move $(PublishDir)\runtimes $(PublishDir)\bin" />
  </Target>


问:
Calculate date time duration with condition
I want to calculate DateTime duration with condition : IF "STATUSIN" > 08:00:00 then "LATECOME" = "STATUSIN" - 08.00.00
and I've been trying this code but it's doesn't work.

```<code>DataTable dtDaily = new DataTable();
string time1 = "08:00:00";
var result = Convert.ToDateTime(time1);
string test = result.ToString("hh:mm:ss");

foreach (DataRow pRow in dtDaily.Rows)
{
   DateTime.ParseExact(pRow["STATUSIN"].ToString(), "hh:mm:ss", CultureInfo.InvariantCulture);
   if (pRow["STATUSIN"] > time1)
   {
      pRow["LATECOME"] = pRow["STATUSIN"] - time1.ToString();
   }
}
</code>```

This is my code to display the value in table:

```<code><asp:Repeater ID="rptrSUMMARYDATA" runat="server">
    <HeaderTemplate>
        <table class="table">
            <thead>
                <tr>
                    <th>IN</th>
                    <th>LATECOME</th>
                </tr>
            </thead>
            <tbody>
    </HeaderTemplate>
    <ItemTemplate>
        <tr>
            <td><%# Eval("STATUSIN") %></td>
            <td><%# Eval("LATECOME") %></td>
        </tr>
    </ItemTemplate>
    <FooterTemplate>
            </tbody>
        </table>
    </FooterTemplate>
</asp:Repeater>
</code>```

答:
Change Code

```<code> string time1 = "08:00:00";
DateTime.ParseExact(pRow["STATUSIN"].ToString(), "hh:mm:ss", CultureInfo.InvariantCulture);
if (pRow["STATUSIN"] > time1)
{
    pRow["LATECOME"] = pRow["STATUSIN"] - time1.ToString();
}
</code>```

Replace Code

```<code>DateTime time1 = DateTime.Parse("08:00:00");
 Datetime d=DateTime.ParseExact(pRow["STATUSIN"].ToString(), "hh:mm:ss", CultureInfo.InvariantCulture);
   if (d > time1)
   {
      pRow["LATECOME"] =d - time1.ToString();
   }
</code>```

Body:
I want to calculate DateTime duration with condition : IF "STATUSIN" > 08:00:00 then "LATECOME" = "STATUSIN" - 08.00.00
and I've been trying this code but it's doesn't work.

DataTable dtDaily = new DataTable();
string time1 = "08:00:00";
var result = Convert.ToDateTime(time1);
string test = result.ToString("hh:mm:ss");

foreach (DataRow pRow in dtDaily.Rows)
{
   DateTime.ParseExact(pRow["STATUSIN"].ToString(), "hh:mm:ss", CultureInfo.InvariantCulture);
   if (pRow["STATUSIN"] > time1)
   {
      pRow["LATECOME"] = pRow["STATUSIN"] - time1.ToString();
   }
}

This is my code to display the value in table:

<asp:Repeater ID="rptrSUMMARYDATA" runat="server">
    <HeaderTemplate>

                    IN
                    LATECOME

    </HeaderTemplate>
    <ItemTemplate>

            <%# Eval("STATUSIN") %>
            <%# Eval("LATECOME") %>

    </ItemTemplate>
    <FooterTemplate>

    </FooterTemplate>
</asp:Repeater>

Body:
Change Code

 string time1 = "08:00:00";
DateTime.ParseExact(pRow["STATUSIN"].ToString(), "hh:mm:ss", CultureInfo.InvariantCulture);
if (pRow["STATUSIN"] > time1)
{
    pRow["LATECOME"] = pRow["STATUSIN"] - time1.ToString();
}

Replace Code

DateTime time1 = DateTime.Parse("08:00:00");
 Datetime d=DateTime.ParseExact(pRow["STATUSIN"].ToString(), "hh:mm:ss", CultureInfo.InvariantCulture);
   if (d > time1)
   {
      pRow["LATECOME"] =d - time1.ToString();
   }


问:
Use pk from url in django form
In my django app I have a table which contains a button that redirects you to a form like this:

```<code><a href="{% url 'employee:delivered_docket_form' docket.pk %}" class="btn btn-primary">Create Delivered Docket</a>
</code>```

Urls.py

```<code>path('delivered-docket/add/<int:pk>/', DeliveredDocketFormView.as_view(),
                                        name='delivered_docket_form')
</code>```

Views.py

```<code>@method_decorator([login_required, employee_required], name='dispatch')
class DeliveredDocketFormView(CreateView):
    model = DeliveredDocket
    form_class = DeliveredDocketeditform
    template_name = 'packsapp/employee/docketDeliveredForm.html'

    def form_valid (self, form):
        product = form.save(commit=False)
        product.save()
        data = form.cleaned_data
        print("form data is ", data)
        print("pk is ",self.kwargs['pk'])
        messages.success(self.request, 'The Delivered Docket was created with success!')
        return redirect('employee:delivered_docket_table')
</code>```

I am able to access the pk in the views function by self.kwargs['pk'] but how can I access it in the formclass. Here's my form

Forms.py

```<code>class DeliveredDocketeditform(forms.ModelForm):
    class Meta:
        model = DeliveredDocket
        fields = '__all__'
</code>```

What I want to add in the form is something like this:

```<code>class DeliveredDocketeditform(forms.ModelForm):
    class Meta:
        model = DeliveredDocket
        fields = '__all__'

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields['sender'].queryset = Warehouse.objects.id(id = ??)
</code>```

How do I get pk to this query ??

答:
You can override get_initial method  in your view to pass initial data to the form:

```<code>class DeliveredDocketFormView(CreateView):
    model = DeliveredDocket
    form_class = DeliveredDocketeditform
    template_name = 'packsapp/employee/docketDeliveredForm.html'

    def get_initial(self):
        initial = super().get_initial()
        initial['sender'] = Warehouse.objects.get(pk=self.kwargs['pk'])
        return initial
</code>```

Title: Use pk from url in django form

Body:
In my django app I have a table which contains a button that redirects you to a form like this:

Create Delivered Docket

Urls.py

path('delivered-docket/add/<int:pk>/', DeliveredDocketFormView.as_view(),
                                        name='delivered_docket_form')

Views.py

@method_decorator([login_required, employee_required], name='dispatch')
class DeliveredDocketFormView(CreateView):
    model = DeliveredDocket
    form_class = DeliveredDocketeditform
    template_name = 'packsapp/employee/docketDeliveredForm.html'

    def form_valid (self, form):
        product = form.save(commit=False)
        product.save()
        data = form.cleaned_data
        print("form data is ", data)
        print("pk is ",self.kwargs['pk'])
        messages.success(self.request, 'The Delivered Docket was created with success!')
        return redirect('employee:delivered_docket_table')

I am able to access the pk in the views function by self.kwargs['pk'] but how can I access it in the formclass. Here's my form

Forms.py

class DeliveredDocketeditform(forms.ModelForm):
    class Meta:
        model = DeliveredDocket
        fields = '__all__'

What I want to add in the form is something like this:

class DeliveredDocketeditform(forms.ModelForm):
    class Meta:
        model = DeliveredDocket
        fields = '__all__'

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields['sender'].queryset = Warehouse.objects.id(id = ??)

How do I get pk to this query ??

Body:
You can override get_initial method  in your view to pass initial data to the form:

class DeliveredDocketFormView(CreateView):
    model = DeliveredDocket
    form_class = DeliveredDocketeditform
    template_name = 'packsapp/employee/docketDeliveredForm.html'

    def get_initial(self):
        initial = super().get_initial()
        initial['sender'] = Warehouse.objects.get(pk=self.kwargs['pk'])
        return initial


问:
Which alternative to choose for a database redesign (sports stats, competitions, geographic scopes)?
I'm extending a database, which is about sports stats. The different leagues, or more precisely "competitions", can be represented by a tree structure analogous to certain geographic areas (scope/range of participating teams):

```
 1. Continent Competition    (continent)
                                  ↑
 2. Country Competition       (country)
                                  ↑
 3. Region Competition        (region)
                                  ↑
 4. State Competition          (state)
                                  ↑
 5. District Competition     (district)
```

(The arrows represent the FKs to the parent geo area entity (tree structure).)

Here' the design visually:

(source: kawoolutions.com)

I created a hierarchy of "geo areas" basically just to implement the scoped competitions hierarchy. Each competition entity has a reference to a geo area, e.g. each state knows its (sub-country) region (parent_id).

Each geo area - competition combination encapsulates three pieces of information: competition type (league, cup, playoffs, ...), geo area type (the scope of participating teams!), and geo area name.

Here are the competitions I wanted to insert into the DB:

```<code>INSERT INTO Competitions (geo_area_id, type, label) VALUES ( 88, 'league', 'Deutsche Meisterschaft');         -- 'Country Championships Germany'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (248, 'league', 'Regionalmeisterschaft Nord');     -- 'Region Championships North'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (249, 'league', 'Regionalmeisterschaft West');     -- 'Region Championships West'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (250, 'league', 'Regionalmeisterschaft Sued');     -- 'Region Championships South'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (251, 'league', 'Regionalmeisterschaft Ost');      -- 'Region Championships East'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (258, 'league', 'Landesmeisterschaft Hessen');     -- 'State Championships Hesse'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (268, 'league', 'Bezirksmeisterschaft Darmstadt'); -- 'District Championships Darmstadt'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (269, 'league', 'Bezirksmeisterschaft Frankfurt'); -- 'District Championships Frankfurt'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (270, 'league', 'Bezirksmeisterschaft Giessen');   -- 'District Championships Giessen'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (271, 'league', 'Bezirksmeisterschaft Kassel');    -- 'District Championships Kassel'

INSERT INTO Competitions (geo_area_id, type, label) VALUES ( 88, 'cup', 'DBB Pokal');              -- 'Country Cup Germany'
-- INSERT INTO Competitions (geo_area_id, type, label) VALUES (250, 'cup', 'Regionenpokal Süd');      -- 'Region Cup South' => DOESN'T EXIST IN REALITY!
INSERT INTO Competitions (geo_area_id, type, label) VALUES (258, 'cup', 'Landespokal Hessen');     -- 'State Cup Hessen'  => PROBLEM HERE! parent should be country cup Germany, but it points to Region South due to the geo areas nature
INSERT INTO Competitions (geo_area_id, type, label) VALUES (268, 'cup', 'Bezirkspokal Darmstadt'); -- 'District Cup Darmstadt'
</code>```

For the regular-season competitions (leagues) this works pretty well (top entities), however, on the second to last insert into the Competitions table I realized a problem that I hadn't foreseen:

There are competitions for which the "parent competition" - as determined by the geo area parent - doesn't exist. Example: the qualifying teams of the German cup competition for each state go directly to country level, because there is no such thing as a "German regional cup" competition.

By their logic, looking at the geo areas isolated from the competitions, the geo areas themselves are represented correctly I'd say. It's just that competitions sometimes seem to "skip" geo areas. Nothing unsolvable of course, but how do I best adapt to this situation now?

The alternatives that come to my mind:

Enter a dummy cup competition for each region. The Competitions table then needs a BOOLEAN is_dummy column or similar. At runtime this flag had to be checked and if it's a dummy that geo area's parent is returned (possible recursively until a geoa area is found or NULL is returned).

Add another optional parent_geo_area_id to Competitions. At runtime this field is checked: if it has non-NULL value, use that one to return the parent geo area (parent override field), if not use the "normal" geo area reference's parent.
The problem with this approach is that the Competitions table already has a foreign key to GeoAreas and that adding another would basically represent a "repeated column" - wouldn't it? Wouldn't this cause a conditional join later on? Is it possible?

Both add redundancy to a certain degree, but I'm not sure how to do it without as the "competitions skip problem" itself causes it.

Maybe other alternatives exist? If not, which alternative would you suggest and why?

Thanks!

答:
It's just that competitions sometimes
  seem to "skip" geo areas. Nothing
  unsolvable of course, but how do I
  best adapt to this situation now?

Model the way the real world works.

Don't adapt a model that you already know doesn't work.

Body:
I'm extending a database, which is about sports stats. The different leagues, or more precisely "competitions", can be represented by a tree structure analogous to certain geographic areas (scope/range of participating teams):

 1. Continent Competition    (continent)
                                  ↑
 2. Country Competition       (country)
                                  ↑
 3. Region Competition        (region)
                                  ↑
 4. State Competition          (state)
                                  ↑
 5. District Competition     (district)

(The arrows represent the FKs to the parent geo area entity (tree structure).)

Here' the design visually:

(source: kawoolutions.com)

I created a hierarchy of "geo areas" basically just to implement the scoped competitions hierarchy. Each competition entity has a reference to a geo area, e.g. each state knows its (sub-country) region (parent_id).

Each geo area - competition combination encapsulates three pieces of information: competition type (league, cup, playoffs, ...), geo area type (the scope of participating teams!), and geo area name.

Here are the competitions I wanted to insert into the DB:

INSERT INTO Competitions (geo_area_id, type, label) VALUES ( 88, 'league', 'Deutsche Meisterschaft');         -- 'Country Championships Germany'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (248, 'league', 'Regionalmeisterschaft Nord');     -- 'Region Championships North'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (249, 'league', 'Regionalmeisterschaft West');     -- 'Region Championships West'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (250, 'league', 'Regionalmeisterschaft Sued');     -- 'Region Championships South'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (251, 'league', 'Regionalmeisterschaft Ost');      -- 'Region Championships East'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (258, 'league', 'Landesmeisterschaft Hessen');     -- 'State Championships Hesse'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (268, 'league', 'Bezirksmeisterschaft Darmstadt'); -- 'District Championships Darmstadt'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (269, 'league', 'Bezirksmeisterschaft Frankfurt'); -- 'District Championships Frankfurt'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (270, 'league', 'Bezirksmeisterschaft Giessen');   -- 'District Championships Giessen'
INSERT INTO Competitions (geo_area_id, type, label) VALUES (271, 'league', 'Bezirksmeisterschaft Kassel');    -- 'District Championships Kassel'

INSERT INTO Competitions (geo_area_id, type, label) VALUES ( 88, 'cup', 'DBB Pokal');              -- 'Country Cup Germany'
-- INSERT INTO Competitions (geo_area_id, type, label) VALUES (250, 'cup', 'Regionenpokal Süd');      -- 'Region Cup South' => DOESN'T EXIST IN REALITY!
INSERT INTO Competitions (geo_area_id, type, label) VALUES (258, 'cup', 'Landespokal Hessen');     -- 'State Cup Hessen'  => PROBLEM HERE! parent should be country cup Germany, but it points to Region South due to the geo areas nature
INSERT INTO Competitions (geo_area_id, type, label) VALUES (268, 'cup', 'Bezirkspokal Darmstadt'); -- 'District Cup Darmstadt'

For the regular-season competitions (leagues) this works pretty well (top entities), however, on the second to last insert into the Competitions table I realized a problem that I hadn't foreseen:

There are competitions for which the "parent competition" - as determined by the geo area parent - doesn't exist. Example: the qualifying teams of the German cup competition for each state go directly to country level, because there is no such thing as a "German regional cup" competition.

By their logic, looking at the geo areas isolated from the competitions, the geo areas themselves are represented correctly I'd say. It's just that competitions sometimes seem to "skip" geo areas. Nothing unsolvable of course, but how do I best adapt to this situation now?

The alternatives that come to my mind:

Enter a dummy cup competition for each region. The Competitions table then needs a BOOLEAN is_dummy column or similar. At runtime this flag had to be checked and if it's a dummy that geo area's parent is returned (possible recursively until a geoa area is found or NULL is returned).

Add another optional parent_geo_area_id to Competitions. At runtime this field is checked: if it has non-NULL value, use that one to return the parent geo area (parent override field), if not use the "normal" geo area reference's parent.
The problem with this approach is that the Competitions table already has a foreign key to GeoAreas and that adding another would basically represent a "repeated column" - wouldn't it? Wouldn't this cause a conditional join later on? Is it possible?

Both add redundancy to a certain degree, but I'm not sure how to do it without as the "competitions skip problem" itself causes it.

Maybe other alternatives exist? If not, which alternative would you suggest and why?

Thanks!


问:
Active Record query for update between two ids in YII2 without using row query
I am noob in the YII2.
I am searching for an update query using Active Record in Yii2.
I need to update some record which are between two ids.

The Query:

```<code>UPDATE
table_name
SET status_name = 1
WHERE
id BETWEEN 1 AND 10;
</code>```

What I have tried in Active Record:

```<code>$command = Yii::$app->db->createCommand('UPDATE table_name SET status_name = 1 WHERE id BETWEEN 1 AND 10 ');
$command->execute();
</code>```

But I need Activerecord query without using row SQL queries.

答:
You can use static updateAll method from Active Record:

```<code>TableName::updateAll(['status_name' => 1], 'id BETWEEN 1 AND 10');
</code>```

Or query builder:

```<code>Yii::$app->db
    ->createCommand()
    ->update(
        'table_name',
        ['status_name' => 1],
        'id BETWEEN 1 AND 10'
    )
    ->execute();
</code>```

Body:
I am noob in the YII2.
I am searching for an update query using Active Record in Yii2.
I need to update some record which are between two ids.

The Query:

UPDATE
table_name
SET status_name = 1
WHERE
id BETWEEN 1 AND 10;

What I have tried in Active Record:

$command = Yii::$app->db->createCommand('UPDATE table_name SET status_name = 1 WHERE id BETWEEN 1 AND 10 ');
$command->execute();

But I need Activerecord query without using row SQL queries.

Body:
You can use static updateAll method from Active Record:

TableName::updateAll(['status_name' => 1], 'id BETWEEN 1 AND 10');

Or query builder:

Yii::$app->db
    ->createCommand()
    ->update(
        'table_name',
        ['status_name' => 1],
        'id BETWEEN 1 AND 10'
    )
    ->execute();


问:
How to correctly replace line in text from a referenced line
I have written some code to take in users and assign tasks to them using a text file. The problem I am having is as the user inputs a task number to edit, but I don't know how to replace the line of text 12 lines above the task number that is input and this replaces the username. If there are two tasks in the text file I need to be able to use the task number line as a reference point and then replace the 12th line above that to a new username. So I basically need to replace the 12th line above the users input for every task.
I have written some code to just replace the name but its erasing my whole text file.

Example of text file: (tasks.txt)

User assigned to task:

jack

Task Title :

Fly

Task Description:

Fly to the moon

Task Due Date:

2020-02-20
  Date Assigned:

2020-02-18

Task Completed:

No

Task number:

1

The code of the effected block so far is:

```<code>with open('tasks.txt') as xxaz:
                 main2 = "Task number:" + "\n" + str(review)
                 aa = xxaz.read()
                 if main2 in aa:
                         print(str(main2) + "\n")
                         edit = input("Enter ""1"" to edit the user assigned to task, ""2"" to change the due date or ""3"" to change the completion status.\n")
                         if edit == "1":
                             new_name = input("Please enter a new user name")
                             lines = open('tasks.txt').read().splitlines()
                             lines[2] = new_name
                             open('tasks.txt','w').write
</code>```

答:
Here is the solution if you want to continue with your same approach:

Tasks.txt:

```<code>User assigned to task:
jack
Task Title :
Fly
Task Description:
Fly to the moon
Task Due Date:
2020-02-20 Date Assigned:
2020-02-18
Task Completed:
No
Task number:
1
User assigned to task:
qwe
Task Title :
Fly
Task Description:
Fly to the moon
Task Due Date:
2020-02-20 Date Assigned:
2020-02-18
Task Completed:
No
Task number:
2
</code>```

Code:-

```<code>with open(r"C:\Users\xyz\Desktop\Tasks.txt","r+") as xxaz:
    main2 = "Task number:" + "\n" + str(2)
    if main2 in xxaz.read():
        edit = input("Enter ""1"" to edit the user assigned to task, ""2"" to change the due date or ""3"" to change the completion status.")
        if edit == "1":
            xxaz.seek(0)
            taskLines = xxaz.readlines()
            new_name = input("Please enter a new user name: ")
            for i in taskLines:
                if i == ('Task number:\n'):
                    indexVal = taskLines.index('Task number:\n')
                    taskLines.insert(indexVal,taskLines[indexVal]+taskLines[indexVal+1])
                    taskLines.pop(indexVal+1)
                    taskLines.pop(indexVal+1)
            indexVal = taskLines.index(main2.strip())
            taskLines.pop(indexVal-10)
            taskLines.insert(indexVal-10,new_name+'\n')
            xxaz.seek(0)
        xxaz.writelines(taskLines)
</code>```

Body:
I have written some code to take in users and assign tasks to them using a text file. The problem I am having is as the user inputs a task number to edit, but I don't know how to replace the line of text 12 lines above the task number that is input and this replaces the username. If there are two tasks in the text file I need to be able to use the task number line as a reference point and then replace the 12th line above that to a new username. So I basically need to replace the 12th line above the users input for every task.
I have written some code to just replace the name but its erasing my whole text file.

Example of text file: (tasks.txt)

User assigned to task:

jack

Task Title :

Fly

Task Description:

Fly to the moon

Task Due Date:

2020-02-20
  Date Assigned:

2020-02-18

Task Completed:

No

Task number:

1

The code of the effected block so far is:

with open('tasks.txt') as xxaz:
                 main2 = "Task number:" + "\n" + str(review)
                 aa = xxaz.read()
                 if main2 in aa:
                         print(str(main2) + "\n")
                         edit = input("Enter ""1"" to edit the user assigned to task, ""2"" to change the due date or ""3"" to change the completion status.\n")
                         if edit == "1":
                             new_name = input("Please enter a new user name")
                             lines = open('tasks.txt').read().splitlines()
                             lines[2] = new_name
                             open('tasks.txt','w').write

Body:
Here is the solution if you want to continue with your same approach:

Tasks.txt:

User assigned to task:
jack
Task Title :
Fly
Task Description:
Fly to the moon
Task Due Date:
2020-02-20 Date Assigned:
2020-02-18
Task Completed:
No
Task number:
1
User assigned to task:
qwe
Task Title :
Fly
Task Description:
Fly to the moon
Task Due Date:
2020-02-20 Date Assigned:
2020-02-18
Task Completed:
No
Task number:
2

Code:-

with open(r"C:\Users\xyz\Desktop\Tasks.txt","r+") as xxaz:
    main2 = "Task number:" + "\n" + str(2)
    if main2 in xxaz.read():
        edit = input("Enter ""1"" to edit the user assigned to task, ""2"" to change the due date or ""3"" to change the completion status.")
        if edit == "1":
            xxaz.seek(0)
            taskLines = xxaz.readlines()
            new_name = input("Please enter a new user name: ")
            for i in taskLines:
                if i == ('Task number:\n'):
                    indexVal = taskLines.index('Task number:\n')
                    taskLines.insert(indexVal,taskLines[indexVal]+taskLines[indexVal+1])
                    taskLines.pop(indexVal+1)
                    taskLines.pop(indexVal+1)
            indexVal = taskLines.index(main2.strip())
            taskLines.pop(indexVal-10)
            taskLines.insert(indexVal-10,new_name+'\n')
            xxaz.seek(0)
        xxaz.writelines(taskLines)


问:
Apache CXF java2wsdl: Custom symbol names
Our java application needs to communicate with a SOAP service. We use Apache CXF to implement a jaxws client. The classes are generated by wsdl2java from the WSDL file we received from the service provider.

Unfortunately the symbol names provided by the service are all uppercase and underscore delimited (e.g. PRODUCT_ATTACHMENT). This is very confusing as it differs from the typical "CamelCase" java coding convention (e.g. ProductAttachment).

I know you could define custom mappings for each class. But as there is a huge number of classes and members, I'd like to automate the symbol name conversion.

So I wonder if there is a way to provide some kind of rules or piece of java code (as hook) for wsdl2java which tells it to convert a symbol name ABC_DEF to AbcDef in the generated java classes.

If not, maybe there are alternative solutions instead of Apache CXF which allow this.

答:
You could try to use camelcase-always plugin. There were examples on stackoverflow of its integration with maven-jaxb2-plugin.

Example configuration for cxf-codegen-plugin:

```<code>    <dependencies>
        <dependency>
            <groupId>org.andromda.thirdparty.jaxb2_commons</groupId>
            <artifactId>camelcase-always</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>

    <plugins>
            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>3.3.5</version>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>${basedir}/src/main/resources/wsdl/customer-service.wsdl</wsdl>
                                    <wsdlLocation>classpath:wsdl/customer-service.wsdl</wsdlLocation>
                                    <extraargs>
                                        <extraarg>-verbose</extraarg>
                                        <extraarg>-xjc-camelcase-always</extraarg>
                                    </extraargs>
                                </wsdlOption>
                                <bindingFiles>
                                    <bindingFile>${basedir}/src/main/resources/wsdl/bindings/customer-service-bindings.xjb</bindingFile>
                                </bindingFiles>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.andromda.thirdparty.jaxb2_commons</groupId>
                        <artifactId>camelcase-always</artifactId>
                        <version>1.0</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
</code>```

Body:
You could try to use camelcase-always plugin. There were examples on stackoverflow of its integration with maven-jaxb2-plugin.

Example configuration for cxf-codegen-plugin:

    <dependencies>
        <dependency>
            <groupId>org.andromda.thirdparty.jaxb2_commons</groupId>
            <artifactId>camelcase-always</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>

    <plugins>
            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>3.3.5</version>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>${basedir}/src/main/resources/wsdl/customer-service.wsdl</wsdl>
                                    <wsdlLocation>classpath:wsdl/customer-service.wsdl</wsdlLocation>
                                    <extraargs>
                                        <extraarg>-verbose</extraarg>
                                        <extraarg>-xjc-camelcase-always</extraarg>
                                    </extraargs>
                                </wsdlOption>
                                <bindingFiles>
                                    <bindingFile>${basedir}/src/main/resources/wsdl/bindings/customer-service-bindings.xjb</bindingFile>
                                </bindingFiles>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.andromda.thirdparty.jaxb2_commons</groupId>
                        <artifactId>camelcase-always</artifactId>
                        <version>1.0</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>