小编mbo*_*nin的帖子

使用Perl的LWP时,是否可以根据`Content-Type`中止HTTP请求?

我希望我的脚本只下载文本/ html内容,而不是二进制文件或可能需要更多时间下载的图像.我知道max_size参数,但我想在Content-Type标题上添加一个检查.这可行吗?

perl http lwp

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

Android/Kotlin:未解决的参考:木材

我正在尝试为 Android 编写 kotlin 库,但不能包含木材。我总是收到以下错误:

Error:error: unresolved reference: timber
Run Code Online (Sandbox Code Playgroud)

我的 build.gradle 中有这个:

apply plugin: 'java-library'
apply plugin: 'kotlin'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
}

sourceCompatibility = "1.8"
targetCompatibility = "1.8"

buildscript {
    ext.kotlin_version = '1.1.2-4'
    repositories {
        maven {url "https://maven.google.com"}
        mavenCentral()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    compile 'com.jakewharton.timber:timber:4.5.1'
    testCompile 'junit:junit:4.12'
}
Run Code Online (Sandbox Code Playgroud)

我的源文件目前非常简单:

package net.mbonnin.test

import timber.log.Timber

class Main() {

    fun main() {
        Timber.d("hello world")
    }
} …
Run Code Online (Sandbox Code Playgroud)

android kotlin timber-android

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

Android @NonNull和Jetbrains @NonNull有什么区别

这两个注释之间有什么区别?

  • org.jetbrains.annotations.NonNull
  • android.support.annotation.NonNull

的科特林编译器的IntelliJ要荣誉android.support.annotation.NonNull,并添加断言检查,如果我传递一个空参数对应的Java功能?

org.jetbrains.annotations.NonNull如果我检查了已经为NonNull的变量,Android皮棉是否会兑现并向我显示警告?

我什么时候应该使用另一个?

java android annotations kotlin

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

bash case 语句中的复合模式

我无法获得http://www.gnu.org/software/bash/manual/bashref.html#Pattern-Matching中所述的复合模式来匹配我的 case 语句:

i=33; case $i in *([A-Za-z0-9]) ) echo "alphanumeric";; * ) echo "bah";; esac;
Run Code Online (Sandbox Code Playgroud)

我希望上面的脚本显示“字母数字”,但它失败了:

bash: syntax error near unexpected token `('
Run Code Online (Sandbox Code Playgroud)

知道出了什么问题吗?

bash

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

标签 统计

android ×2

kotlin ×2

annotations ×1

bash ×1

http ×1

java ×1

lwp ×1

perl ×1

timber-android ×1