instruction
stringlengths
0
30k
|sabre|sabredav|
null
Another possible solution, which first creates a list of `1` or `-1` from each value of column `Integer_Column` and then uses [`explode`][1]: (df.assign(Integer_Column = df['Integer_Column'] .map(lambda x: [np.sign(x)]*abs(x))) .explode('Integer_Column')) ---------- The following solu...
null
I want to know which approach is better in which scenario: 1) React custom hooks for http requests, where we put states for loading, error and data and then inside functional component we just use that hook get data and then render it to ui and/or save it to redux. for example: ```javascript const...
|javascript|reactjs|redux|redux-toolkit|react-custom-hooks|
currently, I install mongodb on the C Drive and everytime I use backend to store something in mongodb, it will be automatically stored in the same folder as mongodb, which is C:/. But my next project will have to store a huge data of video and image, and if i keep save it on C:/, it will be full in no time. How can I...
How to setting mongodb to store data in other disk
|mongodb|express|
null
You can use your same code with only one changes. You are mentioned format as "WEBP "in capital letters. Just change "webp" (lowercase) as shown here . Your code ``` from PIL import Image import glob, os for infile in glob.glob("*.jpg"): file, ext = os.path.splitext(infile) print(file) im = Image....
i am trying to delete a column with the name "1" on pandas but i am getting a keyerror Traceback (most recent call last): File "/usr/lib64/python3.11/tkinter/__init__.py", line 1967, in __call__ return self.func(*args) ^^^^^^^^^^^^^^^^ File "/home/tamil/RnD/PreProcessing-1.0.1/app/app.py", ...
{"Voters":[{"Id":13302,"DisplayName":"marc_s"},{"Id":466862,"DisplayName":"Mark Rotteveel"},{"Id":16217248,"DisplayName":"CPlus"}]}
{"Voters":[{"Id":4541695,"DisplayName":"DVT"},{"Id":22180364,"DisplayName":"Jan"},{"Id":16217248,"DisplayName":"CPlus"}]}
Playing around this on my computer gives the following results. ```text test tests::v_0_bench ... bench: 1,157 ns/iter (+/- 55) test tests::v_1_bench ... bench: 776 ns/iter (+/- 41) test tests::v_2_bench ... bench: 1,741 ns/iter (+/- 61) test tests::v_3_bench ... bench: 424 ns/iter (+/-...
{"Voters":[{"Id":14732669,"DisplayName":"ray"},{"Id":1940850,"DisplayName":"karel"},{"Id":466862,"DisplayName":"Mark Rotteveel"}],"SiteSpecificCloseReasonIds":[18]}
|pdf|latex|pandoc|quarto|
```python import random def foo(row, col, d): N = row * col inds = set(random.sample(range(N), d)) arr = [1 if i in inds else 0 for i in range(N)] return [arr[i:(i + col)] for i in range(0, N, col)] foo(4, 5, 7) # [[1, 0, 0, 0, 0], [0, 0, 1, 0, 1], [0, 1, 0, 0, 0], [0, 1, 1, 1, 0]] ``...
NextJS Docker build fails: fetch failed ECONNREFUSED
I am trying to run ``` from ydata_profiling import ProfileReport profile = ProfileReport(merged_data) profile.to_notebook_iframe() ``` in jupyter notebook. But I am getting an error: AttributeError: module 'numba' has no attribute 'generated_jit' I am running jupyter notebook in Docker container with...
I want to create a Live Chat web widget - component, that can be embedded on ecommerce website and allow business owner to talk to users/customers (like Intercom). In my architecture design, I figured out that I need to store some kind of secret/token, that identifies conversation. System should remember conversation w...
Where to store secret token for an embeddable web widget?
|web|architecture|local-storage|
{"Voters":[{"Id":6574038,"DisplayName":"jay.sf"},{"Id":22180364,"DisplayName":"Jan"},{"Id":466862,"DisplayName":"Mark Rotteveel"}],"SiteSpecificCloseReasonIds":[]}
I'm working on some code for a javascript implemenation of Conway's Game of Life Cellular Automata for a personal project, and I've reached the point of encoding the rules. I am applying the rules to each cell, then storing the new version in a copy of the grid. Then, when I'm finished calculating each cell's next stat...
null
|r|dataframe|mutate|lemmatization|
I am receiving a json string of the form ```json { "people": [ { "Freddie": { "surname": "Mercury", "city": "London" } }, { "David": { "surname": "Bowie", "city": "Berlin" } } ] } ``` with the ultimate goal of recovering th...
Here is one possible option using [`cKDTree.query`][1] from [tag:scipy]: ```py from scipy.spatial import cKDTree def knearest(gdf, **kwargs): notna = gdf["PPM_P"].notnull() arr_geom1 = np.c_[ gdf.loc[notna, "geometry"].x, gdf.loc[notna, "geometry"].y, ] arr_geom2 = np.c_...
I get **Security Issues** (CVE-2019-20444, CVE-2019-20445) with threat level 9 for all the versions of the jars flink-rpc-akka-loader, flink-rpc-akka while scanning. Anyone faced this issue? Please share your resolution. Thanks. [flink-rpc-akka-loader_Vulnerable][1] [1]: https://i.stack.imgur.com/pPzQJ.png
**Open Visual Studio Code. Go to the Extensions view by clicking on the square icon in the sidebar or pressing Ctrl+Shift+X. In the search bar, type "HTML" and look for an extension that provides HTML language support. One popular extension is simply called "HTML" and is provided by Visual Studio Code. Click on the ...
I have the following ```yaml cassandra: image: cassandra:latest ports: - 9042:9042 volumes: - ./cassandra/image:/var/lib/cassandra environment: - CASSANDRA_AUTHENTICATOR=AllowAllAuthenticator - CASSANDRA_AUTHORIZER=AllowAllAuthorizer ``` The cassandra instance ...
I have a table with a string column that is formatted as json. I want to query my table by json. This is achievable with SQL ``` SELECT * FROM [db].[dbo].[table] WHERE JSON_VALUE(ColName, '$.jsonkey') = "value" ``` Is it possible with GraphQl and Hot Chocolate? I tried ``` public IQueryable<Class> G...
I get **Security Issues** (CVE-2019-20444, CVE-2019-20445) with threat level 9 for all the versions of the jars flink-rpc-akka-loader, flink-rpc-akka while scanning. Anyone faced this issue? Please share your resolution. Thanks. [flink-rpc-akka-loader][1] [1]: https://i.stack.imgur.com/pPzQJ.png
Locally run `ansible-lint` `pre-commit` behaves differently than run during CI/CD. I use following ```yaml --- repos: - repo: https://github.com/ansible/ansible-lint rev: v24.2.1 hooks: - id: ansible-lint ``` That is because `/etc/ansible/ansible.cfg` is available locally which also con...
ansible-lint during pre-commit in CI/CD
|git|ansible|cicd|pre-commit.com|ansible-lint|
null
I have a task to submit on greedy algorithms. I wrote this code but I'm not sure what the time complexity of the algorithm is. This problem called "Rectangle Covering". This is the code: ``` MinGreedyCutReg(R[]) cut[] = null while R != null endIndex = 0 for i = 0 to R.length-1 ...
Time complexity of Rectangle Covering algorithm
so as per [matias-quaranta][1] comment, this is a duplicate of [cosmos-db-trigger-is-not-being-run-when-inserting-new-document][2]. Currently CosmosDB does not work how a sane person would normally think, you need an SDK to trigger a pre or post trigger. Not Even the REST API can accept the trigger as a param. Just,...
There seems to be a bug with SwiftUI's [`TabView`](https://developer.apple.com/documentation/swiftui/tabview) when used with [`.tabViewStyle(.page)`](https://developer.apple.com/documentation/swiftui/tabviewstyle/page) and any animated `.transition()` that moves the view horizontally (e.g. [`.move(edge: .leading/.trail...
A quick and dirty solution is to move methods and the variable from the subclasses to `Injector` like so: ``` @dataclass(frozen=True, slots=True) class Injector: outer_diameter_injector: float side_wall_thickness_injector: float number_input_tangential_holes: float diameter_input_tangential_h...
Two ways Orders::max('id'); with softdelete/trashed Orders::withTrashed()->max('id');
{"Voters":[{"Id":3001761,"DisplayName":"jonrsharpe"},{"Id":14732669,"DisplayName":"ray"},{"Id":466862,"DisplayName":"Mark Rotteveel"}]}
|reactjs|node.js|docker|next.js|docker-compose|
i want to establish one way tls authentication system between app service and function app. Inside app service and function app i've uploaded private and public certificates from "certificate" blade. now whenever i make request to function app api i get 403, which certificate (private/public) should i send in request...
mutual tls authentication between app service and function app
|azure|azure-functions|azure-web-app-service|
{"OriginalQuestionIds":[8896320],"Voters":[{"Id":2802040,"DisplayName":"Paulie_D","BindingReason":{"GoldTagBadge":"css"}}]}
I've been working on a Python discord bot and wanted to containerize it, which has worked pretty well, but while testing one of the features (bot -> open API) via HTTPS using the http3 package and I'm getting the following error: ``` ssl.SSLError: Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_s...
Looks like there's an already accepted answer. But @user23919330 was onto something. The most obvious idea would be to convert this: for (size_t i = 0; i < SIZE; i++, a_ptr++, b_ptr++, c_ptr++, data++) { *a_ptr = data->a; *b_ptr = data->b; *c_ptr = data->c; } To this: fo...
I'm trying to setup a scheduled task with ECS Fargate.Task was dockerized and will be run through AWS ECS with Fargate. Unfortunately the service I want to run needs to access an API of a partner where the IP needs to be whitelisted. I see that for each execution of the task with Fargate a new ENI with an different IP ...
How can I have an ECS Fargate scheduled job access API with a ip whitelist policy?
I made a client-server side app using React.js and Expres.js. I also used a local database made on mysql workbench. I want to deploy my app to app-engine on google cloud, for this purpose I exported my db and now it is on the cloud. The problem arises when I want ot deploy the app. The client sode shows, but w...
Deployment through app engine, cloud sql database, problem connecting with server code, doesn't connect
i am trying to delete a column with the name "1" on pandas
|python|pandas|dataframe|
null
Use this: select jsonb_object_keys(json_stuff) from table; (Or just `json_object_keys` if you're using just JSON.) The PostgreSQL JSON documentation is quite good. [Take a look](http://www.postgresql.org/docs/9.5/static/functions-json.html). And as it is stated in the documentation, the function only ge...
I was getting the exact same error, while pushing my code on github. Then I went to github discussions. Solution - The slow or incosistent internet connection may cause this problem, make sure you've steady and fast internet connection, or it'll give you - > error: RPC failed; HTTP 400 curl 92 HTTP/2 stream 5 was...
Solidity: getStudentNotifications Retrieves notifications to other metamask account instead of one metamask account
I have a table that I created using angular-slickgrid AngularGridInstance in that I can add new columns, reorder the columns, shrink and expand the columns If I expand the columns too much that it goes beyond the screen then a Horizontal scroll bar comes which is fine. However, when I shrink columns excessively,...
Is it possible to have forceFitColumns and horizontalScrollBar both at the same time
|angular|slickgrid|angular-slickgrid|
null
I'm trying to Implement a K-means algorithm, with semi-random choosing of the initial centroids. I'm using Python as a way to process the data using numpy to choose initial centers and stable API in order to implement the iterative part of K-means in C. However, when I am entering relatively large datasets, I get S...
Bit of an R shiny novice so bear with me. I am trying to convert some R code I've written into an R shiny app so others can use it more readily. The code utilizes a package called IPDfromKM. The main function of issue is getpoints(), which in R will generate a plot and the user will need to click the max X and max Y ...
|reactjs|google-app-engine|deployment|mysql-workbench|
null
In GLSL I iterate over a float buffer, that contains the coordinates and a couple properties of elements to render. I was curious about shaders (don't have much experience with them) and wanted to obsessively optimise it. When looking at how it gets compiled (I'm using WebGL+Spector.js), I notice that in the loop where...
GLSL clamps indices on array access
|glsl|glsles|
I have a json like [ { "url": "https://drive.google.com/file/d/1tO-qVknlH0PLK9CblQsyd568ZiptdKff/view?usp=share_link", "title": "&#8211; Flexibility" }, { "url": "https://drive.google.com/open?id=11_sR8X13lmPcvlT3POfMW3044f3wZdra", "title": "&#8211; Prono...
How to run an R function getpoints() from IPDfromKM package in an R shiny app which in R pops up a plot that utilizes clicks to capture coordinates?
|r|shiny|survival-analysis|shinyapps|
null
Heres a much simpler version of the accepted answer, without using combine ``` class SearchManager: NSObject, ObservableObject { @Published var completions: [MKLocalSearchCompletion] = [] private let completer = MKLocalSearchCompleter() override init() { ...
I am receiving a json string of the form ```json { "people": [ { "Freddie": { "surname": "Mercury", "city": "London" } }, { "David": { "surname": "Bowie", "city": "Berlin" } } ] } ``` with the ultimate goal of recovering th...
Custom rewriter for json
|json|protocol-buffers|
A **[with expression][1]** produces a ***copy of its operand*** with the specified properties and fields modified. Starting with C# 10, the LHS operand of a **with** expression can now be - **records**, **structs** or **anonymous** types. **Records**: public record Person(string FirstName, string LastName)...
We are running a build pipeline on Azure DevOps. NPM install task fails with the following error: ```npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node index.js --exec install npm ERR! Installing Cypress (version: 4.2.0) npm ERR! npm ERR! 25l[11:02:24] Downloading Cypress [sta...
I have a class with variadic template parameters and I am trying to write a member function that unpacks the parameters into a tuple, so that I can use a structured binding in order to access the individual parameters. ``` #include <string> #include <tuple> #include <vector> #include <map> #include <memory> ...
No programming is required. Create a shortcut to your program on the desktop. Right-click it, Properties, Layout tab. Adjust the Width property of the screen buffer and window size. But you can do it programmatically too, those Windows API functions you found are wrapped by the Console class as well. You first h...
**_Originally asked on Swift Forums: https://forums.swift.org/t/using-bindable-with-a-observable-type/70993_** I'm using SwiftUI environments in my app to hold a preferences object which is an @Observable object But I want to be able to inject different instances of the preferences object for previews vs the prod...
- Loading data from cells to an arrya to improve the efficiency _Microsoft documentation:_ > [Range.ClearContents method (Excel)](https://learn.microsoft.com/en-us/office/vba/api/excel.range.clearcontents?WT.mc_id=M365-MVP-33461&f1url=%3FappId%3DDev11IDEF1%26l%3Den-US%26k%3Dk(vbaxl10.chm144095)%3Bk(TargetFramewor...
[from here][1] > If you try to add a standard HTML tag inside the React Three Fiber > Canvas element, then you will get an error similar to Uncaught Error: > R3F: Div is not part of the THREE namespace! Did you forget to extend? > > The error happens because the React Three Fiber reconciler renders > into a Th...
With input: ``` import re text = "Of the hundreds of thousands of high school wrestlers, only a small percentage know what it’s like to win a state title. {{Elided}} is part of that percentage. The Richmond junior joined that group by winning… Premium Content is available to subscribers only. Please login here to ...
I work on a webForm project (.NET FrameWork) And I have this exception : ``` <!-- System.Web.HttpCompileException (0x80004005): c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\a1f84433\8a878a8d\App_Web_genericusercontrol.ascx.9c4a4a40.c8huzmqq.0.cs(180): error CS0234: The type or names...
{"Voters":[{"Id":5021945,"DisplayName":"Irish Redneck"}],"DeleteType":1}
I'm doing training where I use two projects where, project A will have the artifacts that will be used and, in project B, I will build using a deployment group. During the execution of the release pipeline, the following error appears: > Failed in getBuild with error: Error: VS800075: The project with id > 'vstfs:/...
I'm trying to create a code for **perfectly optimal chess endgame**. This code for chess endgame is my currently best [one](https://pastebin.com/zkcbgANy) import chess def simplify_fen_string(fen): parts = fen.split(' ') simplified_fen = ' '.join(parts[:4]) # Zachováváme pouze info...
I am a beginner in C# and cpp, and When I'm trying to build the FiveM launcher from the the [FiveM launcher OpenSource code](https://github.com/citizenfx/fivem) FiveM launcher OpenSource code, I'm getting this error after doing fxd build. ``` "C:\Users\Utilisateur\Desktop\dev\fivem\launcher\fivem\code\build\five\Ci...
Why am I getting this error ? error CS0103: The name 'EnhancedStackTrace' does not exist in the current context
|c#|c++|build|compiler-errors|fivem|
null
I am trying to make a to do list. MY app take a data successfully. But when I want to delete a data from the list. it is showing typeerror: passdata.map is not a function. I am just learning react and I can not figure out where the problem is. N:B: My code is in between two components. ``` `import React, { useS...
|talend|
I would consider [this previous answer][1] that you can combine with a mask to hide a portion of the circle: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> svg { width:200px; transform:rotate(90deg); /* control the rotation here */ } <!--...