the http request goes directly to the catch method of the promise, not to then

My Vuejs page is inlined into the app and the http request goes directly to the catch method of the promise, not to then. here is the code: queryPayStatus() { let vm = this; vm.$hms.loading.show(); vm.$http.get(url) .then(response => { // not come in console.log(response); vm.$hms.loading.hide(); }) .catch((error) => { // goes directly here console.log(error); vm.$hms.loading.hide(); … Read more

using usestate variable in while loop

await watchProfit(response); const watchProfit = async (response) => { while (calculateProfitPercentage(response.data.avgPrice , strike) < incrementalBuyPercentage) { console.log(‘Checking profit…’, strike); await new Promise((resolve) => setTimeout(resolve, 1000)); } console.log(‘Profit threshold reached. Proceeding to the next iteration.’); }; const calculateProfitPercentage = (averageBuyPrice,currPrice) => { if (averageBuyPrice === 0) { return 0; } console.log(averageBuyPrice,strike,’achha’) const profit = currPrice – … Read more

How to create Elliptic curve key in the Vault using Python SDK

I’m following this tutorial on how to generate elliptic curve keys in Python azure.keyvault.keys package — Azure SDK for Python 2.0.0 documentation (windows.net) This is the current python code that I have executed: from azure.identity import DefaultAzureCredential from azure.keyvault.keys import KeyClient credential = DefaultAzureCredential() key_client = KeyClient(vault_url=”https://mykv.vault.azure.net/”, credential=credential) # Create an elliptic curve key ec_key … Read more

Unable to display my encrypted image using Image.memory

Future<void> _showEncryptedImageDialog() async { if (_selectedImage == null) { // Handle case where no image is selected print(‘No image selected’); return; } final Uint8List originalImageData = await _selectedImage!.readAsBytes(); final Uint8List encryptedImageData = _imageEncryptor.encryptImage(originalImageData); print(encryptedImageData); var image = Image.memory(encryptedImageData); if (encryptedImageData.isEmpty) { print(“No data to encrypt”); } showDialog( context: context, builder: (BuildContext context) { return Dialog( … Read more

Simple PySpark runs far too slow compared to Scala + Spark

I have a simple Pyspark program for test: import datetime from pyspark.sql import SparkSession start = datetime.datetime.now() spark = SparkSession.builder.appName(“test”).getOrCreate() dept = [(“D1”, 10), (“D2”, 20), (“D3”, 30), (“D4”, 40)] deptCols = [“Deptname”, “DeptId”] deptDF = spark.createDataFrame(dept, deptCols) deptDF.show() end = datetime.datetime.now() duration = end – start print(“Duration :”, duration.seconds, ” seconds”) It took 40 … Read more

Problem with Authorities(Authorization) when using OAuth 2.0 Resource Server JWT

I’m trying to configure access authorization with JWT in a simple application using OAuth 2.0 Resource Server JWT. The entire Authentication part is working normally, but I’m having problems with Authorization. Even with the correct Authorities being present in the token, all protected endpoints are giving a 403 Forbidden error. I tried using the default … Read more

Exceptions are not properly logged

I am an accidental postgres DBA and learning things every day. Apologies for my questions if not properly drafted. I am trying to load data from the temp table to the main table and catch the exceptions inside another table. temp table is cast with the main table data type and trying to load the … Read more