问:
Google API places intent PlaceAutoComplete crashing after launch
After searching a lot of solutions at stackoverflow none of the posts help me.
I change my fingerprint,i wrote in the manifest:

```<code>  <meta-data
     android:name="com.google.geo.API_KEY"
     android:value="@string/google_api_key1" />
</code>```

I add this code to my fragment:

```<code>@Override
public void showEditAddress() {
    try {
        Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN)
                .build(getActivity());
        startActivityForResult(intent, Constants.PLACE_AUTOCOMPLETE_REQUEST_CODE);
    } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
        // TODO: Handle the error.
        Log.e(TAG, "Show error: " + e.toString());
    }

}

@Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == Constants.PLACE_AUTOCOMPLETE_REQUEST_CODE) {
            if (resultCode == Activity.RESULT_OK) {
                Place place = PlaceAutocomplete.getPlace(getContext(), data);
                Log.i(TAG, "Place: " + place.getName());
            } else if (resultCode == PlaceAutocomplete.RESULT_ERROR) {
                Status status = PlaceAutocomplete.getStatus(getContext(), data);
                // TODO: Handle the error.
                Log.e(TAG, "Error Places: " + status.toString());

            } else if (resultCode == Activity.RESULT_CANCELED) {
                // The user canceled the operation.
            }
        }
    }
</code>```

But still after its display the activity of google its crush, i am working on it couple of days and nothing works :(

Here what i get from the console:

```<code>teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: ViewPostImeInputStage processPointer 0
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: ViewPostImeInputStage processPointer 1
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: MSG_WINDOW_FOCUS_CHANGED 0
teame.co.il.team_e V/FA: Recording user engagement, ms: 7599
teame.co.il.team_e V/FA: Connecting to remote service
teame.co.il.team_e V/FA: Activity paused, time: 431544392
teame.co.il.team_e D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=7599, firebase_screen_class(_sc)=MyProfileActivity, firebase_screen_id(_si)=4880950556395788363}]
teame.co.il.team_e V/FA: Connection attempt already in progress
teame.co.il.team_e D/FA: Connected to remote service
teame.co.il.team_e V/FA: Processing queued up service tasks: 2
teame.co.il.team_e D/InputTransport: Input channel destroyed: fd=109
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 63 - 0, 834) vi=Rect(0, 63 - 0, 834) or=1
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: Relayout returned: oldFrame=[0,0][1080,2220] newFrame=[0,0][1080,2220] result=0x1 surface={isValid=true 508726705152} surfaceGenerationChanged=false
teame.co.il.team_e D/ScrollView:  onsize change changed
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: MSG_WINDOW_FOCUS_CHANGED 1
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true 508726705152}
teame.co.il.team_e V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@d2f12df nm : teame.co.il.team_e ic=null
teame.co.il.team_e I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
teame.co.il.team_e D/InputTransport: Input channel constructed: fd=109
teame.co.il.team_e E/MyProfileFragment: Error Places: Status{statusCode=ERROR, resolution=null}   //The Error from the log
teame.co.il.team_e V/FA: Activity resumed, time: 431544700
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 63 - 0, 126) vi=Rect(0, 63 - 0, 126) or=1
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: Relayout returned: oldFrame=[0,0][1080,2220] newFrame=[0,0][1080,2220] result=0x1 surface={isValid=true 508726705152} surfaceGenerationChanged=false
teame.co.il.team_e D/ScrollView:  onsize change changed
teame.co.il.team_e V/FA: Inactivity, disconnecting from the service
</code>```

Image of the restiction ay my google api console:

答:
From your console we can see that the MyProfileActivity activity is making constant calls to Relayout.
These calls are very heavy on the phone.
When an app reaches a limit of memory on the phone the Operating System automatically crashes the app.
This is why your app keeps crashing.
Also please keep in mind that the behavior may be phone dependent. Although faulty code will jam up the the thread(s), but if you are using a phone with higher specs then the app might just lag and be frozen or unresponsive, whereas on a phone with lower specs the app would just crash.

To fix this, check MyProfileActivity for any listeners which for whatever reason are constantly being called.
A possible cause is that you have code that requests for location permission which is called within a Google Maps listener.
Hint: check the onResume() listener. If you have a permission checker which constantly asks for permission, and you have to click 'Don't ask again' and Deny the permission, it will constantly make the calls to the Operating System to request for permission.

On the phone, go to Settings -> Apps. Select your app from the list. Scroll down to the App Settings section and click Permissions. Enable all permissions on the app. Then, try running your app. If your app does not crash, then you will have found that the cause of your problem was the constant hidden calls requesting permissions from the Operating System.

The permanent fix is to move the call for permission request or whatever else is being called from a listener which is called all the time such as onResume to somewhere it is called less often or just once, such as onMapReady. The elegant solution is to remember the user's preference instead of asking them every time they load the map, so if they wanted to enable location permissions they would have to do so from the Settings app of their phone, or even from a Settings menu within the app.

Body:
After searching a lot of solutions at stackoverflow none of the posts help me.
I change my fingerprint,i wrote in the manifest:

  <meta-data
     android:name="com.google.geo.API_KEY"
     android:value="@string/google_api_key1" />

I add this code to my fragment:

@Override
public void showEditAddress() {
    try {
        Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN)
                .build(getActivity());
        startActivityForResult(intent, Constants.PLACE_AUTOCOMPLETE_REQUEST_CODE);
    } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
        // TODO: Handle the error.
        Log.e(TAG, "Show error: " + e.toString());
    }

}

@Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == Constants.PLACE_AUTOCOMPLETE_REQUEST_CODE) {
            if (resultCode == Activity.RESULT_OK) {
                Place place = PlaceAutocomplete.getPlace(getContext(), data);
                Log.i(TAG, "Place: " + place.getName());
            } else if (resultCode == PlaceAutocomplete.RESULT_ERROR) {
                Status status = PlaceAutocomplete.getStatus(getContext(), data);
                // TODO: Handle the error.
                Log.e(TAG, "Error Places: " + status.toString());

            } else if (resultCode == Activity.RESULT_CANCELED) {
                // The user canceled the operation.
            }
        }
    }

But still after its display the activity of google its crush, i am working on it couple of days and nothing works :(

Here what i get from the console:

teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: ViewPostImeInputStage processPointer 0
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: ViewPostImeInputStage processPointer 1
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: MSG_WINDOW_FOCUS_CHANGED 0
teame.co.il.team_e V/FA: Recording user engagement, ms: 7599
teame.co.il.team_e V/FA: Connecting to remote service
teame.co.il.team_e V/FA: Activity paused, time: 431544392
teame.co.il.team_e D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=7599, firebase_screen_class(_sc)=MyProfileActivity, firebase_screen_id(_si)=4880950556395788363}]
teame.co.il.team_e V/FA: Connection attempt already in progress
teame.co.il.team_e D/FA: Connected to remote service
teame.co.il.team_e V/FA: Processing queued up service tasks: 2
teame.co.il.team_e D/InputTransport: Input channel destroyed: fd=109
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 63 - 0, 834) vi=Rect(0, 63 - 0, 834) or=1
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: Relayout returned: oldFrame=[0,0][1080,2220] newFrame=[0,0][1080,2220] result=0x1 surface={isValid=true 508726705152} surfaceGenerationChanged=false
teame.co.il.team_e D/ScrollView:  onsize change changed
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: MSG_WINDOW_FOCUS_CHANGED 1
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true 508726705152}
teame.co.il.team_e V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@d2f12df nm : teame.co.il.team_e ic=null
teame.co.il.team_e I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
teame.co.il.team_e D/InputTransport: Input channel constructed: fd=109
teame.co.il.team_e E/MyProfileFragment: Error Places: Status{statusCode=ERROR, resolution=null}   //The Error from the log
teame.co.il.team_e V/FA: Activity resumed, time: 431544700
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 63 - 0, 126) vi=Rect(0, 63 - 0, 126) or=1
teame.co.il.team_e D/ViewRootImpl@d7aa753[MyProfileActivity]: Relayout returned: oldFrame=[0,0][1080,2220] newFrame=[0,0][1080,2220] result=0x1 surface={isValid=true 508726705152} surfaceGenerationChanged=false
teame.co.il.team_e D/ScrollView:  onsize change changed
teame.co.il.team_e V/FA: Inactivity, disconnecting from the service

Image of the restiction ay my google api console:


来源: stackexchange

问:
How to use data (rather than an identifier) to grant postgres permissions
I want to use the following function (as a trigger on a table's inserts):

```<code>CREATE OR REPLACE FUNCTION insert_authid_fn() RETURNS trigger AS $$
BEGIN
  GRANT ALL ON DATABASE testdb TO NEW.username;
  RETURN NEW;
END;
$$ LANGUAGE plpgsql;
</code>```

I get the error:

```<code>ERROR:  syntax error at or near "."
LINE 3:   GRANT ALL ON DATABASE testdb TO NEW.username;
</code>```

because New.username is value, rather than an identifier.

How can I achieve this GRANT?

答:
syntactically:

```<code>CREATE OR REPLACE FUNCTION insert_authid_fn() RETURNS trigger AS $$
BEGIN
  execute format ('GRANT ALL ON DATABASE testdb TO %I',NEW.username);
  RETURN NEW;
END;
$$ LANGUAGE plpgsql;
</code>```

But I doubt it is a good idea in general

ContentLicense: CC BY-SA 3.0

Body:
I want to use the following function (as a trigger on a table's inserts):

CREATE OR REPLACE FUNCTION insert_authid_fn() RETURNS trigger AS $$
BEGIN
  GRANT ALL ON DATABASE testdb TO NEW.username;
  RETURN NEW;
END;
$$ LANGUAGE plpgsql;

I get the error:

ERROR:  syntax error at or near "."
LINE 3:   GRANT ALL ON DATABASE testdb TO NEW.username;

because New.username is value, rather than an identifier.

How can I achieve this GRANT?

Body:
syntactically:

CREATE OR REPLACE FUNCTION insert_authid_fn() RETURNS trigger AS $$
BEGIN
  execute format ('GRANT ALL ON DATABASE testdb TO %I',NEW.username);
  RETURN NEW;
END;
$$ LANGUAGE plpgsql;

But I doubt it is a good idea in general


问:
How to add members to a Group using Microsoft Graph API
How do I add Members to a Group via Microsoft Graph API?

According to documentation for adding Member to a particular Group, it requires the call below:

POST https://graph.microsoft.com/v1.0/groups/{id}/members/$ref
Content-type: application/json
Content-length: 30
{
    "@odata.id": "https://graph.microsoft.com/v1.0/users/{id}"
}
```

<p>My questions lies in this API:</p>

```https://graph.microsoft.com/v1.0/groups/{id}/members/$ref
```

{id} => the group id,

members => adding members to the group

Now where is the users/members data/parameter to be added or posted?

Is it  "@odata.id": "https://graph.microsoft.com/v1.0/users/{id}"?

Do I post @odata.id values as a member/users parameter when adding a member to a group?

答:
That is correct. What you're technically passing is an ODATA Reference (ref$) to the user object within Active Directory rather than just an id.

To illustrate, lets take this fictitious user:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
    "id": "48d31887-5fad-4d73-a9f5-3c356e68a038",
    "businessPhones": [
        "+1 412 555 0109"
    ],
    "displayName": "Megan Bowen",
    "givenName": "Megan",
    "jobTitle": "Auditor",
    "mail": "MeganB@M365x214355.onmicrosoft.com",
    "mobilePhone": null,
    "officeLocation": "12/1110",
    "preferredLanguage": "en-US",
    "surname": "Bowen",
    "userPrincipalName": "MeganB@M365x214355.onmicrosoft.com"
}
```

<p>If we wanted to add Megan to the a Group with an <code>id</code> of <code>02bd9fd6-8f93-4758-87c3-1fb73740a315</code> the call would look like this:</p>

<pre class="lang-http prettyprint-override"><code>POST https://graph.microsoft.com/v1.0/groups/02bd9fd6-8f93-4758-87c3-1fb73740a315/members/$ref
Content-type: application/json

{
  "@odata.id": "https://graph.microsoft.com/v1.0/users/MeganB@M365x214355.onmicrosoft.com"
}
</code>```

Body:
How do I add Members to a Group via Microsoft Graph API?

According to documentation for adding Member to a particular Group, it requires the call below:

POST https://graph.microsoft.com/v1.0/groups/{id}/members/$ref
Content-type: application/json
Content-length: 30
{
    "@odata.id": "https://graph.microsoft.com/v1.0/users/{id}"
}

My questions lies in this API:

https://graph.microsoft.com/v1.0/groups/{id}/members/$ref

{id} => the group id,

members => adding members to the group

Now where is the users/members data/parameter to be added or posted?

Is it  "@odata.id": "https://graph.microsoft.com/v1.0/users/{id}"?

Do I post @odata.id values as a member/users parameter when adding a member to a group?

Body:
That is correct. What you're technically passing is an ODATA Reference (ref$) to the user object within Active Directory rather than just an id.

To illustrate, lets take this fictitious user:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
    "id": "48d31887-5fad-4d73-a9f5-3c356e68a038",
    "businessPhones": [
        "+1 412 555 0109"
    ],
    "displayName": "Megan Bowen",
    "givenName": "Megan",
    "jobTitle": "Auditor",
    "mail": "MeganB@M365x214355.onmicrosoft.com",
    "mobilePhone": null,
    "officeLocation": "12/1110",
    "preferredLanguage": "en-US",
    "surname": "Bowen",
    "userPrincipalName": "MeganB@M365x214355.onmicrosoft.com"
}

If we wanted to add Megan to the a Group with an id of 02bd9fd6-8f93-4758-87c3-1fb73740a315 the call would look like this:

POST https://graph.microsoft.com/v1.0/groups/02bd9fd6-8f93-4758-87c3-1fb73740a315/members/$ref
Content-type: application/json

{
  "@odata.id": "https://graph.microsoft.com/v1.0/users/MeganB@M365x214355.onmicrosoft.com"
}


问:
Fine-tuning / Retraining transferred learning model with an additional image set
Using the retrain.py script provided in the tensorflow source example, I've retrained the top layer of the inception-v3 model to be able to classify the flower set (provided image set of the 5 flowers).

What I am trying to do now, is to take the new transferred learning model (TL-model), and expand upon it with two new sets of flowers without having to completely retrain the entire model. (5 categories of flowers -> 7 categories of flowers)

My approaches:

Replacing the base model (inception-v3) with the TL-model and attempting to build of that on startup. This results in various duplicates of tensors and ops at the top layer and the loss of the softmax subgraph.

Loading in meta graphs of the TL-model. This approach seemingly works great if I only needed to add new images to the previous categories of flowers that were already present in the model. Adding a new category breaks this approach and causes it to crash out as there are tensor size differences between the meta graph and new model to be trained.

Restoring checkpoints, resulted in the same problem as the meta graphs.

I feel like I am fundamentally missing something and approaching this problem from the wrong direction. Any insight at all is greatly appreciated.

答:
(Converted from a comment to an answer, per @dga's request)

Unfortunately this isn't easy without doing some 'brain surgery' on the model structure. I don't have a great answer, since I've never done this myself, but in theory you should be able to restore the old five-category fully-connected layer into a new extended seven-category version, and then rerun the training


问:
HFP/HSP profile in linux
I have Ubuntu 16.04 and already installed BlueZ 5.37, PulseAudio 10.0, and ofono 1.20 (clone from github).

And I need to use phone like modem for transmitting my phone calls to computer. I paired my telephone with PC, made device trust and connect (all actions are successfully). I think problem with ofono, because I can play music (which use the A2DP) but if i want use hends free or headset profile - I have no sound on PC.

In pacmd (PulseAudio console tool) list-cards I see my bluetooth device, but Headset Audio Gateway HFP/HSP is not avalible. Also I tested it on different devices and computers.

Thank you in advice.

答:
My Solution:

I just found my solution in Fedora 26, using Plantronics Legend and Pluggable Bluetooth USB, after a lot of searching.

I am going back through my history, and updating threads with my solution where I can.  This worked for me, direct from Plugable (which is the USB module I am using).

See this post:  plugable-usb-bluetooth-adapter-solving-hfphsp-profile-issues-on-linux

Command Summary per Above Link:

wget https://s3.amazonaws.com/plugable/bin/fw-0a5c_21e8.hcd

sudo mkdir /lib/firmware/brcm

sudo mv fw-0a5c_21e8.hcd /lib/firmware/brcm/BCM20702A0-0a5c-21e8.hcd

sudo cp /lib/firmware/brcm/BCM20702A0-0a5c-21e8.hcd /lib/firmware/brcm/BCM20702A1-0a5c-21e8.hcd

Then reboot.

Title: HFP/HSP profile in linux


问:
echoing mid execution is not being sent to the recipient
```<code>$output = ob_get_contents();
        ob_end_clean();
        echo json_encode($data);
        ob_start();
        echo $output;
</code>```

This code is called as an API from another server and I want to send the json data back to that server but I want to keep $output in the output buffer so later I can log it into a file.  The json_encode($data); is not being sent to the requesting script.  I have tried many variations using flush() and ob_flush but not have worked.  When I add die() immediately after the json_encode($data); line it works except I don't actually want it to die() at that moment. how can I fix this?

答:
What about:

Store the result in a variable, echo the variable, log the variable. No need for output buffering:

```<code>$output = json_encode($data);
echo $output;
log_to_whatever($output);
</code>```

If you do want output buffering, then you should start buffering before you echo:

```<code>ob_start();
echo json_encode($data);
$output = ob_get_clean(); // Shorthand for get and clean
echo $output;
log_to_whatever($output);
</code>```

Instead of cleaning the buffer you can actually flush the buffer (= send it to the client), but still get it into a variable too.

```<code>ob_start();
echo json_encode($data);
$output = ob_get_flush(); // Shorthand for get and flush
// echo $output; This is not needed anymore, because it is already flushed
log_to_whatever($output);
</code>```

But in either case, it seems these are cumbersome alternatives for the simple first solution, at least in the scenario you presented.

Body:
$output = ob_get_contents();
        ob_end_clean();
        echo json_encode($data);
        ob_start();
        echo $output;

This code is called as an API from another server and I want to send the json data back to that server but I want to keep $output in the output buffer so later I can log it into a file.  The json_encode($data); is not being sent to the requesting script.  I have tried many variations using flush() and ob_flush but not have worked.  When I add die() immediately after the json_encode($data); line it works except I don't actually want it to die() at that moment. how can I fix this?

Body:
What about:

Store the result in a variable, echo the variable, log the variable. No need for output buffering:

$output = json_encode($data);
echo $output;
log_to_whatever($output);

If you do want output buffering, then you should start buffering before you echo:

ob_start();
echo json_encode($data);
$output = ob_get_clean(); // Shorthand for get and clean
echo $output;
log_to_whatever($output);

Instead of cleaning the buffer you can actually flush the buffer (= send it to the client), but still get it into a variable too.

ob_start();
echo json_encode($data);
$output = ob_get_flush(); // Shorthand for get and flush
// echo $output; This is not needed anymore, because it is already flushed
log_to_whatever($output);

But in either case, it seems these are cumbersome alternatives for the simple first solution, at least in the scenario you presented.


问:
Pipelining pandas: create columns that depend on freshly created ones
Let's say you have the following DataFrame

```<code>df=pd.DataFrame({'A': [1, 2]})
</code>```

now I want to construct the column B = A+1, then the column C=A+2 and D = B +C. These calculations are only here for simplicity. Typically, I want to use some e.g. nonlinear transformations, normalizations etc.

what one could do is the following:

```<code>df.assign(**{'B': lambda x: x['A'] +1, 'C': lambda x :['A']+2})\
    .assign(**{'D':lambda x: x['B']+ x['C']})
</code>```

However, this is obviously a bit annoying, specifically, if you have a large number of preprocessing steps in a pipeline. Putting both dictionaries together (even in an orderedDict) fails.

Is there a way to obtain a similar result faster or more elegantly?
Additionally, the same problem occurs, if you want to add a column that uses e.g. the sum of a just defined column. This, as far as I know, will always require two assign calls.

答:
You can using eval

```<code>df.eval("""
  B= A+1
  C= A+2
  D = B+C""", inplace=False)
Out[625]:
   A  B  C  D
0  1  2  3  5
1  2  3  4  7
</code>```

If you want the calculation within the query ''

```<code>df.eval('B=A.max()',inplace=True)
df
Out[647]:
   A  B
0  1  2
1  2  2
</code>```

Body:
Let's say you have the following DataFrame

df=pd.DataFrame({'A': [1, 2]})

now I want to construct the column B = A+1, then the column C=A+2 and D = B +C. These calculations are only here for simplicity. Typically, I want to use some e.g. nonlinear transformations, normalizations etc.

what one could do is the following:

df.assign(**{'B': lambda x: x['A'] +1, 'C': lambda x :['A']+2})\
    .assign(**{'D':lambda x: x['B']+ x['C']})

However, this is obviously a bit annoying, specifically, if you have a large number of preprocessing steps in a pipeline. Putting both dictionaries together (even in an orderedDict) fails.

Is there a way to obtain a similar result faster or more elegantly?
Additionally, the same problem occurs, if you want to add a column that uses e.g. the sum of a just defined column. This, as far as I know, will always require two assign calls.

Body:
You can using eval

df.eval("""
  B= A+1
  C= A+2
  D = B+C""", inplace=False)
Out[625]:
   A  B  C  D
0  1  2  3  5
1  2  3  4  7

If you want the calculation within the query ''

df.eval('B=A.max()',inplace=True)
df
Out[647]:
   A  B
0  1  2
1  2  2


问:
Recyclerview onclick show wrong data after do search and filtering
I tried to make recyclerview with lot data using edit text as searchview. It also show data when the item is clicked. But when i try to search data and click it, it gives wrong data or position. Even i already delete the word that i search it keep give wrong data.

This is my main adapter

```<code>    public class AllBlockAdapter extends RecyclerView.Adapter<AllBlockAdapter.AllBlockViewHolder> {
        private ArrayList<AllBlockItem> allBlockItemArrayList;
        Context context;

        public static class AllBlockViewHolder extends RecyclerView.ViewHolder {
            public ImageView imageView;
            public TextView textView1;
            public TextView textView2;

            private View itemView;

            ArrayList<AllBlockItem> allBlockItems = new ArrayList<AllBlockItem>();
            Context context;

            public AllBlockViewHolder(View itemView, Context context, ArrayList<AllBlockItem> allBlockItems) {
                super(itemView);
                this.allBlockItems = allBlockItems;
                this.context = context;
this.itemView = itemView;

                imageView = itemView.findViewById(R.id.blockImage);
                textView1 = itemView.findViewById(R.id.blockTitle);
                textView2 = itemView.findViewById(R.id.blockRecipe);
            }
        }

        public AllBlockAdapter(ArrayList<AllBlockItem> allBlockItems, Context context1) {
            allBlockItemArrayList = allBlockItems;
            context = context1;
        }

        @Override
        public AllBlockAdapter.AllBlockViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.allblock_item, parent, false);
            AllBlockViewHolder allBlockViewHolder = new AllBlockViewHolder(view, context, allBlockItemArrayList);
            return allBlockViewHolder;
        }

        @Override
        public void onBindViewHolder(final AllBlockAdapter.AllBlockViewHolder holder, int position) {
            AllBlockItem currentItem = allBlockItemArrayList.get(position);

            holder.imageView.setImageResource(currentItem.getImageResource());
            holder.textView1.setText(currentItem.getText1());
            holder.textView2.setText(currentItem.getText2());

            holder.itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                        int position = holder.getAdapterPosition();

                        AllBlockItem allBlockItem = holder.allBlockItems.get(position);
                        Intent intent = new Intent(this.context, AllBlockDetail.class);
                        intent.putExtra("mImageResource", allBlockItem.getImageResource());
                        intent.putExtra("mText1", allBlockItem.getText1());
                        intent.putExtra("mText2", allBlockItem.getText2());

                        this.context.startActivity(intent);
                    }
            });

        }

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

        public void filterList(ArrayList<AllBlockItem> filteredList) {
            allBlockItemArrayList = filteredList;
            notifyDataSetChanged();
        }
    }
</code>```

anyone can solve this ? Thank you

答:
I think the problem is that you aren't using the right value of  position.In other words,the position parameter,belongs to the onBindViewHolder() method, is expected to use only inside this method, because it isn't save due to the fact that it might be changed after filter operations.
On the other hand, using getAdapterPosition() ensures that you obtain the right position value.
So,I think if you use  getAdapterPosition() in the right way the problem will be solved.
I've modified your code so that it should work well.Please pay attention to the comments with asterisks.

public class AllBlockAdapter extends RecyclerView.Adapter {
    private ArrayList allBlockItemArrayList;
    Context context;

```<code>public static class AllBlockViewHolder extends RecyclerView.ViewHolder  {
    public ImageView imageView;
    public TextView textView1;
    public TextView textView2;

    //**** add this field****
    private View itemView;

    ArrayList<AllBlockItem> allBlockItems = new ArrayList<AllBlockItem>();
    Context context;

    public AllBlockViewHolder(View itemView, Context context, ArrayList<AllBlockItem> allBlockItems) {
        super(itemView);
        this.allBlockItems = allBlockItems;
        this.context = context;

        // ****initialize it here****
        this.itemView = itemView;

        imageView = itemView.findViewById(R.id.blockImage);
        textView1 = itemView.findViewById(R.id.blockTitle);
        textView2 = itemView.findViewById(R.id.blockRecipe);
    }

}

public AllBlockAdapter(ArrayList<AllBlockItem> allBlockItems, Context context1) {
    allBlockItemArrayList = allBlockItems;
    context = context1;
}

@Override
public AllBlockAdapter.AllBlockViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.allblock_item, parent, false);
    AllBlockViewHolder allBlockViewHolder = new AllBlockViewHolder(view, context, allBlockItemArrayList);
    return allBlockViewHolder;
}

@Override
public void onBindViewHolder(final AllBlockAdapter.AllBlockViewHolder holder, int position) {
    AllBlockItem currentItem = allBlockItemArrayList.get(position);

    holder.imageView.setImageResource(currentItem.getImageResource());
    holder.textView1.setText(currentItem.getText1());
    holder.textView2.setText(currentItem.getText2());

    //****set OnClickListener to it here ****
    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            // ****call getAdapterPosition() on the right ref****
            int position = holder.getAdapterPosition();

            AllBlockItem allBlockItem = holder.allBlockItems.get(position);
            Intent intent = new Intent(holder.itemView.getContext(), AllBlockDetail.class);
            intent.putExtra("mImageResource", allBlockItem.getImageResource());
            intent.putExtra("mText1", allBlockItem.getText1());
            intent.putExtra("mText2", allBlockItem.getText2());

            holder.itemView.getContext().startActivity(intent);
        }
    });

}

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

public void filterList(ArrayList<AllBlockItem> filteredList) {
    allBlockItemArrayList = filteredList;
    notifyDataSetChanged();
}}
</code>```

Body:
I tried to make recyclerview with lot data using edit text as searchview. It also show data when the item is clicked. But when i try to search data and click it, it gives wrong data or position. Even i already delete the word that i search it keep give wrong data.

This is my main adapter

    public class AllBlockAdapter extends RecyclerView.Adapter<AllBlockAdapter.AllBlockViewHolder> {
        private ArrayList<AllBlockItem> allBlockItemArrayList;
        Context context;

        public static class AllBlockViewHolder extends RecyclerView.ViewHolder {
            public ImageView imageView;
            public TextView textView1;
            public TextView textView2;

            private View itemView;

            ArrayList<AllBlockItem> allBlockItems = new ArrayList<AllBlockItem>();
            Context context;

            public AllBlockViewHolder(View itemView, Context context, ArrayList<AllBlockItem> allBlockItems) {
                super(itemView);
                this.allBlockItems = allBlockItems;
                this.context = context;
this.itemView = itemView;

                imageView = itemView.findViewById(R.id.blockImage);
                textView1 = itemView.findViewById(R.id.blockTitle);
                textView2 = itemView.findViewById(R.id.blockRecipe);
            }
        }

        public AllBlockAdapter(ArrayList<AllBlockItem> allBlockItems, Context context1) {
            allBlockItemArrayList = allBlockItems;
            context = context1;
        }

        @Override
        public AllBlockAdapter.AllBlockViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.allblock_item, parent, false);
            AllBlockViewHolder allBlockViewHolder = new AllBlockViewHolder(view, context, allBlockItemArrayList);
            return allBlockViewHolder;
        }

        @Override
        public void onBindViewHolder(final AllBlockAdapter.AllBlockViewHolder holder, int position) {
            AllBlockItem currentItem = allBlockItemArrayList.get(position);

            holder.imageView.setImageResource(currentItem.getImageResource());
            holder.textView1.setText(currentItem.getText1());
            holder.textView2.setText(currentItem.getText2());

            holder.itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                        int position = holder.getAdapterPosition();

                        AllBlockItem allBlockItem = holder.allBlockItems.get(position);
                        Intent intent = new Intent(this.context, AllBlockDetail.class);
                        intent.putExtra("mImageResource", allBlockItem.getImageResource());
                        intent.putExtra("mText1", allBlockItem.getText1());
                        intent.putExtra("mText2", allBlockItem.getText2());

                        this.context.startActivity(intent);
                    }
            });

        }

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

        public void filterList(ArrayList<AllBlockItem> filteredList) {
            allBlockItemArrayList = filteredList;
            notifyDataSetChanged();
        }
    }

anyone can solve this ? Thank you

Body:
I think the problem is that you aren't using the right value of  position.In other words,the position parameter,belongs to the onBindViewHolder() method, is expected to use only inside this method, because it isn't save due to the fact that it might be changed after filter operations.
On the other hand, using getAdapterPosition() ensures that you obtain the right position value.
So,I think if you use  getAdapterPosition() in the right way the problem will be solved.
I've modified your code so that it should work well.Please pay attention to the comments with asterisks.

public class AllBlockAdapter extends RecyclerView.Adapter {
    private ArrayList allBlockItemArrayList;
    Context context;

public static class AllBlockViewHolder extends RecyclerView.ViewHolder  {
    public ImageView imageView;
    public TextView textView1;
    public TextView textView2;

    //**** add this field****
    private View itemView;

    ArrayList<AllBlockItem> allBlockItems = new ArrayList<AllBlockItem>();
    Context context;

    public AllBlockViewHolder(View itemView, Context context, ArrayList<AllBlockItem> allBlockItems) {
        super(itemView);
        this.allBlockItems = allBlockItems;
        this.context = context;

        // ****initialize it here****
        this.itemView = itemView;

        imageView = itemView.findViewById(R.id.blockImage);
        textView1 = itemView.findViewById(R.id.blockTitle);
        textView2 = itemView.findViewById(R.id.blockRecipe);
    }

}

public AllBlockAdapter(ArrayList<AllBlockItem> allBlockItems, Context context1) {
    allBlockItemArrayList = allBlockItems;
    context = context1;
}

@Override
public AllBlockAdapter.AllBlockViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.allblock_item, parent, false);
    AllBlockViewHolder allBlockViewHolder = new AllBlockViewHolder(view, context, allBlockItemArrayList);
    return allBlockViewHolder;
}

@Override
public void onBindViewHolder(final AllBlockAdapter.AllBlockViewHolder holder, int position) {
    AllBlockItem currentItem = allBlockItemArrayList.get(position);

    holder.imageView.setImageResource(currentItem.getImageResource());
    holder.textView1.setText(currentItem.getText1());
    holder.textView2.setText(currentItem.getText2());

    //****set OnClickListener to it here ****
    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            // ****call getAdapterPosition() on the right ref****
            int position = holder.getAdapterPosition();

            AllBlockItem allBlockItem = holder.allBlockItems.get(position);
            Intent intent = new Intent(holder.itemView.getContext(), AllBlockDetail.class);
            intent.putExtra("mImageResource", allBlockItem.getImageResource());
            intent.putExtra("mText1", allBlockItem.getText1());
            intent.putExtra("mText2", allBlockItem.getText2());

            holder.itemView.getContext().startActivity(intent);
        }
    });

}

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

public void filterList(ArrayList<AllBlockItem> filteredList) {
    allBlockItemArrayList = filteredList;
    notifyDataSetChanged();
}}


问:
Python compare two strings and check how many chars they have in common
I'm just wondering how I can check how many chars two string have in common.
For example if I have "car" and "cars", the result should be 3.

Anybody a clue?

Cheers and thanks in advance

Max

答:
Since you didn't write any code, I won't either. But basically this:

-convert strings to list

-use set to get letters they have in common

-get length of your set

Biggest hazard here would be if you wanted to count repeating letters


问:
Adding placeholder text to Wordpress wp-login.php page
So I want to add placeholder text to the Username and Password fields on the standard wp-login.php page - I don't want to edit the actual wp-login.php page because every time WordPress is updated my amends will just be wiped.

So! In functions.php I've added a simple function to add a .js file (and some css files but I don't think that's important for this) to the wp-login.php page where I have this code - here is my function in functions.php

```<code>function my_custom_login() {
  echo '<link rel="stylesheet" type="text/css" href="/shared-assets/css/main-screen-styles.css" />';
  echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/css/campsite-finder-screen-styles.css" />';
  echo '<script type="text/javascript" href="/shared-assets/js/test.js">
</script>';
}
add_action('login_head', 'my_custom_login');
</code>```

And here is my js file

```<code>jQuery(document).ready(function(){
  jQuery('#user_login').attr('placeholder', 'Name');
  jQuery('#user_email').attr('placeholder', 'Email');
  jQuery('#user_pass').attr('placeholder', 'Password');
});
</code>```

And this is where I get stuck .. in my mind that should work, I've checked the IDs and they all seem to line up but I'm clearly doing something wrong, you can see the page here http://www.camp-site-finder.com/wp-login.php

If you view the source you can see the link to my .js file and I'm referencing jQuery so errmm, have I done something stupid along the way or is there a better way of doing this?

If anyone can point me in the right direction on this one I'd be very grateful

N

答: you didn't include .JS file in

Body:
So I want to add placeholder text to the Username and Password fields on the standard wp-login.php page - I don't want to edit the actual wp-login.php page because every time WordPress is updated my amends will just be wiped.

So! In functions.php I've added a simple function to add a .js file (and some css files but I don't think that's important for this) to the wp-login.php page where I have this code - here is my function in functions.php

function my_custom_login() {
  echo '<link rel="stylesheet" type="text/css" href="/shared-assets/css/main-screen-styles.css" />';
  echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/css/campsite-finder-screen-styles.css" />';
  echo '';
}
add_action('login_head', 'my_custom_login');

And here is my js file

jQuery(document).ready(function(){
  jQuery('#user_login').attr('placeholder', 'Name');
  jQuery('#user_email').attr('placeholder', 'Email');
  jQuery('#user_pass').attr('placeholder', 'Password');
});

And this is where I get stuck .. in my mind that should work, I've checked the IDs and they all seem to line up but I'm clearly doing something wrong, you can see the page here http://www.camp-site-finder.com/wp-login.php

If you view the source you can see the link to my .js file and I'm referencing jQuery so errmm, have I done something stupid along the way or is there a better way of doing this?

If anyone can point me in the right direction on this one I'd be very grateful

N

Body: you didn't include .JS file in <script src="something.js"> . you have included it in <link rel=stylesheet > tag that's the problem i have found in your page


问:
Grouping and counting fields on a query filtering by date
I've got a query like this (on MS Access 2016):

```<code>|       City        |  CustomerID  |    OrderID   |   OrderDate   |

|       Venice      |      18      |      45      |   01/01/2015  |
|       Venice      |      18      |      56      |   01/01/2015  |
|       Venice      |      18      |      59      |   03/02/2015  |
|       Venice      |      20      |      60      |   04/02/2015  |
|       Venice      |      20      |      153     |   08/07/2017  |
|        Rome       |      22      |      65      |   05/03/2015  |
|        Rome       |      25      |      68      |   08/03/2015  |
|       Milan       |      27      |      72      |   04/02/2015  |
|       Milan       |      27      |      168     |   04/09/2017  |
</code>```

and I'd like to filter the result by date and get something like this (e.g. filtering by OrderDate between 01/01/2015 and 01/01/2016):

```<code>|       City        |  CustomerID  |    OrderID   |
|                   |   (Count)    |     (Count)  |
|       Venice      |      2       |      3       |
|        Rome       |      2       |      2       |
|       Milan       |      1       |      1       |
</code>```

Basically:

City field should be picked once as unique

CustomerID field should be picked once if unique and summed whereas is different

OrderID field should be counted

Any ideas?

答:
MS Access doesn't support count(distinct), but you can do this with two levels of aggregation:

```<code>select city, count(*) as num_customers, sum(num_orders) as num_orders
from (select city, customerId, count(*) as num_orders
      from <your query here> as t
      group by city, customerId
     ) as t
group by city;
</code>```

Body:
I've got a query like this (on MS Access 2016):

|       City        |  CustomerID  |    OrderID   |   OrderDate   |

|       Venice      |      18      |      45      |   01/01/2015  |
|       Venice      |      18      |      56      |   01/01/2015  |
|       Venice      |      18      |      59      |   03/02/2015  |
|       Venice      |      20      |      60      |   04/02/2015  |
|       Venice      |      20      |      153     |   08/07/2017  |
|        Rome       |      22      |      65      |   05/03/2015  |
|        Rome       |      25      |      68      |   08/03/2015  |
|       Milan       |      27      |      72      |   04/02/2015  |
|       Milan       |      27      |      168     |   04/09/2017  |

and I'd like to filter the result by date and get something like this (e.g. filtering by OrderDate between 01/01/2015 and 01/01/2016):

|       City        |  CustomerID  |    OrderID   |
|                   |   (Count)    |     (Count)  |
|       Venice      |      2       |      3       |
|        Rome       |      2       |      2       |
|       Milan       |      1       |      1       |

Basically:

City field should be picked once as unique

CustomerID field should be picked once if unique and summed whereas is different

OrderID field should be counted

Any ideas?

Body:
MS Access doesn't support count(distinct), but you can do this with two levels of aggregation:

select city, count(*) as num_customers, sum(num_orders) as num_orders
from (select city, customerId, count(*) as num_orders
      from <your query here> as t
      group by city, customerId
     ) as t
group by city;


问:
Disable ssl session resumption on wildfly 10
i need to disable ssl session resumption on wilfly 10 community edition. I tried to modify undertow ssl session-cache-size and ssl-session-timeout unsuccessfully. Any suggestions are welcome. thanks.</p>

答:
I'm not sure that there is any options for that, if the ssl-session-cache-size is not working.

As an alternative, you could consider off-loading TLS using a reverse proxy with support for ssl session resumption (e.g. NGINX).


问:
Data table multiple condition with string vector
I would like to subset a data table with a condition that I want to apply on all column in vector of strings with a & condition in between. Example:

```<code>library(data.table)
test <- setDT(as.data.frame(list(ID = c(rep(1,10),rep(2,10)), time = rep(c(1:10),2),
                                 Input = rep(c(array(data = 0, dim = 5),1,array(data = 0, dim = 4)),2),
                                 replicate(4,sample(c(1:20), 10, replace = TRUE)))))

signalcolumns <- colnames(test)[! colnames(test) %in% c("ID","Input","time")]
</code>```

Now I want

```<code>test[X1 > 5 & X2 > 5 & X3 > 5 & X4 > 5]
</code>```

and I would like to write it with the signalcolumns.

```<code>test[get(signalcolumns) > 5]
</code>```

doesn't work as it set the condition only on the first X1 column. I don't see what syntax I could use here. I though of trying to evaluate an expression like

```<code>c(paste0(signalcolumns[1:(length(signalcolumns)-1)],">5 &"),
paste0(signalcolumns[(length(signalcolumns)-1)],">5") )
</code>```

but I am a bit stuck here.

答:
```<code>test[apply(test[, signalcolumns, with = FALSE] > 5, 1, all)]
#    ID time Input X1 X2 X3 X4
# 1:  1    4     0 18 14 11 17
# 2:  1    8     0 15 20 15 14
# 3:  2    4     0 18 14 11 17
# 4:  2    8     0 15 20 15 14
</code>```

Update

Here is a walk-through of the steps followed.

```<code>test
#     ID time Input X1 X2 X3 X4
#  1:  1    1     0 11  5 12  3
#  2:  1    2     0 15  4 17 10
#  3:  1    3     0  3 16 10 19
#  4:  1    4     0 18 14 11 17
#  5:  1    5     0 10 18  7  3
#  6:  1    6     1  2 16  3  6
#  7:  1    7     0  2  4  5  5
#  8:  1    8     0 15 20 15 14
#  9:  1    9     0 16 20 11  5
# 10:  1   10     0 14  5  6 11
# 11:  2    1     0 11  5 12  3
# 12:  2    2     0 15  4 17 10
# 13:  2    3     0  3 16 10 19
# 14:  2    4     0 18 14 11 17
# 15:  2    5     0 10 18  7  3
# 16:  2    6     1  2 16  3  6
# 17:  2    7     0  2  4  5  5
# 18:  2    8     0 15 20 15 14
# 19:  2    9     0 16 20 11  5
# 20:  2   10     0 14  5  6 11
</code>```

Now generate a table of TRUE/FALSE values based upon being > 5

```<code>test_truth <- test[, signalcolumns, with = FALSE] > 5
test_truth
#          X1    X2    X3    X4
#  [1,]  TRUE FALSE  TRUE FALSE
#  [2,]  TRUE FALSE  TRUE  TRUE
#  [3,] FALSE  TRUE  TRUE  TRUE
#  [4,]  TRUE  TRUE  TRUE  TRUE
#  [5,]  TRUE  TRUE  TRUE FALSE
#  [6,] FALSE  TRUE FALSE  TRUE
#  [7,] FALSE FALSE FALSE FALSE
#  [8,]  TRUE  TRUE  TRUE  TRUE
#  [9,]  TRUE  TRUE  TRUE FALSE
# [10,]  TRUE FALSE  TRUE  TRUE
# [11,]  TRUE FALSE  TRUE FALSE
# [12,]  TRUE FALSE  TRUE  TRUE
# [13,] FALSE  TRUE  TRUE  TRUE
# [14,]  TRUE  TRUE  TRUE  TRUE
# [15,]  TRUE  TRUE  TRUE FALSE
# [16,] FALSE  TRUE FALSE  TRUE
# [17,] FALSE FALSE FALSE FALSE
# [18,]  TRUE  TRUE  TRUE  TRUE
# [19,]  TRUE  TRUE  TRUE FALSE
# [20,]  TRUE FALSE  TRUE  TRUE
</code>```

Then, use apply over each row. The function to apply is all, which will return TRUE if all values applied to it are TRUE, and FALSE if any of the values are not true. Therefore, it will return TRUE for all rows where all of the values are TRUE.

```<code>truth_vect <- apply(test_truth, 1, all)
truth_vect
# [1] FALSE FALSE FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE
</code>```

This is the vector we need to use to subset the table.

```<code>test[truth_vect]
#    ID time Input X1 X2 X3 X4
# 1:  1    4     0 18 14 11 17
# 2:  1    8     0 15 20 15 14
# 3:  2    4     0 18 14 11 17
# 4:  2    8     0 15 20 15 14
</code>```

Body:
I would like to subset a data table with a condition that I want to apply on all column in vector of strings with a & condition in between. Example:

library(data.table)
test <- setDT(as.data.frame(list(ID = c(rep(1,10),rep(2,10)), time = rep(c(1:10),2),
                                 Input = rep(c(array(data = 0, dim = 5),1,array(data = 0, dim = 4)),2),
                                 replicate(4,sample(c(1:20), 10, replace = TRUE)))))

signalcolumns <- colnames(test)[! colnames(test) %in% c("ID","Input","time")]

Now I want

test[X1 > 5 & X2 > 5 & X3 > 5 & X4 > 5]

and I would like to write it with the signalcolumns.

test[get(signalcolumns) > 5]

doesn't work as it set the condition only on the first X1 column. I don't see what syntax I could use here. I though of trying to evaluate an expression like

c(paste0(signalcolumns[1:(length(signalcolumns)-1)],">5 &"),
paste0(signalcolumns[(length(signalcolumns)-1)],">5") )

but I am a bit stuck here.

Body:
test[apply(test[, signalcolumns, with = FALSE] > 5, 1, all)]
#    ID time Input X1 X2 X3 X4
# 1:  1    4     0 18 14 11 17
# 2:  1    8     0 15 20 15 14
# 3:  2    4     0 18 14 11 17
# 4:  2    8     0 15 20 15 14

Update

Here is a walk-through of the steps followed.

test
#     ID time Input X1 X2 X3 X4
#  1:  1    1     0 11  5 12  3
#  2:  1    2     0 15  4 17 10
#  3:  1    3     0  3 16 10 19
#  4:  1    4     0 18 14 11 17
#  5:  1    5     0 10 18  7  3
#  6:  1    6     1  2 16  3  6
#  7:  1    7     0  2  4  5  5
#  8:  1    8     0 15 20 15 14
#  9:  1    9     0 16 20 11  5
# 10:  1   10     0 14  5  6 11
# 11:  2    1     0 11  5 12  3
# 12:  2    2     0 15  4 17 10
# 13:  2    3     0  3 16 10 19
# 14:  2    4     0 18 14 11 17
# 15:  2    5     0 10 18  7  3
# 16:  2    6     1  2 16  3  6
# 17:  2    7     0  2  4  5  5
# 18:  2    8     0 15 20 15 14
# 19:  2    9     0 16 20 11  5
# 20:  2   10     0 14  5  6 11

Now generate a table of TRUE/FALSE values based upon being > 5

test_truth <- test[, signalcolumns, with = FALSE] > 5
test_truth
#          X1    X2    X3    X4
#  [1,]  TRUE FALSE  TRUE FALSE
#  [2,]  TRUE FALSE  TRUE  TRUE
#  [3,] FALSE  TRUE  TRUE  TRUE
#  [4,]  TRUE  TRUE  TRUE  TRUE
#  [5,]  TRUE  TRUE  TRUE FALSE
#  [6,] FALSE  TRUE FALSE  TRUE
#  [7,] FALSE FALSE FALSE FALSE
#  [8,]  TRUE  TRUE  TRUE  TRUE
#  [9,]  TRUE  TRUE  TRUE FALSE
# [10,]  TRUE FALSE  TRUE  TRUE
# [11,]  TRUE FALSE  TRUE FALSE
# [12,]  TRUE FALSE  TRUE  TRUE
# [13,] FALSE  TRUE  TRUE  TRUE
# [14,]  TRUE  TRUE  TRUE  TRUE
# [15,]  TRUE  TRUE  TRUE FALSE
# [16,] FALSE  TRUE FALSE  TRUE
# [17,] FALSE FALSE FALSE FALSE
# [18,]  TRUE  TRUE  TRUE  TRUE
# [19,]  TRUE  TRUE  TRUE FALSE
# [20,]  TRUE FALSE  TRUE  TRUE

Then, use apply over each row. The function to apply is all, which will return TRUE if all values applied to it are TRUE, and FALSE if any of the values are not true. Therefore, it will return TRUE for all rows where all of the values are TRUE.

truth_vect <- apply(test_truth, 1, all)
truth_vect
# [1] FALSE FALSE FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE

This is the vector we need to use to subset the table.

test[truth_vect]
#    ID time Input X1 X2 X3 X4
# 1:  1    4     0 18 14 11 17
# 2:  1    8     0 15 20 15 14
# 3:  2    4     0 18 14 11 17
# 4:  2    8     0 15 20 15 14


问:
Can I capture the console output in Node.js?
I am trying to kill a process at first, I executed with

```<code>exec  = require('child_process').exec;
exec('kill xxx', function(error, stdout, stderr) {
    if (error) {
        console.log('exec error: ', error);
    }else{
       console.log(stdout)
    }
});
</code>```

I noticed the kill program probably started a child process, whose output cannot be captured here as stdout.

So can I generally capture these console output which seem to be not very relevant with the code?

答:
Stolen: Node: log in a file instead of the console

```<code>var fs = require('fs');
var util = require('util');
var log_file = fs.createWriteStream(__dirname + '/debug.log', {flags : 'w'});
var log_stdout = process.stdout;

console.log = function(d) { //
  log_file.write(util.format(d) + '\n');
  log_stdout.write(util.format(d) + '\n');
};
</code>```

ANSWER #2
This message is not created by console.log rather just the Linux system itself. How to catch this?

I think you should be able to do something with fs like so...

```<code>  var fs = require('fs');
  var util = require('util');
  var log_file = fs.createWriteStream(__dirname + '/debug.log', {flags : 'w'});
  var log_stdout = process.stdout;

const command = 'node your_node_script'; //Whatever you would run in terminal

cp.exec(command, (error, stdout, stderr) => {
    if(error) {
        log_file.write(error);

    }
    if(stdout) {
        log_file.write(stdout);
    }
    if(stderr) {
        log_file.write(stderr);
    }
});
</code>```

Body:
I am trying to kill a process at first, I executed with

exec  = require('child_process').exec;
exec('kill xxx', function(error, stdout, stderr) {
    if (error) {
        console.log('exec error: ', error);
    }else{
       console.log(stdout)
    }
});

I noticed the kill program probably started a child process, whose output cannot be captured here as stdout.

So can I generally capture these console output which seem to be not very relevant with the code?

Body:
Stolen: Node: log in a file instead of the console

var fs = require('fs');
var util = require('util');
var log_file = fs.createWriteStream(__dirname + '/debug.log', {flags : 'w'});
var log_stdout = process.stdout;

console.log = function(d) { //
  log_file.write(util.format(d) + '\n');
  log_stdout.write(util.format(d) + '\n');
};

ANSWER #2
This message is not created by console.log rather just the Linux system itself. How to catch this?

I think you should be able to do something with fs like so...

  var fs = require('fs');
  var util = require('util');
  var log_file = fs.createWriteStream(__dirname + '/debug.log', {flags : 'w'});
  var log_stdout = process.stdout;

const command = 'node your_node_script'; //Whatever you would run in terminal

cp.exec(command, (error, stdout, stderr) => {
    if(error) {
        log_file.write(error);

    }
    if(stdout) {
        log_file.write(stdout);
    }
    if(stderr) {
        log_file.write(stderr);
    }
});


问:
How to avoid shape error when I change Keras' backend from Theano to Tensorflow?
I tried to use Deep Semantic Similarity Model(DSSM): https://github.com/airalcorn2/Deep-Semantic-Similarity-Model/blob/master/deep_semantic_similarity_keras.py on Keras using Tensorflow backend. The code is for Keras using Theano backend and works without any errors on it.

To make it run on Keras using Tensorflow backend correctly, I modified some Tensor attributes as:

```<code>-: backend.dot(x, backend.transpose(y)) / (x.norm(2) * y.norm(2))
+: backend.dot(backend.l2_normalize(x, 0), backend.transpose(backend.l2_normalize(y, 0)))
</code>```

and

```<code>-: x.max(axis = 1)
+: backend.max(x, 1)
</code>```

When I compiled the modified model, ValueError: logits and targets must have the same shape (() vs (?, ?)) occurred. How can I avoid the error?

Here is the modified code

```<code>import keras
import numpy as np

from keras import backend
from keras.layers import Input, merge
from keras.layers.core import Dense, Lambda, Reshape
from keras.layers.convolutional import Convolution1D
from keras.models import Model

def R(vects):
    (x, y) = vects
    return backend.dot(backend.l2_normalize(x, 0), backend.transpose(backend.l2_normalize(y, 0)))

LETTER_GRAM_SIZE = 3
WINDOW_SIZE = 3
TOTAL_LETTER_GRAMS = int(3 * 1e4)
WORD_DEPTH = WINDOW_SIZE * TOTAL_LETTER_GRAMS
K = 300
L = 128
J = 4
FILTER_LENGTH = 1

query = Input(shape = (None, WORD_DEPTH))
pos_doc = Input(shape = (None, WORD_DEPTH))
neg_docs = [Input(shape = (None, WORD_DEPTH)) for j in range(J)]

query_conv = Convolution1D(K, FILTER_LENGTH, border_mode = "same", input_shape = (None, WORD_DEPTH), activation = "tanh")(query) # See equation (2).

query_max = Lambda(lambda x: backend.max(x, 1), output_shape = (K, ))(query_conv)

query_sem = Dense(L, activation = "tanh", input_dim = K)(query_max)

doc_conv = Convolution1D(K, FILTER_LENGTH, border_mode = "same", input_shape = (None, WORD_DEPTH), activation = "tanh")
doc_max = Lambda(lambda x: backend.max(x, 1), output_shape = (K, ))
doc_sem = Dense(L, activation = "tanh", input_dim = K)

pos_doc_conv = doc_conv(pos_doc)
neg_doc_convs = [doc_conv(neg_doc) for neg_doc in neg_docs]

pos_doc_max = doc_max(pos_doc_conv)
neg_doc_maxes = [doc_max(neg_doc_conv) for neg_doc_conv in neg_doc_convs]

pos_doc_sem = doc_sem(pos_doc_max)
neg_doc_sems = [doc_sem(neg_doc_max) for neg_doc_max in neg_doc_maxes]

R_layer = Lambda(R, output_shape = (1, ))

R_Q_D_p = R_layer([query_sem, pos_doc_sem])
R_Q_D_ns = [R_layer([query_sem, neg_doc_sem]) for neg_doc_sem in neg_doc_sems]

concat_Rs = merge([R_Q_D_p] + R_Q_D_ns, mode = "concat")
concat_Rs = Reshape((J + 1, 1))(concat_Rs)

weight = np.array([1]).reshape(1, 1, 1, 1)
with_gamma = Convolution1D(1, 1, border_mode = "same", input_shape = (J + 1, 1), activation = "linear", bias = False, weights = [weight])(concat_Rs)

exponentiated = Lambda(lambda x: backend.exp(x), output_shape = (J + 1, ))(with_gamma) # See equation (5).
exponentiated = Reshape((J + 1, ))(exponentiated)

prob = Lambda(lambda x: x[0][0] / backend.sum(x[0]), output_shape = (1, ))(exponentiated)

model = Model(input = [query, pos_doc] + neg_docs, output = prob)
model.compile(optimizer = "adadelta", loss = "binary_crossentropy")
</code>```

and error message.

```<code>---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/Users/jun/anaconda/lib/python3.5/site-packages/tensorflow/python/framework/tensor_shape.py in merge_with(self, other)
    571       try:
--> 572         self.assert_same_rank(other)
    573         new_dims = []

/Users/jun/anaconda/lib/python3.5/site-packages/tensorflow/python/framework/tensor_shape.py in assert_same_rank(self, other)
    617         raise ValueError(
--> 618             "Shapes %s and %s must have the same rank" % (self, other))
    619

ValueError: Shapes (?, ?) and () must have the same rank

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
/Users/jun/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/nn.py in sigmoid_cross_entropy_with_logits(logits, targets, name)
    430     try:
--> 431       targets.get_shape().merge_with(logits.get_shape())
    432     except ValueError:

/Users/jun/anaconda/lib/python3.5/site-packages/tensorflow/python/framework/tensor_shape.py in merge_with(self, other)
    578         raise ValueError("Shapes %s and %s are not compatible" %
--> 579                          (self, other))
    580

ValueError: Shapes (?, ?) and () are not compatible

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-6-a4001289be07> in <module>()
     61
     62 model = Model(input = [query, pos_doc] + neg_docs, output = prob)
---> 63 model.compile(optimizer = "adadelta", loss = "binary_crossentropy")

/Users/jun/anaconda/lib/python3.5/site-packages/keras/engine/training.py in compile(self, optimizer, loss, metrics, loss_weights, sample_weight_mode, **kwargs)
    628             loss_weight = loss_weights_list[i]
    629             output_loss = weighted_loss(y_true, y_pred,
--> 630                                         sample_weight, mask)
    631             if len(self.outputs) > 1:
    632                 self.metrics_tensors.append(output_loss)

/Users/jun/anaconda/lib/python3.5/site-packages/keras/engine/training.py in weighted(y_true, y_pred, weights, mask)
    330     def weighted(y_true, y_pred, weights, mask=None):
    331         # score_array has ndim >= 2
--> 332         score_array = fn(y_true, y_pred)
    333         if mask is not None:
    334             # Cast the mask to floatX to avoid float64 upcasting in theano

/Users/jun/anaconda/lib/python3.5/site-packages/keras/objectives.py in binary_crossentropy(y_true, y_pred)
     46
     47 def binary_crossentropy(y_true, y_pred):
---> 48     return K.mean(K.binary_crossentropy(y_pred, y_true), axis=-1)
     49
     50

/Users/jun/anaconda/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py in binary_crossentropy(output, target, from_logits)
   1464         output = tf.clip_by_value(output, epsilon, 1 - epsilon)
   1465         output = tf.log(output / (1 - output))
-> 1466     return tf.nn.sigmoid_cross_entropy_with_logits(output, target)
   1467
   1468

/Users/jun/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/nn.py in sigmoid_cross_entropy_with_logits(logits, targets, name)
    432     except ValueError:
    433       raise ValueError("logits and targets must have the same shape (%s vs %s)"
--> 434                        % (logits.get_shape(), targets.get_shape()))
    435
    436     # The logistic loss formula from above is

ValueError: logits and targets must have the same shape (() vs (?, ?))
</code>```

答:
(Converted from a comment to an answer at @dga's request)

I asked our resident Keras expert, and his response was: Looking at the error message and code, one can infer that the final output prob is a scalar, whereas it should be a 2D array (one scalar probability per batch entry). The problem is likely to be at line

```<code>prob = Lambda(lambda x: x[0][0] / backend.sum(x[0]), output_shape = (1, ))(exponentiated)
</code>```

Body:
I tried to use Deep Semantic Similarity Model(DSSM): https://github.com/airalcorn2/Deep-Semantic-Similarity-Model/blob/master/deep_semantic_similarity_keras.py on Keras using Tensorflow backend. The code is for Keras using Theano backend and works without any errors on it.

To make it run on Keras using Tensorflow backend correctly, I modified some Tensor attributes as:

-: backend.dot(x, backend.transpose(y)) / (x.norm(2) * y.norm(2))
+: backend.dot(backend.l2_normalize(x, 0), backend.transpose(backend.l2_normalize(y, 0)))

and

-: x.max(axis = 1)
+: backend.max(x, 1)

When I compiled the modified model, ValueError: logits and targets must have the same shape (() vs (?, ?)) occurred. How can I avoid the error?

Here is the modified code

import keras
import numpy as np

from keras import backend
from keras.layers import Input, merge
from keras.layers.core import Dense, Lambda, Reshape
from keras.layers.convolutional import Convolution1D
from keras.models import Model

def R(vects):
    (x, y) = vects
    return backend.dot(backend.l2_normalize(x, 0), backend.transpose(backend.l2_normalize(y, 0)))

LETTER_GRAM_SIZE = 3
WINDOW_SIZE = 3
TOTAL_LETTER_GRAMS = int(3 * 1e4)
WORD_DEPTH = WINDOW_SIZE * TOTAL_LETTER_GRAMS
K = 300
L = 128
J = 4
FILTER_LENGTH = 1

query = Input(shape = (None, WORD_DEPTH))
pos_doc = Input(shape = (None, WORD_DEPTH))
neg_docs = [Input(shape = (None, WORD_DEPTH)) for j in range(J)]

query_conv = Convolution1D(K, FILTER_LENGTH, border_mode = "same", input_shape = (None, WORD_DEPTH), activation = "tanh")(query) # See equation (2).

query_max = Lambda(lambda x: backend.max(x, 1), output_shape = (K, ))(query_conv)

query_sem = Dense(L, activation = "tanh", input_dim = K)(query_max)

doc_conv = Convolution1D(K, FILTER_LENGTH, border_mode = "same", input_shape = (None, WORD_DEPTH), activation = "tanh")
doc_max = Lambda(lambda x: backend.max(x, 1), output_shape = (K, ))
doc_sem = Dense(L, activation = "tanh", input_dim = K)

pos_doc_conv = doc_conv(pos_doc)
neg_doc_convs = [doc_conv(neg_doc) for neg_doc in neg_docs]

pos_doc_max = doc_max(pos_doc_conv)
neg_doc_maxes = [doc_max(neg_doc_conv) for neg_doc_conv in neg_doc_convs]

pos_doc_sem = doc_sem(pos_doc_max)
neg_doc_sems = [doc_sem(neg_doc_max) for neg_doc_max in neg_doc_maxes]

R_layer = Lambda(R, output_shape = (1, ))

R_Q_D_p = R_layer([query_sem, pos_doc_sem])
R_Q_D_ns = [R_layer([query_sem, neg_doc_sem]) for neg_doc_sem in neg_doc_sems]

concat_Rs = merge([R_Q_D_p] + R_Q_D_ns, mode = "concat")
concat_Rs = Reshape((J + 1, 1))(concat_Rs)

weight = np.array([1]).reshape(1, 1, 1, 1)
with_gamma = Convolution1D(1, 1, border_mode = "same", input_shape = (J + 1, 1), activation = "linear", bias = False, weights = [weight])(concat_Rs)

exponentiated = Lambda(lambda x: backend.exp(x), output_shape = (J + 1, ))(with_gamma) # See equation (5).
exponentiated = Reshape((J + 1, ))(exponentiated)

prob = Lambda(lambda x: x[0][0] / backend.sum(x[0]), output_shape = (1, ))(exponentiated)

model = Model(input = [query, pos_doc] + neg_docs, output = prob)
model.compile(optimizer = "adadelta", loss = "binary_crossentropy")

and error message.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/Users/jun/anaconda/lib/python3.5/site-packages/tensorflow/python/framework/tensor_shape.py in merge_with(self, other)
    571       try:
--> 572         self.assert_same_rank(other)
    573         new_dims = []

/Users/jun/anaconda/lib/python3.5/site-packages/tensorflow/python/framework/tensor_shape.py in assert_same_rank(self, other)
    617         raise ValueError(
--> 618             "Shapes %s and %s must have the same rank" % (self, other))
    619

ValueError: Shapes (?, ?) and () must have the same rank

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
/Users/jun/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/nn.py in sigmoid_cross_entropy_with_logits(logits, targets, name)
    430     try:
--> 431       targets.get_shape().merge_with(logits.get_shape())
    432     except ValueError:

/Users/jun/anaconda/lib/python3.5/site-packages/tensorflow/python/framework/tensor_shape.py in merge_with(self, other)
    578         raise ValueError("Shapes %s and %s are not compatible" %
--> 579                          (self, other))
    580

ValueError: Shapes (?, ?) and () are not compatible

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-6-a4001289be07> in <module>()
     61
     62 model = Model(input = [query, pos_doc] + neg_docs, output = prob)
---> 63 model.compile(optimizer = "adadelta", loss = "binary_crossentropy")

/Users/jun/anaconda/lib/python3.5/site-packages/keras/engine/training.py in compile(self, optimizer, loss, metrics, loss_weights, sample_weight_mode, **kwargs)
    628             loss_weight = loss_weights_list[i]
    629             output_loss = weighted_loss(y_true, y_pred,
--> 630                                         sample_weight, mask)
    631             if len(self.outputs) > 1:
    632                 self.metrics_tensors.append(output_loss)

/Users/jun/anaconda/lib/python3.5/site-packages/keras/engine/training.py in weighted(y_true, y_pred, weights, mask)
    330     def weighted(y_true, y_pred, weights, mask=None):
    331         # score_array has ndim >= 2
--> 332         score_array = fn(y_true, y_pred)
    333         if mask is not None:
    334             # Cast the mask to floatX to avoid float64 upcasting in theano

/Users/jun/anaconda/lib/python3.5/site-packages/keras/objectives.py in binary_crossentropy(y_true, y_pred)
     46
     47 def binary_crossentropy(y_true, y_pred):
---> 48     return K.mean(K.binary_crossentropy(y_pred, y_true), axis=-1)
     49
     50

/Users/jun/anaconda/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py in binary_crossentropy(output, target, from_logits)
   1464         output = tf.clip_by_value(output, epsilon, 1 - epsilon)
   1465         output = tf.log(output / (1 - output))
-> 1466     return tf.nn.sigmoid_cross_entropy_with_logits(output, target)
   1467
   1468

/Users/jun/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/nn.py in sigmoid_cross_entropy_with_logits(logits, targets, name)
    432     except ValueError:
    433       raise ValueError("logits and targets must have the same shape (%s vs %s)"
--> 434                        % (logits.get_shape(), targets.get_shape()))
    435
    436     # The logistic loss formula from above is

ValueError: logits and targets must have the same shape (() vs (?, ?))

Body:
(Converted from a comment to an answer at @dga's request)

I asked our resident Keras expert, and his response was: Looking at the error message and code, one can infer that the final output prob is a scalar, whereas it should be a 2D array (one scalar probability per batch entry). The problem is likely to be at line

prob = Lambda(lambda x: x[0][0] / backend.sum(x[0]), output_shape = (1, ))(exponentiated)


问:
Difference between an object and a dictionary?
What exactly is the difference between an object and a dictionary in Actionscript?

```<code>var obj:Object = new Object();
obj.something = "something";

var dict:Dictionary = new Dictionary();
dict.something = "something";

trace(obj.something, dict.something);
</code>```

The trace statement seems identical...

答:
Object() uses strings as keys, while Dictionary() uses objects as keys.

See http://gskinner.com/blog/archives/2006/07/as3_dictionary_.html

ContentLicense: CC BY-SA 2.5

Body:
What exactly is the difference between an object and a dictionary in Actionscript?

var obj:Object = new Object();
obj.something = "something";

var dict:Dictionary = new Dictionary();
dict.something = "something";

trace(obj.something, dict.something);

The trace statement seems identical...


答:
Something like this </p>

```<code>count = 0

for letter in set(string1):
  count += string2.count(letter)

print(count)
</code>```

Title: Python compare two strings and check how many chars they have in common

Body:
I'm just wondering how I can check how many chars two string have in common.
For example if I have "car" and "cars", the result should be 3.

Anybody a clue?

Cheers and thanks in advance

Max

Body:
Something like this

count = 0

for letter in set(string1):
  count += string2.count(letter)

print(count)


问:
Webpack dev server cannot get `http://localhost/8080/bundle.js`
Given this config:

```<code>var webpack = require('webpack');
const path = require('path')

module.exports = {
  entry: "./src/index.js",
  output: {
    path: path.join(__dirname, 'dist'),
    publicPath: path.join(__dirname, 'dist'),
    filename: "bundle.js"
  },
  devServer: {
    contentBase: "./dist",
    // hot: true,
  }
}
</code>```

Why won't webpack-dev-server server my app properly?  I have 0% understanding of localhost, vs localhost/webpack-dev-server, vs publicPath, vs contentBase, etc..  I know all of these paths, and configuration keys are important to setting up my project properly but despite hours of reading about them, they remain as confusing as when I started.

If I go to localhost:8080/webpack-dev-server I see Get http://localhost:8080/bundle.js net:ERR_ABORTED` in the console.

答:
Below are simple and straight forward rules for webpack & webpack-dev-server :

output.path : It needs to be an absolute path or /. You can get it easily using path.join

output.filename : This needs to be the name of output file without any extra file path.

devServer.contentBase : It is the physical location on the disk which is served as the root directory of webpack-dev-server when you open http://localhost:8080

By convention, we keep both output.path and devServer.contentBase same.
The tricky part is when you run webpack cmd, it generates the physical bundle.js file.

But when you run webpack-dev-server, NO PHYSICAL OUTPUT file is generated, rather it keeps the generated output in memory to avoid File-Write operate which in turn helps in faster development/debugging cycle.

So any change you make in src.js or main.js file, it will generate the output but won't write that to disk and wepack-dev-server reads that directly from the memory.

output.publicPath : This is used by webpack, webpack-dev-server & other plug-in to generate the output or serve the generated bundle.
The default value is /.

It is VIRTUAL PATH and need not be present on the physical
  disk. Example : final application name if multiple apps are
  hosted on the same server like /app1, /app2, or some external CDN path
  /CDN-Path.

It is also helpful for React-Router <BrowserRouter basename='/app1'>

Now to refer the bundle output file that is generated & kept in the memory , you need to append the output.publicPath i.e. Virtual Path in the browser's URL.

The final URL for webpack-dev-server will be :
http://localhost:8080/<output.publicPath>/<output.filename>

In your case, either you change the
publicPath: path.join(__dirname, 'dist')
to
publicPath: '/dist' if it contains any spaces.
You can check it by printing the value of path.join(__dirname, 'dist') which returns the absolve path [different on MacOS & Window system].

http://localhost:8080/dist/bundle.js

If you want to dig further deeper, then here is the URL

https://medium.com/p/webpack-understanding-the-publicpath-mystery-aeb96d9effb1

Body:
Given this config:

var webpack = require('webpack');
const path = require('path')

module.exports = {
  entry: "./src/index.js",
  output: {
    path: path.join(__dirname, 'dist'),
    publicPath: path.join(__dirname, 'dist'),
    filename: "bundle.js"
  },
  devServer: {
    contentBase: "./dist",
    // hot: true,
  }
}

Why won't webpack-dev-server server my app properly?  I have 0% understanding of localhost, vs localhost/webpack-dev-server, vs publicPath, vs contentBase, etc..  I know all of these paths, and configuration keys are important to setting up my project properly but despite hours of reading about them, they remain as confusing as when I started.

If I go to localhost:8080/webpack-dev-server I see Get http://localhost:8080/bundle.js net:ERR_ABORTED` in the console.


问:
Reversing words in shell
Task is to reverse all letters (a-zA-Z) in words that have 5 or less characters.

EDIT: Let's assume word is a not interrupted sequence of letters from english alphabet.

( letter: ASCII range A-Z && a-z)

Example:

Input: "One ring to rule them all, one ring to find them, One ring to bring them all and in the darkness bind them."

Output: "enO gnir ot elur meht lla, eno gnir ot dnif meht, enO gnir ot gnirb meht lla dna ni eht darkness dnib meht."

I have been able to write this script, but it sruggles with words with special chracters such as {,.} that are not supposed to be reversed.

```<code>#!/bin/bash

    word_length=0
    touch tmp

    for word in $(cat ./TEXT)
    do
            word_length=$(echo -n $word | wc -c )
            if [ $word_length -le 5 ]
            then
                    echo -n $word | rev >> tmp
                    echo -n " " >> tmp
            else
                    echo -n $word >> tmp
                    echo -n " " >> tmp
            fi
    done

    cat tmp > TEXT
    echo " " >> TEXT
    rm -rf tmp
</code>```

Output of this script:
"enO gnir ot elur meht ,lla eno gnir ot dnif ,meht enO gnir ot gnirb meht lla dna ni eht darkness dnib .meht"

You can see that {,.} are in the wrong place.

答:
You can use this awk code for this:

```<code>awk 'function revw(wrd) {
   if (wrd ~ /[^a-zA-Z]+[a-zA-Z]+$/ || length(wrd) > 5)
      return wrd
   nw = wrd
   sub(/^[a-zA-Z]+/, "", nw)
   sub(/[^a-zA-Z]+$/, "", wrd)
   rw = ""
   for (j=length(wrd); j>0; j--)
      rw = rw substr(wrd, j, 1)
   return rw nw
}
{
   line = ""
   for (i=1; i<=NF; i++)
      line = line revw($i) (i==NF ? "" : OFS)
   print line
}' file

enO gnir ot elur meht lla, eno gnir ot dnif meht, enO gnir ot gnirb meht lla dna ni eht darkness dnib meht.
</code>```

Title: Reversing words in shell

Body:
Task is to reverse all letters (a-zA-Z) in words that have 5 or less characters.

EDIT: Let's assume word is a not interrupted sequence of letters from english alphabet.

( letter: ASCII range A-Z && a-z)

Example:

Input: "One ring to rule them all, one ring to find them, One ring to bring them all and in the darkness bind them."

Output: "enO gnir ot elur meht lla, eno gnir ot dnif meht, enO gnir ot gnirb meht lla dna ni eht darkness dnib meht."

I have been able to write this script, but it sruggles with words with special chracters such as {,.} that are not supposed to be reversed.

#!/bin/bash

    word_length=0
    touch tmp

    for word in $(cat ./TEXT)
    do
            word_length=$(echo -n $word | wc -c )
            if [ $word_length -le 5 ]
            then
                    echo -n $word | rev >> tmp
                    echo -n " " >> tmp
            else
                    echo -n $word >> tmp
                    echo -n " " >> tmp
            fi
    done

    cat tmp > TEXT
    echo " " >> TEXT
    rm -rf tmp

Output of this script:
"enO gnir ot elur meht ,lla eno gnir ot dnif ,meht enO gnir ot gnirb meht lla dna ni eht darkness dnib .meht"

You can see that {,.} are in the wrong place.

Body:
You can use this awk code for this:

awk 'function revw(wrd) {
   if (wrd ~ /[^a-zA-Z]+[a-zA-Z]+$/ || length(wrd) > 5)
      return wrd
   nw = wrd
   sub(/^[a-zA-Z]+/, "", nw)
   sub(/[^a-zA-Z]+$/, "", wrd)
   rw = ""
   for (j=length(wrd); j>0; j--)
      rw = rw substr(wrd, j, 1)
   return rw nw
}
{
   line = ""
   for (i=1; i<=NF; i++)
      line = line revw($i) (i==NF ? "" : OFS)
   print line
}' file

enO gnir ot elur meht lla, eno gnir ot dnif meht, enO gnir ot gnirb meht lla dna ni eht darkness dnib meht.


问:
Joomla Menu items alias SEO works, but article alias SEO not working
I've got a problem with my Joomla site. The SEO for the menu item can work effectively.
So if I type something like, "www.example.com/about", it will work and show the appropriate article page. So this shows that the SEF URL and apache mod_rewrite settings are correct.

My problem is with the Article alias SEO.

I added a new article called "privacypolicy", and by default Joomla created the alias for the article (privacy-policy). I then try to open this page (www.example.com/privacy-policy), but I got the 404 page not found error. I have tried to put this article in various sections and categories and tried to access the URL by using the full path (such as: www.example.com/categoryname/articlename), but I still got the 404 page not found error.

I then tried to add another dummy articles to test this SEF URL feature, and found out that the SEF URL feature is not working for the article alias. It works for the menu items alias (if you put the article as a menu item, such as in article / blog format).

My question is, how can I access the articles (using the alias URL), without having to put this article as a blog in the menu item? I even tried to use some Joomla SEO extensions and was hoping that this could fix the error, but I still got the same problem. I have changed my htaccess.txt to .htaccess (which I believe enables the the menu item alias to work effectively).

Below is the contents of my .htaccess file:

```<code># @version $Id: htaccess.txt 10492 2008-07-02 06:38:28Z ircmaxell $
# @package Joomla
# @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##

#####################################################
#  READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.
#
#####################################################

##  Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

#
#  mod_rewrite in use

RewriteEngine On

########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update Your Joomla! Directory (just / for root)

# RewriteBase /

########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section
</code>```

Thanks,

Bob

答: In order for www.example.com/categoryname/articlename to work, there has to be a menu item for the parent category. If you don't currently have a menu item for the category, or would rather have a URL like www.example.com/articlename, simply create a new menu and don't put it in any module. The URLs will still work but you will not have any extra menus you don't want to display.</p>

Body:
I've got a problem with my Joomla site. The SEO for the menu item can work effectively.
So if I type something like, "www.example.com/about", it will work and show the appropriate article page. So this shows that the SEF URL and apache mod_rewrite settings are correct.

My problem is with the Article alias SEO.

I added a new article called "privacypolicy", and by default Joomla created the alias for the article (privacy-policy). I then try to open this page (www.example.com/privacy-policy), but I got the 404 page not found error. I have tried to put this article in various sections and categories and tried to access the URL by using the full path (such as: www.example.com/categoryname/articlename), but I still got the 404 page not found error.

I then tried to add another dummy articles to test this SEF URL feature, and found out that the SEF URL feature is not working for the article alias. It works for the menu items alias (if you put the article as a menu item, such as in article / blog format).

My question is, how can I access the articles (using the alias URL), without having to put this article as a blog in the menu item? I even tried to use some Joomla SEO extensions and was hoping that this could fix the error, but I still got the same problem. I have changed my htaccess.txt to .htaccess (which I believe enables the the menu item alias to work effectively).

Below is the contents of my .htaccess file:

# @version $Id: htaccess.txt 10492 2008-07-02 06:38:28Z ircmaxell $
# @package Joomla
# @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##

#####################################################
#  READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.
#
#####################################################

##  Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

#
#  mod_rewrite in use

RewriteEngine On

########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a


问:
Single line: create Dict key or update count in swift
It seems like there should be a simple way to do this:

```<code>for each token
   look it up in a dictionary
   if it's there already, increment the value by 1
   else create it and set value to 1
</code>```

I can do this with

```<code>for token in tokens {
    if let count = myDict[token] {
        myDict[token] = count + 1
    } else {
        myDict[token] = 1
}
</code>```

But it seems like there must be a more elegant, single line way to do this?

Body:
It seems like there should be a simple way to do this:

for each token
   look it up in a dictionary
   if it's there already, increment the value by 1
   else create it and set value to 1

I can do this with

for token in tokens {
    if let count = myDict[token] {
        myDict[token] = count + 1
    } else {
        myDict[token] = 1
}

But it seems like there must be a more elegant, single line way to do this?

Body: tokens.map{ myDict[$0] = (myDict[$0] ?? 0) + 1  }


问:
Migration from Heroku PostgreSQL to AWS RDS using AWS Data Migration Service (DMS) not working
I'm trying to use AWS DMS to copy and replicate data from a Heroku PostgreSQL database to an AWS RDS PostgreSQL instance but it isn't working (more infos below).

In DMS Log I can see the following message:

```<code>2017-10-25T17:43:35 [SOURCE_CAPTURE ]E: RetCode: SQL_ERROR SqlState: 42501 NativeError: 1 Message: ERROR: must be superuser or replication role to use replication slots;, Error while executing the query [1022502] (ar_odbc_stmt.c:2421)
</code>```

Heroku PostgreSQL's user is not a superuser or have a replication role but I've made an experiment with the same source database 2 days ago and it worked correctly (I stopped the experiment to create a bigger RDS instance target). I think I'm forgetting something in configuration this time.

Source: Heroku PostgreSQL standard-2 (9.5.8)

Target: AWS RDS PostgreSQL (9.6.3) at sa-east-1 region with rds.logical_replication=1

DMS: Instance at us-east-1 region

Full Cloudwatch logs:

```<code>2017-10-25T17:43:27 [TASK_MANAGER ]I: Task 'WKJYBNDMNIRS3AEA77T5BP5RN4' running full load and CDC in resume mode after recoverable error, retry #3 (replicationtask.c:1078)
2017-10-25T17:43:27 [TASK_MANAGER ]I: Task Id: bb955197-648a-4177-8653-677b5daf5a6e (replicationtask.c:2682)
2017-10-25T17:43:30 [TASK_MANAGER ]I: Creating threads for all components (replicationtask.c:1664)
2017-10-25T17:43:31 [TASK_MANAGER ]I: Threads for all components were created (replicationtask.c:1832)
2017-10-25T17:43:31 [TASK_MANAGER ]I: Task initialization completed successfully (replicationtask.c:2741)
2017-10-25T17:43:31 [TARGET_APPLY ]I: Going to connect to ODBC connection string: PROTOCOL=7.4-0;DRIVER={PostgreSQL};SERVER=XXXXX.rds.amazonaws.com;DATABASE=XXXXX;PORT=5432;sslmode=verify-ca;pqopt=sslrootcert=/rdsdbdata/rds-metadata/certificates/QQSFSDJTBLFXQLQ6VRVDDAYKCM/dms-ca-cert.pem;UID=USERID; (odbc_endpoint_imp.c:2236)
2017-10-25T17:43:31 [TARGET_APPLY ]I: Target endpoint 'PostgreSQL' is using provider syntax 'PostgreSQLLinux' (provider_syntax_manager.c:589)
2017-10-25T17:43:31 [TARGET_APPLY ]I: Transaction size is 10000. Array size is 1000. (odbc_endpoint_imp.c:837)
2017-10-25T17:43:31 [TARGET_APPLY ]I: CSV files will not be kept (odbc_endpoint_imp.c:1519)
2017-10-25T17:43:31 [TARGET_APPLY ]I: Error CSV files will not be kept (odbc_endpoint_imp.c:1528)
2017-10-25T17:43:31 [TARGET_APPLY ]I: Working in transactional apply mode (endpointshell.c:1436)
2017-10-25T17:43:31 [SOURCE_CAPTURE ]I: Going to connect to ODBC connection string: Driver={PostgreSQL Unicode(x64)};Server=SERVER_AT_HEROKU.compute-1.amazonaws.com;Port=5432;Database=XXXX;UseDeclareFetch=1;Fetch=10000;Uid=USERID;Pwd=PASSWORD;sslmode=require (postgres_endpoint_util.c:252)
2017-10-25T17:43:31 [SOURCE_CAPTURE ]I: Source endpoint 'PostgreSQL Source' is using provider syntax '<default>' (provider_syntax_manager.c:583)
2017-10-25T17:43:34 [TASK_MANAGER ]I: All stream components were initialized (replicationtask.c:2547)
2017-10-25T17:43:34 [SOURCE_CAPTURE ]I: Initial position is set to 'now' (postgres_endpoint_util.c:343)
2017-10-25T17:43:35 [SOURCE_CAPTURE ]I: Replication slot 'wkjybndmnirs3aea_00016385_bb955197_648a_4177_8653_677b5daf5a6e' does NOT exist. (postgres_endpoint_capture.c:293)
2017-10-25T17:43:35 [SOURCE_CAPTURE ]I: Initial positioning requested is 'now' (postgres_endpoint_capture.c:313)
2017-10-25T17:43:35 [SOURCE_CAPTURE ]E: Failed to execute statement: 'SELECT xlog_position FROM pg_create_logical_replication_slot('wkjybndmnirs3aea_00016385_bb955197_648a_4177_8653_677b5daf5a6e', 'test_decoding')' [1022502] (ar_odbc_stmt.c:2415)
2017-10-25T17:43:35 [SOURCE_CAPTURE ]E: RetCode: SQL_ERROR SqlState: 42501 NativeError: 1 Message: ERROR: must be superuser or replication role to use replication slots;, Error while executing the query [1022502] (ar_odbc_stmt.c:2421)
2017-10-25T17:43:35 [SOURCE_CAPTURE ]E: Creating replication slot 'wkjybndmnirs3aea_00016385_bb955197_648a_4177_8653_677b5daf5a6e' failed. [1022502] (postgres_endpoint_capture.c:334)
2017-10-25T17:43:35 [SOURCE_CAPTURE ]E: Error executing source loop [1022502] (streamcomponent.c:1581)
2017-10-25T17:43:35 [TASK_MANAGER ]E: Task error notification received from subtask 0, thread 0 [1022502] (replicationtask.c:2375)
2017-10-25T17:43:35 [TASK_MANAGER ]E: Stream component failed at subtask 0, component st_0_QVUF6NET6KSB26SCIIRH4UQZAQ [1022502] (subtask.c:1350)
2017-10-25T17:43:35 [TASK_MANAGER ]W: Task 'WKJYBNDMNIRS3AEA77T5BP5RN4' encountered a recoverable error (repository.c:4749)
2017-10-25T17:43:35 [SOURCE_CAPTURE ]E: Stream component 'st_0_QVUF6NET6KSB26SCIIRH4UQZAQ' terminated [1022502] (subtask.c:1513)
2017-10-25T17:43:40 [TASK_MANAGER ]I: Subtask #0 ended (replicationtask_util.c:937)
2017-10-25T17:43:40 [TASK_MANAGER ]I: Task management thread terminated (replicationtask.c:3210)
</code>```

答:
The prereqs for DMS state that the user for the source db needs to have superuser attribute; Heroku doesn't allow this.

https://devcenter.heroku.com/articles/heroku-postgresql

Body:
I'm trying to use AWS DMS to copy and replicate data from a Heroku PostgreSQL database to an AWS RDS PostgreSQL instance but it isn't working (more infos below).

In DMS Log I can see the following message:

2017-10-25T17:43:35 [SOURCE_CAPTURE ]E: RetCode: SQL_ERROR SqlState: 42501 NativeError: 1 Message: ERROR: must be superuser or replication role to use replication slots;, Error while executing the query [1022502] (ar_odbc_stmt.c:2421)

Heroku PostgreSQL's user is not a superuser or have a replication role but I've made an experiment with the same source database 2 days ago and it worked correctly (I stopped the experiment to create a bigger RDS instance target). I think I'm forgetting something in configuration this time.

Source: Heroku PostgreSQL standard-2 (9.5.8)

Target: AWS RDS PostgreSQL (9.6.3) at sa-east-1 region with rds.logical_replication=1

DMS: Instance at us-east-1 region

Full Cloudwatch logs:

2017-10-25T17:43:27 [TASK_MANAGER ]I: Task 'WKJYBNDMNIRS3AEA77T5BP5RN4' running full load and CDC in resume mode after recoverable error, retry #3 (replicationtask.c:1078)
2017-10-25T17:43:27 [TASK_MANAGER ]I: Task Id: bb955197-648a-4177-8653-677b5daf5a6e (replicationtask.c:2682)
2017-10-25T17:43:30 [TASK_MANAGER ]I: Creating threads for all components (replicationtask.c:1664)
2017-10-25T17:43:31 [TASK_MANAGER ]I: Threads for all components were created (replicationtask.c:1832)
2017-10-25T17:43:31 [TASK_MANAGER ]I: Task initialization completed successfully (replicationtask.c:2741)
2017-10-25T17:43:31 [TARGET_APPLY ]I: Going to connect to ODBC connection string: PROTOCOL=7.4-0;DRIVER={PostgreSQL};SERVER=XXXXX.rds.amazonaws.com;DATABASE=XXXXX;PORT=5432;sslmode=verify-ca;pqopt=sslrootcert=/rdsdbdata/rds-metadata/certificates/QQSFSDJTBLFXQLQ6VRVDDAYKCM/dms-ca-cert.pem;UID=USERID; (odbc_endpoint_imp.c:2236)
2017-10-25T17:43:31 [TARGET_APPLY ]I: Target endpoint 'PostgreSQL' is using provider syntax 'PostgreSQLLinux' (provider_syntax_manager.c:589)
2017-10-25T17:43:31 [TARGET_APPLY ]I: Transaction size is 10000. Array size is 1000. (odbc_endpoint_imp.c:837)
2017-10-25T17:43:31 [TARGET_APPLY ]I: CSV files will not be kept (odbc_endpoint_imp.c:1519)
2017-10-25T17:43:31 [TARGET_APPLY ]I: Error CSV files will not be kept (odbc_endpoint_imp.c:1528)
2017-10-25T17:43:31 [TARGET_APPLY ]I: Working in transactional apply mode (endpointshell.c:1436)
2017-10-25T17:43:31 [SOURCE_CAPTURE ]I: Going to connect to ODBC connection string: Driver={PostgreSQL Unicode(x64)};Server=SERVER_AT_HEROKU.compute-1.amazonaws.com;Port=5432;Database=XXXX;UseDeclareFetch=1;Fetch=10000;Uid=USERID;Pwd=PASSWORD;sslmode=require (postgres_endpoint_util.c:252)
2017-10-25T17:43:31 [SOURCE_CAPTURE ]I: Source endpoint 'PostgreSQL Source' is using provider syntax '<default>' (provider_syntax_manager.c:583)
2017-10-25T17:43:34 [TASK_MANAGER ]I: All stream components were initialized (replicationtask.c:2547)
2017-10-25T17:43:34 [SOURCE_CAPTURE ]I: Initial position is set to 'now' (postgres_endpoint_util.c:343)
2017-10-25T17:43:35 [SOURCE_CAPTURE ]I: Replication slot 'wkjybndmnirs3aea_00016385_bb955197_648a_4177_8653_677b5daf5a6e' does NOT exist. (postgres_endpoint_capture.c:293)
2017-10-25T17:43:35 [SOURCE_CAPTURE ]I: Initial positioning requested is 'now' (postgres_endpoint_capture.c:313)
2017-10-25T17:43:35 [SOURCE_CAPTURE ]E: Failed to execute statement: 'SELECT xlog_position FROM pg_create_logical_replication_slot('wkjybndmnirs3aea_00016385_bb955197_648a_4177_8653_677b5daf5a6e', 'test_decoding')' [1022502] (ar_odbc_stmt.c:2415)
2017-10-25T17:43:35 [SOURCE_CAPTURE ]E: RetCode: SQL_ERROR SqlState: 42501 NativeError: 1 Message: ERROR: must be superuser or replication role to use replication slots;, Error while executing the query [1022502] (ar_odbc_stmt.c:2421)
2017-10-25T17:43:35 [SOURCE_CAPTURE ]E: Creating replication slot 'wkjybndmnirs3aea_00016385_bb955197_648a_4177_8653_677b5daf5a6e' failed. [1022502] (postgres_endpoint_capture.c:334)
2017-10-25T17:43:35 [SOURCE_CAPTURE ]E: Error executing source loop [1022502] (streamcomponent.c:1581)
2017-10-25T17:43:35 [TASK_MANAGER ]E: Task error notification received from subtask 0, thread 0 [1022502] (replicationtask.c:2375)
2017-10-25T17:43:35 [TASK_MANAGER ]E: Stream component failed at subtask 0, component st_0_QVUF6NET6KSB26SCIIRH4UQZAQ [1022502] (subtask.c:1350)
2017-10-25T17:43:35 [TASK_MANAGER ]W: Task 'WKJYBNDMNIRS3AEA77T5BP5RN4' encountered a recoverable error (repository.c:4749)
2017-10-25T17:43:35 [SOURCE_CAPTURE ]E: Stream component 'st_0_QVUF6NET6KSB26SCIIRH4UQZAQ' terminated [1022502] (subtask.c:1513)
2017-10-25T17:43:40 [TASK_MANAGER ]I: Subtask #0 ended (replicationtask_util.c:937)
2017-10-25T17:43:40 [TASK_MANAGER ]I: Task management thread terminated (replicationtask.c:3210)