Posts

Polly Retry : System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Flurl.Http.Content.FileContent'

I'm using flurl and polly as part of my code to post asynchronously - I'm having an issue with the retry policy and the file content getting disposed, on a retry the FileContent option has been disposed. I will get the following error: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Flurl.Http.Content.FileContent'. If someone could advise where best to place the logic to ensure FileContent is available for the retry var endpoint = $"api endpoint here"; if (!File.Exists(filePath)) { return Task.CompletedTask; } var fileBytesLength = _fileSystem.FileInfo.FromFileName(filePath).Length; var httpContent = new Flurl.Http.Content.FileContent(filePath, (int)fileBytesLength); return _statusRetryPolicy .StatusAsyncRetryPolicy() .ExecuteAsync(() => endpoint .WithOAuthBearerToken(accessToken) .WithTimeout(TimeSpan.FromMinutes(timeOutMinutes)) .WithHeader("Content-Type", "appl...

Why do we need to wrap the BrowserRouter in parent component instead of routes child component for react router v6

I tried to create useRoutes hook from react-router-dom@6.4.1 to create my App routes using JS, like this in my routes.jsx: import { useRoutes, } from "react-router-dom"; import TestPage from "../Pages/Public/TestPage"; import TestPageTwo from "../Pages/Public/TestPageTwo"; const redirectRoutes = [ { path: "/no-match", element: () => <div>No Match found</div>, }, ]; const Router = () => { const router = useRoutes([ { path: "/testPage", element: <TestPage />, loader: false, }, { path: "/testPageTwo", element: <TestPageTwo />, loader: false, }, ...redirectRoutes, ]); return <BrowserRouter>{router}</BrowserRouter>; }; export default Router; and in my app.jsx, I imported the file like so: import { Provider } from "react-redux"; ...

Fixing border highlight issue

Image
I have 2 inputs side by side as shown below: .centered-query-cn { height: 150px; display: flex; } .browse-query { display: flex; } .browse-query input { display: flex; flex-grow: 1 !important; } <link href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" rel="stylesheet" /> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" c...

Plotly Heat Map Color Scale

Image
How can I set the scale of the colorscale for my plotly heat map independent of the values of the data? Example data: const z = [2,5,6,2,6,8,2]; But I would like my color scale to be from 0 to 10, red to green respectively. So far I have this, which is amazing, but because my max data is 5.2 and min data is 4.2 it is showing that as green for 5.2 and red for 4.2, but I would like to set a static scale from 0-10.

conda : System could not find the file specific

I tried to install jupyter-lsp but failed. Here is what I've done: I've create a conda environment and activate it, then I followed the instruction in https://github.com/krassowski/jupyterlab-lsp but when I input econda install -c conda-forge 'jupyterlab>=3.0.0,<4.0.0a0' jupyterlab-lsp or pip install 'jupyterlab>=3.0.0,<4.0.0a0' jupyterlab-lsp then an error occurred: System could not find the file specific (I'm a Chinese, so I don't know if this error information's translation is appropriate). Then I tried to stop SSL connection, but it still dosen't work. This is my envirioment: conda 4.14.0 pip 22.2.2 Please help me to solve this annoying problem.

Unable to retrieve device token on iOS app

We have use-case where we need to send push notification from our backend to buildfire application. And in order to do so, we would need device token on backend. We tried to extract it using following function in custom plugin but we are getting its value as empty string. We tested this in TestFlight build. buildfire.getContext(function (err, result) { console.log(result.deviceId) } We have uploaded firebase certificate to Buildfire and have also linked APNs to it. If anyone can guide us with this, it will be a great help.

cppyy OPENMP error: nullptr result where temporary expected

I've been trying to run some parallelised code in C++ from Python through cppyy but am facing an error. The executable (compilted through GCC with -fopenmp -O2 ) runs without errors and shows the expected drop in runtime from parallelisation. When the #pragma omp parallel for is commented out of the C++ code, cppyy doesn't raise any errors. However, when the pragma is part of the code I get the error below: IncrementalExecutor::executeFunction: symbol '__kmpc_for_static_fini' unresolved while linking symbol '__cf_4'! IncrementalExecutor::executeFunction: symbol '__kmpc_for_static_init_4' unresolved while linking symbol '__cf_4'! IncrementalExecutor::executeFunction: symbol '__kmpc_fork_call' unresolved while linking symbol '__cf_4'! IncrementalExecutor::executeFunction: symbol '__kmpc_global_thread_num' unresolved while linking symbol '__cf_4'! Traceback (most recent call last): File "...../SO_troubles...