问:
Linkage error when including npps.h from CUDA 10.0
I'm writing a C++ application that will be using CUDA to do some signal processing on the GPU. Since I'm doing signal processing I'm including npps.h which contains the CUDA signal processing functions. However, every time I include npps.h I get linkage errors. I was able to replicate the problem by creating the 1 line file shown below.

CuTest.cpp

```<code>#include <npps.h>
</code>```

I tried building with the following command:

```<code>g++ -I/tools/cuda-10.0/include -L/tools/cuda-10.0/lib64  -lnpps -c CuTest.cpp
</code>```

When I try building I get the following errors.

```<code>In file included from /tools/cuda-10.0/include/cuda_runtime.h:95:0,
                 from /tools/cuda-10.0/include/nppdefs.h:52,
                 from /tools/cuda-10.0/include/npps.h:60,
                 from CuTest.cpp:2:
/tools/cuda-10.0/include/channel_descriptor.h:104:1: error: template with C linkage
 template<class T> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void)
 ^
/tools/cuda-10.0/include/channel_descriptor.h:137:1: error: template specialization with C linkage
 template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<char>(void)
</code>```

Here is what npps.h looks like:

```<code>#ifndef NV_NPPS_H
#define NV_NPPS_H

/**
* \file npps.h
* NPP Signal Processing Functionality.
*/

#ifdef __cplusplus
extern "C" {
#endif

#include "nppdefs.h"

/** @defgroup npps NPP Signal Processing
*
* @{
*
*/

#include "npps_support_functions.h"
#include "npps_initialization.h"
#include "npps_conversion_functions.h"
#include "npps_arithmetic_and_logical_operations.h"
#include "npps_statistics_functions.h"
#include "npps_filtering_functions.h"

/** @} end of Signal Processing module */

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* NV_NPPS_H */
</code>```

From the error I got you can see that one of the includes in npps.h that is wrapped in the extern “C” eventually includes a file with template code which is a no-no inside an extern “C”. From the error I got I saw that the offending file was cuda_runtime.h. So, I modified CuTest.cpp to look like the following.

CuTest.cpp:

```<code>#include <cuda_runtime.h>
#include <npps.h>
</code>```

By including cuda_runtime.h first, because of include guards it will not be included again by npps.h and so when it gets included it will not be wrapped in extern “C”. This worked for CuTest.cpp and doing the same thing in my larger application allowed it to build and run as well.

Here is the configuration I'm running on

```<code>g++ (GCC) 8.1.0
CUDA 10.0
CentOS Linux release 7.6.1810 (Core)
</code>```

Note: I get the same behavior with g++ 4.8.1

Is this a bug in the CUDA headers? Has anybody else seen this or able to reproduce it?

答:
You need to declare #include "nppdefs.h" before #ifdef __cplusplus line in the npps.h file:

```<code>#ifndef NV_NPPS_H
#define NV_NPPS_H

#include "nppdefs.h"

#ifdef __cplusplus
extern "C" {
#endif
...
</code>```

Body:
I'm writing a C++ application that will be using CUDA to do some signal processing on the GPU. Since I'm doing signal processing I'm including npps.h which contains the CUDA signal processing functions. However, every time I include npps.h I get linkage errors. I was able to replicate the problem by creating the 1 line file shown below.

CuTest.cpp

#include <npps.h>

I tried building with the following command:

g++ -I/tools/cuda-10.0/include -L/tools/cuda-10.0/lib64  -lnpps -c CuTest.cpp

When I try building I get the following errors.

In file included from /tools/cuda-10.0/include/cuda_runtime.h:95:0,
                 from /tools/cuda-10.0/include/nppdefs.h:52,
                 from /tools/cuda-10.0/include/npps.h:60,
                 from CuTest.cpp:2:
/tools/cuda-10.0/include/channel_descriptor.h:104:1: error: template with C linkage
 template<class T> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void)
 ^
/tools/cuda-10.0/include/channel_descriptor.h:137:1: error: template specialization with C linkage
 template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<char>(void)

Here is what npps.h looks like:

#ifndef NV_NPPS_H
#define NV_NPPS_H

/**
* \file npps.h
* NPP Signal Processing Functionality.
*/

#ifdef __cplusplus
extern "C" {
#endif

#include "nppdefs.h"

/** @defgroup npps NPP Signal Processing
*
* @{
*
*/

#include "npps_support_functions.h"
#include "npps_initialization.h"
#include "npps_conversion_functions.h"
#include "npps_arithmetic_and_logical_operations.h"
#include "npps_statistics_functions.h"
#include "npps_filtering_functions.h"

/** @} end of Signal Processing module */

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* NV_NPPS_H */

From the error I got you can see that one of the includes in npps.h that is wrapped in the extern “C” eventually includes a file with template code which is a no-no inside an extern “C”. From the error I got I saw that the offending file was cuda_runtime.h. So, I modified CuTest.cpp to look like the following.

CuTest.cpp:

#include <cuda_runtime.h>
#include <npps.h>

By including cuda_runtime.h first, because of include guards it will not be included again by npps.h and so when it gets included it will not be wrapped in extern “C”. This worked for CuTest.cpp and doing the same thing in my larger application allowed it to build and run as well.

Here is the configuration I'm running on

g++ (GCC) 8.1.0
CUDA 10.0
CentOS Linux release 7.6.1810 (Core)

Note: I get the same behavior with g++ 4.8.1

Is this a bug in the CUDA headers? Has anybody else seen this or able to reproduce it?

Body:
You need to declare #include "nppdefs.h" before #ifdef __cplusplus line in the npps.h file:

#ifndef NV_NPPS_H
#define NV_NPPS_H

#include "nppdefs.h"

#ifdef __cplusplus
extern "C" {
#endif
...


来源: stackexchange

问:
Windows store not allowing to download App
I coded an app and uploaded to store after verifying with certification kit.
This app is for testing so I selected promo code option in store visibility

Now when I or some other user redeems code he see the app in his library but cannot download the app.

I published app three times and added notes to testers that we can't download it, but nothing changed.
This is the error

Any suggestions ?

答: It takes some time to propagate the update of app in servers, worked after some time</p>

ContentLicense: CC BY-SA 3.0

ContentLicense: CC BY-SA 4.0


问:
Laravel Eureka client error 404 not found Response
I have error!!! Please help!!!
GuzzleHttp\Exception\ClientException : Client error: POST  http://10.100.0.7:8080/eureka/apps/NewsService resulted in a 404 Not Found response</p>

```<code>public function handle()
{
    $client = new EurekaClient([
        'eurekaDefaultUrl' => 'http://10.100.0.7:8080/eureka-
                server/eureka',
        'hostName'         => 'NewsService',
        'appName'          => 'NewsService',
        'ip'               => '10.111.2.23',
        'port'             => ['8000', true],
    ]);

    try {
        $client->register();
        $client->start();
    } catch (Exception $e) {
        return $e->getResponse();
    }
}
</code>```

答: Create laravel console  command and use  https://github.com/PavelLoparev/php-eureka-client</p>

Body:
I have error!!! Please help!!!
GuzzleHttp\Exception\ClientException : Client error: POST  http://10.100.0.7:8080/eureka/apps/NewsService resulted in a 404 Not Found response

public function handle()
{
    $client = new EurekaClient([
        'eurekaDefaultUrl' => 'http://10.100.0.7:8080/eureka-
                server/eureka',
        'hostName'         => 'NewsService',
        'appName'          => 'NewsService',
        'ip'               => '10.111.2.23',
        'port'             => ['8000', true],
    ]);

    try {
        $client->register();
        $client->start();
    } catch (Exception $e) {
        return $e->getResponse();
    }
}


问:
Pull to refresh recyclerview android
Hi I've a tabbed activity, and in the first tab I fetch data from server and show it in a recyclerview within card views. For fetching the data from server I use the volley library. I want to implement the Pull to refresh to load the data (so whenever I pull it has to do the request to the network). And I want also to disable the network request whenever I switch between tabs (because when I change tab focus in my app it starts to fetching data) I want to do the network request only 1 time (when user log in first time) and then others requests maneged only by pull to refresh.

Here's my fragment where I've recyclerview and show the data:

```<code>public class Tab1History extends Fragment
{

private RecyclerView recyclerView;
private CespiteAdapter adapter;
UserSessionManager session;

private static final String URL_DATA = "http://mydata.php";

private List<CespiteOgg> cespiteOggList;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState)
{

    View rootView = inflater.inflate(R.layout.tab1history, container, false);

    recyclerView = (RecyclerView) rootView.findViewById(R.id.my_recycler_view);
    recyclerView.setHasFixedSize(true);//every item of the RecyclerView has a fix size
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

    cespiteOggList = new ArrayList<>();

    loadRecyclerViewData();

            return rootView;
}

private void loadRecyclerViewData()
{
    // Session class instance
    session = new UserSessionManager(getActivity());
    //get user data from session
    HashMap<String, String> user = session.getUserDetails();
    //get name
    String name = user.get(UserSessionManager.KEY_NAME);
    // get username
    final String usernameUtente = user.get(UserSessionManager.KEY_USERNAME);

    final ProgressDialog progressDialog = new ProgressDialog(getActivity());
    progressDialog.setMessage("Carimento dati...");
    progressDialog.show();

    StringRequest stringRequest = new StringRequest(Request.Method.POST,
            URL_DATA,
            new Response.Listener<String>() {
                @Override
                public void onResponse(String s) {
                    progressDialog.dismiss();
                    try {
                        JSONObject jsonObject = new JSONObject(s);
                        JSONArray array = jsonObject.getJSONArray("dates");

                        for(int i=0; i<array.length(); i++)
                        {
                            JSONObject o = array.getJSONObject(i);
                            CespiteOgg item = new CespiteOgg(
                                    o.getString("CodNumInventario"),
                                    o.getString("Nome"),
                                    o.getString("DtCatalogazione"),
                                    o.getString("CodIdA"),
                                    o.getString("username")
                            );
                            cespiteOggList.add(item);
                        }

                        adapter = new CespiteAdapter(cespiteOggList, getActivity());
                        recyclerView.setAdapter(adapter);

                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    progressDialog.dismiss();
                }
            })
            {
                @Override
                protected Map<String, String> getParams() throws AuthFailureError {
                    Map<String, String> params = new HashMap<String, String>();
                    params.put("Username", usernameUtente);
                    return params;
                }
            };

    RegisterRequest.getmInstance(getActivity()).addToRequestque(stringRequest);

}
}
</code>```

And it's the adapter:

```<code>public class CespiteAdapter extends RecyclerView.Adapter<CespiteAdapter.ViewHolder>
{

private List<CespiteOgg> cespiteOggList;
private Context context;

public CespiteAdapter(List<CespiteOgg> cespiteOggList, Context context) {

    this.cespiteOggList = cespiteOggList;
    this.context = context;
}

public class ViewHolder extends RecyclerView.ViewHolder
{

    public CardView cv;
    public TextView txtNumInventario;
    public TextView txtNomeCespite;
    public TextView txtDtCatalogazione;
    public TextView txtAula;
    public TextView txtNomeUser;

    ViewHolder(View itemView)
    {

        super (itemView);
        //cv = (CardView) itemView.findViewById(R.id.cardView);
        txtNumInventario = (TextView) itemView.findViewById(R.id.txtNumeroInventario);
        txtNomeCespite = (TextView) itemView.findViewById(R.id.txtNomeCespite);
        txtDtCatalogazione = (TextView) itemView.findViewById(R.id.txtDataCatalogazione);
        txtAula = (TextView) itemView.findViewById(R.id.txtAula);
        txtNomeUser= (TextView) itemView.findViewById(R.id.txtNomeUser);

    }
}

@Override
public CespiteAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
{

    LayoutInflater inflater = LayoutInflater.from(parent.getContext());

    View cespiteView = inflater.inflate(R.layout.cespite_card_view, parent, false);

    return new ViewHolder(cespiteView);
}

@Override
public void onBindViewHolder(ViewHolder holder, int position)
{

    CespiteOgg cespiteOgg = cespiteOggList.get(position);

    holder.txtNumInventario.setText(cespiteOgg.getNumInventario());
    holder.txtNomeCespite.setText(cespiteOgg.getNomeCespite());
    holder.txtDtCatalogazione.setText(cespiteOgg.getDtCatalogazione());
    holder.txtAula.setText(cespiteOgg.getAula());
    holder.txtNomeUser.setText(cespiteOgg.getNomeUser());

}

@Override
public int getItemCount()
{

    return cespiteOggList.size();
}

}
</code>```

答:
XML code

```<code><androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/swipe_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/layout_titlebar">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/layout_titlebar"
        android:layout_margin="5dp"
        />

    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</code>```

Java code

```<code>public class BooksActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener {

            SwipeRefreshLayout swipLayout;
            RecyclerView recyclerview;

        @Override
            protected void onCreate(@Nullable Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity);
                recyclerview = view.findViewById(R.id.recyclerview);
                swipLayout = view.findViewById(R.id.swipe_layout);
                swipLayout.setOnRefreshListener(this);
            }//end of onCreate

        @Override
            public void onRefresh() {
        //your refresh code here
           loadRecyclerViewData()
             }

        private void loadRecyclerViewData(){
        onSuccess(){
        //don't forget to stop refreshing
        swipLayout.setRefreshing(false);
        }

        onFaliure(){
        //don't forget to stop refreshing
        swipLayout.setRefreshing(false);
        }
    }
    }
</code>```

Title: Pull to refresh recyclerview android

Body:
Hi I've a tabbed activity, and in the first tab I fetch data from server and show it in a recyclerview within card views. For fetching the data from server I use the volley library. I want to implement the Pull to refresh to load the data (so whenever I pull it has to do the request to the network). And I want also to disable the network request whenever I switch between tabs (because when I change tab focus in my app it starts to fetching data) I want to do the network request only 1 time (when user log in first time) and then others requests maneged only by pull to refresh.

Here's my fragment where I've recyclerview and show the data:

public class Tab1History extends Fragment
{

private RecyclerView recyclerView;
private CespiteAdapter adapter;
UserSessionManager session;

private static final String URL_DATA = "http://mydata.php";

private List<CespiteOgg> cespiteOggList;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState)
{

    View rootView = inflater.inflate(R.layout.tab1history, container, false);

    recyclerView = (RecyclerView) rootView.findViewById(R.id.my_recycler_view);
    recyclerView.setHasFixedSize(true);//every item of the RecyclerView has a fix size
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

    cespiteOggList = new ArrayList<>();

    loadRecyclerViewData();

            return rootView;
}

private void loadRecyclerViewData()
{
    // Session class instance
    session = new UserSessionManager(getActivity());
    //get user data from session
    HashMap<String, String> user = session.getUserDetails();
    //get name
    String name = user.get(UserSessionManager.KEY_NAME);
    // get username
    final String usernameUtente = user.get(UserSessionManager.KEY_USERNAME);

    final ProgressDialog progressDialog = new ProgressDialog(getActivity());
    progressDialog.setMessage("Carimento dati...");
    progressDialog.show();

    StringRequest stringRequest = new StringRequest(Request.Method.POST,
            URL_DATA,
            new Response.Listener<String>() {
                @Override
                public void onResponse(String s) {
                    progressDialog.dismiss();
                    try {
                        JSONObject jsonObject = new JSONObject(s);
                        JSONArray array = jsonObject.getJSONArray("dates");

                        for(int i=0; i<array.length(); i++)
                        {
                            JSONObject o = array.getJSONObject(i);
                            CespiteOgg item = new CespiteOgg(
                                    o.getString("CodNumInventario"),
                                    o.getString("Nome"),
                                    o.getString("DtCatalogazione"),
                                    o.getString("CodIdA"),
                                    o.getString("username")
                            );
                            cespiteOggList.add(item);
                        }

                        adapter = new CespiteAdapter(cespiteOggList, getActivity());
                        recyclerView.setAdapter(adapter);

                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    progressDialog.dismiss();
                }
            })
            {
                @Override
                protected Map<String, String> getParams() throws AuthFailureError {
                    Map<String, String> params = new HashMap<String, String>();
                    params.put("Username", usernameUtente);
                    return params;
                }
            };

    RegisterRequest.getmInstance(getActivity()).addToRequestque(stringRequest);

}
}

And it's the adapter:

public class CespiteAdapter extends RecyclerView.Adapter<CespiteAdapter.ViewHolder>
{

private List<CespiteOgg> cespiteOggList;
private Context context;

public CespiteAdapter(List<CespiteOgg> cespiteOggList, Context context) {

    this.cespiteOggList = cespiteOggList;
    this.context = context;
}

public class ViewHolder extends RecyclerView.ViewHolder
{

    public CardView cv;
    public TextView txtNumInventario;
    public TextView txtNomeCespite;
    public TextView txtDtCatalogazione;
    public TextView txtAula;
    public TextView txtNomeUser;

    ViewHolder(View itemView)
    {

        super (itemView);
        //cv = (CardView) itemView.findViewById(R.id.cardView);
        txtNumInventario = (TextView) itemView.findViewById(R.id.txtNumeroInventario);
        txtNomeCespite = (TextView) itemView.findViewById(R.id.txtNomeCespite);
        txtDtCatalogazione = (TextView) itemView.findViewById(R.id.txtDataCatalogazione);
        txtAula = (TextView) itemView.findViewById(R.id.txtAula);
        txtNomeUser= (TextView) itemView.findViewById(R.id.txtNomeUser);

    }
}

@Override
public CespiteAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
{

    LayoutInflater inflater = LayoutInflater.from(parent.getContext());

    View cespiteView = inflater.inflate(R.layout.cespite_card_view, parent, false);

    return new ViewHolder(cespiteView);
}

@Override
public void onBindViewHolder(ViewHolder holder, int position)
{

    CespiteOgg cespiteOgg = cespiteOggList.get(position);

    holder.txtNumInventario.setText(cespiteOgg.getNumInventario());
    holder.txtNomeCespite.setText(cespiteOgg.getNomeCespite());
    holder.txtDtCatalogazione.setText(cespiteOgg.getDtCatalogazione());
    holder.txtAula.setText(cespiteOgg.getAula());
    holder.txtNomeUser.setText(cespiteOgg.getNomeUser());

}

@Override
public int getItemCount()
{

    return cespiteOggList.size();
}

}

Body:
XML code

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/swipe_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/layout_titlebar">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/layout_titlebar"
        android:layout_margin="5dp"
        />

    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

Java code

public class BooksActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener {

            SwipeRefreshLayout swipLayout;
            RecyclerView recyclerview;

        @Override
            protected void onCreate(@Nullable Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity);
                recyclerview = view.findViewById(R.id.recyclerview);
                swipLayout = view.findViewById(R.id.swipe_layout);
                swipLayout.setOnRefreshListener(this);
            }//end of onCreate

        @Override
            public void onRefresh() {
        //your refresh code here
           loadRecyclerViewData()
             }

        private void loadRecyclerViewData(){
        onSuccess(){
        //don't forget to stop refreshing
        swipLayout.setRefreshing(false);
        }

        onFaliure(){
        //don't forget to stop refreshing
        swipLayout.setRefreshing(false);
        }
    }
    }


问:
MySQL - get users in location between dates
I have a logs table that contains logs of entrances and exits of users in a location.

I need to create a query that returns me the following data:

All users that have been visiting the site between two dates (FromDate & ToDate)

for this query a user visited the site between the two dates if:

the user has an entrance log before the ToDate but has no exit log at all

the user has an exit log after the FromDate but has no entrance log at all

en entrance and exit logs exist and the there is an entrance before the ToDate and there is en exit log after the FromDate

these are some of my tries:

```<code>SELECT UserId,
       MAX(EventDate) as lastAction,
       MAX(CASE WHEN InOrOut = 1 THEN EventDate END) as lastEntrance,
       MAX(CASE WHEN InOrOut = 0 THEN EventDate END) as lastExit
    FROM site_entrances
    WHERE siteId = 35
    GROUP BY UserId
    HAVING (lastExit IS NULL AND lastEntrance <= '2020-02-17 00:00:00') OR (lastEntrance IS NULL AND  lastExit >= '2020-01-17 00:00:00') OR (lastEntrance <= '2020-02-17 00:00:00' AND lastExit >= '2020-01-17 00:00:00');
</code>```

the problem with this one is: if there latest entrance is after the ToDate but an older entrance that is valid in this query exists, it is ignored...

```<code>SELECT t.*
FROM site_entrances as t, (SELECT site_entrances.UserId, MAX(EventDate) as 'latest'
                                     FROM site_entrances
                                     WHERE siteid = 35
                                     AND site_entrances.EventDate <= '2020-02-17 09:26:10'
                                     GROUP BY UserId) as maxDate
WHERE t.UserId= maxDate.UserId
AND t.EventDate = maxDate.latest
AND (t.InOrOut = 1 OR (t.InOrOut = 0 AND t.EventDate >= '2020-01-17 00:00:00'))
</code>```

this is the one I used and it works for me. the problem is that it is slow...

I think the first one needs a little guidance in the right direction and it would be perfect for me but.
a point in the right direction would be appreciated.

EDIT

Create table:

```<code>create table site_entrances (
    Id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    EventDate DateTime NOT NULL,
    InOrOut TINYINT NOT NULL,
    SiteId INT NOT NULL,
    UserId VARCHAR(13) NOT NULL,
    INDEX (SiteId, EventDate, UserId)
);
</code>```

insert:

```<code>insert into rtls.site_entrances (EventDate, InOrOut, SiteId, UserId)
values
# entrance before ToDate and exit after FromDate -> valid
('2020-01-02 00:01:00', 1, 35, 'a'),
('2020-04-01 00:01:00', 0, 35, 'a'),

# entrance and exit in range -> valid
('2020-01-18 00:01:00', 1, 35, 'b'),
('2020-01-19 00:01:00', 0, 35, 'b'),
('2020-03-18 00:01:00', 1, 35, 'b'), # not relevant to the query

# entrances without exits but they are befor FromDate -> valid
('2020-01-01 00:01:00', 1, 35, 'c1'),
('2020-01-20 00:01:00', 1, 35, 'c2'),

# entrance before ToDate and exit after FromDate -> valid
('2020-01-01 00:01:00', 1, 35, 'd'),
('2020-02-01 00:01:00', 0, 35, 'd'),

# exits without entrances but they are after FromDate -> valid
('2020-03-01 00:01:00', 0, 35, 'e1'),
('2020-02-01 00:01:00', 0, 35, 'e2'),

# entrance before ToDate and exit after FromDate -> valid
('2020-01-20 00:01:00', 1, 35, 'f'),
('2020-04-20 00:01:00', 0, 35, 'f'),

# entrance before ToDate but exit not after FromDate -> not valid
('2020-01-01 00:01:00', 1, 35, 'x'),
('2020-01-03 00:01:00', 0, 35, 'x'),

# exit after FromDate but entrance  not before ToDate -> not valid
('2020-04-01 00:01:00', 1, 35, 'y'),
('2020-04-02 00:01:00', 0, 35, 'y');
</code>```

the search I'm doing is between the dates: '2020-01-17 00:00:00' AND '2020-02-17 00:00:00'

the expected result:

```<code>UserId | Entrance              | Exit
d      | '2020-01-01 00:01:00' | '2020-02-01 00:01:00'
a      | '2020-01-02 00:01:00' | '2020-04-01 00:01:00'
b      | '2020-01-18 00:01:00' | '2020-01-19 00:01:00'
c1     | '2020-01-01 00:01:00' | NULL
c2     | '2020-01-20 00:01:00' | NULL
f      | '2020-01-20 00:01:00' | '2020-04-20 00:01:00'
e2     | NULL                  | '2020-02-01 00:01:00'
e1     | NULL                  | '2020-03-01 00:01:00'
</code>```

答:
Three separate queries:

both events exists

```<code>SELECT t1.UserId, t1.EventDate Entrance, t2.EventDate `Exit`
FROM site_entrances t1
JOIN site_entrances t2
WHERE t1.UserId = t2.UserId
  AND t1.InOrOut = 1
  AND t2.InOrOut = 0
  AND t1.EventDate < t2.EventDate
  AND ( @startdate < t2.EventDate AND t1.EventDate < @enddate )
  AND NOT EXISTS ( SELECT NULL
                   FROM site_entrances t3
                   WHERE t1.UserId = t3.UserId
                     AND t1.EventDate < t3.EventDate
                     AND t3.EventDate < t2.EventDate )
</code>```

entrance only

```<code>SELECT t1.UserId, t1.EventDate Entrance, NULL `Exit`
FROM site_entrances t1
WHERE EventDate < @enddate
  AND InOrOut = 1
  AND NOT EXISTS ( SELECT NULL
                   FROM site_entrances t2
                   WHERE t1.UserId = t2.UserId
                     AND t1.EventDate < t2.EventDate )
</code>```

exit only

```<code>SELECT t1.UserId, NULL Entrance, t1.EventDate `Exit`
FROM site_entrances t1
WHERE @startdate < EventDate
  AND InOrOut = 0
  AND NOT EXISTS ( SELECT NULL
                   FROM site_entrances t2
                   WHERE t1.UserId = t2.UserId
                     AND t1.EventDate > t2.EventDate )
</code>```

Check them. If everything is correct then UNION them.

fiddle

Body:
I have a logs table that contains logs of entrances and exits of users in a location.

I need to create a query that returns me the following data:

All users that have been visiting the site between two dates (FromDate & ToDate)

for this query a user visited the site between the two dates if:

the user has an entrance log before the ToDate but has no exit log at all

the user has an exit log after the FromDate but has no entrance log at all

en entrance and exit logs exist and the there is an entrance before the ToDate and there is en exit log after the FromDate

these are some of my tries:

SELECT UserId,
       MAX(EventDate) as lastAction,
       MAX(CASE WHEN InOrOut = 1 THEN EventDate END) as lastEntrance,
       MAX(CASE WHEN InOrOut = 0 THEN EventDate END) as lastExit
    FROM site_entrances
    WHERE siteId = 35
    GROUP BY UserId
    HAVING (lastExit IS NULL AND lastEntrance <= '2020-02-17 00:00:00') OR (lastEntrance IS NULL AND  lastExit >= '2020-01-17 00:00:00') OR (lastEntrance <= '2020-02-17 00:00:00' AND lastExit >= '2020-01-17 00:00:00');

the problem with this one is: if there latest entrance is after the ToDate but an older entrance that is valid in this query exists, it is ignored...

SELECT t.*
FROM site_entrances as t, (SELECT site_entrances.UserId, MAX(EventDate) as 'latest'
                                     FROM site_entrances
                                     WHERE siteid = 35
                                     AND site_entrances.EventDate <= '2020-02-17 09:26:10'
                                     GROUP BY UserId) as maxDate
WHERE t.UserId= maxDate.UserId
AND t.EventDate = maxDate.latest
AND (t.InOrOut = 1 OR (t.InOrOut = 0 AND t.EventDate >= '2020-01-17 00:00:00'))

this is the one I used and it works for me. the problem is that it is slow...

I think the first one needs a little guidance in the right direction and it would be perfect for me but.
a point in the right direction would be appreciated.

EDIT

Create table:

create table site_entrances (
    Id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    EventDate DateTime NOT NULL,
    InOrOut TINYINT NOT NULL,
    SiteId INT NOT NULL,
    UserId VARCHAR(13) NOT NULL,
    INDEX (SiteId, EventDate, UserId)
);

insert:

insert into rtls.site_entrances (EventDate, InOrOut, SiteId, UserId)
values
# entrance before ToDate and exit after FromDate -> valid
('2020-01-02 00:01:00', 1, 35, 'a'),
('2020-04-01 00:01:00', 0, 35, 'a'),

# entrance and exit in range -> valid
('2020-01-18 00:01:00', 1, 35, 'b'),
('2020-01-19 00:01:00', 0, 35, 'b'),
('2020-03-18 00:01:00', 1, 35, 'b'), # not relevant to the query

# entrances without exits but they are befor FromDate -> valid
('2020-01-01 00:01:00', 1, 35, 'c1'),
('2020-01-20 00:01:00', 1, 35, 'c2'),

# entrance before ToDate and exit after FromDate -> valid
('2020-01-01 00:01:00', 1, 35, 'd'),
('2020-02-01 00:01:00', 0, 35, 'd'),

# exits without entrances but they are after FromDate -> valid
('2020-03-01 00:01:00', 0, 35, 'e1'),
('2020-02-01 00:01:00', 0, 35, 'e2'),

# entrance before ToDate and exit after FromDate -> valid
('2020-01-20 00:01:00', 1, 35, 'f'),
('2020-04-20 00:01:00', 0, 35, 'f'),

# entrance before ToDate but exit not after FromDate -> not valid
('2020-01-01 00:01:00', 1, 35, 'x'),
('2020-01-03 00:01:00', 0, 35, 'x'),

# exit after FromDate but entrance  not before ToDate -> not valid
('2020-04-01 00:01:00', 1, 35, 'y'),
('2020-04-02 00:01:00', 0, 35, 'y');

the search I'm doing is between the dates: '2020-01-17 00:00:00' AND '2020-02-17 00:00:00'

the expected result:

UserId | Entrance              | Exit
d      | '2020-01-01 00:01:00' | '2020-02-01 00:01:00'
a      | '2020-01-02 00:01:00' | '2020-04-01 00:01:00'
b      | '2020-01-18 00:01:00' | '2020-01-19 00:01:00'
c1     | '2020-01-01 00:01:00' | NULL
c2     | '2020-01-20 00:01:00' | NULL
f      | '2020-01-20 00:01:00' | '2020-04-20 00:01:00'
e2     | NULL                  | '2020-02-01 00:01:00'
e1     | NULL                  | '2020-03-01 00:01:00'

Body:
Three separate queries:

both events exists

SELECT t1.UserId, t1.EventDate Entrance, t2.EventDate `Exit`
FROM site_entrances t1
JOIN site_entrances t2
WHERE t1.UserId = t2.UserId
  AND t1.InOrOut = 1
  AND t2.InOrOut = 0
  AND t1.EventDate < t2.EventDate
  AND ( @startdate < t2.EventDate AND t1.EventDate < @enddate )
  AND NOT EXISTS ( SELECT NULL
                   FROM site_entrances t3
                   WHERE t1.UserId = t3.UserId
                     AND t1.EventDate < t3.EventDate
                     AND t3.EventDate < t2.EventDate )

entrance only

SELECT t1.UserId, t1.EventDate Entrance, NULL `Exit`
FROM site_entrances t1
WHERE EventDate < @enddate
  AND InOrOut = 1
  AND NOT EXISTS ( SELECT NULL
                   FROM site_entrances t2
                   WHERE t1.UserId = t2.UserId
                     AND t1.EventDate < t2.EventDate )

exit only

SELECT t1.UserId, NULL Entrance, t1.EventDate `Exit`
FROM site_entrances t1
WHERE @startdate < EventDate
  AND InOrOut = 0
  AND NOT EXISTS ( SELECT NULL
                   FROM site_entrances t2
                   WHERE t1.UserId = t2.UserId
                     AND t1.EventDate > t2.EventDate )

Check them. If everything is correct then UNION them.

fiddle


问:
What is the scheme for calculator?
I'm trying to open the app "Calculator" but I don't know the Scheme</p>

```<code>- (IBAction)btnColetorClick:(id)sender
{
    NSString *customURL = @"calculator://";

    if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:customURL]])
    {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];
    }
    else
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"URL error"
                                                        message:[NSString stringWithFormat:@"No custom URL defined for %@", customURL]
                                                       delegate:self
                                              cancelButtonTitle:@"Ok"
                                              otherButtonTitles:nil];
        [alert show];
    }
}
</code>```

答:
You can try "calc://"

it works on iOS13

Title: What is the scheme for calculator?

Body:
I'm trying to open the app "Calculator" but I don't know the Scheme

- (IBAction)btnColetorClick:(id)sender
{
    NSString *customURL = @"calculator://";

    if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:customURL]])
    {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];
    }
    else
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"URL error"
                                                        message:[NSString stringWithFormat:@"No custom URL defined for %@", customURL]
                                                       delegate:self
                                              cancelButtonTitle:@"Ok"
                                              otherButtonTitles:nil];
        [alert show];
    }
}

Body:
You can try "calc://"

it works on iOS13


问:
Using Simple Injector with SignalR
I thought using my own IoC would be pretty straight forward with SignalR and maybe it is; most likely I'm doing something wrong. Here's my code I have so far:

```<code>private static void InitializeContainer(Container container)
{

   container.Register<IMongoHelper<UserDocument>, MongoHelper<UserDocument>>();
   // ... registrations like about and then:
   var resolver = new SimpleInjectorResolver(container);
   GlobalHost.DependencyResolver = resolver;
}
</code>```

and then my class:

```<code>public class SimpleInjectorResolver : DefaultDependencyResolver
{
    private Container _container;
    public SimpleInjectorResolver(Container container)
    {
        _container = container;
    }

    public override object GetService(Type serviceType)
    {
        return _container.GetInstance(serviceType) ?? base.GetService(serviceType);
    }

    public override IEnumerable<object> GetServices(Type serviceType)
    {
        return _container.GetAllInstances(serviceType) ?? base.GetServices(serviceType);
    }
}
</code>```

What ends up happening is I get an error that IJavaScriptProxyGenerator can't be resolved, so I think, well I'll add the registration:

```<code>container.Register<IJavaScriptProxyGenerator, DefaultJavaScriptProxyGenerator>(
    ConstructorSelector.MostParameters);
</code>```

but then there are a bunch of others! I get to:

```<code>container.Register<IDependencyResolver, SimpleInjectorResolver>();
container.Register<IJavaScriptMinifier, NullJavaScriptMinifier>();
container.Register<IJavaScriptProxyGenerator, DefaultJavaScriptProxyGenerator>(
    ConstructorSelector.MostParameters);
container.Register<IHubManager, DefaultHubManager>();
container.Register<IHubActivator, DefaultHubActivator>();
container.Register<IParameterResolver, DefaultParameterResolver>();
container.Register<IMessageBus, InProcessMessageBus>(ConstructorSelector.MostParameters);
</code>```

Which still gives me "No registration for type ITraceManager could be found." ... but now I'm wondering if I'm doing this right at all as I hoping I wouldn't need to re-wire everything SignalR is doing...right? Hopefully? If not I'll keep trudging along but I'm a SignalR and Simple Injector newb so thought I'd ask first. :)

Additional: https://cuttingedge.it/blogs/steven/pivot/entry.php?id=88 since SignalR had multiple constructors.

答:
In .NET Core 3.x the signalR is now a Transient. You can inject your hub using DI. So you start to map the hub, implement the interface and the hub, and access it's context via DI.

Startup:

app.UseSignalR(routes =>
{
    routes.MapHub<YourHub>(NotificationsRoute); // defined as string
});
```

<pre class="lang-cs prettyprint-override"><code>services.AddSignalR(hubOptions =>
{
    // your options
})
</code>```

Then you implement a interface like:

public interface IYourHub
{
    // Your interface implementation
}
```

<p>And your hub:</p>

<pre class="lang-cs prettyprint-override"><code>public class YourHub : Hub<IYourHub>
{
    // your hub implementation
}
</code>```

Finally you inject the hub like:

private IHubContext<YourHub, IYourHub> YourHub
{
    get
    {
        return this.serviceProvider.GetRequiredService<IHubContext<YourHub, IYourHub>>();
    }
}
```

<p>Also you can define a service for your hub (middleware) and don't inject the context directly to your class.</p>

<p>Imagine you defined in the interface the method <code>Message</code> so in your class you can send the message like this:</p>

<pre class="lang-cs prettyprint-override"><code>await this.YourHub.Clients.Group("someGroup").Message("Some Message").ConfigureAwait(false);
</code>```

If not implemented in a interface you just use:

await this.YourHub.Clients.Group("someGroup").SendAsync("Method Name", "Some Message").ConfigureAwait(false);
```

Title: Using Simple Injector with SignalR

Body:
I thought using my own IoC would be pretty straight forward with SignalR and maybe it is; most likely I'm doing something wrong. Here's my code I have so far:

private static void InitializeContainer(Container container)
{

   container.Register<IMongoHelper<UserDocument>, MongoHelper<UserDocument>>();
   // ... registrations like about and then:
   var resolver = new SimpleInjectorResolver(container);
   GlobalHost.DependencyResolver = resolver;
}

and then my class:

public class SimpleInjectorResolver : DefaultDependencyResolver
{
    private Container _container;
    public SimpleInjectorResolver(Container container)
    {
        _container = container;
    }

    public override object GetService(Type serviceType)
    {
        return _container.GetInstance(serviceType) ?? base.GetService(serviceType);
    }

    public override IEnumerable<object> GetServices(Type serviceType)
    {
        return _container.GetAllInstances(serviceType) ?? base.GetServices(serviceType);
    }
}

What ends up happening is I get an error that IJavaScriptProxyGenerator can't be resolved, so I think, well I'll add the registration:

container.Register<IJavaScriptProxyGenerator, DefaultJavaScriptProxyGenerator>(
    ConstructorSelector.MostParameters);

but then there are a bunch of others! I get to:

container.Register<IDependencyResolver, SimpleInjectorResolver>();
container.Register<IJavaScriptMinifier, NullJavaScriptMinifier>();
container.Register<IJavaScriptProxyGenerator, DefaultJavaScriptProxyGenerator>(
    ConstructorSelector.MostParameters);
container.Register<IHubManager, DefaultHubManager>();
container.Register<IHubActivator, DefaultHubActivator>();
container.Register<IParameterResolver, DefaultParameterResolver>();
container.Register<IMessageBus, InProcessMessageBus>(ConstructorSelector.MostParameters);

Which still gives me "No registration for type ITraceManager could be found." ... but now I'm wondering if I'm doing this right at all as I hoping I wouldn't need to re-wire everything SignalR is doing...right? Hopefully? If not I'll keep trudging along but I'm a SignalR and Simple Injector newb so thought I'd ask first. :)

Additional: https://cuttingedge.it/blogs/steven/pivot/entry.php?id=88 since SignalR had multiple constructors.

Body:
In .NET Core 3.x the signalR is now a Transient. You can inject your hub using DI. So you start to map the hub, implement the interface and the hub, and access it's context via DI.

Startup:

app.UseSignalR(routes =>
{
    routes.MapHub<YourHub>(NotificationsRoute); // defined as string
});

services.AddSignalR(hubOptions =>
{
    // your options
})

Then you implement a interface like:

public interface IYourHub
{
    // Your interface implementation
}

And your hub:

public class YourHub : Hub<IYourHub>
{
    // your hub implementation
}

Finally you inject the hub like:

private IHubContext<YourHub, IYourHub> YourHub
{
    get
    {
        return this.serviceProvider.GetRequiredService<IHubContext<YourHub, IYourHub>>();
    }
}

Also you can define a service for your hub (middleware) and don't inject the context directly to your class.

Imagine you defined in the interface the method Message so in your class you can send the message like this:

await this.YourHub.Clients.Group("someGroup").Message("Some Message").ConfigureAwait(false);

If not implemented in a interface you just use:

await this.YourHub.Clients.Group("someGroup").SendAsync("Method Name", "Some Message").ConfigureAwait(false);


问:
Kotlin Multiplateform with TensorflowLite
Is there any way to develop project by using Kotlin Multiplateform and tensor flow lite model in the shared logic. Target is to use same tensor flow model with same kotlin code to retrieve data from it with android and iOS both. UI is desired to be developed separately with platform specific code.

I have explored many project of kotlin MPP with shared logic of kotlin to be used in android and iOS both but I have doubt about tenserflow lite model. will it work fine in shared logic of kotlin and give same data to android and iOS both?

答:
Both iOS and Android have libraries for using TensorFlow but those libs are different libs, they are written for each platform independently (unlike TensorFlow C API which can be built for Android and iOS). So you won't be able to use officially supported TensorFlow API in common kotlin code.

Fortunately you can divide your common logic from platform dependent TensorFlow API calls by introducing a common interface TensorFlowNativeApi. Just add some necessary TensorFlow API methods into this interface and call them in common code. Then in apps for each platform create a class that implements this interface (using TensorFlow lib for particular platform) and pass this implementation to your common code that uses TensorFlow.

Also worth noting that the same TensorFlow Lite model can be used on both platforms, it is just must be converted from TensorFlow model using converter.


问:
Need change envioment of bootstrap in Spring Cloud
I am new in spring cloud, and i see can change the aplication.yml but i dont know how change bootstrap.yml for local or another enviroment like development, production, or any else.

If can give me any example or similar. Thanks

答:
I think you are asking the same thing i asked days before.

Here the question answered

I hope it's what you want


问:
Google Transliteration in Rich Text Editor
I need to use Google Transliteration along with rich-text editing support.

The Google Transliteration API docs recommend the rich text-editor offered by Closure library or Yahoo! UI Library.

But, I tried both of them and the transliteration does not work.

Anybody who has implemented a rich-text editor which supports transliteration as well?

[Edit: Answer updated below]

答:
The WYSIWIG editor that comes with Textile Markup works well with Google Transliteration API :)

Install the acts_as_textiled plugin

```<code>rails plugin install https://github.com/defunkt/acts_as_textiled.git
</code>```

and then install textile_editor_helper

```<code>rails plugin install http://svn.webtest.wvu.edu/repos/rails/plugins/textile_editor_helper
</code>```

Then, you should be able to integrate the WYSIWIG editor in your views. For, MarkitUp fans, equivalent plugins are available too ;)

Refer this article for further info. The article explains the editor integration, but the links are outdated, so refer above for the latest sources.

Body:
The WYSIWIG editor that comes with Textile Markup works well with Google Transliteration API :)

Install the acts_as_textiled plugin

rails plugin install https://github.com/defunkt/acts_as_textiled.git

and then install textile_editor_helper

rails plugin install http://svn.webtest.wvu.edu/repos/rails/plugins/textile_editor_helper

Then, you should be able to integrate the WYSIWIG editor in your views. For, MarkitUp fans, equivalent plugins are available too ;)

Refer this article for further info. The article explains the editor integration, but the links are outdated, so refer above for the latest sources.


问:
How to increase or decrease the number of mongodb shards deployed via helm bitnami/mongodb-sharded?
I have deployed mongodb sharded cluster in kubernetes.
via: helm install my-release bitnami/mongodb-sharded with default features of 2 shards and only 1 replica per shard.

It is running fine but now I must increase the total number of shards to 4 and each shard replica to 3. Any idea how to do that?

答:
If I recall correctly you can make those changes using command line:

$ helm install my-release --set shards=4, configsvr.replicas=3 bitnami/mongodb-sharded

As for replicas it depends what exactly your want to scale, you can choose from following:

configsvr.replicas

Number of nodes in the replica set (the first node will be primary)

or

mongos.replicas

Number of Mongos nodes to create

or

shardsvr.dataNode.replicas

Number of nodes in each shard replica set (the first node will be primary)

or

shardsvr.arbiter.replicas

Number of arbiters in each shard replica set (the first node will be primary)

Everything is described in Installing the Chart


问:
Ansible vars_prompt for roles
I have a set of Ansible playbooks and the main yml file is like this

```<code>- hosts: all
  roles:
    - common
    - install_nginx
</code>```

I want to add the confirm message when I trigger the playbook. I tried this and did not work

```<code>- hosts: all
  vars_prompt:
    - name: CONFIRM
      prompt: Just to confirm you will install stuff
  tasks:
    - fail: no deployment this time
      when: CONFIRM != 'yes'
  roles:
    - common
    - install_nginx
</code>```

How can I use vars_prompt in this case without modify every role?

答:
How to use Ansible vars_prompt for roles

i got the solution to use vars_prompts in ansible role section

i have directly included vars_prompt in my main.yml playbook as like before

```<code>- hosts: "{{HOSTS}}"
  gather_facts: yes
  become: yes
  roles:
    - syslog
    - splunk
    - nmon
    - trendmicro
    - user-creation
    - extened-history
  vars_prompt:
    - name: "user_password"
      prompt: "Enter User Password"
      private: yes
      confirm: yes
==========================================================
</code>```

Below is the ansible command to execute the playbook

```<code># ansible-playbook ort-linux.yml -e "HOSTS=TESTSERVER"
Enter User Password:
confirm Enter User Password:

========================================================
</code>```

Below is my roles playbook for user id creation

```<code>---
  - name: "Task-1 create Linux Team user"
    user:
     name: "{{item}}"
     comment: LINUX_UNIX_TEAM
     group: LINUX_UNIX_TEAM
     shell: /bin/bash
     generate_ssh_key: yes
     ssh_key_bits: 2048
     ssh_key_file: .ssh/id_rsa
     createhome: yes
     password: "{{user_password|password_hash('sha512')}}"

    loop:
     - sam
     - jack
     - kumar
     - ravi
    tags: linuxuser
</code>```

Title: Ansible vars_prompt for roles

Body:
I have a set of Ansible playbooks and the main yml file is like this

- hosts: all
  roles:
    - common
    - install_nginx

I want to add the confirm message when I trigger the playbook. I tried this and did not work

- hosts: all
  vars_prompt:
    - name: CONFIRM
      prompt: Just to confirm you will install stuff
  tasks:
    - fail: no deployment this time
      when: CONFIRM != 'yes'
  roles:
    - common
    - install_nginx

How can I use vars_prompt in this case without modify every role?

Body:
How to use Ansible vars_prompt for roles

i got the solution to use vars_prompts in ansible role section

i have directly included vars_prompt in my main.yml playbook as like before

- hosts: "{{HOSTS}}"
  gather_facts: yes
  become: yes
  roles:
    - syslog
    - splunk
    - nmon
    - trendmicro
    - user-creation
    - extened-history
  vars_prompt:
    - name: "user_password"
      prompt: "Enter User Password"
      private: yes
      confirm: yes
==========================================================

Below is the ansible command to execute the playbook

# ansible-playbook ort-linux.yml -e "HOSTS=TESTSERVER"
Enter User Password:
confirm Enter User Password:

========================================================

Below is my roles playbook for user id creation

---
  - name: "Task-1 create Linux Team user"
    user:
     name: "{{item}}"
     comment: LINUX_UNIX_TEAM
     group: LINUX_UNIX_TEAM
     shell: /bin/bash
     generate_ssh_key: yes
     ssh_key_bits: 2048
     ssh_key_file: .ssh/id_rsa
     createhome: yes
     password: "{{user_password|password_hash('sha512')}}"

    loop:
     - sam
     - jack
     - kumar
     - ravi
    tags: linuxuser


问:
how to send Recyclerview list to Server Using Volley
I have created a Project in which i have acustom alertdialog box with 3 edit text and one button. On button Click it add my data to Recyclerview successfully and it's working fine.

Now i want to post the recyclerview data to server using volley Post method can any one help me out how can i do it i just need a idea how to send data of recyclerview(list of my Recyclerview) to server. I want to Post full list of objects in array to server.

what should i send to my parameters so that i Successful post the recyclerview data to my server.

I have Reached Almost there but i want all objects in my same ARRAY LIST DATA But i am getting Different Array List with different object(need All object in one Array list)

Need Output Like

```<code> [{
    "movie_name":"trter",
    "movies_Add":"hgjhj90",
    "movie_no":"8787878787"
    }
    {
    "movie_name":"trter",
    "movies_Add":"hgjhj90",
    "movie_no":"8787878787"
    }
    {
    "movie_name":"trter",
    "movies_Add":"hgjhj90",
    "movie_no":"8787878787"
    }
    ]
</code>```

Code of

```<code> JSONArray movieArray = new JSONArray();
                for (int i = 0; i <= movieList.size(); i++) {
                    JSONObject movieObject = new JSONObject();
                    try {
                        movieObject.put("movie_name", "" + member_name);
                        movieObject.put("movies_Add", "" + member_adds);
                        movieObject.put("movie_no", "" + member_contacts);
                        movieArray.put(movieObject);
                    } catch (JSONException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
                String jsonStr = movieArray.toString();

                Log.i("jsonobj12", String.valueOf(movieArray));
                Log.i("jsonobj123", String.valueOf(movieList1.size()));
</code>```

Log Data

```<code>2020-02-14 09:49:54.283 17587-17587/com.example.raid I/jsonobj12: [{"movie_name":"trter","movies_Add":"hgjhj90","movie_no":"8787878787"}]
2020-02-14 09:49:54.283 17587-17587/com.example.raid I/jsonobj123: 1
2020-02-14 09:50:03.381 17587-17587/com.example.raid I/jsonobj12: [{"movie_name":"tertre","movies_Add":"hgvjnbk99090","movie_no":"7687687868"}]
2020-02-14 09:50:03.381 17587-17587/com.example.raid I/jsonobj123: 2
</code>```

答:
There are a few problems in your code I want to point out, maybe one of is fixing your problem. Identifying the real problem is hard, because you did not provide enough information:

This loop for (int i = 0; i <= movieList.size(); i++) { iterates one time too often. Let's say your movieList has 3 elements, your loop will iterate for each i in (0,1,2,3) but your list only has the indices (0,1,2) as Arrays/Lists start with index 0. So you should use i < movieList.size() here.

Are you sure you are adding the right items to your movieObject? movieObject.put("movie_name", "" + member_name); uses the variable member_name which is not updated within your loop, you probably need to use movieList.get(i).member_name or similar (please provide more information what exactly the movieList looks like). Same applies for the following two lines

In your log you use movieList1 but in your loop you use movieList are you sure both lists are the same?

Body:
I have created a Project in which i have acustom alertdialog box with 3 edit text and one button. On button Click it add my data to Recyclerview successfully and it's working fine.

Now i want to post the recyclerview data to server using volley Post method can any one help me out how can i do it i just need a idea how to send data of recyclerview(list of my Recyclerview) to server. I want to Post full list of objects in array to server.

what should i send to my parameters so that i Successful post the recyclerview data to my server.

I have Reached Almost there but i want all objects in my same ARRAY LIST DATA But i am getting Different Array List with different object(need All object in one Array list)

Need Output Like

 [{
    "movie_name":"trter",
    "movies_Add":"hgjhj90",
    "movie_no":"8787878787"
    }
    {
    "movie_name":"trter",
    "movies_Add":"hgjhj90",
    "movie_no":"8787878787"
    }
    {
    "movie_name":"trter",
    "movies_Add":"hgjhj90",
    "movie_no":"8787878787"
    }
    ]

Code of

 JSONArray movieArray = new JSONArray();
                for (int i = 0; i <= movieList.size(); i++) {
                    JSONObject movieObject = new JSONObject();
                    try {
                        movieObject.put("movie_name", "" + member_name);
                        movieObject.put("movies_Add", "" + member_adds);
                        movieObject.put("movie_no", "" + member_contacts);
                        movieArray.put(movieObject);
                    } catch (JSONException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
                String jsonStr = movieArray.toString();

                Log.i("jsonobj12", String.valueOf(movieArray));
                Log.i("jsonobj123", String.valueOf(movieList1.size()));

Log Data

2020-02-14 09:49:54.283 17587-17587/com.example.raid I/jsonobj12: [{"movie_name":"trter","movies_Add":"hgjhj90","movie_no":"8787878787"}]
2020-02-14 09:49:54.283 17587-17587/com.example.raid I/jsonobj123: 1
2020-02-14 09:50:03.381 17587-17587/com.example.raid I/jsonobj12: [{"movie_name":"tertre","movies_Add":"hgvjnbk99090","movie_no":"7687687868"}]
2020-02-14 09:50:03.381 17587-17587/com.example.raid I/jsonobj123: 2


问:
Microsoft's StreamInsight - Experiences & SQL Server 2008 R2
Microsoft's Complex Event Processing (CEP) offering StreamInsight was released in tandem with SQL Server 2008 R2.

I am wondering:

if StreamInsight is in any way tied
to the SQL Server 2008 R2 database and
if it can be run separately.

(From scanning over the documentation
   it looks like StreamInsight can be

   run separately but clarification would be desirable).

If you have experience using StreamInsight separate from SQL Server 2008 R2 how has the experience been?

Thanks!

答:
Responding to Tom's issues ...

Lacks query code reuse options

How so? First, you have Query Templates, which allow for query code reuse right out of the box. Second, you can create an architecture (as we have) that encapsulates related sets of queries in a provider model and then hook them up to various input and output adapters.

Adapters are constrained to pulling rather than pushing

Again, how so? The input adapters push data into the StreamInsight engine. Whether or not the data gets pushed into the input adapter depends on the source. We've created an OPC-DA input adapter that uses subscriptions and has data pushed from OPC. OSISoft's PI adapter works the same way.

No fail-over mechanism, no persistency guaranteed.

That is true.

Window logic is not as straightforward as other engines

That may be your opinion based on what you've used before and what you are familiar with. I've found StreamInsight's model to be relatively straightforward, flexible and powerful. I also find the query language (LINQ) much easier to use and very natural for a C# developer.

On another note, most of the other CEP engines out there are a very "heavy" install and can have a significant impact on an enterprise architecture - this from someone that's seen several installations of TIBCO do very unpleasant things to a network. StreamInsight is very lightweight and has a very small footprint compared to other engines.
Just my $.02 worth.

ContentLicense: CC BY-SA 2.5