instruction
stringlengths
0
30k
I have a api that only uses POST, so i have to sent an ID to fetch, in this case event. The problem is that my SWR is making infinite calls. I have this component: ``` const EventDetail = ({ params }: { params: { id: string } }) => { const id: string = params.id; const [cookies] = useCookies(["token"]);...
useSWR has infinite service call
|reactjs|next.js|swr|
null
In Python, Delta Live Tables determines whether to update a dataset as a materialized view or streaming table based on the defining query. The **@table** decorator is used to define both materialized views and streaming tables. To define a materialized view in Python, apply **@table to a query that performs a st...
{"Voters":[{"Id":22356960,"DisplayName":"pindakazen"}],"DeleteType":1}
As the first comment already says, you can use commands that can undo themselves. The idea is to have a `Command` class having a `Do` and a `Undo` method. These methods have a `ICommandContext context` parameter (it can in fact be of any useful type, e.g. `Game`). This is basically your game application. It allows the...
i have problem in Google Colab Deep Learning coding any one help me about this issue Chat GPT fail to solve my error
|python|keras|google-colaboratory|tensorflow2.0|
null
{"OriginalQuestionIds":[19780411],"Voters":[{"Id":5577765,"DisplayName":"Rabbid76","BindingReason":{"GoldTagBadge":"pygame"}}]}
round(fractions.Fraction("3.50")) yields 4, as one would expect. But round(fractions.Fraction("49886.50")) yields 49886, not 49887. What gives?
In the python fractions module, why is a result of round() sometimes incorrect?
|python|rounding|fractions|
To make those horizontal lines with annotations, RuleMark or RectangleMark can be used. Rectangle marks were used in this example: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/c58FS.png RectangleMark has a height parameter which was used to create something similar to the thicker ...
### Problem description I'm writing a python library and I am planning to upload both sdist (.tar.gz) and wheel to PyPI. The [build docs say](https://build.pypa.io/) that running ``` python -m build ``` I get sdist created from the source tree and *wheel created from the sdist*, which is nice since I get th...
How to test the wheel created with "python -m build" against multiple versions of python?
|python|python-packaging|tox|
|css|opacity|shadow|
I get the following result from an SP-API call using CURL within PHP. It is a private app created in Seller Central, and all permissions have been granted. We are just trying to retrieve our data. Array ( [errors] => Array ( [0] => Array ( ...
For loop through the list unless empty?
|python|for-loop|nonetype|
My code keeps working for a couple inputs and then ends citing a segmentation fault. I do not do any dynamic memory allocation. It's supposed to be a game of reversi (aka othello). The include lab8part1 contains the stdbool and declares some of the functions. ``` #include <stdio.h> #include <stdlib.h> //#inclu...
_Microsoft documentation:_ > [Range.Collapse method (Word)](https://learn.microsoft.com/en-us/office/vba/api/word.range.collapse?WT.mc_id=M365-MVP-33461&f1url=%3FappId%3DDev11IDEF1%26l%3Den-US%26k%3Dk(vbawd10.chm157155429)%3Bk(TargetFrameworkMoniker-Office.Version%3Dv16)%26rd%3Dtrue) > [Selection.TypeText met...
I'm hacking the Linux kernel v5.15 and try to debug it with `gdb` line by line. I've opened the dwarf debug info through `make menuconfig`. However, it seems that some line will still be skipped. I find that the default compile optimization is -O2. So I changed the Makefile like: ```lang-make ifdef CONFIG_CC_OPTIMI...
> I had Win 10 systems and I was practicing on it and I always get > addresses which are multiples of 2 > > Know, I am practicing on Macbook Pro M3 and I get 9 digit addresses. It does not depend on a number of digits only the the value of that number. Example: `0x16fa13228` is `6167802408` in decimal. T...
so I am new to Rust but recently came across a problem I don't know how to solve. It's to work with nested (and multi-dimensional) value-key pair arrays in Rust that is dynamically generated based on string splitting. The sample dataset looks something like the example below: Species | Category Dog ...
I'm trying to solve a non-linear equation with nleqslv, and I know a priori if I want a positive or negative solution (it's a dataset on choice under risk, and I'm trying to compute the risk aversion coefficient for each individual under CRRA assumption. Since I can observe the DMs' choices, I already know if each DM i...
Since I ran into this problem AGAIN, and stumbled upon my previous question which helped me solve it, I figured I'd go ahead and post the solution to the problem so when I google it again next time I run into this problem it'll be here. The `Content-Length` header is required. If you don't have it, you'll get an Uns...
I do homework for my lab on c++, I needed to get a number from keyboard and delete an element after inputted number in STL list. For some reason if I get 7 elements into the list, exactly {1,2,2,3,4,2,5} and ellement is 2 it outputs {1,2,2,2} and not {1,2,2,4,2}. Why? ``` #include <iostream> #include <iterator> #...
Why my code is working on everything except one instance?
|c++|list|function|stl|
null
After receiving Alex Mamo's response, I modified my code as follows: **.update("guests.$guestId", guest)** if (guest.toString().isNotEmpty()) { // Get the guest_id from Guest model val guestId = guest.toMap()["guest_id"] // Update the document with the new data ...
I am using fullcalendar v5 version and rendering the events with ```resourceTimeGrid``` After rendering my view is looking like this [![enter image description here][1]][1] When I tried to click on the date its not going to dayView. Even if I put console log the click event is not getting fired I tried with ...
I'm using Visual Studio 2022 Community, and C# projects. I like my namespaces to match my folder structures, so when I move a file from one folder to another within VS, I always accept the popup message offering to change the namespace too, or if I do the move outside of VS (e.g. in File Explorer), I go into the file w...
Can't get IDE0130 to show up in VS2022 error list
|c#|visual-studio|compiler-warnings|editorconfig|
{"Voters":[{"Id":4621513,"DisplayName":"mkrieger1"},{"Id":235698,"DisplayName":"Mark Tolonen"},{"Id":6243352,"DisplayName":"ggorlen"}],"SiteSpecificCloseReasonIds":[13]}
Upon trying to output the roles on page ListRoles.cshtml with the admin account in this project it gives me System.NullReferenceException: 'Object reference not set to an instance of an object.'... I think the problem is in the processing of the request because when i add breakpoints on the lines that return the m...
Background: Currently trying to implement a feature so that users on my site can upload their profile image to GCS. I understand that there are two ways you could upload objects when using the client library: The standard way (see here: https://cloud.google.com/storage/docs/uploading-objects#storage-upload-object...
Best way to upload images to Google Cloud Storage?
|node.js|google-cloud-platform|next.js|
{"Voters":[{"Id":1563833,"DisplayName":"Wyck"}]}
It's because in `GetAllProducts`, type `T` is not decided yet. So it is impossible to assign `[]models.Products` to `T`. ```golang func (db *DbConnection[T]) GetAllProducts() { var re []models.Products re, _ = db.GetAll() } ``` But you can assign `models.Products` to `T` if `T` is decided as `models.Products...
I have a multi-threaded implementation of Mandelbrot. Instead of scanning X and Y in nested loops, I scan pixels from 0 to width*height. The Mandelbrot worker thread then calculates the logical and real coordinates of the pixel. Here is a subset of the code... ``` // Worker thread for processing the Mandelbrot algo...
I have implemented LCA of a binary tree problem on Leetcode using Python: https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/ But I got error: TypeError: list indices must be integers or slices, not TreeNode. I am wondering how do I keep track of all parents treenode in self.up 2d array in Python. ...
null
I think this is pretty good: ``` db['date'] = db['date'] + pd.to_timedelta(7-db['date'].dt.dayofweek,'d') ```
**TL;DR** In version 2.4-0 of `exams` (current CRAN version at the time of writing) there is no way of accomplishing this. In version 2.4-1 (current development version on R-Forge) we have started working towards an `exams2inspera()` interface that might get you a few steps further. To try it out install: instal...
You have to change the docker **entrypoint** command like below to use a custom `vault.hcl` file. vault server -config=/vault/vault.hcl Example `docker-compose.yaml` file (vault.hcl file resides inside `/home/volumes/vault/`) version: "3.8" services: vault: image: hashicorp/vault ...
{"Voters":[{"Id":87698,"DisplayName":"Heinzi","BindingReason":{"GoldTagBadge":"c#"}}]}
How can I use unified memory on an OpenCL device without copying data correctly? OpenCL defined [CL_DEVICE_HOST_UNIFIED_MEMORY](https://registry.khronos.org/OpenCL/sdk/3.0/docs/man/html/clGetDeviceInfo.html ) as: > Is CL_TRUE if the device and the host have a unified memory subsystem and is CL_FALSE otherwise. ...
How to exploit Unified Memory in OpenCL with CL_MEM_ALLOC_HOST_PTR flag?
|arm|opencl|mali|unified-memory|
I am trying to program a COM object with the Enumerable and Enumerator inside in Delphi. It's a nightmare. First in the .ridl file: [![enter image description here][1]][1] next in the _tlb.pas I have this: // *********************************************************************// // Interface : ITracki...
|python|turtle-graphics|python-turtle|
You are doing it very bad. `php artisan serve` is a [server for local development, not for production][1]. I will asume that you have nginx installed, and that you already configured .env file, databases and all other things for production. If not, please follow [this tutorial][2] First of all, you need to copy ...
datetime... ```SQL SELECT days= CONVERT(int,cast('02-02-2024' as datetime)), dt = convert(date, (convert(datetime, 45322))) ``` result would be |days|dt| |---|---| |45322|2024-02-02|
Here's a list of resources to get started with the Python debugger: 1. Read Steve Ferb's article ["Debugging in Python"][ferg] 2. Watch Eric Holscher's screencast ["Using pdb, the Python Debugger"][holscher] 3. Read the [Python documentation for pdb — The Python Debugger][pydoc] 4. Read Chapter 9—When You Don't E...
Disabling the `mitm_http2` flag within `seleniumwire_options`, as recommended by the seleniumwire author for similar issues, did not work for me: seleniumwire_options = { 'mitm_http2': False, } I include it here as other users have reported success with this for other sites. Disabling HTTP2...
You should sort the list of integers in descending order and then iterate through it, adding each number to the list with the smaller current sum, like the following: ```python import random intList = [] for i in range(10): intList.append(random.randint(10, 200)) listX = [] listY = [] intList.sort(r...
|gcc|x86|inline-assembly|
you need to define second argument "tree" as empty Here is example: `istree(t(a, t(b, nil, nil), empty)).` domains tree = nil; t(symbol, tree, tree); empty(). predicates istree(tree). clauses istree(nil). istree(t(_, L, R)) :- istree(L), istree(R). goal ...
I'm pretty sure that Google used to publish an XML snippet of how to add a banner AdView to the layout, a ConstraintLayout to be precise. But that isn't in the [documentation](https://developers.google.com/admob/android/banner) anymore. There is a section called **Add AdView to the layout** and it contains a code sn...
How to add a banner adview to the layout?
|android|admob|google-play-services|
How can I remove Textfield focus when I press return or click outside Textfield? Note that this is SwiftUI on macOS. If I do this: ```swift import SwiftUI struct ContentView: View { @State var field1: String = "This is the Text Field View" var body: some View { VStack{ ...
Im facing this error Your requirements could not be resolved to an installable set of packages when trying to run composer update
|php|
null
I recently upgraded my Angular project to version 17, and now I'm encountering many browser console warnings like the following messages. `NG0912: Component ID generation collision detected. Components 'DevDashboardComponent' and 'DevDashboardComponent' with selector 'lib-dev-dashboard-page' generated the same compo...
Angular NG0912 Warning: Component ID generation collision detected after upgrading to angular 17
|angular|warnings|angular17|browser-console|versionupgrade|
null
I am currently working on a .NET project where I am utilizing Entity Framework. I require assistance with sorting users by date. Specifically, I need to sort users based on multiple dates. In the user entity, there are createDate and updateDate fields. Additionally, each user contains a list of items, each of which als...
LCA of a binary tree implemented in Python
|python|algorithm|lowest-common-ancestor|
null
I want to use JCA(Java connector architecture) and get data from Mainframe system using IBM provided Resource adapter(.rar) file. I could not find out this file in IBM portal. Since it is an old way of connecting from Java to Mainframe, it may not available. Please help me to find out. I'm looking for IBM provi...
Where can I download ECI resource adapter (cicseci.rar). Unable to find out it in IBM portal
|java|websphere-liberty|mainframe|rar|jca|
null
Your container's ID contains a space but they're illegal. <div id="Sign-In TempUI" Get rid of it. Also... document.addEventListener('DOMContentLoaded', Why are you in such a hurry? Use LOAD... document.addEventListener('load', The only time one would need to listen to *DOMContentLo...
If you want to extend an idea/discussion please post a reply to the same thread instead of posting a new Discussion.
null
I have implemented LCA of a binary tree problem on Leetcode using Python: https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/ But I got error: TypeError: list indices must be integers or slices, not TreeNode. I am wondering how do I keep track of all parents treenode in self.up 2d array in Python. ...
There was also a proposal to add a "Sentinel" class to the Python standard library: https://peps.python.org/pep-0661/ That points you to a GitHub repo containing a reference implementation: https://github.com/taleinat/python-stdlib-sentinels It has a license allowing incorporation in any project.
this is a problem I am facing. When trying to composite several bitmaps together I get a weird result. [Desired result (but this was done manually)][1] [Current result with the weird oddities][2] [1]: https://i.stack.imgur.com/Xa5hv.png [2]: https://i.stack.imgur.com/Ukhl6.png This is the code snip...
Compositing ARGB Bitmaps Together CPU-only
|c#|arrays|real-time|alphablending|compositing|
You can possibly use networkx's Edmond's algorithm to find minimum spanning arborescence rooted at a particular root in a given directed graph. https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.tree.branchings.Edmonds.html In graph theory, an arborescence is a directe...
You can use PHP's `nl2br()` function to convert newline characters to `<br>` tags. This will preserve the line breaks when displaying the text in HTML. However, it would be best if you also used `strip_tags()` to remove the `<p>` tags before converting newline characters to `<br>` tags. {!! Form::textarea('mline...
In Rust, I'm able to downcast a trait object to a concrete type using .as_any().downcast_ref(). That works ok, but it returns a &ref, not the owned object itself. How can I get ownership of a downcast object?
{"Voters":[{"Id":215552,"DisplayName":"Heretic Monkey"},{"Id":3959259,"DisplayName":"Bill Tür stands with Ukraine"},{"Id":1159478,"DisplayName":"Servy"}]}
I have 2 tables of data. 1 table has a list of start and end date ranges. The other table a list of students with their class and start dates. For each of the date ranges, I'm trying to list the students who have a start date in that range. Range Data | Start | End | | ---------- | ----------- ...
Apply criteria from one table against each row in another table to generate a list of matches
|r|function|loops|vector|rstudio|
null