问:
Probles to Buld project in Android 2.3 after update. 'all com.android.support libraries must use the exact same version'
I´ve updated my AndroidStudio from 2.2.3 to 2.3 after being updated, my project start to have some build conflicts: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.2.0, 25.0.2

app module build.gradle

```<code>apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
def AAVersion = '4.2.0'
apply plugin: 'io.fabric'

apt {
    arguments {
        androidManifestFile variant.outputs[0]?.processResources?.manifestFile
    }
}
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        // The Fabric Gradle plugin uses an open ended version to react
        // quickly to Android tooling updates
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
repositories {
    maven {
        url "https://jitpack.io"
    }
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots"
    }
    maven {
        url 'https://zendesk.artifactoryonline.com/zendesk/repo'
    }
    maven {
        url 'https://maven.fabric.io/public'
    }
}

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "amaro.amaroandroid"
        minSdkVersion 21
        targetSdkVersion 25
        renderscriptTargetApi 25
        renderscriptSupportModeEnabled true
        versionCode 6
        versionName "1.01"
        //Instrumentation Test Runner
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        // Enabling multidex support.
        multiDexEnabled true
        manifestPlaceholders = [manifestApplicationId          : "${applicationId}",
                                onesignal_app_id               : "32551ffc-b35d-482f-81c7-2c4206811814",
                                onesignal_google_project_number: "867653264688"]
        vectorDrawables.useSupportLibrary = true
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "2g"
    }

}

afterEvaluate {
    tasks.matching {
        it.name.startsWith('dex')
    }.each { dx ->
        if (dx.additionalParameters == null) {
            dx.additionalParameters = []
        }
        dx.additionalParameters += '--multi-dex'
        dx.additionalParameters += "--main-dex-list=$projectDir/multidex.keep".toString()
    }
}
allprojects {
    repositories {
        mavenCentral()
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':api')

    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"

    compile group: 'com.zopim.android', name: 'sdk', version: '1.3.2.1'
    // Required for geotagging
    compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
        transitive = true;
    }
    compile 'com.google.maps.android:android-maps-utils:0.4.+'
    compile 'com.android.support:recyclerview-v7:25.2.0'
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    compile 'com.android.support:cardview-v7:25.2.0'
    compile 'org.jsoup:jsoup:1.10.2'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.5'
    compile 'com.mikepenz:iconics-core:2.6.6@aar'
    compile 'com.mikepenz:google-material-typeface:2.2.0.1.original@aar'
    compile 'com.mikepenz:material-design-iconic-typeface:2.2.0.1@aar'
    compile 'com.mikepenz:fontawesome-typeface:4.6.0.1@aar'
    compile 'com.mikepenz:octicons-typeface:3.2.0.1@aar'
    compile 'com.mikepenz:meteocons-typeface:1.1.0.1@aar'
    compile 'com.mikepenz:community-material-typeface:1.5.54.1@aar'
    compile 'com.mikepenz:weather-icons-typeface:2.0.10.1@aar'
    compile 'com.mikepenz:typeicons-typeface:2.0.7.1@aar'
    compile 'com.mikepenz:entypo-typeface:1.0.0.1@aar'
    compile 'com.mikepenz:devicon-typeface:2.0.0.1@aar'
    compile 'com.mikepenz:foundation-icons-typeface:3.0.0.1@aar'
    compile 'com.mikepenz:ionicons-typeface:2.0.1.1@aar'
    compile 'com.github.Yalantis:Context-Menu.Android:v1.0.4'
    compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
    compile 'com.android.support.test.espresso:espresso-contrib:2.2.2'
    compile 'com.rengwuxian.materialedittext:library:2.1.4'
    compile 'com.github.medyo:fancybuttons:1.8.3'
    compile 'com.yarolegovich:lovely-dialog:1.0.4'
    compile 'com.wang.avi:library:1.0.5'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.github.traex.rippleeffect:library:1.3'
    compile 'com.balysv:material-ripple:1.0.2'
    compile 'com.mikepenz:actionitembadge:3.2.5@aar'
    compile 'com.github.linger1216:labelview:v1.1.1'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.onesignal:OneSignal:3.+@aar'
    compile 'com.google.android.gms:play-services-places:10.2.0'
    compile 'com.google.android.gms:play-services-location:10.2.0'
    compile 'com.google.android.gms:play-services-analytics:10.2.0'
    compile 'com.android.support:support-v4:25.2.0'
    compile 'com.github.rahatarmanahmed:circularprogressview:2.5.0'
    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:1.+'
    androidTestCompile 'com.android.support:support-annotations:25.2.0'
    androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile 'com.android.support.test:rules:0.5'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestCompile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'
    androidTestCompile 'org.mockito:mockito-core:1.+'
    androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
    androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
}
</code>```

Project build.gradle

```<code>   // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
        classpath 'com.google.gms:google-services:3.0.0'
        // replace with the current version of the android-apt plugin
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'me.tatarka:gradle-retrolambda:3.2.4'
        classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
    configurations.classpath.exclude group: 'com.android.tools.external.lombok'
}

allprojects {
    repositories {
        jcenter()
        jcenter()
        mavenCentral()
        maven { url 'http://repo.spring.io/milestone' }
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    }
    configurations.all {
        resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
        resolutionStrategy {
            force 'com.android.support:support-annotations:25.2.0'
        }
    }
}

def getDate() {
    def date = new Date()
    def formattedDate = date.format('yyyyMMdd-HHmm')
    return formattedDate
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
</code>```

api module build.gradle

```<code>apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.neenbedankt.android-apt'
def AAVersion = '4.2.0'

apt {
    arguments {
        androidManifestFile variant.outputs[0]?.processResources?.manifestFile
    }
}
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 25
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField "String", "SHARE_URL", System.getenv("RSAPIURL") ? "\"" + System.getenv("RSAPIURL") + "\"" : "\"https://amaro.com\""
            buildConfigField "String", "API_URL", System.getenv("RSAPIURL") ? "\"" + System.getenv("RSAPIURL") + "\"" : "\"https://amaro.com/shop/api/\""
            buildConfigField "String", "DEV_API_URL", System.getenv("RSAPIURL") ? "\"" + System.getenv("RSAPIURL") + "\"" : "\"https://amaro.com/shop/api/\""//https://amaro.com/shop/api/
            buildConfigField "String", "SESSION", "\"_aecp\""//_aecp
            buildConfigField "String", "AUTHENTICATION", "\"_aecp_user\""//_aecp_user
        }
        debug {
            minifyEnabled false
            debuggable true
            buildConfigField "String", "SHARE_URL", System.getenv("RSAPIURL") ? "\"" + System.getenv("RSAPIURL") + "\"" : "\"https://amaro.com\""
            buildConfigField "String", "API_URL", System.getenv("RSAPIURL") ? "\"" + System.getenv("RSAPIURL") + "\"" : "\"https://amaro.com/shop/api/\""
            buildConfigField "String", "DEV_API_URL", System.getenv("RSAPIURL") ? "\"" + System.getenv("RSAPIURL") + "\"" : "\"http://dev.amaro.com/shop/api/\""//
            buildConfigField "String", "SESSION", "\"_aecp_dev\""//_aecp_dev
            buildConfigField "String", "AUTHENTICATION", "\"_aecp_dev_user\""//_aecp_dev_user
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
    compile "org.projectlombok:lombok:1.16.6"

    apt "org.androidannotations:rest-spring:$AAVersion"
    compile "org.androidannotations:rest-spring-api:$AAVersion"
    compile 'org.springframework.android:spring-android-rest-template:2.0.0.M3'

    compile "commons-lang:commons-lang:2.6"

    compile "com.j256.ormlite:ormlite-jdbc:4.48"
    compile "com.j256.ormlite:ormlite-android:4.48"
    compile "org.jdeferred:jdeferred-core:1.2.2"
    compile "org.javamoney:moneta-bp:1.0"

    compile 'com.fasterxml.jackson.core:jackson-core:2.1.0'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.1.0'
    compile 'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.1.0'

    compile 'com.squareup:otto:1.3.8'
}
</code>```

答:
Solved!

In your root build.gradle, you should have

```<code>ext {
supportlib_version = '25.2.0'
...
}

...
subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "$supportlib_version"
            }
        }
    }
}
...
</code>```

In your module build.gradle must have

```<code>dependencies {
    compile "com.android.support:appcompat-v7:25.2.0"
    compile "com.android.support:recyclerview-v7:25.2.0"
    ...
}
</code>```

Body:
I´ve updated my AndroidStudio from 2.2.3 to 2.3 after being updated, my project start to have some build conflicts: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.2.0, 25.0.2

app module build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
def AAVersion = '4.2.0'
apply plugin: 'io.fabric'

apt {
    arguments {
        androidManifestFile variant.outputs[0]?.processResources?.manifestFile
    }
}
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        // The Fabric Gradle plugin uses an open ended version to react
        // quickly to Android tooling updates
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
repositories {
    maven {
        url "https://jitpack.io"
    }
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots"
    }
    maven {
        url 'https://zendesk.artifactoryonline.com/zendesk/repo'
    }
    maven {
        url 'https://maven.fabric.io/public'
    }
}

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "amaro.amaroandroid"
        minSdkVersion 21
        targetSdkVersion 25
        renderscriptTargetApi 25
        renderscriptSupportModeEnabled true
        versionCode 6
        versionName "1.01"
        //Instrumentation Test Runner
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        // Enabling multidex support.
        multiDexEnabled true
        manifestPlaceholders = [manifestApplicationId          : "${applicationId}",
                                onesignal_app_id               : "32551ffc-b35d-482f-81c7-2c4206811814",
                                onesignal_google_project_number: "867653264688"]
        vectorDrawables.useSupportLibrary = true
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "2g"
    }

}

afterEvaluate {
    tasks.matching {
        it.name.startsWith('dex')
    }.each { dx ->
        if (dx.additionalParameters == null) {
            dx.additionalParameters = []
        }
        dx.additionalParameters += '--multi-dex'
        dx.additionalParameters += "--main-dex-list=$projectDir/multidex.keep".toString()
    }
}
allprojects {
    repositories {
        mavenCentral()
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':api')

    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"

    compile group: 'com.zopim.android', name: 'sdk', version: '1.3.2.1'
    // Required for geotagging
    compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
        transitive = true;
    }
    compile 'com.google.maps.android:android-maps-utils:0.4.+'
    compile 'com.android.support:recyclerview-v7:25.2.0'
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    compile 'com.android.support:cardview-v7:25.2.0'
    compile 'org.jsoup:jsoup:1.10.2'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.5'
    compile 'com.mikepenz:iconics-core:2.6.6@aar'
    compile 'com.mikepenz:google-material-typeface:2.2.0.1.original@aar'
    compile 'com.mikepenz:material-design-iconic-typeface:2.2.0.1@aar'
    compile 'com.mikepenz:fontawesome-typeface:4.6.0.1@aar'
    compile 'com.mikepenz:octicons-typeface:3.2.0.1@aar'
    compile 'com.mikepenz:meteocons-typeface:1.1.0.1@aar'
    compile 'com.mikepenz:community-material-typeface:1.5.54.1@aar'
    compile 'com.mikepenz:weather-icons-typeface:2.0.10.1@aar'
    compile 'com.mikepenz:typeicons-typeface:2.0.7.1@aar'
    compile 'com.mikepenz:entypo-typeface:1.0.0.1@aar'
    compile 'com.mikepenz:devicon-typeface:2.0.0.1@aar'
    compile 'com.mikepenz:foundation-icons-typeface:3.0.0.1@aar'
    compile 'com.mikepenz:ionicons-typeface:2.0.1.1@aar'
    compile 'com.github.Yalantis:Context-Menu.Android:v1.0.4'
    compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
    compile 'com.android.support.test.espresso:espresso-contrib:2.2.2'
    compile 'com.rengwuxian.materialedittext:library:2.1.4'
    compile 'com.github.medyo:fancybuttons:1.8.3'
    compile 'com.yarolegovich:lovely-dialog:1.0.4'
    compile 'com.wang.avi:library:1.0.5'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.github.traex.rippleeffect:library:1.3'
    compile 'com.balysv:material-ripple:1.0.2'
    compile 'com.mikepenz:actionitembadge:3.2.5@aar'
    compile 'com.github.linger1216:labelview:v1.1.1'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.onesignal:OneSignal:3.+@aar'
    compile 'com.google.android.gms:play-services-places:10.2.0'
    compile 'com.google.android.gms:play-services-location:10.2.0'
    compile 'com.google.android.gms:play-services-analytics:10.2.0'
    compile 'com.android.support:support-v4:25.2.0'
    compile 'com.github.rahatarmanahmed:circularprogressview:2.5.0'
    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:1.+'
    androidTestCompile 'com.android.support:support-annotations:25.2.0'
    androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile 'com.android.support.test:rules:0.5'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestCompile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'
    androidTestCompile 'org.mockito:mockito-core:1.+'
    androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
    androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
}

Project build.gradle

   // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
        classpath 'com.google.gms:google-services:3.0.0'
        // replace with the current version of the android-apt plugin
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'me.tatarka:gradle-retrolambda:3.2.4'
        classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
    configurations.classpath.exclude group: 'com.android.tools.external.lombok'
}

allprojects {
    repositories {
        jcenter()
        jcenter()
        mavenCentral()
        maven { url 'http://repo.spring.io/milestone' }
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    }
    configurations.all {
        resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
        resolutionStrategy {
            force 'com.android.support:support-annotations:25.2.0'
        }
    }
}

def getDate() {
    def date = new Date()
    def formattedDate = date.format('yyyyMMdd-HHmm')
    return formattedDate
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

api module build.gradle

apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.neenbedankt.android-apt'
def AAVersion = '4.2.0'

apt {
    arguments {
        androidManifestFile variant.outputs[0]?.processResources?.manifestFile
    }
}
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 25
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField "String", "SHARE_URL", System.getenv("RSAPIURL") ? "\"" + System.getenv("RSAPIURL") + "\"" : "\"https://amaro.com\""
            buildConfigField "String", "API_URL", System.getenv("RSAPIURL") ? "\"" + System.getenv("RSAPIURL") + "\"" : "\"https://amaro.com/shop/api/\""
            buildConfigField "String", "DEV_API_URL", System.getenv("RSAPIURL") ? "\"" + System.getenv("RSAPIURL") + "\"" : "\"https://amaro.com/shop/api/\""//https://amaro.com/shop/api/
            buildConfigField "String", "SESSION", "\"_aecp\""//_aecp
            buildConfigField "String", "AUTHENTICATION", "\"_aecp_user\""//_aecp_user
        }
        debug {
            minifyEnabled false
            debuggable true
            buildConfigField "String", "SHARE_URL", System.getenv("RSAPIURL") ? "\"" + System.getenv("RSAPIURL") + "\"" : "\"https://amaro.com\""
            buildConfigField "String", "API_URL", System.getenv("RSAPIURL") ? "\"" + System.getenv("RSAPIURL") + "\"" : "\"https://amaro.com/shop/api/\""
            buildConfigField "String", "DEV_API_URL", System.getenv("RSAPIURL") ? "\"" + System.getenv("RSAPIURL") + "\"" : "\"http://dev.amaro.com/shop/api/\""//
            buildConfigField "String", "SESSION", "\"_aecp_dev\""//_aecp_dev
            buildConfigField "String", "AUTHENTICATION", "\"_aecp_dev_user\""//_aecp_dev_user
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
    compile "org.projectlombok:lombok:1.16.6"

    apt "org.androidannotations:rest-spring:$AAVersion"
    compile "org.androidannotations:rest-spring-api:$AAVersion"
    compile 'org.springframework.android:spring-android-rest-template:2.0.0.M3'

    compile "commons-lang:commons-lang:2.6"

    compile "com.j256.ormlite:ormlite-jdbc:4.48"
    compile "com.j256.ormlite:ormlite-android:4.48"
    compile "org.jdeferred:jdeferred-core:1.2.2"
    compile "org.javamoney:moneta-bp:1.0"

    compile 'com.fasterxml.jackson.core:jackson-core:2.1.0'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.1.0'
    compile 'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.1.0'

    compile 'com.squareup:otto:1.3.8'
}

Body:
Solved!

In your root build.gradle, you should have

ext {
supportlib_version = '25.2.0'
...
}

...
subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "$supportlib_version"
            }
        }
    }
}
...

In your module build.gradle must have

dependencies {
    compile "com.android.support:appcompat-v7:25.2.0"
    compile "com.android.support:recyclerview-v7:25.2.0"
    ...
}


来源: stackexchange

问:
How to get the count of repeated value of some perticular attribute in array of object and store in Object
Suppose I have an array of Object.

code :

```<code>var arrayMap = [{continent: "Asia", Country: "China"},
{continent:"NAmerica", Country: "USA"},
{continent:"Asia", Country:"India"},
{continent:"Australia", Country:"Australia"},
{continent:"Asia", Country:"Japan"},
{continent:"Europe", Country:"UK"},
{continent:"SAmerica", Country:"Brazil"},
{continent:"Europe", Country:"Germany"},
{continent:"Asia", Country:"Rassia"},
{continent:"NAmerica", Country:"Canada"}]
</code>```

Now I have two attribute continent and Country in arrayMap in Obj. I want to the counts of country in all continent.
like :

```<code> Obj{Asia: 4, NAmerica:2, Australia:1, Europe:2, SAmerica:1}
</code>```

Can anybody help me how to get this.

答:
If you have it in an ExtJS store with grouping on continent, you can use store.count(true).

Otherwise, I don't know any builtin function - you may have to loop over your array and count the continent values yourself.

ContentLicense: CC BY-SA 3.0

Body:
Suppose I have an array of Object.

code :

var arrayMap = [{continent: "Asia", Country: "China"},
{continent:"NAmerica", Country: "USA"},
{continent:"Asia", Country:"India"},
{continent:"Australia", Country:"Australia"},
{continent:"Asia", Country:"Japan"},
{continent:"Europe", Country:"UK"},
{continent:"SAmerica", Country:"Brazil"},
{continent:"Europe", Country:"Germany"},
{continent:"Asia", Country:"Rassia"},
{continent:"NAmerica", Country:"Canada"}]

Now I have two attribute continent and Country in arrayMap in Obj. I want to the counts of country in all continent.
like :

 Obj{Asia: 4, NAmerica:2, Australia:1, Europe:2, SAmerica:1}

Can anybody help me how to get this.


问:
JSON Unexpected End
I'm running into an exception that I can't seem to find a lot of information about online.

Unexpected End. Line #, Position ######

Some details, this is running on Windows 6.5.3 , the Mobile .NET CE Framework. I'm parsing the response from a web-service call. I have verified that the response is proper JSON formatting, But I know that the response is very, very big.

What I can't figure out, is why I get this excpetion. Here's my parsing code (Yes, we always get lists of complex objects)

```<code>List<T> objList = new List<T>();
using (StreamReader sr = new StreamReader(responseStream))
{
    using (JsonTextReader jr = new JsonTextReader(sr))
    {
        JsonSerializer ser = new JsonSerializer();
        JObject jo = ser.Deserialize(jr) as JObject;  //<---- This line throws the exception
        if (jo != null)
        {
            List<JToken> jResults = jo[name + "Result"].Children().ToList();
            foreach (JToken jObjResult in jResults)
            {
                T obj = JsonConvert.DeserializeObject<T>(jObjResult.ToString());
                objList.Add(obj);
            }
        }
    }
}
return objList;
</code>```

Anyone who can shed some light on this, please do. And Thanks.

UPDATE: Add Exact Exception Text

```<code>Message: "Unexpected end. Line 1, position 1594143."
StackTrace:
       at Newtonsoft.Json.JsonTextReader.ParseValue(Char currentChar)
       at Newtonsoft.Json.JsonTextReader.ReadInternal()
       at Newtonsoft.Json.JsonTextReader.Read()
       at Newtonsoft.Json.JsonWriter.WriteToken(JsonReader reader, Int32 initialDepth)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateJObject(JsonReader reader)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueNonProperty(JsonReader reader, Type objectType, JsonContract contract)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType)
       at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
       at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
       at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader)
       at MY CODE HIDDEN HERE
</code>```

Note: The exact position varies sometimes, but it always seems to be a number greater than 65536

答:
Ok.  I figured out what was causing the issue, but it isn't something that's easy to reproduce at all, because it has to do with connection speed.  Literally, the speed at which the response stream is able to supply data.

The Altered Code

```<code>using (StreamReader sr = new StreamReader(responseStream))
{
    using (JsonTextReader jr = new JsonTextReader(sr))
    {
        while (jr.Read())
            if (jr.TokenType == JsonToken.StartArray)
                break;
        jr.Read();

        JsonSerializer Jser = new JsonSerializer();
        while (!sr.EndOfStream && jr.TokenType != JsonToken.EndArray)
        {
            if(jr.TokenType == JsonToken.StartObject)
            {
                T tobj = Jser.Deserialize<T>(jr);
                objList.Add(tobj);
            }
            //consume the EndObject tag
            if (jr.TokenType == JsonToken.EndObject)
                jr.Read();
            //Deliberately slow down the process, On purpose, otherwise we will overrun the stream itself and throw an error
            Thread.Sleep(1); //<=== VERY IMPORTANT LINE
        }
    }
}
</code>```

The explanation

I found this by checking the stream position at failure.  I noticed that it kept changing, and I finally figured out that the change was based on how long I spent with the process paused in debug mode looking at details.  The longer I spent, the farther the read would get.  So I altered it to manually advance the stream one object at a time (that took some doing as well, but I figured out what the token order was going to be).  Added in a VERY short thread sleep.  And it worked perfectly.

So, in summary.  When loading JSON directly from a response stream over a slow connection....you can actually serialize data FASTER than the response stream can provide it.  It will report an "Unexpected End" in this case.

Title: JSON Unexpected End

Body:
I'm running into an exception that I can't seem to find a lot of information about online.

Unexpected End. Line #, Position ######

Some details, this is running on Windows 6.5.3 , the Mobile .NET CE Framework. I'm parsing the response from a web-service call. I have verified that the response is proper JSON formatting, But I know that the response is very, very big.

What I can't figure out, is why I get this excpetion. Here's my parsing code (Yes, we always get lists of complex objects)

List<T> objList = new List<T>();
using (StreamReader sr = new StreamReader(responseStream))
{
    using (JsonTextReader jr = new JsonTextReader(sr))
    {
        JsonSerializer ser = new JsonSerializer();
        JObject jo = ser.Deserialize(jr) as JObject;  //<---- This line throws the exception
        if (jo != null)
        {
            List<JToken> jResults = jo[name + "Result"].Children().ToList();
            foreach (JToken jObjResult in jResults)
            {
                T obj = JsonConvert.DeserializeObject<T>(jObjResult.ToString());
                objList.Add(obj);
            }
        }
    }
}
return objList;

Anyone who can shed some light on this, please do. And Thanks.

UPDATE: Add Exact Exception Text

Message: "Unexpected end. Line 1, position 1594143."
StackTrace:
       at Newtonsoft.Json.JsonTextReader.ParseValue(Char currentChar)
       at Newtonsoft.Json.JsonTextReader.ReadInternal()
       at Newtonsoft.Json.JsonTextReader.Read()
       at Newtonsoft.Json.JsonWriter.WriteToken(JsonReader reader, Int32 initialDepth)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateJObject(JsonReader reader)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueNonProperty(JsonReader reader, Type objectType, JsonContract contract)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType)
       at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
       at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
       at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader)
       at MY CODE HIDDEN HERE

Note: The exact position varies sometimes, but it always seems to be a number greater than 65536

Body:
Ok.  I figured out what was causing the issue, but it isn't something that's easy to reproduce at all, because it has to do with connection speed.  Literally, the speed at which the response stream is able to supply data.

The Altered Code

using (StreamReader sr = new StreamReader(responseStream))
{
    using (JsonTextReader jr = new JsonTextReader(sr))
    {
        while (jr.Read())
            if (jr.TokenType == JsonToken.StartArray)
                break;
        jr.Read();

        JsonSerializer Jser = new JsonSerializer();
        while (!sr.EndOfStream && jr.TokenType != JsonToken.EndArray)
        {
            if(jr.TokenType == JsonToken.StartObject)
            {
                T tobj = Jser.Deserialize<T>(jr);
                objList.Add(tobj);
            }
            //consume the EndObject tag
            if (jr.TokenType == JsonToken.EndObject)
                jr.Read();
            //Deliberately slow down the process, On purpose, otherwise we will overrun the stream itself and throw an error
            Thread.Sleep(1); //<=== VERY IMPORTANT LINE
        }
    }
}

The explanation

I found this by checking the stream position at failure.  I noticed that it kept changing, and I finally figured out that the change was based on how long I spent with the process paused in debug mode looking at details.  The longer I spent, the farther the read would get.  So I altered it to manually advance the stream one object at a time (that took some doing as well, but I figured out what the token order was going to be).  Added in a VERY short thread sleep.  And it worked perfectly.

So, in summary.  When loading JSON directly from a response stream over a slow connection....you can actually serialize data FASTER than the response stream can provide it.  It will report an "Unexpected End" in this case.


问:
Is there a canonical way to mix standard django sitemaps with Wagtail sitemaps?
Pretty straightforward - I want to use the django sitemap framework and set up my static and custom pages, and I want to make sure that any pages added in wagtail are also indexed.</p>

答: Wagtail's sitemaps module will only generate sitemaps for pages managed by Wagtail. But it should be possible to enable Django sitemaps alongside it for everything else and link the two together with a sitemap index.</p>


问:
<authentication mode="Forms"> doesnt work?
I have a login-page where users can log in. When they logging in with correctly details they are sent to an main admin-page. If they cant log in they are staying on the login-page. What I want to do is, if a random user, type in the URL for an admin-page when they are not logged in they are redirecting to the login-page.

I have understood that I have to do it in the masterpage or webconfig!?! I have a main admin-page and some other admin-pages.

Any tips?

I tried to insert this into my webconfig:

```<code><authentication mode="Forms">
    <forms loginUrl="InnUtlogging.aspx" timeout="2880"/>
  </authentication>
</code>```

here is my code for the "login"-button (on the login-page);

```<code>protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True");
        con.Open();
        SqlCommand cmd = new SqlCommand("select * FROM Ansatt WHERE epost='" + brukernavn.Text + "' and passord='" + passord.Text + "'");
        cmd.Connection = con;
        int OBJ = Convert.ToInt32(cmd.ExecuteScalar());

        if (OBJ > 0)

            {
            Session["name"] = brukernavn.Text;
            Response.Redirect("KunstnerAdmin.aspx");
        }
        else
            {
                melding.Text = "Feil brukernavn/passord";
            }
        if (brukernavn.Text == "")
        {
            melding.Text = "Du må fylle inn brukernavn";

        }
        if (passord.Text == "")
        {
            melding.Text = "Du må fylle inn passord";
        }
        }
</code>```

The code on the "login"-page works for that page, but I actually want to check if user is logged in in the master-page. Is there something I can do in the masterpage to activate the forms authentication?

答:
Here is how you check if the user authenticated.</p>

```<code>HttpContext.Current.User.Identity.IsAuthenticated
</code>```

Body:
I have a login-page where users can log in. When they logging in with correctly details they are sent to an main admin-page. If they cant log in they are staying on the login-page. What I want to do is, if a random user, type in the URL for an admin-page when they are not logged in they are redirecting to the login-page.

I have understood that I have to do it in the masterpage or webconfig!?! I have a main admin-page and some other admin-pages.

Any tips?

I tried to insert this into my webconfig:

<authentication mode="Forms">
    <forms loginUrl="InnUtlogging.aspx" timeout="2880"/>
  </authentication>

here is my code for the "login"-button (on the login-page);

protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True");
        con.Open();
        SqlCommand cmd = new SqlCommand("select * FROM Ansatt WHERE epost='" + brukernavn.Text + "' and passord='" + passord.Text + "'");
        cmd.Connection = con;
        int OBJ = Convert.ToInt32(cmd.ExecuteScalar());

        if (OBJ > 0)

            {
            Session["name"] = brukernavn.Text;
            Response.Redirect("KunstnerAdmin.aspx");
        }
        else
            {
                melding.Text = "Feil brukernavn/passord";
            }
        if (brukernavn.Text == "")
        {
            melding.Text = "Du må fylle inn brukernavn";

        }
        if (passord.Text == "")
        {
            melding.Text = "Du må fylle inn passord";
        }
        }

The code on the "login"-page works for that page, but I actually want to check if user is logged in in the master-page. Is there something I can do in the masterpage to activate the forms authentication?

Body:
Here is how you check if the user authenticated.

HttpContext.Current.User.Identity.IsAuthenticated


问:
Input submit name is not being posted
I have a form with one input field and submit button. I know the name of the button can be submitted but for some reason, it isn't being posted to the server.

$(document).ready(function(){

  $("form").submit(function(e) {
      e.preventDefault();
      console.log($(this).serialize());
      return false;
  });

});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form method="post">
<div class="a">
  <label>Name</label>
  <input name="projectName" type="text">
</div>
<div class="b">
  <input name="newProject" value="Save Project" type="submit"></div>
</form>
<p>"newProject" field from submit input is not being posted</p></code>```

The only thing visible by doing print_r($_POST) is Array([projectName] => "") but the form name "newProject" is not visible or even being sent.

Here is a fiddle demonstrating it: https://jsfiddle.net/bosLyn1w/

Why is this happening and how can I submit the name of the submit input?

答:
```<code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">  </script>
<script>
$(document).ready(function(){
$('form').on('click', 'input[type=submit]', function(e) {
$(this.form).data('clicked', this.name);
$('.pVal').html($(this.form).serialize()+ ' <br> '+this.name+'=' +this.value);
console.log($(this.form).serialize());
return false;
});
});
</script>
<form method="post">
<div class="a">
<label>Name</label>
<input name="projectName3" type="text">
</div>
<div class="b">
<input name="newProject4" class="newProject" value="Save Project" type="submit"></div>
</form>
<p class="pVal"> -- Please put the both fields value here ---</p>
</code>```

Title: Input submit name is not being posted

Body:
I have a form with one input field and submit button. I know the name of the button can be submitted but for some reason, it isn't being posted to the server.

$(document).ready(function(){

  $("form").submit(function(e) {
      e.preventDefault();
      console.log($(this).serialize());
      return false;
  });

});

<form method="post">

  Name
  <input name="projectName" type="text">

  <input name="newProject" value="Save Project" type="submit">

</form>

"newProject" field from submit input is not being posted

The only thing visible by doing print_r($_POST) is Array([projectName] => "") but the form name "newProject" is not visible or even being sent.

Here is a fiddle demonstrating it: https://jsfiddle.net/bosLyn1w/

Why is this happening and how can I submit the name of the submit input?


问:
Append Query String to URL with Jquery
What am I doing wrong?

Only on pages with the URL location of "/MyWebsite/Example.aspx" append "?template=PW"

But only to links that contain "/HelloWorld/default.aspx"

There is no ID or classes associated to this link, so I have to look for the URL.

This is my code, but the links are not updating.. I know I'm close!

```<code>$(document).ready(function(){
    if (document.location.href.indexOf('/MyWebsite/Example.aspx') > 0)
        {
            $('a[href*="/HelloWorld/default.aspx"]').append("href",$("?template=PW"))
        }
});
</code>```

答:
This would definitely solve your problem as it did mine.</p>

```<code><script type="text/javascript">
    var querystring = 'MyString'; // Replace this
    $('a').each(function(){
        var href = $(this).attr('href');
        href += (href.match(/\?/) ? '&' : '?') + querystring;
        $(this).attr('href', href);
    });
</script>
</code>```

Title: Append Query String to URL with Jquery

Body:
What am I doing wrong?

Only on pages with the URL location of "/MyWebsite/Example.aspx" append "?template=PW"

But only to links that contain "/HelloWorld/default.aspx"

There is no ID or classes associated to this link, so I have to look for the URL.

This is my code, but the links are not updating.. I know I'm close!

$(document).ready(function(){
    if (document.location.href.indexOf('/MyWebsite/Example.aspx') > 0)
        {
            $('a[href*="/HelloWorld/default.aspx"]').append("href",$("?template=PW"))
        }
});

Body:
This would definitely solve your problem as it did mine.

<script type="text/javascript">
    var querystring = 'MyString'; // Replace this
    $('a').each(function(){
        var href = $(this).attr('href');
        href += (href.match(/\?/) ? '&' : '?') + querystring;
        $(this).attr('href', href);
    });
</script>

ContentLicense: CC BY-SA 4.0


问:
I can't show the ajax Request Response in my html page
guys i'm trying to work with ajax, i send the request to the server when a button clicked, then it's must return some HTML and show it, in the div with the id="formTag", but it's doesn't work can'i get some advice,
Her is my code:</p>

```<code>var ajaxRequest; // The variable that makes Ajax possible!
function ajaxFunction() {
try {

    // Opera 8.0+, Firefox, Safari
    ajaxRequest = new XMLHttpRequest();
} catch (e) {

    // Internet Explorer Browsers
    try {
        ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {

        try {
            ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {

            // Something went wrong
            alert("Your browser broke!");
            return false;
        }
    }
  }
}

function getForm(objButton) {
ajaxFunction();
if (ajaxRequest.readyState == 4) {
   document.getElementById("formTag").innerHTML = ajaxRequest.Response;
}
   var buttonValue = objButton.value;
   ajaxRequest.open("get", "get-form/" + buttonValue, true);
   ajaxRequest.send();
}
</code>```

答:
```<code>function getForm(objButton) {
    ajaxFunction();
    ajaxRequest.onreadystatechange=function{
        if (ajaxRequest.readyState == 4) {
            document.getElementById("formTag").innerHTML = ajaxRequest.responseText;//property responseText contain data from server
        }
    }
    var buttonValue = objButton.value;
    ajaxRequest.open("get", "get-form/" + buttonValue, true);
    ajaxRequest.send(null);//parameter null is necessary even you don't pass data
}
</code>```

you could try this.

Body:
guys i'm trying to work with ajax, i send the request to the server when a button clicked, then it's must return some HTML and show it, in the div with the id="formTag", but it's doesn't work can'i get some advice,
Her is my code:

var ajaxRequest; // The variable that makes Ajax possible!
function ajaxFunction() {
try {

    // Opera 8.0+, Firefox, Safari
    ajaxRequest = new XMLHttpRequest();
} catch (e) {

    // Internet Explorer Browsers
    try {
        ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {

        try {
            ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {

            // Something went wrong
            alert("Your browser broke!");
            return false;
        }
    }
  }
}

function getForm(objButton) {
ajaxFunction();
if (ajaxRequest.readyState == 4) {
   document.getElementById("formTag").innerHTML = ajaxRequest.Response;
}
   var buttonValue = objButton.value;
   ajaxRequest.open("get", "get-form/" + buttonValue, true);
   ajaxRequest.send();
}

Body:
function getForm(objButton) {
    ajaxFunction();
    ajaxRequest.onreadystatechange=function{
        if (ajaxRequest.readyState == 4) {
            document.getElementById("formTag").innerHTML = ajaxRequest.responseText;//property responseText contain data from server
        }
    }
    var buttonValue = objButton.value;
    ajaxRequest.open("get", "get-form/" + buttonValue, true);
    ajaxRequest.send(null);//parameter null is necessary even you don't pass data
}

you could try this.


问:
Update model according to database changes
I have an array filled with objects , queried from a database and this array is displayed as a table to the user.

The user wants to delete 1 item so the server receives the request from the client and updates the database accordingly.

Question : How should I update the user's view ?
should I requery the Database again and select everything from it and reasign it to my model or should I do a fast array.remove(element) ?

Which one is the preferred method ?

答:
If you are dealing with a real world application than you should always query the DB for fresh result. Doing this ensures,

You have consistency across the application (this approach will work for Add/update too).

Data Integrity, which will help you to ensure that DB operation was successful.

So re-query the Database again and select everything from it and reassign it to your model.


问:
Separating while loop tags from each other using (,)
```<code>while($loop = . . . .){
     $loopy = $loop['tag'];
     echo "<a>$loopy</a>";
}
</code>```

Using this code i get the tags outputted like this

```<code>Tag1Tag2Tag3Tag4Tag5Tag6
</code>```

How do i separate them to be Tag1, Tag2, Tag3, Tag4, Tag5, Tag6

答:
There are several ways to achieve this. A simple one can be:</p>

```<code>for($i = 0; $i < count($loop); $i++){
    $loop[$i] = $loop['tag'];
    echo "<a>$loop[$i]</a>";
    // the next line will add the commas but the last one
    if ($i < count($loop) - 1) echo ", ";

}
</code>```

Body:
while($loop = . . . .){
     $loopy = $loop['tag'];
     echo "$loopy";
}

Using this code i get the tags outputted like this

Tag1Tag2Tag3Tag4Tag5Tag6

How do i separate them to be Tag1, Tag2, Tag3, Tag4, Tag5, Tag6

Body:
There are several ways to achieve this. A simple one can be:

for($i = 0; $i < count($loop); $i++){
    $loop[$i] = $loop['tag'];
    echo "<a>$loop[$i]</a>";
    // the next line will add the commas but the last one
    if ($i < count($loop) - 1) echo ", ";

}


问:
Wordpress Jquery is not working for custom search field
Custom jQuery is not working in wordpress. I am trying to make a custom make wordpress search field where after a button click the input field appear , but this is not working on wordpress. please have a look on my code and please help me to fix what i'm doing wrong.

See Demo JSFIDDLE

Here is my jQuery

```<code>    jQuery(document).ready(function($){
            var submitIcon = $('.searchbox-icon');
            var inputBox = $('.searchbox-input');
            var searchBox = $('.searchbox');
            var isOpen = false;
            submitIcon.click(function(){
                if(isOpen == false){
                    searchBox.addClass('searchbox-open');
                    inputBox.focus();
                    isOpen = true;
                } else {
                    searchBox.removeClass('searchbox-open');
                    inputBox.focusout();
                    isOpen = false;
                }
            });

            submitIcon.mouseup(function(){
                return false;
            });

            searchBox.mouseup(function(){
                return false;
            });

        $(document).mouseup(function(){
            if(isOpen == true){
                $('.searchbox-icon').css('display','block');
                submitIcon.click();
            }
        });
});
function buttonUp(){
    var inputVal = $('.searchbox-input').val();
    inputVal = $.trim(inputVal).length;
    if( inputVal !== 0){
        $('.searchbox-icon').css('display','none');
    } else {
        $('.searchbox-input').val('');
        $('.searchbox-icon').css('display','block');
    }
}
</code>```

答:
I think that there is nothing wrong with your code , you probably just need to enqueue your script properly into Wordpress...

1.) First create folder called js.
Your Theme File structure should look like so:

-index.php

-single.php

-js <-- This is your folder containing custom-search-field.js

-other files.php

2.) Create the file called custom-search-field.js and copy the code you posted to this file. Than add that file to your js folder.

3.) Add code below to your functions.php file

```<code>/**
* Enqueues scripts and styles.
*
*/
function enqueue_js_scripts_and_css() {

wp_enqueue_script( 'jquery' );//Enqueues Jquery that comes with Wordpress
    /*
    * Registers a script file in WordPress to be linked to a page
    * later using the wp_enqueue_script()
    * @link https://developer.wordpress.org/reference/functions/wp_enqueue_script/
    * @link https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts
    */

    wp_register_script( 'custom_search_field', get_template_directory_uri() . '/js/custom-search-field.js', array( 'jquery' ), '1.0', false );

   // Enqueue your custom search field JS file.
    wp_enqueue_script( 'custom_search_field' );
}

add_action( 'wp_enqueue_scripts', 'enqueue_js_scripts_and_css' );
</code>```

Body:
Custom jQuery is not working in wordpress. I am trying to make a custom make wordpress search field where after a button click the input field appear , but this is not working on wordpress. please have a look on my code and please help me to fix what i'm doing wrong.

See Demo JSFIDDLE

Here is my jQuery

    jQuery(document).ready(function($){
            var submitIcon = $('.searchbox-icon');
            var inputBox = $('.searchbox-input');
            var searchBox = $('.searchbox');
            var isOpen = false;
            submitIcon.click(function(){
                if(isOpen == false){
                    searchBox.addClass('searchbox-open');
                    inputBox.focus();
                    isOpen = true;
                } else {
                    searchBox.removeClass('searchbox-open');
                    inputBox.focusout();
                    isOpen = false;
                }
            });

            submitIcon.mouseup(function(){
                return false;
            });

            searchBox.mouseup(function(){
                return false;
            });

        $(document).mouseup(function(){
            if(isOpen == true){
                $('.searchbox-icon').css('display','block');
                submitIcon.click();
            }
        });
});
function buttonUp(){
    var inputVal = $('.searchbox-input').val();
    inputVal = $.trim(inputVal).length;
    if( inputVal !== 0){
        $('.searchbox-icon').css('display','none');
    } else {
        $('.searchbox-input').val('');
        $('.searchbox-icon').css('display','block');
    }
}

Body:
I think that there is nothing wrong with your code , you probably just need to enqueue your script properly into Wordpress...

1.) First create folder called js.
Your Theme File structure should look like so:

-index.php

-single.php

-js <-- This is your folder containing custom-search-field.js

-other files.php

2.) Create the file called custom-search-field.js and copy the code you posted to this file. Than add that file to your js folder.

3.) Add code below to your functions.php file

/**
* Enqueues scripts and styles.
*
*/
function enqueue_js_scripts_and_css() {

wp_enqueue_script( 'jquery' );//Enqueues Jquery that comes with Wordpress
    /*
    * Registers a script file in WordPress to be linked to a page
    * later using the wp_enqueue_script()
    * @link https://developer.wordpress.org/reference/functions/wp_enqueue_script/
    * @link https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts
    */

    wp_register_script( 'custom_search_field', get_template_directory_uri() . '/js/custom-search-field.js', array( 'jquery' ), '1.0', false );

   // Enqueue your custom search field JS file.
    wp_enqueue_script( 'custom_search_field' );
}

add_action( 'wp_enqueue_scripts', 'enqueue_js_scripts_and_css' );


问:
FFmpeg Generate Thumbnail Efficiently
I am using FFmpeg for generating timeline thumbnail preview (image preview when your hover over seekbar in video player , like youtube player)

I need generating thumbnail for every 20s .
Here is code i use :

ffmpeg -i vide.mp4 -vf "fps=4/60 ,scale=260:150,tile=10*10" -qscale:v 10  thumbnail_%d.jpg

Code Work's Fine , only problem i have it's slow , for a movie with 3 hour long it's take more than 6 minute to generate thumbnail.

My System spec : Max os x 10.12 , Core i5 6600 , 16GB Ram.

I want's know there's a better way to do this ?

答:
I think you might be looking for this:
https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video

And more spefically -vframes parameter.

Title: FFmpeg Generate Thumbnail Efficiently


问:
PHP code to generate icons
currently i am working on a huge back-end application in Zend Framework.
A lot of times i end up using wrong icon for some object or action.

My Question
Is there any php code to generate icons automatically????

Ofcourse these icons will not be generated magically, best case scenario is that we have a collection of icons which have the type of.

Object (user,category,product,rss etc)

Action (add,edit,delete,update etc)

This way we can create icons by mixing different types of icons on the fly.

The code for generating a icon to delete user with 32x32 and delete icon in bottom-right corner of the icon.

```
$icon = new Icon();
$icon->object('user')->action('delete');
$icon->action_align('right')->action_valign('bottom');
$icon->action_height(10)->action_width(10);
$icon->height(32)->width(32);
$icon->create();
```

This is just an example that how can we create a icon which was never exited before.

答: You can use GD library to export the images, not in the .ico format but a .bmp will be ok.  With Imagick it seems you can do directly .ico files.</p>

ContentLicense: CC BY-SA 2.5

Title: PHP code to generate icons

Body:
currently i am working on a huge back-end application in Zend Framework.
A lot of times i end up using wrong icon for some object or action.

My Question
Is there any php code to generate icons automatically????

Ofcourse these icons will not be generated magically, best case scenario is that we have a collection of icons which have the type of.

Object (user,category,product,rss etc)

Action (add,edit,delete,update etc)

This way we can create icons by mixing different types of icons on the fly.

The code for generating a icon to delete user with 32x32 and delete icon in bottom-right corner of the icon.

$icon = new Icon();
$icon->object('user')->action('delete');
$icon->action_align('right')->action_valign('bottom');
$icon->action_height(10)->action_width(10);
$icon->height(32)->width(32);
$icon->create();

This is just an example that how can we create a icon which was never exited before.


问:
How to calculate sum of only last elements in list of lists?
I have a simple question, that I hope Python can do easily for me.

I would like to use the sum function on an array.

The array is a little complicated however it has the following structure:

```<code>[[x1,y1,z1],[x2,y2,z2],..]
</code>```

I want to sum up all the z elements:

```<code>sum([[x1,y1,z1],[x2,y2,z2],..]) = z1+z2+...
</code>```

Can I do this?

答:
Let's say you have your list declared as follows:

```<code>myList = [[1,2,3],[4,5,6],[7,8,9],[10,11,12]]
</code>```

There are several ways you can do that, the methods listed below are all equivalent:

```<code>sum(x[-1] for x in myList) # execution time: 0.000125 - 0.00015 (most efficient)

sum(c for a,b,c in myList)  # execution time: 0.000135 - 0.0003

sum(myList[x][-1] for x in range(len(myList))) # exec. time: 0.00017 - 0.00045
</code>```

Body:
I have a simple question, that I hope Python can do easily for me.

I would like to use the sum function on an array.

The array is a little complicated however it has the following structure:

[[x1,y1,z1],[x2,y2,z2],..]

I want to sum up all the z elements:

sum([[x1,y1,z1],[x2,y2,z2],..]) = z1+z2+...

Can I do this?

Body:
Let's say you have your list declared as follows:

myList = [[1,2,3],[4,5,6],[7,8,9],[10,11,12]]

There are several ways you can do that, the methods listed below are all equivalent:

sum(x[-1] for x in myList) # execution time: 0.000125 - 0.00015 (most efficient)

sum(c for a,b,c in myList)  # execution time: 0.000135 - 0.0003

sum(myList[x][-1] for x in range(len(myList))) # exec. time: 0.00017 - 0.00045


问:
How to parse static text in Javascript
I have a String that contains a function as a String. This String is returned by the server:

```<code>var funcStr = "function() {
    console.log('this is a sample function');
}";
</code>```

Is it possible to parse this String to a Function and execute it?

答: Yes, it is possible, but not a good idea. You use eval. This isn't the best to do for reasons too complex and opinion-based to get into here.

Title: How to parse static text in Javascript

Body:
I have a String that contains a function as a String. This String is returned by the server:

var funcStr = "function() {
    console.log('this is a sample function');
}";

Is it possible to parse this String to a Function and execute it?


问:
asp.net MVC adding Multiple classes not giving expected result
Code

C#

```<code> public static class MyClass
    {
        public static object Foo = new { @class = "foo" };
        public static object Barbaz = new { @class = "bar baz" };
    }
</code>```

cshtml

```<code><div @MyClass.Foo></div>
<div @MyClass.Barbaz></div>
</code>```

Desired HTML result

```<code><div class="foo"></div>
<div class="foo bar"></div>
</code>```

Actual HTML result

```<code><div {="" class="foo" }=""></div>
</code>```

(works, but looks wrong)

```<code><div {="" class="bar" baz="" }=""></div>
</code>```

(doesn't work, and looks even more wrong)

How should I declare Foo and Barbaz to achieve my desired result?

答:
class is an html attribute, IMHO, It is not a good idea to render that attribute itself from server using a variable. The value is fine.

Use simple string type which holds just the css class name

```<code>public static class MyClass
{
    public static string Foo =  "foo" ;
    public static string Barbaz = "bar baz" ;
}
</code>```

and the view

```<code><div class="@MyClass.Foo"></div>
</code>```

Your approach in the question, will work with ActionLink helper method call as the mvc framework accepts an anonymous object and build the html attributes from that. You cannot use that as it is with your normal html markup as there is nothing to convert the anonymous object to the corresponding html markup. Although you can write some code to do that, It will make your code messy. Remember , The clean approach is to write readable code (normal html markup as much as you can in the view file). This the whole reason behind the asp net team to bring the new tag helpers so designers can build the page without worrying too much about server code / any magic helper methods etc

I would lean towards avoiding to call magic helper methods in my view code. I prefer to keep it as normal HTML code as much as i can.

Body:
Code

C#

 public static class MyClass
    {
        public static object Foo = new { @class = "foo" };
        public static object Barbaz = new { @class = "bar baz" };
    }

cshtml

Desired HTML result

Actual HTML result

(works, but looks wrong)

(doesn't work, and looks even more wrong)

How should I declare Foo and Barbaz to achieve my desired result?

Body:
class is an html attribute, IMHO, It is not a good idea to render that attribute itself from server using a variable. The value is fine.

Use simple string type which holds just the css class name

public static class MyClass
{
    public static string Foo =  "foo" ;
    public static string Barbaz = "bar baz" ;
}

and the view

<div class="@MyClass.Foo"></div>

Your approach in the question, will work with ActionLink helper method call as the mvc framework accepts an anonymous object and build the html attributes from that. You cannot use that as it is with your normal html markup as there is nothing to convert the anonymous object to the corresponding html markup. Although you can write some code to do that, It will make your code messy. Remember , The clean approach is to write readable code (normal html markup as much as you can in the view file). This the whole reason behind the asp net team to bring the new tag helpers so designers can build the page without worrying too much about server code / any magic helper methods etc

I would lean towards avoiding to call magic helper methods in my view code. I prefer to keep it as normal HTML code as much as i can.


问:
Graphite: series with constant calculation
I have a metric that represents a hit ratio of my DB.

I want a graph showing the miss ratio (1 - hit_ratio)

Is there a way do do that in graphite?

Basically the question is how to calculate:

1 - series with wildcards

答: Try offset(scale(some.series.*, -1), 1).


问:
Selenium Webdriver fails in open Firefox
I was learning how to create a new project using Maven for Selenium Webdriver. I created a pom.xml file and one basic test file containing the test.

Here they are:

pom.xml

```<code><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>CleanSubmission</groupId>
<artifactId>CleanSubmission</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>CleanSubmissions</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.10</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.9</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>3.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.github.yev</groupId>
        <artifactId>screenshot</artifactId>
        <version>0.2</version>
    </dependency>
</dependencies>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.13</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit47</artifactId>
                        <version>2.13</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-testng</artifactId>
                        <version>2.13</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>selenium-maven-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <id>xvfb</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>xvfb</goal>
                        </goals>
                        <configuration>
                            <displayPropertiesFile>2.3</displayPropertiesFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
</code>```

and the Test File:

```<code>import org.junit.After;
import org.junit.Before;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;

public class ClearSubmissionTest  {
    public WebDriver driver;
    String baseUrlAdmin = "http://www.google.pl/";

    @Before
    public void setUp() throws Exception {
        WebDriver driver = new FirefoxDriver();
    }

  @Test
  public void Testno1() throws Exception  {
      driver.get(baseUrlAdmin);
      Thread.sleep(5000);
  }

    @After
    public void tearDown() throws Exception {
        driver.close();
    }
}
</code>```

But somehow there is always an error
java.lang.NullPointerException: null at COS2Clean.CleanSubmissions.ClearSubmissionTest.Testno1(ClearSubmissionTest.java:21) which points to the line driver.get(baseUrlAdmin);.
I was looking for an answer, including updating Selenium, choosing Firefox Webdriver as Binary file, but all methods failed.

As I was debbuging, I can see that the problem is with org.apache.maven.plugin.MojoFailureException instead of my code, therefore something in the pom.xml file must be missing - for now I haven't got any idea what more can be wrong...

答:
Update your CleanSubmissionTest.java file with below code.

```<code>import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class ClearSubmissionTest{
    public WebDriver driver;
    String baseUrlAdmin = "http://www.google.pl/";

    @BeforeTest
    public void setUp() throws Exception {
        driver = new FirefoxDriver();
    }

  @Test
  public void Testno1() throws Exception  {
      driver.get(baseUrlAdmin);
      Thread.sleep(5000);
  }

    @AfterTest
    public void tearDown() throws Exception {
        driver.close();
    }
}
</code>```

If you are still facing any issue, Update your dependencies and plugins with below code and try

```<code><dependencies>

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.9.10</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>3.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.github.yev</groupId>
        <artifactId>screenshot</artifactId>
        <version>0.2</version>
    </dependency>
</dependencies>

<build>
    <pluginManagement>
        <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>java</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.13</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
</code>```

I tested it in my machine its working fine, let me know if it works for you

Body:
I was learning how to create a new project using Maven for Selenium Webdriver. I created a pom.xml file and one basic test file containing the test.

Here they are:

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>CleanSubmission</groupId>
<artifactId>CleanSubmission</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>CleanSubmissions</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.10</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.9</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>3.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.github.yev</groupId>
        <artifactId>screenshot</artifactId>
        <version>0.2</version>
    </dependency>
</dependencies>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.13</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit47</artifactId>
                        <version>2.13</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-testng</artifactId>
                        <version>2.13</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>selenium-maven-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <id>xvfb</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>xvfb</goal>
                        </goals>
                        <configuration>
                            <displayPropertiesFile>2.3</displayPropertiesFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

and the Test File:

import org.junit.After;
import org.junit.Before;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;

public class ClearSubmissionTest  {
    public WebDriver driver;
    String baseUrlAdmin = "http://www.google.pl/";

    @Before
    public void setUp() throws Exception {
        WebDriver driver = new FirefoxDriver();
    }

  @Test
  public void Testno1() throws Exception  {
      driver.get(baseUrlAdmin);
      Thread.sleep(5000);
  }

    @After
    public void tearDown() throws Exception {
        driver.close();
    }
}

But somehow there is always an error
java.lang.NullPointerException: null at COS2Clean.CleanSubmissions.ClearSubmissionTest.Testno1(ClearSubmissionTest.java:21) which points to the line driver.get(baseUrlAdmin);.
I was looking for an answer, including updating Selenium, choosing Firefox Webdriver as Binary file, but all methods failed.

As I was debbuging, I can see that the problem is with org.apache.maven.plugin.MojoFailureException instead of my code, therefore something in the pom.xml file must be missing - for now I haven't got any idea what more can be wrong...

Body:
Update your CleanSubmissionTest.java file with below code.

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class ClearSubmissionTest{
    public WebDriver driver;
    String baseUrlAdmin = "http://www.google.pl/";

    @BeforeTest
    public void setUp() throws Exception {
        driver = new FirefoxDriver();
    }

  @Test
  public void Testno1() throws Exception  {
      driver.get(baseUrlAdmin);
      Thread.sleep(5000);
  }

    @AfterTest
    public void tearDown() throws Exception {
        driver.close();
    }
}

If you are still facing any issue, Update your dependencies and plugins with below code and try

<dependencies>

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.9.10</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>3.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.github.yev</groupId>
        <artifactId>screenshot</artifactId>
        <version>0.2</version>
    </dependency>
</dependencies>

<build>
    <pluginManagement>
        <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>java</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.13</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

I tested it in my machine its working fine, let me know if it works for you


问:
Using a Template Repeater in a Table tag
In my application I have noticed that my template repeater does not get called when inside of a table.  My goal is to use the repeater to complete the data and refresh it as needed.

Markup:

```<code><table>
    <tr>
        <th>Name</th>
        <th>Date Uploaded</th>
        <th>Default</th>
    </tr>
    <template id="themesRows" is="dom-repeat" items="{{themeList}}">
        <tr>
            <td>TEST {{item.name}}</td>
            <td>{{item.dateCreatedUtc}}</td>
            <td>
                <!--<input type="radio" name="default" value="{{item.id}}" selected="{{item.id == model.defaultThemeId}}" />-->
            </td>
            <td>{{index}}</td>
        </tr>
    </template>
</table>
</code>```

Dart:

```<code>class SampleB {
  String name = "";
  String dateCreatedUtc = "";
  int id = 0;
  SampleB(this.id, this.name, this.dateCreatedUtc);
}
</code>```

class MyPolymerElement extends PolymerElement{
     @property List themeList = [];
     MyPolymerElement.created() : super.created();
     attached(){}
   }

答:
This is not necessarily something "broken" in Polymer or your code, rather it is a limitation caused by a "feature" in the browser parser. Since the element hierarchy for table is well defined, browsers have specific parsing rules when they process them. When drilling into a table hierarchy, if the parser comes across a child it does not expect, it produces unexpected results.

It's hard to tell from the excerpt, but I would guess that your repeater is actually working, but the browser is not rendering the rows within the table. If you want to post a complete demo of the issue, I'd be happy to review and amend my answer.

A way around this is to just put an observer on your themeList property. When the value changes, use DOM manipulation to fill or modify the table.

There is some good information about it in the discussion related to this issue: https://github.com/Polymer/polymer/issues/4135

Per the thread, it appears there is a fix that will allow this in the Polymer 2.0 preview release.

Body:
In my application I have noticed that my template repeater does not get called when inside of a table.  My goal is to use the repeater to complete the data and refresh it as needed.

Markup:

        Name
        Date Uploaded
        Default

    <template id="themesRows" is="dom-repeat" items="{{themeList}}">

            TEST {{item.name}}
            {{item.dateCreatedUtc}}

            {{index}}

    </template>

Dart:

class SampleB {
  String name = "";
  String dateCreatedUtc = "";
  int id = 0;
  SampleB(this.id, this.name, this.dateCreatedUtc);
}

class MyPolymerElement extends PolymerElement{
     @property List themeList = [];
     MyPolymerElement.created() : super.created();
     attached(){}
   }


问:
How to transitionTo multiple views using angular ui.router
I'm having some issues with the ui.router.
I've defined what i thought were 3 states that i could flip between

```<code>$stateProvider
        .state('rackOrShelf', {
            url: '/information',
            templateUrl: 'Scripts/html/rackOrShelfPartial.html'
        }).state('door', {
            url: '/information',
            templateUrl: 'Scripts/html/doorPartial.html'
        }).state('frame', {
            url: '/information',
            templateUrl: 'Scripts/html/framePartial.html'
        });
</code>```

I've an html page that defines a header to display common stuff at the top. further down within div i have the ui-view placeholder

the html page defines an ng-controller that does some work and returns a json model, one of the parameters being a

```<code>model.Transiton = 'frame';
</code>```

which i then use to call this.
    $state.transitionTo(model.Transiton);

Problem is if model.Transition = 'rackOrShelf' or 'door' ui.router seems to work fine. but if i do model.Transition = 'frame' i always appear to get the contents of the door templateUrl? Why is this?

this is an SPA too.
and i use $routeProvider

```<code>$routeProvider
      .when("/main", {
          templateUrl: "Scripts/html/main.html",
          controller: "mainController"
      }).when("/information", {
          templateUrl: "Scripts/html/information.html",
          controller: "informationController",
          reloadOnSearch: false
      })
      .otherwise({ redirectTo: "/main" });
</code>```

so here is an update, this seems to work.

```<code>$stateProvider
        .state('empty', {
            template: '<div></div>'
        })
        .state('rackOrShelf', {
            templateUrl: 'Scripts/html/rackOrShelfPartial.html'
        }).state('door', {
            templateUrl: 'Scripts/html/doorPartial.html'
        }).state('frame', {
            templateUrl: 'Scripts/html/framePartial.html'
        }).state('information', {
            url: '/information',
            params: {partial: 'empty'},
            controller: function ($state) {
               $state.go($state.params.partial);
            }
        });
</code>```

And in my angular controller i have something like this.

```<code> $state.transitionTo('information', { partial:<'door' || 'frame' || 'rackOrShelf'> });
</code>```

答:
All three of your states have the exact same URL.  I'm not sure if giving these unique URL's will fix your issue, but it will certainly reduce other issues you might have:

```<code>$stateProvider
    .state('information', {
        abstract: true,
        url: '/information',
        template: '<ui-view />'
    })
        .state('information.rackOrShelf', {
            url: '/rackOrShelf',
            templateUrl: 'Scripts/html/rackOrShelfPartial.html'
        }).state('information.door', {
            url: '/door',
            templateUrl: 'Scripts/html/doorPartial.html'
        }).state('information.frame', {
            url: '/frame',
            templateUrl: 'Scripts/html/framePartial.html'
        });
</code>```

Now you should be able to navigate to /information/door for example, or transition to the state name of information.door

Body:
I'm having some issues with the ui.router.
I've defined what i thought were 3 states that i could flip between

$stateProvider
        .state('rackOrShelf', {
            url: '/information',
            templateUrl: 'Scripts/html/rackOrShelfPartial.html'
        }).state('door', {
            url: '/information',
            templateUrl: 'Scripts/html/doorPartial.html'
        }).state('frame', {
            url: '/information',
            templateUrl: 'Scripts/html/framePartial.html'
        });

I've an html page that defines a header to display common stuff at the top. further down within div i have the ui-view placeholder

the html page defines an ng-controller that does some work and returns a json model, one of the parameters being a

model.Transiton = 'frame';

which i then use to call this.
    $state.transitionTo(model.Transiton);

Problem is if model.Transition = 'rackOrShelf' or 'door' ui.router seems to work fine. but if i do model.Transition = 'frame' i always appear to get the contents of the door templateUrl? Why is this?

this is an SPA too.
and i use $routeProvider

$routeProvider
      .when("/main", {
          templateUrl: "Scripts/html/main.html",
          controller: "mainController"
      }).when("/information", {
          templateUrl: "Scripts/html/information.html",
          controller: "informationController",
          reloadOnSearch: false
      })
      .otherwise({ redirectTo: "/main" });

so here is an update, this seems to work.

$stateProvider
        .state('empty', {
            template: '

'
        })
        .state('rackOrShelf', {
            templateUrl: 'Scripts/html/rackOrShelfPartial.html'
        }).state('door', {
            templateUrl: 'Scripts/html/doorPartial.html'
        }).state('frame', {
            templateUrl: 'Scripts/html/framePartial.html'
        }).state('information', {
            url: '/information',
            params: {partial: 'empty'},
            controller: function ($state) {
               $state.go($state.params.partial);
            }
        });

And in my angular controller i have something like this.

 $state.transitionTo('information', { partial:<'door' || 'frame' || 'rackOrShelf'> });

Body:
All three of your states have the exact same URL.  I'm not sure if giving these unique URL's will fix your issue, but it will certainly reduce other issues you might have:

$stateProvider
    .state('information', {
        abstract: true,
        url: '/information',
        template: '<ui-view />'
    })
        .state('information.rackOrShelf', {
            url: '/rackOrShelf',
            templateUrl: 'Scripts/html/rackOrShelfPartial.html'
        }).state('information.door', {
            url: '/door',
            templateUrl: 'Scripts/html/doorPartial.html'
        }).state('information.frame', {
            url: '/frame',
            templateUrl: 'Scripts/html/framePartial.html'
        });

Now you should be able to navigate to /information/door for example, or transition to the state name of information.door


问:
Displaying more than one Google Map V3 on child templates
I have a problem displaying multiple google maps on child templates. Only first initialized map in the script is displaying, second seems to be ignored.

If I place two maps on one child template everything works fine, but adding second map to an additional template is making second map not working.

base.html:

```<code>{% block body %}
<h1>Base</h1>
{% endblock %}

<script>
function initMap() {
    var uluru = {lat: 12, lng: 23};
    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 6,
      center: uluru
    });

    var uluru2 = {lat: 13, lng: 24};
    var map2 = new google.maps.Map(document.getElementById('map2'), {
      zoom: 6,
      center: uluru2
    });
</code>```

child.html:

```<code>{% extends 'base.html' %}

{% block body %}
<div id="map"></div>
{% endblock %}
</code>```

child2.html:

```<code>{% extends 'base.html' %}

{% block body %}
<div id="map2"></div>
{% endblock %}
</code>```

答:
Unfortunately only solution I found is to split map initialization through child templates.

child.html:

```<code>{% extends 'base.html' %}

{% block body %}
<div id="map"></div>
{% endblock %}

<script>
    function initMap() {
        var uluru = {lat: 12, lng: 23};
        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 6,
          center: uluru
    });
</script>
</code>```

child2.html:

```<code>{% extends 'base.html' %}

{% block body %}
<div id="map2"></div>
{% endblock %}

<script>
    function initMap() {
        var uluru2 = {lat: 13, lng: 24};
        var map2 = new google.maps.Map(document.getElementById('map2'), {
          zoom: 6,
          center: uluru2
    });
</script>
</code>```

Body:
I have a problem displaying multiple google maps on child templates. Only first initialized map in the script is displaying, second seems to be ignored.

If I place two maps on one child template everything works fine, but adding second map to an additional template is making second map not working.

base.html:

{% block body %}

Base

{% endblock %}

Body:
Unfortunately only solution I found is to split map initialization through child templates.

child.html:

{% extends 'base.html' %}

{% block body %}
<div id="map"></div>
{% endblock %}

<script>
    function initMap() {
        var uluru = {lat: 12, lng: 23};
        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 6,
          center: uluru
    });
</script>

child2.html:

{% extends 'base.html' %}

{% block body %}
<div id="map2"></div>
{% endblock %}

<script>
    function initMap() {
        var uluru2 = {lat: 13, lng: 24};
        var map2 = new google.maps.Map(document.getElementById('map2'), {
          zoom: 6,
          center: uluru2
    });
</script>


问:
How to use for loop in class for user inputs?
I have created employee details using class by giving pre defined inputs. I'm not able to store the results into a dict. I need to write it as a csv.   I would be thankful if you could help me, as I'm a novice in python

Here are my codes:

Is it correct way to use for loop in classes?

```<code>class Employee():
    def main(self,name,idno,position,salary):

        self.name=name
        self.idno=idno
        self.position=position
        self.salary = salary

    def input(self):
        n=int(raw_input("Enter the number of employees:"))
        for i in range(n):
            self.name=raw_input("Name:")
            self.idno=raw_input("Idno:")
            self.position=raw_input("position:")
            self.salary=raw_input("salary:")

            print("Name:", self.name, "Idno:", self.idno, "position:", self.position,
                  "salary:", self.salary)

if __name__=='__main__':
        result=Employee()
        result.input()
</code>```

答:
First of all, I don't think you're class will be working like you intend it to. Since you're constantly overwriting the class  variables, there is no point in entering more than one employee, as the class can currently only save information on one employee. I would consider saveing employees as dictionarys and have those dictionaries saved as a list in your Employee(s) class.</p>

```<code>class Employees():
    all_employees = [{...}, {...}]
    dict_keys = ["name", "idno", "position",...]
    def input(self):
        counter = 0
        n = input("Number of employees: ")
        while counter < n:
            new_employee = dict()
            for key in dict_keys:
                new_employee[key] = raw_input("{}: ".format(key))
            all_employees.append(new_employee)

if __name__ == "__main__":
    e = Employees()
    e.input()
</code>```

Body:
I have created employee details using class by giving pre defined inputs. I'm not able to store the results into a dict. I need to write it as a csv.   I would be thankful if you could help me, as I'm a novice in python

Here are my codes:

Is it correct way to use for loop in classes?

class Employee():
    def main(self,name,idno,position,salary):

        self.name=name
        self.idno=idno
        self.position=position
        self.salary = salary

    def input(self):
        n=int(raw_input("Enter the number of employees:"))
        for i in range(n):
            self.name=raw_input("Name:")
            self.idno=raw_input("Idno:")
            self.position=raw_input("position:")
            self.salary=raw_input("salary:")

            print("Name:", self.name, "Idno:", self.idno, "position:", self.position,
                  "salary:", self.salary)

if __name__=='__main__':
        result=Employee()
        result.input()

Body:
First of all, I don't think you're class will be working like you intend it to. Since you're constantly overwriting the class  variables, there is no point in entering more than one employee, as the class can currently only save information on one employee. I would consider saveing employees as dictionarys and have those dictionaries saved as a list in your Employee(s) class.

class Employees():
    all_employees = [{...}, {...}]
    dict_keys = ["name", "idno", "position",...]
    def input(self):
        counter = 0
        n = input("Number of employees: ")
        while counter < n:
            new_employee = dict()
            for key in dict_keys:
                new_employee[key] = raw_input("{}: ".format(key))
            all_employees.append(new_employee)

if __name__ == "__main__":
    e = Employees()
    e.input()


答:
use implode to get that , between the elements.</p>

```<code>echo implode(', ',array_map($allLops, function($tag){return '<a>'.$tag.'</a>'}));
</code>```

Title: Separating while loop tags from each other using (,)

Body:
while($loop = . . . .){
     $loopy = $loop['tag'];
     echo "$loopy";
}

Using this code i get the tags outputted like this

Tag1Tag2Tag3Tag4Tag5Tag6

How do i separate them to be Tag1, Tag2, Tag3, Tag4, Tag5, Tag6

Body:
use implode to get that , between the elements.

echo implode(', ',array_map($allLops, function($tag){return '<a>'.$tag.'</a>'}));


问:
How do I tell TYPO3 what it's URL is when using a reverse proxy?
I have:

A url www.my-website.com

A machine running TYPO3 with some hostname like typo3-website.my.internal.domain.com

A machine running Nginx which uses proxy_pass to send requests from www.my-website.com to typo3-website.my.internal.domain.com

A DNS A record for www.my-website.com pointing to the reverse-proxy machine.

When a backend user is working in the Page module, and they do right-click 'Show' on a page, it tries to open the page at the hostname of the machine TYPO3 is running on.

I want it to open the page under the actual website URL instead.

What setting do I need to change to make this work?

Things I have already tried which did not help:

Setting the trusted hosts pattern

'reverseProxyIP' => '*'

'reverseProxyHeaderMultiValue' => 'last'

答:
I needed to create a domain record. That partially fixed it.

This still leaves problems where images use the wrong URL in the backend.

This means, that, for example, the little dotted lines in the page tree module do not display.

To fix that, I used a clue from this forum thread. I needed to set the HTTP_HOST variable to my domain and send it to PHP fpm:

```<code>location ~ \.php$ {
    try_files $uri = 404;
    include ${pkgs.nginx}/conf/fastcgi.conf;

    fastcgi_pass unix:/var/run/phpfpm/default.sock;
    # Assorted fastcgi_blah
    fastcgi_param HTTP_HOST "www.my-domain.com";
}
</code>```

Body:
I needed to create a domain record. That partially fixed it.

This still leaves problems where images use the wrong URL in the backend.

This means, that, for example, the little dotted lines in the page tree module do not display.

To fix that, I used a clue from this forum thread. I needed to set the HTTP_HOST variable to my domain and send it to PHP fpm:

location ~ \.php$ {
    try_files $uri = 404;
    include ${pkgs.nginx}/conf/fastcgi.conf;

    fastcgi_pass unix:/var/run/phpfpm/default.sock;
    # Assorted fastcgi_blah
    fastcgi_param HTTP_HOST "www.my-domain.com";
}


问:
Concentric Box colliders in Unity
I have two concentric Box Colliders on same GameObject. Outer Box Collider rotates the object (on swiping the screen) and inner Box Collider plays animation when we touch the screen.

But when ray goes from my mobile screen to outer Collider it destroys and does not pass through that collider.

Is there any way to do it?

答:
You could make the outer one a Trigger Collider by checking Is Trigger in the inspector:

and have the inner collider as just a collider. Then you can check the outer one with OnTriggerEnter and the inner one with OnCollisionEnter.

Alternatively you could give them different Tags and check for each Ray hit by checking for the tag (use OnTriggerEnter for this).

```<code>void OnTriggerEnter (Collider other)
{
    if (other.gameObject.tag == "Inner Cube")
    {
        // We have hit the inner cube
    }
    else if (other.gameObject.tag == "Outer Cube")
    {
        // We have hit the outer cube
    }
}
</code>```

Looking at what you want to do in your question though, using 2 concentric colliders is not as good as simply detecting which input action the user performs (tap or swipe) and acting according to that.

Title: Concentric Box colliders in Unity

Body:
You could make the outer one a Trigger Collider by checking Is Trigger in the inspector:

and have the inner collider as just a collider. Then you can check the outer one with OnTriggerEnter and the inner one with OnCollisionEnter.

Alternatively you could give them different Tags and check for each Ray hit by checking for the tag (use OnTriggerEnter for this).

void OnTriggerEnter (Collider other)
{
    if (other.gameObject.tag == "Inner Cube")
    {
        // We have hit the inner cube
    }
    else if (other.gameObject.tag == "Outer Cube")
    {
        // We have hit the outer cube
    }
}

Looking at what you want to do in your question though, using 2 concentric colliders is not as good as simply detecting which input action the user performs (tap or swipe) and acting according to that.


答:
You can make an array then implode it, like so:</p>

```<code>$loopArr = array();
while($loop = . . . .){
     $loopArr[] = "<a>{$loop['tag']}</a>";
}
echo implode(', ',$loopArr);
</code>```

Body:
You can make an array then implode it, like so:

$loopArr = array();
while($loop = . . . .){
     $loopArr[] = "<a>{$loop['tag']}</a>";
}
echo implode(', ',$loopArr);


问:
UI of sign in with LinkedIn SDK is broken
I have implemented a solution to sign in to my app with a LinkedIn account. When the user clicks on that option the LinkedIn SDK checks for the existence of the native LinkedIn app. If the app exists, the user gets redirected to the LinkedIn app where he is asked if he wants to allow my application to have access to the profile overview and email address.

Unfortunately this view is broken, see screenshots below (the first one taken from an iPhone 6, the second one from an iPhone 6s). Since this is part of the LinkedIn app there is no way for me to fix it. I have implemented the LinkedIn SDK 6 months ago and have not touched it since. The broken view must be rather new.

Could you please tell me what causes this and can you fix it? As you can see on the second screenshot, there is no way the user knows where to "accept", so this is crucial.

答:
We had the same problem. We fixed it by updating the "Application Logo" inside the Developer console for LinkedIn.

If you go the your app -> Settings -> There is an "Application Logo" input, which showed an error before which gave us that white overlay. After adding a complete white square PNG image the white overlay disappeared.


问:
how to create Mschart in VB6?
How can i retrieve data from database and display in chart format using MSChart in visual basic6.(Not in VB .NET).??? pls pls.... send me d answer...</p>

答:
Have a look at the following example code:
Display Data on a Chart Using MSChart control: Demo.

It's compatible with VB5 and 6

There is a nice tutorial on handling the difficulties (and getting started) with the chart control in VB6 here: Microsoft Chart - A How To Guide For Handling The VB 6 Charting Beast

Title: how to create Mschart in VB6?