instruction
stringlengths
0
30k
I have some code that for a grid of ints requires comparing cols with rows. The grid dimension is unknown at compile time. So I need a good hash function for a 1-d array of int. The following code compiles and runs as expected as it uniquely identifies any row or col : def hashValue(a: List[int]) -...
I'm working on an application designed to convert between different number systems. Its operation involves users inputting a value in one base number system, after which the remaining three text boxes will automatically display the equivalent values in the other number systems. However, I've encountered a stack overflo...
1. Define your `embedding` model, with `HuggingFaceEmbeddings` ```py from langchain_community.embeddings import HuggingFaceEmbeddings embedder = HuggingFaceEmbeddings( model_name = "sentence-transformers/all-MiniLM-L6-v2" ) ``` 2. Then embed the chunks into vectorDB ```py db = Chroma.from_documen...
espero y me puedan ayudar. resulta que estoy creando una tabla la cual contiene 2 claves primarias. estoy haciendo esto de la siguiente manera: create table DatosPrincipales( CodigoPrincipal char(10) not null, CodigoSecundario char(3) not null, NombreProducto char(50) not null, CantidadProducto int null de...
Claves combinadas
|foreign-keys|primary-key|
I am creating an app, in which user firstly specify in-app language and then is allowed do proceed to button from which is Google Sign-In intent launched. I was using this tutorial and it works perfectly [link to tutorial](https://developers.google.com/identity/sign-in/android/sign-in), but there is no option to specif...
How to specify language in Google Sign-In intent in Android?
|java|android|kotlin|google-identity|
null
`isAuthenticated` is only set once ``` @tracked isAuthenticated = this.SessionManager.isAuthenticated ``` this means, the variable `isAuthenticated` is initialized with the value from sessionManager (not that isAuthenticated always prepresents the value on the right side of `=` (as assignments only happen once...
Resolution: After ignoring misleading error messages, I looked at docker daemon response I spin up other B series VM with 2 vcpus, 8 gb ram and it did solve the problem (Azure B2ms Ubuntu VM)
This could be achieved via `scale_fill_binned` and `guide_bins`. Try this: ``` library(usmap) library(ggplot2) plot_usmap( regions = "counties", include = c("NY"), data = Z, values = "unionized" ) + labs(title = "Percent Unionized", subtitle = "") + scale_fill_binned( low = "white", high = "re...
null
Please consider the following case that would result in memory getting written after being deallocated. The reason being that in `class PoorlyOrderedMembers` the member `m_pData` is declared after the member `m_nc` which means that the `std::unique_ptr` d'tor will be called and the instance of `ClassWithData` will b...
I want to use the deepL API in a C# project. I want to translate from one into 3 different languages and work with a single glossary for each language pair. However - a glossary is not static and from time to time it needs to be updated - e.g. by extending it by a new word pair or replacing or deleting an old one. ...
How can I add, edit or delete an existing deepL Glossary using C#?
|c#|deepl|
1. You need to export the `app` from `index.js` file. try placing the below code at the end of `index.js` file. `module.exports = app;` 2. Update your `vercel.json` as below. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> { "version": 2, ...
An alternative approach, keeping the image sources away from the Javascript, might be to use `dataset` attributes to store the alternative image source and toggle between that and the source. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> document.querySelector...
Okay so in this secnario, I haven't included python3.lib, Simple fix to this is to iinclude python3.lib in the Linker.
I've started to use Vite to craete React project for the first time. I followed a 2023 tutorial video on youtube. I'm using macos. There were many projects in **Webapps** folder and I created a new folder for a Vite project where the directory structure was like this: **Webapps |- project A |- project B |- .....
null
import os import shutil # Source directory containing the 900 files source_dir = '/content/dataset/train/rottenapples/' # Destination directory where you want to copy the files destination_dir = '/content/fresh_rotten/rotten_pic/' # List all files in the source direct...
When you crate a Lakehouse or Warehouse in Fabric, the service will create a folder structure under the top onelake folder like that: <em>worksapce_name/Lakehouse_name/table_name</em> Please note that although Fabric uses the name Synapse Data engineering, It has nothing to do with the Synapse analytics service and ...
All answers provided so far are correct. Adding my version, in an attempt to make it bit easier for those who still need further clarification. **Task Role:** The ECS set up will have some containers. These containers will perform some tasks for which we are being created. To perform these tasks **containers** need...
Try declaring variable for distance as at line no.9: ` double distance = 0.00; `
I am developing a website using django rest framework and react. And I transferred from the test VM to the timeweb cloud virtual cloud and ran into the problem that when connecting to the site, the site starts without information from the postgres database. And also when starting the react web server.the js command "n...
Are there C++ idioms that protect you from poorly ordered data members?
|c++|
{"Voters":[{"Id":11854986,"DisplayName":"Ken Lee"},{"Id":9473764,"DisplayName":"Nick"},{"Id":839601,"DisplayName":"gnat"}],"SiteSpecificCloseReasonIds":[13]}
Using Conditional Formatting does not restrict the automation.<br> Rather than colouring the cells in Pandas and writing to Excel you are just colouring the cells in Excel instead using Openpyxl.<br> It shouldn't be any different unless you have a need to access the DataFrame with styling included.<br> Conditional F...
You can construct your own version of `keep_alive`: ```cpp struct keep_alive_container {}; namespace pybind11::detail { template <> struct process_attribute<keep_alive_container> : public process_attribute_default<keep_alive_container> { static void precall(function_call&) {} ...
I am trying to convert the input that I got from the user(string)to float and for float number format(15.6,4.5...) `string checkedNumber = txtResult.Text.Replace(',', '.'); number1 = Convert.ToSingle(checkedNumber);` I already tried that but it didnt help So I updated now `string checkedNumber ...
Culture info usage while converting string to float type
|type-conversion|converters|cultureinfo|decimalformat|
null
You can't. The keyboard is a separate app, and there is no mechanism to force it to display certain things. Even if there was, that other app may not respect it. Even high level ideas like numeric keyboard are suggestions, not enforced.
null
The following solution "melts" the data from wide to long format, using the Family as the id column against which to melt. Then, sorting the data table by the sample name and the counts in descending order (which will order the Family with the largest count at the start of each group). Grouping the data table b...
I had the same issue and finally figured it out. you should not use the init method, instead pass the fields directly to you custom retriever. class QuestionRetriever(BaseRetriever): vectorestore:VectorStore docstore:Docstore def _get_relevant_documents(self, query, run_ma...
|snakemake|
I have seen that **int **and **integer **both are do the same job.There is "bool" and "boolean" too. As i know there is no wrapper classes in php like we have in java. So my question is, What is the exact purpose of having two kinds like this ? Theoretically those are may be just two names for the same data type...
why we got same data type in two versions like "int" and "integer" in php?
|php|class|types|backend|
null
{"Voters":[{"Id":205233,"DisplayName":"Filburt"},{"Id":14853083,"DisplayName":"Tangentially Perpendicular"},{"Id":839601,"DisplayName":"gnat"}],"SiteSpecificCloseReasonIds":[18]}
In the example of your link, the ctx is passed as an argument to 'page' before MustElement is called, but you do it after calling MustElement. So, when you try to cancel, your 'page' variable doesn't share the context and it hangs. Here's the example from the github link I am referring to (modified a little): pa...
I am trying to get record of related table name automation_tag but getting above error please provide solution to solve this error there is relation between three tables automation,automation_tag and automation_tag_relation here is the code I am trying to do function for getting record:- export const get...
Error:DatabaseError complex joins are only supported when all distributed tables are co-located and joined on their distribution columns
|node.js|typescript|sequelize.js|
I was trying to build a social media app.In my home page I was displaying other people posts.But its displaying the last uploaded post repeatedly rather than displaying all posts. This is cloud firestore database structure [database structure](https://i.stack.imgur.com/zRKwM.png) This is the output I am getting ...
How to recover deleted files from create vite react project
|macos|visual-studio-code|vite|restore|
null
I am using node server for the backend. Connection to Cassandra is done using cassandra-driver nodejs. Connection is done as follows: const client = new cassandra.Client({ contactPoints: ['h1', 'h2'], localDataCenter: 'datacenter1', keyspace: 'ks1' }); 1. In contactPoints, do I j...
Insert & Retrieve from a channel in same main function throws goroutine 1 [chan receive]: main.main() /path exit status 2 error
I have been working on a `LAMP` Server project which is a hotel booking website. The flow is that once the user selects the hotel, the user will check to confirm the number of adults and children for a particular room, and then proceed to payment which will then insert the user's payment credentials into the `MySQL` da...
Unable to insert into MySQL database upon checkout and payment
|php|mysql|lamp|
It did not go so well ... The right sidebar disappears if screen is small alright but the top sidebar is staying there and I do not understand why ... after fiddling for hours I decided to ask for help. <html><head> <style type="text/css"> body{ width:100%; height:100%; margin:0px; ...
Insert & Retrieve from a channel in same main function throws "goroutine 1 [chan receive]: main.main() /path exit status 2" error
final AsyncMemoizer<List<MyModel>> _memoizer = AsyncMemoizer<List<MyModel>>(); Future<List<MyModel>> getSometing() async { return this._memoizer.runOnce(() async { return await getData(); }); }
How do I connect a website to the postgres database?
|reactjs|django|
Return a pointer to the `Node` of interest instead of updating the out parameter `head_dest`. The current implementation changes the original list. To create a new list you need to return a pointer to copy of the smallest node or NULL. To emphasize that I made the argument constant with `const Node *head`. ``` #...
I'm currently using `Elysia@1.0.0`, and as far as I could tell (even from previous versions), you could use: ```typescript app.listen({ port: 3000, tls: { key: Bun.file(join(import.meta.dir, "../key.pem")), cert: Bun.file(join(import.meta.dir, "../cert.pem")), }, hostname: "0.0.0.0", }); ```...
|ios|xcode|
Try declaring variable for distance with initial value as `0.00` at line 9 as below code: ` double distance = 0.00; `
I have two databases, the first for user names and their data, and the other database is for training, and I did not find a way to link the trainee from the training table and the users table in the first database for users. Two Contexts were used, but I did not find the solution. 1- CentralBase DbContext : p...
How to load data from a different context in Entity Framework Core?
|c#|entity-framework|entity-framework-core|entity|
When ever we enter text in the filter section, we need to call an API to get the relevant output list and update this into multiselect results. Here I tried onFilter event to call the API, I got the API result but the result list not getting updated in the multiselect DOM. I can not override the default fi...
Firebase read from the database resulting in repeating the contents of last uploaded document instead of all documents
|flutter|firebase|google-cloud-firestore|firebase-realtime-database|
null
I have created a web api application using C# and dot net 6, when I changed `app.Run();` in **program.cs** file to this: ``` app.Run(async context => { await context.Response.WriteAsync("I'm upgrading!\nTRY AGAIN LATER"); }); ``` the application does not show me the message and does not open either! doe...
Web-Api pipeline Does Not Work As expected
|c#|asp.net|.net|asp.net-web-api|webapi|
null
I am using POI 5.2.3 and I am having problems with finding the getRPr methods isSetRFonts, isSetSz, isSetSzCs and the corresponding "gets" in setParagraphRunProperties in the answer to the question here: https://stackoverflow.com/questions/64074191/apache-poi-java-how-can-i-change-the-font-name-and-size-of-a-list-numbe...
Use ADB-WiFi plugin and if still not connecting the just switch off and switch on wifi on you device before connecting.
{"Voters":[{"Id":62576,"DisplayName":"Ken White"},{"Id":390122,"DisplayName":"AlwaysLearning"},{"Id":839601,"DisplayName":"gnat"}],"SiteSpecificCloseReasonIds":[11]}
I'm using `JanusGraph-1.0.0` with `Cassandra-4.1.3`. By using `JanusGraphManagement`, I am able to set edge TTL. However, I cannot update the edge TTL later. I have created an edge label and with `mgmt.printEdgeLabels()`, I get the below output. ----------------------------------------------------------------...
Mail verification in Laravel, redirect to custom route?
|laravel|authentication|
Using nodriver, you don't need to switch to iframe to interact with it. nodriver's search methods automatically switch to iframe if the searched text/element is not found on the parent document or if you are using multiple elements selectors. From nodriver's README: > smart element lookup, by selector or text, **...
The continuity correction implementation in SciPy was *not* correct, as discussed in [`scipy/scipy#2118`](https://github.com/scipy/scipy/issues/2118). What *should* happen is for the correction to nudge the test statistic toward the mean of the asymptotic distribution, slightly increasing the p-value to compensate for ...
I've been learning kubernetes on GKE lately. I'm testing CronJob, and I'm having trouble with the behavior there. Below is overview of node-pool, cron job settings. ``` node-pool: 1 node (remaining allocable memory is 1Gi) cronjob: Simple busybox cron for test ``` So, first of all, I requested the cronjob'...
I've been learning kubernetes on GKE lately. I'm testing CronJob, and I'm having trouble with the behavior there. Below is overview of node-pool, cron job settings. ``` node-pool: 1 node (remaining allocable memory is 1Gi) cronjob: Simple busybox cron for test ``` So, first of all, I requested the cronjob'...
Create a child job from a parent "seed" job with Job DSL
|jenkins|groovy|devops|jenkins-plugins|jenkins-job-dsl|
null
One possible way is creating an array of positions using the separator regexp, and then doing different replacements between those positions, like this: ```Python import re def replace(data, separator_re, replace_outside_special_func): poss = [0] for match in re.finditer(separator_re, data): poss.ex...
When trying to run the application in Android Studio, I'm getting the following error message: [![enter image description here][1]][1] Unfortunately, there is no further information about the cause of the error. Is it possible to get more detailed information? [1]: https://i.stack.imgur.com/27sPt.png
How to debug the "Installation failed" error in Android Studio
I'm trying create a docker-compose file to connect a backend created in nodejs using typeORM to manipulate and connect with a postgresql database, but always is getting error. It's working in separete containers but when I try to connect the typeORM using service name in docker-compose always returns connect ECONNREFUS...
I've started to use Vite to craete React project for the first time. I followed a 2023 tutorial video on youtube. I'm using macos. There were many projects in **Webapps** folder and I created a new folder for a Vite project where the directory structure was like this: Webapps |- project A |- project B |- ... ...
Is ++i an atomic (thread-safe) operation in C++. If so, which standard and compiler? Does this even exist somewhere? I couldn't find information about this on the Internet. atomic\<\> guarantees this. But if you do it without it. Usually ++i is not an atomic operation? Are they on all platforms, etc.
Atomic increment operation in C++?