小编jea*_*rme的帖子

Dockerizing Node.js 应用程序 - 有什么作用:ENV PATH /app/node_modules/.bin:$PATH

我经历了为数不多的很好的 dockerizing Vue.js 教程之一,有一件事我不明白为什么是强制性的Dockerfile

# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json /usr/src/app/package.json #not sure though how it relates to PATH...
Run Code Online (Sandbox Code Playgroud)

我在这里只找到了一种解释它说:

我们将所有 Node.js 二进制文件暴露给我们的 PATH 环境变量,并将我们的项目 package.json 复制到 app 目录。复制 JSON 文件而不是整个工作目录允许我们利用 Docker 的缓存层。

尽管如此,它并没有让我变得更聪明。谁能用简单的英语解释一下?

node.js docker

5
推荐指数
3
解决办法
2174
查看次数

制作照片后,无法从相机接收Intent.extras()

我发现这是捕捉照片和接收全尺寸照片而不是缩略图的常见问题(根据:http://developer.android.com/training/camera/photobasics.html).拍摄照片和接收缩略图很容易,但教程的其余部分似乎不完整且无法正常工作.有人轻松解决了吗?

public class TakePhoto extends Activity{

static final int REQUEST_IMAGE_CAPTURE = 1;
static final int REQUEST_TAKE_PHOTO = 1;
private String mCurrentPhotoPath;
private ImageView mImageView;

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

    mImageView = (ImageView) findViewById(R.id.imageView);

    dispatchTakePictureIntent();

}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_TAKE_PHOTO && resultCode == RESULT_OK) {
        Bundle extras = data.getExtras();
        Bitmap imageBitmap = (Bitmap) extras.get("data");
        mImageView.setImageBitmap(imageBitmap);
    }
}

private void dispatchTakePictureIntent() {
    Intent takePictureIntent = …
Run Code Online (Sandbox Code Playgroud)

android android-camera-intent android-bundle

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

Gradle无法管理添加编译'com.google.android.gms:play-services:7.0.0'

我无法相信没有人发现如何解决这个问题.我想在我的应用程序中添加一个横幅,但Android Studio的Gradle系统试图让我感到高兴,这不是一个好主意.它看起来像这样:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.(package).(name)"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.google.android.gms:play-services:7.0.0'
}
Run Code Online (Sandbox Code Playgroud)

日志:

Error:A problem occurred configuring project ':app'.
Run Code Online (Sandbox Code Playgroud)

无法解析配置':app:_debugCompile'的所有依赖项.找不到com.android.support:support-v4:22.0.0.在以下位置搜索:https : //jcenter.bintray.com/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom https://jcenter.bintray.com/com /android/support/support-v4/22.0.0/support-v4-22.0.0.aar 文件:/ C:/ Program Files(x86)/ Android/sdk/extras/android/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom文件:/ C:/ Program Files(x86)/Android/sdk/extras/android/m2repository/com/android/support/support-v4/22.0 .0/support-v4-22.0.0.aar文件:/ C:/ Program Files(x86)/Android/sdk/extras/google/m2repository/com/android/support/support-v4/22.0.0/support- v4-22.0.0.pom文件:/ C:/ Program Files(x86)/Android/sdk/extras/google/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0 .aar必需者:FakeCall:app:unspecified> com.android.support:appcompat-v7:21.0.3找不到com.android.support:support-v4:22.0.0.在以下位置搜索:https …

android google-play-services build.gradle android-gradle-plugin

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

DividerItemDecoration 未显示在 RecyclerView 中

我发现 DividerItemDecoration 可以很好地处理简单的单行列表项,但对于更复杂的项,它拒绝显示。这是列表项的 XML:

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

    <ImageView
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:id="@+id/imageView"
        android:transitionName="obrazek"
        android:layout_marginRight="5dp" />

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingTop="5dp"
        android:paddingBottom="5dp"
        android:background="?android:attr/selectableItemBackground">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="Medium Text"
            android:id="@+id/nazwa"
            android:maxLines="1" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="Medium Text"
            android:id="@+id/odleglosc"
            android:layout_gravity="right"
            android:gravity="end"
            android:layout_below="@+id/nazwa"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:clickable="false" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text=" "
            android:id="@+id/cena"
            android:layout_below="@+id/nazwa"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true" />
        <!--
            <RatingBar
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/ratingBar"
                android:layout_below="@+id/nazwa"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                style="@style/beerRatingBar" />
        -->

    </RelativeLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我正在为 RecyclerView 使用最常见的装饰器。就是不知道为什么不想画。

recyclerView.addItemDecoration(new …
Run Code Online (Sandbox Code Playgroud)

android material-design android-recyclerview

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

Glide 实际上是如何工作的?

这个问题可能看起来非常基本,但我正在考虑在我的 RecyclerView 中使用 Glide,其中我有超过 1,000 个项目。当我打开这个列表时 - Glide 开始下载所有图像还是只下载我面前实际存在的图像 - 那么如果我从 A 快速滚动到 E,它也会下载 B、C 和 D 的图像吗?

android android-recyclerview android-glide

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

Knex交易中的多种操作

我在一个函数中需要对数据库执行五 (5) 次操作。我想将它们放入事务中,但我发现将每个放入上一个操作的回调中有点奇怪。我怎样才能以优雅且可读的方式做到这一点?

knex.js

2
推荐指数
2
解决办法
2989
查看次数