问:
Send Intent from Activity to another Activity with RecyclerView
I have an Activity where I enter a phone number and a message and when I click on the send Button, I want to display the message and number I entered in the layout of another Activity which has a RecyclerView. I have tried to use an Intent but it displays "NUMBER" and "NUMBER" in both TextViews.
This is some of the code below.

```<code>public class NewMessageActivity extends AppCompatActivity {

private String message, number;
private EditText mComposeMessage, mPhoneNumber;
private Button mSendButton, mCancelButton;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.new_message_layout);

    mPhoneNumber = (EditText) findViewById(R.id.phone_number_et);
    mComposeMessage = (EditText) findViewById(R.id.compose_et);
    mSendButton = (Button) findViewById(R.id.send_button);
    mCancelButton = (Button) findViewById(R.id.cancel_button);

    number = mPhoneNumber.getText().toString();
    message = mComposeMessage.getText().toString();

    mSendButton.setOnClickListener(mButtonClickListener);
    mCancelButton.setOnClickListener(mButtonClickListener);
}

private View.OnClickListener mButtonClickListener = new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        int id = v.getId();

        switch (id) {
            case R.id.send_button:
                Intent intent = new Intent(v.getContext(), SentActivity.class);
                intent.putExtra(getString(R.string.key_message), message);
                intent.putExtra("NUMBER", number);
                startActivity(intent);
                break;

            case R.id.cancel_button:
                break;
        }
    }
};

}
</code>```

This is my Adapter

```<code>public class SentMessageAdapter extends RecyclerView.Adapter<SentMessageAdapter.MessageHolder> {
private List<String> mMessages;

public static class MessageHolder extends RecyclerView.ViewHolder {
    private TextView mSentMessageTv;
    private TextView mRecipientNumberTv;
    private TextView mRecipientTv;

    public MessageHolder(View v){
        super(v);
        mSentMessageTv = (TextView) v.findViewById(R.id.sent_message_tv);
        mRecipientNumberTv = (TextView) v.findViewById(R.id.recipient_number_tv);
        mRecipientTv = (TextView) v.findViewById(R.id.recipient_tv);
    }
}

public SentMessageAdapter(List<String> messages){
    mMessages = messages;
}

@Override
public MessageHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.sent_list_item, parent, false);
    MessageHolder vH = new MessageHolder(v);
    return vH;
}

@Override
public void onBindViewHolder(MessageHolder holder, int position) {
    holder.mSentMessageTv.setText(mMessages.get(position));
    holder.mRecipientNumberTv.setText(mMessages.get(position));
    holder.mRecipientTv.setText(R.string.to);
}

@Override
public int getItemCount() {
    return mMessages.size();
}

}
</code>```

Activity where the text should be displayed

```<code>public class SentActivity extends AppCompatActivity {

private static final String LOG_TAG = SentActivity.class.getSimpleName();

private RecyclerView mRecyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;

final ArrayList<String> messages = new ArrayList<>();

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.message_recycler_list);

    Bundle extras = getIntent().getExtras();
    String message = null;

    if (extras != null){
        message = extras.getString(String.valueOf(R.string.key_message), String.valueOf("NUMBER"));
    }

    if (message == null){
        message = "text";
    }
    Log.d(LOG_TAG, message);
    messages.add(0, message);

    Toast.makeText(this, message, Toast.LENGTH_SHORT).show();

    mRecyclerView = (RecyclerView) findViewById(R.id.message_recycler_view);
    mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);

    mAdapter = new SentMessageAdapter(messages);
    mRecyclerView.setAdapter(mAdapter);
    mAdapter.notifyDataSetChanged();
}

}
</code>```

Layout for the Activity

```<code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp">

<TextView
    android:id="@+id/sent_message_tv"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="4dp"
    tools:text="Hello world"/>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="4dp"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/recipient_tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        tools:text="@string/to"/>

    <TextView
        android:id="@+id/recipient_number_tv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="4dp"
        android:paddingStart="4dp"
        android:paddingRight="4dp"
        android:paddingEnd="4dp" />
</LinearLayout>

</LinearLayout>
</code>```

答:
You're accessing phone number edit text in onCreate;

```<code>number = mPhoneNumber.getText().toString();
</code>```

And it will be set to whatever your text in XML (It's set to NUMBER I guess). You need to access this after user entered text, so put this line in on click listener.

Body:
I have an Activity where I enter a phone number and a message and when I click on the send Button, I want to display the message and number I entered in the layout of another Activity which has a RecyclerView. I have tried to use an Intent but it displays "NUMBER" and "NUMBER" in both TextViews.
This is some of the code below.

public class NewMessageActivity extends AppCompatActivity {

private String message, number;
private EditText mComposeMessage, mPhoneNumber;
private Button mSendButton, mCancelButton;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.new_message_layout);

    mPhoneNumber = (EditText) findViewById(R.id.phone_number_et);
    mComposeMessage = (EditText) findViewById(R.id.compose_et);
    mSendButton = (Button) findViewById(R.id.send_button);
    mCancelButton = (Button) findViewById(R.id.cancel_button);

    number = mPhoneNumber.getText().toString();
    message = mComposeMessage.getText().toString();

    mSendButton.setOnClickListener(mButtonClickListener);
    mCancelButton.setOnClickListener(mButtonClickListener);
}

private View.OnClickListener mButtonClickListener = new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        int id = v.getId();

        switch (id) {
            case R.id.send_button:
                Intent intent = new Intent(v.getContext(), SentActivity.class);
                intent.putExtra(getString(R.string.key_message), message);
                intent.putExtra("NUMBER", number);
                startActivity(intent);
                break;

            case R.id.cancel_button:
                break;
        }
    }
};

}

This is my Adapter

public class SentMessageAdapter extends RecyclerView.Adapter<SentMessageAdapter.MessageHolder> {
private List<String> mMessages;

public static class MessageHolder extends RecyclerView.ViewHolder {
    private TextView mSentMessageTv;
    private TextView mRecipientNumberTv;
    private TextView mRecipientTv;

    public MessageHolder(View v){
        super(v);
        mSentMessageTv = (TextView) v.findViewById(R.id.sent_message_tv);
        mRecipientNumberTv = (TextView) v.findViewById(R.id.recipient_number_tv);
        mRecipientTv = (TextView) v.findViewById(R.id.recipient_tv);
    }
}

public SentMessageAdapter(List<String> messages){
    mMessages = messages;
}

@Override
public MessageHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.sent_list_item, parent, false);
    MessageHolder vH = new MessageHolder(v);
    return vH;
}

@Override
public void onBindViewHolder(MessageHolder holder, int position) {
    holder.mSentMessageTv.setText(mMessages.get(position));
    holder.mRecipientNumberTv.setText(mMessages.get(position));
    holder.mRecipientTv.setText(R.string.to);
}

@Override
public int getItemCount() {
    return mMessages.size();
}

}

Activity where the text should be displayed

public class SentActivity extends AppCompatActivity {

private static final String LOG_TAG = SentActivity.class.getSimpleName();

private RecyclerView mRecyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;

final ArrayList<String> messages = new ArrayList<>();

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.message_recycler_list);

    Bundle extras = getIntent().getExtras();
    String message = null;

    if (extras != null){
        message = extras.getString(String.valueOf(R.string.key_message), String.valueOf("NUMBER"));
    }

    if (message == null){
        message = "text";
    }
    Log.d(LOG_TAG, message);
    messages.add(0, message);

    Toast.makeText(this, message, Toast.LENGTH_SHORT).show();

    mRecyclerView = (RecyclerView) findViewById(R.id.message_recycler_view);
    mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);

    mAdapter = new SentMessageAdapter(messages);
    mRecyclerView.setAdapter(mAdapter);
    mAdapter.notifyDataSetChanged();
}

}

Layout for the Activity

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp">

<TextView
    android:id="@+id/sent_message_tv"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="4dp"
    tools:text="Hello world"/>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="4dp"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/recipient_tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        tools:text="@string/to"/>

    <TextView
        android:id="@+id/recipient_number_tv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="4dp"
        android:paddingStart="4dp"
        android:paddingRight="4dp"
        android:paddingEnd="4dp" />
</LinearLayout>

</LinearLayout>

Body:
You're accessing phone number edit text in onCreate;

number = mPhoneNumber.getText().toString();

And it will be set to whatever your text in XML (It's set to NUMBER I guess). You need to access this after user entered text, so put this line in on click listener.


来源: stackexchange

问:
Clearing input field on firebase function after angular submit
The function works and submits the user input to my firebase "back-end" but I cannot figure out a clear function to empty out the input field after using ng-submit.  The input is tied to the var "emailInput" with ng-model.  Thanks for any suggestions!</p>

```<code>var newEmailref = new Firebase("https://nevermind.com");
$scope.email = $firebaseArray(newEmailref);
$scope.addEmail = function(email) {
    $scope.email.$add(email);
    $scope.emailInput = '';
};
</code>```

答:
```<code>       See the Full code of mine it's working for me

    var ref = firebase.database().ref();
    var firebasedata = $firebaseObject(ref);

  var messagesRef = ref.child("storeUserData");
  var data = $firebaseArray(messagesRef)

  $scope.createItem= function(user) {
        data.$add(user).then(function(data) {
           $scope.user = "";
              var myPopup = $ionicPopup.show({
           title: 'Dear User, Your Account has created Successfully',
         });
      $timeout(function() {
          myPopup.close(); //close the popup after 6 seconds for some reason
       }, 6000);
         });
      }
      ref.orderByValue().on("value", function(data) {
        data.forEach(function(takenData) {
         console.log("The " + takenData.key + " rating is " +
       takenData.val().email);
        });
        });
</code>```

ContentLicense: CC BY-SA 3.0

Body:
The function works and submits the user input to my firebase "back-end" but I cannot figure out a clear function to empty out the input field after using ng-submit.  The input is tied to the var "emailInput" with ng-model.  Thanks for any suggestions!

var newEmailref = new Firebase("https://nevermind.com");
$scope.email = $firebaseArray(newEmailref);
$scope.addEmail = function(email) {
    $scope.email.$add(email);
    $scope.emailInput = '';
};


问:
Incorrect syntax for SQL query
So I have this SQL Server query:

```<code>declare @symbol varchar(8) = '180460';
declare @sdate DATE = '20170630';
declare @edate DATE = '20170704';
IF @symbol = 'TSE00081'
    BEGIN
        SELECT * from dbo.IndexNames
    END
ELSE
BEGIN
    SELECT t1.qcode, t4.Name,t1.effectivedate, t1.publishdate, EventMap.Description, t1.SharesChanged, t1.FFW, t1.OldFFW,
    IIF(t1.EventCode='SK',t6.IndexName,''), IIF(t1.EventCode='SK',t7.Indexname,''), IIF(t1.Market<>'',t5.IndexName,''), IIF(t3.NameEn<>'',t3.NameEn,t2.NameEn),
    IIF(t1.OldSector<>'',t8.NameEn,''),  IIF(t1.Allotment1<>0 AND t1.EventCode<>'05', t1.Allotment2/t1.Allotment1,''), t1.SharesUnit
    FROM ( dbo.AdvNoticeData as t1 , dbo.IdTable as t4 )
    LEFT JOIN dbo.EventMap on t1.EventCode = dbo.EventMap.EventCode
    LEFT JOIN dbo.Industries as t2 on t1.SectorAsOf = t2.IndNum
    LEFT JOIN dbo.Industries as t3 on t1.Sector = t3.IndNum
    LEFT JOIN dbo.Industries as t8 on t1.OldSector = t8.IndNum
    LEFT JOIN dbo.IndexNames as t5 on t1.OldMarket = t5.Market
    LEFT JOIN dbo.IndexNames as t6 on t1.Scale = t6.Scale
    LEFT JOIN dbo.IndexNames as t7 on t1.OldScale = t7.Scale
    WHERE (t1.Market=1 or t1.MarketAsOf=1 or (t1.OldMarket=1 and t1.MarketAsOf=''))
    and t1.EffectiveDate >= @sdate and t1.EffectiveDate <= @edate and t1.Qcode = t4.Qcode
    ORDER BY t1.EffectiveDate, t1.EventCode, t1.Qcode
END
</code>```

the problem is after the FROM clause. I keep on getting incorrect syntax at ','

When I tried this command (with few modifications) on sqlyog, it works with that comma after the FROM clause. what seems to be the problem? here's the mysql counter part that works:

```<code>SELECT t1.qcode, t4.Name,t1.effectivedate, t1.publishdate,
EventMap.Description, t1.SharesChanged, t1.FFW, t1.OldFFW,
IF(t1.EventCode="SK",t6.IndexName,""),
IF(t1.EventCode="SK",t7.Indexname,""),
IF(t1.market<>"",t5.IndexName,""),
IF(t3.NameEn<>"",t3.NameEn,t2.NameEn),
IF(t1.oldSector<>"",t8.NameEn,""),
IF(t1.allotment1<>0 AND t1.eventcode<>"05",t1.allotment2/t1.allotment1,""),
t1.sharesunit
FROM (AdvNoticeData AS t1, IdTable AS t4)
LEFT JOIN EventMap ON t1.eventcode = EventMap.eventcode
LEFT JOIN Industries AS t2 ON t1.sectorasof = t2.IndNum
LEFT JOIN Industries AS t3 ON t1.sector = t3.IndNum
LEFT JOIN Industries AS t8 ON t1.oldsector = t8.IndNum
LEFT JOIN IndexNames AS t5 ON t1.oldmarket = t5.Market
LEFT JOIN IndexNames AS t6 ON t1.scale = t6.Scale
LEFT JOIN IndexNames AS t7 ON t1.oldscale = t7.Scale
WHERE (t1.market=1 OR t1.marketasof=1 OR (t1.oldmarket=1 AND t1.marketasof=""))
AND t1.effectivedate >= '20170630'
AND t1.effectivedate <= '20170703'
AND t1.Qcode = t4.Qcode
ORDER BY t1.effectivedate, t1.eventcode,t1.qcode
</code>```

答:
Don't mix legacy and new join syntax.</p>

```<code>...
FROM dbo.AdvNoticeData as t1
JOIN dbo.IdTable as t4 ON t1.Qcode = t4.Qcode
LEFT JOIN dbo.EventMap on t1.EventCode = dbo.EventMap.EventCode
...
</code>```

Title: Incorrect syntax for SQL query

Body:
So I have this SQL Server query:

declare @symbol varchar(8) = '180460';
declare @sdate DATE = '20170630';
declare @edate DATE = '20170704';
IF @symbol = 'TSE00081'
    BEGIN
        SELECT * from dbo.IndexNames
    END
ELSE
BEGIN
    SELECT t1.qcode, t4.Name,t1.effectivedate, t1.publishdate, EventMap.Description, t1.SharesChanged, t1.FFW, t1.OldFFW,
    IIF(t1.EventCode='SK',t6.IndexName,''), IIF(t1.EventCode='SK',t7.Indexname,''), IIF(t1.Market<>'',t5.IndexName,''), IIF(t3.NameEn<>'',t3.NameEn,t2.NameEn),
    IIF(t1.OldSector<>'',t8.NameEn,''),  IIF(t1.Allotment1<>0 AND t1.EventCode<>'05', t1.Allotment2/t1.Allotment1,''), t1.SharesUnit
    FROM ( dbo.AdvNoticeData as t1 , dbo.IdTable as t4 )
    LEFT JOIN dbo.EventMap on t1.EventCode = dbo.EventMap.EventCode
    LEFT JOIN dbo.Industries as t2 on t1.SectorAsOf = t2.IndNum
    LEFT JOIN dbo.Industries as t3 on t1.Sector = t3.IndNum
    LEFT JOIN dbo.Industries as t8 on t1.OldSector = t8.IndNum
    LEFT JOIN dbo.IndexNames as t5 on t1.OldMarket = t5.Market
    LEFT JOIN dbo.IndexNames as t6 on t1.Scale = t6.Scale
    LEFT JOIN dbo.IndexNames as t7 on t1.OldScale = t7.Scale
    WHERE (t1.Market=1 or t1.MarketAsOf=1 or (t1.OldMarket=1 and t1.MarketAsOf=''))
    and t1.EffectiveDate >= @sdate and t1.EffectiveDate <= @edate and t1.Qcode = t4.Qcode
    ORDER BY t1.EffectiveDate, t1.EventCode, t1.Qcode
END

the problem is after the FROM clause. I keep on getting incorrect syntax at ','

When I tried this command (with few modifications) on sqlyog, it works with that comma after the FROM clause. what seems to be the problem? here's the mysql counter part that works:

SELECT t1.qcode, t4.Name,t1.effectivedate, t1.publishdate,
EventMap.Description, t1.SharesChanged, t1.FFW, t1.OldFFW,
IF(t1.EventCode="SK",t6.IndexName,""),
IF(t1.EventCode="SK",t7.Indexname,""),
IF(t1.market<>"",t5.IndexName,""),
IF(t3.NameEn<>"",t3.NameEn,t2.NameEn),
IF(t1.oldSector<>"",t8.NameEn,""),
IF(t1.allotment1<>0 AND t1.eventcode<>"05",t1.allotment2/t1.allotment1,""),
t1.sharesunit
FROM (AdvNoticeData AS t1, IdTable AS t4)
LEFT JOIN EventMap ON t1.eventcode = EventMap.eventcode
LEFT JOIN Industries AS t2 ON t1.sectorasof = t2.IndNum
LEFT JOIN Industries AS t3 ON t1.sector = t3.IndNum
LEFT JOIN Industries AS t8 ON t1.oldsector = t8.IndNum
LEFT JOIN IndexNames AS t5 ON t1.oldmarket = t5.Market
LEFT JOIN IndexNames AS t6 ON t1.scale = t6.Scale
LEFT JOIN IndexNames AS t7 ON t1.oldscale = t7.Scale
WHERE (t1.market=1 OR t1.marketasof=1 OR (t1.oldmarket=1 AND t1.marketasof=""))
AND t1.effectivedate >= '20170630'
AND t1.effectivedate <= '20170703'
AND t1.Qcode = t4.Qcode
ORDER BY t1.effectivedate, t1.eventcode,t1.qcode

Body:
Don't mix legacy and new join syntax.

...
FROM dbo.AdvNoticeData as t1
JOIN dbo.IdTable as t4 ON t1.Qcode = t4.Qcode
LEFT JOIN dbo.EventMap on t1.EventCode = dbo.EventMap.EventCode
...


问:
Display the output on the terminal and tail the last 10 lines to log file
I need to run a script and output the full contents to the terminal.
I then want to get the last 10 lines from the terminal output and put them in a log file.
I have tried using ./script.sh 2>&1 | tail -10 > log.log
but this stops the output to the terminal.

答:
For that you have to use the tee command. Then you can pipe to a file and your console.

```<code>ls -a | tee output.file
</code>```

Body:
For that you have to use the tee command. Then you can pipe to a file and your console.

ls -a | tee output.file


问:
How to represent functions in flowchart?
I define some function in my Ansi C Program (simple program). I don't known how to represent a function in flowchart. Anybody can help me?</p>

答: On a flowchart, a function can be anything: a state, an action that occurs while transitioning betwwen states, etc.  It all depends on how you have your flowchart organized.  I would recommend building your flowchart normally, then go back and add a function name to the description of anything that is implemented by a function.</p>

ContentLicense: CC BY-SA 2.5


问:
How do I remove JSON form JSON array with repeated key-value
I have a JSON as follows:

```<code>[{"name": "John", "id": 1},
 {"name": "Don", "id": 2},
 {"name": "Tom", "id": 3},
 {"name": "NewJohn", "id": 1},
 {"name": "Tim", "id": 4}]
</code>```

I want to first identify if key "id" has same value. If yes, I want to remove previous JSON with the same "id" so that I get following JSON with unique "id" values in the JSON Array.

```<code>[{"name": "Don", "id": 2},
 {"name": "Tom", "id": 3},
 {"name": "NewJohn", "id": 1},
 {"name": "Tim", "id": 4}]
</code>```

How do I achieve this in javascript?

答:
```<code>var result=new Map(data.map(el=>[el.id,el]));
</code>```

You may create a Map out of it.. which can be destructured to an array:

```<code>result=[...result].map(e=>e[1]);
</code>```

http://jsbin.com/zuqabonebe/edit?console

Body:
I have a JSON as follows:

[{"name": "John", "id": 1},
 {"name": "Don", "id": 2},
 {"name": "Tom", "id": 3},
 {"name": "NewJohn", "id": 1},
 {"name": "Tim", "id": 4}]

I want to first identify if key "id" has same value. If yes, I want to remove previous JSON with the same "id" so that I get following JSON with unique "id" values in the JSON Array.

[{"name": "Don", "id": 2},
 {"name": "Tom", "id": 3},
 {"name": "NewJohn", "id": 1},
 {"name": "Tim", "id": 4}]

How do I achieve this in javascript?

Body:
var result=new Map(data.map(el=>[el.id,el]));

You may create a Map out of it.. which can be destructured to an array:

result=[...result].map(e=>e[1]);

http://jsbin.com/zuqabonebe/edit?console


问:
Why does: string st = "" + 12; work in c# without conversion?
This is super dumb, but I've googled and checked references and I just cannot find an answer... Why can an int or float etc be added as part of a string without converstion but not on it's own? that is:

while this work fine:

```<code> string st = "" + 12;
</code>```

this doesn't (of course):

```<code> string st = 12;
</code>```

Where is the magic here? I know it works I just want to know WHY it works and how I control HOW the conversion is done?

答: This is working because of the operator overload of the operator + on the string datatype.</p>

Body:
This is super dumb, but I've googled and checked references and I just cannot find an answer... Why can an int or float etc be added as part of a string without converstion but not on it's own? that is:

while this work fine:

 string st = "" + 12;

this doesn't (of course):

 string st = 12;

Where is the magic here? I know it works I just want to know WHY it works and how I control HOW the conversion is done?


问:
Jenkins Pipeline - Build with parameters
I'm trying to execute an already defined job using build method with jenkins pipeline.
This is a simple example:

```<code> build('jenkins-test-project-build', param1 : 'some-value')
</code>```

But when I try to execute it I get an error:

```<code>java.lang.IllegalArgumentException: Expected named arguments but got [{param1=some-value}, jenkins-test-project-build]
at org.jenkinsci.plugins.workflow.cps.DSL.parseArgs(DSL.java:442)
at org.jenkinsci.plugins.workflow.cps.DSL.parseArgs(DSL.java:380)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:156)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
...............
</code>```

答: Use the pipeline code generator of the specific jenkins server to generate the code, in my case this was happening because of version mismatch, we use a different version for development then production and each used a different syntax to call a job and pass parameters.</p>

Body:
I'm trying to execute an already defined job using build method with jenkins pipeline.
This is a simple example:

 build('jenkins-test-project-build', param1 : 'some-value')

But when I try to execute it I get an error:

java.lang.IllegalArgumentException: Expected named arguments but got [{param1=some-value}, jenkins-test-project-build]
at org.jenkinsci.plugins.workflow.cps.DSL.parseArgs(DSL.java:442)
at org.jenkinsci.plugins.workflow.cps.DSL.parseArgs(DSL.java:380)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:156)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
...............


问:
To leave in the list items whose values coincide with the numbers of their positions in the list
I need to change list for example:

[1,2,4,6,5,10]

To this one

[1,2,5] (the list of elements that are on correct position).

1st element value is 1 - ok,

element value is 2 - ok,

3rd element value is 4 but expected 3 (due to the index)- remove

and etc. How can I solve the error which is attached below?

My code:

```<code>module Count where
import Control.Monad.State

nthel n xs = last xsxs
    where xsxs = take n xs

 deleteNth i items = take i items ++ drop (1 + i) items

 repeatNTimes 0 _ = return ()
 repeatNTimes n xs =
   do
     if (n == nthel n xs) then return()
       else deleteNth (n-1) xs
         repeatNTimes (n-1) xs

 list = [1,2,3,4,5]
 main = repeatNTimes (length list) list
</code>```

I have the following error:

```<code> * Couldn't match type `Int' with `()'
       Expected type: [()]
       Actual type: [Int]
* In the expression: deleteNth (n - 2) xs
  In a stmt of a 'do' block:
    if (n == nthel n xs) then return () else deleteNth (n - 2) xs
  In the expression:
    do { if (n == nthel n xs) then return () else deleteNth (n - 2) xs;
         repeatNTimes (n - 1) xs }
</code>```

答:
A really nice way to work with this is to stitch functions together. First one might need to get to know the functions in the Data.List module, which you can find with hoogle: http://hoogle.haskell.org

Data.List Module functions

I'll give you a little bit of a boost here. The functions I would pick out are the zip function: https://hackage.haskell.org/package/base-4.9.1.0/docs/Data-List.html#v:zip whose type is [a] -> [b] -> [(a, b)] and then the filter function https://hackage.haskell.org/package/base-4.9.1.0/docs/Prelude.html#v:filter whose type is (a -> Bool) -> [a] -> [a] and then the map function whose type is (a -> b) -> [a] -> [b] along with the fst :: (a, b) -> a

Function Composition

These functions can be stitched together using the function composition operator: (.) :: (b -> c) -> (a -> b) -> a -> c it takes two functions that share a common input/output point (in the type signature they are the second and first parameters, respectively; a -> b and b -> c) and it will then join them into one single function.

Stacking it up - required knowledge

In order to do what you want to do, you really need to know about simple types, parameterised types, ranges (including lazy infinite ranges would help), functions and possibly recursion as well some higher order functions and how Haskell functions are curried, and to understand function composition. It wouldn't hurt to add a basic understanding of what typeclasses do and are into the mix.

I helped author a tutorial which can really help with understanding how this stuff works from a usage point of view by following a series of interesting examples. It's not too long, and you might find it much easier to approach your problem once you have understood some of the more foundational stuff: http://happylearnhaskelltutorial.com — note that it's not tuned to teaching you how to construct stuff, that'll be coming in a later volume, but it should give you enough understanding to be able to at least guess at an answer, or understand the one below.

The Answer - spoilers

If you want to work this out yourself, you should stop here and come back later on when you're feeling more confident. However, I'm going to put one possible answer just below, so don't look if you don't want to know yet!

```<code>positionals :: (Enum a, Eq a, Num a) => [a] -> [a]
positionals = map fst . filter (\(x, y) -> x == y) . zip [1..]
</code>```

Keep in mind this is only one way of doing this. There are simpler more explanatory ways to do it, and while it might possibly seem inefficient, Haskell has list/stream fusion which compiles that function into something that will do a single pass across your data.

Body:
I need to change list for example:

[1,2,4,6,5,10]

To this one

[1,2,5] (the list of elements that are on correct position).

1st element value is 1 - ok,

element value is 2 - ok,

3rd element value is 4 but expected 3 (due to the index)- remove

and etc. How can I solve the error which is attached below?

My code:

module Count where
import Control.Monad.State

nthel n xs = last xsxs
    where xsxs = take n xs

 deleteNth i items = take i items ++ drop (1 + i) items

 repeatNTimes 0 _ = return ()
 repeatNTimes n xs =
   do
     if (n == nthel n xs) then return()
       else deleteNth (n-1) xs
         repeatNTimes (n-1) xs

 list = [1,2,3,4,5]
 main = repeatNTimes (length list) list

I have the following error:

 * Couldn't match type `Int' with `()'
       Expected type: [()]
       Actual type: [Int]
* In the expression: deleteNth (n - 2) xs
  In a stmt of a 'do' block:
    if (n == nthel n xs) then return () else deleteNth (n - 2) xs
  In the expression:
    do { if (n == nthel n xs) then return () else deleteNth (n - 2) xs;
         repeatNTimes (n - 1) xs }

Body:
A really nice way to work with this is to stitch functions together. First one might need to get to know the functions in the Data.List module, which you can find with hoogle: http://hoogle.haskell.org

Data.List Module functions

I'll give you a little bit of a boost here. The functions I would pick out are the zip function: https://hackage.haskell.org/package/base-4.9.1.0/docs/Data-List.html#v:zip whose type is [a] -> [b] -> [(a, b)] and then the filter function https://hackage.haskell.org/package/base-4.9.1.0/docs/Prelude.html#v:filter whose type is (a -> Bool) -> [a] -> [a] and then the map function whose type is (a -> b) -> [a] -> [b] along with the fst :: (a, b) -> a

Function Composition

These functions can be stitched together using the function composition operator: (.) :: (b -> c) -> (a -> b) -> a -> c it takes two functions that share a common input/output point (in the type signature they are the second and first parameters, respectively; a -> b and b -> c) and it will then join them into one single function.

Stacking it up - required knowledge

In order to do what you want to do, you really need to know about simple types, parameterised types, ranges (including lazy infinite ranges would help), functions and possibly recursion as well some higher order functions and how Haskell functions are curried, and to understand function composition. It wouldn't hurt to add a basic understanding of what typeclasses do and are into the mix.

I helped author a tutorial which can really help with understanding how this stuff works from a usage point of view by following a series of interesting examples. It's not too long, and you might find it much easier to approach your problem once you have understood some of the more foundational stuff: http://happylearnhaskelltutorial.com — note that it's not tuned to teaching you how to construct stuff, that'll be coming in a later volume, but it should give you enough understanding to be able to at least guess at an answer, or understand the one below.

The Answer - spoilers

If you want to work this out yourself, you should stop here and come back later on when you're feeling more confident. However, I'm going to put one possible answer just below, so don't look if you don't want to know yet!

positionals :: (Enum a, Eq a, Num a) => [a] -> [a]
positionals = map fst . filter (\(x, y) -> x == y) . zip [1..]

Keep in mind this is only one way of doing this. There are simpler more explanatory ways to do it, and while it might possibly seem inefficient, Haskell has list/stream fusion which compiles that function into something that will do a single pass across your data.


问:
How to add buttons into the TabbedPage above the Tabs
Is this possible to create ? I need to add 2 buttons above the tabs as below:</p>

```<code><?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local ="clr-namespace:SembIWIS.View"
       x:Class="myApp.MainPage">

  <local:ProductPage>
  </local:ProductPage>

  <local:ServicePage>
  </local:ServicePage>

</TabbedPage>

How to add two buttons in the TabbedPage, so It will look like :

 |----------------------|
 | TabbedPage           |
 |----------------------|
 |                      |
 |  btn1        btn2    |
 |                      |
 |----------------------|
 | Tab1 | tab2 | tab3 ..|
 |----------------------|
 |                      |
 |                      |
 |                      |
 ------------------------
</code>```

答:
Yes this can be done. You can use either a simple Grid structure or it can also be done with StackLayouts using VerticalOptions = EndAndExpand. This is the Grid version:

```<code><Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <Grid Grid.Row="0">
        // Normal content
    </Grid>
    <Grid Grid.Row="1">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Button Grid.Column="0" Text="Button 1" />
        <Button Grid.Column="1" Text="Button 2" />
    </Grid>
</Grid>
</code>```

Body:
Is this possible to create ? I need to add 2 buttons above the tabs as below:

<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local ="clr-namespace:SembIWIS.View"
       x:Class="myApp.MainPage">

  <local:ProductPage>
  </local:ProductPage>

  <local:ServicePage>
  </local:ServicePage>

</TabbedPage>

How to add two buttons in the TabbedPage, so It will look like :

 |----------------------|
 | TabbedPage           |
 |----------------------|
 |                      |
 |  btn1        btn2    |
 |                      |
 |----------------------|
 | Tab1 | tab2 | tab3 ..|
 |----------------------|
 |                      |
 |                      |
 |                      |
 ------------------------

Body:
Yes this can be done. You can use either a simple Grid structure or it can also be done with StackLayouts using VerticalOptions = EndAndExpand. This is the Grid version:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <Grid Grid.Row="0">
        // Normal content
    </Grid>
    <Grid Grid.Row="1">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Button Grid.Column="0" Text="Button 1" />
        <Button Grid.Column="1" Text="Button 2" />
    </Grid>
</Grid>


问:
how to get day from mysql with codeigniter query
I need to take my date to sunday, monday, tuesday .... from my databse, currently i getting the date from the databse, how can i convert it to day (like sunday, monday)

```<code>$start_date = $data['start_date'];
    $end_date = $data ['end_date'];
    $student_id = $data['student_id'];

    $where_condition = ['sa.school_id' => $school_id, 'sa.student_id' => $student_id];
    $this->db
    ->select('sa.id, sa.date, sa.attendance_type, sa.reason')
    ->from('student_attendance sa')
    ->join('student st', 'st.id = sa.student_id AND st.school_id = sa.school_id', 'left')
    ->where($where_condition)
    ->where('sa.date >=', $start_date)
    ->where('sa.date <=', $end_date);
    $query = $this->db->get()->result();
    return $query;
</code>```

and this is my result when i run my query

```<code>[{"id":"2","date":"2017-07-03","attendance_type":"absent","reason":""},{"id":"3","date":"2017-07-04","attendance_type":"present","reason":""}]
</code>```

答:
You can use in PHP pass date you are getting from DB in place of '2017-07-03'</p>

```<code>$get_day = strtotime('2017-07-03');
echo $day = date('l', $get_day);
</code>```

Body:
I need to take my date to sunday, monday, tuesday .... from my databse, currently i getting the date from the databse, how can i convert it to day (like sunday, monday)

$start_date = $data['start_date'];
    $end_date = $data ['end_date'];
    $student_id = $data['student_id'];

    $where_condition = ['sa.school_id' => $school_id, 'sa.student_id' => $student_id];
    $this->db
    ->select('sa.id, sa.date, sa.attendance_type, sa.reason')
    ->from('student_attendance sa')
    ->join('student st', 'st.id = sa.student_id AND st.school_id = sa.school_id', 'left')
    ->where($where_condition)
    ->where('sa.date >=', $start_date)
    ->where('sa.date <=', $end_date);
    $query = $this->db->get()->result();
    return $query;

and this is my result when i run my query

[{"id":"2","date":"2017-07-03","attendance_type":"absent","reason":""},{"id":"3","date":"2017-07-04","attendance_type":"present","reason":""}]

Body:
You can use in PHP pass date you are getting from DB in place of '2017-07-03'

$get_day = strtotime('2017-07-03');
echo $day = date('l', $get_day);


问:
How can I detect browser and OS of user and use this to dynamically modify my MySQL database query from a PHP page
I need to be able to run a mysql query and omit certain results if the user is using a certain browser on a certain OS. My database query takes place from an AMFPHP service and I have a javascript browserDetect script that I can use to get user browser and OS.

Ideally I want to run the browserDetect script when the user arrives at my page and then store this in the PHP session variables but I cannot see how to pass the javascript vars to the PHP session. This would allow my database query script to look up the session and modify the query accordingly. I also tried to include the browser detect script in the AMFPHP script but this did not work - I realise that this a serverside vs client side problem.

What other solutions would work for me?

thanks

答: Another solution would be to let the javascript make an ajax request containing OS/Browser, yet the better way might be to parse the user agent.</p>


问:
Add special beamer slide using RMarkdown
I want to produce a beamer presentation from a RMarkdown file.
I am in this case using this beautiful template: https://github.com/matze/mtheme

How in markdown can you specify that you want to insert, not a "normal" slide, by a special one, such as an appendix slide, or a standout slide?

This template contains a standout slide that I would like to use as final slide as they do in their demo slides (http://mirrors.standaloneinstaller.com/ctan/macros/latex/contrib/beamer-contrib/themes/metropolis/demo/demo.pdf)

In beamer, I would do:

```<code>\begin{frame}[standout]
Questions?
\end{frame}
</code>```

What is the equivalent in Markdown?

答:
Setting frame options is pretty straight forward:

```<code>---
title: "Untitled"
output: beamer_presentation
theme: "metropolis"
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

##  {.standout}
Questions?
</code>```

Body:
I want to produce a beamer presentation from a RMarkdown file.
I am in this case using this beautiful template: https://github.com/matze/mtheme

How in markdown can you specify that you want to insert, not a "normal" slide, by a special one, such as an appendix slide, or a standout slide?

This template contains a standout slide that I would like to use as final slide as they do in their demo slides (http://mirrors.standaloneinstaller.com/ctan/macros/latex/contrib/beamer-contrib/themes/metropolis/demo/demo.pdf)

In beamer, I would do:

\begin{frame}[standout]
Questions?
\end{frame}

What is the equivalent in Markdown?

Body:
Setting frame options is pretty straight forward:

---
title: "Untitled"
output: beamer_presentation
theme: "metropolis"
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

##  {.standout}
Questions?


问:
Grouping and remove from list
I have following type

```<code>public class Parameter
{
   public string Name {get;set;}
   public string PathType {get;set;}
}
</code>```

My parameter list like:

```<code>List<Parameter> params = new List<Parameter>();
params.Add(new Parameter{ Name ="A", PathType ="path" });
params.Add(new Parameter{ Name ="B", PathType ="query" });
params.Add(new Parameter{ Name ="C", PathType ="path" });
params.Add(new Parameter{ Name ="C", PathType ="query" });
params.Add(new Parameter{ Name ="D", PathType ="path" });
params.Add(new Parameter{ Name ="D", PathType ="query" });
params.Add(new Parameter{ Name ="D", PathType ="body" });
</code>```

I need to find parameters that have the same Name (like: C and D) where PathType equals path and query. Sorry for my English, it is a little bit difficult to explain. I want to find

```<code> Name ="C", PathType ="path"
 Name ="C", PathType ="query"
 Name ="D", PathType ="path"
 Name ="D", PathType ="query"
</code>```

Then remove all where PathType = "query". Finally result should be

```<code>Name ="A", PathType ="path"
Name ="B", PathType ="query"
Name ="C", PathType ="path"
Name ="D", PathType ="path"
Name ="D", PathType ="body"
</code>```

My code

```<code>var groupedParams = params.GroupBy(a => a.Name, StringComparer.InvariantCultureIgnoreCase).ToDictionary(t => t.Key);
foreach (var parameter in params) {
    if (groupedParams.ContainsKey(parameter.Name)) {
        var temp = groupedParams[parameter.Name];
        if (temp.Count(x => x.PathType.ToLower() == "path") == 1 && temp.Count(x => x.PathType.ToLower() == "query") == 1) {
            params.Remove(parameter);
        }
    }
}
</code>```

I need to group by name but remove only when there are path and query for that name.
Please suggest how can I do in in other way? Thanks

答:
I have some difficulty to understand your problem as it is not well stated.
So here is what i have understood. It has 2 questions:
Q1. Return those entries which has repeated names (e.g. c and d) where pathType has value query or path like you mentioned in your expected result.

```<code>Name ="C", PathType ="path"
Name ="C", PathType ="query"
Name ="D", PathType ="path"
Name ="D", PathType ="query"
</code>```

if yes you can get it like:

```<code>var filteredList = param.Where(x => x.PathType == "query" || x.PathType == "path").ToList();
//Below list will have result.
var duplicateNameList = filteredList.GroupBy(x => x.Name).Where(x => x.Count() > 1).ToList();
</code>```

Q2. Get the entries from the list where pathType =="query" or pathType=="path".

if yes here is the code:

```<code> var result = param.Where(x => x.PathType != "query" && x.PathType!="path").ToList();
</code>```

Let me know if i have misunderstood your question.

Title: Grouping and remove from list

Body:
I have following type

public class Parameter
{
   public string Name {get;set;}
   public string PathType {get;set;}
}

My parameter list like:

List<Parameter> params = new List<Parameter>();
params.Add(new Parameter{ Name ="A", PathType ="path" });
params.Add(new Parameter{ Name ="B", PathType ="query" });
params.Add(new Parameter{ Name ="C", PathType ="path" });
params.Add(new Parameter{ Name ="C", PathType ="query" });
params.Add(new Parameter{ Name ="D", PathType ="path" });
params.Add(new Parameter{ Name ="D", PathType ="query" });
params.Add(new Parameter{ Name ="D", PathType ="body" });

I need to find parameters that have the same Name (like: C and D) where PathType equals path and query. Sorry for my English, it is a little bit difficult to explain. I want to find

 Name ="C", PathType ="path"
 Name ="C", PathType ="query"
 Name ="D", PathType ="path"
 Name ="D", PathType ="query"

Then remove all where PathType = "query". Finally result should be

Name ="A", PathType ="path"
Name ="B", PathType ="query"
Name ="C", PathType ="path"
Name ="D", PathType ="path"
Name ="D", PathType ="body"

My code

var groupedParams = params.GroupBy(a => a.Name, StringComparer.InvariantCultureIgnoreCase).ToDictionary(t => t.Key);
foreach (var parameter in params) {
    if (groupedParams.ContainsKey(parameter.Name)) {
        var temp = groupedParams[parameter.Name];
        if (temp.Count(x => x.PathType.ToLower() == "path") == 1 && temp.Count(x => x.PathType.ToLower() == "query") == 1) {
            params.Remove(parameter);
        }
    }
}

I need to group by name but remove only when there are path and query for that name.
Please suggest how can I do in in other way? Thanks

Body:
I have some difficulty to understand your problem as it is not well stated.
So here is what i have understood. It has 2 questions:
Q1. Return those entries which has repeated names (e.g. c and d) where pathType has value query or path like you mentioned in your expected result.

Name ="C", PathType ="path"
Name ="C", PathType ="query"
Name ="D", PathType ="path"
Name ="D", PathType ="query"

if yes you can get it like:

var filteredList = param.Where(x => x.PathType == "query" || x.PathType == "path").ToList();
//Below list will have result.
var duplicateNameList = filteredList.GroupBy(x => x.Name).Where(x => x.Count() > 1).ToList();

Q2. Get the entries from the list where pathType =="query" or pathType=="path".

if yes here is the code:

 var result = param.Where(x => x.PathType != "query" && x.PathType!="path").ToList();

Let me know if i have misunderstood your question.


问:
Make exception to smooth scrolling script
I'm using this script to make smooth scrolling on a page with a lot of anchors.
But when I'm adding Bootstrap's accordions, they don't work (they don't collapse/expand) due to this script.

How can I make some adjustments to the script, so that it doesn't collide with the accordions collapsing/expanding?

$('a[href*="#"]').click(function() {
  if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
    var target = $(this.hash);
    target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
    if (target.length) {
      $('html, body').animate({
        scrollTop: target.offset().top
      }, 500);
      return false;
    }
  }
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
<div id="stats" role="tablist" aria-multiselectable="true">
  <div class="card stats">
    <h4 class="card-header" role="tab" id="statsHeading">
      Header</h4>
    <div id="collapseStats" class="collapse" role="tabpanel" aria-labelledby="statsHeading">
      <div class="card-block">
        Content...
      </div>
    </div>
  </div>
</div></code>```

Fiddle here.

答:
If you add a class accordion to the Bootstrap accordion links you can then exclude this from the selection in your scrolling function by using .not().

HTML

```<code><a class="accordion" data-toggle="collapse" data-parent="#stats" href="#collapseStats" aria-expanded="false">Header</a>
</code>```

JS

```<code>$('a[href*="#"]').not('.accordion').click(function() { ... });
</code>```

Body:
I'm using this script to make smooth scrolling on a page with a lot of anchors.
But when I'm adding Bootstrap's accordions, they don't work (they don't collapse/expand) due to this script.

How can I make some adjustments to the script, so that it doesn't collide with the accordions collapsing/expanding?

$('a[href*="#"]').click(function() {
  if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
    var target = $(this.hash);
    target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
    if (target.length) {
      $('html, body').animate({
        scrollTop: target.offset().top
      }, 500);
      return false;
    }
  }
});

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" />

      Header

        Content...

Fiddle here.

Body:
If you add a class accordion to the Bootstrap accordion links you can then exclude this from the selection in your scrolling function by using .not().

HTML

<a class="accordion" data-toggle="collapse" data-parent="#stats" href="#collapseStats" aria-expanded="false">Header</a>

JS

$('a[href*="#"]').not('.accordion').click(function() { ... });


问:
how can filter multilevel arrays for searching a string?
```<code>NSPredicate *predicate3 = [NSPredicate predicateWithFormat:@"ANY %K.%K.%K CONTAINS[c] %@",@"Assets",@"TFloorAssets",@"AssetNo",strSearch];

NSArray *filteredPendingList = [NSMutableArray arrayWithArray:[arrOfAllAssetsCategory filteredArrayUsingPredicate:predicate3]];
</code>```

I am using above type of code for multilevel search ?

答:
Use a collection operator:

```<code>[NSPredicate predicateWithFormat:@"ANY Assets.@unionOfArrays.TFloorAssets.AssetNo contains[c] %@", strSearch]
</code>```

Or a subquery:

```<code>[[NSPredicate predicateWithFormat:@"SUBQUERY(Assets, $asset, ANY $asset.TFloorAssets.AssetNo contains[c] %@).@count > 0", strSearch]
</code>```

Or a two subqueries:

```<code>[NSPredicate predicateWithFormat:@"SUBQUERY(Assets, $asset, SUBQUERY($asset.TFloorAssets, $tFloorAsset, $tFloorAsset.AssetNo contains[c] %@).@count > 0).@count > 0", strSearch]
</code>```

Body:
NSPredicate *predicate3 = [NSPredicate predicateWithFormat:@"ANY %K.%K.%K CONTAINS[c] %@",@"Assets",@"TFloorAssets",@"AssetNo",strSearch];

NSArray *filteredPendingList = [NSMutableArray arrayWithArray:[arrOfAllAssetsCategory filteredArrayUsingPredicate:predicate3]];

I am using above type of code for multilevel search ?

Body:
Use a collection operator:

[NSPredicate predicateWithFormat:@"ANY Assets.@unionOfArrays.TFloorAssets.AssetNo contains[c] %@", strSearch]

Or a subquery:

[[NSPredicate predicateWithFormat:@"SUBQUERY(Assets, $asset, ANY $asset.TFloorAssets.AssetNo contains[c] %@).@count > 0", strSearch]

Or a two subqueries:

[NSPredicate predicateWithFormat:@"SUBQUERY(Assets, $asset, SUBQUERY($asset.TFloorAssets, $tFloorAsset, $tFloorAsset.AssetNo contains[c] %@).@count > 0).@count > 0", strSearch]


答: you can get the name of the day with mysql function DAYNAME() if you pass any date it will return you the name of the day f or eg SELECT DAYNAME('2013-01-01') as day will return you Tuesday, so accordingly you can use this function in your query eg select sa.id, sa.date, DAYNAME(sa.date), sa.attendance_type, sa.reason from student_attendance;

Title: how to get day from mysql with codeigniter query


答:
This is how string concatenation is designed to work, and as BoltClock's answer noted, the compiler is using the + as the string concatenation operator. From the C# Language Specification on string concatenation, we find that:

Any non-string argument is converted to its string representation by invoking the virtual ToString method inherited from type object.

Title: Why does: string st = "" + 12; work in c# without conversion?


问:
bottom layout deprecated since ios 11.0
What can I do to fix Bottom layout is deprecated iOS 11, I am using Xcode 9 beta 2.

答: Simply check the "Use safe area layout guides" button in the File Inspector of the IB.

Title: bottom layout deprecated since ios 11.0


问:
Python multiprocessing using nested objects
I'm writing an optimization algorithm which uses several different initial conditions to increase the chance of finding the global optimum. I'm trying to make the code run faster by using the multiprocessing library, and running the optimizations on different processes.

This is the way my code is basically working now:

```<code>from multiprocessing import Process, Queue
from SupportCostModel.SupportStructure import SupportStructure, SupportType

# Method the processes will execute
def optimizeAlgoritm(optimizeObject, qOut):

    optimizeObject.Optimize()
    qOut.put(optimizeObject)

# Method the main thread will execute
def getOptimumalObject(n):

    for i in range(n):

        # Create a new process with a new nested object that should be optimized
        p = Process(target = optimizeAlgoritm, args = (SupportStructure(SupportType.Monopile), qOut))
        processes.append(p)
        p.deamon = True
        p.start()

# Part the main thread is running
if __name__ == '__main__':

    qOut = Queue()
    processes = []

    # Run the code on 6 processes
    getOptimumalObject(6)

    for i in range(len(processes)):
        processes[i].join()

    # Get the best optimized object and print the resulting value
    minimum = 1000000000000000000000000.

    while not qOut.empty():

        optimizeObject = qOut.get()

        if optimizeObject.GetTotalMass() < minimum:

            bestObject = optimizeObject
            minumum = optimizeObject.GetTotalMass()

    print(bestObject.GetTotalMass())
</code>```

This code works as long as I only use 4 processes. If I run more than 4, say 6 as in the example, two processes will get stuck at the end of the code and the code will never stop running as the main thread is still stuck at the processes[i].join(). I think the two processes have a problem in the qOut.put() in the optimizeAlgorithm. When I remove the qOut.put() the code exits giving the error that bestObject doesn't exists, as expected. However, the strange thing is that if I print, for example, the objects minimum after the qOut.put() it will print it, but the process will stay stay alive using 0% of my CPU. This forces the main code to stay alive as well.

I'm quite new to the multiprocessing and a read that OOP and multiprocessing don't always work very well hand in hand. Am I using a wrong approach here? It is kind of frustrating as it almost works, but isn't working for more than 4 processes.

Thanks in advance!

答:
I got it to work using pipes to send my objects!

this is the code I used:

```<code>from multiprocessing import Process, Pipe
from SupportCostModel.SupportStructure import SupportStructure, SupportType
import random

# Method the processes will execute
def optimizeAlgoritm(optimizeObject, conn):

    optimizeObject.Optimize()

    # Send the optimized object
    conn.send(optimizeObject)

# Method the main thread will execute
def getOptimumalObject(n):

    connections = []

    for i in range(n):

        # Create a pipe for each of the processes that is started
        parent_conn, child_conn = Pipe()

        # Save the parent connections
        connections.append(parent_conn)

        # Create objects that needs to by optimized using different initial conditions
        if i == 0:
            structure = SupportStructure(SupportType.Monopile)
        else:
            structure = SupportStructure(SupportType.Monopile)
            structure.properties.D_mp = random.randrange(4., 10.)
            structure.properties.Dtrat_tower = random.randrange(90., 120.)
            structure.properties.Dtrat_mud = random.randrange(60., 100.)
            structure.properties.Dtrat_mp = random.randrange(60., 100.)
            structure.UpdateAll()

        # Create a new process with a new nested object that should be optimized
        p = Process(target = optimizeAlgoritm, args = (structure, child_conn))
        processes.append(p)
        p.deamon = True
        p.start()

    # Receive the optimized objects
    for i in range(n):
        optimizedObjects.append(connections[i].recv())

# Part the main thread is running
if __name__ == '__main__':

    processes = []
    optimizedObjects = []

    # Run the code on 6 processes
    getOptimumalObject(6)

    for i in range(len(processes)):
        processes[i].join()

    # Get the best optimized object and print the resulting value
    minimum = 1000000000000000000000000.

    for i in range(len(optimizedObjects)):

        optimizeObject = optimizedObjects[i]

        if optimizeObject.GetTotalMass() < minimum:

            bestObject = optimizeObject
            minumum = optimizeObject.GetTotalMass()

    print(bestObject.GetTotalMass())
</code>```

Body:
I'm writing an optimization algorithm which uses several different initial conditions to increase the chance of finding the global optimum. I'm trying to make the code run faster by using the multiprocessing library, and running the optimizations on different processes.

This is the way my code is basically working now:

from multiprocessing import Process, Queue
from SupportCostModel.SupportStructure import SupportStructure, SupportType

# Method the processes will execute
def optimizeAlgoritm(optimizeObject, qOut):

    optimizeObject.Optimize()
    qOut.put(optimizeObject)

# Method the main thread will execute
def getOptimumalObject(n):

    for i in range(n):

        # Create a new process with a new nested object that should be optimized
        p = Process(target = optimizeAlgoritm, args = (SupportStructure(SupportType.Monopile), qOut))
        processes.append(p)
        p.deamon = True
        p.start()

# Part the main thread is running
if __name__ == '__main__':

    qOut = Queue()
    processes = []

    # Run the code on 6 processes
    getOptimumalObject(6)

    for i in range(len(processes)):
        processes[i].join()

    # Get the best optimized object and print the resulting value
    minimum = 1000000000000000000000000.

    while not qOut.empty():

        optimizeObject = qOut.get()

        if optimizeObject.GetTotalMass() < minimum:

            bestObject = optimizeObject
            minumum = optimizeObject.GetTotalMass()

    print(bestObject.GetTotalMass())

This code works as long as I only use 4 processes. If I run more than 4, say 6 as in the example, two processes will get stuck at the end of the code and the code will never stop running as the main thread is still stuck at the processes[i].join(). I think the two processes have a problem in the qOut.put() in the optimizeAlgorithm. When I remove the qOut.put() the code exits giving the error that bestObject doesn't exists, as expected. However, the strange thing is that if I print, for example, the objects minimum after the qOut.put() it will print it, but the process will stay stay alive using 0% of my CPU. This forces the main code to stay alive as well.

I'm quite new to the multiprocessing and a read that OOP and multiprocessing don't always work very well hand in hand. Am I using a wrong approach here? It is kind of frustrating as it almost works, but isn't working for more than 4 processes.

Thanks in advance!

Body:
I got it to work using pipes to send my objects!

this is the code I used:

from multiprocessing import Process, Pipe
from SupportCostModel.SupportStructure import SupportStructure, SupportType
import random

# Method the processes will execute
def optimizeAlgoritm(optimizeObject, conn):

    optimizeObject.Optimize()

    # Send the optimized object
    conn.send(optimizeObject)

# Method the main thread will execute
def getOptimumalObject(n):

    connections = []

    for i in range(n):

        # Create a pipe for each of the processes that is started
        parent_conn, child_conn = Pipe()

        # Save the parent connections
        connections.append(parent_conn)

        # Create objects that needs to by optimized using different initial conditions
        if i == 0:
            structure = SupportStructure(SupportType.Monopile)
        else:
            structure = SupportStructure(SupportType.Monopile)
            structure.properties.D_mp = random.randrange(4., 10.)
            structure.properties.Dtrat_tower = random.randrange(90., 120.)
            structure.properties.Dtrat_mud = random.randrange(60., 100.)
            structure.properties.Dtrat_mp = random.randrange(60., 100.)
            structure.UpdateAll()

        # Create a new process with a new nested object that should be optimized
        p = Process(target = optimizeAlgoritm, args = (structure, child_conn))
        processes.append(p)
        p.deamon = True
        p.start()

    # Receive the optimized objects
    for i in range(n):
        optimizedObjects.append(connections[i].recv())

# Part the main thread is running
if __name__ == '__main__':

    processes = []
    optimizedObjects = []

    # Run the code on 6 processes
    getOptimumalObject(6)

    for i in range(len(processes)):
        processes[i].join()

    # Get the best optimized object and print the resulting value
    minimum = 1000000000000000000000000.

    for i in range(len(optimizedObjects)):

        optimizeObject = optimizedObjects[i]

        if optimizeObject.GetTotalMass() < minimum:

            bestObject = optimizeObject
            minumum = optimizeObject.GetTotalMass()

    print(bestObject.GetTotalMass())


问:
How to Mock a named constructor dependency
I have an MVC controller that has the following signature:

```<code> public AccountController(
            IRulesFacade rulesFacade,
            [Dependency("personAppClient")] IAppClient personAppClient,
            [Dependency("notificationsClient")] IAppClient notificationsClient,
            ITransformer<ExpandoObject> transformer)
</code>```

You will notice that there are two CTOR properties which are the same Interface type but which are named differently.

In my Unity configuration I have the following lines of code:

```<code> container.RegisterType<IAppClientConfigProvider, AppClientConfigProvider>("personAppClient", new InjectionConstructor(
                new ResolvedParameter<IAppClient>("personAppClient"),
                personBaseUrl));
container.RegisterType<IAppClientConfigProvider, AppClientConfigProvider>("notificationsClient", new InjectionConstructor(
                new ResolvedParameter<IAppClient>("notificationsClient"),
                notificationsBaseUrl));
</code>```

In my UnitTest I have the following with some related Setup code:

```<code>MockAppClient = new Mock<IAppClient>();

MockAppClient.Setup(ac => ac.AddAsync<ExpandoObject>(It.IsAny<ExpandoObject>()))
             .Returns(() => Task.FromResult(User));
</code>```

My question is how do I create a Mock that can provide the necessary "name" for the Dependency?

答:
Create two separate mocks of the dependencies and pass that to the SUT</p>

```<code>// Arrange
var personAppClientMock = new Mock<IAppClient>();
personAppClientMock.Setup(_ => _.AddAsync(It.IsAny<ExpandoObject>()))
                   .ReturnsAsync(User);

var notificationsClientMock = new Mock<IAppClient>();
notificationsClientMock.Setup(_ => _.AddAsync(It.IsAny<ExpandoObject>()))
                       .ReturnsAsync(SomeOtherObject);

//...other related setup code

var sut = new AccountController(
                  rulesFacadeMock.Object,
                  personAppClientMock.Object,
                  notificationsClientMock.Object,
                  transformerMock.Object);

// Act
//...
</code>```

Body:
I have an MVC controller that has the following signature:

 public AccountController(
            IRulesFacade rulesFacade,
            [Dependency("personAppClient")] IAppClient personAppClient,
            [Dependency("notificationsClient")] IAppClient notificationsClient,
            ITransformer<ExpandoObject> transformer)

You will notice that there are two CTOR properties which are the same Interface type but which are named differently.

In my Unity configuration I have the following lines of code:

 container.RegisterType<IAppClientConfigProvider, AppClientConfigProvider>("personAppClient", new InjectionConstructor(
                new ResolvedParameter<IAppClient>("personAppClient"),
                personBaseUrl));
container.RegisterType<IAppClientConfigProvider, AppClientConfigProvider>("notificationsClient", new InjectionConstructor(
                new ResolvedParameter<IAppClient>("notificationsClient"),
                notificationsBaseUrl));

In my UnitTest I have the following with some related Setup code:

MockAppClient = new Mock<IAppClient>();

MockAppClient.Setup(ac => ac.AddAsync<ExpandoObject>(It.IsAny<ExpandoObject>()))
             .Returns(() => Task.FromResult(User));

My question is how do I create a Mock that can provide the necessary "name" for the Dependency?

Body:
Create two separate mocks of the dependencies and pass that to the SUT

// Arrange
var personAppClientMock = new Mock<IAppClient>();
personAppClientMock.Setup(_ => _.AddAsync(It.IsAny<ExpandoObject>()))
                   .ReturnsAsync(User);

var notificationsClientMock = new Mock<IAppClient>();
notificationsClientMock.Setup(_ => _.AddAsync(It.IsAny<ExpandoObject>()))
                       .ReturnsAsync(SomeOtherObject);

//...other related setup code

var sut = new AccountController(
                  rulesFacadeMock.Object,
                  personAppClientMock.Object,
                  notificationsClientMock.Object,
                  transformerMock.Object);

// Act
//...


问:
How to suppress class path entry warnings while deploying war on JBOSS EAP 6.2.0?
When I deploy a war on JBOSS EAP6.2.0 I get

```<code>13:08:59,402 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry jaxp-api.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncconsole.war/WEB-INF/lib/saaj-api.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,403 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry jax-qname.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncconsole.war/WEB-INF/lib/saaj-api.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,403 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry servlet.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncconsole.war/WEB-INF/lib/saaj-api.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,767 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_cs.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,768 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_de_DE.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,768 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_es.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,769 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_fr.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,769 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_hu.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,770 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_it.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,770 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ja_JP.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,771 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ko_KR.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,772 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_pl.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,775 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_pt_BR.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,780 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ru.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,785 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_zh_CN.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,792 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_zh_TW.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,798 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_cs.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,802 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_de_DE.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,807 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_es.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,813 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_fr.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,818 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_hu.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,823 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_it.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,828 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ja_JP.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,835 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ko_KR.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,840 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_pl.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,845 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_pt_BR.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,850 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ru.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,856 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_zh_CN.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,862 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_zh_TW.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,867 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbynet.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyrun.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,872 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_cs.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,878 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_de_DE.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,883 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_es.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,888 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_fr.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,895 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_hu.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,900 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_it.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,904 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ja_JP.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,909 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ko_KR.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,916 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_pl.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,921 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_pt_BR.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,926 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ru.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,929 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_zh_CN.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,950 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_zh_TW.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:09:00,000 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry lib/log4j-1.2.15.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/logadapter.jar  does not point to a valid jar for a Class-Path reference.
13:09:00,001 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry lib/wlfullclient.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/logadapter.jar  does not point to a valid jar for a Class-Path reference.
13:09:00,144 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry jaxp-api.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/saaj-api.jar  does not point to a valid jar for a Class-Path reference.
13:09:00,146 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry jax-qname.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/saaj-api.jar  does not point to a valid jar for a Class-Path reference.
13:09:00,152 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry servlet.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/saaj-api.jar  does not point to a valid jar for a Class-Path reference.
</code>```

How do I suppress these warnings?

答:
We have the same issue with a jar we are using that itself is requiring (via Maven pom.xml) some provided (means the server should provide it and they are not included in the jar itself) jars.
We do not use the functionality (classes) that needs these jars and thus it is not an issue.

We currently just ignore it.

I guess manipulating the contained pom.xml and foo.jar!/META-INF/MANIFEST by removing the reference entries could be a workaround.

If one uses logback you could write a log filter to specifically filter it out e.g. via some regexp ^\QJBAS015960: Class Path entry \E(somelib-1.2.3|somelib2|somelib3)\.jar.*.

Another option, if you can manipulate the referencing jar/project, is, to split the project into separate ones, each implementing more dedicated functionality, so the dependencies on the referenced libs will be less for each (sub)project and thus only the really required ones may be left.

Body:
When I deploy a war on JBOSS EAP6.2.0 I get

13:08:59,402 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry jaxp-api.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncconsole.war/WEB-INF/lib/saaj-api.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,403 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry jax-qname.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncconsole.war/WEB-INF/lib/saaj-api.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,403 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry servlet.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncconsole.war/WEB-INF/lib/saaj-api.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,767 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_cs.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,768 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_de_DE.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,768 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_es.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,769 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_fr.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,769 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_hu.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,770 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_it.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,770 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ja_JP.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,771 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ko_KR.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,772 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_pl.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,775 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_pt_BR.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,780 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ru.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,785 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_zh_CN.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,792 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_zh_TW.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derby.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,798 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_cs.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,802 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_de_DE.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,807 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_es.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,813 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_fr.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,818 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_hu.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,823 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_it.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,828 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ja_JP.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,835 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ko_KR.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,840 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_pl.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,845 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_pt_BR.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,850 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ru.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,856 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_zh_CN.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,862 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_zh_TW.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyclient.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,867 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbynet.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbyrun.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,872 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_cs.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,878 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_de_DE.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,883 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_es.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,888 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_fr.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,895 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_hu.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,900 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_it.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,904 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ja_JP.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,909 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ko_KR.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,916 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_pl.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,921 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_pt_BR.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,926 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_ru.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,929 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_zh_CN.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:08:59,950 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry derbyLocale_zh_TW.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/derbytools.jar  does not point to a valid jar for a Class-Path reference.
13:09:00,000 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry lib/log4j-1.2.15.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/logadapter.jar  does not point to a valid jar for a Class-Path reference.
13:09:00,001 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry lib/wlfullclient.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/logadapter.jar  does not point to a valid jar for a Class-Path reference.
13:09:00,144 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry jaxp-api.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/saaj-api.jar  does not point to a valid jar for a Class-Path reference.
13:09:00,146 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry jax-qname.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/saaj-api.jar  does not point to a valid jar for a Class-Path reference.
13:09:00,152 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry servlet.jar in /C:/Kony/KonySync/jboss-eap-6.2/bin/content/syncservice.war/WEB-INF/lib/saaj-api.jar  does not point to a valid jar for a Class-Path reference.

How do I suppress these warnings?


问:
Correct meaning of SecondActivity.class in intents in Android?
```<code>Intent intent = new Intent(getApplicationContext(), SecondActivity.class);
startService(intent);
</code>```

What i understood is, till this line of code "SecondActivity object" is not created and we are sending Runtime data of SecondActivity to Intent. So, what i think is at runtime compiler adds some extra code to second Activity.

I know this is related to Reflection but still i don't understand correctly. Does ".class" denotes a "static Variable class" of type "Class" in "SecondActivity" class at runtime, something like,

```<code>static Class class = .......
</code>```

Are we accessing Class object through "class static Variable"? Does compiler at runtime adds this static variable through which we are getting "Class object" of SecondActivity? Is my understanding correct?

答:
Write it as

Intent intent = new Intent(YourActivity.this, SecondActivity.class);
startService(intent);```

This means that you are refering  to second Activity which is not created yet so you are using its class file to load class in memory

Body:
Intent intent = new Intent(getApplicationContext(), SecondActivity.class);
startService(intent);

What i understood is, till this line of code "SecondActivity object" is not created and we are sending Runtime data of SecondActivity to Intent. So, what i think is at runtime compiler adds some extra code to second Activity.

I know this is related to Reflection but still i don't understand correctly. Does ".class" denotes a "static Variable class" of type "Class" in "SecondActivity" class at runtime, something like,

static Class class = .......

Are we accessing Class object through "class static Variable"? Does compiler at runtime adds this static variable through which we are getting "Class object" of SecondActivity? Is my understanding correct?

Body:
Write it as

Intent intent = new Intent(YourActivity.this, SecondActivity.class);
startService(intent);

This means that you are refering  to second Activity which is not created yet so you are using its class file to load class in memory