instruction
stringlengths
0
30k
βŒ€
like this? ``` def loop_and_return(lst, target_item, steps_back): for index, item in enumerate(lst): print(item) if item == target_item: new_start_index = max(0, index - steps_back) for new_item in lst[new_start_index:]: print(new_item) ```
{"Voters":[{"Id":483779,"DisplayName":"Stickers"},{"Id":2802040,"DisplayName":"Paulie_D"},{"Id":8620333,"DisplayName":"Temani Afif"}]}
I'm encountering an issue with my Brick Breaker game project. When the game ends, that is, when the number of clicks exceeds 10, a button appears and I exit. However, when I restart the game after exiting, the ball starts moving again according to the mouse position where I clicked the button or the position of the las...
Preventing the ball from moving after restarting the game in Raylib C++
|c++|game-development|raylib|
null
A shell script is a sequence of commands. The shell will read the script file, and execute those commands one after the other. In the usual case, there are no surprises here; but a frequent beginner error is assuming that *some* commands will take over from the shell, and start executing the following commands in t...
I have set up a Datastream service, in order to replicate data from Cloud SQL (MySQL) to BigQuery. Everything is set up correctly, connection works. But the weird thing is that only tables < 10mb size are replicated without issues. The larger tables (100+ MB) all fail. When checking the error status, it only say...
It seems that you have a logic issue in your code. You're overwriting the value of num within the loop. I fixed the code for you and added message strings to your awaiting input to clarify which action the user should perform next. import sys max_num = -sys.maxsize sum_numbers = 0 ...
When I use the shortcut CTRL+/, without selecting anything, Sublime Text 3 inserts `/**/` where the cursor is in my typescript (*.ts) files, instead of commenting out the current line by inserting `//` at its beginning. Block commenting should happen only when I selected several lines.
Commenting current line with shorcut CRTL+/ instead of block commenting
I have with two sql statements, returning different results, but I do not understand why. Here is my data [enter image description here](https://i.stack.imgur.com/1VTJY.png) student|class --|-- 'A'| 'Math' 'B'| 'English' 'C'| 'Math' 'D'| 'Biology' 'E'| 'Math' 'F'| 'Computer' 'G'| 'Math' 'H'| 'Math' 'I'...
I'm currently trying to simulate a algorithm on a RISCV processor using RVV intrinsics. I want to explore how the performance varies depending on the RVV vector length. I've noticed [the RISCV ISA file](https://github.com/gem5/gem5/blob/e8bc4fc137a5a7e82b601432271a027b652ae69b/src/arch/riscv/RiscvISA.py#L101) seems to ...
In my Flutter app, I'm hitting an API to get the Order details from the server but getting the following exception: **Code:** ``` try { final url = Uri.parse('$baseUrl/api/v1/user/order/fetch-by-id'); final response = await http.post( url, headers: { "Hos...
Getting `FormatException: Missing extension byte (at offset 6)` exception for accessing `response.body` from a server deployed in Vercel
|json|flutter|http|vercel|formatexception|
|git|pre-commit|pre-commit.com|ruff|just|
Try something like this: async function myFunction () { async function fetchData() { try { let f = await fetch("./my_file.txt"); let text = await f.text(); return text; } catch (ex) { console.error(ex); } ...
I'm practicing using React queries. In this code, I expected to invalidate only the ['test'] query key. However, the ['todos'] query is invalidated and the data is received again from the server. Applying useQuery options does not change the results. I would appreciate some help as to what the problem is. ...
The result of the invalidateQueries in react-query isn't as expected
|reactjs|react-query|
null
Have you tried saving the value of the filters in the local storage with vuex or pinia (depending on your case) so that when you return to the previous page you can take those values by default?
You're right, `string.Trim` removes the spaces before and after, `string.TrimStart` before and `string.TrimEnd` after the `string`. ```cs " my string ".Trim(); // "my string" " my string ".TrimStart(); // "my string " " my string ".TrimEnd(); // " my string" ``` However, this doesn't remove the spaces in the midd...
I was looking for solution with **acceptable** performance. It comes to me that COBOL has extremely efficient SORT implementation, especially external SORT on mainframes. Sorting 10GB data set with 10M records, using 1GB of RAM, takes less then one minute on laptop PC. I haven't tested it on mainframe yet, but I assume...
I am getting an error for my desired dataset when trying to use an isolation forest method to detect anomalies. However I have another completely different dataset that it works fine for, what could cause this issue? isolationforest Model Build progress: | (failed) | 0% Traceback (most recent call last): File ...
java.lang.AssertionError when trying to train certain datasets with h2o
|python|java|h2o|
1. Check the maximum supported GCC version for your CUDA version: | CUDA version | max supported GCC version | |:-------------------------------:|:-------------------------:| | 12.4 | 13.2 | | 12.1, 12.2, 12.3 | 12....
I'm using Go for my backend server and Javascript as my frontend, I've successfully used http previously to localhost some simple data in IPC in Go then fetch and retrieve in my table from the localhost url in Javascript. But now I'm having trouble with trying to setup a way of serving and retrieving data using flight....
How do I locally host an Apache Arrow Flight server using Go and retrieve in Javascript?
|javascript|go|apache-arrow|apache-arrow-flight|
null
Basically you didn't provide a terminating statement. It keeps on dividing your array in half. You have to provide a terminating statement to check if the length of your array is 0. if len(sorted_arr) == 0: return -1 Check [here][1] for more information on binary search [1]: https://www.geeksfor...
The `-n` option cannot be overridden, so you can't exclude a single tag when extracting all data. It can be activated on a per tag basis by appending a hash tag to the end if a tag name e.g `-TAG#`, but that requires listing only specific tags, not all of them.
{"Voters":[{"Id":207421,"DisplayName":"user207421"},{"Id":10971581,"DisplayName":"jhnc"},{"Id":1431720,"DisplayName":"Robert"}],"SiteSpecificCloseReasonIds":[18]}
Accessing a variable that constantly changes part of its name, knowing only the unchanging part
|javascript|
I want to solve an implicit functional equation by finding the solution's Taylor expansion. E.g., solve n f(x) - (n-1) f(f(x)) - f'(f(x)) f(x) = x^(n-1) f(x) for f(x), given f(0) = 0. Differentiating this with respect to x, I get n f'(x) - n f'(f(x)) f'(x) - f''(f(x)) f(x) f'(x) = (n-1) x^(n-2) f(x) + x^(n-1) ...
Substituting values in an Python sympy unknown function
|sympy|substitution|
null
I recently started implementing post-quantum crypto and needed to implement the polynomial multiplication for which number theoretic transform (ntt) is used to reduce its time of computation and this code below is one of the approach(not the most optimal but optimal compared to naive convolution implementation) and thi...
I have an SSD from a failed server with data on it I'd like to restore. The data is in an LVM volume. I've tried various things based on googling which may have messed things up on the drive but I'm hoping I can still recover some of it. Here is what I have: ``` root@proxmox:~# lsblk --fs NAME ...
How do I access data from an lvm volume on a drive?
|linux|mount|proxmox|lvm|
I am trying to find best tool which pulls data from different database and data sources (like sharepoint, salesforce etc), that contains usage metrics, asset management data, incident management data, alerts etc. and show in Dashboard. Can you please recommend any suitable tool that give me this requirement? I found Mi...
Dashboard to pull data from different databases and data sources
|database|dashboard|metrics|usage-statistics|asset-management|
IIRC, IntelliJ standard keyboard shortcut for redo is <kbd>CTRL</kbd>+<kbd>SHIFT</kbd>+<kbd>Z</kbd>, so what probably happened is you remapped the shortcut at some point and it just slipped your mind. The settings window can be found under File > Settings. <kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>S</kbd> should work if t...
null
Given this directory structure (empty `__init__.py` and `logging.yml` is fine): <!-- language: lang-none --> foo β”‚ setup.py β”‚ └─── foo β”‚ __init__.py β”‚ └─── config logging.yml Here is my attempt, this `setup.py`: <!-- language: lang-python -...
Including non-Python files without __init__.py using `package_data` in setup.py?
|python|setuptools|setup.py|egg|data-files|
{"Voters":[{"Id":6752050,"DisplayName":"273K"},{"Id":17562044,"DisplayName":"Sunderam Dubey"},{"Id":16217248,"DisplayName":"CPlus"}],"SiteSpecificCloseReasonIds":[13]}
I added custom icons in the right folders (as recommended in the documentation): <project-root>/platforms/android/res/drawable-xxhdpi/ic_stat_onesignal_default.png for OneSignal notifications, but when I build the apk for android using `ionic package`, the icons are not present. Is there any workaround...
Ionic package, how to add onesignal custom icons to the packaged apk
With no control over source table, you have sort of hit on one of a few use cases to actually use the `SELECT *` pattern. However, the answer of what to do is really determined by your answer to how will you resolve your broken ETL if the source is changed. If it is critical, can't go back in time to get past data,...
I am trying to host a nextjs website on iis here is my set up . 1. Website with web.config hosted under default site [![enter image description here][1]][1] 2. Contents of web.config which causes nextjs site . On access of http://localhost/AppWithNode1/SimpleErrorView it should redirect to the nextjs site. ...
You may use this refactored awk script for this data. Note that we need to check for both `private` or `public` keywords for our start of the block marker. Moreover checks like `!col1[n]` and `!col2[n]` are required to avoid overwriting same array indices for both the arrays. ```sh cat parse.awk BEGIN { OFS="\t"...
You can use the following to display a notice in checkout page when a subscription product is in cart and if the customer has already an active subscription: ```php // Conditional function: Check if a user has active subscriptions function has_active_subscriptions( $user_id = 0 ) { return wcs_user_has_subscript...
You have to use <input type="submit" name="id" value="1"/> Button does not have name and value attributes.
I get the following error when I use the Stripe API for Rails. [![enter image description here][1]][1] The error occurs when: - I use the token with parameters, - I directly create the map without parameters in Rails console. The code only worked when I used the code below. - ``` Stripe.api_key = 'sk_tes...
I have a table like: | concatenated_dates | mat_emp |rest | |:---------------- | :----: |----: | | EX 2018/2019 | AO-26 |27.5 | | EX2019/2020 | AO-26 | 30 | | EX2020/2021 | AO-26 | 30 | | EX2021/2022 | AO-26 | 30 | | EX2022/2023 | AO-26 ...
Before I was stuck with this problem the project was running on ```PHP5.6``` on ```SF2.6```. Now I'm using ```PHP7.1.20``` with ```SF2.8```. I installed apcu along with apcu_bc inside my docker container and enabled the apcu php module. Now the error is: UndefinedFunctionException in ApcCache.php line 35: ...
null
i have there function: function send(address to, Pair721[] memory tokens) public nonReentrant whenNotPaused { for (uint256 i = 0; i < tokens.length; i++) { Pair721 memory p = tokens[i]; p.token.safeTransferFrom(msg.sender, to, p.tokenId); } } and i have code on...
how i need place arg in code for funtion send?
|go|cryptography|smartcontracts|bsc|
null
> Note: This service only works when Log list returns only one data. But when it returns more than one data, then it triggers the error. `_db.Users.FindAsync` and potentially `GetDirectoryInformation` (it seems that it can use/uses database too) are the problem, the following: ```csharp var logsDTO = await Task....
i am new to the program and need to learn the basics of the coding to type down the research paper. any inputs are welcome, thank you in advance i have tried the learning options in overleaf itself but did not seem to help much
i need help coding a research paper in overleaf (LaTex)
|latex|
null
To solve, you need to import Private Certificate (PFX). If you don't have PFX, use OpenSSL to generate it: - Download&Install OpenSSL - Open command line and run: `openssl pkcs12 -export -in public_certificate.cer -inkey server.key -out private_certificate.pfx` Than, install private_certificate.pfx ...
I have a relatively large PostgreSQL (v12) table storing JSONB data that has unintentional duplicate data (based on a composite unique index on two columns, `aCol` and `bCol`). In order to create that index, I have to first delete all of the accidental duplicates from the DB. This works fine in 2/3 of our DB servers (s...
Try this, import com.microsoft.graph.authentication.TokenCredentialAuthProvider import com.microsoft.graph.models.Message import com.microsoft.graph.models.Body import com.microsoft.graph.models.EmailAddress import com.microsoft.graph.models.Recipient import com.microsoft.graph.requests....
I'm developing `Grails 6.1.2 ` application and I installed [Spring security core plugin][1] and followed all the installation steps mentioned in the documentation, I'm using`MYSQL`, I used the `Bootstrap` file to save some credentials when the application starts, all the `User,Role` tables were populated successfully e...
Table UserRole not populated in Grails 6
|mysql|hibernate|grails|spring-security|grails-plugin|
> How will it know which persisted state is being provided during the migration? This where the `version` of the [persist configuration][1] comes into play. > { > key: string, > storage: Object, > version?: number, // the state version as an integer (defaults to -1) > blacklist?: ...
{"Voters":[{"Id":16695029,"DisplayName":"user16695029"},{"Id":16791505,"DisplayName":"Paolo"},{"Id":16217248,"DisplayName":"CPlus"}],"SiteSpecificCloseReasonIds":[13]}
How does the REPEAT FUNCTION deal with the trailing blanks from the string?
|css|wordpress|woocommerce|media-queries|mobile-devices|
{"Voters":[{"Id":7758804,"DisplayName":"Trenton McKinney"},{"Id":2530121,"DisplayName":"L Tyrone"},{"Id":16217248,"DisplayName":"CPlus"}]}
{"Voters":[{"Id":22192445,"DisplayName":"taller"},{"Id":8162520,"DisplayName":"Mayukh Bhattacharya"},{"Id":16217248,"DisplayName":"CPlus"}]}
def count_and_say(n): string= '1' for i in range(n-1): count = 1 result = '' for j in range(len(string)): if j == len(string)-1 or string[j]!=string[j+1]: result += str(count)+string[j] count = 1 else: coun...
{"Voters":[{"Id":7758804,"DisplayName":"Trenton McKinney"},{"Id":2756409,"DisplayName":"TylerH"},{"Id":16217248,"DisplayName":"CPlus"}]}
{"Voters":[{"Id":209103,"DisplayName":"Frank van Puffelen"},{"Id":2851937,"DisplayName":"Jay"},{"Id":16217248,"DisplayName":"CPlus"}]}
My app allows users to create account by e-mail. And Google play console asked account deletion link, but I'm using Firebase and users can delete own account after login. Where can I get account deletion link in firebase?
Google Play Asked Account Deletion Link
|firebase|
How to change WooCommerce notice "info" background color on smaller screens?
here is my code ``` const puppeteer = require("puppeteer-core"); async function main() { console.log("Connecting to Scraping Browser..."); const browser = await puppeteer.connect({ browserWSEndpoint: SBR_WS_ENDPOINT }); try { const page = await browser.newPage(); console.log("Connected! Na...
403 on brightdata ws endpoint
|javascript|node.js|web-scraping|puppeteer|
null
In influx 2.x I use: ```bash influx delete --start=$(date -d "today -60 days" +%Y-%m-%dT%H:%M:%S)Z --stop=$(date -d now +%Y-%m-%dT%H:%M:%S)Z --bucket MY_BUCKET_NAME ```
I did a error while understanding about the polar decompositon. I thought polar decomposition is `PU`, but it is `UP`. While trying to understand what went wrong, I realized that it is somewhat commutative for the inputs I am giving to it because of which I could not realize about this big mistake. It would be great...