input_text_instruct
stringlengths
288
45.8k
output_text
stringlengths
37
33.2k
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: need to save a global variables coming from the same function() in python()<p>I made a toy function where I would need to save certain values that are given ...
<p>Using global/nonlocal variables makes it difficult to keep the different lists straight, since they both share the same name in the same scope. You should instead initialize each array separately.</p> <p>Your example could be written much more simply (and correctly) as:</p> <pre><code>import numpy as np keep_1 = ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: geting input in one line array / list<p>How can I get an input like this in python3</p> <p>The first input is = 2 and based on this first input I want to get...
<p>The reason is that you're running a loop n times and in each iteration you are picking up a whole line of input. Thus, at the end <code>x</code> contains the latest input line. Instead you can read space separated input and store it into list directly.</p> <pre><code>n = int(input()) x = list(map(int,input().split()...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: OBIEE12C: NULL appearing as option in dashboard prompt choice list<p>I have a dashboard prompt with various fields to allow the client to filter the data by ...
<p>Your prompt is populated by a query. That query accesses the database. If your query returns a NULL and the query is the same in both environments that means that your database is the place where there's a difference.</p> <p>a) Grab the two queries from both environments b) Run both queries against their REPSECTIVE ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: The api I sent the request to works but returns an error<p><a href="https://i.stack.imgur.com/xlNTs.png" rel="nofollow noreferrer"><img src="https://i.stack....
<p>You have two issues here:</p> <ol> <li><p>You're passing options in the place where you should pass the request body. The signature is:</p> <p><code>post(url, body, options)</code></p> </li> <li><p>You're not requesting <code>text/plain</code> from the server, so you're leaving it up to the server what format you wa...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do you finish working with a git project?<p>I'm new to git and github and I'm struggling to figure out what's going on with git in cmd. I've just made lo...
<blockquote> <p>Is there a way to break the connection in cmd between the local repo and the GitHub repo? A proper way to 'close' it?</p> </blockquote> <p>You <em>can</em> break the connection between your local and the remote repository by using the <code>git remote remove</code> command, but you will not gain anythin...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to see failed lambda executions on datadog using lambda proxy integration<p>I am kind of new on datadog and was wondering how to show errors for lambda e...
<p>After chatting with datadog's team, they acknowledge that this was in fact a missing feature and create a PR on their github to include it on the 5.3.0 version of the plugin.</p> <p>You can find the PR details on: <a href="https://github.com/DataDog/datadog-lambda-python/pull/229" rel="nofollow noreferrer">https://g...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Passing ID to API react<p>I am trying to pass an id using useParam to an api call , when i console.log the id it will show correctly yet when it's in my api ...
<p>You need to tell which Id is i.e:</p> <pre><code>const { id: idDefault = '-1' } = useParams(); </code></pre> <p>Try to console vesselId and see what properties it has.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: VSCode intergrated terminal fails to execute command, but system terminal executes same command correctly<p>M1 Mac system terminal <code>firebase emulators:s...
<p>There was a bug with a setting in <code>settings.json</code>: <code>&quot;debug.javascript.autoAttachFilter&quot;: &quot;onlyWithFlag&quot;,</code> caused the error above.</p> <p>I found this by iteratively bisecting my settings (i.e. commenting out half at a time) until I found the one that broke the <code>firebase...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CSS Flex items not filling container<p>Struggling to get the flex items inside the calculator to fill the parent. Have been messing with so many declarations...
<p>Try this code. I just added <code>width: 100% and height: 100%</code>, and set height <code>20%</code> to <code>.screen</code> class element relative to <code>.calculator</code> class element. and, added <code>box-sizing: border-box</code> as universal style.</p> <p><div class="snippet" data-lang="js" data-hide="fal...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Extract rows from dataframe containing each label<p>In the example <code>dataframe</code> shown below, I have 5 labels (<code>class_name</code>). There are ...
<p>I think this should help. Sample the dataframe twice: Once using <code>groupby</code> to sample one row for each name, then sample from the rest of the dataframe randomly to complete the 80% training set.</p> <pre class="lang-py prettyprint-override"><code>TrainPercent = 0.8 # sample one row for each class_name (5 r...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: xcode-select: error: tool 'xcodebuild' requires Xcode<p>I am trying to migrate my Angular application from <a href="https://update.angular.io/?l=3&amp;v=4.4-...
<p>Found the solution to my problem finally :</p> <pre><code>sudo xcode-select -s /Applications/Xcode.app/Contents/Developer </code></pre> <p><a href="https://github.com/nodejs/node-gyp/issues/569#issuecomment-94917337" rel="nofollow noreferrer">Source</a></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ingress Resource file error AKS - spec.rules[0].http.paths[0].pathType: Required value: pathType must be specified<p>I am following MS documentation to creat...
<p><strong>I tried to reproduce creating ingress NGINX controller with the same code and got the same error</strong>:</p> <p><a href="https://i.stack.imgur.com/WNDJC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WNDJC.png" alt="image1" /></a></p> <p>To resolve the error &quot;<em><strong>spec.rules...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Copy URL from Spotify Playlist<p>I'm trying to make a GUI that takes your Spotify playlist, analyzes it and guesses your age. I'm looking thru their API tuto...
<p>Unless these playlists are public, no, they always will need to AUTH.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MATLAB numeric precision when generating a numeric sequence<p>I was testing a operation like this:</p> <pre><code>[input] 3.9/0.1 : 4.1/0.1 [output] 39 40...
<p>In <a href="https://stackoverflow.com/q/49377234/7328782">this Q&amp;A</a> I go into detail on how the colon operator works in MATLAB to create a range. But the detail that causes the issue described in this question is not covered there.</p> <p>That post includes the full code for a function that imitates exactly w...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: VS Code debugging prompting for arguments and also setting the working directory<p>I know how to pass fixed arguments in the launch.json, e.g. <a href="https...
<p>You can use <a href="https://code.visualstudio.com/docs/editor/variables-reference#_input-variables" rel="nofollow noreferrer">input variables</a></p> <pre class="lang-json prettyprint-override"><code>{ &quot;version&quot;: &quot;0.2.0&quot;, &quot;configurations&quot;: [ { &quot;name&quot;: &quot;Pyth...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create Dataframes based on array values<p>I have a dataset that spans over several years.</p> <pre><code># Import full dataset df_all = pd.read_csv('https:/...
<p>This is a way to do it, not sure if it is most efficient but hey it will do the job</p> <pre><code>for i in years: grouped_df = df_all[df_all.eq(i)].groupby([&quot;concelho&quot;]).sum() #Little redundant to groupby year grouped_df.to_csv(f'/content/drive/MyDrive/2022/DATAVIZ/dssg_{i}.csv') </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to prevent a double submit<p>I have the current code where with a button (OpenModal.jsx) the user open a modal where he can save data in a database, the ...
<p>Disable the button while the operation is processing. You can keep a <code>disabled</code> flag in state:</p> <pre><code>const [isDisabled, setIsDisabled] = useState(false); </code></pre> <p>And use it on the button:</p> <pre><code>&lt;button className=&quot;btn-save&quot; type=&quot;submit&quot; disabled={isDisabl...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Constructors as object keys<p>I'm trying to construct a map of types and callbacks so I started with an structure like this:</p> <pre class="lang-js prettypr...
<blockquote> <p>Given all of this, is using the constructors as object keys a reliable approach?</p> </blockquote> <p>No. As you said, an object's keys can only be strings or <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol" rel="nofollow noreferrer">Symbols</a>. A Symbol...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Custom Common Input Component - Validation Errors not working as expected<p>I am trying to write up a common input component for Material Angular, so I don't...
<p>The <code>mat-input</code> inside your <code>app-common-input</code> is not bound to any <code>FormControl</code>. You're working around it by binding <code>value</code>, <code>onChange</code> and <code>onTouched</code> events to the <code>&lt;input&gt;</code>, but none of that actually passes the information about ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Laravel - HTTP Session Flash Data dont work<p>The Laravel documentation:</p> <p>Sometimes you may wish to store items in the session for the next request. Yo...
<p>have you include the following namespace</p> <pre><code>use Session; </code></pre> <p>if not use 'Session' namespace</p> <p>you can also try another way</p> <pre><code>public function store(StorePost $request) { $validated = $request-&gt;validate(); $post = new Posts(); $post-&gt;title =...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Divide cells in selected range by another column value<p>I'm trying to write a code in Excel VBA that firstly will let user to select a range of values he wa...
<p>Sticking as far as possible with your own code, the following works are you requested:</p> <pre><code>Sub DivideRange() Dim r As Range Dim W As Range Dim i As Integer Dim target_col As Range Dim LFcount As Integer myTitle = &quot;divide range by a number&quot; Set W = Application.Sele...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to make modal window not close after refetch<p>Good day to all. My question is: is it possible to make the modal window not close after the refetch happe...
<p>By refetch you referring to Refresh of the browser? If so, I would suggest use some <a href="https://github.com/rt2zz/redux-persist" rel="nofollow noreferrer">redux-persist</a> or managing your own storage over <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage" rel="nofollow noreferrer">l...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Hashicorp Vault vs Azure Key Vault<p>I am trying to put together analysis/metrics around secret management tools available in cloud application development t...
<p><strong>Azure KeyVault</strong></p> <p>Azure Key Vault uses for key management it can easily generate and manage encryption keys for your data. This KV method mainly for secure safely and managing access to API keys, tokens, and other secrets.</p> <ul> <li>Key Vault offers the simplicity of changing passwords numero...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Refused to connect local ip address by using docker while running ok without docker<p>[Editted]</p> <p>I am trying to dockerize a simple flask project. I kep...
<p><code>127.0.0.1</code> is the <code>localhost</code> interface and when running inside the container only the container has access to it. To be accessible outside the container it should be the special IP <code>0.0.0.0</code> to bind all interfaces.</p> <h2>Solution 1</h2> <p>Change the host to be <code>0.0.0.0</cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Material UI - How to add multiple `actionIcons` to `ImageListItemBar`?<p>The Material UI documentation for <code>ImageList</code> <a href="https://mui.com/ma...
<p>The <code>actionIcon</code> prop on the <code>&lt;ImageListItemBar&gt;</code> component is a <code>node</code>, so you can put any valid JSX in there, and in your case making a simple container with multiple <code>&lt;IconButtons&gt;</code> should work:</p> <pre><code>actionIcon={ &lt;&gt; &lt;IconButton ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Use this as parameter name in javascript function definition<p>I saw a function definition like this in my learning vscode source code.</p> <pre class="lang-...
<p>Paraphrasing the <a href="https://www.typescriptlang.org/docs/handbook/2/functions.html#declaring-this-in-a-function" rel="nofollow noreferrer">typescript documentation on this</a></p> <blockquote> <h2>Declaring <code>this</code> in a Function</h2> <p>TypeScript will infer what <code>this</code> should be in a funct...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Adding items from list to the dictionaries in another list<p>I'm trying to add items from list to the dictionaries in another list.</p> <pre><code>info = [{'...
<p>If you nest the for cycles then only the last iteration of the first for matters.</p> <p>The correct way to do it is cycling in parallel over the two list, using the function <code>zip</code>.</p> <pre><code>info = [{'id' : 1, 'tag' : 'Football'}, {'id' : 2, 'tag' : 'MMA'}] dates = ['May 1st', 'April 23rd'] for item...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Scala spark data frame phone number validation<p>I want to perform some validation on column Phone number mentioned below and then update the &quot;Correct&q...
<pre class="lang-scala prettyprint-override"><code>val df = Seq[(String)](&quot;&quot;, &quot; &quot;, null, &quot;123456789a&quot;, &quot;1111111111&quot;, &quot;1.3-4567 80&quot;, &quot; 1.23-4567 890 &quot;, &quot;1234567890&quot;).toDF(&quot;PhoneNumber&quot;) val trimmed = regexp_replace(trim($&quot;PhoneNumber&...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to calculate with cummin() until condition is true<p>I want to calculate the minimum value until <code>cond</code> column is true</p> <p>Then recalculate...
<p>Calculate the reverse <code>cumsum</code> on <code>cond</code> to identify blocks of rows, then group the column <code>A</code> by these blocks and <code>transform</code> with <code>min</code> to calculate minimum value per block then mask the values and use <code>ffill</code> to propagate last min values in forward...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to cast to <CustomType> result of useFetch in Nuxt3<p>I want to cast result of useFetch to List</p> <pre><code>async getAllFiscalYear(): Promise&lt;Custo...
<pre><code>async getAllFiscalYear(): Promise&lt;CustomType&gt;[]&gt; { const { data } = await useFetch&lt;{ data: CustomType[] }&gt;('/api/list'); return data; }; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Install new apk after download by Download Manager and exit from running app<p>I have create android app using java. But i want upgrade my app without playst...
<p>After I search all day, i got the solution Thank you for comment my post :) <strong>This is my solution</strong> Add to manifest :</p> <pre><code>&lt;provider android:authorities=&quot;${applicationId}.provider&quot; android:name=&quot;androidx.core.content.FileProvider&quot; android:exported=&quot;false&qu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Gekko seems to ignore the single equation<p>I've been using <a href="https://github.com/BYU-PRISM/GEKKO" rel="nofollow noreferrer">Gekko</a> for the last thr...
<p>The error is with <code>model.Equation = (sum(wesg) == 1)</code> that redefines the <code>model.Equation</code> function as <code>False</code>. Use this instead:</p> <pre class="lang-py prettyprint-override"><code>model.Equation(sum(wesg) == 1) </code></pre> <p>The new result enforces the constraint to add to one wi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: starting wiremock as part of local development<p>I have a hello world micronaut application which starts locally and makes some calls to an external service....
<p>Have you tried instructions provided in <a href="https://github.com/tomakehurst/wiremock-jdk8-examples/" rel="nofollow noreferrer">https://github.com/tomakehurst/wiremock-jdk8-examples/</a> ?</p> <p>Add dependency:</p> <p><code> test &quot;com.github.tomakehurst:wiremock-jre8-standalone:2.33.2&quot;</code></p>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mutating ref value from watcher in Vue 3 with Composition API<p>I'm trying to mutate a ref within a watch function but it doesn't seem to work. I'm using wat...
<p>Since <code>selectedTitle</code> is ref try with</p> <pre><code>selectedTitle.value = tabTitles.value[0]; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Two different login system in Laravel 9<p>In my case, I will create a login system with two different users. a) Voters and b) Administrators. Where &quot;Vot...
<p>You need a multi guard authentication. Read this how to. It works with two tables. <a href="https://codecheef.org/article/laravel-9-multiple-authentication-example-using-guard" rel="nofollow noreferrer">https://codecheef.org/article/laravel-9-multiple-authentication-example-using-guard</a></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mongoose connection issue with .env used into access<p>I am unable to pass requests with postman, and the error message is the one being printed on console. ...
<p>It was due to not whitelisting m IP. If anyone has the same issue try it first. Go to mongodb and whitelist your IP in security -&gt; network connections</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CbPro python library giving invalid response<p>When i attempt to use the CBPro api it gives bad responses</p> <pre><code>import cbpro </code></pre> <p>Output...
<p>for me creating a separate instance of python on my desktop with all the right pip imports and files worked. I just copied the imports from my library folder and i put python 3.5.2 into a separate file folder and that worked completely perfect <a href="https://www.python.org/downloads/release/python-352/" rel="nofol...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to write pandas dataframe to a csv with varying row length<p>I've read in a csv in Pandas that has a variance in row values and some blank lines in betwe...
<p>A simple way would be to just parse your <code>out.csv</code> and for the non-blank lines (those consisting solely of <code>;</code>'s) - write a stripped version of that line, eg:</p> <pre><code>with open('out.csv') as fin, open('out2.csv', 'w') as fout: for line in fin: if stripped := line.strip(';\n '...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why the data base is not populated even after successful form rendering and submission of form in my django app?<p>I am beginner in django and making a simpl...
<p>Your <code>book_name</code> is not well processed, because you have comma inside <code>name</code> attribute:</p> <pre><code>placeholder=&quot;Enter Book Name&quot;,name=&quot;book_name&quot; </code></pre> <p>Another thing is form data in template is not the same that <code>BookForm</code> is expecting.</p> <p>To do...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Trust additional CAs and make use of the Android certificate store in a net6 MAUI solution<pre><code>System.Net.WebException: java.security.cert.CertPathVal...
<p>After this suggestion of Gerald, &quot;So you can still add a xml folder under Resources (under the Android folder that is)&quot;, I finally got it!</p> <p><a href="https://i.stack.imgur.com/zEtIs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zEtIs.png" alt="enter image description here" /></a><...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Sending data over UART from a buffer filled by DMA<p>I have an ADC set up with DMA to fill a buffer in circular mode. I've verified with the debugger that th...
<blockquote> <p>When looking at the received data using <code>screen /dev/ttyACM0 115200</code>, then converting to hex using vscode, this is what is received.</p> </blockquote> <p>Rather than perform an extra conversion step, suggest that you use a better tool such as <strong>minicom</strong>, which has a built-in hex...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas convert column where every cell is list of strings to list of integers<p>I have a dataframe with columns that has list of numbers as strings:</p> <pre...
<p>You can try</p> <pre class="lang-py prettyprint-override"><code>df['l'] = df['l'].apply(lambda lst: list(map(int, lst))) </code></pre> <pre><code>print(df) C1 C2 l 0 1 7 [5, 9, 1] 1 3 1 [7, 1, 6] </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Automating font color selection of specifc text in spreadsheets?<p>I have extracted data from a website and formatted it into a CSV, all with Python. My job ...
<p>You can do it using with &quot;xlsxwriter&quot; library. You can format parts of a string with XlsxWriter using <a href="https://xlsxwriter.readthedocs.io/worksheet.html#worksheet-write-rich-string" rel="nofollow noreferrer">write_rich_string()</a>.</p> <p>I am assuming you have already converted csv to dict. And yo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Where is kernel machine_desc table information?<p>I'm trying to understand how devicetrees work.</p> <p>According to the kernel documentation, they are used,...
<p>TL;DR - The machine description is built by building and linking different source files into the kernel. So each machine source file adds an entry into the table.</p> <hr /> <p>The table is based in <em>arch/arm/kernel/vmlinux.lds.S</em> (or relevant architecture linker file). It is built with the macros <code>MAC...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to initiate cores in parallel package of R<p>To initiate the cluster, it is advised to use below codes</p> <pre><code>library(parallel) cl &lt;- makeClus...
<p>The usual way to do this is:</p> <pre class="lang-r prettyprint-override"><code>num_cores &lt;- parallel::detectCores() # 8 in my case cluster &lt;- parallel::makeCluster(num_cores-1) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Typescript conditionally making a property optional<p>Suppose I have a type such as</p> <pre class="lang-js prettyprint-override"><code>interface Definition ...
<p>You can get that behaviour with this logic:</p> <pre><code>type ValueType&lt;T extends Record&lt;string, { optional: boolean }&gt;&gt; = ( { [K in keyof T]?: string } &amp; { [K in keyof T as T[K][&quot;optional&quot;] extends false ? K : never]-?: string } ) extends infer O ? { [K in keyof O]: O[K] } :...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I get a TextIO.instream from a POSIX file descriptor?<p>If I have a POSIX file descriptor of type <code>Posix.FileSys.file_desc</code>, how to I conve...
<p>This'll do the trick. It requires a &quot;name&quot; for the instream, which the <a href="https://smlfamily.github.io/Basis/posix-io.html#SIG:POSIX_IO.mkBinReader:VAL" rel="nofollow noreferrer">basis library claims</a> is used for error messages shown to the user. So I would recommend using the name or path of the u...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: packet socket not receiving data<p>I have the following C code that is supposed to await <strong>any</strong> packet on ethernet device <code>eth0</code>, in...
<p>In this line:</p> <pre><code>sll.sll_protocol = ETH_P_ALL; </code></pre> <p>you forgot to use <code>htons</code></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: start() method of QuarkusTestResourceLifecycleManager is not updating the system properties<p>In a setup as described in the <a href="https://quarkus.io/guid...
<p>The system properties mentioned in the javadoc is confusing. The returned map will as expected override the configurations.</p> <p>It was not working for me to access it with the <code>@ConfigProperty</code> annotation because I was reading the value in the constructor and not in the method annotated with <code>@Pos...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Storing 2^31 in an `int`<p>Looking at links such as <a href="https://stackoverflow.com/questions/589575/what-does-the-c-standard-state-the-size-of-int-long-t...
<blockquote> <p>a. Why can we store INT_MAX in an int variable, such as:</p> <p>int res=INT_MAX;</p> </blockquote> <p><code>INT_MAX</code> is the maximum value that can be store in <code>int</code>. Per definition that can be stored in an <code>int</code>.</p> <blockquote> <p>b. How is the code like below which calcula...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Limiting output of rows based on count of values in another table?<p>As a base example, I have a query that effectively produces a table with a list of value...
<p>You can use two window functions:</p> <ul> <li><code>COUNT</code> to keep track of the amount of ids for each category</li> <li><code>ROW_NUMBER</code> to uniquely identify each id within each category</li> </ul> <p>Once you have collected these information, it's sufficient to keep all those rows that satisfy either...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to enable authentication in MaxScale in MONGO for production?<p>We have a MariaBD version using MaxScale to use the NoSQL version using MongoDB driver.</...
<p>You can require authentication of clients by adding <a href="https://mariadb.com/kb/en/mariadb-maxscale-6-nosql-protocol-module/#enforce-authentication" rel="nofollow noreferrer"><code>nosqlprotocol.authentication_required=true</code></a> in the listener configuration.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Assertion for check string value include array of string<p>I create the class of book as below</p> <pre><code>public class book { public int id {get;set;}...
<p>If I understand correctly then you could use an extension method for this. Create a class with an <code>Assert</code> method in like this:</p> <pre><code>public static class Assertion { public static bool Assert(this List&lt;Book&gt; books, IEnumerable&lt;string&gt; expectedResults) { books = expecte...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to turn the Vega timeline example of the first five US Presidents into one of the first five Canadian Prime Ministers?<p><a href="https://vega.github.io/...
<p>To have unlimited terms for each president, have a dataset &quot;terms&quot; with each record being a president's term of office:</p> <pre><code> &quot;data&quot;: [ { &quot;name&quot;: &quot;people&quot;, &quot;values&quot;: [ {&quot;label&quot;: &quot;Washington&quot;, &quot;born&quot;: -7...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MYSQL delete from large table increase the delete time for each transaction<p>I am trying to delete data from table which contains almost 6,000,000,000 recor...
<p>You need to add an index to the column with which you are using to find the record(s) to be deleted.</p> <p>With an index, MySQL knows exactly where the records are to be found so it can go straight to the record(s).</p> <p>Without an index, then the table must be searched row by row.</p> <p>The difference is, witho...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why might HmsInstanceId.deleteToken and HmsInstanceId.getToken not work?<p>On some devices, <code>HmsInstanceId.deleteToken</code> throws &quot;com.huawei.hm...
<p><strong>Update:</strong></p> <p>Check whether the system version is earlier than EMUI 10.0.</p> <p>If the EMUI version of a Huawei device is <strong>earlier than 10.0</strong>, the token is returned through the onNewToken(String token, Bundle bundle) method. For details, kindly refer to <a href="https://developer.hu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: QSqlTableModel.insertRecord(row, record) not inserting at specified row<p>Using the answer provided <a href="https://stackoverflow.com/questions/63399234/how...
<p>Due to their nature, databases don't have the concept of insertion at a given index: records are always <em>appended</em>.</p> <p>The default <a href="https://doc.qt.io/qt-5/qsqltablemodel.html#editStrategy" rel="nofollow noreferrer"><code>editStrategy</code></a> (which dictates when the model actually submits chang...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to display a list of search results in Django 4<p>I'm writing a Django app to manage sales leads. From the template that lists a page of leads, I want to...
<p>Below is your url.py file</p> <pre><code>urlpatterns = [ path('', LeadsListView.as_view(), name='list'), path('&lt;int:pk&gt;/', LeadsDetailView.as_view(), name='detail'), path('', LeadsCreateView.as_view(), name='create'), path('', LeadsSearchResultsView.as_view(), name='search_results'), ] </code><...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: coordinating multiple outgoing requests in a reactive manner<p>this is more of a best practice question. in my current system (monolith), a single incoming h...
<p>You can drop the thread pool, you don't need it to invoke your backend services in parallel.</p> <p>Yes, the MP RestClient is reactive. Let's say you have this service which invokes a backend to get a comic villain:</p> <pre><code>@RegisterRestClient(configKey = &quot;villain-service&quot;) public interface VillainS...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Updating a variable in Python Schedule<p>With the python schedule, I am unable to feed the updated output back to the variable. Is there a smart way to achie...
<p>If you want to update a global, then you have to use the <code>global</code> statement. Right now, you set the global <code>x</code> once (to 10). The name <code>x</code> within your function is entirely local. And there's no point in returning anything.</p> <pre><code>@repeat(every(3).seconds) def yee(): glo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I add Control-A as a Hotkey to all EDITTEXT controls in a dialog box?<p>I have a bunch of dialog boxes created with <code>DialogBox()</code> from defi...
<p>Edit controls don't support <kbd>Ctrl</kbd>+<kbd>A</kbd> natively (even though they have this command in their context menu).</p> <p>If you want to add <kbd>Ctrl</kbd>+<kbd>A</kbd> handling to an edit control you can do it through sub-classing.</p> <p>For example,</p> <pre><code>LRESULT CALLBACK CtrlASubProc(HWND hW...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Sticky item content in RecyclerView<p>What is the best way to stick the content of a recyclerview items to the side of the screen. So that when the element g...
<p>Try this code in your view holder</p> <p>Kotlin</p> <pre><code>itemView.viewTreeObserver.addOnScrollChangedListener { val offset = -itemView.left.toFloat() YOUR_RED_VIEW.translationX = offset.coerceAtLeast(0f) //ELEVATION YOUR_RED_VIEW.translationZ = if (offset &lt; 0) 2f else 0f ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Default value with react-select, checkboxes not working when I want to post my data having a blank page output<p>I'm not able to put my fetch data as a defau...
<p>Here there should be the main problem:</p> <pre><code>&lt;Dropdown defaultValue={TASTE.find((t) =&gt; t.label === dish.taste)} /&gt; </code></pre> <p>With this defaultValue prop you are only setting the value once, when the dropdown renders. The <strong>dish.taste</strong> can not be defined at that time if you re...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: react fetch post takes too long<p>I am converting web service from Angular to React. Angular version I worked with was 6.0.x and nodejs version was 10.18.x. ...
<p>If there is anyone experiencing a similar problem, here is what I have found.</p> <p>When I was working with <strong>Node 10.18.x, mysql package 2.17.1</strong> and Angular, I inserted row by row in for-loop, and it worked without any problems.</p> <p>But now I am working with <strong>Node 12.16.2, mysql package 2.1...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Boto3 add security group to EC2 instance<p>I create instances like so:</p> <pre><code>client = boto3.client('ec2', region_name=&quot;eu-central-1&quot;) clie...
<p>You would add the parameter <code>SecurityGroupIds</code> if you want to add one or more by the ID or <code>SecurityGroups</code> if you want to add by the name of the security group. Both of these should be of type <code>list</code>.</p> <pre class="lang-py prettyprint-override"><code>client = boto3.client('ec2', r...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How Do I Generate RowId For Intermediate Group Rows?<p>I am working on implementing grouping w/ the Server Side Row Model. I need to generate an appropriate ...
<p>The columnApi exposes the 'getRowGroupColumns' function from which the field property can be deduced:</p> <pre><code>getRowId: ({ columnApi, data, level, parentKeys = [] }) =&gt; { const groupColumns = columnApi.getRowGroupColumns(); if (groupColumns.length &gt; level) { const field = groupColumns[level].get...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Problem with encryption/Decryption code written in Jmeter<p>I have written a code in beanshell for encryption and decryption in Jmeter but somehow its not wo...
<p><code>Encountered &quot;}&quot;</code> is a syntax error so double check your Beanshell script for eventual missing semicolons or closing brackets or whatever. You can use online lint tool like <a href="https://tio.run/#beanshell" rel="nofollow noreferrer">this one</a> to see where exactly the problem is</p> <p>In g...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP imap_open: SSL negotiation failed - only in docker<p>When opening an IMAP connection from PHP in a docker container, I get the following error:</p> <bloc...
<p>Managed to solve this by switching from a Debian image, to an Alpine image. I was able to connect to some other mail servers, just not to some specific ones. My guess is combination of a badly configured mail server and a bug in either Debian or some package.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Nuxtjs 3 - Cannot read properties of undefined using reactive()<p>I'm having a problem with a reactive() object, an error is generated when trying to use the...
<p>Resolved</p> <pre><code>let ruleForm = reactive&lt;FormInterface&gt;({endereco:{}}) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flutter iOS flutter_swipe_action_cell not updating UI after deleting cell<p>I have a <code>ListView</code> containing 5 elements in the following order:</p> ...
<p>I ended up figuring it out myself after several hours of trial and error. The <em>key</em> component here is literally <code>key</code>. I didn't realize the purpose of the key initially. It seems to be used to coordinate which cell is being deleted on the UI with its corresponding data. The <code>key</code> for eac...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R aggregate variable lengths differ error<p>Lots of questions on SO with similar titles, but I can't find any that match my circumstances or adapt them to re...
<p>I wouldn't use <code>noquote</code> and just concatenate the column names as strings and then change it to a formula.</p> <pre class="lang-r prettyprint-override"><code>cols.to.agg &lt;- colnames(df)[4:length(df)] grouping.col &lt;- colnames(df)[3] form &lt;- paste0('cbind(', paste(cols.to.agg, colla...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Changing variables, maps and lists in another class<p>I'm supposed to implement twistPlot.</p> <p>I tried:</p> <ol> <li><p>_friends.getMembers().put(&quot;Ph...
<p>Your step 1, 2, 3 looks correct. There's something wrong with the index in step 4.</p> <p>Initially, Pippi has two pets: Herr Nilsson and Kleiner Onkel. After <code>_pippi.getPets().remove(0);</code>, Pippi has only one pets now (<code>_pippi.getPets().size() == 1</code>), and &quot;Kleiner Onkel&quot; becomes the f...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to show another element with hover in Angular?<p>This is my <a href="https://stackblitz.com/edit/angular-stuoys?file=src%2Fapp%2Fapp.component.ts,src%2Fa...
<p>The main problem of your code are</p> <ol> <li>Wrong event name.</li> <li>The element doesn't rendered so you can't targeted the element.</li> </ol> <p>Here is simple solution for you, It might be other way to implement as well.</p> <p>Try this one, put on your <code>.ts</code> file of the component.</p> <pre><code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Counting hours in format H:mm in SQL<p>I have a column on hours looking like that:</p> <pre><code>|time| -------------- 8:54 5:32 4:34 7:12 12:55 10:32 3:54 ...
<p>what I did was a bit tricky but it worked:</p> <pre><code>WITH A AS ( SELECT cast(substring(hours, 1, len(hours) -3) as INT) as TIME FROM your_table ) SELECT count(*) as MORE_THAN_5_HOURS FROM A WHERE TIME &gt;= 5 </code></pre> <p>you remove the last 3 letters of the text you have as hou...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: XML data display in grid using kibana and logstash<p>I wanted to display XML data using logstash and Kibana in grid format. using below conf file I am able t...
<p>xpath will always return arrays, to associate the members of the two arrays you are going to need to use a ruby filter. To get multiple events you can use a split filter to split an array which you build in the ruby filter. If you start with</p> <pre><code>&lt;stations&gt; &lt;station&gt; &lt;id&gt;1&lt;/id&gt; &...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kubernetes Failed to create object: Namespace is required for v1.Endpoints<p>I'm currently trying to setup heketi on kubernetes, i need to create an endpoin...
<p>An <code>Endpoints</code> resource (like a <code>Pod</code>, <code>Service</code>, <code>Deployment</code>, etc) is a <em>namespaced</em> resource: it cannot be created globally; it must be created inside a specific <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/" rel="nofollow...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: AWS Athena: Right function<p>I would like to use the function <code>right</code> from AWS athena, but it does not seem to be supported.</p> <p>How would I go...
<p>Athena uses Presto as SQL engine and it <a href="https://prestodb.io/docs/current/functions/string.html" rel="nofollow noreferrer">does not have</a> <code>right</code> function, but you can mimic it using <code>substr</code> and determining the staring position <code>greatest(length(str) - 3, 1)</code> - we need to ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Follow tree structure of sql database with python<p>I have a database with structure like this:</p> <div class="s-table-container"> <table class="s-table"> <...
<p>You could extract the contents of your database as a flat table like this, then cycle over the records to build a <code>graph</code> in a module like <a href="https://networkx.org/" rel="nofollow noreferrer">NetworkX</a></p> <p>In the below, I setup a pandas dataframe to host the data, but for you, you'd need to dea...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: multiple records with A certificate in route53<p>I have a custom domain setup in route53 and using rout53 as domain service provider. I have a static page ho...
<p>No, you can't do it this way. A DNS name can only resolve to one thing.</p> <p>Instead, you could create a subdomain so that:</p> <ul> <li><code>xyz.com</code> --&gt; Amazon S3 bucket</li> <li><code>products.xyz.com</code> --&gt; API Gateway</li> </ul> <p>You could pass the <code>productId</code> as a parameter (eg ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I make Visual Studio Code auto format the code?<p>How can I make <strong>Visual Studio Code</strong> auto format to adequately render my methods and ...
<p>You can press <code>Control + Shift + P</code> or <code>Command + Shift + P</code> (Mac) to open the command palette and type &quot;settings&quot; and then select &quot;Preferences: Open User Settings&quot; option. Search for &quot;format on save&quot; setting and check the checkbox. Whenever you save your file, it ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I am adding an ImageView in android app in android studio. The image size is 1.93MB. When I am running the AVD, app is getting closed due to an error<p>This ...
<p>That isn't a 1.93 MB image. That's a 110MB image. The compressed size of the file isn't what matters, its the uncompressed size- which is <code>4*width*height</code>.</p> <p>Why is your image so large, in terms of width and height? That's over 5300x5300. You need a smaller image. Reducing the quality wouldn't ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to setup Teams' URL Preview Service for GitLab authentication?<p>We use Teams in our development team and we paste links to GitLab to request ...
<p>This doesn't seems to be possible to give Teams credentials so we can see a preview of the content because <strong>Teams loads a preview with no session details.</strong></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What's wrong with this multiplication table printing code (it's working, this is job interview question)?<pre><code>public static void Main() { int i, j;...
<p>This question might be better asked here: <a href="https://codereview.stackexchange.com/">Code review</a></p> <ul> <li>Correctness: it behaves correctly</li> <li>Readability: simple program, not too bad</li> <li>Efficiency: not too bad either</li> <li>Flexibility: poor - I suggest implementing a more generalized met...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: No Hidden Layer Neural Network Doesn't Equal Logistic Regression<p>In theory, a no-hidden layer neural network should be the same as a logistic regression, h...
<p>A simple way to determine if this is actually a bug is to let the number of epochs in your perceptron go to some arbitrary large number (say, 5000). You'll note that the decision boundary approaches that of your logistic regression model.</p> <p>The natural question is why LR needs fewer iterations to achieve a near...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to scrape google map in python without using selenium and any api?<p>Scrape google map using only requests and 'bs4' library.</p> <p>I dont want any sugg...
<p>Using just requests and bs4 is hard but possible. Not entirely sure what information you are trying to parse, but this should help you:</p> <pre class="lang-py prettyprint-override"><code>import requests, lxml, re, json from bs4 import BeautifulSoup headers = { &quot;User-Agent&quot;: &quot;Mozilla/5.0 (Windows...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: finding consecutive numbers in a matrix with python numpy<p><a href="https://i.stack.imgur.com/YiuAV.png" rel="nofollow noreferrer"><img src="https://i.stack...
<p>Here is a naive approach to check whether each row/column of a given matrix has a given amount (4 in this case) of consecutive numbers:</p> <pre class="lang-py prettyprint-override"><code> import numpy as np def has_consecutive_number(M, num_consecutive=4): for v in np.vstack((M, M.T)): # You need to check bot...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas Pct Change Between 2 Columns, Replacing Original<p>(I think) I'm looking to apply a <code>transform</code> to a column, by finding the % change when c...
<p>Subtract column <code>A</code> from the dataframe then divide by column <code>A</code> to calculate pct_change:</p> <pre><code>df.sub(df['A'], axis=0).div(df['A'], axis=0) </code></pre> <p>The above expression can be further simplied to:</p> <pre><code>df.div(df['A'], axis=0).sub(1) </code></pre> <hr /> <pre><code> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Remove Pandas rows that contain approximate string matches<p>I want to remove rows from a Pandas dataframe that have the same value in column A and are an ap...
<p>I would suggest looking into using Levenshtein distance. I believe there is a Python library for calculating this.</p> <p><a href="https://pypi.org/project/python-Levenshtein/" rel="nofollow noreferrer">https://pypi.org/project/python-Levenshtein/</a></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I use imagejpeg() with $_FILES["file"]["tmp_name"]<p>My TensorFlow project only accepts JPEG because that is what I trained it on. I use a PHP image u...
<p>Because a common way to handle temporary files is to create the file, open it, and then unlink/delete it without closing the handle. This gives you the ability to use disk while ensuring that the files are deleted/unlinked when the process ends. That is what is happening, why <code>move_uploaded_file()</code> exists...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Extract date and time from text in GoogleSheets<p>I am trying to separate the date and time alone from the text <code>Reported By: Name 1 16/2/2021 9:44 A...
<p><strong>Option 01</strong> Extract Date and time <em>Only</em><br> Try this in <code>C2</code>, to get time and date extracted to their cells in one go, take a look at <a href="https://docs.google.com/spreadsheets/d/1oBWu_KSD_lE2YchAsLws6T3rzgOYlRK_djGq3_Bp0zs/edit?usp=sharing" rel="nofollow noreferrer">This Sheet</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Trying to return multiple values in output<p>I'm trying to get running hours on an EC2 tagged instance with (Tag-periods - active) in an sns email notificati...
<p>In this block:</p> <pre><code> for x in active: if str(timeDiff)&gt;='08.0': response = sns.publish( TopicArn='arn:aws:sns:ap-south-1:123456789:SNS-Notification', Message='Current Active Instances ' + active, ) return response </code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I get this to work : "WorkersText = GameObject.FindGameObjectWithTag("Workers");"<p>I have a text object in my game called WorkersText. I am creating...
<p>You get <code>GameObject</code> as a result and obviously cannot assign it to the <code>Text</code> type variable. That is what error is about. Add <code>GetComponent&lt;Text&gt;()</code> to the object returned. If it has such a component - you will get your <code>Text</code> to assign.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: sh: 1: Syntax error: Unterminated quoted string\n<p>I am making an online judge in django frame work I am trying to run a c++ program inside a docker contain...
<p><code>subprocess.call(shell=True)</code> has some significant security problems and I'd avoid it whenever possible. It opens your application to a <em>shell injection attack</em>. You're actually seeing this in your code: if the string in <code>problem_testcase.input</code> contains any characters that are meaning...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Saving some data in Kotlin fragments<p>I have 2 fragments, first(start_fragment) should shows when app starts and have 2 buttons, 1 which close app(declineBu...
<p>You can use <a href="https://developer.android.com/training/data-storage/shared-preferences" rel="nofollow noreferrer">sharedPreferences</a> for keep small data.</p> <p>In MainActivity</p> <pre><code>val sharedPref = activity?.getPreferences(Context.MODE_PRIVATE) ?: return val firstLaunch = sharedPref.getBoolean(&qu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: mongoose add a field to a document from another document<p>I want to get categories by limit, offset, orderBy viewers from VideoSchema</p> <pre class="lang-j...
<p>If I understand correctly, you want for each <code>category</code>, to add the sum of <code>viewers</code> from the relevant <code>videos</code>, sort and slice.</p> <p>On mongoDB you can easily do it all in one query. Since you want to get categories with 0 viewers as well, we will start from the <code>category</co...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to avoid cycles when introducing FOREIGN KEY constraint in a table?<p>I'm using <strong>code-first</strong> approach with <strong>EF Core 6</strong> to c...
<p>you need to add some extra config like this :</p> <pre><code> protected override void OnModelCreating(ModelBuilder mb) { var pmConfig = mb.Entity&lt;PmDataSet&gt;(); pmConfig.HasOne(n =&gt; n.Equipment).WithMany(n =&gt; n.PmDataSets).OnDelete(DeleteBehavior.NoAction); } </code></pre> <p>the problem is ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: positioning several background layers<p>I have a div container that takes up 100% of the width of the browser window. The height of the container changes wit...
<p>The background image set at 50% will be centered (so part of it is hidden under the first background image).</p> <p>This snippet positions the second background image to the right and the first to the left.</p> <p>[This snippet uses linear-gradients as images just to prove that it works OK].</p> <p><div class="snipp...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calibrate Donkey Car via raspberrypi4 with l298n motor (* no 16 channel servo driver )<p>So I am building a donkey car in raspberry pi 4 2gb. I have installe...
<p>This question is probably best asked in the <a href="https://robotics.stackexchange.com/">robotics stackexchange</a> or the <a href="https://www.donkeycar.com/community.html" rel="nofollow noreferrer">donkeycar discord</a>. But to answer your question, a differential drive robot (you've chosen the DC_TWO_WHEEL_L298...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unable to validate form using js<p>I am trying to validate a form by seeing if all the inputs are filled. So here when either email or password are empty, it...
<p>You should access the value of DOM elements by <strong>DOM Methods</strong> like <code>document.getElementById()</code>, <code>document.querySelector()</code>, <code>document.getElementsByClassName()</code>, <code>document.querySelectorAll()</code> etc.</p> <p>You can do the validation in two ways:</p> <ol> <li>With...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to explain the output of this Dart code - List of List<int><p>Does anyone agree that the output of this code is surprising?</p> <p>If so, can anyone expl...
<blockquote> <p><code>shared[0]</code> has type <code>List&lt;int&gt;</code> so add performed on <code>shared[0]</code> should have no effect on <code>shared[1]</code>.</p> </blockquote> <p>The fact that <code>shared[0]</code> is <code>List&lt;int&gt;</code> is orthogonal to the fact that <code>shared[0]</code> and <co...