问:
transformClassesWithDesugar build error after updating to AS 3.0 Canary 6
I updated to Android Studio 3.0 Canary 6 and am now getting following error (had been on Canary 5).  I've searched for people seeing similar issues but no luck so far.  Anyone else seeing anything like this?  (note fwiw that project includes some Kotlin code)

```<code>Exception in thread "main" java.lang.IllegalArgumentException
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
    at com.google.devtools.build.android.desugar.DefaultMethodClassFixer$DefaultMethodFinder.visit(DefaultMethodClassFixer.java:295)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:173)
    at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:75)
    at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
    at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:77)
    at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
    at com.google.devtools.build.android.desugar.LambdaDesugaring.visitEnd(LambdaDesugaring.java:137)
    at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
    at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:368)
    at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:297)
    at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:251)
    at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:543)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDesugarForCustomDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.google.devtools.build.android.desugar.Desugar with arguments {--input /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-auth-11.0.1.aar/91f94c8cb7e863a526130efb6853f44d/jars/classes.jar --output /Users/jooreill/devroot/github.com/augerlabs/android/app/build/intermediates/transforms/desugar/custom/debug/74.jar --input /Users/jooreill/devroot/github.com/augerlabs/android/app/build/tmp/kotlin-classes/customDebug --output /Users/jooreill/devroot/github.com/augerlabs/android/app/build/intermediates/transforms/desugar/custom/debug/104 --classpath_entry /Users/jooreill/devroot/github.com/augerlabs/android/app/libs/Vuforia.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/multidex-1.0.1.aar/68aa367bb1e87f4c04d0e8096afbe360/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/rxlifecycle-components-0.6.1.aar/b837126d50eda35a238e7bd86cc1c425/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/sectionedrecyclerviewadapter-1.0.4.aar/f4c62ec6b68561c4c8f2e0a5ec0d80d9/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/exomedia-3.1.1.aar/66adb78bc9c4c7786a58a994c00a5ef8/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/playlistcore-1.1.1.aar/49d1cb56d61981c150fcde68d63144bf/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/PanoramaImageView-1.0.aar/1c32f8cf1813084b859814da32240f8e/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/facebook-android-sdk-4.18.0.aar/92ff51227982206289a7eff19a88041a/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/sparkbutton-1.0.0.aar/5487c596f92c0fa9837a90297f6e3855/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/dexter-2.3.1.aar/a4ef168e02436f01282cf4d1d6b39115/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/algoliasearch-android-3.5.aar/198199df4a842a59c23abc3be195b0c3/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-ui-auth-2.0.1.aar/e649eadac02602bd44077d02205a69da/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/design-26.0.0-beta2.aar/443b130b797612ac88bab855035932ec/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.0.0-beta2.aar/85f6ae44a239c549b0042f86bb3779c9/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/recyclerview-v7-26.0.0-beta2.aar/db8b12f40c909a751a361300ace3e62c/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/cardview-v7-26.0.0-beta2.aar/18111878d92e05ebcf30f4ffebc5865a/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/palette-v7-26.0.0-beta2.aar/26eee6a40e9f2e65d1ebcd11de343be2/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/percent-26.0.0-beta2.aar/f3770d7d087221317999746fbad190c6/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-v13-26.0.0-beta2.aar/00f89973d57b4060ff2f1d93e208ccfe/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/rxlifecycle-0.6.1.aar/10994c956dc569d4685b2653d4d5fae3/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.retrofit2/adapter-rxjava/2.3.0/43e4ac24adc40a24c51b2d2a71a2483ef1b0ce9a/adapter-rxjava-2.3.0.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/rxbinding-0.4.0.aar/d267b21156fab2ff1e4b01d8be62cc26/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/rxandroid-1.1.0.aar/a051ff597c8879651794b4cdbc0288c4/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/io.reactivex/rxjava/1.3.0/af000bec2036a2a9d07197c4b03b8966bfc60b03/rxjava-1.3.0.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/keen-client-api-android-5.0.0.aar/3bce97b05132f7845a1ab1f10afcb558/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/io.keen/keen-client-java-core/5.0.0/59493e952e1a94a95edb10d0782073a808b11dda/keen-client-java-core-5.0.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.retrofit2/converter-gson/2.1.0/aa557d71ead91cbf26e0c316a0f593d168303309/converter-gson-2.1.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.stripe/stripe-java/3.5.0/1f94c8eb165e072da47469763ee74697a0acc45/stripe-java-3.5.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.7/751f548c85fa49f330cecbb1875893f971b33c4e/gson-2.7.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-core-11.0.2.aar/1456345113dac43ee724779c29328038/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-auth-11.0.2.aar/c70c35e8ea85ce516b6c3f75081beeae/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-database-11.0.2.aar/019fc1af21f35dbcae07f3c32e51da4d/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-ads-11.0.2.aar/4f4342cdae105a0dd435afb6fdded11e/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-storage-11.0.2.aar/0ce3385d91297486d9d18491fcd7bdfb/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-perf-11.0.2.aar/a1118b79fb1ab9d666cd22c04ef97fb4/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-nearby-11.0.2.aar/c1352daa47f550373137c81a4d012011/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-location-11.0.2.aar/19c93a0e7b4bf3b50cdfa7bd03425fb6/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-places-11.0.2.aar/97958df271160b9519d81b9e736ebffd/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-ads-11.0.2.aar/ec8c559dacb5e77a10ef26f8af9f775f/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-wallet-11.0.2.aar/2c9885a2c6f92a87da5726ef00d9b791/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-maps-11.0.2.aar/ffb05e8c61aae5a9890121a5260c3bd4/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-messaging-11.0.2.aar/4203fd3298aebb953e7bcbdf6de1a7f1/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/geofire-android-2.1.1.aar/0730cae841e0b48759c9e73bd61703dc/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.github.frankiesardo/auto-parcel/0.3.1/501393158454717fef27cba8d177f32a158b8955/auto-parcel-0.3.1.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/fab-1.6.4.aar/7212a5bdd8292a8b6c037de62901dad0/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/library-0.1.0.aar/3b8e7bd6f4901a48a4dd7524a77dd050/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/library-1.14.5.aar/bc42266211a8af8995b53d85405aa8d1/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.jakewharton.picasso/picasso2-okhttp3-downloader/1.1.0/f4f77eb62269c977c154765cd01587eda6488273/picasso2-okhttp3-downloader-1.1.0.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/picasso-2.6.0-SNAPSHOT.aar/cd8241d302a30d8e44f003957abe6fcd/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/logging-interceptor/3.8.1/feab46062803513d6a8307c74b0084265855de1a/logging-interceptor-3.8.1.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.retrofit2/converter-simplexml/2.1.0/a71c37fa341165df2c61ba93f549c4ceeb98d6c8/converter-simplexml-2.1.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.retrofit2/converter-scalars/2.2.0/6303d085f1da877f8cd49ae36ffc49db2ab59f4f/converter-scalars-2.2.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.retrofit2/retrofit/2.3.0/bcacde6a8ccedcc56c127403d26b76072fe6214d/retrofit-2.3.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.8.1/4d060ca3190df0eda4dc13415532a12e15ca5f11/okhttp-3.8.1.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/stripe-android-2.0.2.aar/c5141a307a57062e90ac3143c6ab840e/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/CreditCardEntry-1.4.7.aar/6c1f2245cd13b6456abbe1db7523ae92/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/subsampling-scale-image-view-3.6.0.aar/f33292a13dc086e2c26ee39cf475d441/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/logger-1.15.aar/ba11ecde0536ba3c63baee07f741eeb2/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/butterknife-8.1.0.aar/14f95240c51be6ae0e4b30b441e1e072/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/org.parceler/parceler-api/1.1.5/23114b381811fd7c8e7aeeef4b845453c4a16a1d/parceler-api-1.1.5.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.google.dagger/dagger/2.11/95037eaee68aa48021511972e9db9ba29916e1c9/dagger-2.11.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/javax.inject/javax.inject/1/6975da39a7040257bd51d21a231b76c915872d38/javax.inject-1.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/circleimageview-2.1.0.aar/ada098152b74016aebbd5531cbc53a97/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/sensey-1.5.1.aar/120dcf19c7af70566c1e6034bd06dd7c/jars/classes.jar --classpath_entry /Applications/Android Studio 3.0 Preview.app/Contents/gradle/m2repository/org/jetbrains/kotlin/kotlin-stdlib-jre7/1.1.3/kotlin-stdlib-jre7-1.1.3.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/leakcanary-android-no-op-1.4-beta2.aar/d9c41f6620c59ecc1efc1441ab22cacf/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/transition-26.0.0-beta2.aar/49967477f2d9b139f09ab64243b29feb/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-analytics-11.0.2.aar/b9f99b28c939c9281283c83fa42cc502/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-database-connection-11.0.2.aar/d46c72d2358a6dbaa676463838ecd09e/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-analytics-impl-11.0.2.aar/0c7c1375133af1be0732ac655755c2a0/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-iid-11.0.2.aar/b3b8d37b9ff5aa5a3399308eb163af3d/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-common-11.0.2.aar/f5b64bfd58ae9fc3c3380058266cd0cc/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-storage-common-11.0.2.aar/8c5100f81e0fb83f86749ca7edcd7f91/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-clearcut-11.0.2.aar/1613c21966e70b3b40dc28c82691ca60/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-auth-11.0.1.aar/91f94c8cb7e863a526130efb6853f44d/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-ads-lite-11.0.2.aar/70739be26dd6304c5476c124e1bb42da/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-gass-11.0.2.aar/dc4ce6c2d751fea4570147371ae89ab1/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-safetynet-11.0.2.aar/3c14df4b551b9f1c3529a265b4fdd1fa/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-identity-11.0.2.aar/7669a5b00b557b38008903f58bdfa30c/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-auth-base-11.0.1.aar/f7831dc23098b7eca63174e21b2b158b/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-base-11.0.2.aar/b85f6c3ac50ec082b12279297db79f9c/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-tasks-11.0.2.aar/ff81c84f960df823ea12f5a438e69cb7/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-basement-11.0.2.aar/83390a7dea9ab6de3bab0eb0751b7ea3/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-v4-26.0.0-beta2.aar/02671b0a370bbef222f758a3a6b38d94/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-fragment-26.0.0-beta2.aar/9552b19b582bc7a684288e5dda3f43b5/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-core-utils-26.0.0-beta2.aar/00ea0c38297044d75233565dc1264fd9/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.jakewharton/butterknife-annotations/8.1.0/d6854f42bfb4098d3d2358d93201307b9f1cc95d/butterknife-annotations-8.1.0.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/animated-vector-drawable-26.0.0-beta2.aar/52e85379769487743c9b387447d9dff9/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-vector-drawable-26.0.0-beta2.aar/3e737cabee81b1671b4a105c4ad31f7e/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-core-ui-26.0.0-beta2.aar/29abff85aa019fc24831cef84f9324a9/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-media-compat-26.0.0-beta2.aar/d5186b266d43e0447cd462047d1ea51a/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/customtabs-25.3.1.aar/48cae1d0acef708f5eed6c876f435e45/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-compat-26.0.0-beta2.aar/cebf7b16037936cf8f05d4a525a708e3/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.android.support/support-annotations/26.0.0-beta2/e5ef6e4822404221c9b03dff0d31e4810ac3fb0d/support-annotations-26.0.0-beta2.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/exoplayer-r1.5.13.aar/103ac5dc77a294269ba54351d068e840/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/answers-shim-0.0.4.aar/d27c0187463e098c046954469f448d0f/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/org.simpleframework/simple-xml/2.7.1/dd91fb744c2ff921407475cb29a1e3fee397d411/simple-xml-2.7.1.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.parse.bolts/bolts-android/1.4.0/cc174c559b5177982887bf6e1b76003aebad9516/bolts-android-1.4.0.jar --classpath_entry /Applications/Android Studio 3.0 Preview.app/Contents/gradle/m2repository/org/jetbrains/kotlin/kotlin-stdlib/1.1.3/kotlin-stdlib-1.1.3.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.parse.bolts/bolts-applinks/1.4.0/8ad21bf21784dacce5f2043afb97218cc377e835/bolts-applinks-1.4.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.parse.bolts/bolts-tasks/1.4.0/d85884acf6810a3bbbecb587f239005cbc846dc4/bolts-tasks-1.4.0.jar --classpath_entry /Applications/Android Studio 3.0 Preview.app/Contents/gradle/m2repository/org/jetbrains/annotations/13.0/annotations-13.0.jar --classpath_entry /Users/jooreill/devroot/github.com/augerlabs/android/app/build/intermediates/classes/custom/debug --classpath_entry /Users/jooreill/devroot/github.com/augerlabs/android/app/build/tmp/kotlin-classes/customDebug --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/javax.annotation/jsr250-api/1.0/5025422767732a1ab45d93abfea846513d742dcf/jsr250-api-1.0.jar --bootclasspath_entry /Users/jooreill/Library/Android/sdk_2.2/platforms/android-26/android.jar --bootclasspath_entry /Users/jooreill/Library/Android/sdk_2.2/platforms/android-26/optional/org.apache.http.legacy.jar --bootclasspath_entry /Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/resources.jar --bootclasspath_entry /Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/rt.jar --bootclasspath_entry /Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/jsse.jar --bootclasspath_entry /Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/jce.jar --bootclasspath_entry /Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/charsets.jar --min_sdk_version 17 --desugar_try_with_resources_if_needed --desugar_try_with_resources_omit_runtime_classes}
</code>```

Seems to be somehow related to use of following in build.gradle

```<code>compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
</code>```

UPDATE:
Looks like this is related to use of Play Services v11.0.2.  If I revert to 11.0.1 then I don't see this issue

UPDATE (July 18th):
Still seeing this issue with Canary 7

UPDATE (July 25th):
Still seeing this issue with Canary 8 (again when using Play Services v11.0.2 ....ok with 11.0.1)

答: For me, it happened with AS3.0 stable, with classfiles from previous beta version. The solution was to do a Build -> Clean Project.

Body:
I updated to Android Studio 3.0 Canary 6 and am now getting following error (had been on Canary 5).  I've searched for people seeing similar issues but no luck so far.  Anyone else seeing anything like this?  (note fwiw that project includes some Kotlin code)

Exception in thread "main" java.lang.IllegalArgumentException
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
    at com.google.devtools.build.android.desugar.DefaultMethodClassFixer$DefaultMethodFinder.visit(DefaultMethodClassFixer.java:295)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:173)
    at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:75)
    at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
    at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:77)
    at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
    at com.google.devtools.build.android.desugar.LambdaDesugaring.visitEnd(LambdaDesugaring.java:137)
    at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
    at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:368)
    at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:297)
    at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:251)
    at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:543)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDesugarForCustomDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.google.devtools.build.android.desugar.Desugar with arguments {--input /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-auth-11.0.1.aar/91f94c8cb7e863a526130efb6853f44d/jars/classes.jar --output /Users/jooreill/devroot/github.com/augerlabs/android/app/build/intermediates/transforms/desugar/custom/debug/74.jar --input /Users/jooreill/devroot/github.com/augerlabs/android/app/build/tmp/kotlin-classes/customDebug --output /Users/jooreill/devroot/github.com/augerlabs/android/app/build/intermediates/transforms/desugar/custom/debug/104 --classpath_entry /Users/jooreill/devroot/github.com/augerlabs/android/app/libs/Vuforia.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/multidex-1.0.1.aar/68aa367bb1e87f4c04d0e8096afbe360/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/rxlifecycle-components-0.6.1.aar/b837126d50eda35a238e7bd86cc1c425/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/sectionedrecyclerviewadapter-1.0.4.aar/f4c62ec6b68561c4c8f2e0a5ec0d80d9/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/exomedia-3.1.1.aar/66adb78bc9c4c7786a58a994c00a5ef8/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/playlistcore-1.1.1.aar/49d1cb56d61981c150fcde68d63144bf/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/PanoramaImageView-1.0.aar/1c32f8cf1813084b859814da32240f8e/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/facebook-android-sdk-4.18.0.aar/92ff51227982206289a7eff19a88041a/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/sparkbutton-1.0.0.aar/5487c596f92c0fa9837a90297f6e3855/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/dexter-2.3.1.aar/a4ef168e02436f01282cf4d1d6b39115/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/algoliasearch-android-3.5.aar/198199df4a842a59c23abc3be195b0c3/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-ui-auth-2.0.1.aar/e649eadac02602bd44077d02205a69da/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/design-26.0.0-beta2.aar/443b130b797612ac88bab855035932ec/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.0.0-beta2.aar/85f6ae44a239c549b0042f86bb3779c9/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/recyclerview-v7-26.0.0-beta2.aar/db8b12f40c909a751a361300ace3e62c/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/cardview-v7-26.0.0-beta2.aar/18111878d92e05ebcf30f4ffebc5865a/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/palette-v7-26.0.0-beta2.aar/26eee6a40e9f2e65d1ebcd11de343be2/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/percent-26.0.0-beta2.aar/f3770d7d087221317999746fbad190c6/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-v13-26.0.0-beta2.aar/00f89973d57b4060ff2f1d93e208ccfe/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/rxlifecycle-0.6.1.aar/10994c956dc569d4685b2653d4d5fae3/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.retrofit2/adapter-rxjava/2.3.0/43e4ac24adc40a24c51b2d2a71a2483ef1b0ce9a/adapter-rxjava-2.3.0.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/rxbinding-0.4.0.aar/d267b21156fab2ff1e4b01d8be62cc26/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/rxandroid-1.1.0.aar/a051ff597c8879651794b4cdbc0288c4/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/io.reactivex/rxjava/1.3.0/af000bec2036a2a9d07197c4b03b8966bfc60b03/rxjava-1.3.0.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/keen-client-api-android-5.0.0.aar/3bce97b05132f7845a1ab1f10afcb558/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/io.keen/keen-client-java-core/5.0.0/59493e952e1a94a95edb10d0782073a808b11dda/keen-client-java-core-5.0.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.retrofit2/converter-gson/2.1.0/aa557d71ead91cbf26e0c316a0f593d168303309/converter-gson-2.1.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.stripe/stripe-java/3.5.0/1f94c8eb165e072da47469763ee74697a0acc45/stripe-java-3.5.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.7/751f548c85fa49f330cecbb1875893f971b33c4e/gson-2.7.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-core-11.0.2.aar/1456345113dac43ee724779c29328038/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-auth-11.0.2.aar/c70c35e8ea85ce516b6c3f75081beeae/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-database-11.0.2.aar/019fc1af21f35dbcae07f3c32e51da4d/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-ads-11.0.2.aar/4f4342cdae105a0dd435afb6fdded11e/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-storage-11.0.2.aar/0ce3385d91297486d9d18491fcd7bdfb/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-perf-11.0.2.aar/a1118b79fb1ab9d666cd22c04ef97fb4/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-nearby-11.0.2.aar/c1352daa47f550373137c81a4d012011/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-location-11.0.2.aar/19c93a0e7b4bf3b50cdfa7bd03425fb6/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-places-11.0.2.aar/97958df271160b9519d81b9e736ebffd/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-ads-11.0.2.aar/ec8c559dacb5e77a10ef26f8af9f775f/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-wallet-11.0.2.aar/2c9885a2c6f92a87da5726ef00d9b791/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-maps-11.0.2.aar/ffb05e8c61aae5a9890121a5260c3bd4/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-messaging-11.0.2.aar/4203fd3298aebb953e7bcbdf6de1a7f1/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/geofire-android-2.1.1.aar/0730cae841e0b48759c9e73bd61703dc/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.github.frankiesardo/auto-parcel/0.3.1/501393158454717fef27cba8d177f32a158b8955/auto-parcel-0.3.1.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/fab-1.6.4.aar/7212a5bdd8292a8b6c037de62901dad0/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/library-0.1.0.aar/3b8e7bd6f4901a48a4dd7524a77dd050/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/library-1.14.5.aar/bc42266211a8af8995b53d85405aa8d1/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.jakewharton.picasso/picasso2-okhttp3-downloader/1.1.0/f4f77eb62269c977c154765cd01587eda6488273/picasso2-okhttp3-downloader-1.1.0.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/picasso-2.6.0-SNAPSHOT.aar/cd8241d302a30d8e44f003957abe6fcd/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/logging-interceptor/3.8.1/feab46062803513d6a8307c74b0084265855de1a/logging-interceptor-3.8.1.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.retrofit2/converter-simplexml/2.1.0/a71c37fa341165df2c61ba93f549c4ceeb98d6c8/converter-simplexml-2.1.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.retrofit2/converter-scalars/2.2.0/6303d085f1da877f8cd49ae36ffc49db2ab59f4f/converter-scalars-2.2.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.retrofit2/retrofit/2.3.0/bcacde6a8ccedcc56c127403d26b76072fe6214d/retrofit-2.3.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.8.1/4d060ca3190df0eda4dc13415532a12e15ca5f11/okhttp-3.8.1.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/stripe-android-2.0.2.aar/c5141a307a57062e90ac3143c6ab840e/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/CreditCardEntry-1.4.7.aar/6c1f2245cd13b6456abbe1db7523ae92/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/subsampling-scale-image-view-3.6.0.aar/f33292a13dc086e2c26ee39cf475d441/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/logger-1.15.aar/ba11ecde0536ba3c63baee07f741eeb2/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/butterknife-8.1.0.aar/14f95240c51be6ae0e4b30b441e1e072/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/org.parceler/parceler-api/1.1.5/23114b381811fd7c8e7aeeef4b845453c4a16a1d/parceler-api-1.1.5.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.google.dagger/dagger/2.11/95037eaee68aa48021511972e9db9ba29916e1c9/dagger-2.11.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/javax.inject/javax.inject/1/6975da39a7040257bd51d21a231b76c915872d38/javax.inject-1.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/circleimageview-2.1.0.aar/ada098152b74016aebbd5531cbc53a97/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/sensey-1.5.1.aar/120dcf19c7af70566c1e6034bd06dd7c/jars/classes.jar --classpath_entry /Applications/Android Studio 3.0 Preview.app/Contents/gradle/m2repository/org/jetbrains/kotlin/kotlin-stdlib-jre7/1.1.3/kotlin-stdlib-jre7-1.1.3.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/leakcanary-android-no-op-1.4-beta2.aar/d9c41f6620c59ecc1efc1441ab22cacf/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/transition-26.0.0-beta2.aar/49967477f2d9b139f09ab64243b29feb/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-analytics-11.0.2.aar/b9f99b28c939c9281283c83fa42cc502/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-database-connection-11.0.2.aar/d46c72d2358a6dbaa676463838ecd09e/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-analytics-impl-11.0.2.aar/0c7c1375133af1be0732ac655755c2a0/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-iid-11.0.2.aar/b3b8d37b9ff5aa5a3399308eb163af3d/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-common-11.0.2.aar/f5b64bfd58ae9fc3c3380058266cd0cc/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/firebase-storage-common-11.0.2.aar/8c5100f81e0fb83f86749ca7edcd7f91/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-clearcut-11.0.2.aar/1613c21966e70b3b40dc28c82691ca60/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-auth-11.0.1.aar/91f94c8cb7e863a526130efb6853f44d/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-ads-lite-11.0.2.aar/70739be26dd6304c5476c124e1bb42da/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-gass-11.0.2.aar/dc4ce6c2d751fea4570147371ae89ab1/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-safetynet-11.0.2.aar/3c14df4b551b9f1c3529a265b4fdd1fa/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-identity-11.0.2.aar/7669a5b00b557b38008903f58bdfa30c/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-auth-base-11.0.1.aar/f7831dc23098b7eca63174e21b2b158b/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-base-11.0.2.aar/b85f6c3ac50ec082b12279297db79f9c/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-tasks-11.0.2.aar/ff81c84f960df823ea12f5a438e69cb7/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/play-services-basement-11.0.2.aar/83390a7dea9ab6de3bab0eb0751b7ea3/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-v4-26.0.0-beta2.aar/02671b0a370bbef222f758a3a6b38d94/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-fragment-26.0.0-beta2.aar/9552b19b582bc7a684288e5dda3f43b5/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-core-utils-26.0.0-beta2.aar/00ea0c38297044d75233565dc1264fd9/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.jakewharton/butterknife-annotations/8.1.0/d6854f42bfb4098d3d2358d93201307b9f1cc95d/butterknife-annotations-8.1.0.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/animated-vector-drawable-26.0.0-beta2.aar/52e85379769487743c9b387447d9dff9/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-vector-drawable-26.0.0-beta2.aar/3e737cabee81b1671b4a105c4ad31f7e/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-core-ui-26.0.0-beta2.aar/29abff85aa019fc24831cef84f9324a9/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-media-compat-26.0.0-beta2.aar/d5186b266d43e0447cd462047d1ea51a/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/customtabs-25.3.1.aar/48cae1d0acef708f5eed6c876f435e45/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/support-compat-26.0.0-beta2.aar/cebf7b16037936cf8f05d4a525a708e3/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.android.support/support-annotations/26.0.0-beta2/e5ef6e4822404221c9b03dff0d31e4810ac3fb0d/support-annotations-26.0.0-beta2.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/exoplayer-r1.5.13.aar/103ac5dc77a294269ba54351d068e840/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/transforms-1/files-1.1/answers-shim-0.0.4.aar/d27c0187463e098c046954469f448d0f/jars/classes.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/org.simpleframework/simple-xml/2.7.1/dd91fb744c2ff921407475cb29a1e3fee397d411/simple-xml-2.7.1.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.parse.bolts/bolts-android/1.4.0/cc174c559b5177982887bf6e1b76003aebad9516/bolts-android-1.4.0.jar --classpath_entry /Applications/Android Studio 3.0 Preview.app/Contents/gradle/m2repository/org/jetbrains/kotlin/kotlin-stdlib/1.1.3/kotlin-stdlib-1.1.3.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.parse.bolts/bolts-applinks/1.4.0/8ad21bf21784dacce5f2043afb97218cc377e835/bolts-applinks-1.4.0.jar --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/com.parse.bolts/bolts-tasks/1.4.0/d85884acf6810a3bbbecb587f239005cbc846dc4/bolts-tasks-1.4.0.jar --classpath_entry /Applications/Android Studio 3.0 Preview.app/Contents/gradle/m2repository/org/jetbrains/annotations/13.0/annotations-13.0.jar --classpath_entry /Users/jooreill/devroot/github.com/augerlabs/android/app/build/intermediates/classes/custom/debug --classpath_entry /Users/jooreill/devroot/github.com/augerlabs/android/app/build/tmp/kotlin-classes/customDebug --classpath_entry /Users/jooreill/.gradle/caches/modules-2/files-2.1/javax.annotation/jsr250-api/1.0/5025422767732a1ab45d93abfea846513d742dcf/jsr250-api-1.0.jar --bootclasspath_entry /Users/jooreill/Library/Android/sdk_2.2/platforms/android-26/android.jar --bootclasspath_entry /Users/jooreill/Library/Android/sdk_2.2/platforms/android-26/optional/org.apache.http.legacy.jar --bootclasspath_entry /Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/resources.jar --bootclasspath_entry /Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/rt.jar --bootclasspath_entry /Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/jsse.jar --bootclasspath_entry /Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/jce.jar --bootclasspath_entry /Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/charsets.jar --min_sdk_version 17 --desugar_try_with_resources_if_needed --desugar_try_with_resources_omit_runtime_classes}

Seems to be somehow related to use of following in build.gradle

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

UPDATE:
Looks like this is related to use of Play Services v11.0.2.  If I revert to 11.0.1 then I don't see this issue

UPDATE (July 18th):
Still seeing this issue with Canary 7

UPDATE (July 25th):
Still seeing this issue with Canary 8 (again when using Play Services v11.0.2 ....ok with 11.0.1)


来源: stackexchange

问:
Why does bash use/need so many input redirect symbols?
I am curious as to the nature and purpose of using multiple "<" characters to satisfy certain bash redirections.  When is each of the <, <<, <<<, syntax correct/preferred?  And under what conditions?  Shouldn't a single "<" be sufficient for a properly written command, function, or subroutine?  In unix 'everything' is a file.  So why mask this with process-substitution?  Isn't that already just a mask for the natural (grouping) capability of any shell?  Or in some cases just a matter of proper order of execution?

Efficiency and performance always have trade-offs, as do ease of read/write ability or ease of usability.  I'm an old dog trying to learn new tricks.  10 lines of code I understand, to perform the same task as one line of code that I do not understand, is worth the trade-off to me.  In my years of scripting, I have had very few situations require writing to non-volatile storage, unless it was intended to be left there ""permanently.

I have not seen such reference for output.  A single ">" will create/overwrite a file.  A double ">>" will create/append a file.  Is there a ">>>" for output too?  This is a redundant question.  I am only interested in the input redirect.

答:
In simple words, they all have different meanings.

< Redirection of input

<< Here Document

<<< Here String (variant of here document)

Examples

< Redirection of input

```<code>grep foo < a-file.txt
</code>```

This redirects the contents of a-file.txt to grep's standard input. grep searches for occurrences of string 'foo' in file a-file.txt.

<< Here Document

```<code>grep foo <<EOF
foo
foobar
baz
bar
EOF
</code>```

Notice the EOF right after << and in the last line. From man bash:

This type of redirection instructs the shell to read input from the current source until a line containing only delimiter (with no trailing  blanks) is seen.

So effectively, grep gets the string enclosed by the two EOFs as input.

<<< Here String (variant of here document)

```<code>grep foo <<<"foobar"
</code>```

You could see this as a "single line" here document (<<). grep gets the string "foobar" as input.

Shouldn't a single "<" be sufficient for a properly written command, function, or subroutine?

So, which variant is the correct one to use depends on your use case and is indepent from the command you're using, as your shell (most likely bash) will take care of them.

I recommend section 3.6 Redirection of bash's manual for further reading. The sections concerning <, << and <<< are 3.6.1, 3.6.6, 3.6.7: https://www.gnu.org/software/bash/manual/bash.html#Redirections

ContentLicense: CC BY-SA 3.0

Body:
In simple words, they all have different meanings.

< Redirection of input

<< Here Document

<<< Here String (variant of here document)

Examples

< Redirection of input

grep foo < a-file.txt

This redirects the contents of a-file.txt to grep's standard input. grep searches for occurrences of string 'foo' in file a-file.txt.

<< Here Document

grep foo <<EOF
foo
foobar
baz
bar
EOF

Notice the EOF right after << and in the last line. From man bash:

This type of redirection instructs the shell to read input from the current source until a line containing only delimiter (with no trailing  blanks) is seen.

So effectively, grep gets the string enclosed by the two EOFs as input.

<<< Here String (variant of here document)

grep foo <<<"foobar"

You could see this as a "single line" here document (<<). grep gets the string "foobar" as input.

Shouldn't a single "<" be sufficient for a properly written command, function, or subroutine?

So, which variant is the correct one to use depends on your use case and is indepent from the command you're using, as your shell (most likely bash) will take care of them.

I recommend section 3.6 Redirection of bash's manual for further reading. The sections concerning <, << and <<< are 3.6.1, 3.6.6, 3.6.7: https://www.gnu.org/software/bash/manual/bash.html#Redirections


问:
How to condition a variable so that it takes all values within IN clause
I'm very hesitant and I have not gotten solutions, so I turn here.
Quickly explain, suppose I want to filter a query as follows:

```<code>SELECT name FROM students WHERE courseCode IN (17, 18, 19);
</code>```

Here I will get the students who are enrolled in courses 17 or 18 or 19.

Now, how would you get the students who are enrolled in those 3 courses? That is, in 17 and 18 and 19?

Maybe it can be simple when you know what the "courseCode" values are, but how would you do it when you get those values with a subquery?

Something like this:

```<code>SELECT name FROM students WHERE courseCode = 17 and courseCode = 18 and courseCode = 19;
</code>```

when I know the values (This is not correct)

but how would I do when I do not know what values they are? Like this:

```<code>SELECT name FROM students WHERE courseCode IN (SELECT courseCode FROM course WHERE ...);
</code>```

I hope you have explained me well, thanks for your help

答:
Here's one possible way to do it, collapsing with a GROUP BY and getting a count of distinct coursecode, and comparing that to a literal:

```<code> SELECT s.name
   FROM students s
  WHERE s.courseCode IN (17,18,19)
  GROUP BY s.name
 HAVING COUNT(DISTINCT s.courseCode) = 3
</code>```

The (17,18,19) could be replaced by a subquery. But I would tend to use an inline view and a join operation.

```<code> SELECT s.name
   FROM students s
   JOIN ( SELECT 17 AS courseCode
           UNION ALL SELECT 18
           UNION ALL SELECT 19
        ) c
     ON c.courseCode = s.courseCode
  GROUP BY s.name
 HAVING COUNT(DISTINCT s.courseCode) = 3
</code>```

The query for inline view c just needs to return distinct values of a column named courseCode with appropriate datatype... a lot of possible queries will work ...

```<code>   JOIN ( SELECT foo AS courseCode
            FROM bar
           WHERE ...
           GROUP BY foo
        ) c
</code>```

This is an example of one approach, there are other approaches...

Body:
I'm very hesitant and I have not gotten solutions, so I turn here.
Quickly explain, suppose I want to filter a query as follows:

SELECT name FROM students WHERE courseCode IN (17, 18, 19);

Here I will get the students who are enrolled in courses 17 or 18 or 19.

Now, how would you get the students who are enrolled in those 3 courses? That is, in 17 and 18 and 19?

Maybe it can be simple when you know what the "courseCode" values are, but how would you do it when you get those values with a subquery?

Something like this:

SELECT name FROM students WHERE courseCode = 17 and courseCode = 18 and courseCode = 19;

when I know the values (This is not correct)

but how would I do when I do not know what values they are? Like this:

SELECT name FROM students WHERE courseCode IN (SELECT courseCode FROM course WHERE ...);

I hope you have explained me well, thanks for your help

Body:
Here's one possible way to do it, collapsing with a GROUP BY and getting a count of distinct coursecode, and comparing that to a literal:

 SELECT s.name
   FROM students s
  WHERE s.courseCode IN (17,18,19)
  GROUP BY s.name
 HAVING COUNT(DISTINCT s.courseCode) = 3

The (17,18,19) could be replaced by a subquery. But I would tend to use an inline view and a join operation.

 SELECT s.name
   FROM students s
   JOIN ( SELECT 17 AS courseCode
           UNION ALL SELECT 18
           UNION ALL SELECT 19
        ) c
     ON c.courseCode = s.courseCode
  GROUP BY s.name
 HAVING COUNT(DISTINCT s.courseCode) = 3

The query for inline view c just needs to return distinct values of a column named courseCode with appropriate datatype... a lot of possible queries will work ...

   JOIN ( SELECT foo AS courseCode
            FROM bar
           WHERE ...
           GROUP BY foo
        ) c

This is an example of one approach, there are other approaches...


问:
How to save value from System.currentTimeMillis() in android studio
I have this code:

```<code>public class MainActivity extends AppCompatActivity implements SensorEventListener {

    long start_time;
    int record_state;

    @Override
    public void onSensorChanged(SensorEvent event) {
    Long time = System.currentTimeMillis();

    if (record_state == 1)
    {
        start_time = time;
        record_state = 0;
    }

    if(Ax.size() == N_SAMPLES && Ay.size() == N_SAMPLES && Az.size() == N_SAMPLES) //assuming this gets executed
    {
        Toast.makeText(MainActivity.this, "Size of Ax: " + Integer.toString(Ax.size()) +
                    "\nSize of Ay: " + Integer.toString(Ay.size()) +
                    "\nSize of Az: " + Integer.toString(Az.size()) + "\n" + Long.toString((time)) + "\n" + Long.toString((start_time)) + "\nrecord state: " + Integer.toString((record_state)), Toast.LENGTH_LONG).show();
        }
    }
}
</code>```

But it appears that time and start_time always have the same value. I want start_time to record the time at the very beginning (or freeze the value of time at one instant) only. How can I do this? What is wrong with this code?

答:
Because this code is going to be used in onSensorChanged (referring to your comments) then the solution should be these variables should be declared and used throughout your class and not in the single method and the problem will disappear so please declare this outside any method as local variables:

```<code>int record_state = 1;
Long start_time;
</code>```

Code and logic improvements

Use long instead of Long

Use >= instead of == because its too hard to get it exactly equal!

Body:
I have this code:

public class MainActivity extends AppCompatActivity implements SensorEventListener {

    long start_time;
    int record_state;

    @Override
    public void onSensorChanged(SensorEvent event) {
    Long time = System.currentTimeMillis();

    if (record_state == 1)
    {
        start_time = time;
        record_state = 0;
    }

    if(Ax.size() == N_SAMPLES && Ay.size() == N_SAMPLES && Az.size() == N_SAMPLES) //assuming this gets executed
    {
        Toast.makeText(MainActivity.this, "Size of Ax: " + Integer.toString(Ax.size()) +
                    "\nSize of Ay: " + Integer.toString(Ay.size()) +
                    "\nSize of Az: " + Integer.toString(Az.size()) + "\n" + Long.toString((time)) + "\n" + Long.toString((start_time)) + "\nrecord state: " + Integer.toString((record_state)), Toast.LENGTH_LONG).show();
        }
    }
}

But it appears that time and start_time always have the same value. I want start_time to record the time at the very beginning (or freeze the value of time at one instant) only. How can I do this? What is wrong with this code?

Body:
Because this code is going to be used in onSensorChanged (referring to your comments) then the solution should be these variables should be declared and used throughout your class and not in the single method and the problem will disappear so please declare this outside any method as local variables:

int record_state = 1;
Long start_time;

Code and logic improvements

Use long instead of Long

Use >= instead of == because its too hard to get it exactly equal!


问:
Angular 4 - @HostBinding bind the css class to host element but ui not rending correctly.
I have created ProductListComponent and it access the child component ProductRowComponent. The code listed below

ProductListComponent

```<code>import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
 import { Product } from '../product';
  @Component({
      selector: 'products-list',
      template: `
          <product-row *ngFor="let myProduct of productList"
                        [product]="myProduct"
                        (click)="clicked(myProduct)"
                        [class.selectedItem] = "isSelected(myProduct)">
          </product-row>
      `
    })
    export class ProductsListComponent implements OnInit {
      @Input() productList: Product[];
      @Output() onProductSelected: EventEmitter<Product>;

      constructor() {
        this.onProductSelected = new EventEmitter();
       }

      clicked(product: Product): void {
        this.currentProduct = product;
        this.onProductSelected.emit(product);
      }

      isSelected(product: Product): boolean {
        if(!product || !this.currentProduct) {
          return false;
        }
        return this.currentProduct.sku === product.sku;
      }
    }
</code>```

ProductRowComponent

```<code>import { Component, Input, HostBinding } from '@angular/core';
import { Product } from '../product';

@Component({
  selector: 'product-row',
  template: `
  <div class="card">
  <div  class="card-block">
    <h4 class="card-title">{{product.name}}</h4>
     <p class="card-text">
      {{product.price}}
    </p>
  </div>
</div>
  `
})
export class ProductRowComponent {
  @Input() product: Product;
  @HostBinding('attr.class') cssClass = "selectedItem";
}
</code>```

I defined the style

```<code>.selectedItem  {
    background-color: blue;
    color: white;
}
</code>```

But it is not apply right style to the selected product. I debugged browser window and have seen the style is applied to the host element product-row.

```<code>**<product-row** ng-reflect-product="[object Object]" **class="selectedItem"**>
  <div class="card">
  <div class="card-block">
    <h4 class="card-title">Black Running Shoes</h4>
    <p class="card-text">
      109.99
    </p>
  </div>
</div>
</product-row>
</code>```

What am i doing wrong?

答: You should use attribute directive with @HostBinding inside for this purpose, not component.</p>

Body:
I have created ProductListComponent and it access the child component ProductRowComponent. The code listed below

ProductListComponent

import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
 import { Product } from '../product';
  @Component({
      selector: 'products-list',
      template: `
          <product-row *ngFor="let myProduct of productList"
                        [product]="myProduct"
                        (click)="clicked(myProduct)"
                        [class.selectedItem] = "isSelected(myProduct)">
          </product-row>
      `
    })
    export class ProductsListComponent implements OnInit {
      @Input() productList: Product[];
      @Output() onProductSelected: EventEmitter<Product>;

      constructor() {
        this.onProductSelected = new EventEmitter();
       }

      clicked(product: Product): void {
        this.currentProduct = product;
        this.onProductSelected.emit(product);
      }

      isSelected(product: Product): boolean {
        if(!product || !this.currentProduct) {
          return false;
        }
        return this.currentProduct.sku === product.sku;
      }
    }

ProductRowComponent

import { Component, Input, HostBinding } from '@angular/core';
import { Product } from '../product';

@Component({
  selector: 'product-row',
  template: `

{{product.name}}

      {{product.price}}

  `
})
export class ProductRowComponent {
  @Input() product: Product;
  @HostBinding('attr.class') cssClass = "selectedItem";
}

I defined the style

.selectedItem  {
    background-color: blue;
    color: white;
}

But it is not apply right style to the selected product. I debugged browser window and have seen the style is applied to the host element product-row.

**<product-row** ng-reflect-product="[object Object]" **class="selectedItem"**>

Black Running Shoes

      109.99

</product-row>

What am i doing wrong?


问:
How to change MQTT hostname for Google Iot Core
I am working on an iot device using google-cloud-iot-core, but i would like to have allow for 3rd party support, so i want to change the host name of the mqtt, how can it be done?

Thanks in advance

答:
If you change that endpoint, then you're no longer talking to IoT Core. It's not configurable, as that's the endpoint to talk to the service.

You can setup your own MQTT server somewhere else (could do it in GCE or GKE with a custom container) and make the hostname whatever you want, and then setup your own broker to take the MQTT payloads and create Pub/Sub messages, or even to act as a forwarding proxy to IoT Core itself I suppose (although security and auth might get a bit odd).

Or you could even just go directly to Pub/Sub. It all just depends on your need.

As I mentioned, changing the hostname for IoT Core (the mqtt.googleapis.com) it means that you aren't using IoT Core any longer. There's no other way to access the communication broker piece of IoT Core to do the Pub/Sub message creation, etc. If you don't use the IoT Core endpoint (hostname) then you'd be on your own for creating the Pub/Sub messages from the IoT device data.


问:
How to run MSBuild from Powershell without spawning msbuild.exe process?
I am considering running MSBuild from a Powershell script by tapping directly to the MSBuild assemblies (as opposed to looking up MSBuild install path and starting msbuild.exe as a child process).

Has anyone done this? What would be the simplest, most straightforward way to run the build? Are there any pros/cons to either technique you'd like to point out? (I'm especially interested in any issues that might arise from running msbuild in the same process/appdomain as the rest of the script).

Currently my thinking is something along these lines:

```<code>[void][System.Reflection.Assembly]::Load('Microsoft.Build.Engine, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][Microsoft.Build.BuildEngine.Engine]::GlobalEngine.BuildProjectFile("path/main.proj")
</code>```

答:
I was looking for this same thing. Following JaredPar's lead I found the following:

This is a how-to on making a cmdlet.

http://bartdesmet.net/blogs/bart/archive/2008/02/03/easy-windows-powershell-cmdlet-development-and-debugging.aspx

The MSBuild API is part of these namespaces:

```<code>Microsoft.Build.Framework

Microsoft.Build.BuildEngine
</code>```

And the MSBuild documentation can be found here (this is more for completeness than in response to your question):

http://msdn.microsoft.com/en-us/library/wea2sca5.aspx

OwnerDisplayName: Milan Gardian

ContentLicense: CC BY-SA 2.5

Body:
I am considering running MSBuild from a Powershell script by tapping directly to the MSBuild assemblies (as opposed to looking up MSBuild install path and starting msbuild.exe as a child process).

Has anyone done this? What would be the simplest, most straightforward way to run the build? Are there any pros/cons to either technique you'd like to point out? (I'm especially interested in any issues that might arise from running msbuild in the same process/appdomain as the rest of the script).

Currently my thinking is something along these lines:

[void][System.Reflection.Assembly]::Load('Microsoft.Build.Engine, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][Microsoft.Build.BuildEngine.Engine]::GlobalEngine.BuildProjectFile("path/main.proj")

Body:
I was looking for this same thing. Following JaredPar's lead I found the following:

This is a how-to on making a cmdlet.

http://bartdesmet.net/blogs/bart/archive/2008/02/03/easy-windows-powershell-cmdlet-development-and-debugging.aspx

The MSBuild API is part of these namespaces:

Microsoft.Build.Framework

Microsoft.Build.BuildEngine

And the MSBuild documentation can be found here (this is more for completeness than in response to your question):

http://msdn.microsoft.com/en-us/library/wea2sca5.aspx

OwnerDisplayName: Anthony Potts


问:
Git asking for password from command line
I setup git and gitosis on a server to manage my repos.  It's working properly for the initial shell account I set it up with, i.e. I can run:

```<code>git clone git@MYSERVER:gitosis-admin.git
</code>```

But when I try to use the separate accounts I've created (via gitosis.conf) it keeps asking for a password:

```<code>git clone johndoe@MYSERVER:gitosis-admin.git
</code>```

I setup the SSH key and pushed a copy to the keydir on the server.  This question seems to address the same problem, but the solution given is for tortoisegit.

Git keeps asking for password

How do I tell git to use the ssh key instead of asking for a password?

答:
Well, I just read about gitosis, and AFAICT you should never ever be cloning from johndoe@MYSERVER when using it.  Always clone from git@, and make sure your ssh keys are set up correctly so that the server can use those to differentiate (for example) johndoe from janedoe.

What you do on the client side is add johndoe's SSH key to your keychain, remove any others the server will accept, and set your git user and email settings to id you as johndoe.  The server will compare the two, see that they match, and let you commit.  If you configure SSH to use someone else's key and then try to commit as johndoe with git, you may be able to connect to the server, but it will not let you proceed with a commit.

OTOH, because gitosis does not create actual user accounts, you can't ssh as johndoe into the machine, which also means you can't use johndoe@... addresses for the repository in git.  If you need to do that, you'll have to set your git server up another way.

Body:
I setup git and gitosis on a server to manage my repos.  It's working properly for the initial shell account I set it up with, i.e. I can run:

git clone git@MYSERVER:gitosis-admin.git

But when I try to use the separate accounts I've created (via gitosis.conf) it keeps asking for a password:

git clone johndoe@MYSERVER:gitosis-admin.git

I setup the SSH key and pushed a copy to the keydir on the server.  This question seems to address the same problem, but the solution given is for tortoisegit.

Git keeps asking for password

How do I tell git to use the ssh key instead of asking for a password?


问:
Is there a relationship between dollar sign ($) and id function in Haskell?
One of these days I was reading comments on the Monad Challenge (which I highly recommend to any beginner in Haskell, like myself), and I ended up on this thread where I read that ($) = id.

I don't know about scaring people, but many programming languages have concepts that are best demonstrated with small examples that make people say "whoa".

For example, it's amazing that append() in Prolog can be run "backwards" from the concatenated result to yield all the lists that can be concatenated to produce it. Or that the monadic bind operator in Haskell (>>=) can be defined in terms of join and fmap, or that ($) = id.

($) = id !?

< tries it out in Raskell/Ghci >

I see now why it's true, but still... Whoah!! Thanks for that! (...)

I then checked the base-4.10.0.0 code, looking for the definitions of ($) and id, but right at the top I read this:

```NOTA BENE: Do NOT use ($) anywhere in this module! The type of ($) is
slightly magical (it can return unlifted types), and it is wired in.
But, it is also *defined* in this module, with a non-magical type.
GHC gets terribly confused (and *hangs*) if you try to use ($) in this
module, because it has different types in different scenarios.

This is not a problem in general, because the type ($), being wired in, is not
written out to the interface file, so importing files don't get confused.
The problem is only if ($) is used here. So don't!```

And their implementations are:

-- | Identity function.
id                      :: a -> a
id x                    =  x

-- | Application operator.
{-# INLINE ($) #-}
($)                     :: (a -> b) -> a -> b
f $ x                   =  f x
```

I tried swapping one by the other on GHCi and all I got was type errors (as I expected). Now, I have more questions than what I started with:

What do they mean by saying that ($) = id?

In which cases is that statement true? Does that mean I can use one instead of the other?

In the base, what is meant by saying that ($) is "slightly magical (it can return unlifted types)" and "being wired in"?

And what about "different types in different scenarios"? I thought that since Haskell is a strongly typed language, once you define a type signature, that signature is retained until the end of Time. Is that not true? Are there cases where one can change a function's type?

答:
What do they mean by saying that ($) = id?

The function ($) could be defined as

```<code>($) f x = f x
</code>```

i.e. taking a function and an argument and returning the result of the application. Equivalently, thanks to currying, we can interpret that as taking only f and returning a function of x.

```<code>($) f = \x -> f x
</code>```

Here, we can note that the function \x -> f x maps any input x to f x -- that's also what f does! So, we can simplify the definition to

```<code>($) f = f
</code>```

Now, this is the same as the identity function definition id y = y, so we might as well write

```<code>($) = id
</code>```

In which cases is that statement true? Does that mean I can use one instead of the other?

The equation holds always, but there are two caveats.

The first one is that ($) has a more restricted type than the one of id, since ($) f = f holds only for a function f, not for any value f. This means that you can replace ($) with id, but not vice versa. When writing

```<code>($) = id
</code>```

one could make the implicit type argument explicit and write that, for any types a and b

```<code>($) @ a @ b = id @ (a->b)
</code>```

The other caveat is that, in the presence of higher-ranked function, ($) receives some special handling during type checking, while id does not.
This is point 3 blow.

In the base, what is meant by saying that ($) is "slightly magical (it can return unlifted types)" and "being wired in"?

Normally, in polymorphic functions such as

```<code>id :: forall a . a -> a
</code>```

the type variable a can be instantiated to other types, but only under some restrictions. For instance, a can be instantiated to Int, but can not be instantiated to another polymorphic type forall b . .... This keeps the type system predicative, which helps greatly during type inference.

Usually, this is not an issue in everyday programming. However, some functions use rank-2 types, e.g. runST

```<code>runST :: (forall s. ST s x) -> x
</code>```

If we write

```<code>runST (some polymorphic value here)
</code>```

the type system can type check that. But if we use the common idiom

```<code>runST $ some polymorphic value here
</code>```

then the type inference engine has to take the type of ($)

```<code>($) :: forall a b . (a -> b) -> a -> b
</code>```

and choose a ~ forall s. ST s x which is polymorphic, hence forbidden.

Since this idiom is too common, the GHC developers decided to add a special case to the typing of ($) to allow this. Since this is a bit ad-hoc, if you define your own ($) (possibly under another name), and try to type check runST $ ... this will fail since it does not use the special case.

Further, a can not be instantiated to unboxed types such as Int#, or unboxed tuples (# Int#, Int# #). These are GHC extensions which allow writing functions which pass a "raw" integer, without the usual thunk wrapper. This can change the semantics, e.g. making functions stricter than they are. Unless you want to squeeze more performance from some numeric code, you can ignore these.

(I'm leaving this part here, but lisyarus already covered it more precisely.)

```<code>f $ x = f x
-- i.e.
($) f x = f x
-- i.e.
($) f x = id f x
-- eta contraction
($) f = id f
-- eta contraction
($) = id
</code>```

Basically, ($) is id, but with a more restrictive type. id can be used on arguments of any type, ($) instead takes a function argument.

```<code>($) :: (a -> b) -> a -> b
-- is better read as
($) :: (a -> b) -> (a -> b)
-- which is of the form (c -> c) with c = (a -> b)
</code>```

Note that id :: c -> c, so the type of ($) is indeed a special case.

And what about "different types in different scenarios"? I thought that since Haskell is a strongly typed language, once you define a type signature, that signature is retained until the end of Time. Is that not true? Are there cases where one can change a function's type?

In the code of the libraries which define ($), GHC has to play some tricks to get the special typing rules to work for the other libraries and programs. For that, apparently it is required not to use ($) in said library. Unless you are developing GHC or the base module which happens to define ($), you can ignore this. It is an implementation detail internal to the compiler, not something that the user of the compiler and libraries must know.

Body:
One of these days I was reading comments on the Monad Challenge (which I highly recommend to any beginner in Haskell, like myself), and I ended up on this thread where I read that ($) = id.

I don't know about scaring people, but many programming languages have concepts that are best demonstrated with small examples that make people say "whoa".

For example, it's amazing that append() in Prolog can be run "backwards" from the concatenated result to yield all the lists that can be concatenated to produce it. Or that the monadic bind operator in Haskell (>>=) can be defined in terms of join and fmap, or that ($) = id.

($) = id !?

< tries it out in Raskell/Ghci >

I see now why it's true, but still... Whoah!! Thanks for that! (...)

I then checked the base-4.10.0.0 code, looking for the definitions of ($) and id, but right at the top I read this:

NOTA BENE: Do NOT use ($) anywhere in this module! The type of ($) is
slightly magical (it can return unlifted types), and it is wired in.
But, it is also *defined* in this module, with a non-magical type.
GHC gets terribly confused (and *hangs*) if you try to use ($) in this
module, because it has different types in different scenarios.

This is not a problem in general, because the type ($), being wired in, is not
written out to the interface file, so importing files don't get confused.
The problem is only if ($) is used here. So don't!

And their implementations are:

-- | Identity function.
id                      :: a -> a
id x                    =  x

-- | Application operator.
{-# INLINE ($) #-}
($)                     :: (a -> b) -> a -> b
f $ x                   =  f x

I tried swapping one by the other on GHCi and all I got was type errors (as I expected). Now, I have more questions than what I started with:

What do they mean by saying that ($) = id?

In which cases is that statement true? Does that mean I can use one instead of the other?

In the base, what is meant by saying that ($) is "slightly magical (it can return unlifted types)" and "being wired in"?

And what about "different types in different scenarios"? I thought that since Haskell is a strongly typed language, once you define a type signature, that signature is retained until the end of Time. Is that not true? Are there cases where one can change a function's type?

Body:
What do they mean by saying that ($) = id?

The function ($) could be defined as

($) f x = f x

i.e. taking a function and an argument and returning the result of the application. Equivalently, thanks to currying, we can interpret that as taking only f and returning a function of x.

($) f = \x -> f x

Here, we can note that the function \x -> f x maps any input x to f x -- that's also what f does! So, we can simplify the definition to

($) f = f

Now, this is the same as the identity function definition id y = y, so we might as well write

($) = id

In which cases is that statement true? Does that mean I can use one instead of the other?

The equation holds always, but there are two caveats.

The first one is that ($) has a more restricted type than the one of id, since ($) f = f holds only for a function f, not for any value f. This means that you can replace ($) with id, but not vice versa. When writing

($) = id

one could make the implicit type argument explicit and write that, for any types a and b

($) @ a @ b = id @ (a->b)

The other caveat is that, in the presence of higher-ranked function, ($) receives some special handling during type checking, while id does not.
This is point 3 blow.

In the base, what is meant by saying that ($) is "slightly magical (it can return unlifted types)" and "being wired in"?

Normally, in polymorphic functions such as

id :: forall a . a -> a

the type variable a can be instantiated to other types, but only under some restrictions. For instance, a can be instantiated to Int, but can not be instantiated to another polymorphic type forall b . .... This keeps the type system predicative, which helps greatly during type inference.

Usually, this is not an issue in everyday programming. However, some functions use rank-2 types, e.g. runST

runST :: (forall s. ST s x) -> x

If we write

runST (some polymorphic value here)

the type system can type check that. But if we use the common idiom

runST $ some polymorphic value here

then the type inference engine has to take the type of ($)

($) :: forall a b . (a -> b) -> a -> b

and choose a ~ forall s. ST s x which is polymorphic, hence forbidden.

Since this idiom is too common, the GHC developers decided to add a special case to the typing of ($) to allow this. Since this is a bit ad-hoc, if you define your own ($) (possibly under another name), and try to type check runST $ ... this will fail since it does not use the special case.

Further, a can not be instantiated to unboxed types such as Int#, or unboxed tuples (# Int#, Int# #). These are GHC extensions which allow writing functions which pass a "raw" integer, without the usual thunk wrapper. This can change the semantics, e.g. making functions stricter than they are. Unless you want to squeeze more performance from some numeric code, you can ignore these.

(I'm leaving this part here, but lisyarus already covered it more precisely.)

f $ x = f x
-- i.e.
($) f x = f x
-- i.e.
($) f x = id f x
-- eta contraction
($) f = id f
-- eta contraction
($) = id

Basically, ($) is id, but with a more restrictive type. id can be used on arguments of any type, ($) instead takes a function argument.

($) :: (a -> b) -> a -> b
-- is better read as
($) :: (a -> b) -> (a -> b)
-- which is of the form (c -> c) with c = (a -> b)

Note that id :: c -> c, so the type of ($) is indeed a special case.

And what about "different types in different scenarios"? I thought that since Haskell is a strongly typed language, once you define a type signature, that signature is retained until the end of Time. Is that not true? Are there cases where one can change a function's type?

In the code of the libraries which define ($), GHC has to play some tricks to get the special typing rules to work for the other libraries and programs. For that, apparently it is required not to use ($) in said library. Unless you are developing GHC or the base module which happens to define ($), you can ignore this. It is an implementation detail internal to the compiler, not something that the user of the compiler and libraries must know.


问:
Change to the next image when clickon button using jquery
**I want to change to the next image when clicking on button using jquery, displaying one image at a time, should I use hide/show, display: none or .remove/.append? **

$("#next").toggle(function(){
  function(){
    $('#planet1').remove();
    $('#planet2').append();
  });
  function(){
    $(this).remove('#planet2').append('#planet3');
  });
  function(){
    $(this).removeClass('planet3').addClass('planet4');
  });
  function(){
    $(this).removeClass('planet4').addClass('planet5');
  });
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code>          <div class="planets">
              <img id="planet1" src="img\planets\planet1.png" />
              <img id="planet2" src="img\planets\planet2.png" />
              <img id="planet3" src="img\planets\planet3.png" />
              <img id="planet4" src="img\planets\planet4.png" />
              <img id="planet5" src="img\planets\planet5.png" />
          </div>
              <button id="next"> Make a greener planet</button></code>```

答:
Here is a way to accomplish what you are looking for with some basic jQuery and CSS. First, you will set all images to be hidden by default, with only the first shown.

```<code>img:first-of-type {
  display: inherit;
}

img {
  display: none;
}
</code>```

Then you can have a function that rotates through.

```<code>$('#next').click(function() {
  currentPicture++;
  if (currentPicture > $('img').length) {
    currentPicture = 1;
  }
  $('img').css('display', 'none');
  $(`#planet${currentPicture}`).css('display', 'inherit');
});
</code>```

https://jsfiddle.net/hmnhdknL/1/

Body:
**I want to change to the next image when clicking on button using jquery, displaying one image at a time, should I use hide/show, display: none or .remove/.append? **

$("#next").toggle(function(){
  function(){
    $('#planet1').remove();
    $('#planet2').append();
  });
  function(){
    $(this).remove('#planet2').append('#planet3');
  });
  function(){
    $(this).removeClass('planet3').addClass('planet4');
  });
  function(){
    $(this).removeClass('planet4').addClass('planet5');
  });
});

              <button id="next"> Make a greener planet</button>

Body:
Here is a way to accomplish what you are looking for with some basic jQuery and CSS. First, you will set all images to be hidden by default, with only the first shown.

img:first-of-type {
  display: inherit;
}

img {
  display: none;
}

Then you can have a function that rotates through.

$('#next').click(function() {
  currentPicture++;
  if (currentPicture > $('img').length) {
    currentPicture = 1;
  }
  $('img').css('display', 'none');
  $(`#planet${currentPicture}`).css('display', 'inherit');
});

https://jsfiddle.net/hmnhdknL/1/


问:
change Qt GUI by Qt tcp socket?
i have a server and client.i am going to change the handle of my clock to new value that will send by client to server.i added the source code below.
my problem is when client connect to server after client send data to server to change the handle of clock to new data. the gui that created in Server::startRead() method appear and disappear automatically. what is wrong with my code please.

server.h

```<code>#ifndef SERVER_H
#define SERVER_H
#include <QtNetwork>
#include <QObject>
#include <QTcpServer>
#include <QTcpSocket>

class Server: public QObject
{
Q_OBJECT
public:

   QString buf;
  Server(QObject * parent = 0);
  ~Server();
public slots:
  void acceptConnection();
  void startRead();
  QString getinfo();

private:
  QTcpServer server;
  QTcpSocket* client;
};

#endif // SERVER_H
</code>```

server.cpp

```<code>#include <QGuiApplication>
#include "server.h"
#include <QDebug>
#include <iostream>
#include <QApplication>
#include "qlabel.h"
#include <QtGui>
Server::Server(QObject* parent): QObject(parent)
{

connect(&server, SIGNAL(newConnection()),
    this, SLOT(acceptConnection()));

  server.listen(QHostAddress::Any, 1234);
  qDebug() <<  "connected";
}

Server::~Server()
{
  server.close();
}

void Server::acceptConnection()
{

  qDebug()<<"accept connection";
  client = server.nextPendingConnection();
  client->write("Hello client\r\n");

  connect(client, SIGNAL(readyRead()),
    this, SLOT(startRead()));

}

void Server::startRead()
{

    client->waitForReadyRead(3000);
    QString buf=client->readAll();

    qDebug() << buf;

    static const QPoint minuteHand[3] = {
        QPoint(7, 8),
        QPoint(-7, 8),
        QPoint(0, -40)
    };
     int side = qMin(200, 200);
    QColor minuteColor(60, 60, 0);
    QPixmap pixmap( 200, 200 );
    pixmap.fill( Qt::red );
    QPainter painter( &pixmap );
    painter.setRenderHint(QPainter::Antialiasing);
    painter.translate(200 / 2, 200 / 2);
    painter.scale(side / 200.0, side / 200.0);

    painter.setPen(Qt::NoPen);

    for (int i = 0; i < 12; ++i) {
        painter.drawLine(88, 0, 96, 0);
        painter.rotate(30.0);
    }
    painter.setPen(Qt::NoPen);
    painter.setBrush(minuteColor);

    painter.save();
    painter.rotate(240);
    painter.drawConvexPolygon(minuteHand, 3);
    painter.restore();

    painter.setPen(minuteColor);

    for (int j = 0; j < 60; ++j) {
        if ((j % 5) != 0)
            painter.drawLine(92, 0, 96, 0);
        painter.rotate(6.0);
    }

    QLabel l;
    l.setPixmap(pixmap);
    l.show();

}
QString Server::getinfo()
{

 qDebug()<< buf;
    return buf;

}
</code>```

main.cpp

```<code>#include "server.h"
#include <QApplication>
#include "analogclock.h"
#include "qlabel.h"
#include <QtGui>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

Server s;

    return a.exec();
}
</code>```

application output

```<code>Starting C:\Qt\Qt5.3.0_1\Tools\QtCreator\bin\build-NHAJA-Desktop_Qt_5_3_0_MinGW_32bit-Debug\debug\NHAJA.exe...
connected
accept connection
"11"
C:\Qt\Qt5.3.0_1\Tools\QtCreator\bin\build-NHAJA-Desktop_Qt_5_3_0_MinGW_32bit-Debug\debug\NHAJA.exe exited with code 0
</code>```

I really appreciate it.

答:
The variables created in the functions only exist while the function is called, so when the function is finished executing the variables are eliminated, and in your case the QLabel is eliminated.

A possible solution is to create QLabel as a member of the class:

server.h

```<code>private:
    QLabel *label;
</code>```

server.cpp

```<code>Server::Server(QObject *parent) : QObject(parent)
{
    [...]
    qDebug() <<  "connected";
    label = new QLabel;
}

void Server::startRead()
{
    [...]
    for (int j = 0; j < 60; ++j) {
        if ((j % 5) != 0)
            painter.drawLine(92, 0, 96, 0);
        painter.rotate(6.0);
    }

    label->setPixmap(pixmap);
    label->show();

}
</code>```

Title: change Qt GUI by Qt tcp socket?

Body:
i have a server and client.i am going to change the handle of my clock to new value that will send by client to server.i added the source code below.
my problem is when client connect to server after client send data to server to change the handle of clock to new data. the gui that created in Server::startRead() method appear and disappear automatically. what is wrong with my code please.

server.h

#ifndef SERVER_H
#define SERVER_H
#include <QtNetwork>
#include <QObject>
#include <QTcpServer>
#include <QTcpSocket>

class Server: public QObject
{
Q_OBJECT
public:

   QString buf;
  Server(QObject * parent = 0);
  ~Server();
public slots:
  void acceptConnection();
  void startRead();
  QString getinfo();

private:
  QTcpServer server;
  QTcpSocket* client;
};

#endif // SERVER_H

server.cpp

#include <QGuiApplication>
#include "server.h"
#include <QDebug>
#include <iostream>
#include <QApplication>
#include "qlabel.h"
#include <QtGui>
Server::Server(QObject* parent): QObject(parent)
{

connect(&server, SIGNAL(newConnection()),
    this, SLOT(acceptConnection()));

  server.listen(QHostAddress::Any, 1234);
  qDebug() <<  "connected";
}

Server::~Server()
{
  server.close();
}

void Server::acceptConnection()
{

  qDebug()<<"accept connection";
  client = server.nextPendingConnection();
  client->write("Hello client\r\n");

  connect(client, SIGNAL(readyRead()),
    this, SLOT(startRead()));

}

void Server::startRead()
{

    client->waitForReadyRead(3000);
    QString buf=client->readAll();

    qDebug() << buf;

    static const QPoint minuteHand[3] = {
        QPoint(7, 8),
        QPoint(-7, 8),
        QPoint(0, -40)
    };
     int side = qMin(200, 200);
    QColor minuteColor(60, 60, 0);
    QPixmap pixmap( 200, 200 );
    pixmap.fill( Qt::red );
    QPainter painter( &pixmap );
    painter.setRenderHint(QPainter::Antialiasing);
    painter.translate(200 / 2, 200 / 2);
    painter.scale(side / 200.0, side / 200.0);

    painter.setPen(Qt::NoPen);

    for (int i = 0; i < 12; ++i) {
        painter.drawLine(88, 0, 96, 0);
        painter.rotate(30.0);
    }
    painter.setPen(Qt::NoPen);
    painter.setBrush(minuteColor);

    painter.save();
    painter.rotate(240);
    painter.drawConvexPolygon(minuteHand, 3);
    painter.restore();

    painter.setPen(minuteColor);

    for (int j = 0; j < 60; ++j) {
        if ((j % 5) != 0)
            painter.drawLine(92, 0, 96, 0);
        painter.rotate(6.0);
    }

    QLabel l;
    l.setPixmap(pixmap);
    l.show();

}
QString Server::getinfo()
{

 qDebug()<< buf;
    return buf;

}

main.cpp

#include "server.h"
#include <QApplication>
#include "analogclock.h"
#include "qlabel.h"
#include <QtGui>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

Server s;

    return a.exec();
}

application output

Starting C:\Qt\Qt5.3.0_1\Tools\QtCreator\bin\build-NHAJA-Desktop_Qt_5_3_0_MinGW_32bit-Debug\debug\NHAJA.exe...
connected
accept connection
"11"
C:\Qt\Qt5.3.0_1\Tools\QtCreator\bin\build-NHAJA-Desktop_Qt_5_3_0_MinGW_32bit-Debug\debug\NHAJA.exe exited with code 0

I really appreciate it.

Body:
The variables created in the functions only exist while the function is called, so when the function is finished executing the variables are eliminated, and in your case the QLabel is eliminated.

A possible solution is to create QLabel as a member of the class:

server.h

private:
    QLabel *label;

server.cpp

Server::Server(QObject *parent) : QObject(parent)
{
    [...]
    qDebug() <<  "connected";
    label = new QLabel;
}

void Server::startRead()
{
    [...]
    for (int j = 0; j < 60; ++j) {
        if ((j % 5) != 0)
            painter.drawLine(92, 0, 96, 0);
        painter.rotate(6.0);
    }

    label->setPixmap(pixmap);
    label->show();

}


问:
Swift 3 Read Terminal Current Working Directory
I want to develop an app to promote the experience when using terminal on Mac. And I want to get the current working directory (cwd) from terminal. How can I implement it?

I notice that the answer in Get terminal output after a command swift is really good but it seems that it still cannot resolve my problem perfectly. I learned Process().currentDirectoryPath from Apple's document https://developer.apple.com/reference/foundation/process Does it do the trick that I need? Can I use it like the following?

```<code>let path = Process().currentDirectoryPath
</code>```

I am very new to swift and Xcode, please help me! Thanks!

Update: Thank you guys! It seems that both

```<code>let path = fileManager.default.currentDirectoryPath
</code>```

and the Process() one temporarily work for me. Are there any differences between these two?

答:
I had this same question and went with the latter option:

let path = FileManager.default.currentDirectoryPath
```

To answer your updated question, the difference between the Process() and the FileManager approaches is that the Process().currentDirectoryPath approach prepares to create a new subprocess and then tells you the working directory that subprocess will use. The subprocess would have the same working directory as the parent process, of course, but it's wasteful to create a new Process instance just to find the working directory.

Definitely use the FileManager approach, as that returns the working directory that is used by the current process without creating any subprocesses or any other overhead.

Sources:

https://developer.apple.com/documentation/foundation/filemanager/1409234-default

https://developer.apple.com/documentation/foundation/filemanager/1410766-currentdirectorypath

ContentLicense: CC BY-SA 4.0

Body:
I want to develop an app to promote the experience when using terminal on Mac. And I want to get the current working directory (cwd) from terminal. How can I implement it?

I notice that the answer in Get terminal output after a command swift is really good but it seems that it still cannot resolve my problem perfectly. I learned Process().currentDirectoryPath from Apple's document https://developer.apple.com/reference/foundation/process Does it do the trick that I need? Can I use it like the following?

let path = Process().currentDirectoryPath

I am very new to swift and Xcode, please help me! Thanks!

Update: Thank you guys! It seems that both

let path = fileManager.default.currentDirectoryPath

and the Process() one temporarily work for me. Are there any differences between these two?

Body:
I had this same question and went with the latter option:

let path = FileManager.default.currentDirectoryPath

To answer your updated question, the difference between the Process() and the FileManager approaches is that the Process().currentDirectoryPath approach prepares to create a new subprocess and then tells you the working directory that subprocess will use. The subprocess would have the same working directory as the parent process, of course, but it's wasteful to create a new Process instance just to find the working directory.

Definitely use the FileManager approach, as that returns the working directory that is used by the current process without creating any subprocesses or any other overhead.

Sources:

https://developer.apple.com/documentation/foundation/filemanager/1409234-default

https://developer.apple.com/documentation/foundation/filemanager/1410766-currentdirectorypath


问:
Chrome Debugger Breakpoint not Working
Can't seem to find an answer as to why debugger; isn't working.

```<code>        RSVP.aggregate([{
            $lookup: {
                from: "users", // collection name in db
                localField: "userId",
                foreignField: "_id",
                as: "user"
            }
        }
        ]).exec( (err, rsvpList) => {
            if (err) throw err("Mongoose aggregate failed to join rsvps to users: " + err);
            console.log('rsvp: ' + rsvpList[0].user.toString());
            debugger;
        });
</code>```

答:
I guess it was because I was using node.js.  I was able to download and install the nodejs inspection manager Chrome and get it working.

https://chrome.google.com/webstore/detail/nodejs-v8-inspector-manag/gnhhdgbaldcilmgcpfddgdbkhjohddkj

Title: Chrome Debugger Breakpoint not Working

Body:
Can't seem to find an answer as to why debugger; isn't working.

        RSVP.aggregate([{
            $lookup: {
                from: "users", // collection name in db
                localField: "userId",
                foreignField: "_id",
                as: "user"
            }
        }
        ]).exec( (err, rsvpList) => {
            if (err) throw err("Mongoose aggregate failed to join rsvps to users: " + err);
            console.log('rsvp: ' + rsvpList[0].user.toString());
            debugger;
        });


问:
alternate methods of computing log change yield different structures
Can anyone explain why the second method of computing log change yields a numpy array, discarding the index instead of DataFrame? If I specify DataFrame I get one with integer based index.  The first method works as desired. Thanks for any insight.</p>

```<code>import numpy as np
import pandas as pd
import pandas_datareader as pdr
aapl = pdr.get_data_yahoo('AAPL')
close = pd.DataFrame(aapl['Close'])
change = np.log(close['Close'] / close['Close'].shift(1))
another_change = np.diff(np.log(close['Close']))
</code>```

答:
I can't find documentation to back this up, but it seems that the type returned is being converted to ndarray when there's a reduction in dimension from the Series input. This happens with diff but not with log.

Taking the simple example:

```<code>x = pd.Series(range(5))

change = np.log(x / x.shift(1)) # Series of float64 of length 5

another_change = np.diff(np.log(x)) # array of float64 of length 4
</code>```

We can observe that x / x.shift(1) is still a 5-element Series (even though elements 0 and 1 are NaN and inf)  So np.log, which doesn't reduce dimension, will still return a 5-element something, which matches the dimensionality of x.

However, np.diff does reduce dimension -- it is supposed to return (according to doc)

diff : ndarray
  The n-th differences. The shape of the output is the same as a except along axis where the dimension is smaller by n. [...]

The next sentence appears in the above doc for numpy 1.13 but not 1.12 and earlier:

[...] The type of the output is the same as that of the input.

So the type of the output is still an array-like structure, but because of the dimension being reduced, perhaps it doesn't get re-converted to a Series (the array-like input).  At least in versions 1.12 and earlier.

That's my best guess.

Body:
Can anyone explain why the second method of computing log change yields a numpy array, discarding the index instead of DataFrame? If I specify DataFrame I get one with integer based index.  The first method works as desired. Thanks for any insight.

import numpy as np
import pandas as pd
import pandas_datareader as pdr
aapl = pdr.get_data_yahoo('AAPL')
close = pd.DataFrame(aapl['Close'])
change = np.log(close['Close'] / close['Close'].shift(1))
another_change = np.diff(np.log(close['Close']))

Body:
I can't find documentation to back this up, but it seems that the type returned is being converted to ndarray when there's a reduction in dimension from the Series input. This happens with diff but not with log.

Taking the simple example:

x = pd.Series(range(5))

change = np.log(x / x.shift(1)) # Series of float64 of length 5

another_change = np.diff(np.log(x)) # array of float64 of length 4

We can observe that x / x.shift(1) is still a 5-element Series (even though elements 0 and 1 are NaN and inf)  So np.log, which doesn't reduce dimension, will still return a 5-element something, which matches the dimensionality of x.

However, np.diff does reduce dimension -- it is supposed to return (according to doc)

diff : ndarray
  The n-th differences. The shape of the output is the same as a except along axis where the dimension is smaller by n. [...]

The next sentence appears in the above doc for numpy 1.13 but not 1.12 and earlier:

[...] The type of the output is the same as that of the input.

So the type of the output is still an array-like structure, but because of the dimension being reduced, perhaps it doesn't get re-converted to a Series (the array-like input).  At least in versions 1.12 and earlier.

That's my best guess.


问:
Getting array of objects from CodableAlamofire
Im using Alamofire with the CodableAlamofire extension but I having trouble in get one data in my json response.

This is my json:

```<code>{
    "total": 95,
    "per_page": 100,
    "current_page": 1,
    "last_page": 1,
    "from": 1,
    "to": 95,
    "data": [
        {
            "id": 1,
            "name": "ONE",
            "city": "CITY 1"
        },
        {
            "id": 2,
            "name": "TWO",
            "city": "CITY 2"
        },
        {
            "id": 3,
            "name": "THREE",
            "city": "CITY 3"
        }
    ]
}
</code>```

I have these structs:

```<code>struct AssetResult: Decodable {
    let current_page : Int
//    let data : [AssetData]
    let from : Int
    let last_page : Int
    let per_page : Int
    let to : Int
    let total : Int

    enum CodingKeys : String, CodingKey {
        case current_page
//        case data
        case from
        case last_page
        case per_page
        case to
        case total
    }
}

struct AssetData: Decodable {
    let city : String
    let id : String
    let name : String
}
</code>```

And this is the code to get the data in AssetResult struct:

```<code>let parameters: Parameters = ["page": 1]
let url = URL(string: "http://url")!
let decoder = JSONDecoder()

Alamofire.request(url, parameters: parameters).responseDecodableObject(keyPath: nil, decoder: decoder) { (response: DataResponse<AssetResult>) in
            let repo = response.result.value
            print(repo)
        }
</code>```

The problem is everytime I try to get the data (uncommenting the data in the AssetResult struct) the print(repo) turn to nil.

If I let the data commented this is printed:

Optional(AssetResult(current_page: 1, from: 1, last_page: 1, per_page: 100, to: 95, total: 95))

How can I get the array of objects? Preferably as an array of AssetData objects.

Thanks

答:
I ran several tests with the JSON return and realized that some assets appeared without a city, which caused the error:

```<code>{
    "id": 10,
    "name": "TEN",
    "city": null
},
</code>```

So I just needed change the city to optional, adding the ? after the type:

```<code>struct AssetData: Decodable {
    let city : String?
    let id : String
    let name : String
}
</code>```

Body:
Im using Alamofire with the CodableAlamofire extension but I having trouble in get one data in my json response.

This is my json:

{
    "total": 95,
    "per_page": 100,
    "current_page": 1,
    "last_page": 1,
    "from": 1,
    "to": 95,
    "data": [
        {
            "id": 1,
            "name": "ONE",
            "city": "CITY 1"
        },
        {
            "id": 2,
            "name": "TWO",
            "city": "CITY 2"
        },
        {
            "id": 3,
            "name": "THREE",
            "city": "CITY 3"
        }
    ]
}

I have these structs:

struct AssetResult: Decodable {
    let current_page : Int
//    let data : [AssetData]
    let from : Int
    let last_page : Int
    let per_page : Int
    let to : Int
    let total : Int

    enum CodingKeys : String, CodingKey {
        case current_page
//        case data
        case from
        case last_page
        case per_page
        case to
        case total
    }
}

struct AssetData: Decodable {
    let city : String
    let id : String
    let name : String
}

And this is the code to get the data in AssetResult struct:

let parameters: Parameters = ["page": 1]
let url = URL(string: "http://url")!
let decoder = JSONDecoder()

Alamofire.request(url, parameters: parameters).responseDecodableObject(keyPath: nil, decoder: decoder) { (response: DataResponse<AssetResult>) in
            let repo = response.result.value
            print(repo)
        }

The problem is everytime I try to get the data (uncommenting the data in the AssetResult struct) the print(repo) turn to nil.

If I let the data commented this is printed:

Optional(AssetResult(current_page: 1, from: 1, last_page: 1, per_page: 100, to: 95, total: 95))

How can I get the array of objects? Preferably as an array of AssetData objects.

Thanks

Body:
I ran several tests with the JSON return and realized that some assets appeared without a city, which caused the error:

{
    "id": 10,
    "name": "TEN",
    "city": null
},

So I just needed change the city to optional, adding the ? after the type:

struct AssetData: Decodable {
    let city : String?
    let id : String
    let name : String
}