instruction
stringlengths
0
30k
Why did I get "expression is assisgned to nothing" in ternary (Python)
|python|ternary|
null
I have developed a code using the libusb library to send USB packets to a Samsung device. Initially, I tested it with my Samsung Note 10. After running the code, the device transitioned to accessory mode, as indicated by the output of the lsusb command: Before running the code: Bus 001 Device 079: ID 04e8:...
Failed to switch Samsung Fold 4 to Accessory Mode
|android|libusb|accessory|
target 'OneSignalNotificationServiceExtension' do use_frameworks! pod 'OneSignalXCFramework', '>= 2.5.2', '< 6.0' end while adding your code into the podfile make sure to check the compatibility with your dependency in the pubspec.yaml file.
This Q&A seems to have evolved into a canonical and the information here is quite scattered and incomplete (there are several different types of highlighting in VS Code!). This is an attempt to defragment/unify/fill. In general, use subproperties of the `workbench.colorCustomizations` setting in a [settings.json fil...
|reactjs|vercel|rtk-query|express-jwt|render.com|
I have an SVG that I want to be responsive. I haven't set a width and height attribute because I ideally want it to be automatic. However, Safari doesn't render the SVG correctly without them. ``` <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 191 6" preserveAspectRatio="xMinYMid meet"> <path d="M0.113249 3...
I am building a new React website that consumes some REST services hosted on Azure App Service (ASP.NET Web API). The React application will require customers to log into the site. The login process follows the standard "Forgot Password" which will email the customer a code to reset their password online. Currently,...
Authentication Workflow with Azure App Service and React
|c#|azure|
I work with Firestore in my flutter application. I programmed that you can create notes and edit them. If i call my update function in the creation of the note the app doesen't crash. If I call it afterwards the app crashes. I printed the error to the console and this was what i got: > Assertion failed: file:///C:/...
You can do it using a regex: cat file1.txt | jq '.foo[].bar.second | (.key1 | match("delimiter1([^*]*)delimter2").captures[0].string), .key2'
I think somehow you are flushing the assembly when the second lookup occurs: `Component.get_by_sn()`. So you connect a module, and then that module includes the assembly via `back_populates`. Then the second `get_by_sn `triggers the flush of the `module` and the session doesn't know what to do with the assembly conn...
what is the error export 'AWSIoTProvider' (imported as 'AWSIoTProvider') was not found in '@aws-amplify/pubsub' even though it has been mentioned in the offcial Amplify documentation how do I import it correct ?? Solution on how to import AWSIoTProvider?
export 'AWSIoTProvider' (imported as 'AWSIoTProvider') was not found in '@aws-amplify/pubsub'
|node.js|amazon-web-services|aws-iot-core|
null
I'm trying to get the sha1 key of my project but each time I do by the running, cd android and later gradlew signingReport, everything will run smoothly but at the end of the day I get this message "The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher". It's a flutter project and I'm u...
I'm encountering a weird issue in a React application related to handling keyboard events. Specifically, when quickly pressing the Shift key followed by a letter key, the `onKeyUp` event handler logs the `e.key` value as lowercase. However, if I hold down the Shift key and then press a letter key, it correctly logs the...
React onKeyUp Inconsistently Logs Case with Quick Shift+Key Presses
The [Python interpreter](https://docs.python.org/3/tutorial/interpreter.html) running in your terminal has [state](https://en.wikipedia.org/wiki/State_(computer_science)#Program_state). If you only rerun the print line after changing the lines that set the variables to different values, you haven't told the interpreter...
{"OriginalQuestionIds":[5410757],"Voters":[{"Id":874188,"DisplayName":"tripleee","BindingReason":{"GoldTagBadge":"sed"}}]}
{"Voters":[{"Id":238704,"DisplayName":"President James K. Polk"},{"Id":8054998,"DisplayName":"Bench Vue"},{"Id":483779,"DisplayName":"Stickers"}]}
I recently upgraded my application's installer created with WiX Toolset 4. In the older version, I did not specify a scope, while in the newer version, I set the scope to "perUser" to allow Non-Admin users to install the app aswell. However, when attempting to update the application from the old version to the new o...
React portfolio copying images in ubuntu
|javascript|html|css|reactjs|ubuntu|
You can remove consecutive duplicates by adding each item to a new list only if it doesn't match the prior item, or, as suggested by @juanpa.arrivillag in comments, you can use `itertools` to accomplish this in one line. Here is an example: ``` # Copied from the examples in the question a = [ [8, 8, 8, 8, 5,...
The way you solve this is by converting the values to String so Terraform plays along like so : jsondecode(local.current_provider == "aws" ? jsonencode([]) : jsonencode({}))
You should read the contents of the input file first, then should use subprocess.run() to execute XFOIL by providing the input content directly, like below: import subprocess with open('input_file.txt', 'rb') as f: input_content = f.read() xfoil_process = subprocess.run(['c:\\xfoil...
Just more ways to get the result: ``` [a[:] for a in [[None] * 4] for a[:2] in enumerate(h, start=1)] [[*tpl] for nones in [repeat(None)] for tpl in zip(count(1), h, nones, nones)] [*map(list, zip(count(1), h, nones := repeat(None), nones))] ``` Benchmark, can't currently run it :-( ```python im...
|python|opencv|image-processing|image-segmentation|image-thresholding|
Pivot your "Legendary" columns to long format and map to `color`. This also handles the positioning such that you don't have to include `position_nudge(y=d$old)`. ```r library(dplyr) library(tidyr) library(ggplot2) d_part_long <- d %>% select(grp, Old = old, Mature = mat) %>% pivot_longer(Old:Mature, nam...
{"Voters":[{"Id":18400908,"DisplayName":"Сергей Кох"}]}
First things to try would be to clear the cache and toggle "friendly urls" - both of these can cause random stupidness. I'm not an expert on multistore though so maybe others could recommend additional steps. I assume you're not seeing any errors in the logs - which makes me assume it's probably related to the .htac...
223e3232e2['l3emlp23me2l3; em3l;2em3l2;[e32e23
You should include a callback function in the API call. <script async src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&loading=async&callback=initMap"> </script> You can then include any maps related code within the callback function: function initMap() { // Your Googl...
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher"
|flutter|kotlin|dart|
null
I am working on building a co-pilot using node LangChain. Right now I am trying to create an agent that can use a vector retrieval tool and return the source/citations. I have the model correctly using the vector store, however, I cannot seem to find a way to get it to return the sources. Could use some advice or resou...
LangChain OpenAI Agent with Sources
|artificial-intelligence|openai-api|langchain|langchain-js|
You should add a simple log statement in your component to find out how many times it renders, and the value of `authUser` at each rendering. It's almost certainly the case that your component is rendering more than once: - First with the initial value of `authUser`, which will be `null` when the page first loads ...
null
Does RN support iOS ProMotion for faster refresh rates without having to add some codes? I remember that several months ago when our team released the iOS app which is built by RN it do support ProMotion, but last week when I open the app I found the promotion didn't work anymore. We didn't change any code for refre...
RN 0.63 support iOS ProMotion?
Getting 'Error writing to file' during WiX Toolset upgrade when changing installation scope
|wix|wix4|
See example. Recursive assmebling expression formula from expression_tree table. ``` with -- recursive -- for PostgreSql cte as( select expression_id,oid ,concat( case when lv in('*','+','-') then concat('[',lid,']') else cast(lv as varchar) end ,ov ,case when rv in('*','+','-') ...
In `Windows `**`10`**, I used: The **`JAVA_HOME`** instead! I renamed `Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jar` to `Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jar_BACK` And I used: assoc .jar=jarfile ftype...
I have searched intensive for a solution of my problem but found noting helpful in my case. What i try to archive is to refresh a screenshot from my webcam in a webpage continously. Not the whole page. This is my current code which only shows a screenshot without to refresh it. Any help is appreciated. ``` <!DOCTYPE ...
Need help to refresh periodically a webcam snapshot in a webpage - not the whole webpage
|javascript|html|
I'm having some problems when static type checking decorated functions. For instance, when I use an incorrect function argument name or type, I don't get any warning or error hints in the IDE, only at runtime. **What steps will reproduce the problem?** - Add a decorator to a function - Use a incorrect arg...
If you have references, then you have to follow the rules for references: you can't change them later. You could just initialize them in your WILMA constructor: ``` WILMA(uint8_t *p) : bar(foo[0], foo[1]) { ... } ``` Or, make it something else, like pointers. ``` FRED *bar; ... bar=new FRED(foo[0],fo...
I am building a `Tampermonkey` user script. My actual script is a lot more complex but I am able to reproduce with the following example. My script needs to work on Hacker News website. For example on this page: https://news.ycombinator.com/item?id=39778570 Their html has `.athing` class which contains each...
I have a game which is drawing 324 tiles to an HTML5 canvas at 60 frames per second. It was working great when the tilesize was set to a fixed number of pixels and matched the pixels of the source image file. I updated the game to resize to the user's screen upon load. Everything still works fine, but the game has a...
|ios|react-native|
Try: ```py import requests from bs4 import BeautifulSoup url = "https://www.iplt20.com/news/match-reports" soup = BeautifulSoup(requests.get(url).content, "html.parser") for a in soup.select("#div-match-report a:has(li)"): print(a["href"]) ``` Prints: ```none https://www.iplt20.com/news/4014/...
The fact the JSON is being transmitted via MQTT is not really relevant; to access a property with a name that contains special characters you can use [bracket notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors): ``` const message = '{"src":"shellyplus1-08b61fd9e...
1.Way: [Integrated Functions to convert it after Executing the Report][1] 2.Way: Use the Keyword `LOWER CASE` on your Parameter. This way your input will be transported like its entered instead of translated to upper case. Only works if you get it from the Parameters. If its from your `SELECT`, use Way 1. Btw: Tr...
So I have beein working on a Towers of Hanoi code using Stack and no recursion and came up with the following logic according the the Wikipedia section on solving ToH using iteration. ``` if (tower[1].isEmpty() == false && tower[1].peek() != 1) { if (tower[2].isEmpty() || tower[1].peek() < tower[2].p...
What is causing my towers of hanoi logic to infinitely loop?
|java|stack|logic|towers-of-hanoi|
null
Formkit autoanimate doesn't work on my list. I have HospitalList, and there is a div with HospitalItems, i download autoanimate library, applied it, but it doesnt work My main.js: ```js import { createApp } from 'vue'; import App from './App.vue'; import './styles/app.css'; import components from '@/componen...
I am building a camera application in which i want a functionality that if the mobile camera is of 50 megapixels or any size It should only capture image in 12 megapixels size and its pixels should be restricted and resolution should be high.and image should have clear pixels .. I have used camera2 dependency for re...
Android camera application restriction to 12 mp
|java|xml|android-studio|android-camera|high-resolution|
null
`PostAsJsonAsync` uses `JsonSerializerDefaults.Web` for serializer options which will result in Camel case property names in the JSON while `JsonSerializer.Serialize(obj)` will create Pascal case. There are multiple ways to handle that. For example changing the settings for `PostAsJsonAsync`: ```csharp var response...
This is my code: ``` <?php $realm = 'Restricted area'; //user => password $users = array('admin' => 'mypass', 'guest' => 'guest'); if (empty($_SERVER['PHP_AUTH_DIGEST'])) { header('HTTP/1.1 401 Unauthorized'); header('WWW-Authenticate: Digest realm="'.$realm. '",q...
What´s the opposite of opening and closing tags in {PHP}?
I could show the [splide][1] slider by [BlazorPageScript][2] nuget package that makes easy [this][3] microsoft document for us. Home.razor : @page "/" @using BlazorPageScript @attribute [StreamRendering] <PageTitle>Home</PageTitle> <PageScript Src="./Components/Pages/Public/Home.razor.js...
Compare the elements of a linked list in pairs, each time choosing the minimum of the two and placing it in another linked list result. Example: we have a list [1, 2, 3, 4, 5, 6] the output must be a sublist such as [1, 3, 5] since min(1,2) = 1 and min(3,4) =3 and min(5,6)=5. Here's the recursive function I've wr...
Can I pre-scale and cache Images?
|javascript|html5-canvas|game-development|
I have a transaction table where I am trying to map Outflows to Inflows based on the LIFO. **Input dataset** Id|Date |Type |Amount --|----------|-------|----- 1 |26-01-2024|Inflow |519 2 |26-01-2024|Outflow|100 3 |26-01-2024|Outflow|139 4 |26-01-2024|Outflow|122 5 |29-01-2024|Outflow|42 6 |29-01-2024|...
I've managed to set up a successful API call to reddit's API. I'm looking to extract the subreddit rules for a list of subreddits. I have loaded the list of subreddits from a .csv. I'm struggling to understand what I need to do to queue up a number of requests and record the output. ``` library("httr2") library("j...
How to do API call for each value on list, then record results against each value?
|r|reddit|httr2|
Usually using a variable is an additional overhead, but in your case Chrome was able to provide the same performance. But if a variable is reused, that could actually boost performance. So the rule could be - don't create unnecessary variables. Also note that JS engine could optimize code while compiling so in reali...
Given that: - `GCD(a, b) ≤ a` - `GCD(a, b) ≤ b` Then you know that for a graph G(V,E) where the vertex v<sub>n</sub> has a cost c<sub>n</sub> then for every edge e<sub>(i,j)</sub> = (v<sub>i</sub>, v<sub>j</sub>) the cost c<sub>(i,j)</sub> for the edge is GCD(c<sub>i</sub>, c<sub>j</sub>) which is always less ...
I figured out the solution after posting my question. 1. I added an extra view at the beginning of the right `UIStackView`. This is basically a spacer view with no constraints and background color set to transparent. It is important NOT to set it to hidden and instead use transparent background color because `UIStac...
I am trying to project a trend through points on the chart. I have 2 set of points(lets say highs of 2 previous candles).If I draw a trendline through those 2 points, it will be extended right to the current bar. Is there a way for me to calculate what the value will be on the 3rd bar without having to actually plot th...
Pinescript Calculating 3rd point by joining 2 existing points from previous bar. i.e projecting trends
|pine-script|pine-script-v5|trendline|
|html|svg|safari|
Swiss-sched. help! please I am working on scheduling 8 showcases for the year. I have dataframes for each showcase that have rank and conference from where each player is from. Each showcase has a different number of players registered but it is always a different number of players. Ex. 48, 20 players. There can be ...
Store the price and time in a variable that you have defined with `var` like `var triggertime` if you want their value retained between bars (as normally all other variables are reset and recalculated on each bar). Or if you want to retain this value on the last - currently calculated - bar, you will need to use `va...
I had the same question. My solution looked like this: ```python @api.doc("""Return a report by method name""") @api.route("/reports/<method_name>") class ReportByMethod(Reporter): def __init__(self, method_name): self.method_name = method_name super().__init__() def get(self, met...
In the absolute, Yes you can. But it will be a very, very hard task. Look at the dependencies in the [pom.xml](https://github.com/spotify-web-api-java/spotify-web-api-java/blob/master/pom.xml) file: ```xml [...] <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-dat...
The action function has to have it's first argument as context, then arguments. **Like below.** ```typescript async createUser(context, username, email) { await addDoc(users, { username: username, email: email, }); }, ``` The error you're getting is that the field `username...
|php|html|
null
{"Voters":[{"Id":6461462,"DisplayName":"M--"},{"Id":522444,"DisplayName":"Hovercraft Full Of Eels"},{"Id":5468463,"DisplayName":"Vega"}],"SiteSpecificCloseReasonIds":[11]}
From the look of your code you seem to be making a call to this API endpoint http://localhost:4000/stocks but that doesn't look like the way API endpoint routes are structured ideally you should have something like "/api/stocks/{params.stockId}" is you have a folder structure like /api/stocks/[stockId] the varies base...