小编sak*_*sak的帖子

在Windows 10上使用Python 3.7时出现“ ModuleNotFoundError:没有名为'pysqlcipher3'的模块”错误

我正在尝试使用python 3.7解密一个数据库文件。所以要解密它,我必须对python 3.7使用pysqlcipher3版本。要安装它,我尝试使用两个命令:

pip3 install pysqlcipher3
Run Code Online (Sandbox Code Playgroud)

pip install pysqlcipher3
Run Code Online (Sandbox Code Playgroud)

并且两个命令都显示成功安装了pysqlcipher软件包。但是现在的问题是,当我尝试使用此行在python项目中导入pysqlcipher3时:

from pysqlcipher3 import dbapi2 as sqlite
Run Code Online (Sandbox Code Playgroud)

它向我显示此错误:

ModuleNotFoundError: No module named 'pysqlcipher3
Run Code Online (Sandbox Code Playgroud)

我检查了各种github项目,但没有一个提供明确的工作解决方案。python软件包网站说要在您的操作系统中安装libsqlcipher,但是这次问题是相同的,没有关于Windows 10的libsqlcipher安装的文档和链接。因此,请任何人可以向我提供正确的安装步骤或任何文档或任何视频关于同一教程或import语句有问题吗?

python python-3.x pysqlcipher

8
推荐指数
1
解决办法
637
查看次数

何时使用 executePendingBindings() 以及何时不需要?

我正在为这两种情况寻找一个实际的例子,什么时候使用什么?我见过类似的线程,但它们只告诉“何时必须立即执行绑定”,但对于必须强制执行绑定的任何情况,都没有实时示例。所以请如果有人能用任何例子来解释什么时候使用它,什么时候不需要!

android mvvm android-databinding android-mvvm

6
推荐指数
1
解决办法
593
查看次数

使用 sortedBy(...) 排序在 kotlin 中不起作用

我正在尝试对此进行排序:listOf("P5","P1","P2","P3","P10")通过使用 val list = categoryList.sortedBy { it }但返回的是这个:[P1, P10, P2, P3, P5],根据我的要求它应该返回[P1, P2, P3, P5, P10]所以我在这里做错了什么?

sorting android kotlin

6
推荐指数
3
解决办法
1321
查看次数

无法使用Picasso Library下载图像并将其保存在本地存储中

我正在尝试使用Picasso库下载图像,然后将图像保存到本地存储中。错误:来自方法的日志“ inside getImage”之后,getImage()logcat正在显示来自的日志onBitmapFailed(Drawable errorDrawable)。我只能找到将目标参考转换为强参考的示例。但是,这不能解决问题。

下面是我编写的用于下载和保存图像的代码片段:

import android.content.Context;
import android.content.ContextWrapper;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Environment;
import android.util.Log;

import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;

import java.io.File;
import java.io.FileOutputStream;


public class DownloadImage {

    Context mContext;
    Target target;

    public void getImage(Context context) {
        mContext = context;
        String path = "/data/data/ops.com.imagefetcher/images";
        Picasso.with(context)
                .load("http://blog.concretesolutions.com.br/wp-content/uploads/2015/04/Android1.png")
                .into(getTarget(path));
        Log.e("Download Image: ", "inside  getImage()");
    }

    private Target getTarget(final String path) {
//        ContextWrapper cw = new ContextWrapper(mContext);
//        final File directory = cw.getDir(path, Context.MODE_PRIVATE); // path to …
Run Code Online (Sandbox Code Playgroud)

android picasso

5
推荐指数
1
解决办法
435
查看次数

Android ViewModel无法在片段更改后继续存在

我一直在尝试使用viewmodel和livedata来分享片段之间的信息.

但是当我从第一个片段更改为另一个片段时,我的viewmodel似乎重新初始化,使我丢失了以前存储的所有数据.

我在我的片段中以相同的方式获得了两次我的viewmodel:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    interventionViewModel = ViewModelProviders.of(this).get(InterventionsViewModel.class);

}
Run Code Online (Sandbox Code Playgroud)

这就是我在我的活动中替换我的framgents的方式(我猜问题必须来自片段生命周期,但我无法弄清楚错误在哪里:/)

public void showFragment(Fragment fragment) {

    String TAG = fragment.getClass().getSimpleName();
    FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
    fragmentTransaction.replace(R.id.fragment_container, fragment, TAG);
    fragmentTransaction.addToBackStack(null);
    fragmentTransaction.commitAllowingStateLoss();
}

public void backstackFragment() {
    Log.d("Stack count", getSupportFragmentManager().getBackStackEntryCount() + "");
    if (getSupportFragmentManager().getBackStackEntryCount() == 0) {
        finish();
    }
    getSupportFragmentManager().popBackStack();
    removeCurrentFragment();
}

private void removeCurrentFragment() {
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    Fragment currentFrag = getSupportFragmentManager()
            .findFragmentById(R.id.fragment_container);

    if (currentFrag != null) {
        transaction.remove(currentFrag);
    }
    transaction.commitAllowingStateLoss();
}
Run Code Online (Sandbox Code Playgroud)

当我需要一个片段时,我会调用backStackFragment()删除当前片段然后调用showFragment(MyFragment.newInstance());

该片段是AndroidStudio生成的片段 …

android android-fragments android-livedata android-viewmodel android-architecture-components

5
推荐指数
1
解决办法
1724
查看次数

什么时候用 numpy.random.randn(...) 什么时候用 numpy.random.rand(...)?

在我的深度学习练习中,我必须初始化一个与 A1 大小相同的参数 D1,所以我所做的是:

D1 = np.random.randn(A1.shape[0],A1.shape[1]) 
Run Code Online (Sandbox Code Playgroud)

但是在我检查结果时计算了进一步的方程后,它们不匹配,然后在正确阅读文档后,我发现他们说使用 rand 而不是randn初始化 D1 ;

D1 = np.random.rand(A1.shape[0],A1.shape[1]) 
Run Code Online (Sandbox Code Playgroud)

但是他们没有说明原因,因为代码在这两种情况下都有效,而且该练习还有一个文档,所以我找出了错误,但是如何何时以及为什么从这两者中进行选择?

python numpy deep-learning

3
推荐指数
1
解决办法
1745
查看次数

Top_toBottomof 在约束布局中不起作用。如何在约束布局中使用 Top_toBottomof?

我有以下布局:

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

        <include layout="@layout/toolbar_with_filter_back" />

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">

        <android.support.constraint.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <ImageView
                android:id="@+id/imageView2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scaleType="fitXY"
                android:src="@drawable/banner"
                app:layout_constraintTop_toTopOf="parent"
                tools:layout_editor_absoluteX="0dp" />

            <android.support.constraint.Guideline
                android:id="@+id/guideline"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                app:layout_constraintGuide_begin="165dp" />


            <android.support.v7.widget.CardView
                android:id="@+id/win_card"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/_5sdp"
                android:elevation="@dimen/_8sdp"
                app:cardCornerRadius="@dimen/_10sdp"
                app:cardPreventCornerOverlap="false"
                app:cardUseCompatPadding="true"
                app:layout_constraintTop_toBottomOf="@+id/guideline">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">


                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        android:padding="@dimen/_10sdp">


                            <android.support.v7.widget.CardView
                                android:layout_width="0dp"
                                android:layout_height="match_parent"
                                android:layout_weight="0.4"
                                android:gravity="center"
                                android:scaleType="fitXY"
                                app:cardCornerRadius="8dp"
                                app:cardPreventCornerOverlap="true">

                                <RelativeLayout
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content">

                                    <ImageView
                                        android:id="@+id/exec_business_icon"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:layout_gravity="center_vertical"
                                        android:gravity="center"
                                        android:scaleType="fitXY"
                                        android:src="@drawable/icon_dairy" />

                                    <TextView
                                        android:id="@+id/exec_business_iconname"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

android mpandroidchart android-constraintlayout

3
推荐指数
1
解决办法
1134
查看次数

DexArchiveBuilderException

我知道这个问题已经被问到了,但是那里提供的解决方案对我不起作用,我不能冒险使用d8编译器进行构建.这是错误:

Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process E:\suv\Projects\SoundRecorder\ImageFetcher\app\build\intermediates\classes\debug
Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process E:\suv\Projects\SoundRecorder\ImageFetcher\app\build\intermediates\classes\debug
Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing Services/MyFirebaseInstanceIDService.class
Error:com.android.dx.cf.iface.ParseException: class name (services/MyFirebaseInstanceIDService) does not match path (Services/MyFirebaseInstanceIDService.class)
Run Code Online (Sandbox Code Playgroud)

Gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "ops.com.imagefetcher"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation …
Run Code Online (Sandbox Code Playgroud)

android android-gradle-plugin

1
推荐指数
1
解决办法
6847
查看次数