问:
Android NDK OpenCV - No implementation found for native
can you help me handle my errors? I have read a lot of tips how to fix them but nothing helped me. I also know that there are similar question already asked but they didnt help me. So I give a chance to ask you:

I am trying to make Android application what takes Image from gallery and call native function written in c++ to make it grey.

In my main activity is:

```<code>static {
        if(!OpenCVLoader.initDebug())
        {
            Log.e("tom", "Tomasku opencv problem static");
        }
        else
        {
            Log.e("tom", "OPENCV NACITANE");
            System.loadLibrary("halgorithm");
        }
    }
</code>```

***In the same Activity I call another activity(EditorActivity):

```<code>Intent i = new Intent(this, EditorActivity.class);
                ...
                i.putExtra("path", selectedImagePath); //path to image from gallery
                startActivity(i);
</code>```

***In my EditorActivity:

```<code>...
public native int fce(long matAddrRgba, long matAddrGray);
...

fce(image.getNativeObjAddr(), image_gray.getNativeObjAddr());
// and here it crashes
</code>```

**In my halgorithm.cpp

```<code>#include <jni.h>
#include <string.h>
#include <stdio.h>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"

//using namespace std;
using namespace cv;

extern "C"
{

JNIEXPORT jint JNICALL Java_com_example_hematoma_MainActivity_fce(JNIEnv*, jobject, jlong addrRgba, jlong addrGray) {

    Mat& mRgb = *(Mat*)addrRgba;
    Mat& mGray = *(Mat*)addrGray;

    int conv;
    jint retVal;

    conv = toGray(mRgb, mGray);
    retVal = (jint)conv;

    return retVal;

}

}

int toGray(Mat img, Mat& gray)
{
    cvtColor(img, gray, CV_RGBA2GRAY); // Assuming RGBA input

    if (gray.rows == img.rows && gray.cols == img.cols)
    {
        return 1;
    }
    return 0;
}
</code>```

**In my Android.mk

```<code>include $(CLEAR_VARS)

OPENCV_INSTALL_MODULES:=on
OPENCV_CAMERA_MODULES:=on
include /home/nemesis/adt-bundle-linux-x86_64-20140702/OpenCV-2.4.10-android-sdk/sdk/native/jni/OpenCV.mk

LOCAL_MODULE := halgorithm
LOCAL_SRC_FILE := halgorithm.cpp

LOCAL_C_INCLUDES := /home/nemesis/adt-bundle-linux-x86_64-20140702/OpenCV-2.4.10-android-sdk/sdk/native/jni/include

include $(BUILD_SHARED_LIBRARY)
</code>```

***LogCat

```<code>04-30 13:16:28.320: W/dalvikvm(3863): No implementation found for native Lcom/example/hematoma/EditorActivity;.fce (JJ)I
04-30 13:16:28.320: D/AndroidRuntime(3863): Shutting down VM
04-30 13:16:28.320: W/dalvikvm(3863): threadid=1: thread exiting with uncaught exception (group=0x40185760)
04-30 13:16:28.320: E/AndroidRuntime(3863): FATAL EXCEPTION: main
04-30 13:16:28.320: E/AndroidRuntime(3863): java.lang.UnsatisfiedLinkError: fce
04-30 13:16:28.320: E/AndroidRuntime(3863):     at com.example.hematoma.EditorActivity.fce(Native Method)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at com.example.hematoma.EditorActivity$3.onClick(EditorActivity.java:166)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at android.view.View.performClick(View.java:3110)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at android.view.View$PerformClick.run(View.java:11934)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at android.os.Handler.handleCallback(Handler.java:587)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at android.os.Handler.dispatchMessage(Handler.java:92)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at android.os.Looper.loop(Looper.java:132)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at android.app.ActivityThread.main(ActivityThread.java:4123)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at java.lang.reflect.Method.invokeNative(Native Method)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at java.lang.reflect.Method.invoke(Method.java:491)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at dalvik.system.NativeStart.main(Native Method)
</code>```

Thanks in advance!

****************************EDITED***********************

After your suggestions I changed:

***In Android.mk:

```<code>JNIEXPORT jint JNICALL
Java_com_example_hematoma_**EditorActivity**_fce(JNIEnv*, jobject, jlong addrRgba, jlong addrGray) {...}
</code>```

***In EditorActivity:
I am calling System.loadLibrary("halgorithm") before native methode.

```<code>static {
        if(!OpenCVLoader.initDebug())
        {
            Log.e("tom", "Tomasku opencv problem static");
        }
        else
        {
            Log.e("tom", "OPENCV NACITANE");
            System.loadLibrary("halgorithm");
        }
    }
</code>```

But it didnt fixed my error. There is the same error :/

***LogCat

```<code>04-30 13:36:21.760: W/dalvikvm(4255): No implementation found for native Lcom/example/hematoma/EditorActivity;.fce (JJ)I
04-30 13:36:21.760: D/AndroidRuntime(4255): Shutting down VM
04-30 13:36:21.760: W/dalvikvm(4255): threadid=1: thread exiting with uncaught exception (group=0x40185760)
04-30 13:36:21.760: E/AndroidRuntime(4255): FATAL EXCEPTION: main
04-30 13:36:21.760: E/AndroidRuntime(4255): java.lang.UnsatisfiedLinkError: fce
04-30 13:36:21.760: E/AndroidRuntime(4255):     at com.example.hematoma.EditorActivity.fce(Native Method)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at com.example.hematoma.EditorActivity$3.onClick(EditorActivity.java:166)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at android.view.View.performClick(View.java:3110)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at android.view.View$PerformClick.run(View.java:11934)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at android.os.Handler.handleCallback(Handler.java:587)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at android.os.Handler.dispatchMessage(Handler.java:92)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at android.os.Looper.loop(Looper.java:132)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at android.app.ActivityThread.main(ActivityThread.java:4123)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at java.lang.reflect.Method.invokeNative(Native Method)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at java.lang.reflect.Method.invoke(Method.java:491)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at dalvik.system.NativeStart.main(Native Method)
</code>```

答:
Follow this article in case you still have

```<code>unsatisfied link
</code>```

error in Android studio over opencv4

a couple of renaming would resolve the issue.

Body:
can you help me handle my errors? I have read a lot of tips how to fix them but nothing helped me. I also know that there are similar question already asked but they didnt help me. So I give a chance to ask you:

I am trying to make Android application what takes Image from gallery and call native function written in c++ to make it grey.

In my main activity is:

static {
        if(!OpenCVLoader.initDebug())
        {
            Log.e("tom", "Tomasku opencv problem static");
        }
        else
        {
            Log.e("tom", "OPENCV NACITANE");
            System.loadLibrary("halgorithm");
        }
    }

***In the same Activity I call another activity(EditorActivity):

Intent i = new Intent(this, EditorActivity.class);
                ...
                i.putExtra("path", selectedImagePath); //path to image from gallery
                startActivity(i);

***In my EditorActivity:

...
public native int fce(long matAddrRgba, long matAddrGray);
...

fce(image.getNativeObjAddr(), image_gray.getNativeObjAddr());
// and here it crashes

**In my halgorithm.cpp

#include <jni.h>
#include <string.h>
#include <stdio.h>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"

//using namespace std;
using namespace cv;

extern "C"
{

JNIEXPORT jint JNICALL Java_com_example_hematoma_MainActivity_fce(JNIEnv*, jobject, jlong addrRgba, jlong addrGray) {

    Mat& mRgb = *(Mat*)addrRgba;
    Mat& mGray = *(Mat*)addrGray;

    int conv;
    jint retVal;

    conv = toGray(mRgb, mGray);
    retVal = (jint)conv;

    return retVal;

}

}

int toGray(Mat img, Mat& gray)
{
    cvtColor(img, gray, CV_RGBA2GRAY); // Assuming RGBA input

    if (gray.rows == img.rows && gray.cols == img.cols)
    {
        return 1;
    }
    return 0;
}

**In my Android.mk

include $(CLEAR_VARS)

OPENCV_INSTALL_MODULES:=on
OPENCV_CAMERA_MODULES:=on
include /home/nemesis/adt-bundle-linux-x86_64-20140702/OpenCV-2.4.10-android-sdk/sdk/native/jni/OpenCV.mk

LOCAL_MODULE := halgorithm
LOCAL_SRC_FILE := halgorithm.cpp

LOCAL_C_INCLUDES := /home/nemesis/adt-bundle-linux-x86_64-20140702/OpenCV-2.4.10-android-sdk/sdk/native/jni/include

include $(BUILD_SHARED_LIBRARY)

***LogCat

04-30 13:16:28.320: W/dalvikvm(3863): No implementation found for native Lcom/example/hematoma/EditorActivity;.fce (JJ)I
04-30 13:16:28.320: D/AndroidRuntime(3863): Shutting down VM
04-30 13:16:28.320: W/dalvikvm(3863): threadid=1: thread exiting with uncaught exception (group=0x40185760)
04-30 13:16:28.320: E/AndroidRuntime(3863): FATAL EXCEPTION: main
04-30 13:16:28.320: E/AndroidRuntime(3863): java.lang.UnsatisfiedLinkError: fce
04-30 13:16:28.320: E/AndroidRuntime(3863):     at com.example.hematoma.EditorActivity.fce(Native Method)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at com.example.hematoma.EditorActivity$3.onClick(EditorActivity.java:166)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at android.view.View.performClick(View.java:3110)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at android.view.View$PerformClick.run(View.java:11934)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at android.os.Handler.handleCallback(Handler.java:587)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at android.os.Handler.dispatchMessage(Handler.java:92)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at android.os.Looper.loop(Looper.java:132)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at android.app.ActivityThread.main(ActivityThread.java:4123)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at java.lang.reflect.Method.invokeNative(Native Method)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at java.lang.reflect.Method.invoke(Method.java:491)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
04-30 13:16:28.320: E/AndroidRuntime(3863):     at dalvik.system.NativeStart.main(Native Method)

Thanks in advance!

****************************EDITED***********************

After your suggestions I changed:

***In Android.mk:

JNIEXPORT jint JNICALL
Java_com_example_hematoma_**EditorActivity**_fce(JNIEnv*, jobject, jlong addrRgba, jlong addrGray) {...}

***In EditorActivity:
I am calling System.loadLibrary("halgorithm") before native methode.

static {
        if(!OpenCVLoader.initDebug())
        {
            Log.e("tom", "Tomasku opencv problem static");
        }
        else
        {
            Log.e("tom", "OPENCV NACITANE");
            System.loadLibrary("halgorithm");
        }
    }

But it didnt fixed my error. There is the same error :/

***LogCat

04-30 13:36:21.760: W/dalvikvm(4255): No implementation found for native Lcom/example/hematoma/EditorActivity;.fce (JJ)I
04-30 13:36:21.760: D/AndroidRuntime(4255): Shutting down VM
04-30 13:36:21.760: W/dalvikvm(4255): threadid=1: thread exiting with uncaught exception (group=0x40185760)
04-30 13:36:21.760: E/AndroidRuntime(4255): FATAL EXCEPTION: main
04-30 13:36:21.760: E/AndroidRuntime(4255): java.lang.UnsatisfiedLinkError: fce
04-30 13:36:21.760: E/AndroidRuntime(4255):     at com.example.hematoma.EditorActivity.fce(Native Method)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at com.example.hematoma.EditorActivity$3.onClick(EditorActivity.java:166)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at android.view.View.performClick(View.java:3110)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at android.view.View$PerformClick.run(View.java:11934)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at android.os.Handler.handleCallback(Handler.java:587)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at android.os.Handler.dispatchMessage(Handler.java:92)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at android.os.Looper.loop(Looper.java:132)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at android.app.ActivityThread.main(ActivityThread.java:4123)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at java.lang.reflect.Method.invokeNative(Native Method)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at java.lang.reflect.Method.invoke(Method.java:491)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
04-30 13:36:21.760: E/AndroidRuntime(4255):     at dalvik.system.NativeStart.main(Native Method)

Body:
Follow this article in case you still have

unsatisfied link

error in Android studio over opencv4

a couple of renaming would resolve the issue.


来源: stackexchange

问:
Where to build database objects in Django(without using shell)?
I have created my database models in my model.py file, but I want to be able to populate them with data. I have the code written that reads in the data from a text file I have and create the objects for my models. But I am not sure where to actually run this code, all the tutorials I can find they only create the objects through the shell, but since I am reading in from a text file and since the code is quite long I dont want to use the shell. My solution was to create a file called buildDB in my application folder, and run the code there, but this will not work:

if I try to import my models at top of file using
from .models import * I get
ImportError: attempted relative import with no known parent package
when I run it.
If I try using from applicatonName.models import*
I get

```<code>django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
</code>```

When I google the second error message, it would appear that this happens becasue I am not using manage.py shell, and the first error message I dont even know. Do I have to use shell to populate data base? Where would I put my code if not?

答:
a) It looks like you should write a data migration: https://docs.djangoproject.com/en/3.0/topics/migrations/#data-migrations

b) Another option would be to write a "custom command": https://docs.djangoproject.com/en/3.0/howto/custom-management-commands/

c) And finally, you could write an external script that initializes django and creates all model objects from the file: simply a python script in the same folder as the django project (or in a scripts folder) that runs django.setup() at the beginning. This script can import and use the models and the ORM and create all database objects.

You have attempted (c) without success, because you were missing the django.setup() part.

If this is some data that should be populated initially in every instance of the application (for instance, testing, pre-production and production), then I would pick a)

If you will have to load similar files from time to time, and the file is different each time, maybe b) or c). The later two options are quite similar, and probably a custom command is something cleaner (although you need to read the docs about writing custom commands)

ContentLicense: CC BY-SA 4.0

Body:
I have created my database models in my model.py file, but I want to be able to populate them with data. I have the code written that reads in the data from a text file I have and create the objects for my models. But I am not sure where to actually run this code, all the tutorials I can find they only create the objects through the shell, but since I am reading in from a text file and since the code is quite long I dont want to use the shell. My solution was to create a file called buildDB in my application folder, and run the code there, but this will not work:

if I try to import my models at top of file using
from .models import * I get
ImportError: attempted relative import with no known parent package
when I run it.
If I try using from applicatonName.models import*
I get

django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

When I google the second error message, it would appear that this happens becasue I am not using manage.py shell, and the first error message I dont even know. Do I have to use shell to populate data base? Where would I put my code if not?


问:
Excel - Return value of adjacent cell (which has the highest value)
I'm trying to write a formula to give me the value of a cell which is directly adjacent to that of the highest value within a range. For reference (https://gyazo.com/67e28d9427021c52731f56f72700aaf2) I want to return the name directly above the highest value (between C8 and F8) into cell H8. I've tried both HLOOKUP and VLOOKUP, a combination of Index and Match, but all to no avail.

In most cases there is one number value greater than the rest, but since this has a tied result, I wanted to display both names if possible

Thanks for any advice!

答:
=INDEX(C7:F7,1,MATCH(MAX(C8:F8),C8:F8,0)) will give you what you need however where two or more people have the same value (which is the highest), it will only return the first name.

You could however add in a COUNTIF to check this (ie COUNTIF in the array the number of values which equal to the max value) and then add further formula to handle this to then return two or more names where multiple people have the highest value...


问:
I can't get members from a 16k member server, what am I doing wrong?
I'm trying to get certain user objects from a discord server using their IDs, but it can't get the guild object for some reason. My code:

```<code>@botclient.event
async def on_ready():
    for x in all_ids:
        guild = botclient.get_guild(GUILD)
        user=guild.get_member(x)
        all_urls[x]=user.avatar_url

botclient.run(TOKEN)
</code>```

[TOKEN and GUILD are specified further above, I've checked multiple times and there seems to be nothing wrong with them]

It's worked in a smaller server before and I've tried several variations of this, but each gave me an AttributeError:

```<code>    user=guild.get_member(x)
AttributeError: 'NoneType' object has no attribute 'get_member'
</code>```

(sometimes this would also happen when trying to get the avatar URLs)

I enabled logging and after the exception, it would output(I've removed the guild ID)

```<code>INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 107 members in guild ID -.
</code>```

..which led me to believe that it actually succeeded at getting the guild, but for some reason it did not work in the code

I couldn't find any documentation on this, if anyone could point out where to find it/point out any mistakes I made that'd be much appreciated!

答:
I've made it work by using await client.fetch_member() instead of guild.get_member()!

Still don't understand why guild.get_member() didn't work, though...

I might need it in the future and it'd be a pity if I still can't get it to work by then, but I guess this is sort of a solution for now.

Body:
I'm trying to get certain user objects from a discord server using their IDs, but it can't get the guild object for some reason. My code:

@botclient.event
async def on_ready():
    for x in all_ids:
        guild = botclient.get_guild(GUILD)
        user=guild.get_member(x)
        all_urls[x]=user.avatar_url

botclient.run(TOKEN)

[TOKEN and GUILD are specified further above, I've checked multiple times and there seems to be nothing wrong with them]

It's worked in a smaller server before and I've tried several variations of this, but each gave me an AttributeError:

    user=guild.get_member(x)
AttributeError: 'NoneType' object has no attribute 'get_member'

(sometimes this would also happen when trying to get the avatar URLs)

I enabled logging and after the exception, it would output(I've removed the guild ID)

INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 1000 members in guild ID -.
INFO:discord.state:Processed a chunk for 107 members in guild ID -.

..which led me to believe that it actually succeeded at getting the guild, but for some reason it did not work in the code

I couldn't find any documentation on this, if anyone could point out where to find it/point out any mistakes I made that'd be much appreciated!


问:
Datastructures where Add, Get kth largest are O(log n) and O(1)
Give a data structure that stores comparable objects and supports add() and get(k) operations [get(k) returns the kth smallest element in the data structure (1 <= k <= n)]. get(k) must be O(1) and add() must be O(log n) where n is the number of objects added to the data structure. Give another structure where get(k) is O(log n) and add is O(1)

答:
If I got this interview question I would respond by saying that I am unaware of any such data structures, and suspect that they don't exist.  However I suspect that the data structures that the interviewer is thinking of are "sorted array" and "skip list" respectively.

I would then explain that retrieving any element of an array by position is O(1).  Figuring out where to insert it is O(log(n)).  However the actual insertion is O(n) due to having to move the rest of the array.  However the O(n) piece comes with very good constants.

For the skip list, retrieving is O(log(n)).  Inserting involves half of the time only modifying one element, 1/4 of the time editing 2, 1/8 of the time editing 3 and so on, which is an average of 2 elements.  That's O(1).  However you cannot insert an element without figuring where to put it.  And that lookup is O(log(n)).  (To make the insert truly O(1) you either need to collect O(log(n)) data on the lookup that you make available to the insert, or you need to create the moral equivalent of a doubly linked skip list.)

ContentLicense: CC BY-SA 3.0

LastEditorDisplayName: Aryabhatta


问:
Can Gravity Forms be integrated with CiviCRM?
We have a site that has 5 different Gravity Forms currently.  They work great and we love them.   We're planning on setting up CiviCRM for this organization in WordPress and want to know if its possible to map all the data from our current forms directly into CiviCRM.   Is this possible?</p>

答:
Most of the community effort i think has gone in to Caldera Forms but there is a product for GF at https://shop.civivip.com/civi-plugins/gravity-forms-integration/ but I am sure you would have already found that from the simplest of google searches so am thinking you may be asking something that is less obvious.

Also in case you didn't spot it, i recommend you steer Civi question via http://civicrm.stackexchange.com as it gets many more civi eyeballs (though i appreciate this question is aimed at both audiences.)


问:
How many rows can the following SQL query return?
sql. There is a table T with an id field (optionally unique) that contains N rows. How many rows can the following SQL query return?

```<code>select * from T
inner join (
    select count(*) as cnt from T
    union all select count(*) as cnt from T
) as TA on TA.cnt = T.id
inner join (
    select count(*) as cnt from T
    union select count(*) as cnt from T
) as TB on TB.cnt = T.id;
</code>```

I have some options:

only N rows

from 0 to N rows

from 2N to 4N rows

or can you name some other options ?

答:
0 rows if T.Id does not contain the value 2.
2 rows id T.Id contains the value 2</p>

Body:
sql. There is a table T with an id field (optionally unique) that contains N rows. How many rows can the following SQL query return?

select * from T
inner join (
    select count(*) as cnt from T
    union all select count(*) as cnt from T
) as TA on TA.cnt = T.id
inner join (
    select count(*) as cnt from T
    union select count(*) as cnt from T
) as TB on TB.cnt = T.id;

I have some options:

only N rows

from 0 to N rows

from 2N to 4N rows

or can you name some other options ?


问:
Migrating Apache xmlrpc from 2.0.1 to 3.1.3 - How to deal with the removal of the SecureWebServer and related APIs?
I'm upgrading java xmlrpc from 2.0.1 (org: xmlrpc; module: xmlrpc) to 3.1.3 (org: org.apache.xmlrpc; modules: xmlrpc-client, xmlrpc-server, xmlrpc-commons) in preparation of a migration to JDK 11. Because this project has been split into separate modules for client and server and, I have to fix about three dozen compilation errors. Most of these aren't a big problem. However, I've run into a bit of a roadblock in that there are a number of classes related to secured XMLRPC connections that have been removed in version 3.0:

```<code>org.apache.xmlrpc.secure.SecureWebServer; // including setParanoid(boolean), acceptClient(String) and addHandler(string, Handler)
org.apache.xmlrpc.AuthenticatedXmlRpcHandler;
org.apache.xmlrpc.secure.SecureXmlRpcClient; // including setBasicAuthentication(username, password)
</code>```

We use these in the following ways:

We have a SecureWebServer class that extends from the Apache SecureWebServer, though I don't know if we need this anymore because it appears like the only reason we overrode this was for improved shutdown logic, which seems to be improved already in the 3.1.3 release.

We have a custom Handler class that extends from AuthenticatedXmlRpcHandler. This handler uses a custom ValueProvider for additional logic related to Timestamps and other types that weren't supported in 2.0.1. I don't know if we need this ValueProvider anymore either.

We have a client/server architecture and allow our users to optionally encrypt the communication between the server and the client. Because of this, we have a bunch of logic to configure a SecureXmlRpcClient if necessary.

I've tried to find a migration guide for migrating from 2.X to 3.X versions, and while the Apache site on XMLRPC does contain explanations to some extent, it's not quite the same as a migration guide. Best I can tell, you should now use a config class? It's somewhat confusing, and I'm wondering if it's still necessary to use separate secure and insecure classes.

The above might be more detail than is necessary for the question, which is: How do I handle the removal of separate servers and clients for secure xmlrpc calls in XMLRPC 3.0? Like, do I still need to create separate secure and insecure clients and servers in code, or can everything now use the default XMLRPC server and client with no differentiation between secure and insecure servers and clients?

答:
Like, do I still need to create separate secure and insecure clients
  and servers in code, or can everything now use the default XMLRPC
  server and client with no differentiation between secure and insecure
  servers and clients?

Yes you still need the separate implementations. In 3.x it is up to clients to provide secure set up.

There are couple of ways

On server side you will need to override createServerSocket to substitute for secure SSLServerSocket similar to what 2.x had.

On client side you have initialize with SSLServerSocketFactory on the XmlRpcCommonsTransportFactory to create ssl factory.
Basic Auth can be configured using XmlRpcHttpClientConfig.

Alternatively on server side you could use the full blown servlet container like tomcat or jetty which comes up its own ssl factory.

For client side you can use Httpcient to cover ssl.

You can find some details on how to configure the XmlRpcServlet and client

https://ws.apache.org/xmlrpc/server.html

https://ws.apache.org/xmlrpc/client.html

Body:
I'm upgrading java xmlrpc from 2.0.1 (org: xmlrpc; module: xmlrpc) to 3.1.3 (org: org.apache.xmlrpc; modules: xmlrpc-client, xmlrpc-server, xmlrpc-commons) in preparation of a migration to JDK 11. Because this project has been split into separate modules for client and server and, I have to fix about three dozen compilation errors. Most of these aren't a big problem. However, I've run into a bit of a roadblock in that there are a number of classes related to secured XMLRPC connections that have been removed in version 3.0:

org.apache.xmlrpc.secure.SecureWebServer; // including setParanoid(boolean), acceptClient(String) and addHandler(string, Handler)
org.apache.xmlrpc.AuthenticatedXmlRpcHandler;
org.apache.xmlrpc.secure.SecureXmlRpcClient; // including setBasicAuthentication(username, password)

We use these in the following ways:

We have a SecureWebServer class that extends from the Apache SecureWebServer, though I don't know if we need this anymore because it appears like the only reason we overrode this was for improved shutdown logic, which seems to be improved already in the 3.1.3 release.

We have a custom Handler class that extends from AuthenticatedXmlRpcHandler. This handler uses a custom ValueProvider for additional logic related to Timestamps and other types that weren't supported in 2.0.1. I don't know if we need this ValueProvider anymore either.

We have a client/server architecture and allow our users to optionally encrypt the communication between the server and the client. Because of this, we have a bunch of logic to configure a SecureXmlRpcClient if necessary.

I've tried to find a migration guide for migrating from 2.X to 3.X versions, and while the Apache site on XMLRPC does contain explanations to some extent, it's not quite the same as a migration guide. Best I can tell, you should now use a config class? It's somewhat confusing, and I'm wondering if it's still necessary to use separate secure and insecure classes.

The above might be more detail than is necessary for the question, which is: How do I handle the removal of separate servers and clients for secure xmlrpc calls in XMLRPC 3.0? Like, do I still need to create separate secure and insecure clients and servers in code, or can everything now use the default XMLRPC server and client with no differentiation between secure and insecure servers and clients?


问:
Install python package on Synology DiskStation
tldr: Cannot install python-docx and lxml on my Synology DiskStation via pip3 or python 3 -m pip install.

Long version:
I already had some problem installing pip3 and django, but I got it working. Now I wanted to create doc files within django. So, python-docx was recommended. However I cannot just say "pip3 install python-docx".

[Here I have erased the old output, because it was not valid anymore.]

I do not know what to do next. I also tried to install libxml2:

```<code>python3 -m pip install libxml2
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement libxml2 (from versions: none)
ERROR: No matching distribution found for libxml2
</code>```

I googled, but many sites just recommend how to install certain dev packages on debian, which is not helping me.

Can you please tell me how to proceed?

Edit
After reading for hours and trying different things, including an install of entware, I have now a slightly different output.

```<code>python3 -m pip install python-docx
Defaulting to user installation because normal site-packages is not writeable
Processing /volume1/homes/admin/.cache/pip/wheels/5c/b3/f7/0b2150abcd02387566859213e86c490e38070d0aad388c1105/python_docx-0.8.10-py3-none-any.whl
Collecting lxml>=2.3.2
  Using cached lxml-4.5.0.tar.gz (4.5 MB)
Building wheels for collected packages: lxml
  Building wheel for lxml (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-h4ugg_2s
       cwd: /tmp/pip-install-9_1bbtke/lxml/
  Complete output (91 lines):
  Building lxml version 4.5.0.
  Building without Cython.
  ERROR: b'/bin/sh: xslt-config: command not found\n'
  ** make sure the development packages of libxml2 and libxslt are installed **

  Using build configuration of libxslt
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-armv7l-3.5
  creating build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/doctestcompare.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/pyclasslookup.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/cssselect.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/usedoctest.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/__init__.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/ElementInclude.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/builder.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/_elementpath.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/sax.py -> build/lib.linux-armv7l-3.5/lxml
  creating build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/__init__.py -> build/lib.linux-armv7l-3.5/lxml/includes
  creating build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/defs.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/formfill.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/_diffcommand.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/_html5builder.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/soupparser.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/clean.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/_setmixin.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/usedoctest.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/__init__.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/builder.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/html5parser.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/ElementSoup.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/diff.py -> build/lib.linux-armv7l-3.5/lxml/html
  creating build/lib.linux-armv7l-3.5/lxml/isoschematron
  copying src/lxml/isoschematron/__init__.py -> build/lib.linux-armv7l-3.5/lxml/isoschematron
  copying src/lxml/etree.h -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/etree_api.h -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/lxml.etree.h -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/lxml.etree_api.h -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/includes/schematron.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/c14n.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/relaxng.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/xpath.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/tree.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/xslt.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/uri.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/__init__.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/config.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/xinclude.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/lxml-version.h -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/etree_defs.h -> build/lib.linux-armv7l-3.5/lxml/includes
  creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources
  creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/rng
  copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/rng
  creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
  copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
  copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
  creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  running build_ext
  building 'lxml.etree' extension
  creating build/temp.linux-armv7l-3.5
  creating build/temp.linux-armv7l-3.5/src
  creating build/temp.linux-armv7l-3.5/src/lxml
  /opt/bin/gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DSYNO_FIX_FLAG_BUG -DOPENSSL_NO_SSL3 -DOPENSSL_NO_SSL2 -mhard-float -mfpu=vfpv3-d16 -march=armv7-a -mcpu=marvell-pj4 -mtune=marvell-pj4 -DSYNOPLAT_F_ARMV7 -O2 -fno-diagnostics-show-caret -Wno-unused-local-typedefs -include /usr/syno/include/platformconfig.h -DSYNO_ENVIRONMENT -DBUILD_ARCH=32 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -g -DSDK_VER_MIN_REQUIRED=600 -pipe -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc/lxml/includes -I/volume1/@appstore/py3k/usr/local/include/python3.5m -c src/lxml/etree.c -o build/temp.linux-armv7l-3.5/src/lxml/etree.o -w
  gcc: error trying to exec 'as': execvp: No such file or directory
  cc1: fatal error: /usr/syno/include/platformconfig.h: No such file or directory
  compilation terminated.
  Compile failed: command '/opt/bin/gcc' failed with exit status 1
  creating tmp
  cc -I/usr/include/libxml2 -c /tmp/xmlXPathInit_wqm9l9k.c -o tmp/xmlXPathInit_wqm9l9k.o
  unable to execute 'cc': No such file or directory
  *********************************************************************************
  Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
  *********************************************************************************
  error: command '/opt/bin/gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for lxml
  Running setup.py clean for lxml
Failed to build lxml
Installing collected packages: lxml, python-docx
    Running setup.py install for lxml ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-_uhfue_j/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /var/services/homes/admin/.local/include/python3.5m/lxml
         cwd: /tmp/pip-install-9_1bbtke/lxml/
    Complete output (90 lines):
    Building lxml version 4.5.0.
    Building without Cython.
    ERROR: b'/bin/sh: xslt-config: command not found\n'
    ** make sure the development packages of libxml2 and libxslt are installed **

    Using build configuration of libxslt
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-3.5
    creating build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/doctestcompare.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/pyclasslookup.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/cssselect.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/usedoctest.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/__init__.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/ElementInclude.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/builder.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/_elementpath.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/sax.py -> build/lib.linux-armv7l-3.5/lxml
    creating build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/__init__.py -> build/lib.linux-armv7l-3.5/lxml/includes
    creating build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/defs.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/formfill.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/_diffcommand.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/_html5builder.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/soupparser.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/clean.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/_setmixin.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/usedoctest.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/__init__.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/builder.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/html5parser.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/ElementSoup.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/diff.py -> build/lib.linux-armv7l-3.5/lxml/html
    creating build/lib.linux-armv7l-3.5/lxml/isoschematron
    copying src/lxml/isoschematron/__init__.py -> build/lib.linux-armv7l-3.5/lxml/isoschematron
    copying src/lxml/etree.h -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/etree_api.h -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/lxml.etree.h -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/lxml.etree_api.h -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/includes/schematron.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/c14n.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/relaxng.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/xpath.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/tree.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/xslt.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/uri.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/__init__.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/config.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/xinclude.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/lxml-version.h -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/etree_defs.h -> build/lib.linux-armv7l-3.5/lxml/includes
    creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources
    creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/rng
    copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/rng
    creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
    copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
    copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
    creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    running build_ext
    building 'lxml.etree' extension
    creating build/temp.linux-armv7l-3.5
    creating build/temp.linux-armv7l-3.5/src
    creating build/temp.linux-armv7l-3.5/src/lxml
    /opt/bin/gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DSYNO_FIX_FLAG_BUG -DOPENSSL_NO_SSL3 -DOPENSSL_NO_SSL2 -mhard-float -mfpu=vfpv3-d16 -march=armv7-a -mcpu=marvell-pj4 -mtune=marvell-pj4 -DSYNOPLAT_F_ARMV7 -O2 -fno-diagnostics-show-caret -Wno-unused-local-typedefs -include /usr/syno/include/platformconfig.h -DSYNO_ENVIRONMENT -DBUILD_ARCH=32 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -g -DSDK_VER_MIN_REQUIRED=600 -pipe -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc/lxml/includes -I/volume1/@appstore/py3k/usr/local/include/python3.5m -c src/lxml/etree.c -o build/temp.linux-armv7l-3.5/src/lxml/etree.o -w
    gcc: error trying to exec 'as': execvp: No such file or directory
    cc1: fatal error: /usr/syno/include/platformconfig.h: No such file or directory
    compilation terminated.
    Compile failed: command '/opt/bin/gcc' failed with exit status 1
    cc -I/usr/include/libxml2 -c /tmp/xmlXPathInit31sc0ump.c -o tmp/xmlXPathInit31sc0ump.o
    unable to execute 'cc': No such file or directory
    *********************************************************************************
    Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
    *********************************************************************************
    error: command '/opt/bin/gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-_uhfue_j/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /var/services/homes/admin/.local/include/python3.5m/lxml Check the logs for full command output.
</code>```

If I see this correct, there is something wrong about something called "CC". But I still do not know what to do.

答:
I may have found a solution. But I still have to test it. In the meantime you do not have to answer.

Via opkg I could install some of the packages and I also got a new install of python3. Somewhat confusing for me. So now I have a 2.7 that I never wanted from Synology and a 3.5 from the Synology package center and obviously a newer one from opkg.

However, I could install some packages, but others not. For example, I tried to install reportlab as a way to produce PDFs if python-docx would not run. But I could not install reportlab either, because it seems to miss something like libjpeg-dev or so. And I could also not find this in the opkg repo. However, suddenly python-docx could be installed and I am working with that now.

I am sorry that I cannot provide a better description for others who might have the same problem, but at least I tried to make my steps comprehensible.

Best regards

Body:
tldr: Cannot install python-docx and lxml on my Synology DiskStation via pip3 or python 3 -m pip install.

Long version:
I already had some problem installing pip3 and django, but I got it working. Now I wanted to create doc files within django. So, python-docx was recommended. However I cannot just say "pip3 install python-docx".

[Here I have erased the old output, because it was not valid anymore.]

I do not know what to do next. I also tried to install libxml2:

python3 -m pip install libxml2
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement libxml2 (from versions: none)
ERROR: No matching distribution found for libxml2

I googled, but many sites just recommend how to install certain dev packages on debian, which is not helping me.

Can you please tell me how to proceed?

Edit
After reading for hours and trying different things, including an install of entware, I have now a slightly different output.

python3 -m pip install python-docx
Defaulting to user installation because normal site-packages is not writeable
Processing /volume1/homes/admin/.cache/pip/wheels/5c/b3/f7/0b2150abcd02387566859213e86c490e38070d0aad388c1105/python_docx-0.8.10-py3-none-any.whl
Collecting lxml>=2.3.2
  Using cached lxml-4.5.0.tar.gz (4.5 MB)
Building wheels for collected packages: lxml
  Building wheel for lxml (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-h4ugg_2s
       cwd: /tmp/pip-install-9_1bbtke/lxml/
  Complete output (91 lines):
  Building lxml version 4.5.0.
  Building without Cython.
  ERROR: b'/bin/sh: xslt-config: command not found\n'
  ** make sure the development packages of libxml2 and libxslt are installed **

  Using build configuration of libxslt
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-armv7l-3.5
  creating build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/doctestcompare.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/pyclasslookup.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/cssselect.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/usedoctest.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/__init__.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/ElementInclude.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/builder.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/_elementpath.py -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/sax.py -> build/lib.linux-armv7l-3.5/lxml
  creating build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/__init__.py -> build/lib.linux-armv7l-3.5/lxml/includes
  creating build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/defs.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/formfill.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/_diffcommand.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/_html5builder.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/soupparser.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/clean.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/_setmixin.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/usedoctest.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/__init__.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/builder.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/html5parser.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/ElementSoup.py -> build/lib.linux-armv7l-3.5/lxml/html
  copying src/lxml/html/diff.py -> build/lib.linux-armv7l-3.5/lxml/html
  creating build/lib.linux-armv7l-3.5/lxml/isoschematron
  copying src/lxml/isoschematron/__init__.py -> build/lib.linux-armv7l-3.5/lxml/isoschematron
  copying src/lxml/etree.h -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/etree_api.h -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/lxml.etree.h -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/lxml.etree_api.h -> build/lib.linux-armv7l-3.5/lxml
  copying src/lxml/includes/schematron.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/c14n.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/relaxng.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/xpath.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/tree.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/xslt.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/uri.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/__init__.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/config.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/xinclude.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/lxml-version.h -> build/lib.linux-armv7l-3.5/lxml/includes
  copying src/lxml/includes/etree_defs.h -> build/lib.linux-armv7l-3.5/lxml/includes
  creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources
  creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/rng
  copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/rng
  creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
  copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
  copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
  creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  running build_ext
  building 'lxml.etree' extension
  creating build/temp.linux-armv7l-3.5
  creating build/temp.linux-armv7l-3.5/src
  creating build/temp.linux-armv7l-3.5/src/lxml
  /opt/bin/gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DSYNO_FIX_FLAG_BUG -DOPENSSL_NO_SSL3 -DOPENSSL_NO_SSL2 -mhard-float -mfpu=vfpv3-d16 -march=armv7-a -mcpu=marvell-pj4 -mtune=marvell-pj4 -DSYNOPLAT_F_ARMV7 -O2 -fno-diagnostics-show-caret -Wno-unused-local-typedefs -include /usr/syno/include/platformconfig.h -DSYNO_ENVIRONMENT -DBUILD_ARCH=32 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -g -DSDK_VER_MIN_REQUIRED=600 -pipe -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc/lxml/includes -I/volume1/@appstore/py3k/usr/local/include/python3.5m -c src/lxml/etree.c -o build/temp.linux-armv7l-3.5/src/lxml/etree.o -w
  gcc: error trying to exec 'as': execvp: No such file or directory
  cc1: fatal error: /usr/syno/include/platformconfig.h: No such file or directory
  compilation terminated.
  Compile failed: command '/opt/bin/gcc' failed with exit status 1
  creating tmp
  cc -I/usr/include/libxml2 -c /tmp/xmlXPathInit_wqm9l9k.c -o tmp/xmlXPathInit_wqm9l9k.o
  unable to execute 'cc': No such file or directory
  *********************************************************************************
  Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
  *********************************************************************************
  error: command '/opt/bin/gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for lxml
  Running setup.py clean for lxml
Failed to build lxml
Installing collected packages: lxml, python-docx
    Running setup.py install for lxml ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-_uhfue_j/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /var/services/homes/admin/.local/include/python3.5m/lxml
         cwd: /tmp/pip-install-9_1bbtke/lxml/
    Complete output (90 lines):
    Building lxml version 4.5.0.
    Building without Cython.
    ERROR: b'/bin/sh: xslt-config: command not found\n'
    ** make sure the development packages of libxml2 and libxslt are installed **

    Using build configuration of libxslt
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-3.5
    creating build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/doctestcompare.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/pyclasslookup.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/cssselect.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/usedoctest.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/__init__.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/ElementInclude.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/builder.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/_elementpath.py -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/sax.py -> build/lib.linux-armv7l-3.5/lxml
    creating build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/__init__.py -> build/lib.linux-armv7l-3.5/lxml/includes
    creating build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/defs.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/formfill.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/_diffcommand.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/_html5builder.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/soupparser.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/clean.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/_setmixin.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/usedoctest.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/__init__.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/builder.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/html5parser.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/ElementSoup.py -> build/lib.linux-armv7l-3.5/lxml/html
    copying src/lxml/html/diff.py -> build/lib.linux-armv7l-3.5/lxml/html
    creating build/lib.linux-armv7l-3.5/lxml/isoschematron
    copying src/lxml/isoschematron/__init__.py -> build/lib.linux-armv7l-3.5/lxml/isoschematron
    copying src/lxml/etree.h -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/etree_api.h -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/lxml.etree.h -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/lxml.etree_api.h -> build/lib.linux-armv7l-3.5/lxml
    copying src/lxml/includes/schematron.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/c14n.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/relaxng.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/xpath.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/tree.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/xslt.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/uri.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/__init__.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/config.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/xinclude.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/lxml-version.h -> build/lib.linux-armv7l-3.5/lxml/includes
    copying src/lxml/includes/etree_defs.h -> build/lib.linux-armv7l-3.5/lxml/includes
    creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources
    creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/rng
    copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/rng
    creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
    copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
    copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
    creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    running build_ext
    building 'lxml.etree' extension
    creating build/temp.linux-armv7l-3.5
    creating build/temp.linux-armv7l-3.5/src
    creating build/temp.linux-armv7l-3.5/src/lxml
    /opt/bin/gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DSYNO_FIX_FLAG_BUG -DOPENSSL_NO_SSL3 -DOPENSSL_NO_SSL2 -mhard-float -mfpu=vfpv3-d16 -march=armv7-a -mcpu=marvell-pj4 -mtune=marvell-pj4 -DSYNOPLAT_F_ARMV7 -O2 -fno-diagnostics-show-caret -Wno-unused-local-typedefs -include /usr/syno/include/platformconfig.h -DSYNO_ENVIRONMENT -DBUILD_ARCH=32 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -g -DSDK_VER_MIN_REQUIRED=600 -pipe -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc/lxml/includes -I/volume1/@appstore/py3k/usr/local/include/python3.5m -c src/lxml/etree.c -o build/temp.linux-armv7l-3.5/src/lxml/etree.o -w
    gcc: error trying to exec 'as': execvp: No such file or directory
    cc1: fatal error: /usr/syno/include/platformconfig.h: No such file or directory
    compilation terminated.
    Compile failed: command '/opt/bin/gcc' failed with exit status 1
    cc -I/usr/include/libxml2 -c /tmp/xmlXPathInit31sc0ump.c -o tmp/xmlXPathInit31sc0ump.o
    unable to execute 'cc': No such file or directory
    *********************************************************************************
    Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
    *********************************************************************************
    error: command '/opt/bin/gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-_uhfue_j/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /var/services/homes/admin/.local/include/python3.5m/lxml Check the logs for full command output.

If I see this correct, there is something wrong about something called "CC". But I still do not know what to do.


问:
Java: invalid selector: An invalid or illegal selector was specified
I'm trying to click an element on payment pop-up:

```<code><label data-v-533987c6="" xpath="1">Card Number:</label>
<input data-v-533987c6="" type="tel" data-mask="#### #### #### ####" data-previous-value="" xpath="1">
</code>```

with following xPath:

@FindBy(name = "//div[contains(@class,'buy-tickets')]//div/label[text()='Card Number:']/following-sibling::input")

but I receive this error:

```<code>org.openqa.selenium.InvalidSelectorException: invalid selector: An invalid or illegal selector was specified
  (Session info: chrome=80.0.3987.87)
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/invalid_selector_exception.html
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-VQ56FMV', ip: '192.168.0.13', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_231'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 80.0.3987.87, chrome: {chromedriverVersion: 80.0.3987.106 (f68069574609..., userDataDir: C:\Users\Nastya\AppData\Loc...}, goog:chromeOptions: {debuggerAddress: localhost:64958}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webdriver.remote.sessionid: 3ca3f388f2b3cf47642733a6f03...}
Session ID: 3ca3f388f2b3cf47642733a6f0383c1e
*** Element info: {Using=name, value=//div[contains(@class,'buy-tickets')]//div/label[text()='Card Number:']/following-sibling::input}
</code>```

Why? Hope, you can help me!

答:
According to the error message

```<code>Element info: {Using=name, value=//div[contains(@class,'buy-tickets')]//div/label[text()='Card Number:']/following-sibling::input}
</code>```

you are trying to use another xpath

```<code>//div[contains(@class,'buy-tickets')]//div/label[text()='Card Number:']/following-sibling::input`
</code>```

with By.name, which is invalid. You need to use By.xpath.

Body:
I'm trying to click an element on payment pop-up:

Card Number:
<input data-v-533987c6="" type="tel" data-mask="#### #### #### ####" data-previous-value="" xpath="1">

with following xPath:

@FindBy(name = "//div[contains(@class,'buy-tickets')]//div/label[text()='Card Number:']/following-sibling::input")

but I receive this error:

org.openqa.selenium.InvalidSelectorException: invalid selector: An invalid or illegal selector was specified
  (Session info: chrome=80.0.3987.87)
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/invalid_selector_exception.html
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-VQ56FMV', ip: '192.168.0.13', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_231'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 80.0.3987.87, chrome: {chromedriverVersion: 80.0.3987.106 (f68069574609..., userDataDir: C:\Users\Nastya\AppData\Loc...}, goog:chromeOptions: {debuggerAddress: localhost:64958}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webdriver.remote.sessionid: 3ca3f388f2b3cf47642733a6f03...}
Session ID: 3ca3f388f2b3cf47642733a6f0383c1e
*** Element info: {Using=name, value=//div[contains(@class,'buy-tickets')]//div/label[text()='Card Number:']/following-sibling::input}

Why? Hope, you can help me!

Body:
According to the error message

Element info: {Using=name, value=//div[contains(@class,'buy-tickets')]//div/label[text()='Card Number:']/following-sibling::input}

you are trying to use another xpath

//div[contains(@class,'buy-tickets')]//div/label[text()='Card Number:']/following-sibling::input`

with By.name, which is invalid. You need to use By.xpath.


问:
Getting an error on entering special characters using Entity Framwork
I am entering special character into SQL Server using Entity Framework and am getting an error on the server.

Single database two servers, the first one is Localhost and the second one is hosting server.

On localhost this code is working properly.

Error:

System.Data.Entity.Validation.DbEntityValidationException:' Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.

      at System.Data.Entity.Internal.InternalContext.SaveChanges()

      at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()

      at System.Data.Entity.DbContext.SaveChanges()

      at Admin_AddNews.Button1_Click(Object sender, EventArgs e) in c:\inetpub\vhosts\newstimenation.in\newstimenation.com\Admin\AddNews.aspx.cs:line 148

答:
You can handle this exception for exception details.
You can find the reason in the error detail.

try
{
    //_unitOfWorkAsync.SaveChangesAsync();
}
catch (DbEntityValidationException ex)
{
    var sb = new StringBuilder();
    foreach (var failure in ex.EntityValidationErrors)
    {
        sb.AppendFormat("{0} failed validation\n", failure.Entry.Entity.GetType());
        foreach (var error in failure.ValidationErrors)
        {
            sb.AppendFormat("- {0} : {1}", error.PropertyName, error.ErrorMessage);
            sb.AppendLine();
        }
    }
    Debug.WriteLine(sb.ToString());
}
catch (Exception ex)
{
    Debug.WriteLine(ex.Message);
}
```


问:
How to use findAll() on CrudRepository returning a List instead of Iterable
I want to write a FindAll() method which returns a List of all Student objects. But the CRUDRepository only has Iterable<> findAll().

The goal is to get all students in a List and pass it to the API Controller so I can get all the students with a http GET.

What would be the best way to convert this method to List<> FindAll()

In my current code the findAll method in the StudentService gives me the Incompatible types found: Iterable. Required: List error.

Service

```<code>@Service
@RequiredArgsConstructor
public class StudentServiceImpl implements StudentService {

    @Autowired
    private final StudentRepository studentRepository;

    //Incompatible types found: Iterable. Required: List
    public List<Student> findAll() {
        return studentRepository.findAll();
    }
}
</code>```

API Controller

```<code>@RestController
@RequestMapping("/api/v1/students")

public class StudentAPIController {

    private final StudentRepository studentRepository;

    public StudentAPIController(StudentRepository studentRepository) {
        this.studentRepository = studentRepository;
    }

    @GetMapping
    public ResponseEntity<List<Student>> findAll() {
        return ResponseEntity.ok(StudentServiceImpl.findAll());
    }
}
</code>```

StudentRepository

```<code>public interface StudentRepository extends CrudRepository<Student, Long> {

}
</code>```

答:
For CrudRepository you will need to use lambda expression in order to return a list</p>

```<code>public List<Student> findAll() {
    List<Student> students = new ArrayList<>();
    studentRepository.findAll().forEach(students::add);
    return students;
}
</code>```

Body:
I want to write a FindAll() method which returns a List of all Student objects. But the CRUDRepository only has Iterable<> findAll().

The goal is to get all students in a List and pass it to the API Controller so I can get all the students with a http GET.

What would be the best way to convert this method to List<> FindAll()

In my current code the findAll method in the StudentService gives me the Incompatible types found: Iterable. Required: List error.

Service

@Service
@RequiredArgsConstructor
public class StudentServiceImpl implements StudentService {

    @Autowired
    private final StudentRepository studentRepository;

    //Incompatible types found: Iterable. Required: List
    public List<Student> findAll() {
        return studentRepository.findAll();
    }
}

API Controller

@RestController
@RequestMapping("/api/v1/students")

public class StudentAPIController {

    private final StudentRepository studentRepository;

    public StudentAPIController(StudentRepository studentRepository) {
        this.studentRepository = studentRepository;
    }

    @GetMapping
    public ResponseEntity<List<Student>> findAll() {
        return ResponseEntity.ok(StudentServiceImpl.findAll());
    }
}

StudentRepository

public interface StudentRepository extends CrudRepository<Student, Long> {

}

Body:
For CrudRepository you will need to use lambda expression in order to return a list

public List<Student> findAll() {
    List<Student> students = new ArrayList<>();
    studentRepository.findAll().forEach(students::add);
    return students;
}


问:
Data structure padding
What is data structure padding in c++ and how do i check the number of bytes padded bytes?</p>

```<code>class a { public: int x; int y; int z; };
</code>```

答:
Processors require that certain types of data have particular alignments.  For example, a processor might require that an int be on a 4-byte boundary.  So, for example, an int could start at memory location 0x4000 but it could not start at 0x4001.  So if you defined a class:

```<code>class a
{
public:
    char c;
    int i;
};
</code>```

the compiler would have to insert padding between c and i so that i could start on a 4-byte boundary.

Title: Data structure padding

Body:
What is data structure padding in c++ and how do i check the number of bytes padded bytes?

class a { public: int x; int y; int z; };

Body:
Processors require that certain types of data have particular alignments.  For example, a processor might require that an int be on a 4-byte boundary.  So, for example, an int could start at memory location 0x4000 but it could not start at 0x4001.  So if you defined a class:

class a
{
public:
    char c;
    int i;
};

the compiler would have to insert padding between c and i so that i could start on a 4-byte boundary.


问:
Regular Expressions How to append matches from raw string text into a list
Hello I have some messy text I am unable to process in any good way and I want to match all zip codes 5 digit numbers from the raw string then append them to a list.  My string looks something like this: </p>

```<code>string = '''
         January 2020
          Zip Code
           Current Month
        Sales Breakdown
      (by type)
              Last Month                Last Year     Year-to-Date
         95608
         Carmichael
         95610
        Citrus Heights
        95621
        Citrus Heights
         95624
         Elk Grove
         95626
         Elverta
         95628
         Fair Oaks
          95630
           Folsom
          95632
         Galt
        95638
        Herald
        95641
         Isleton
         95655
        Mather
       95660
        North Highlands
        95662
        Orangevale
            Total Sales
         43               REO Sales 0                                                      45
        40                             43
           Median Sales Price                                                             $417,000
                  $0                                      $410,000                 $400,000
        $417,000
        '''
</code>```

答:
It can be done with re.findall and the regular expression \b\d{5}\b or even just \d{5}. Let's see an example:

```<code>import re

string = '''
         January 2020
          Zip Code
           Current Month
        Sales Breakdown
      (by type)
              Last Month                Last Year     Year-to-Date
         95608
         Carmichael
         95610
        Citrus Heights
        95621
        Citrus Heights
         95624
         Elk Grove
         95626
         Elverta
         95628
         Fair Oaks
          95630
           Folsom
          95632
         Galt
        95638
        Herald
        95641
         Isleton
         95655
        Mather
       95660
        North Highlands
        95662
        Orangevale
            Total Sales
         43               REO Sales 0                                                      45
        40                             43
           Median Sales Price                                                             $417,000
                  $0                                      $410,000                 $400,000
        $417,000
        '''

regex = r'\b\d{5}\b'

zip_codes = re.findall(regex, string)
</code>```

Then you can get each code from zip_codes. I recommend you to read re documentation and Regular Expression HOWTO. There are interesting tools to write and test regex, as Regex101.

I also recommend you that for the next time you ask, please investigate a bit by yourself and then try to do what you want, and then, if you have an issue, ask for this specific issue. The help page How I ask a good question? and How to create a Minimum, Reproducible example might help you to write a good question.

Body:
Hello I have some messy text I am unable to process in any good way and I want to match all zip codes 5 digit numbers from the raw string then append them to a list.  My string looks something like this:

string = '''
         January 2020
          Zip Code
           Current Month
        Sales Breakdown
      (by type)
              Last Month                Last Year     Year-to-Date
         95608
         Carmichael
         95610
        Citrus Heights
        95621
        Citrus Heights
         95624
         Elk Grove
         95626
         Elverta
         95628
         Fair Oaks
          95630
           Folsom
          95632
         Galt
        95638
        Herald
        95641
         Isleton
         95655
        Mather
       95660
        North Highlands
        95662
        Orangevale
            Total Sales
         43               REO Sales 0                                                      45
        40                             43
           Median Sales Price                                                             $417,000
                  $0                                      $410,000                 $400,000
        $417,000
        '''

Body:
It can be done with re.findall and the regular expression \b\d{5}\b or even just \d{5}. Let's see an example:

import re

string = '''
         January 2020
          Zip Code
           Current Month
        Sales Breakdown
      (by type)
              Last Month                Last Year     Year-to-Date
         95608
         Carmichael
         95610
        Citrus Heights
        95621
        Citrus Heights
         95624
         Elk Grove
         95626
         Elverta
         95628
         Fair Oaks
          95630
           Folsom
          95632
         Galt
        95638
        Herald
        95641
         Isleton
         95655
        Mather
       95660
        North Highlands
        95662
        Orangevale
            Total Sales
         43               REO Sales 0                                                      45
        40                             43
           Median Sales Price                                                             $417,000
                  $0                                      $410,000                 $400,000
        $417,000
        '''

regex = r'\b\d{5}\b'

zip_codes = re.findall(regex, string)

Then you can get each code from zip_codes. I recommend you to read re documentation and Regular Expression HOWTO. There are interesting tools to write and test regex, as Regex101.

I also recommend you that for the next time you ask, please investigate a bit by yourself and then try to do what you want, and then, if you have an issue, ask for this specific issue. The help page How I ask a good question? and How to create a Minimum, Reproducible example might help you to write a good question.


问:
How do I solve ApiPlatform authentication error?
I have an APIPlatform setup, the docker setup. I created several entities, and followed the docs for JWT authentication. I ran the fixture for my first user, and no error. When I try to login, I get the following error.

```<code>Authentication request could not be processed due to a system problem.
</code>```

In my logs I see the following.

```<code>db_1       | 2020-02-16 20:19:05.700 UTC [11594] ERROR:  column t0.id does not exist at character 8
</code>```

I can see the table with \d+ user and but I can't use it

答:
This may not be the right solution, but I changed table name in entity</p>

```<code>* @ORM\Table(name="users")
</code>```

Body:
I have an APIPlatform setup, the docker setup. I created several entities, and followed the docs for JWT authentication. I ran the fixture for my first user, and no error. When I try to login, I get the following error.

Authentication request could not be processed due to a system problem.

In my logs I see the following.

db_1       | 2020-02-16 20:19:05.700 UTC [11594] ERROR:  column t0.id does not exist at character 8

I can see the table with \d+ user and but I can't use it

Body:
This may not be the right solution, but I changed table name in entity

* @ORM\Table(name="users")


问:
How to join multiple rows sequentially in a numpy array?
I've a data like this,

```<code>data = [array(['a', 'b', 'c']),
        array([['d', 'e', 'f'], ['g', 'h', 'i']]),
        array([['j', 'k', 'l'], ['m', 'n', 'o'], ['p', 'q', 'r']])]
</code>```

I want to join values in inner list sequentially. This is the desired output that I need.

```<code>[['a', 'b', 'c'], ['d g', 'e h', 'f i'], ['j m p', 'k n q', 'l o r']]
</code>```

I tried using using multiple loops and join but it's not giving me required output.

```<code>for i in data:
    for j in i:
        print(" ".join(j))
</code>```

I'm not really sure on how to achieve this? Need an efficient and faster approach because my original data is really large.

答:
```<code>In [300]: [np.array([' '.join(ij) for ij in zip(*np.atleast_2d(row))]) for row in data]
Out[300]:
[array(['a', 'b', 'c'], dtype='<U1'),
 array(['d g', 'e h', 'f i'], dtype='<U3'),
 array(['j m p', 'k n q', 'l o r'], dtype='<U5')]
</code>```

The first array is 1d, thus requiring the atleast_2d for consistency.  Most the rest is just iterative application of string join.

Body:
I've a data like this,

data = [array(['a', 'b', 'c']),
        array([['d', 'e', 'f'], ['g', 'h', 'i']]),
        array([['j', 'k', 'l'], ['m', 'n', 'o'], ['p', 'q', 'r']])]

I want to join values in inner list sequentially. This is the desired output that I need.

[['a', 'b', 'c'], ['d g', 'e h', 'f i'], ['j m p', 'k n q', 'l o r']]

I tried using using multiple loops and join but it's not giving me required output.

for i in data:
    for j in i:
        print(" ".join(j))

I'm not really sure on how to achieve this? Need an efficient and faster approach because my original data is really large.

Body:
In [300]: [np.array([' '.join(ij) for ij in zip(*np.atleast_2d(row))]) for row in data]
Out[300]:
[array(['a', 'b', 'c'], dtype='<U1'),
 array(['d g', 'e h', 'f i'], dtype='<U3'),
 array(['j m p', 'k n q', 'l o r'], dtype='<U5')]

The first array is 1d, thus requiring the atleast_2d for consistency.  Most the rest is just iterative application of string join.


问:
Python Pony ORM Insert multiple values at once
I'm trying to insert multiple values into my postgres database using Pony ORM. My current approach is very inefficient:

```<code>from pony.orm import *

db = Database()

class Names(db.Entity):
    first_name = Optional(str)
    last_name = Optional(str)

family = [["Peter", "Mueller"], ["Paul", "Meyer"], ...]

@db_session
def populate_names(name_list)
    for name in name_list:
        db.insert("Names", first_name=name[0], last_name=name[1])

if __name__ == "__main__":
    db.bind(provider='postgres', user='', password='', host='', database='')
    db.generate_mappings(create_tables=True)
    populate_names(family)
</code>```

This is just a short example but the structure of the input is the same:
a list of lists.
I'm extracting the data from several xml files and insert one "file" at a time.

Does anyone has an idea on how to put several rows of data into one insert query in Pony ORM?

答:
Currently I'm experimenting with PonyORM for a future project and also came to the conclusion you provided.

The only way on how to insert data in a bulky way is:

# assuming data has this structure:
# [['foo','bar','bazooka'],...]
@db_session
def insert_bulk_array(field1, field2, field3):
    MyClass(field1=field1, field2=field2, field3=field3)

# assuming the data is:
# {'field1':'foo','field2':'bar','field3':'bazooka'}
@db_session
def insert_bulk_dict(data)
    MyClass(**data)
```

But from my point of view this is still somehow handy, specially when your data comes as JSON.

Body:
I'm trying to insert multiple values into my postgres database using Pony ORM. My current approach is very inefficient:

from pony.orm import *

db = Database()

class Names(db.Entity):
    first_name = Optional(str)
    last_name = Optional(str)

family = [["Peter", "Mueller"], ["Paul", "Meyer"], ...]

@db_session
def populate_names(name_list)
    for name in name_list:
        db.insert("Names", first_name=name[0], last_name=name[1])

if __name__ == "__main__":
    db.bind(provider='postgres', user='', password='', host='', database='')
    db.generate_mappings(create_tables=True)
    populate_names(family)

This is just a short example but the structure of the input is the same:
a list of lists.
I'm extracting the data from several xml files and insert one "file" at a time.

Does anyone has an idea on how to put several rows of data into one insert query in Pony ORM?

Body:
Currently I'm experimenting with PonyORM for a future project and also came to the conclusion you provided.

The only way on how to insert data in a bulky way is:

# assuming data has this structure:
# [['foo','bar','bazooka'],...]
@db_session
def insert_bulk_array(field1, field2, field3):
    MyClass(field1=field1, field2=field2, field3=field3)

# assuming the data is:
# {'field1':'foo','field2':'bar','field3':'bazooka'}
@db_session
def insert_bulk_dict(data)
    MyClass(**data)

But from my point of view this is still somehow handy, specially when your data comes as JSON.


问:
Pass string in jquery to asp.net mvc ActionResult
I have the following jquery code.

```<code><script src="Scripts/jquery-1.10.2.min.js"></script>
<script>
    function FillOption() {
        $.ajax({
            type: "Post",
            url: "/contratoBuscar/GetItem/",
            dataType: 'json',
            success: function (data) {
                for (var i = 0; i < data.length; i++) {
                    $('#mydrop').append('<option value=' + data[i].Value + '>' + data[i].Text + '</option > ');
                }
            }
        });
    }
</script>
</code>```

I would like to pass a string to my GetItem fonction from the follwing cshtml field

```<code>@Html.TextBox("selected_cliente_contrato", Model.selected_cliente_contrato, new { @id = "clienteContratoAutocomplete", @type = "text", @placeholder = "clientes", @class = "form-control" })
</code>```

Here is the code for my controller
   [HttpPost]
        public ActionResult GetItem(string clienteName)
        {

```<code>        contratoBuscarModel contrato = new contratoBuscarModel();
        contrato.selected_cliente_contrato = clienteName;
        contratoBuscarContext contratoBuscar = new contratoBuscarContext();

        clienteContratosContext clienteContratosContext = new clienteContratosContext();

        List<SelectListItem> drop = new List<SelectListItem>();

        foreach (contratoModel contract in contratoBuscar.GetAllContratosFiltrar(contrato).contratosFound)
        {
            drop.Add(new SelectListItem
            {
                Text = contract.numero_contrato,
                Value = contract.numero_contrato
            });
        }

        return Json(drop);
    }
</code>```

My question is how can I get the clienteName from  my htmlTextBox pass it in the jquery so I can use it in my actionResult. I have tried many times and my clienteName keeps being null. Thank you for your help.

答:
On your url line, change it to the following:

url: "/contratoBuscar/GetItem?clienteName=" + $("#clienteContratoAutocomplete").val()

primitive types for some reason do not work if passed in in data field so you have to pass them in in the url. Assuming default routes, since string clienteName is not id, you have to pass it like a get parameter ?varname=value.

Body:
I have the following jquery code.

I would like to pass a string to my GetItem fonction from the follwing cshtml field

@Html.TextBox("selected_cliente_contrato", Model.selected_cliente_contrato, new { @id = "clienteContratoAutocomplete", @type = "text", @placeholder = "clientes", @class = "form-control" })

Here is the code for my controller
   [HttpPost]
        public ActionResult GetItem(string clienteName)
        {

        contratoBuscarModel contrato = new contratoBuscarModel();
        contrato.selected_cliente_contrato = clienteName;
        contratoBuscarContext contratoBuscar = new contratoBuscarContext();

        clienteContratosContext clienteContratosContext = new clienteContratosContext();

        List<SelectListItem> drop = new List<SelectListItem>();

        foreach (contratoModel contract in contratoBuscar.GetAllContratosFiltrar(contrato).contratosFound)
        {
            drop.Add(new SelectListItem
            {
                Text = contract.numero_contrato,
                Value = contract.numero_contrato
            });
        }

        return Json(drop);
    }

My question is how can I get the clienteName from  my htmlTextBox pass it in the jquery so I can use it in my actionResult. I have tried many times and my clienteName keeps being null. Thank you for your help.


问:
How do I join an NSSet's elements to create an NSString?
If I have an NSSet of NSString objects, how can I join them together to create a single NSString?

答:
NSSet's -allObjects method will return an NSArray of objects in the receiver.

So, knowing this, it's pretty simple:

```<code>[[set allObjects] componentsJoinedByString:@" "];
</code>```

Body:
NSSet's -allObjects method will return an NSArray of objects in the receiver.

So, knowing this, it's pretty simple:

[[set allObjects] componentsJoinedByString:@" "];


问:
Performance tests for Lightweight Encryption
I am currently doing my final project, and I need to conduct some performance tests on at least 3 lightweight encryption algorithms (symmetric block ciphers).  Ideally encrypt/decrypt of a text file and measure/compare at least 3 metrics such as execution time, memory, code size, throughput. I'm struggling to work out how to achieve this so if anyone has any pointers I would be extremely grateful. I've no experience with code although I'm trying to work this out (looking at C#, Java Cryptographic Extension, FELICS).
Thanks.</p>

答: Consider constructing speed and memory tests of one-time pad, as an example of perfect secrecy or a substitution cipher perhaps, DES as an outdated form of symmetric encryption, and it’s modern replacement AES. Pick a language, and duckduckgo for library implementations of the latter two.</p>