Can we disallow to use || on optional types by lint?

I want to disallow following code: function(num: undefined|number) { return num || 10; } I want use ?? instead of ||. typescript-eslint.io/rules/prefer-nullish-coalescing –  Note that for num 0, nullish coalescing will return 0 while the or operator will return 10. –  @JSONDerulo I believe that’s exactly the reason to prefer ?? – to avoid defaulting … Read more

Android Studio Gradle Version Error On Apollo

I want to use this “https://studio.apollographql.com/public/star-wars-swapi/variant/current/home” star wars API, but when I want to download scheme from terminal I take this error. Here my gradle app module: plugins { id(“com.android.application”) id(“org.jetbrains.kotlin.android”) id(“com.apollographql.apollo3”) version “3.8.2” id(“com.google.dagger.hilt.android”) kotlin(“kapt”) id(“androidx.navigation.safeargs.kotlin”) } apollo { service(“service”) { packageName.set(“com.softcross.starwars”) } } android { namespace = “com.softcross.starwars” compileSdk = 34 defaultConfig { … Read more

How do I approach PaddleOCR “ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()”?

This is the inference code that I’ve used for the text detection task using paddle. I referred to the following site for the code: https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/doc/doc_en/whl_en.md from paddleocr import PaddleOCR,draw_ocr ocr = PaddleOCR(det_model_dir=”/content/drive/MyDrive/paddleocr/Multilingual_PP-OCRv3_det_infer/”) # need to run only once to download and load model into memory img_path=”/content/drive/MyDrive/paddleocr/inference_images/494__2334178__494.jpg” result = ocr.ocr(img_path,rec=False) print(f”result: {result}”) for idx in range(len(result)): … Read more

App installation campaign (Android SDK) – Facebook

How can i set facebook ad for App installation that we have to pay only for number of app installs with SDK. That means not for the impression or clicks. Eg – If i set a cost per installation 1USD per app, get 50 mobile app installation i’m paying 50usd. not for the clicks or … Read more

Why does performing DFS with this code result in duplicate leaves?

I am writing an algorithm that discerns whether two trees have the same leaves. These have the same leaf numbers in the same order so this returns true. This is the code I wrote: function leafSimilar(root1: TreeNode | null, root2: TreeNode | null): boolean { console.log(DFS(root1)) const leavesRoot1 = DFS(root1); const leavesRoot2 = DFS(root2); for … Read more

configparser not working in Python 3.11, NoSectionError

I am trying to migrate PySpark code into Python pandas lib. Mainly facing issue with configParser() , as Spark use SparkConf/SparkContext: Pyspark def __init__(self): ”’ Constructor ”’ self.currentYear = datetime.datetime.now().year base_path = os.environ[‘BASE_PATH’] self.config = StringIO.StringIO() self.configParser = ConfigParser.ConfigParser() # Read the property file messageResource.properties and store it in baseProp print “reading messageResource.properties” self.config.write(‘[msgProp]\n’) self.config.write(open(base_path+’/conf/messageResource.properties’).read()) … Read more

how to trigger a watcher even when assigned to the same newVal

i am using vue3 with options api as shown in the following stackbiltz link here i have a child-component that contains a button that when clicked, the method refresh should be invoked. the refresh() sets true to the event-emitter as shown below in the code. in the parent-component, i bind on the event-emitter via v-model … Read more