问:
minifyEnabled true and shrinkResources true in release build retrofit api's are not working
This is my proguard file:

```<code>-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
-printmapping mapping.txt

-keepattributes Signature, InnerClasses, EnclosingMethod

-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations

-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}

-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

-dontwarn javax.annotation.**

-dontwarn kotlin.Unit

-dontwarn retrofit2.KotlinExtensions

-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>

-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

-dontwarn org.codehaus.mojo.animal_sniffer.*

-dontwarn okhttp3.internal.platform.ConscryptPlatform

-keepattributes Signature

-keepattributes Annotation

-dontwarn sun.misc.**

-keep class com.google.gson.examples.android.model.** { <fields>; }

-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

-keepclassmembers,allowobfuscation class * {
  @com.google.gson.annotations.SerializedName <fields>;
</code>```

This is the log i am getting after running the release app:

```<code> <-- 200 https://api.gobaskt.com/dev-basket/gobaskt/basket (24002ms)
2020-02-20 12:39:57.729 10758-12256/com.gobaskt D/OkHttp: content-type: application/json
2020-02-20 12:39:57.729 10758-12256/com.gobaskt D/OkHttp: content-length: 6769
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: date: Thu, 20 Feb 2020 07:09:57 GMT
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amzn-requestid: 2f52af84-0138-45ab-b403-75e2583e4f90
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amz-apigw-id: ILyLSGD3CYcFlMg=
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amzn-trace-id: Root=1-5e4e30ae-7893b2e8430ff7b0f0793ae8;Sampled=0
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-cache: Miss from cloudfront
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: via: 1.1 66f5b63f0d6bfa07c6e6afd2b0f672b2.cloudfront.net (CloudFront)
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amz-cf-pop: BLR50-C1
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amz-cf-id: 7o44Q_yEkwYDRH0m-aqsmi6V3hPi1R7R8KOQ0mSd5PnpTkDw5j-BvA==
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: {"success":true,"message":"found","statusCode":200,"responseData":[{"id":"b3d06745-f030-40af-9704-3d7d51fe0458","basket_userId":null,"offers":{"offerId":"a0936455-f99a-4693-918e-c49356512d21","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-10 16:42:04.634","redeem_timeStamp":null,"lmname":"PK's bar & grill","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Bar & Grill Restaurant","lmid":"LM0003","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"20","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Excludes non dip items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/Jursey_mikes_image.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/2.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/logo_petco_copy.png","upccode":null}},{"id":"9c4eb971-03d3-491d-ab89-cf18c44f6bb3","basket_userId":null,"offers":{"offerId":"bd15effb-36ad-4449-9278-3c37942f7828","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-05 09:12:24.381","redeem_timeStamp":null,"lmname":"Amelia's Pizzeria & Restaurant","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Pizza Restautant","lmid":"LM0002","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"$ off","lmofferValue":"10","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Excludes non pizza items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/PKs_bar_grill+(1).png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/5.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/pk_s_logo_01.png","upccode":null}},{"id":"8ebe77cf-bb2d-468d-bb2f-10d76921c06a","basket_userId":null,"offers":{"offerId":"878b1c26-e721-4b51-8dcf-6887493629c5","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-10 05:51:40.891","redeem_timeStamp":null,"lmname":"Amelia's Pizzeria & Restaurant","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Pizza Restautant","lmid":"LM0002","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"20","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"No valid on non pizza items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/PKs_bar_grill+(1).png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/5.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/pk_s_logo_01.png","upccode":null}},{"id":"f762e94a-1652-4d86-a79b-4206e837ad29","basket_userId":null,"offers":{"offerId":"4b2e20d1-7ceb-45d8-bbc7-773d21601370","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-05 08:24:22.048","redeem_timeStamp":null,"lmname":"Jersey Mike's","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Subs Restaurant","lmid":"LM0001","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"15","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Valid on hot subs only","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/1602.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/4.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/jersey_mikes_1_copy_4.png","upccode":null}},{"id":"c7300b66-a9e4-44cb-a6f8-4c1af104fb11","basket_userId":null,"offers":{"offerId":"8
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: f40d7ca-2db7-45bb-a26f-fdcde43abb65","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-17 04:33:05.802","redeem_timeStamp":null,"lmname":"PK's bar & grill","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Bar & Grill Restaurant","lmid":"LM0003","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"20","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Excludes non dip items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/Jursey_mikes_image.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/2.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/logo_petco_copy.png","upccode":null}},{"id":"5f97c5a3-043a-4b42-bd21-9747ecbdb4af","basket_userId":null,"offers":{"offerId":"6c0dfbb8-b4bc-4db3-98e1-083ea4353bc5","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-18 05:38:57.512","redeem_timeStamp":null,"lmname":"Real life dental","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Dentist","lmid":"LM0005","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"15","offerCurrency":"USD","offerExpiryDate":"1/1/2020","offerExpiryTime":"10 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/2/2019","offerStartTime":"12 am EST","offerTermsandConditions":"Applicable only once per customer","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/354.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/1.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/1200_px_rite_aid_svg.png","upccode":null}},{"id":"d4f332d4-b4d9-476d-9d92-b8bfb1a3ae2c","basket_userId":null,"offers":{"offerId":"60deb825-fda9-4087-a2c5-59e95782b6f1","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-11 02:39:22.185","redeem_timeStamp":null,"lmname":"Real life dental","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Dentist","lmid":"LM0005","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"15","offerCurrency":"USD","offerExpiryDate":"1/1/2020","offerExpiryTime":"10 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/2/2019","offerStartTime":"12 am EST","offerTermsandConditions":"Applicable only once per customer","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/354.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/1.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/1200_px_rite_aid_svg.png","upccode":null}}]}
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: <-- END HTTP (6769-byte body)
2020-02-20 12:39:57.731 10758-12256/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2020-02-20 12:39:57.731 10758-12256/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2020-02-20 12:39:57.731 10758-12256/com.gobaskt D/FirebasePerformance: Retrieving Max Duration (in minutes) of single Session configuration value.
2020-02-20 12:39:57.731 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving master flag for Firebase Performance SDK enabled configuration value.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: 'true' for key: 'fpr_enabled' from Firebase Remote Config.
2020-02-20 12:39:57.732 10758-12256/com.gobaskt W/FirebaseRemoteConfig: No value of type 'FirebaseRemoteConfigValue' exists for parameter key 'fpr_session_max_duration_min'.
2020-02-20 12:39:57.732 10758-12256/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.r' is: '240'.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.q' is: 'true'.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving Firebase Performance SDK disabled versions configuration value.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: '' for key: 'fpr_disabled_android_versions' from Firebase Remote Config.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.n' is: ''. Resolving value as 'false'
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Logging NetworkRequestMetric - https://api.gobaskt.com/dev-basket/gobaskt/basket 6769b 24010ms,
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving master flag for Firebase Performance SDK enabled configuration value.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: 'true' for key: 'fpr_enabled' from Firebase Remote Config.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.q' is: 'true'.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving Firebase Performance SDK disabled versions configuration value.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: '' for key: 'fpr_disabled_android_versions' from Firebase Remote Config.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.n' is: ''. Resolving value as 'false'
2020-02-20 12:39:57.734 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving network request sampling rate configuration value.
2020-02-20 12:39:57.735 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: '1.0' for key: 'fpr_vc_network_request_sampling_rate' from Firebase Remote Config.
2020-02-20 12:39:57.735 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.l' is: '1.0'.
2020-02-20 12:39:57.735 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
2020-02-20 12:39:57.735 10758-12244/com.gobaskt E/a$a: java.lang.ClassCastException: f.j.c.z.h cannot be cast to f.i.d.b.c.c.a
        at f.i.d.c.i.b.b(SourceFile:26)
        at f.i.d.c.i.b$b.b(Unknown Source:11)
        at l.z.i.a.a.a(SourceFile:33)
        at m.a.s0.run(SourceFile:241)
        at m.a.l2.a.a(SourceFile:594)
        at m.a.l2.a.a(SourceFile:60)
        at m.a.l2.a$b.run(SourceFile:740)
2020-02-20 12:39:57.735 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-02-20 12:39:57.760 10758-10758/com.gobaskt V/ViewRootImpl: The specified message queue synchronization  barrier token has not been posted or has already been removed
2020-02-20 12:42:00.386 10758-12318/com.gobaskt V/FA: Recording user engagement, ms: 147302
2020-02-20 12:42:00.388 10758-12318/com.gobaskt V/FA: Connecting to remote service
2020-02-20 12:42:00.425 10758-10758/com.gobaskt D/FirebasePerformance: Retrieving Max Duration (in minutes) of single Session configuration value.
2020-02-20 12:42:00.426 10758-10758/com.gobaskt W/FirebaseRemoteConfig: No value of type 'FirebaseRemoteConfigValue' exists for parameter key 'fpr_session_max_duration_min'.
2020-02-20 12:42:00.426 10758-10758/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.r' is: '240'.
2020-02-20 12:42:00.427 10758-10758/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.i' is: 'false'.
2020-02-20 12:42:00.428 10758-10758/com.gobaskt D/FirebasePerformance: CollectionEnabled metadata key unknown or value not found in manifest.
</code>```

Below is the build type :

```<code>release {
        manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]
        minifyEnabled true   // Obfuscate and minify codes
        shrinkResources true // Remove unused resources
        useProguard true     // Remove unused codes
        debuggable true
        signingConfig signingConfigs.release
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), '../proguard-rules.pro'
    }
</code>```

I have also added a screen shot of message that i am getting on api call.
Everything is working fine is debug build. I am facing issue in release build only.
I have already used serializedName for my model.
Tried so many answer from stackoverflow from last two days.
If anyone have any idea please let me know.

答:
I have Same issue with release build and release-debug variant was working well.

Following was an error :

```<code>.z.i.a.a.b(:33)
at kotlinx.coroutines.v0.run(:241)
at kotlinx.coroutines.w2.a.a(:594)
at kotlinx.coroutines.w2.a.a(:60)
at kotlinx.coroutines.w2.a$b.run(:740)
</code>```

just add below gradle :

```<code>implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
</code>```

add following things in proguard file from this link :
coroutines.pro

Body:
This is my proguard file:

-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
-printmapping mapping.txt

-keepattributes Signature, InnerClasses, EnclosingMethod

-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations

-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}

-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

-dontwarn javax.annotation.**

-dontwarn kotlin.Unit

-dontwarn retrofit2.KotlinExtensions

-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>

-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

-dontwarn org.codehaus.mojo.animal_sniffer.*

-dontwarn okhttp3.internal.platform.ConscryptPlatform

-keepattributes Signature

-keepattributes Annotation

-dontwarn sun.misc.**

-keep class com.google.gson.examples.android.model.** { <fields>; }

-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

-keepclassmembers,allowobfuscation class * {
  @com.google.gson.annotations.SerializedName <fields>;

This is the log i am getting after running the release app:

 <-- 200 https://api.gobaskt.com/dev-basket/gobaskt/basket (24002ms)
2020-02-20 12:39:57.729 10758-12256/com.gobaskt D/OkHttp: content-type: application/json
2020-02-20 12:39:57.729 10758-12256/com.gobaskt D/OkHttp: content-length: 6769
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: date: Thu, 20 Feb 2020 07:09:57 GMT
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amzn-requestid: 2f52af84-0138-45ab-b403-75e2583e4f90
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amz-apigw-id: ILyLSGD3CYcFlMg=
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amzn-trace-id: Root=1-5e4e30ae-7893b2e8430ff7b0f0793ae8;Sampled=0
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-cache: Miss from cloudfront
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: via: 1.1 66f5b63f0d6bfa07c6e6afd2b0f672b2.cloudfront.net (CloudFront)
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amz-cf-pop: BLR50-C1
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amz-cf-id: 7o44Q_yEkwYDRH0m-aqsmi6V3hPi1R7R8KOQ0mSd5PnpTkDw5j-BvA==
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: {"success":true,"message":"found","statusCode":200,"responseData":[{"id":"b3d06745-f030-40af-9704-3d7d51fe0458","basket_userId":null,"offers":{"offerId":"a0936455-f99a-4693-918e-c49356512d21","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-10 16:42:04.634","redeem_timeStamp":null,"lmname":"PK's bar & grill","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Bar & Grill Restaurant","lmid":"LM0003","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"20","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Excludes non dip items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/Jursey_mikes_image.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/2.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/logo_petco_copy.png","upccode":null}},{"id":"9c4eb971-03d3-491d-ab89-cf18c44f6bb3","basket_userId":null,"offers":{"offerId":"bd15effb-36ad-4449-9278-3c37942f7828","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-05 09:12:24.381","redeem_timeStamp":null,"lmname":"Amelia's Pizzeria & Restaurant","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Pizza Restautant","lmid":"LM0002","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"$ off","lmofferValue":"10","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Excludes non pizza items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/PKs_bar_grill+(1).png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/5.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/pk_s_logo_01.png","upccode":null}},{"id":"8ebe77cf-bb2d-468d-bb2f-10d76921c06a","basket_userId":null,"offers":{"offerId":"878b1c26-e721-4b51-8dcf-6887493629c5","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-10 05:51:40.891","redeem_timeStamp":null,"lmname":"Amelia's Pizzeria & Restaurant","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Pizza Restautant","lmid":"LM0002","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"20","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"No valid on non pizza items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/PKs_bar_grill+(1).png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/5.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/pk_s_logo_01.png","upccode":null}},{"id":"f762e94a-1652-4d86-a79b-4206e837ad29","basket_userId":null,"offers":{"offerId":"4b2e20d1-7ceb-45d8-bbc7-773d21601370","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-05 08:24:22.048","redeem_timeStamp":null,"lmname":"Jersey Mike's","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Subs Restaurant","lmid":"LM0001","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"15","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Valid on hot subs only","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/1602.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/4.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/jersey_mikes_1_copy_4.png","upccode":null}},{"id":"c7300b66-a9e4-44cb-a6f8-4c1af104fb11","basket_userId":null,"offers":{"offerId":"8
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: f40d7ca-2db7-45bb-a26f-fdcde43abb65","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-17 04:33:05.802","redeem_timeStamp":null,"lmname":"PK's bar & grill","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Bar & Grill Restaurant","lmid":"LM0003","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"20","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Excludes non dip items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/Jursey_mikes_image.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/2.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/logo_petco_copy.png","upccode":null}},{"id":"5f97c5a3-043a-4b42-bd21-9747ecbdb4af","basket_userId":null,"offers":{"offerId":"6c0dfbb8-b4bc-4db3-98e1-083ea4353bc5","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-18 05:38:57.512","redeem_timeStamp":null,"lmname":"Real life dental","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Dentist","lmid":"LM0005","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"15","offerCurrency":"USD","offerExpiryDate":"1/1/2020","offerExpiryTime":"10 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/2/2019","offerStartTime":"12 am EST","offerTermsandConditions":"Applicable only once per customer","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/354.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/1.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/1200_px_rite_aid_svg.png","upccode":null}},{"id":"d4f332d4-b4d9-476d-9d92-b8bfb1a3ae2c","basket_userId":null,"offers":{"offerId":"60deb825-fda9-4087-a2c5-59e95782b6f1","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-11 02:39:22.185","redeem_timeStamp":null,"lmname":"Real life dental","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Dentist","lmid":"LM0005","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"15","offerCurrency":"USD","offerExpiryDate":"1/1/2020","offerExpiryTime":"10 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/2/2019","offerStartTime":"12 am EST","offerTermsandConditions":"Applicable only once per customer","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/354.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/1.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/1200_px_rite_aid_svg.png","upccode":null}}]}
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: <-- END HTTP (6769-byte body)
2020-02-20 12:39:57.731 10758-12256/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2020-02-20 12:39:57.731 10758-12256/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2020-02-20 12:39:57.731 10758-12256/com.gobaskt D/FirebasePerformance: Retrieving Max Duration (in minutes) of single Session configuration value.
2020-02-20 12:39:57.731 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving master flag for Firebase Performance SDK enabled configuration value.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: 'true' for key: 'fpr_enabled' from Firebase Remote Config.
2020-02-20 12:39:57.732 10758-12256/com.gobaskt W/FirebaseRemoteConfig: No value of type 'FirebaseRemoteConfigValue' exists for parameter key 'fpr_session_max_duration_min'.
2020-02-20 12:39:57.732 10758-12256/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.r' is: '240'.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.q' is: 'true'.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving Firebase Performance SDK disabled versions configuration value.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: '' for key: 'fpr_disabled_android_versions' from Firebase Remote Config.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.n' is: ''. Resolving value as 'false'
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Logging NetworkRequestMetric - https://api.gobaskt.com/dev-basket/gobaskt/basket 6769b 24010ms,
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving master flag for Firebase Performance SDK enabled configuration value.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: 'true' for key: 'fpr_enabled' from Firebase Remote Config.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.q' is: 'true'.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving Firebase Performance SDK disabled versions configuration value.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: '' for key: 'fpr_disabled_android_versions' from Firebase Remote Config.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.n' is: ''. Resolving value as 'false'
2020-02-20 12:39:57.734 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving network request sampling rate configuration value.
2020-02-20 12:39:57.735 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: '1.0' for key: 'fpr_vc_network_request_sampling_rate' from Firebase Remote Config.
2020-02-20 12:39:57.735 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.l' is: '1.0'.
2020-02-20 12:39:57.735 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
2020-02-20 12:39:57.735 10758-12244/com.gobaskt E/a$a: java.lang.ClassCastException: f.j.c.z.h cannot be cast to f.i.d.b.c.c.a
        at f.i.d.c.i.b.b(SourceFile:26)
        at f.i.d.c.i.b$b.b(Unknown Source:11)
        at l.z.i.a.a.a(SourceFile:33)
        at m.a.s0.run(SourceFile:241)
        at m.a.l2.a.a(SourceFile:594)
        at m.a.l2.a.a(SourceFile:60)
        at m.a.l2.a$b.run(SourceFile:740)
2020-02-20 12:39:57.735 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-02-20 12:39:57.760 10758-10758/com.gobaskt V/ViewRootImpl: The specified message queue synchronization  barrier token has not been posted or has already been removed
2020-02-20 12:42:00.386 10758-12318/com.gobaskt V/FA: Recording user engagement, ms: 147302
2020-02-20 12:42:00.388 10758-12318/com.gobaskt V/FA: Connecting to remote service
2020-02-20 12:42:00.425 10758-10758/com.gobaskt D/FirebasePerformance: Retrieving Max Duration (in minutes) of single Session configuration value.
2020-02-20 12:42:00.426 10758-10758/com.gobaskt W/FirebaseRemoteConfig: No value of type 'FirebaseRemoteConfigValue' exists for parameter key 'fpr_session_max_duration_min'.
2020-02-20 12:42:00.426 10758-10758/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.r' is: '240'.
2020-02-20 12:42:00.427 10758-10758/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.i' is: 'false'.
2020-02-20 12:42:00.428 10758-10758/com.gobaskt D/FirebasePerformance: CollectionEnabled metadata key unknown or value not found in manifest.

Below is the build type :

release {
        manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]
        minifyEnabled true   // Obfuscate and minify codes
        shrinkResources true // Remove unused resources
        useProguard true     // Remove unused codes
        debuggable true
        signingConfig signingConfigs.release
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), '../proguard-rules.pro'
    }

I have also added a screen shot of message that i am getting on api call.
Everything is working fine is debug build. I am facing issue in release build only.
I have already used serializedName for my model.
Tried so many answer from stackoverflow from last two days.
If anyone have any idea please let me know.

Body:
I have Same issue with release build and release-debug variant was working well.

Following was an error :

.z.i.a.a.b(:33)
at kotlinx.coroutines.v0.run(:241)
at kotlinx.coroutines.w2.a.a(:594)
at kotlinx.coroutines.w2.a.a(:60)
at kotlinx.coroutines.w2.a$b.run(:740)

just add below gradle :

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'

add following things in proguard file from this link :
coroutines.pro


来源: stackexchange

问:
Arranging of column in multiple excel files in R
I am attempting to combine two or more columns in an automated way in some survey data (by using R). The data are in Excel file with .csv format. Example data:

Data frame name Andy:

```<code>Name : Andy
Country :
Location :
Time
 a    b    c    d    e    f    g    h    i    j    k    l    m    n    o
100  -2   100   1   159  200   5   250   5   100  -5   100  -6   2000
200   1   200   1   260  200   7   250   7   100  -7   200  -8   2500
300   0   300   1   480                                300       3000
          100   1
          200   1
          100   1
          200   1
          300   1
</code>```

Data frame name Benny:

```<code>Name : Benny
Country :
Location :
Time
 a    b    c    d    e    f    g    h    i    j    k    l    m    n     o
100  -1   100   1   357  900   5   900   5   900  -5   900  -6   2000  -7
200   0   200   1   680  900   7   900   7   950  -7   950  -8   2500  -8
300   1   300   1   240                                970       3000  -9
          100   1   362
          200   1
          100   1
          200   1
          100   1
          200   1
          300   1
</code>```

Desired result:

```<code>Andy   Andy   Benny   Benny
 a      b       a       b
100    -2      100     -1
200     1      200      0
300     0      300      1

Andy  Benny
 e      e
159    357
260    680
480    240
       362

Andy  Andy  Andy  Andy  Andy  Benny  Benny  Benny  Benny  Benny  Benny
  j    k     l     m     n     j       k      l      m      n      o
 100  -5    100   -6    2000  900     -5     900    -6     2000   -7
 100  -7    200   -8    2500  950     -7     950    -8     2500   -8
            300         3000                 970           3000   -9
</code>```

答:
Is it correct that what you're looking for is simply to bind those columns together without any need that rows align in a certain way? Then the following should work:

```<code># read data from csv file
Andy <- read.csv2("Andy.csv")
Benny <- read.csv2("Benny.csv")

# to bind two data frames together, they have to be of the same length, i.e. you need add two rows to Andy, even if they're only filled with NAs
Andy[(length(Andy$a)+1):length(Benny$a),] <- NA

# bind columns together
df1 <- cbind(Andy[,c("a", "b")], Benny[, c("a", "b")])
df1 <- df1[complete.cases(df1),] # delete rows containing only NAs

# if you don't want to specify the column names directly, safe them in a vector first
colnam1 <- c("a", "b")
df1 <- cbind(Andy[,colnam1], Benny[, colnam1])
df1 <- df1[complete.cases(df1),]
</code>```

I guess you would then have to change column names as well, as they are identical now. You can then do the same for all the three data frames you want to have. Is that what you want?

Data I'm using:

```<code>dput(Benny)
structure(list(a = c(100L, 200L, 300L, NA, NA, NA, NA, NA, NA,
NA), b = c(-1L, 0L, 1L, NA, NA, NA, NA, NA, NA, NA), c = c(100L,
200L, 300L, 100L, 200L, 100L, 200L, 100L, 200L, 300L), d = c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), e = c(357L, 680L, 240L,
362L, NA, NA, NA, NA, NA, NA), f = c(900L, 900L, NA, NA, NA,
NA, NA, NA, NA, NA), g = c(5L, 7L, NA, NA, NA, NA, NA, NA, NA,
NA), h = c(900L, 900L, NA, NA, NA, NA, NA, NA, NA, NA), i = c(5L,
7L, NA, NA, NA, NA, NA, NA, NA, NA), j = c(900L, 950L, NA, NA,
NA, NA, NA, NA, NA, NA), k = c(-5L, -7L, NA, NA, NA, NA, NA,
NA, NA, NA), l = c(900L, 950L, 970L, NA, NA, NA, NA, NA, NA,
NA), m = c(-6L, -8L, NA, NA, NA, NA, NA, NA, NA, NA), n = c(2000L,
2500L, 3000L, NA, NA, NA, NA, NA, NA, NA), o = c(-7L, -8L, -9L,
NA, NA, NA, NA, NA, NA, NA)), class = "data.frame", row.names = c(NA,
-10L))

dput(Andy)
structure(list(a = c(100L, 200L, 300L, NA, NA, NA, NA, NA), b = c(-2L,
1L, 0L, NA, NA, NA, NA, NA), c = c(100L, 200L, 300L, 100L, 200L,
100L, 200L, 300L), d = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), e = c(159L,
260L, 480L, NA, NA, NA, NA, NA), f = c(200L, 200L, NA, NA, NA,
NA, NA, NA), g = c(5L, 7L, NA, NA, NA, NA, NA, NA), h = c(250L,
250L, NA, NA, NA, NA, NA, NA), i = c(5L, 7L, NA, NA, NA, NA,
NA, NA), j = c(100L, 100L, NA, NA, NA, NA, NA, NA), k = c(-5L,
-7L, NA, NA, NA, NA, NA, NA), l = c(100L, 200L, 300L, NA, NA,
NA, NA, NA), m = c(-6L, -8L, NA, NA, NA, NA, NA, NA), n = c(2000L,
2500L, 3000L, NA, NA, NA, NA, NA), o = c(NA, NA, NA, NA, NA,
NA, NA, NA)), class = "data.frame", row.names = c(NA, -8L))
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am attempting to combine two or more columns in an automated way in some survey data (by using R). The data are in Excel file with .csv format. Example data:

Data frame name Andy:

Name : Andy
Country :
Location :
Time
 a    b    c    d    e    f    g    h    i    j    k    l    m    n    o
100  -2   100   1   159  200   5   250   5   100  -5   100  -6   2000
200   1   200   1   260  200   7   250   7   100  -7   200  -8   2500
300   0   300   1   480                                300       3000
          100   1
          200   1
          100   1
          200   1
          300   1

Data frame name Benny:

Name : Benny
Country :
Location :
Time
 a    b    c    d    e    f    g    h    i    j    k    l    m    n     o
100  -1   100   1   357  900   5   900   5   900  -5   900  -6   2000  -7
200   0   200   1   680  900   7   900   7   950  -7   950  -8   2500  -8
300   1   300   1   240                                970       3000  -9
          100   1   362
          200   1
          100   1
          200   1
          100   1
          200   1
          300   1

Desired result:

Andy   Andy   Benny   Benny
 a      b       a       b
100    -2      100     -1
200     1      200      0
300     0      300      1

Andy  Benny
 e      e
159    357
260    680
480    240
       362

Andy  Andy  Andy  Andy  Andy  Benny  Benny  Benny  Benny  Benny  Benny
  j    k     l     m     n     j       k      l      m      n      o
 100  -5    100   -6    2000  900     -5     900    -6     2000   -7
 100  -7    200   -8    2500  950     -7     950    -8     2500   -8
            300         3000                 970           3000   -9

Body:
Is it correct that what you're looking for is simply to bind those columns together without any need that rows align in a certain way? Then the following should work:

# read data from csv file
Andy <- read.csv2("Andy.csv")
Benny <- read.csv2("Benny.csv")

# to bind two data frames together, they have to be of the same length, i.e. you need add two rows to Andy, even if they're only filled with NAs
Andy[(length(Andy$a)+1):length(Benny$a),] <- NA

# bind columns together
df1 <- cbind(Andy[,c("a", "b")], Benny[, c("a", "b")])
df1 <- df1[complete.cases(df1),] # delete rows containing only NAs

# if you don't want to specify the column names directly, safe them in a vector first
colnam1 <- c("a", "b")
df1 <- cbind(Andy[,colnam1], Benny[, colnam1])
df1 <- df1[complete.cases(df1),]

I guess you would then have to change column names as well, as they are identical now. You can then do the same for all the three data frames you want to have. Is that what you want?

Data I'm using:

dput(Benny)
structure(list(a = c(100L, 200L, 300L, NA, NA, NA, NA, NA, NA,
NA), b = c(-1L, 0L, 1L, NA, NA, NA, NA, NA, NA, NA), c = c(100L,
200L, 300L, 100L, 200L, 100L, 200L, 100L, 200L, 300L), d = c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), e = c(357L, 680L, 240L,
362L, NA, NA, NA, NA, NA, NA), f = c(900L, 900L, NA, NA, NA,
NA, NA, NA, NA, NA), g = c(5L, 7L, NA, NA, NA, NA, NA, NA, NA,
NA), h = c(900L, 900L, NA, NA, NA, NA, NA, NA, NA, NA), i = c(5L,
7L, NA, NA, NA, NA, NA, NA, NA, NA), j = c(900L, 950L, NA, NA,
NA, NA, NA, NA, NA, NA), k = c(-5L, -7L, NA, NA, NA, NA, NA,
NA, NA, NA), l = c(900L, 950L, 970L, NA, NA, NA, NA, NA, NA,
NA), m = c(-6L, -8L, NA, NA, NA, NA, NA, NA, NA, NA), n = c(2000L,
2500L, 3000L, NA, NA, NA, NA, NA, NA, NA), o = c(-7L, -8L, -9L,
NA, NA, NA, NA, NA, NA, NA)), class = "data.frame", row.names = c(NA,
-10L))

dput(Andy)
structure(list(a = c(100L, 200L, 300L, NA, NA, NA, NA, NA), b = c(-2L,
1L, 0L, NA, NA, NA, NA, NA), c = c(100L, 200L, 300L, 100L, 200L,
100L, 200L, 300L), d = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), e = c(159L,
260L, 480L, NA, NA, NA, NA, NA), f = c(200L, 200L, NA, NA, NA,
NA, NA, NA), g = c(5L, 7L, NA, NA, NA, NA, NA, NA), h = c(250L,
250L, NA, NA, NA, NA, NA, NA), i = c(5L, 7L, NA, NA, NA, NA,
NA, NA), j = c(100L, 100L, NA, NA, NA, NA, NA, NA), k = c(-5L,
-7L, NA, NA, NA, NA, NA, NA), l = c(100L, 200L, 300L, NA, NA,
NA, NA, NA), m = c(-6L, -8L, NA, NA, NA, NA, NA, NA), n = c(2000L,
2500L, 3000L, NA, NA, NA, NA, NA), o = c(NA, NA, NA, NA, NA,
NA, NA, NA)), class = "data.frame", row.names = c(NA, -8L))


问:
Ignore Typescript Errors "property does not exist on value of type"
In VS2013 building stops when tsc exits with code 1. This was not the case in VS2012.

How can I run my solution while ignoring the tsc.exe error?

I get many The property 'x' does not exist on value of type 'y' errors, which I want to ignore when using javascript functions.

答:
I know it's now 2020, but I couldn't see an answer that satisfied the "ignore" part of the question. Turns out, you can tell TSLint to do just that using a directive;

```<code>// @ts-ignore
this.x = this.x.filter(x => x.someProp !== false);
</code>```

Normally this would throw an error, stating that 'someProp does not exist on type'. With the comment, that error goes away.

This will stop any errors being thrown when compiling and should also stop your IDE complaining at you.

Body:
I know it's now 2020, but I couldn't see an answer that satisfied the "ignore" part of the question. Turns out, you can tell TSLint to do just that using a directive;

// @ts-ignore
this.x = this.x.filter(x => x.someProp !== false);

Normally this would throw an error, stating that 'someProp does not exist on type'. With the comment, that error goes away.

This will stop any errors being thrown when compiling and should also stop your IDE complaining at you.


问:
How to train a Neural ODE to predict Lotka Voltera Time Series in Julia?
I want to decouple the ODE from which a time series data is generated and a Neural Network embedded in an ODE which is trying to learn the structure of this data. In other terms, I want to replicate the example on time-series extrapolation provided in https://julialang.org/blog/2019/01/fluxdiffeq/, but with a different underlying function, i.e. I am using Lotka-Voltera to generate the data.

My workflow in Julia is the following (Note that I am rather new to Julia, but I hope it's clear.):

```<code>train_size = 32
tspan_train = (0.0f0,4.00f0)

u0 = [1.0,1.0]
p = [1.5,1.0,3.0,1.0]

function lotka_volterra(du,u,p,t)
  x, y = u
  α, β, δ, γ = p
  du[1] = dx = α*x - β*x*y
  du[2] = dy = -δ*y + γ*x*y
end

t_train = range(tspan_train[1],tspan_train[2],length = train_size)

prob = ODEProblem(lotka_volterra, u0, tspan_train,p)
ode_data_train = Array(solve(prob, Tsit5(),saveat=t_train))

function create_neural_ode(solver, tspan, t_saveat)
    dudt = Chain(
            Dense(2,50,tanh),
            Dense(50,2))
    ps = Flux.params(dudt)
    n_ode = NeuralODE(dudt, tspan, solver, saveat = t_saveat, reltol=1e-7, abstol=1e-9)
    n_ode
end

function predict_n_ode(ps)
    n_ode(u0,ps)
end
function loss_n_ode(ps)
    pred = predict_n_ode(ps)
    loss = sum(abs2, ode_data_train .- pred)
    loss,pred
end

n_ode = create_neural_ode(Tsit5(), tspan_train, t_train)

final_p = Any[]
losses = []
cb = function(p,loss,pred)
            display(loss)
            display(p)
            push!(final_p, copy(p))
            push!(losses,loss)
            pl = scatter(t_train, ode_data_train[1,:],label="data")
            scatter!(pl,t_train,pred[1,:],label="prediction")
            display(plot(pl))
        end

sol = DiffEqFlux.sciml_train!(loss_n_ode, n_ode.p, ADAM(0.05), cb = cb, maxiters = 100)

# Plot and save training results
x = 1:100
plot_to_save = plot(x,losses,title=solver_name,label="loss")
plot(x,losses,title=solver_name, label="loss")
xlabel!("Epochs")
</code>```

However I can observe that my NN is not learning much, it stagnates and the loss stays at around 155 with Euler and Tsit5, and behaves a bit better with RK4 (loss 142).

I would be very thankful if someone points out if I'm doing an error in my implementation or if this behaviour is expected.

答: Increasing the number for maxiters = to 300 helped achieving better fits, but the training is extremely unstable.

Body:
I want to decouple the ODE from which a time series data is generated and a Neural Network embedded in an ODE which is trying to learn the structure of this data. In other terms, I want to replicate the example on time-series extrapolation provided in https://julialang.org/blog/2019/01/fluxdiffeq/, but with a different underlying function, i.e. I am using Lotka-Voltera to generate the data.

My workflow in Julia is the following (Note that I am rather new to Julia, but I hope it's clear.):

train_size = 32
tspan_train = (0.0f0,4.00f0)

u0 = [1.0,1.0]
p = [1.5,1.0,3.0,1.0]

function lotka_volterra(du,u,p,t)
  x, y = u
  α, β, δ, γ = p
  du[1] = dx = α*x - β*x*y
  du[2] = dy = -δ*y + γ*x*y
end

t_train = range(tspan_train[1],tspan_train[2],length = train_size)

prob = ODEProblem(lotka_volterra, u0, tspan_train,p)
ode_data_train = Array(solve(prob, Tsit5(),saveat=t_train))

function create_neural_ode(solver, tspan, t_saveat)
    dudt = Chain(
            Dense(2,50,tanh),
            Dense(50,2))
    ps = Flux.params(dudt)
    n_ode = NeuralODE(dudt, tspan, solver, saveat = t_saveat, reltol=1e-7, abstol=1e-9)
    n_ode
end

function predict_n_ode(ps)
    n_ode(u0,ps)
end
function loss_n_ode(ps)
    pred = predict_n_ode(ps)
    loss = sum(abs2, ode_data_train .- pred)
    loss,pred
end

n_ode = create_neural_ode(Tsit5(), tspan_train, t_train)

final_p = Any[]
losses = []
cb = function(p,loss,pred)
            display(loss)
            display(p)
            push!(final_p, copy(p))
            push!(losses,loss)
            pl = scatter(t_train, ode_data_train[1,:],label="data")
            scatter!(pl,t_train,pred[1,:],label="prediction")
            display(plot(pl))
        end

sol = DiffEqFlux.sciml_train!(loss_n_ode, n_ode.p, ADAM(0.05), cb = cb, maxiters = 100)

# Plot and save training results
x = 1:100
plot_to_save = plot(x,losses,title=solver_name,label="loss")
plot(x,losses,title=solver_name, label="loss")
xlabel!("Epochs")

However I can observe that my NN is not learning much, it stagnates and the loss stays at around 155 with Euler and Tsit5, and behaves a bit better with RK4 (loss 142).

I would be very thankful if someone points out if I'm doing an error in my implementation or if this behaviour is expected.


问:
EasyTable - Paragraph in a cell
I am using your EasyTable library and it is fantastic, for my use it is better than itext7. I have only one problem. I'm trying to insert a paragraph with multiple lines inside a cell but it gives me an error. Here is my class.

The error is:

```

    Exception in thread "main" java.lang.NullPointerException
        at org.vandeseer.easytable.drawing.cell.ParagraphCellDrawer.drawContent(ParagraphCellDrawer.java:52)
        at org.vandeseer.easytable.TableDrawer.lambda$new$0(TableDrawer.java:53)
        at org.vandeseer.easytable.TableDrawer.drawRow(TableDrawer.java:161)
        at org.vandeseer.easytable.TableDrawer.drawWithFunction(TableDrawer.java:145)
        at org.vandeseer.easytable.TableDrawer.lambda$drawPage$1(TableDrawer.java:75)
        at java.lang.Iterable.forEach(Iterable.java:75)
        at org.vandeseer.easytable.TableDrawer.drawPage(TableDrawer.java:74)
        at org.vandeseer.easytable.TableDrawer.draw(TableDrawer.java:70)
        at it.baz.ProvaPDF.crea(ProvaPDF.java:66)
        at it.baz.ProvaPDF.main(ProvaPDF.java:21)

```

```</p>

<code>package it.baz;

import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.vandeseer.easytable.TableDrawer;
import org.vandeseer.easytable.settings.HorizontalAlignment;
import org.vandeseer.easytable.structure.Row;
import org.vandeseer.easytable.structure.Table;
import org.vandeseer.easytable.structure.cell.TextCell;
import org.vandeseer.easytable.structure.cell.paragraph.*;

import java.awt.*;
import java.io.IOException;

public class ProvaPDF {
    public static void main(String[] args) {
        ProvaPDF pdf = new ProvaPDF();
        pdf.crea();
    }

    private void crea() {
        try {
            PDDocument document = new PDDocument();

            final PDPage page = new PDPage(PDRectangle.A4);
            document.addPage(page);

            PDPageContentStream contentStream = new PDPageContentStream(document, page);

            Table myTable = Table.builder()
                    .addColumnsOfWidth(100, 100)
                    .addRow(Row.builder()
                            .add(TextCell.builder().text("One One").borderWidth(1).backgroundColor(Color.GRAY).build())
                            .add(TextCell.builder().text("One Two").borderWidth(1).backgroundColor(Color.LIGHT_GRAY).build())
                            .build())
                    .addRow(Row.builder()
                            .add(TextCell.builder().text("Two One").borderWidth(1).textColor(Color.RED).build())
                            .add(TextCell.builder().text("Two Two").borderWidth(1).horizontalAlignment(HorizontalAlignment.RIGHT).build())
                            .build())
                    .addRow(Row.builder()
                            .add(TextCell.builder().text("Two Two").borderWidth(1).horizontalAlignment(HorizontalAlignment.RIGHT).build())

                            .add(ParagraphCell.builder()
                                    .paragraph(ParagraphCell.Paragraph.builder()
                                            .append(StyledText.builder().text("This is some text in one font.").build())
                                            .appendNewLine()
                                            .build())
                                    .build())
                            .build())
                    .build();

            TableDrawer tableDrawer = TableDrawer.builder()
                    .contentStream(contentStream)
                    .startX((page.getMediaBox().getUpperRightX() - 200) / 2)
                    .startY(page.getMediaBox().getUpperRightY() - 20)
                    .table(myTable)
                    .build();

            System.out.println(page.getMediaBox().getUpperRightY());
            System.out.println(page.getMediaBox().getUpperRightX());

            tableDrawer.draw();

            contentStream.close();

            document.save("example.pdf");
        } catch (IOException e) {
            System.out.println(e.getMessage());
        }
    }
}
</code>```

Thank you.

答:
Vandaer suggested this solution:</p>

```<code>TableDrawer tableDrawer = TableDrawer.builder()
            .contentStream(contentStream)
            .page(page) // <-- This was missing
            .startX((page.getMediaBox().getUpperRightX() - 200) / 2)
            .startY(page.getMediaBox().getUpperRightY() - 20)
            .table(myTable)
            .build();
</code>```

Title: EasyTable - Paragraph in a cell

Body:
I am using your EasyTable library and it is fantastic, for my use it is better than itext7. I have only one problem. I'm trying to insert a paragraph with multiple lines inside a cell but it gives me an error. Here is my class.

The error is:

    Exception in thread "main" java.lang.NullPointerException
        at org.vandeseer.easytable.drawing.cell.ParagraphCellDrawer.drawContent(ParagraphCellDrawer.java:52)
        at org.vandeseer.easytable.TableDrawer.lambda$new$0(TableDrawer.java:53)
        at org.vandeseer.easytable.TableDrawer.drawRow(TableDrawer.java:161)
        at org.vandeseer.easytable.TableDrawer.drawWithFunction(TableDrawer.java:145)
        at org.vandeseer.easytable.TableDrawer.lambda$drawPage$1(TableDrawer.java:75)
        at java.lang.Iterable.forEach(Iterable.java:75)
        at org.vandeseer.easytable.TableDrawer.drawPage(TableDrawer.java:74)
        at org.vandeseer.easytable.TableDrawer.draw(TableDrawer.java:70)
        at it.baz.ProvaPDF.crea(ProvaPDF.java:66)
        at it.baz.ProvaPDF.main(ProvaPDF.java:21)

package it.baz;

import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.vandeseer.easytable.TableDrawer;
import org.vandeseer.easytable.settings.HorizontalAlignment;
import org.vandeseer.easytable.structure.Row;
import org.vandeseer.easytable.structure.Table;
import org.vandeseer.easytable.structure.cell.TextCell;
import org.vandeseer.easytable.structure.cell.paragraph.*;

import java.awt.*;
import java.io.IOException;

public class ProvaPDF {
    public static void main(String[] args) {
        ProvaPDF pdf = new ProvaPDF();
        pdf.crea();
    }

    private void crea() {
        try {
            PDDocument document = new PDDocument();

            final PDPage page = new PDPage(PDRectangle.A4);
            document.addPage(page);

            PDPageContentStream contentStream = new PDPageContentStream(document, page);

            Table myTable = Table.builder()
                    .addColumnsOfWidth(100, 100)
                    .addRow(Row.builder()
                            .add(TextCell.builder().text("One One").borderWidth(1).backgroundColor(Color.GRAY).build())
                            .add(TextCell.builder().text("One Two").borderWidth(1).backgroundColor(Color.LIGHT_GRAY).build())
                            .build())
                    .addRow(Row.builder()
                            .add(TextCell.builder().text("Two One").borderWidth(1).textColor(Color.RED).build())
                            .add(TextCell.builder().text("Two Two").borderWidth(1).horizontalAlignment(HorizontalAlignment.RIGHT).build())
                            .build())
                    .addRow(Row.builder()
                            .add(TextCell.builder().text("Two Two").borderWidth(1).horizontalAlignment(HorizontalAlignment.RIGHT).build())

                            .add(ParagraphCell.builder()
                                    .paragraph(ParagraphCell.Paragraph.builder()
                                            .append(StyledText.builder().text("This is some text in one font.").build())
                                            .appendNewLine()
                                            .build())
                                    .build())
                            .build())
                    .build();

            TableDrawer tableDrawer = TableDrawer.builder()
                    .contentStream(contentStream)
                    .startX((page.getMediaBox().getUpperRightX() - 200) / 2)
                    .startY(page.getMediaBox().getUpperRightY() - 20)
                    .table(myTable)
                    .build();

            System.out.println(page.getMediaBox().getUpperRightY());
            System.out.println(page.getMediaBox().getUpperRightX());

            tableDrawer.draw();

            contentStream.close();

            document.save("example.pdf");
        } catch (IOException e) {
            System.out.println(e.getMessage());
        }
    }
}

Thank you.

Body:
Vandaer suggested this solution:

TableDrawer tableDrawer = TableDrawer.builder()
            .contentStream(contentStream)
            .page(page) // <-- This was missing
            .startX((page.getMediaBox().getUpperRightX() - 200) / 2)
            .startY(page.getMediaBox().getUpperRightY() - 20)
            .table(myTable)
            .build();


问:
Why do i need to typecast here?
So, I had a task in my C quiz to write a program that prompts the user to enter three integer values, then passes their addresses as pointers to a function that apply changes to these values according to some conditions, then send the average of these UPDATED values as a float.

```<code>#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

float Update(int *x, int *y, int *z);
int main()
{
    float avg;
    int x, y, z;
    printf("Please enter three intger values for x, y, and z respectively:");
    scanf("%d %d %d", &x, &y, &z);
    printf("\n\nthe values that you entered are:\n\tx = %d\n\ty = %d\n\tz = %d", x, y, z);
    avg = Update(&x, &y, &z);
    printf("\nthe UPDATED values are:\n\tx = %d\n\ty = %d\n\tz = %d", x, y, z);
    printf("\nthe average of the updated values are: %.1f\n\n", avg);
    system("pause");
    return 0;
}

float Update(int *x, int *y, int*z)
{
    float AVERAGE;
    if (*x % 2 == 0)    // for x
        *x *= 3;
    else
        *x -= 8;

    if (*y % 2 == 0)  // for y
        *y *= 3;
    else
        *y -= 8;

    if (*z % 2 == 0)  // for z
        *z *= 3;
    else
        *z -= 8;
    AVERAGE = (*x + *y + *z) / 3;
    return AVERAGE;
}
</code>```

Entering 5, 10, 7 should give me an average of 8.0 instead of 8.7.

I know that (even though AVERAGE and avg are all float) typecasting solves it but why?

答:
Typecasting is not needed. You just need to make sure that integer division is avoided:

```<code>AVERAGE = ((*x)*1.0f + (*y)*1.0f + (*z)*1.0f) / 3;
</code>```

This is more generously explicit (drawing attention to why it is done) than the shorter and probably more readable alternative solution by SomeProgrammerDude (which I include for completeness):

```<code>(*x + *y + *z) / 3.0f
</code>```

Title: Why do i need to typecast here?

Body:
So, I had a task in my C quiz to write a program that prompts the user to enter three integer values, then passes their addresses as pointers to a function that apply changes to these values according to some conditions, then send the average of these UPDATED values as a float.

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

float Update(int *x, int *y, int *z);
int main()
{
    float avg;
    int x, y, z;
    printf("Please enter three intger values for x, y, and z respectively:");
    scanf("%d %d %d", &x, &y, &z);
    printf("\n\nthe values that you entered are:\n\tx = %d\n\ty = %d\n\tz = %d", x, y, z);
    avg = Update(&x, &y, &z);
    printf("\nthe UPDATED values are:\n\tx = %d\n\ty = %d\n\tz = %d", x, y, z);
    printf("\nthe average of the updated values are: %.1f\n\n", avg);
    system("pause");
    return 0;
}

float Update(int *x, int *y, int*z)
{
    float AVERAGE;
    if (*x % 2 == 0)    // for x
        *x *= 3;
    else
        *x -= 8;

    if (*y % 2 == 0)  // for y
        *y *= 3;
    else
        *y -= 8;

    if (*z % 2 == 0)  // for z
        *z *= 3;
    else
        *z -= 8;
    AVERAGE = (*x + *y + *z) / 3;
    return AVERAGE;
}

Entering 5, 10, 7 should give me an average of 8.0 instead of 8.7.

I know that (even though AVERAGE and avg are all float) typecasting solves it but why?

Body:
Typecasting is not needed. You just need to make sure that integer division is avoided:

AVERAGE = ((*x)*1.0f + (*y)*1.0f + (*z)*1.0f) / 3;

This is more generously explicit (drawing attention to why it is done) than the shorter and probably more readable alternative solution by SomeProgrammerDude (which I include for completeness):

(*x + *y + *z) / 3.0f


问:
Draw a simple dotted line or dashed line in OpenGL GLES20 android using fragment shader and GL_LINE_STRIP
I went through different sources and seen that we could draw a dotted line using a fragment shader. Because I am new to OpenGL I couldn't able to understand.

Can anyone share some code sample that plot dotted or dashed line using fragment shader and GL_LINE_STRIP in Android.

References:

Dashed line in OpenGL3?

Dotted back edges of object

答:
Line stipple is not supported in OpenGL ES.

If you use OpenGL ES 1.00, then you can use the approach which is presented in the answers to OpenGL ES - Dashed Lines.

You have to create a 1 dimensional texture (2 dimensional Nx1 texture), and wrap the texture on the lines. The texture has a stipple pattern encoded in its alpha channel. The space between the dashes is discarded by the Alpha test.

If you use OpenGL ES 2.00 or higher (OpenGL ES 3.x), then you can't use the alpha test, because it is deprecated. You have to use a fragment shader and to skip fragments by the discard keyword.

Create a texture with a red color channel only. The stipple pattern is encoded in the red color channel, but the code is very similar to that one from OpenGL ES - Dashed Lines, beside the fact that you have to use GL10.GL_RED for the internal texture format (instead of GL10.GL_ALPHA):

byte arr[] = new byte[] { 255, 0, 0, 255 };
ByteBuffer textureBuffer = ByteBuffer.wrap(arr);

gl.glGenTextures(1, texture_id_, stippleTexObj);
gl.glBindTexture(GLES20.GL_TEXTURE_2D, stippleTexObj);
gl.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
gl.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
gl.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_REPEAT);
gl.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_REPEAT);
gl.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RED, 4, 1, 0,
                GLES20.GL_RED, GLES20.GL_UNSIGNED_BYTE, textureBuffer);
```

<p>When you draw the lines, the you have to use a shader program, that discard the fragments dependent on the red color channel of the texture. A very simple GLSL ES 1.00 shader (for OpenGL ES 3.00) may look as follows:</p>

<p>Vertex shader:</p>

<pre class="lang-c prettyprint-override"><code>attribute vec2  inPos;
attribute float inU;
varying   float vU;

void main()
{
    outU        = inU;
    gl_Position = vec4( inPos.xy, 0.0, 1.0 );
}
</code>```

Fragment shader:

precision mediump float;

varying float     vU;
uniform sampler2D u_stippleTexture;

void main()
{
    float stipple = texture2D(u_stippleTexture, vec2(vU, 0.0)).r;
    if (stipple < 0.5)
        discard;
    gl_FragColor = vec4(1.0);
}
```

<p>Ensure that the texture coordinates which are associated to the vertices are aligned to integral values when you draw the line, that causes the the lines start and end with a dash:</p>

<p>e.g. a quad with bottom left of (-0.5 -0.5) and to right of (0.5, 0.5) and the texture coordinates in range [0, 5]:</p>

<pre class="lang-non prettyprint-override"><code> x     y       u
-0.5f -0.5f    0.0f
 0.5f -0.5f    5.0f
 0.5f  0.5f    0.0f
-0.5f  0.5f    5.0f
</code>```

Since the wrap function is GL_REPEAT and the texture coordinates are in range [0, 5], 5 repetitions of the stipple pattern are wrapped to each edge of the quad.

Instead of using a texture, you can also generate the stippling in the fragment shader. See the solutions for desktop OpenGL cor profile:

glLineStipple deprecated in OpenGL 3.1

Dashed line in OpenGL3?

Body:
Line stipple is not supported in OpenGL ES.

If you use OpenGL ES 1.00, then you can use the approach which is presented in the answers to OpenGL ES - Dashed Lines.

You have to create a 1 dimensional texture (2 dimensional Nx1 texture), and wrap the texture on the lines. The texture has a stipple pattern encoded in its alpha channel. The space between the dashes is discarded by the Alpha test.

If you use OpenGL ES 2.00 or higher (OpenGL ES 3.x), then you can't use the alpha test, because it is deprecated. You have to use a fragment shader and to skip fragments by the discard keyword.

Create a texture with a red color channel only. The stipple pattern is encoded in the red color channel, but the code is very similar to that one from OpenGL ES - Dashed Lines, beside the fact that you have to use GL10.GL_RED for the internal texture format (instead of GL10.GL_ALPHA):

byte arr[] = new byte[] { 255, 0, 0, 255 };
ByteBuffer textureBuffer = ByteBuffer.wrap(arr);

gl.glGenTextures(1, texture_id_, stippleTexObj);
gl.glBindTexture(GLES20.GL_TEXTURE_2D, stippleTexObj);
gl.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
gl.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
gl.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_REPEAT);
gl.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_REPEAT);
gl.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RED, 4, 1, 0,
                GLES20.GL_RED, GLES20.GL_UNSIGNED_BYTE, textureBuffer);

When you draw the lines, the you have to use a shader program, that discard the fragments dependent on the red color channel of the texture. A very simple GLSL ES 1.00 shader (for OpenGL ES 3.00) may look as follows:

Vertex shader:

attribute vec2  inPos;
attribute float inU;
varying   float vU;

void main()
{
    outU        = inU;
    gl_Position = vec4( inPos.xy, 0.0, 1.0 );
}

Fragment shader:

precision mediump float;

varying float     vU;
uniform sampler2D u_stippleTexture;

void main()
{
    float stipple = texture2D(u_stippleTexture, vec2(vU, 0.0)).r;
    if (stipple < 0.5)
        discard;
    gl_FragColor = vec4(1.0);
}

Ensure that the texture coordinates which are associated to the vertices are aligned to integral values when you draw the line, that causes the the lines start and end with a dash:

e.g. a quad with bottom left of (-0.5 -0.5) and to right of (0.5, 0.5) and the texture coordinates in range [0, 5]:

 x     y       u
-0.5f -0.5f    0.0f
 0.5f -0.5f    5.0f
 0.5f  0.5f    0.0f
-0.5f  0.5f    5.0f

Since the wrap function is GL_REPEAT and the texture coordinates are in range [0, 5], 5 repetitions of the stipple pattern are wrapped to each edge of the quad.

Instead of using a texture, you can also generate the stippling in the fragment shader. See the solutions for desktop OpenGL cor profile:

glLineStipple deprecated in OpenGL 3.1

Dashed line in OpenGL3?


问:
jQuery how to select options by values?
How to select options which are not in 'restrictedIds', for example, selector should select the options with values 24 and 31.
Also I know how it could be done with using '.inArray' and '.each()' but it would be good to look at yours solutions. Thank you.</p>

```<code>...
var restrictedIds='0,38,23';
...
<select class="text4" size="1" name="drivers">
        <option value="0"></option>
        <option value="24">test1</option>
        <option value="31">test2</option>
        <option value="38">test3</option>
        <option value="23">test4</option>
</select>
</code>```

答:
You can use .filter. For better performance I suggest to create a map of IDs:

```<code>var restrictedIds = {
    0: true,
    28: true,
    23: true
};

var options = $('select[name="drivers"] option').filter(function() {
    return !restrictedIds[this.value];
    //or   !(this.value in restrictedIds)
});
</code>```

ContentLicense: CC BY-SA 3.0

Title: jQuery how to select options by values?

Body:
How to select options which are not in 'restrictedIds', for example, selector should select the options with values 24 and 31.
Also I know how it could be done with using '.inArray' and '.each()' but it would be good to look at yours solutions. Thank you.

...
var restrictedIds='0,38,23';
...
<select class="text4" size="1" name="drivers">
        <option value="0"></option>
        <option value="24">test1</option>
        <option value="31">test2</option>
        <option value="38">test3</option>
        <option value="23">test4</option>
</select>

Body:
You can use .filter. For better performance I suggest to create a map of IDs:

var restrictedIds = {
    0: true,
    28: true,
    23: true
};

var options = $('select[name="drivers"] option').filter(function() {
    return !restrictedIds[this.value];
    //or   !(this.value in restrictedIds)
});


问:
Angular Toggle NgOnChanges for Primitive boolean Types from Parent to Child Input
I have a Parent and Child component.
The Parent component is trying to send a Test Boolean Flag into the child component input.

We are attempting to toggle NgOnChanges in the Child Component, by conducting this is a method.

```<code>@Input() Testflag: boolean;
public changeTestFlag(){
    this.TestFlag = false;
    this.TestFlag = true;
}
</code>```

However, this seem to trigger NgOnchanges in Child input, in debugging and tracing.  However, it only reads it as false, not true.  How can this be resolved to be called?

We can do Object.assign({}, this.testClass)  for classes; how can we trigger for primitive boolean types?

答:
This is done by @Input decorator in Angular, Please read more here https://angular.io/guide/template-syntax#input-and-output-properties

Parent Component

In your parent-component.ts file you will have the boolean variable.

```<code>testFlag: boolean = true;
</code>```

And in your parent-component.html you will call the child-component and will pass the boolean value as attribute.

```<code><child-component [flag]="testFlag"></child-component>
</code>```

Child Component

Now in your child-component.ts you will declare the variable coming from the parent component using @Input decorator.

```<code>@Input() flag: boolean; // 'flag' is set in child component as [flag]
</code>```

And in your child-component.html you can use this variable

```<code><p *ngIf="flag">Show Flag</p>
</code>```

Body:
I have a Parent and Child component.
The Parent component is trying to send a Test Boolean Flag into the child component input.

We are attempting to toggle NgOnChanges in the Child Component, by conducting this is a method.

@Input() Testflag: boolean;
public changeTestFlag(){
    this.TestFlag = false;
    this.TestFlag = true;
}

However, this seem to trigger NgOnchanges in Child input, in debugging and tracing.  However, it only reads it as false, not true.  How can this be resolved to be called?

We can do Object.assign({}, this.testClass)  for classes; how can we trigger for primitive boolean types?

Body:
This is done by @Input decorator in Angular, Please read more here https://angular.io/guide/template-syntax#input-and-output-properties

Parent Component

In your parent-component.ts file you will have the boolean variable.

testFlag: boolean = true;

And in your parent-component.html you will call the child-component and will pass the boolean value as attribute.

<child-component [flag]="testFlag"></child-component>

Child Component

Now in your child-component.ts you will declare the variable coming from the parent component using @Input decorator.

@Input() flag: boolean; // 'flag' is set in child component as [flag]

And in your child-component.html you can use this variable

<p *ngIf="flag">Show Flag</p>


问:
Qt5 and MacOS X
I've installed Qt5 on my Mac OS X Yosemite from MacPorts.
If I compile this simple file

```<code>#include <QtGui>
#include <QtWidgets/QApplication>
#include <QtWidgets/QLabel>

int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    QLabel lbl("Hello World!");
    lbl.show();
    return app.exec();
}
</code>```

I'll get error

```<code>Undefined symbols for architecture x86_64:
  "QApplication::exec()", referenced from:
      _main in main.o
  "QApplication::QApplication(int&, char**, int)", referenced from:
      _main in main.o
  "QApplication::~QApplication()", referenced from:
      _main in main.o
  "QLabel::QLabel(QString const&, QWidget*, QFlags<Qt::WindowType>)", referenced from:
      _main in main.o
  "QLabel::~QLabel()", referenced from:
      _main in main.o
  "QWidget::show()", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [123.app/Contents/MacOS/123] Error 1
</code>```

I've change QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
to QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
or QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10
in file /opt/local/share/qt5/mkspecs/macx-clang/qmake.conf
but it has no result.

答:
Hard to know exactly without more information, but check that you are adding in widgets in your .pro file:

```<code>QT       += gui core
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
</code>```

You may have to run qmake explicitly if you aren't using qtcreator. Also, wouldn't you be showing a main window instead of a QLabel? I haven't checked if that's legit doable code, but maybe you should start showing a main window and verify that works first. QTCreator has a project template for a new  Qt Widgets Application. Also check to see that macports is installing the latest qt5 version in the event it's a bad path or config on their part.

Title: Qt5 and MacOS X

Body:
I've installed Qt5 on my Mac OS X Yosemite from MacPorts.
If I compile this simple file

#include <QtGui>
#include <QtWidgets/QApplication>
#include <QtWidgets/QLabel>

int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    QLabel lbl("Hello World!");
    lbl.show();
    return app.exec();
}

I'll get error

Undefined symbols for architecture x86_64:
  "QApplication::exec()", referenced from:
      _main in main.o
  "QApplication::QApplication(int&, char**, int)", referenced from:
      _main in main.o
  "QApplication::~QApplication()", referenced from:
      _main in main.o
  "QLabel::QLabel(QString const&, QWidget*, QFlags<Qt::WindowType>)", referenced from:
      _main in main.o
  "QLabel::~QLabel()", referenced from:
      _main in main.o
  "QWidget::show()", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [123.app/Contents/MacOS/123] Error 1

I've change QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
to QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
or QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10
in file /opt/local/share/qt5/mkspecs/macx-clang/qmake.conf
but it has no result.

Body:
Hard to know exactly without more information, but check that you are adding in widgets in your .pro file:

QT       += gui core
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

You may have to run qmake explicitly if you aren't using qtcreator. Also, wouldn't you be showing a main window instead of a QLabel? I haven't checked if that's legit doable code, but maybe you should start showing a main window and verify that works first. QTCreator has a project template for a new  Qt Widgets Application. Also check to see that macports is installing the latest qt5 version in the event it's a bad path or config on their part.


问:
Whoosh IndexingError: Writer is closed
I am using the code, and I am getting as error message

This writer is closed

I am using whoosh and python. I am fetching data from a json file and I then iterate with a loop for creating the search engine index.

from whoosh.fields import Schema,TEXT,ID
from whoosh import index
from whoosh.qparser import QueryParser
import os.path
import json
if not os.path.exists("indexdir"):
  os.mkdir("indexdir")
  schema = Schema(title=TEXT(stored=True), content=TEXT(stored=True))
  ix = index.create_in("indexdir", schema)
  doc_json=json.load(open("review.json",'r'))
  for doc in doc_json:
     with ix.writer() as w:
        for key,value in doc.get('properties').items():
           w.add_document(title=str(key), content=str(value[0].get('value')))
           w.commit()
```

答:
w.commit() closes the writer, so you can do it like this:</p>

```<code>with ix.writer() as w:
    for doc in doc_json:
        for key,value in doc.get('properties').items():
            w.add_document(title=str(key), content=str(value[0].get('value')))
    w.commit()
</code>```

Title: Whoosh IndexingError: Writer is closed

Body:
w.commit() closes the writer, so you can do it like this:

with ix.writer() as w:
    for doc in doc_json:
        for key,value in doc.get('properties').items():
            w.add_document(title=str(key), content=str(value[0].get('value')))
    w.commit()


问:
LocalNotification not working [IOS] - PushNotificationIOS
I'm trying to implementing local notification in IOS using this @react-native-community/push-notification-ios package.

I followed all the documentation properly. Still, LocalNotification is not working.

This is my environment config:
- react-native : 0.61.4
- @react-native-community/push-notification-ios --save : 1.0.5

I did the following things,

npm i @react-native-community/push-notification-ios --save

cd ios && pod install

Updated AppDelegate.m as per described here

Made build : react-native run-ios --device "iPhone X"

Then calling function in my js like this,

import PushNotificationIOS from "@react-native-community/push-notification-ios";
.
.
.
componentDidMount(){
  PushNotificationIOS.addEventListener('localNotification', this._onNotification);

  PushNotificationIOS.requestPermissions();
  PushNotificationIOS.presentLocalNotification({
    alertBody: 'Test Notification'
  });
}

_onNotification(notification) {
  console.log(notification._alert);
}
.
.
.
```

By the way, It requests for permissions when the first-time app opens & also I'm getting console.log of notification but not getting any local notification.

答:
Well, when the app running in the foreground, you won't be able to see the notification. You can call the local schedule function and quick hide app to the background, then you will see the notification.

Source Code:-

```<code>PushNotificationIOS.localNotificationSchedule({
      message: "Local push notification",   //mandatory
      number: 1,
      date: new Date(Date.now() + (5 * 1000)) // Schedule in 5 secs
    });
</code>```

Body:
I'm trying to implementing local notification in IOS using this @react-native-community/push-notification-ios package.

I followed all the documentation properly. Still, LocalNotification is not working.

This is my environment config:
- react-native : 0.61.4
- @react-native-community/push-notification-ios --save : 1.0.5

I did the following things,

npm i @react-native-community/push-notification-ios --save

cd ios && pod install

Updated AppDelegate.m as per described here

Made build : react-native run-ios --device "iPhone X"

Then calling function in my js like this,

import PushNotificationIOS from "@react-native-community/push-notification-ios";
.
.
.
componentDidMount(){
  PushNotificationIOS.addEventListener('localNotification', this._onNotification);

  PushNotificationIOS.requestPermissions();
  PushNotificationIOS.presentLocalNotification({
    alertBody: 'Test Notification'
  });
}

_onNotification(notification) {
  console.log(notification._alert);
}
.
.
.

By the way, It requests for permissions when the first-time app opens & also I'm getting console.log of notification but not getting any local notification.

Body:
Well, when the app running in the foreground, you won't be able to see the notification. You can call the local schedule function and quick hide app to the background, then you will see the notification.

Source Code:-

PushNotificationIOS.localNotificationSchedule({
      message: "Local push notification",   //mandatory
      number: 1,
      date: new Date(Date.now() + (5 * 1000)) // Schedule in 5 secs
    });


问:
How to clear all selected items in a dropdpwn?
My question is related to Angular and Typescript. My problem is quite tricky. I've created a dropdown menu with 3 items. But I'm not creating it using select tag of HTML. I'm using my company's toolkit. Which is just a wrapper around primeng components with our font and our color scheme. They call it PLK toolkit. Their code have a bug. It is not clearing the previously selected item. Here is their sample dropdown code (i feel it is ok to share the code because it is few lines of plain html only and that too written by me):

Note: In below code,  plk-dropdown is like select tag, while plk-option is like option tag. There's nothing special about it.

```<code><plk-dropdown [(ngModel)]="fruit" name="fruit">
    <plk-option [value]="'apple'">Apple</plk-option>
    <plk-option [value]="'pear'">Pear</plk-option>
    <plk-option [value]="'melon'">Melon</plk-option>
</plk-dropdown>
</code>```

So, when I click it first time it is good.But after first click it keeps on selecting the other options along with previous. I looked into their code:

dropdown.js

```<code>DropDownComponent.prototype.writeValue = function (value) {
    if (this.options) {
        this.selectOptionByValue(value);
    }
};
</code>```

and I fixed this bug by adding 1 line of code:

```<code>DropDownComponent.prototype.writeValue = function (value) {
  if (this.options) {
      this.clearSelectedOptions(); // THIS I ADDED
      this.selectOptionByValue(value);
  }
};
</code>```

Now the compoenent is working but the problem is that I can't make changes to their js file. Firstly, I'm not supposed to do so. Secondly, if in future we update our repositories, that bug will come back.

Is there any way I can fix this with my typescript code. I cant implement jquery in between. I tried this:

How to clear all selected items in a SELECT input using jQuery?

Please help me. I'm blocked because of this. I really need help.

答:
I use a null option so when the dropdown has no values unselected option is selected , I thing it 's related to primeng the set the first option as selected even the value don't match with ngModel property I have create a demo to show this but so far that how we solve abd this will give to the use an option to undo the selection in case this was not required.

<plk-dropdown [(ngModel)]="fruit" name="fruit">
    <plk-option [value]="null">Unselected</plk-option>
    <plk-option [value]="'apple'">Apple</plk-option>
    <plk-option [value]="'pear'">Pear</plk-option>
    <plk-option [value]="'melon'">Melon</plk-option>
</plk-dropdown>
```

demo

Body:
My question is related to Angular and Typescript. My problem is quite tricky. I've created a dropdown menu with 3 items. But I'm not creating it using select tag of HTML. I'm using my company's toolkit. Which is just a wrapper around primeng components with our font and our color scheme. They call it PLK toolkit. Their code have a bug. It is not clearing the previously selected item. Here is their sample dropdown code (i feel it is ok to share the code because it is few lines of plain html only and that too written by me):

Note: In below code,  plk-dropdown is like select tag, while plk-option is like option tag. There's nothing special about it.

<plk-dropdown [(ngModel)]="fruit" name="fruit">
    <plk-option [value]="'apple'">Apple</plk-option>
    <plk-option [value]="'pear'">Pear</plk-option>
    <plk-option [value]="'melon'">Melon</plk-option>
</plk-dropdown>

So, when I click it first time it is good.But after first click it keeps on selecting the other options along with previous. I looked into their code:

dropdown.js

DropDownComponent.prototype.writeValue = function (value) {
    if (this.options) {
        this.selectOptionByValue(value);
    }
};

and I fixed this bug by adding 1 line of code:

DropDownComponent.prototype.writeValue = function (value) {
  if (this.options) {
      this.clearSelectedOptions(); // THIS I ADDED
      this.selectOptionByValue(value);
  }
};

Now the compoenent is working but the problem is that I can't make changes to their js file. Firstly, I'm not supposed to do so. Secondly, if in future we update our repositories, that bug will come back.

Is there any way I can fix this with my typescript code. I cant implement jquery in between. I tried this:

How to clear all selected items in a SELECT input using jQuery?

Please help me. I'm blocked because of this. I really need help.

Body:
I use a null option so when the dropdown has no values unselected option is selected , I thing it 's related to primeng the set the first option as selected even the value don't match with ngModel property I have create a demo to show this but so far that how we solve abd this will give to the use an option to undo the selection in case this was not required.

<plk-dropdown [(ngModel)]="fruit" name="fruit">
    <plk-option [value]="null">Unselected</plk-option>
    <plk-option [value]="'apple'">Apple</plk-option>
    <plk-option [value]="'pear'">Pear</plk-option>
    <plk-option [value]="'melon'">Melon</plk-option>
</plk-dropdown>

demo


问:
Git submodules and ssh access
I have some trouble with a git repository that contains several submodules.

The super git repository was constructed with the commands

```<code>mkdir projectname
cd projectname
git init
git submodule add ssh://myusername@server/pathtorepos
</code>```

When a different user ("otheruser") then clones the super repository everything seems to work out. But when it is time to get access to the submodule

```<code>git submodule init
git submodule update
</code>```

git tries to clone the submodule using "myusername" instead of "otheruser".

How to solve this problem?

答:
The other user has to alter the .git/config file to change the user name to his own username. That way, git uses the right user to connect to the server.

```<code>[submodule "path/to/module"]
    url = ssh://otheruser@server/pathtorepos
</code>```

Title: Git submodules and ssh access

Body:
I have some trouble with a git repository that contains several submodules.

The super git repository was constructed with the commands

mkdir projectname
cd projectname
git init
git submodule add ssh://myusername@server/pathtorepos

When a different user ("otheruser") then clones the super repository everything seems to work out. But when it is time to get access to the submodule

git submodule init
git submodule update

git tries to clone the submodule using "myusername" instead of "otheruser".

How to solve this problem?

Body:
The other user has to alter the .git/config file to change the user name to his own username. That way, git uses the right user to connect to the server.

[submodule "path/to/module"]
    url = ssh://otheruser@server/pathtorepos


问:
Why PHPUnit tests run faster when the machine is disconnected from the internet?
I have noticed that when my laptop is connected to the internet my PHPUnit tests takes between ~90 sec ~200 sec to finish. But when I disconnect it from the internet it runs in less than 20 sec!! that makes me happy and sad at the same time!

In both cases all the tests are passing, I'm sure I'm mocking every request to external API's.

I'm using Laravel and MySQL for real data storage and in-memory sqlite for the tests environment. Also my development environment is all on running on Docker.

Is this something related to PHPUnit or to my code!! any one has an idea on what's going on. Thanks

More Info

The domain I'm using is something.dev and my API's uses api.something.dev. Every test makes at least one call to each API endpoint.

DNS!
If you think this is due to DNS lookup: I changed all the domain and subdomains to 127.0.0.1 just to test it, and it didn't helped the tests are still slow. Should this eliminate the possibility of DNS lookup!

In addition I tried mocking the DNS using The PHPUnit Bridge with PHPUnit but I guess I couldn't make it work due to the lack of documentation, so I didn't knew what to pass as parameter to   DnsMock::withMockedHosts([here!!]) after calling it from my setUp() function.

Something else
I think the problem is related to the data storage because the delay happens before and after querying the database, mostly to store data.

答:
Never use $faker->image('storage/app',640,480, null, false) in factory
: it will be time consuming.

Transform

```<code>$factory->define(Model::class, function (Faker $faker) {
    return [
        'name' => $faker->name,
        'description' => $faker->text,
        'image' => $faker->image('storage/app',640,480, null, false),
    ];
});
</code>```

into

```<code>$factory->define(Model::class, function (Faker $faker) {
    return [
        'name' => $faker->name,
        'description' => $faker->text,
        'image' => 'test.png',
    ];
});
</code>```

Body:
Never use $faker->image('storage/app',640,480, null, false) in factory
: it will be time consuming.

Transform

$factory->define(Model::class, function (Faker $faker) {
    return [
        'name' => $faker->name,
        'description' => $faker->text,
        'image' => $faker->image('storage/app',640,480, null, false),
    ];
});

into

$factory->define(Model::class, function (Faker $faker) {
    return [
        'name' => $faker->name,
        'description' => $faker->text,
        'image' => 'test.png',
    ];
});


问:
How would you turn a JavaScript variable into a Template literal?
I would like to take text that I generated and stored in a string and use it like a template literal.

```<code>var generatedText = "Pretend this text was generated and then stored in a variable. ";
generatedText = "But I still need to use it as a template it to get ${variable}.";

var variable = "Successs!!!!";

console.log(generatedText);
//prints 'But I still need to interpolate it to get ${variable}.'
//how can I make it print using variable in it like a template as if it were doing this
console.log(`But I still need to use it as a template it to get ${variable}.`);
//prints 'But I still need to use it as a template it to get Successs!!!!.'
</code>```

How can I get generated text to become a template string?

generatedText must start in a variable so I need to find a way to convert it to a template string if possible.

Edit:

I didn't think I would have to put this but also I don't want to use eval to risk evaluating random code...

答:
The interpolate function below is an extended version of the above solution adds support for simple nested object field references, with addition of arrays (e.g.: a[0][2].b.c)

const interpolate = (str, obj) => {
  return str.replace(/\${([^}]+)}/g, (_, target) => {
    let keys = target.split(".");
    return keys.reduce((prev, curr) => {
      if (curr.search(/\[/g) > -1) {
        //if element/key in target array is array, get the value and return
        let m_curr = curr.replace(/\]/g, "");
        let arr = m_curr.split("[");
        return arr.reduce((pr, cu) => {
          return pr && pr[cu];
        }, prev);
      } else {
        //else it is a object, get the value and return
        return prev && prev[curr];
      }
    }, obj);
  });
};

let template = "hello ${a[0][0].b.c}";
let data = {
  a: [
    [{
      b: {
        c: "world",
        f: "greetings"
      }
    }, 2], 3
  ],
  d: 12,
  e: 14
}
console.log(interpolate(template, { ...data
}));```

Body:
I would like to take text that I generated and stored in a string and use it like a template literal.

var generatedText = "Pretend this text was generated and then stored in a variable. ";
generatedText = "But I still need to use it as a template it to get ${variable}.";

var variable = "Successs!!!!";

console.log(generatedText);
//prints 'But I still need to interpolate it to get ${variable}.'
//how can I make it print using variable in it like a template as if it were doing this
console.log(`But I still need to use it as a template it to get ${variable}.`);
//prints 'But I still need to use it as a template it to get Successs!!!!.'

How can I get generated text to become a template string?

generatedText must start in a variable so I need to find a way to convert it to a template string if possible.

Edit:

I didn't think I would have to put this but also I don't want to use eval to risk evaluating random code...


问:
Azure DevOps - PowerApps package Deployer - You cannot call a method on a null-valued expression
I am trying to run packagedeployer using PowerApps Deploy Package and getting an error "You cannot call a method on a null-valued expression".
This is a CRM Package solution that is created using Dynamics 365 SDK templates. Please find below the link with details

https://learn.microsoft.com/en-us/powerapps/developer/common-data-service/package-deployer/create-packages-package-deployer#create-a-package

Azure DevOps Error Screenshot

答:
"You cannot call a method on a null-valued expression"

The information is not enough to solve the problem, but i can suggest a way you can troubleshoot.

First, set the system.debug value to "true" in your pipeline Variables,

and then run the build again and you shall see the detailed exception message in the debug information(with ##[debug] before them) in the log information.

Most likely you will see it's a ps1 file that raised the error since the error message you cannot call a method on a null-valued expression usually occurs in ps script and it should points out in which line which char you got the error.

Then, add a PowerShell Script task down below your PowerApps Deploy Package  task, add an Inline script using the Get-Content method:

```<code>Get-Content -Path {path you find in above task log information}
</code>```

Now you are able to see which line in the script caused the problem and find a way to solve it, or update what you find in your question post and we will keep on.

Below are some reference links you can check:

Troubleshoot the InvokeMethodOnNull Error with PowerShell

You cannot call a method on a null-valued expression

Body:
"You cannot call a method on a null-valued expression"

The information is not enough to solve the problem, but i can suggest a way you can troubleshoot.

First, set the system.debug value to "true" in your pipeline Variables,

and then run the build again and you shall see the detailed exception message in the debug information(with ##[debug] before them) in the log information.

Most likely you will see it's a ps1 file that raised the error since the error message <a href="https://www.google.com/search?rlz=1C1GCEU_zh-CNSG849__850&sxsrf=ALeKk036NyM8XJAbLWPUu-O_OPGqyAg5mA%3A1582180859722&ei=-ylOXqjnK8rF4-EP_PqOkAk&q=you+cannot+call+a+method+on+a+null-valued+expression&oq=you+cannot+call+a+method+on+a+null-valued+expression&gs_l=psy-ab.3..35i39j0i7i30l4j0i203j0i7i10i30j0i7i30l3.2847359.2847359..2847697...0.0..0.412.880.2-2j0j1......0....1..gws-wiz.......35i302i39.Wbged9DBORQ&ved=0ahUKEwjo0PSAw9_nAhXK4jgGHXy9A5IQ4dUDCAs&uact=5" rel="nofollow noreferrer">you cannot call a method on a null-valued expression usually occurs in ps script and it should points out in which line which char you got the error.

Then, add a PowerShell Script task down below your PowerApps Deploy Package  task, add an Inline script using the Get-Content method:

Get-Content -Path {path you find in above task log information}

Now you are able to see which line in the script caused the problem and find a way to solve it, or update what you find in your question post and we will keep on.

Below are some reference links you can check:

Troubleshoot the InvokeMethodOnNull Error with PowerShell

You cannot call a method on a null-valued expression


问:
VBScript sendKeys to already open IE Window
I am new to VBScript and have an issue regarding sendKeys with already opened IE Window.

Initially I had a script, which opened a new instance of Internet Explorer, wrote some text in a textfield and clicked a button:

```<code>Set shell = WScript.CreateObject("WScript.shell")
Set IE = WScript.CreateObject("InternetExplorer.Application", "ie_")

Wait IE, 2000
IE.Visible = True
shell.AppActivate IE

Wait IE, 2000
IE.Navigate "http://someurl"

Wait IE, 2000
IE.document.getElementById("myTextField").Click
shell.SendKeys "TEST"
Wait IE, 2000
IE.document.getElementById("myButton").Click
...
IE.Quit

End Function

Sub Wait(IE, ms)
    Do
        WScript.Sleep ms
    Loop While IE.ReadyState < 4 And IE.Busy
End Sub
</code>```

This worked perfectly fine.
However now I need to do the same with an already opened instance of IE and this is what I did:

```<code>Set shell = WScript.CreateObject("WScript.shell")

Dim objInstances, objIE, IE
Set objInstances = WScript.CreateObject("Shell.Application").windows
If objInstances.Count > 0 Then '/// make sure we have instances open.
    For Each objIE In objInstances
        If InStr(objIE.LocationURL,"http://someurl") > 0 then
        Set IE = objIE
        End if
Next
End If
shell.AppActivate ("Internet Explorer")

Wait IE, 2000
IE.document.getElementById("myTextField").Click
shell.SendKeys "TEST"
Wait IE, 2000
IE.document.getElementById("myButton").Click
...
IE.Quit

End Function

Sub Wait(IE, ms)
    Do
        WScript.Sleep ms
    Loop While IE.ReadyState < 4 And IE.Busy
End Sub
</code>```

This time the the text wouldn't be written into the textfield.
Has anyone a solution for this?

答:
You could use IE.document.getElementById("myTextField").Value if you want to set value of textfield.

Change these two lines:

```<code>IE.document.getElementById("myTextField").Click
shell.SendKeys "TEST"
</code>```

into:

```<code>IE.document.getElementById("myTextField").Value = "TEST"
</code>```

Body:
I am new to VBScript and have an issue regarding sendKeys with already opened IE Window.

Initially I had a script, which opened a new instance of Internet Explorer, wrote some text in a textfield and clicked a button:

Set shell = WScript.CreateObject("WScript.shell")
Set IE = WScript.CreateObject("InternetExplorer.Application", "ie_")

Wait IE, 2000
IE.Visible = True
shell.AppActivate IE

Wait IE, 2000
IE.Navigate "http://someurl"

Wait IE, 2000
IE.document.getElementById("myTextField").Click
shell.SendKeys "TEST"
Wait IE, 2000
IE.document.getElementById("myButton").Click
...
IE.Quit

End Function

Sub Wait(IE, ms)
    Do
        WScript.Sleep ms
    Loop While IE.ReadyState < 4 And IE.Busy
End Sub

This worked perfectly fine.
However now I need to do the same with an already opened instance of IE and this is what I did:

Set shell = WScript.CreateObject("WScript.shell")

Dim objInstances, objIE, IE
Set objInstances = WScript.CreateObject("Shell.Application").windows
If objInstances.Count > 0 Then '/// make sure we have instances open.
    For Each objIE In objInstances
        If InStr(objIE.LocationURL,"http://someurl") > 0 then
        Set IE = objIE
        End if
Next
End If
shell.AppActivate ("Internet Explorer")

Wait IE, 2000
IE.document.getElementById("myTextField").Click
shell.SendKeys "TEST"
Wait IE, 2000
IE.document.getElementById("myButton").Click
...
IE.Quit

End Function

Sub Wait(IE, ms)
    Do
        WScript.Sleep ms
    Loop While IE.ReadyState < 4 And IE.Busy
End Sub

This time the the text wouldn't be written into the textfield.
Has anyone a solution for this?

Body:
You could use IE.document.getElementById("myTextField").Value if you want to set value of textfield.

Change these two lines:

IE.document.getElementById("myTextField").Click
shell.SendKeys "TEST"

into:

IE.document.getElementById("myTextField").Value = "TEST"