qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
74,244,099
<p>I'm a big fan of <code>git worktree</code> command. My project directory contains a number of folders which points to branches which I'm working on at the moment.</p> <pre class="lang-bash prettyprint-override"><code>.../project directory ├── bugfix │   ├── IBD-15 │   ├── IBD-17 │   ├── IBD-18 │   ├── IBD-21 │   ├── IBD-22 │   └── IBD-23 ... ├── main └── story ├── logs └── IBD-7 X directories </code></pre> <p>Over a time I close a <strong>feature</strong> via merge request using CI instruments (CI automatically deletes a remote branch). But <strong>feature branch</strong> keeps alive in the project folder and I need periodically watch through the list of closed features and manually remove the folders which points to non-existent branches on remote:</p> <pre class="lang-bash prettyprint-override"><code>$ rm -rf bugfix/IBD-15 $ rm -rf bugfix/IBD-23 ... $ git worktree prune </code></pre> <p>So is there a way to get rid <strong>worktree folders</strong> for <strong>branches</strong> which don't exist anymore on <strong>remote</strong> (of course if the 'worktree' folder doesn't contain not pushed commits or untracked local changes) ?</p>
[ { "answer_id": 74244239, "author": "Remy Lebeau", "author_id": 65863, "author_profile": "https://Stackoverflow.com/users/65863", "pm_score": 3, "selected": true, "text": "insert()" }, { "answer_id": 74244297, "author": "Ankur Dahiya", "author_id": 19084200, "author_pr...
2022/10/29
[ "https://Stackoverflow.com/questions/74244099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2892357/" ]
74,244,120
<p>iam trying to write merge sort but its not working why here when i run this code it's not splitting all the list and it is just repeating this form</p> <pre><code>ID_list=[5,8,9] def merge_sort(Id_list): #define middle middle_index=len(ID_list)//2 #split array into two parts (copies: left and right) left=ID_list[:middle_index] right=ID_list[middle_index:] #call merge sort for left print(left) print(right) merge_sort(left) #call merge sort for right merge_sort(right) merge_sort(ID_list) the output is below: [5] [8, 9] [5] [8, 9] [5] [8, 9] [5] [8, 9] Recursion Error: maximum recursion depth exceeded while calling a Python object what i need to have [5] [8] [9] </code></pre>
[ { "answer_id": 74244239, "author": "Remy Lebeau", "author_id": 65863, "author_profile": "https://Stackoverflow.com/users/65863", "pm_score": 3, "selected": true, "text": "insert()" }, { "answer_id": 74244297, "author": "Ankur Dahiya", "author_id": 19084200, "author_pr...
2022/10/29
[ "https://Stackoverflow.com/questions/74244120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20320212/" ]
74,244,134
<p>I have that method <code>valorMaxim([1, 5, 252, 24, 7, 82, 3])</code> returns 252. I don't know how to do it. I have been thinking if I could decrease the array length.</p> <pre class="lang-java prettyprint-override"><code>public static int valorMaxim(int arr[]){ int max; if(arr.length==1) return arr[0]; for (int i = 0; i &lt; arr.length; i++) { if (arr[i] &lt; arr[i+1]) { max=arr[i+1]; return arr[i+1]; } } return valorMaxim(arr); //Retorna el valor màxim en un array no buit d’enters. } </code></pre>
[ { "answer_id": 74244247, "author": "Abra", "author_id": 2164365, "author_profile": "https://Stackoverflow.com/users/2164365", "pm_score": 2, "selected": false, "text": "public class Main {\n\n public static int valorMaxim(int arr[]){\n if (arr.length == 1) {\n return...
2022/10/29
[ "https://Stackoverflow.com/questions/74244134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19111628/" ]
74,244,146
<p>I'm having an issue in my form. Every time I press a key to add a character in the input (I took the lastname example but I get the same error for each of them) I get this error.</p> <p><a href="https://i.stack.imgur.com/IAmHN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IAmHN.png" alt="Vue warn" /></a></p> <p><a href="https://i.stack.imgur.com/0UOCu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0UOCu.png" alt="Uncaught TypeError" /></a></p> <p>Form is working but anyway I would like to clean these errors. I've been trying my myself but I don't see what is wrong.</p> <p>Here is the part of my code the error is refering to:</p> <pre><code> const resetError = (field) =&gt; { validationErrors.value.contactForm[field] = null; }; </code></pre> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>const contactData = reactive({ lastname: null, firstname: null, email: null, textarea: null, }); const resetError = (field) =&gt; { validationErrors.value.contactForm[field] = null; }; const active = ref(false); const loading = ref(false); const submitContact = async (event) =&gt; { try { validationErrors.value["contactForm"] = {}; const isValid = await validateData( "contactForm", contactSchema, contactData ); if (!isValid) return; loading.value = true; await airtableStore.fetchAirtablePortfolio(contactData); loading.value = false; toggleModal(true); event.target.reset(); } catch (error) { console.error(error); } };</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form @submit.prevent="submitContact"&gt; &lt;form-input-molecule label="Nom:" id="lastname" name="lastname" v-model="contactData.lastname" placeholder="Doe" @input="resetError('lastname')" :error-message="validationErrors.contactForm?.lastname" &gt;&lt;/form-input-molecule&gt; &lt;button-atom type="submit" :disabled="loading" :active="active" &gt;Envoyer&lt;/button-atom&gt; &lt;/form&gt;</code></pre> </div> </div> </p>
[ { "answer_id": 74245243, "author": "Nikola Gava", "author_id": 19656174, "author_profile": "https://Stackoverflow.com/users/19656174", "pm_score": 1, "selected": false, "text": "const contactData = reactive({\n lastname: '',\n firstname: '',\n email: '',\n textarea: '',\n});\n" }, ...
2022/10/29
[ "https://Stackoverflow.com/questions/74244146", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19368163/" ]
74,244,178
<p>I would like to instantiate the project.toml that's build in in a Pluto notebook with the native package manager. How do I read it from the notebook?</p> <p>Say, I have a notebook, e.g.,</p> <pre><code>nb_source = &quot;https://raw.githubusercontent.com/fonsp/Pluto.jl/main/sample/Interactivity.jl&quot; </code></pre> <p>How can I create a temporary environment, and get the packages for the project of this notebook? In particular, how do I complete the following code?</p> <pre><code>cd(mktempdir()) import Pkg; Pkg.activate(&quot;.&quot;) import Pluto, Pkg nb = download(nb_source, &quot;.&quot;) ### Some code using Pluto's build in package manager ### to read the Project.toml from nb --&gt; nb_project_toml cp(nb_project_toml, &quot;./Project.toml&quot;, force=true) Pkg.instantiate(&quot;.&quot;) </code></pre>
[ { "answer_id": 74252951, "author": "HenrikWolf", "author_id": 6136427, "author_profile": "https://Stackoverflow.com/users/6136427", "pm_score": 2, "selected": true, "text": "# ╔═╡ 00000000-0000-0000-0000-000000000001\nPLUTO_PROJECT_TOML_CONTENTS = \"\"\"\n[deps]\nPlots = \"91a5bcdd-55d7-...
2022/10/29
[ "https://Stackoverflow.com/questions/74244178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15412096/" ]
74,244,197
<p>I would like to write a variadic template function that takes an arbitrary number of containers of any type (though realistically I will only use it for vectors I would say), and return <code>true</code> if they all have the same <code>size</code> (so <code>.size()</code> method or <code>std::size</code> (same thing)). I tried to implement this using my own understanding of template programming but I failed. I tried to use a set of recursive functions to this end but without luck, it's clear to me that the wrong functions are being chosen by the compiler.</p> <h1>My implementation attempt, with reasoning</h1> <p>This is the function that I would like to be called first, and is the entry point. I have two arguments, one normal template argument and another as a parameter pack. This is so I can separate the &quot;head&quot; from the &quot;tail&quot; (which I am used to with car and cdr from lisp, maybe this is the wrong paradigm here though).</p> <pre><code>template &lt;typename Arg, typename... Args&gt; bool all_equal_in_size(Arg arg, Args... args) { auto size = arg.size(); return (size == all_equal_in_size(size, args...)); } </code></pre> <p>This should be the function called recursively, same as above but with the state (size) provided additionally in the parameter list. This is also familiar to me from functional programming, as a means to propagate state through a recursive call chain.</p> <pre><code>template &lt;typename Arg, typename... Args&gt; bool all_equal_in_size(std::size_t n, Arg arg, Args... args) { return ((n == arg.size()) &amp;&amp; all_equal_in_size(args...)); } </code></pre> <p>This is simply the terminal condition, and ends the recursive call chain.</p> <pre><code>template &lt;typename T&gt; bool all_equal_in_size(unsigned long n, T ele) { return (n == ele.size()); } </code></pre> <h2>The Problem</h2> <p>So in essence I would like to use it like this (sorry if ctor args are wrong, point is I want some containers with length 5):</p> <pre><code>std::vector&lt;int&gt; v1(5); std::vector&lt;int&gt; v2(5); std::vector&lt;float&gt; v3(5); std::vector&lt;double&gt; v4(5); std::list&lt;int&gt; v5(5); all_of_equal_size(v1, v2, v3, v4, v5); // == true </code></pre> <p>But when I try to do this I find that the compiler complains because the wrong functions are found:</p> <pre><code>bunch.hpp:13:24: error: member reference base type 'unsigned long' is not a structure or union auto size = arg.size(); </code></pre> <p>It's trying to call <code>size</code> on a long, which I don't want. If I reorder the template definitions then I get even more scary compiler warnings. So where am I going wrong? Is there a simpler way to do this? Why is it picking the wrong template?</p> <p>Thank you for reading.</p>
[ { "answer_id": 74244464, "author": "joergbrech", "author_id": 12173376, "author_profile": "https://Stackoverflow.com/users/12173376", "pm_score": 2, "selected": false, "text": "template <typename Arg, typename... Args>\nbool all_equal_in_size(Arg const& head, Args const&... tail){\n r...
2022/10/29
[ "https://Stackoverflow.com/questions/74244197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2872466/" ]
74,244,208
<p>I have a string from which I would like to remove the HTML tags.</p> <blockquote> <p>&quot;overview&quot;:&quot;\u003cp style=\&quot;margin: 0px 0px 20px; padding: 0px; line-height: 20px; outline: none !important; min-height: 1em; color: #333333; font-family: Arial, Helvetica, sans-serif, emoji; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; text-align: center;\&quot;\u003e\u003cspan style=\&quot;font-family: arial, helvetica, sans-serif;\&quot;\u003e\u003cstrong\u003e\u003cspan style=\&quot;font-size: 18pt; outline: none !important;\&quot;\u003eWTS/VDI macOS\u003c/span\u003e\u003c/strong\u003e\u003c/span\u003e\u003c/p\u003e\n\u003chr\u003e\n\u003cp\u003e\u003cspan ......</p> </blockquote> <p>I would like to just have</p> <blockquote> <p>&quot;overview&quot;:&quot;WTS/VDI macOS.....</p> </blockquote> <p>I tried with BeautifulSoap and Python Bleach, but it only recognizes if the tags are written in '&lt;' and '&gt;' format. Is there a library or any function which removes this for me? Or should I convert the unicode characters and do it manually?</p>
[ { "answer_id": 74244464, "author": "joergbrech", "author_id": 12173376, "author_profile": "https://Stackoverflow.com/users/12173376", "pm_score": 2, "selected": false, "text": "template <typename Arg, typename... Args>\nbool all_equal_in_size(Arg const& head, Args const&... tail){\n r...
2022/10/29
[ "https://Stackoverflow.com/questions/74244208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3152686/" ]
74,244,211
<p>there is situation in which when user search a keyword, the result will be 3 queries</p> <pre><code>a=model.objects.filter(icontains=keyword[0]) b= a.filter(icontains=keyword) c= a.filter(istartswith=keyword) </code></pre> <p>And I want to return a result which combines a, b &amp; c. But the condition is the order should be c,b,a and elements should not be repeated. I tried using union but the order is not correct.</p>
[ { "answer_id": 74244464, "author": "joergbrech", "author_id": 12173376, "author_profile": "https://Stackoverflow.com/users/12173376", "pm_score": 2, "selected": false, "text": "template <typename Arg, typename... Args>\nbool all_equal_in_size(Arg const& head, Args const&... tail){\n r...
2022/10/29
[ "https://Stackoverflow.com/questions/74244211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18249027/" ]
74,244,228
<p>So this contact form used to work, however now it loads and says mail sent when someone clicks submit but I never get any emails, what am I missing out?</p> <pre><code>&lt;?php // Replace this with your own email address $siteOwnersEmail = 'email@domain.com'; if($_POST) { $name = trim(stripslashes($_POST['contactName'])); $email = trim(stripslashes($_POST['contactEmail'])); $subject = trim(stripslashes($_POST['contactSubject'])); $contact_message = trim(stripslashes($_POST['contactMessage'])); // Check Name if (strlen($name) &lt; 2) { $error['name'] = &quot;Please enter your name.&quot;; } // Check Email if (!preg_match('/^[a-z0-9&amp;\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*+[a-z]{2}/is', $email)) { $error['email'] = &quot;Please enter a valid email address.&quot;; } // Check Message if (strlen($contact_message) &lt; 15) { $error['message'] = &quot;Please enter your message. It should have at least 15 characters.&quot;; } // Subject if ($subject == '') { $subject = &quot;Contact Form Submission&quot;; } // Set Message $message .= &quot;Email from: &quot; . $name . &quot;&lt;br /&gt;&quot;; $message .= &quot;Email address: &quot; . $email . &quot;&lt;br /&gt;&quot;; $message .= &quot;Message: &lt;br /&gt;&quot;; $message .= $contact_message; $message .= &quot;&lt;br /&gt; ----- &lt;br /&gt; This email was sent from your site's contact form. &lt;br /&gt;&quot;; // Set From: header $from = $name . &quot; &lt;&quot; . $email . &quot;&gt;&quot;; // Email Headers $headers = &quot;From: &quot; . $from . &quot;\r\n&quot;; $headers .= &quot;Reply-To: &quot;. $email . &quot;\r\n&quot;; $headers .= &quot;MIME-Version: 1.0\r\n&quot;; $headers .= &quot;Content-Type: text/html; charset=ISO-8859-1\r\n&quot;; if (!$error) { ini_set(&quot;sendmail_from&quot;, $siteOwnersEmail); // for windows server $mail = mail($siteOwnersEmail, $subject, $message, $headers); if ($mail) { echo &quot;OK&quot;; } else { echo &quot;Something went wrong. Please try again.&quot;; } } # end if - no validation error else { $response = (isset($error['name'])) ? $error['name'] . &quot;&lt;br /&gt; \n&quot; : null; $response .= (isset($error['email'])) ? $error['email'] . &quot;&lt;br /&gt; \n&quot; : null; $response .= (isset($error['message'])) ? $error['message'] . &quot;&lt;br /&gt;&quot; : null; echo $response; } # end if - there was a validation error } ?&gt; </code></pre> <p>And this is the contact form:</p> <pre><code>&lt;form name=&quot;contactForm&quot; id=&quot;contactForm&quot; method=&quot;post&quot; action=&quot;mail/mail.php&quot;&gt; &lt;fieldset&gt; &lt;div class=&quot;form-field&quot;&gt; &lt;input name=&quot;contactName&quot; type=&quot;text&quot; id=&quot;contactName&quot; placeholder=&quot;Name&quot; value=&quot;&quot; minlength=&quot;2&quot; required=&quot;&quot;&gt; &lt;/div&gt; &lt;div class=&quot;form-field&quot;&gt; &lt;input name=&quot;contactEmail&quot; type=&quot;email&quot; id=&quot;contactEmail&quot; placeholder=&quot;Email&quot; value=&quot;&quot; required=&quot;&quot;&gt; &lt;/div&gt; &lt;div class=&quot;form-field&quot;&gt; &lt;input name=&quot;contactSubject&quot; type=&quot;text&quot; id=&quot;contactSubject&quot; placeholder=&quot;Subject&quot; value=&quot;&quot;&gt; &lt;/div&gt; &lt;div class=&quot;form-field&quot;&gt; &lt;textarea name=&quot;contactMessage&quot; id=&quot;contactMessage&quot; placeholder=&quot;message&quot; rows=&quot;10&quot; cols=&quot;50&quot; required=&quot;&quot;&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;div class=&quot;form-field&quot;&gt; &lt;button type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;send&quot;class=&quot;submitform&quot;&gt;Submit&lt;/button&gt; &lt;div id=&quot;submit-loader&quot;&gt; &lt;div class=&quot;text-loader&quot;&gt;Sending...&lt;/div&gt; &lt;div class=&quot;s-loader&quot;&gt; &lt;div class=&quot;bounce1&quot;&gt;&lt;/div&gt; &lt;div class=&quot;bounce2&quot;&gt;&lt;/div&gt; &lt;div class=&quot;bounce3&quot;&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre> <p>All the messages work, am I missing out on some SMPT information or something? Are there any alternatives to using phpmailer for this job?</p>
[ { "answer_id": 74244464, "author": "joergbrech", "author_id": 12173376, "author_profile": "https://Stackoverflow.com/users/12173376", "pm_score": 2, "selected": false, "text": "template <typename Arg, typename... Args>\nbool all_equal_in_size(Arg const& head, Args const&... tail){\n r...
2022/10/29
[ "https://Stackoverflow.com/questions/74244228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18331597/" ]
74,244,256
<p>I am use next-auth for authorization in next project and use typescript, when I assign 'jwt' to strategy, a warn for type error occur: Type 'string' is not assignable to type 'SessionStrategy | undefined'.</p> <p>my code:</p> <pre><code> session: { strategy: 'jwt', }, </code></pre> <p>type code: these type are all the official type, no declare by myself</p> <pre><code>export interface NextAuthOptions { ... session?: Partial&lt;SessionOptions&gt;; ... } </code></pre> <pre><code>type Partial&lt;T&gt; = { [P in keyof T]?: T[P] | undefined; } </code></pre> <pre><code>export interface SessionOptions { ... strategy: SessionStrategy; ... } </code></pre> <pre><code>export declare type SessionStrategy = &quot;jwt&quot; | &quot;database&quot;; </code></pre> <p><a href="https://i.stack.imgur.com/rdN1k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rdN1k.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74249850, "author": "Eric Haynes", "author_id": 1057157, "author_profile": "https://Stackoverflow.com/users/1057157", "pm_score": 3, "selected": true, "text": "export const authOptions: NextAuthOptions = {\n" }, { "answer_id": 74249996, "author": "6899 huge", ...
2022/10/29
[ "https://Stackoverflow.com/questions/74244256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11424751/" ]
74,244,276
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form id="signup"&gt; &lt;div class="row"&gt; &lt;div class="col-xs-12 col-sm-6"&gt; &lt;div class="form-group"&gt; &lt;input type="text" class="form-control" id="first_name" placeholder="First Name" required data-validation-required-message="Please enter your name." autocomplete="off"&gt; &lt;p class="help-block text-danger"&gt;&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col-xs-12 col-sm-6"&gt; &lt;div class="form-group"&gt; &lt;input type="text" class="form-control" id="last_name" placeholder="Last Name" required data-validation-required-message="Please enter your name." autocomplete="off"&gt; &lt;p class="help-block text-danger"&gt;&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input type="email" class="form-control" id="email" placeholder="Your Email" required data-validation-required-message="Please enter your email address." autocomplete="off"&gt; &lt;p class="help-block text-danger"&gt;&lt;/p&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input type="tel" class="form-control" id="phone" placeholder="Your Phone" required data-validation-required-message="Please enter your phone number." autocomplete="off"&gt; &lt;p class="help-block text-danger"&gt;&lt;/p&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input type="addr" class="form-control" id="address" placeholder="Address" required data-validation-required-message="Please enter your phone number." autocomplete="off"&gt; &lt;p class="help-block text-danger"&gt;&lt;/p&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input type="password" class="form-control" id="password" placeholder="Password" required data-validation-required-message="Please enter your password" autocomplete="off"&gt; &lt;p class="help-block text-danger"&gt;&lt;/p&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input type="password" class="form-control" id="password" placeholder="Confirm Password" required data-validation-required-message="Please enter your password" autocomplete="off"&gt; &lt;p class="help-block text-danger"&gt;&lt;/p&gt; &lt;/div&gt; &lt;div class="mrgn-30-top"&gt; &lt;button type="submit" class="btn btn-larger btn-block" onclick="rdt()"&gt; Sign up as customer &lt;/button&gt; &lt;/div&gt; &lt;div class="mrgn-30-top"&gt; &lt;button type="submit" class="btn btn-larger btn-block"&gt; Sign up as Shop Owner &lt;/button&gt; &lt;/div&gt; &lt;div class="redirect"&gt; &lt;p&gt;Already have an account? &lt;a href="file:///Users/megatron/Documents/Project/The_Isle_of_Kitchens/Login/login.html"&gt;Login Here&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; &lt;/form&gt;</code></pre> </div> </div> </p> <p>I wanna go to a new HTML page when the user clicks the &quot;Sign Up as Shop Owner&quot; button. I used the tag in that portion, but it's not working, how will I use the tag in that division or is there any other way to solve it? Just give suggestion to me the way to solve it.</p>
[ { "answer_id": 74249850, "author": "Eric Haynes", "author_id": 1057157, "author_profile": "https://Stackoverflow.com/users/1057157", "pm_score": 3, "selected": true, "text": "export const authOptions: NextAuthOptions = {\n" }, { "answer_id": 74249996, "author": "6899 huge", ...
2022/10/29
[ "https://Stackoverflow.com/questions/74244276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20139689/" ]
74,244,322
<p>I'm using a listview in a grid proportional row, and its other elements are in an auto row. Because I want my listview to take up the rest of the screen. So far everything is normal.</p> <img src="https://i.stack.imgur.com/axcfm.png" height="300" /> <p>However, when I want to use a scrollview on the outside, the listview takes up the whole screen and the other elements are not visible.</p> <img src="https://i.stack.imgur.com/D30Pz.png" height="300" /> <p>I want the listview to appear the same in the scrollview. Here I have to use scrollview because I am adding more elements (label, button, etc.) in grid dynamically. After a while, when the listview height reaches the end, the scrollview should kick in. I tried everything but failed</p> <p>Many thanks to those who have helped so far.</p> <p>Example code</p> <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt; &lt;ContentPage xmlns=&quot;http://schemas.microsoft.com/dotnet/2021/maui&quot; xmlns:x=&quot;http://schemas.microsoft.com/winfx/2009/xaml&quot; x:Class=&quot;MauiApp4.MainPage&quot;&gt; &lt;ScrollView VerticalOptions=&quot;Fill&quot;&gt; &lt;Grid HorizontalOptions=&quot;Fill&quot; VerticalOptions=&quot;Fill&quot;&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height=&quot;Auto&quot;/&gt; &lt;RowDefinition Height=&quot;Auto&quot;/&gt; &lt;RowDefinition Height=&quot;*&quot;/&gt; &lt;RowDefinition Height=&quot;Auto&quot;/&gt; &lt;RowDefinition Height=&quot;Auto&quot;/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Image Source=&quot;dotnet_bot.png&quot; SemanticProperties.Description=&quot;Cute dot net bot waving hi to you!&quot; HeightRequest=&quot;200&quot; HorizontalOptions=&quot;Center&quot; /&gt; &lt;Label Grid.Row=&quot;1&quot; Text=&quot;Hello, World!&quot; SemanticProperties.HeadingLevel=&quot;Level1&quot; FontSize=&quot;32&quot; HorizontalOptions=&quot;Center&quot; /&gt; &lt;ListView x:Name=&quot;listView&quot; Grid.Row=&quot;2&quot; VerticalOptions=&quot;Fill&quot; ItemsSource=&quot;{Binding Monkeys}&quot; MinimumHeightRequest=&quot;200&quot;&gt; &lt;ListView.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;ViewCell&gt; &lt;ViewCell.ContextActions&gt; &lt;MenuItem Text=&quot;Favorite&quot; IconImageSource=&quot;favorite.png&quot; Command=&quot;{Binding Source={x:Reference listView}, Path=BindingContext.FavoriteCommand}&quot; CommandParameter=&quot;{Binding}&quot; /&gt; &lt;MenuItem Text=&quot;Delete&quot; IconImageSource=&quot;delete.png&quot; Command=&quot;{Binding Source={x:Reference listView}, Path=BindingContext.DeleteCommand}&quot; CommandParameter=&quot;{Binding}&quot; /&gt; &lt;/ViewCell.ContextActions&gt; &lt;Grid Padding=&quot;10&quot;&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height=&quot;Auto&quot; /&gt; &lt;RowDefinition Height=&quot;Auto&quot; /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width=&quot;Auto&quot; /&gt; &lt;ColumnDefinition Width=&quot;Auto&quot; /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Image Grid.RowSpan=&quot;2&quot; Source=&quot;{Binding ImageUrl}&quot; Aspect=&quot;AspectFill&quot; HeightRequest=&quot;60&quot; WidthRequest=&quot;60&quot; /&gt; &lt;Label Grid.Column=&quot;1&quot; Text=&quot;{Binding Name}&quot; FontAttributes=&quot;Bold&quot; /&gt; &lt;Label Grid.Row=&quot;1&quot; Grid.Column=&quot;1&quot; Text=&quot;{Binding Location}&quot; FontAttributes=&quot;Italic&quot; VerticalOptions=&quot;End&quot; /&gt; &lt;/Grid&gt; &lt;/ViewCell&gt; &lt;/DataTemplate&gt; &lt;/ListView.ItemTemplate&gt; &lt;/ListView&gt; &lt;Label Grid.Row=&quot;3&quot; Text=&quot;Welcome to .NET Multi-platform App UI&quot; SemanticProperties.HeadingLevel=&quot;Level2&quot; SemanticProperties.Description=&quot;Welcome to dot net Multi platform App U I&quot; FontSize=&quot;18&quot; HorizontalOptions=&quot;Center&quot; /&gt; &lt;Button Grid.Row=&quot;4&quot; x:Name=&quot;CounterBtn&quot; Text=&quot;Click me&quot; SemanticProperties.Hint=&quot;Counts the number of times you click&quot; Clicked=&quot;OnCounterClicked&quot; HorizontalOptions=&quot;Center&quot; /&gt; &lt;/Grid&gt; &lt;/ScrollView&gt; &lt;/ContentPage&gt; </code></pre>
[ { "answer_id": 74247613, "author": "ewerspej", "author_id": 4308455, "author_profile": "https://Stackoverflow.com/users/4308455", "pm_score": -1, "selected": false, "text": "<Grid RowDefinitons=\"auto, auto, *, auto, auto\">\n <!-- leaving out irrelevant bits -->\n\n <ListView Grid...
2022/10/29
[ "https://Stackoverflow.com/questions/74244322", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4923625/" ]
74,244,348
<p>i got an node error, the cause is to use jenkins to build the projec.</p> <pre><code>Error: write EPIPE at process.target._send (internal/child_process.js:841:20) at process.target.send (internal/child_process.js:712:19) at callback (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/worker-farm/lib/child/index.js:32:17) </code></pre> <pre><code>+ npm run build &gt; widsomfarm_admin_v2@0.1.0 build /home/jenkins/agent/workspace/dvf/F-adopt-backoffice/codeDir &gt; vue-cli-service build - Building for production... WARN A new version of sass-loader is available. Please upgrade for best experience. Killed npm ERR! code ELIFECYCLE npm ERR! errno 137 npm ERR! widsomfarm_admin_v2@0.1.0 build: `vue-cli-service build` npm ERR! Exit status 137 npm ERR! npm ERR! Failed at the widsomfarm_admin_v2@0.1.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /softdata/npm_local_repository/_logs/2022-10-28T09_05_45_429Z-debug.log events.js:377 throw er; // Unhandled 'error' event ^ Error: write EPIPE at process.target._send (internal/child_process.js:841:20) at process.target.send (internal/child_process.js:712:19) at callback (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/worker-farm/lib/child/index.js:32:17) at module.exports (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/terser-webpack-plugin/dist/worker.js:13:5) at handle (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/worker-farm/lib/child/index.js:44:8) at process.&lt;anonymous&gt; (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/worker-farm/lib/child/index.js:55:3) at process.emit (events.js:400:28) at emit (internal/child_process.js:912:12) at processTicksAndRejections (internal/process/task_queues.js:83:21) Emitted 'error' event on process instance at: at internal/child_process.js:845:39 at processTicksAndRejections (internal/process/task_queues.js:77:11) { errno: -32, code: 'EPIPE', syscall: 'write' } Shell Script -- npm run build (self time 1min 10s) </code></pre>
[ { "answer_id": 74247613, "author": "ewerspej", "author_id": 4308455, "author_profile": "https://Stackoverflow.com/users/4308455", "pm_score": -1, "selected": false, "text": "<Grid RowDefinitons=\"auto, auto, *, auto, auto\">\n <!-- leaving out irrelevant bits -->\n\n <ListView Grid...
2022/10/29
[ "https://Stackoverflow.com/questions/74244348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10819031/" ]
74,244,385
<p>here in below program i am defining <strong>ArrayList</strong> of size 7 [1,2,3,4,5,6,7] and and rotating right by 3 places but when i print the numbers1 list it gives me my expected answer <strong>numbers: [5, 6, 7, 1, 2, 3, 4]</strong> but when i return this ArrayList and then print it, it gives me this answer <strong>numbers: [2, 3, 4, 5, 6, 7, 1]</strong> why is that please explain.</p> <pre><code>package QAIntvSprint; import java.util.ArrayList; import java.util.Scanner; public class RotateArray { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); ArrayList&lt;Integer&gt; numbers = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; n; i++) { numbers.add(sc.nextInt()); } rotateArray(numbers, k); ArrayList&lt;Integer&gt; ans = rotateArray(numbers, k); for (Integer x : ans) { System.out.print(x + &quot; &quot;); } } static ArrayList&lt;Integer&gt; rotateArray(ArrayList&lt;Integer&gt; numbers, int k) { for (int i = 0; i &lt; k; i++) { numbers.add(0, numbers.get(numbers.size() - 1)); numbers.remove(numbers.size() - 1); } ArrayList&lt;Integer&gt; numbers1 = numbers; System.out.println(&quot;numbers: &quot; + numbers1.toString()); return numbers1; } } </code></pre> <p>output</p> <p><a href="https://i.stack.imgur.com/IvRzt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IvRzt.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74244546, "author": "Thomas", "author_id": 10148219, "author_profile": "https://Stackoverflow.com/users/10148219", "pm_score": 1, "selected": false, "text": "rotateArray" }, { "answer_id": 74244563, "author": "Mishin870", "author_id": 9630962, "author_p...
2022/10/29
[ "https://Stackoverflow.com/questions/74244385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13337068/" ]
74,244,396
<p>I am a fairly novice windows IIS guy, so any help I would greatly appreciate.</p> <p>I have a client that requested all root Urls on their department websites redirect to their index.html page. So if a user, for example, goes to <a href="https://mysite.domain.com/" rel="nofollow noreferrer">https://mysite.domain.com/</a>, it will redirect to <a href="https://mysite.doman.com/index.html" rel="nofollow noreferrer">https://mysite.doman.com/index.html</a>.</p> <p>I did this through IIS 10 using a URLrewrite rule on the root of each site by doing the following.</p> <pre><code> &lt;rule name=&quot;Index Request&quot; enabled=&quot;true&quot; stopProcessing=&quot;true&quot;&gt; &lt;match url=&quot;^$&quot; /&gt; &lt;action type=&quot;Redirect&quot; url=&quot;https://mysite.domain.com/index.html&quot; /&gt; &lt;/rule&gt; </code></pre> <p>This seemed to work.</p> <p>The client now wants to have any of the subfolders of the root site show the index.html to any subdirectory sites of the root. Example. Https://mysite.domain.com/subdir/ “This is what shows now” to <a href="https://mysite.domain.com/subdir/index.html" rel="nofollow noreferrer">https://mysite.domain.com/subdir/index.html</a>. Is there a way to do this in IIS?</p> <p>Thanks in advance for any advice</p> <p>I have made sure the index.html is the default document. I have also looked at User Friendly URL-template <a href="https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/user-friendly-url-rule-template" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/user-friendly-url-rule-template</a>, but I am not sure if this is the right direction to go.</p>
[ { "answer_id": 74244546, "author": "Thomas", "author_id": 10148219, "author_profile": "https://Stackoverflow.com/users/10148219", "pm_score": 1, "selected": false, "text": "rotateArray" }, { "answer_id": 74244563, "author": "Mishin870", "author_id": 9630962, "author_p...
2022/10/29
[ "https://Stackoverflow.com/questions/74244396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20364737/" ]
74,244,401
<p>I have two python scripts, both of whom i need to start at <strong>exactly the same time</strong></p> <p>This is because i am trying to measure performance metrics of both the scripts and it is a compulsory requirement of the task at hand that both of them <strong>should have started their execution at the same time</strong></p> <p>Is there a trivial way to do this?</p> <p>Preferably through a third python script, which executes them both at the same time ?</p>
[ { "answer_id": 74244986, "author": "Roland Smith", "author_id": 1219295, "author_profile": "https://Stackoverflow.com/users/1219295", "pm_score": 0, "selected": false, "text": "python a.py >/dev/null &\npython b.py >/dev/null &\n" } ]
2022/10/29
[ "https://Stackoverflow.com/questions/74244401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6713026/" ]
74,244,439
<p>Why does it not generate two random numbers untill theyre are 5 and 3?</p> <pre><code>import random rolla = int(0) rollb = int(0) while rolla != 5 and rollb != 3: rolla = random.randint(1, 10) rollb = random.randint(1, 11) print(rolla, ' - ', rollb) </code></pre>
[ { "answer_id": 74245391, "author": "Anton Chernyshov", "author_id": 20127679, "author_profile": "https://Stackoverflow.com/users/20127679", "pm_score": 2, "selected": true, "text": "import random\n\nrolla = 0\nrollb = 0\n\nwhile not(rolla == 5 and rollb == 3):\n rolla = random.randint(1...
2022/10/29
[ "https://Stackoverflow.com/questions/74244439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20364839/" ]
74,244,447
<p>I have a for loop that is creates a sum by multiplying the values in the loop:</p> <pre><code>int i; int j; float total = 0; int x = 1000; for (i = 0; i &lt; x; i++) { for (j = 0; j &lt; x; j++) { total += i * j; } } </code></pre> <p>Is there a <em>better way</em> of writing this? When <code>x</code> gets <em>larger</em>, the time it takes to process is <em>incredibly long</em>.</p> <p>My research suggests that nested for loops are good enough, but I'm wondering if there's a way to <em>simplify</em> this.</p>
[ { "answer_id": 74244558, "author": "Dmitry Bychenko", "author_id": 2319407, "author_profile": "https://Stackoverflow.com/users/2319407", "pm_score": 3, "selected": false, "text": "x" }, { "answer_id": 74245146, "author": "Yves Daoust", "author_id": 1196549, "author_pr...
2022/10/29
[ "https://Stackoverflow.com/questions/74244447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12498785/" ]
74,244,460
<p>models.py</p> <pre><code>class Category(models.Model): category_name = models.CharField(max_length=100) def __str__(self): return self.category_name class SubCategory(models.Model): sub = models.CharField(max_length=100) category = models.ForeignKey(Category,on_delete=models.CASCADE) def __str__(self): return self.sub class Wallpaper(models.Model): subcategory = models.ManyToManyField(SubCategory) </code></pre> <p>this is my view.py</p> <pre><code>def download(request, wallpaper_name): try: wallpaper = Wallpaper.objects.get(name=wallpaper_name) context = {'wallpaper': wallpaper} return render(request, 'Wallpaper/download.html', context) </code></pre> <p>on my download page how can I show categorty name of that specific wallpaper</p>
[ { "answer_id": 74244558, "author": "Dmitry Bychenko", "author_id": 2319407, "author_profile": "https://Stackoverflow.com/users/2319407", "pm_score": 3, "selected": false, "text": "x" }, { "answer_id": 74245146, "author": "Yves Daoust", "author_id": 1196549, "author_pr...
2022/10/29
[ "https://Stackoverflow.com/questions/74244460", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13839157/" ]
74,244,463
<p>I'm studying recursion now, and my head is about to explode trying to use it.</p> <p>If <strong>lst = [-1, -4, 0, 3, 6]</strong>, my expecting output is <strong>result = [3, 6]</strong>.</p> <p>I tried this,</p> <pre><code>def positive(lst): result = [] if not lst: return result else: if lst[0] &gt; 0: result.append(lst[0]) return positive(lst[1:]) </code></pre> <p>But output is empty list. like result = [ ].</p>
[ { "answer_id": 74244558, "author": "Dmitry Bychenko", "author_id": 2319407, "author_profile": "https://Stackoverflow.com/users/2319407", "pm_score": 3, "selected": false, "text": "x" }, { "answer_id": 74245146, "author": "Yves Daoust", "author_id": 1196549, "author_pr...
2022/10/29
[ "https://Stackoverflow.com/questions/74244463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20281037/" ]
74,244,483
<p>python, ModuleNotFoundError: No module named 'pygame', pip</p> <p>in the command prompt, it says &quot;Requirement already satisfied&quot; but when trying to import, I keep getting errors.</p>
[ { "answer_id": 74244558, "author": "Dmitry Bychenko", "author_id": 2319407, "author_profile": "https://Stackoverflow.com/users/2319407", "pm_score": 3, "selected": false, "text": "x" }, { "answer_id": 74245146, "author": "Yves Daoust", "author_id": 1196549, "author_pr...
2022/10/29
[ "https://Stackoverflow.com/questions/74244483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15687720/" ]
74,244,493
<p>so I developed an app which will send a series of integers over Bluetooth (for RED, GREEN &amp; BLUE) to a ESP32 which will then change the colour of 3 LED's (WS2811) based on the numbers it receives. It works the first time I send them but when I try to change the colour of the LED's a second time nothing happens.</p> <p>By using the serial monitor of the Arduino IDE I have verified that the numbers are being received by the ESP32 every time I send the numbers, but I cannot understand why the LEDs are not changing colour after the first send.</p> <p>The code is as follows :</p> <pre><code> #include &lt;Arduino.h&gt; #include &lt;fastled_config.h&gt; #define NUM_LEDS 3 // was 100 #define LED_TYPE WS2811 #define COLOR_ORDER RGB #define DATA_PIN 4 //#define CLK_PIN 4 #define VOLTS 12 #define MAX_MA 4000 CRGBArray&lt;NUM_LEDS&gt; leds; #define LED 2 int myRGB[30]; int counter =0; int display =-1; #include &quot;BluetoothSerial.h&quot; // init Class: BluetoothSerial ESP_BT; // Parameters for Bluetooth interface int incoming; void setup() { Serial.begin(115200); ESP_BT.begin(&quot;ESP32_Control&quot;); //Name of your Bluetooth interface -&gt; will show up on your phone delay( 3000 ); //safety startup delay FastLED.setMaxPowerInVoltsAndMilliamps( VOLTS, MAX_MA); FastLED.addLeds&lt;LED_TYPE,DATA_PIN,COLOR_ORDER&gt;(leds, NUM_LEDS) .setCorrection(TypicalLEDStrip); } void loop() { delay(1000); Serial.println(myRGB[1]); Serial.println(myRGB[2]); Serial.println(myRGB[3]); leds[0].r = myRGB[1]; leds[0].g = myRGB[2]; leds[0].b = myRGB[3]; leds[1].r = myRGB[4]; leds[1].g = myRGB[5]; leds[1].b = myRGB[6]; leds[2].r = myRGB[7]; leds[2].g = myRGB[8]; leds[2].b = myRGB[9]; FastLED.show(); // -------------------- Receive Bluetooth signal ---------------------- if (ESP_BT.available()) { incoming = ESP_BT.read(); //Read what we receive digitalWrite(LED, HIGH); counter ++; myRGB[counter] = incoming; if (counter &gt; 29) counter = 0; Serial.print(&quot;counter :&quot; ); Serial.println(counter); Serial.print( myRGB[counter]); } } // end loop </code></pre>
[ { "answer_id": 74244558, "author": "Dmitry Bychenko", "author_id": 2319407, "author_profile": "https://Stackoverflow.com/users/2319407", "pm_score": 3, "selected": false, "text": "x" }, { "answer_id": 74245146, "author": "Yves Daoust", "author_id": 1196549, "author_pr...
2022/10/29
[ "https://Stackoverflow.com/questions/74244493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11811579/" ]
74,244,496
<p>** flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/src/firebase_app.dart:18:25: Error: Member not found: 'FirebaseAppPlatform.verifyExtends'. FirebaseAppPlatform.verifyExtends(_delegate);</p> <p>I used . . .</p> <blockquote> <p>firebase_core: ^1.7.0....I cheked in my code but there is not show any error shoud i change in my library file of firebase_core:1.24.0 ***</p> </blockquote>
[ { "answer_id": 74279410, "author": "SalemFeyzo", "author_id": 7469068, "author_profile": "https://Stackoverflow.com/users/7469068", "pm_score": 1, "selected": true, "text": "firebase_core: ^2.1.1\nfirebase_auth: ^4.1.0\ncloud_firestore: ^4.0.3" } ]
2022/10/29
[ "https://Stackoverflow.com/questions/74244496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18307873/" ]
74,244,524
<p>I want to list out the subnets only from specific VPC in my cloudformation parameters section:</p> <pre><code>VPC: Description: VPC Id Type: AWS::EC2::VPC::Id Subnets: Description: Select Subnets (Minimum 2) Type: List&lt;AWS::EC2::Subnet::Id&gt; </code></pre> <p>The above displays all subnets (from other subnets also) but I want to show only subnets from selected VPC.</p> <p>Is it possible? What is the workaround for the same?</p>
[ { "answer_id": 74244678, "author": "Paolo", "author_id": 3390419, "author_profile": "https://Stackoverflow.com/users/3390419", "pm_score": 2, "selected": true, "text": "{\n \"Rules\": {\n \"IsSubnetInsideVPC\": {\n \"Assertions\": [\n {\n \"Assert\": {\n ...
2022/10/29
[ "https://Stackoverflow.com/questions/74244524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5443527/" ]
74,244,578
<p>Let me edit my question again. I know how <code>flatten</code> works but I am looking if it possible to remove the <code>inside braces</code> and just simple <code>two outside braces</code> just like in <code>MATLAB</code> and maintain the same <code>shape of (3,4)</code>. here it is <code>arrays inside array</code>, and I want to have just one array so I can plot it easily also get the same results is it is in <code>Matlab</code>. For example I have the following <code>matrix</code> (which is arrays inside array):</p> <pre><code>s=np.arange(12).reshape(3,4) print(s) [[ 0 1 2 3] [ 4 5 6 7] [ 8 9 10 11]] </code></pre> <p>Is it possible to <code>reshape</code> or <code>flatten()</code> it and get results like this:</p> <pre><code>[ 0 1 2 3 4 5 6 7 8 9 10 11] </code></pre>
[ { "answer_id": 74244609, "author": "assume_irrational_is_rational", "author_id": 11622508, "author_profile": "https://Stackoverflow.com/users/11622508", "pm_score": 0, "selected": false, "text": "itertools.chain" }, { "answer_id": 74244620, "author": "drx", "author_id": 2...
2022/10/29
[ "https://Stackoverflow.com/questions/74244578", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20191650/" ]
74,244,601
<p>I have prepared the following code:</p> <pre><code>data = [] for i in range(4, 8): for value in round(df[&quot;month&quot;] / 12, 1) #converting months to years if value &gt; i: data.append(value) </code></pre> <p>What I am wanting to do is count the number of values stored in this list <code>data</code> which are greater than <code>i</code> and then store this information in a separate list so I can create a data frame.</p> <p>I would get something like this:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Description</th> <th>Count</th> </tr> </thead> <tbody> <tr> <td>&gt; 4 years</td> <td>56</td> </tr> <tr> <td>&gt; 5 years</td> <td>456</td> </tr> </tbody> </table> </div> <p>I have tried with a <code>lambda</code> function but this does not seem to work:</p> <pre><code>data = [] for i in range(4, 8): for value in round(df[&quot;month&quot;] / 12, 1) if value &gt; i: data.append(value) counts = sum(map(lambda x: if x &gt; i, data))) </code></pre> <p>What can I add to my existing code to get what I want?</p>
[ { "answer_id": 74244727, "author": "Rodrigo Guzman", "author_id": 13315525, "author_profile": "https://Stackoverflow.com/users/13315525", "pm_score": 0, "selected": false, "text": "dataFrame = pd.DataFrame(round(df[\"month\"] / 12, 1).value_counts(dropna=True))\n" }, { "answer_id...
2022/10/29
[ "https://Stackoverflow.com/questions/74244601", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18937753/" ]
74,244,603
<p>Assuming I worked with meteorological observations and wanted to know not only the daily maximum value but also the relevant timestamp, describing when this value was observed, is it possible to accomplish this without significant overhead, e.g. by setting some sort of parameter?</p> <pre class="lang-r prettyprint-override"><code>library(xts) set.seed(42) # init data datetimes &lt;- seq(from = as.POSIXct(&quot;2022-01-01&quot;), to = as.POSIXct(&quot;2022-01-08&quot;), by = &quot;10 mins&quot;) values &lt;- length(datetimes) |&gt; runif() |&gt; sin() data &lt;- xts(x = values, order.by = datetimes) # ep &lt;- endpoints(data, &quot;days&quot;) data_max &lt;- period.apply(data, INDEX = ep, FUN = max) head(data_max) #&gt; [,1] #&gt; 2022-01-01 23:50:00 0.8354174 #&gt; 2022-01-02 23:50:00 0.8396034 #&gt; 2022-01-03 23:50:00 0.8364624 #&gt; 2022-01-04 23:50:00 0.8376930 #&gt; 2022-01-05 23:50:00 0.8392988 #&gt; 2022-01-06 23:50:00 0.8372780 </code></pre> <p>Obviously, this would not work with summarizing functions like <code>mean</code> and <code>median</code> where you would want to specify the interval width considered, but when working with e.g. <code>min</code> and <code>max</code>, how would I proceed when I wanted to know the exact index of the value in question observed.</p> <p>At the moment, I'm just looping over my xts subsets to determine the relevant index, but maybe there is a more elegant approach, maybe even an argument when using <code>period.apply()</code> I haven't noticed to get this information.</p> <pre class="lang-r prettyprint-override"><code>sub &lt;- &quot;2022-01-04&quot; ind &lt;- which(data[sub] == max(data[sub])) data[sub][ind] #&gt; [,1] #&gt; 2022-01-04 23:20:00 0.837693 </code></pre> <p>My desired output would look like this:</p> <pre class="lang-r prettyprint-override"><code>#&gt; [,1] #&gt; 2022-01-01 03:40:00 0.8354174 #&gt; 2022-01-02 15:00:00 0.8396034 #&gt; 2022-01-03 05:10:00 0.8364624 #&gt; 2022-01-04 23:20:00 0.8376930 #&gt; 2022-01-05 02:50:00 0.8392988 #&gt; 2022-01-06 06:40:00 0.8372780 </code></pre> <p>Thanks a lot in advance!</p>
[ { "answer_id": 74246052, "author": "Chris", "author_id": 794450, "author_profile": "https://Stackoverflow.com/users/794450", "pm_score": 1, "selected": false, "text": "set.seed(42)\ndatetimes <- seq(from = as.POSIXct('2022-01-01'),\nto = as.POSIXct('2022-01-09'), by = '10 mins')\n\n\nval...
2022/10/29
[ "https://Stackoverflow.com/questions/74244603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11709296/" ]
74,244,646
<p>I do have a list of people for a raffle. The supervisor told me that the number of entry will vary depending on their purchase amount: <br> $1 - 59$: 1 Raffle Ticket <br> $60 - $200: 5 Raffle Tickets <br> $201 - $600: 10 Raffle Tickets <br> $601 - Max: 15 Raffle Ticket </p> <p>My thoughts are I'll create a column wherein I'll apply a condition for the purchase amount and give it a score.</p> <p>And after how would I randomly pick a winner applying the multiple entry as a higher chance of winning?</p>
[ { "answer_id": 74246052, "author": "Chris", "author_id": 794450, "author_profile": "https://Stackoverflow.com/users/794450", "pm_score": 1, "selected": false, "text": "set.seed(42)\ndatetimes <- seq(from = as.POSIXct('2022-01-01'),\nto = as.POSIXct('2022-01-09'), by = '10 mins')\n\n\nval...
2022/10/29
[ "https://Stackoverflow.com/questions/74244646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19992644/" ]
74,244,663
<p>If I have a PowerShell module that acts as a wrapper over an executable program, and I would like to communicate failure to the parent process so that it can be checked programmatically, how would I best do this?</p> <p>Possible ways that the module could be invoked from (non-exhaustive):</p> <ol> <li>From within the PowerShell shell (powershell or pwsh),</li> <li>From the command prompt (.e.g as <code>powershell -Command \&lt;module fn\&gt;</code>),</li> <li>From an external program creating a PowerShell process (e.g. by calling <code>powershell -Command \&lt;module fn\&gt;</code>)).</li> </ol> <p>If I throw an exception from the module when the executable fails, say, with</p> <pre><code>if ($LastExitCode -gt 0) { throw $LastExitCode; } </code></pre> <p>it appears to cover all of the requirements. If an exception is thrown and the module was called</p> <ol> <li>from within the PowerShell shell, <code>$?</code> variable is set to <code>False</code>.</li> <li>from the command prompt, the <code>%errorlevel%</code> variable is set to <code>1</code>.</li> <li>from an external process, the <code>exit</code> code is set to <code>1</code>.</li> </ol> <p>Thus the parent process can check for failure depending on how the module was called.</p> <p>A small drawback with this approach is that the full range of exit codes cannot be communicated to the parent process (it either returns True/False in <code>$?</code> or 0/1 as the <code>exit</code> code), but more annoyingly the exception message displayed on the output is too verbose for some tastes (can it be suppressed?):</p> <pre><code>+ if ($LastExitCode -gt 0) { throw $LastExitCode; } + ~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (9:Int32) [], RuntimeException + FullyQualifiedErrorId : 9 </code></pre> <p>Are there any better ways to communicate failure of an executable invoked from a PowerShell module to the parent process?</p> <p>Thanks</p>
[ { "answer_id": 74246374, "author": "efotinis", "author_id": 12320, "author_profile": "https://Stackoverflow.com/users/12320", "pm_score": 0, "selected": false, "text": "exit" }, { "answer_id": 74249498, "author": "mklement0", "author_id": 45375, "author_profile": "htt...
2022/10/29
[ "https://Stackoverflow.com/questions/74244663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20364929/" ]
74,244,673
<p>I call <code>const dataProvider = useDataProvider()</code> in my component and can use the default methods like <code>dataProvider.getList(&quot;resource&quot;,{})</code> without any issue. Then, I expanded my <code>DataProvider</code> with a custom <code>get</code> method for retrieving objects that don't have the required <code>Record</code> structure like the following:</p> <pre><code> get: async &lt;T = any&gt;( resource: string, params: Partial&lt;QueryParams&gt; ): Promise&lt;{ data: T }&gt; =&gt; { const url = `${apiUrl}/${resource}?${stringify(params)}` return httpClient(url) .then(({ json }) =&gt; ({ data: json, })) .catch((e) =&gt; { console.log(e) return Promise.reject(e) }) }, </code></pre> <p>I can use this method without any problem when I import the <code>DataProvider</code> object directly, but when I want to use it with the <code>useDataProvider</code> hook I get the following typing message: <code>(...a: unknown[]) =&gt; unknown</code></p> <p>What do I have to add/change, so that my custom data provider methods also have proper typing for the <code>useDataProvider</code> hook?</p> <p>I am using <code>react-admin</code> version 3.14, and probably soon upgrade to 4.x.</p>
[ { "answer_id": 74284028, "author": "FatihAziz", "author_id": 16360035, "author_profile": "https://Stackoverflow.com/users/16360035", "pm_score": 1, "selected": false, "text": "get" }, { "answer_id": 74287816, "author": "Heikkisorsa", "author_id": 11465355, "author_pro...
2022/10/29
[ "https://Stackoverflow.com/questions/74244673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11465355/" ]
74,244,689
<p>I have this nested array which I am trying to sum the number in the last arrays individually</p> <p>so it should return 400 for each array also trying to get the average of the total, for example if it is 400 then it is 100%, if 399 it will be 99.99%, the average needs to be from 100% and dynamic if that makes sense.</p> <p>I been using javascript map method, but every time I map over the array it returns the same array level, I couldn't access the last array.</p> <p>arr.map(item =&gt; item.map(item2 =&gt; item2))</p> <p>example in code:</p> <pre><code>const arr = [ [ [100, 100, 100, 100], // sum 400 -&gt; average 100% [100, 100, 100, 100], // sum 400 -&gt; average 100% [100, 100, 98, 100], // sum 398 -&gt; average 99.99% [100, 100, 100, 100], // sum 400 -&gt; average 100% ], [ [100, 100, 100, 99], // sum 399 -&gt; average 99.99% [100, 100, 100, 100], // sum 400 -&gt; average 100% [100, 100, 100, 100], // sum 400 -&gt; average 100% [100, 100, 100, 100], // sum 400 -&gt; average 100% ] ]; </code></pre> <p>the result should be something like this</p> <pre><code> const arr = [ [ {total: 400, average: 100%}, {total: 400, average: 100%}, {total: 398, average: 99,99%}, {total: 400, average: 100%}, ], [ {total: 399, average: 99,99%}, {total: 400, average: 100%}, {total: 400, average: 100%}, {total: 400, average: 100%}, ] ]; </code></pre> <p>I would really appreciate if someone can help</p>
[ { "answer_id": 74244741, "author": "Breezer", "author_id": 260640, "author_profile": "https://Stackoverflow.com/users/260640", "pm_score": 3, "selected": true, "text": " let data = arr.map(section => section.map(row => {\n let tot = row.reduce((pv,cv) => pv+cv,0);\n return {'t...
2022/10/29
[ "https://Stackoverflow.com/questions/74244689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18836219/" ]
74,244,737
<p>Trying to bulk-rename photographs to a given naming scheme while keeping the current sort order with the following code:</p> <pre><code>Get-ChildItem | ForEach-Object -begin { $count=1 } -process { rename-item $_ -NewName &quot;MyNamingSchemeWithIndex-$count.jp2&quot;; $count++ } </code></pre> <p>The renaming works well, however in some cases, the order gets messed up. I couldn't so far identify any given reason why only some runs are incorrect, expect for the files being jp2 instead of jpeg. With jpeg it so far seems to be right every time.</p> <p>I tried adding Sort-Object</p> <pre><code>Get-ChildItem | Sort-Object | ForEach-Object -begin { $count=1 } -process { rename-item $_ -NewName &quot;MyNamingSchemeWithIndex-$count.jp2&quot;; $count++ } </code></pre> <p>But that doesn't seem to help.</p> <p>Just running</p> <pre><code> Get-ChildItem | Sort-Object </code></pre> <p>Works though and displays proper order.</p>
[ { "answer_id": 74244741, "author": "Breezer", "author_id": 260640, "author_profile": "https://Stackoverflow.com/users/260640", "pm_score": 3, "selected": true, "text": " let data = arr.map(section => section.map(row => {\n let tot = row.reduce((pv,cv) => pv+cv,0);\n return {'t...
2022/10/29
[ "https://Stackoverflow.com/questions/74244737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10364943/" ]
74,244,780
<p>I use a sidebar with a height of 100vh. when the content becomes longer and it is necessary to scroll down, the <code>sidebar</code> does not extend along the page, but remains at the original height. How can I solve?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>html { line-height: 1.15; -webkit-text-size-adjust: 100%; font-family: 'Roboto', sans- serif; box-sizing: border-box; min-height: 100%; } *, *:before, *:after { box-sizing: inherit; } body { margin: 0; } .container { height: 100%; } .sidebar { height: 100vh; background-color: #c7cdd1; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container"&gt; &lt;div class="sidebar"&gt;&lt;/div&gt; &lt;div class="content"&gt;&lt;/div&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
[ { "answer_id": 74244741, "author": "Breezer", "author_id": 260640, "author_profile": "https://Stackoverflow.com/users/260640", "pm_score": 3, "selected": true, "text": " let data = arr.map(section => section.map(row => {\n let tot = row.reduce((pv,cv) => pv+cv,0);\n return {'t...
2022/10/29
[ "https://Stackoverflow.com/questions/74244780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14721337/" ]
74,244,783
<p>I have an 8MB video set to &quot;object-fit:contain&quot; and need to retrieve its height before it finishes loading on mobile devices. Reason I need the height earlier is to position content overlaying the video by matching the video height on this content container.</p> <p>I am not looking for the actual height of the video, but the height as rendered in the user's browser / viewport.</p> <p>If I try to get the height while it's loading, I get a much smaller value (200 some pixels) than what it ends up being (usually 600 some pixels). I've been able to get the height AFTER it loads using the load() function, but this method is very slow because my video is 8MB in size.</p> <p>Is there any workaround?</p> <pre><code>jQuery(document).ready(function($){ function vidHeight() { var newHeight = jQuery('#section-feature-device video').height(); jQuery(&quot;.elementor-element-0113321&quot;).css(&quot;height&quot;, newHeight+&quot;px&quot;); } jQuery(window).load(function () { var win = jQuery(this); if (win.width() &lt;= 767) { vidHeight(); } }); }); </code></pre>
[ { "answer_id": 74244741, "author": "Breezer", "author_id": 260640, "author_profile": "https://Stackoverflow.com/users/260640", "pm_score": 3, "selected": true, "text": " let data = arr.map(section => section.map(row => {\n let tot = row.reduce((pv,cv) => pv+cv,0);\n return {'t...
2022/10/29
[ "https://Stackoverflow.com/questions/74244783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/871614/" ]
74,244,813
<p>I need to have first node of below xml that is inside of FIToFICstmrCdtTrf. However, xpath returns binary data.</p> <pre><code>xpath(xml(triggerBody()),'/') xpath(xml(triggerBody())x,'/FIToFICstmrCdtTrf') </code></pre> <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt; &lt;Document xmlns=&quot;urn:iso:std:iso:20022:tech:xsd:pacs.008.001.02&quot;&gt; &lt;FIToFICstmrCdtTrf&gt; &lt;GrpHdr&gt; &lt;MsgId&gt;x&lt;/MsgId&gt; &lt;CreDtTm&gt;x&lt;/CreDtTm&gt; &lt;NbOfTxs&gt;2&lt;/NbOfTxs&gt; .... </code></pre>
[ { "answer_id": 74245750, "author": "Mads Hansen", "author_id": 14419, "author_profile": "https://Stackoverflow.com/users/14419", "pm_score": 2, "selected": false, "text": "urn:iso:std:iso:20022:tech:xsd:pacs.008.001.02" }, { "answer_id": 74258639, "author": "SwethaKandikonda"...
2022/10/29
[ "https://Stackoverflow.com/questions/74244813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5562110/" ]
74,244,817
<p>I am trying to make an app which takes names then validates it. I got which says : The operator '+' can't be unconditionally invoked because the receiver can be 'null'. I tried to write ' if (value != null), but then i got another error.</p> <pre><code>Expanded( child: ListView.builder( itemCount: animeler.length, itemBuilder: (BuildContext context, int index) { return ListTile(title: Text(animeler[index].animeName + &quot; : &quot; + animeler[index].animePoint.toString()), })), </code></pre> <p>This is the class :</p> <pre><code>class Animes { String? animeName = &quot;&quot;; double animePoint = 0; String animeLover = &quot;&quot;; Animes(String animeName, double animePoint, String animeLover) { this.animeName = animeName; this.animePoint = animePoint; this.animeLover = animeLover; } } </code></pre> <p>This is where i got the anime name. I have a variable anime.</p> <pre><code> Widget buildFirstNameField() { return TextFormField( decoration: InputDecoration(labelText: &quot;Anime name&quot;, hintText: &quot;Death Note&quot;), validator: vallval, onSaved: (String? value) { anime.animeName = value; }, ); } } </code></pre> <p>i call the 'buildFirstNameField' function in:</p> <pre><code>body: Container( margin: EdgeInsets.all(20.0), child: Form( child: Column( children: &lt;Widget&gt;[ buildFirstNameField(), </code></pre>
[ { "answer_id": 74245750, "author": "Mads Hansen", "author_id": 14419, "author_profile": "https://Stackoverflow.com/users/14419", "pm_score": 2, "selected": false, "text": "urn:iso:std:iso:20022:tech:xsd:pacs.008.001.02" }, { "answer_id": 74258639, "author": "SwethaKandikonda"...
2022/10/29
[ "https://Stackoverflow.com/questions/74244817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19780653/" ]
74,244,857
<p>I am trying to save image to Gallery from image View but getting File Not Found Exception Error</p> <p>The code I tried but got File Not Found Exception.</p> <p>Sorry if you didn't understand my English.</p> <pre><code>save.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ BitmapDrawable draw = (BitmapDrawable) mainImage.getDrawable(); Bitmap bitmap = draw.getBitmap(); try{ FileOutputStream outStream = null; File sdCard = Environment.getExternalStorageDirectory(); File dir = new File(sdCard.getAbsolutePath() + &quot;/MyFolder&quot;); dir.mkdirs(); String fileName = String.format(&quot;%d.jpg&quot;, System.currentTimeMillis()); File outFile = new File(dir, fileName); outStream = new FileOutputStream(outFile); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outStream); outStream.flush(); outStream.close(); Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); intent.setData(Uri.fromFile(outFile)); sendBroadcast(intent); } catch (Exception e){ e.printStackTrace(); Toast.makeText(MainActivity.this,e.toString(),Toast.LENGTH_SHORT).show(); } } }); </code></pre> <p>I am a beginner so I don't how to solve this Problem. Help me Please</p>
[ { "answer_id": 74245750, "author": "Mads Hansen", "author_id": 14419, "author_profile": "https://Stackoverflow.com/users/14419", "pm_score": 2, "selected": false, "text": "urn:iso:std:iso:20022:tech:xsd:pacs.008.001.02" }, { "answer_id": 74258639, "author": "SwethaKandikonda"...
2022/10/29
[ "https://Stackoverflow.com/questions/74244857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20347794/" ]
74,244,886
<p>The following functionality is needed, after user authorization, it returns back to the application via a link with a callback function - localhost / callback, at this point I don't need to render anything, the application parses information in the search bar and the router pushes to the user's page, but vue swears that there is no template for rendering, how to implement this functionality correctly? <a href="https://i.stack.imgur.com/2oRNn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2oRNn.png" alt="enter image description here" /></a></p> <p>my callback code:</p> <pre><code>import { useRoute, useRouter } from 'vue-router'; import { useUserStore } from '../../../stores/userState' export default { name: 'AuthCallback', setup() { const tokenParseRegex: RegExp = /access_token=(.*?)&amp;/; const idParseRegex: RegExp = /user_id=(.*?)$/; const exAccessToken: RegExpMatchArray | null = useRoute().hash.match(tokenParseRegex); const exUserId: RegExpMatchArray | null = useRoute().hash.match(idParseRegex); if (exAccessToken !== null) { useUserStore().userAccess.accessToken = exAccessToken![1]; useUserStore().userAccess.userId = exUserId![1]; useUserStore().userAccess.isAuthorized = true; localStorage.setItem('userAccess', JSON.stringify(useUserStore().userAccess)) } else { useRouter().push({ name: 'AuthFailed', }) } if (exUserId) { useRouter().push({ name: 'UserInit', params: { usedId: String(exUserId![1]) }, }) } else { useRouter().push({ name: 'AuthFailed', }) } } } </code></pre>
[ { "answer_id": 74245750, "author": "Mads Hansen", "author_id": 14419, "author_profile": "https://Stackoverflow.com/users/14419", "pm_score": 2, "selected": false, "text": "urn:iso:std:iso:20022:tech:xsd:pacs.008.001.02" }, { "answer_id": 74258639, "author": "SwethaKandikonda"...
2022/10/29
[ "https://Stackoverflow.com/questions/74244886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18572442/" ]
74,244,895
<p>I'm a newbie and trying to figure out something in Javascript that should be simple. I have 2 functions let's say</p> <pre><code>function play1(){ Promise.resolve() .then(() =&gt; put('A', 1000)) .then(() =&gt; put('B', 1000)) } </code></pre> <pre><code>function play2(){ Promise.resolve() .then(() =&gt; put('C'), 1000) .then(() =&gt; put('D'), 1000) } </code></pre> <p>I need a third function so that it executes sequentially A, B, C, D What I've tried so far with no luck:</p> <pre><code>function playAllSequentially(){ Promise.resolve() .then(() =&gt; play1()) .then(() =&gt; play2()) } </code></pre> <p>but this doesn't get the job done, of course I could do</p> <pre><code>Promise.resolve() .then(() =&gt; put('A', 1000)) .then(() =&gt; put('B', 1000)) .then(() =&gt; put('C', 1000)) .then(() =&gt; put('D', 1000)) </code></pre> <p>but that is not the idea</p> <p>in case it matters the content of put() is</p> <pre><code>function put(text, duration){ $('#txtRemarks').text(text); delay(duration); } </code></pre> <p>Thanks in advance</p>
[ { "answer_id": 74244956, "author": "Wazeed", "author_id": 6394979, "author_profile": "https://Stackoverflow.com/users/6394979", "pm_score": 1, "selected": false, "text": "play1" }, { "answer_id": 74244993, "author": "T.J. Crowder", "author_id": 157247, "author_profile...
2022/10/29
[ "https://Stackoverflow.com/questions/74244895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9022572/" ]
74,244,897
<p>I've installed nvm and then tried to run an npm project as I usually do with &quot;npm start&quot;, but I get this failure</p> <pre><code>npm ERR! Invalid version: &quot;10-10-2022 -- 1685 -- every cell calls own pop w/out invisible block&quot; npm ERR! A complete log of this run can be found in: npm ERR! /Users/roman/.npm/_logs/2022-10-29T11_30_43_298Z-debug.log </code></pre> <p>Logs:</p> <pre><code>0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli '/Users/roman/.nvm/versions/node/v14.20.0/bin/node', 1 verbose cli '/Users/roman/.nvm/versions/node/v14.20.0/bin/npm', 1 verbose cli 'start' 1 verbose cli ] 2 info using npm@6.14.17 3 info using node@v14.20.0 4 verbose stack Error: Invalid version: &quot;10-10-2022 -- 1685 -- every cell calls own pop w/out invisible block&quot; 4 verbose stack at Object.fixVersionField (/Users/roman/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/normalize-package-data/lib/fixer.js:191:13) 4 verbose stack at /Users/roman/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/normalize-package-data/lib/normalize.js:32:38 4 verbose stack at Array.forEach (&lt;anonymous&gt;) 4 verbose stack at normalize (/Users/roman/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/normalize-package-data/lib/normalize.js:31:15) 4 verbose stack at final (/Users/roman/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/read-package-json/read-json.js:429:5) 4 verbose stack at then (/Users/roman/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/read-package-json/read-json.js:161:5) 4 verbose stack at /Users/roman/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/read-package-json/read-json.js:382:12 4 verbose stack at /Users/roman/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:123:16 4 verbose stack at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:71:3) 5 verbose cwd /Users/roman/Desktop/pycharm_projects/frontend 6 verbose Darwin 21.3.0 7 verbose argv &quot;/Users/roman/.nvm/versions/node/v14.20.0/bin/node&quot; &quot;/Users/roman/.nvm/versions/node/v14.20.0/bin/npm&quot; &quot;start&quot; 8 verbose node v14.20.0 9 verbose npm v6.14.17 10 error Invalid version: &quot;10-10-2022 -- 1685 -- every cell calls own pop w/out invisible block&quot; 11 verbose exit [ 1, true ] </code></pre> <p>I tried:</p> <ul> <li>npm install</li> <li>npm upgrade</li> </ul> <p>Nothing worked. I can't even google that, there's no results, please help</p>
[ { "answer_id": 74244956, "author": "Wazeed", "author_id": 6394979, "author_profile": "https://Stackoverflow.com/users/6394979", "pm_score": 1, "selected": false, "text": "play1" }, { "answer_id": 74244993, "author": "T.J. Crowder", "author_id": 157247, "author_profile...
2022/10/29
[ "https://Stackoverflow.com/questions/74244897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13246657/" ]
74,244,908
<p>I've tried to change from this matrix to another model very hard, but I can't work it out.</p> <p>Here are some details about my original matrix:</p> <pre><code>summary(tuPeru1naomit1) # Month YEAR LAT LONG Temp # APR : 73332 Min. :1980 Min. :-39.9 Min. :-89.5 Min. :10.78 # AUG : 73332 1st Qu.:1990 1st Qu.:-31.5 1st Qu.:-86.5 1st Qu.:17.58 # JUL : 73332 Median :2000 Median :-23.9 Median :-81.5 Median :19.60 # JUN : 73332 Mean :2000 Mean :-23.5 Mean :-81.6 Mean :19.58 # MAR : 73332 3rd Qu.:2011 3rd Qu.:-16.2 3rd Qu.:-77.5 3rd Qu.:21.72 # MAY : 73332 Max. :2021 Max. : -3.9 Max. :-70.5 Max. :29.84 # (Other):433444 head(tuPeru1naomit) # Month YEAR LAT LONG Temp #1 JAN 1980 -40.0 -89.5 17.5498 #2 JAN 1980 -39.5 -89.5 17.8718 #3 JAN 1980 -39.2 -89.5 18.1983 #4 JAN 1980 -38.9 -89.5 18.5264 #5 JAN 1980 -38.5 -89.5 18.8529 #6 JAN 1980 -38.2 -89.5 19.1596 </code></pre> <p>I'd like to have another matrix like this: <a href="https://i.stack.imgur.com/o2uFy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o2uFy.jpg" alt="Here is my goal matrix" /></a></p> <p>Thanks in advance!.</p>
[ { "answer_id": 74245076, "author": "Josh White", "author_id": 20289207, "author_profile": "https://Stackoverflow.com/users/20289207", "pm_score": 0, "selected": false, "text": "t()" }, { "answer_id": 74245181, "author": "AndS.", "author_id": 9778513, "author_profile":...
2022/10/29
[ "https://Stackoverflow.com/questions/74244908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13217887/" ]
74,244,933
<p>I need to design a function named firstN that, given a positive integer n, displays on the screen the first n integers on the same line, separated by white space.</p> <p>An example of using the function could be:</p> <pre><code>&gt;&gt;&gt; firstN(10) 0 1 2 3 4 5 6 7 8 9 </code></pre> <p>I have done this:</p> <pre><code>def firstN(n): for i in range(10): print (i, end=&quot; &quot;) firstN(10); </code></pre> <p>but I can't put end=&quot; &quot; because my teacher has a compiler that doesn't allow it</p>
[ { "answer_id": 74256078, "author": "Arifa Chan", "author_id": 19574157, "author_profile": "https://Stackoverflow.com/users/19574157", "pm_score": 0, "selected": false, "text": "def firstN(n):\n print(*(range(n)))\n\nfirstN(10)\n\n# 0 1 2 3 4 5 6 7 8 9\n" }, { "answer_id": 7426...
2022/10/29
[ "https://Stackoverflow.com/questions/74244933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19905670/" ]
74,244,936
<p>I only want to display the shadow effect without the square itself.</p> <p><a href="https://i.stack.imgur.com/KxWpk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KxWpk.png" alt="enter image description here" /></a></p> <p>here is the block code:</p> <pre><code>.light-blur-effect { height: 100px; width: 100px; background-color: #BEEEF5; opacity: 0.4; filter: drop-shadow(20px 20px 20px #BEEEF5); } </code></pre> <p>The only thing that came to mind is to do through opacity, but as you may guess, it didn’t help</p>
[ { "answer_id": 74256078, "author": "Arifa Chan", "author_id": 19574157, "author_profile": "https://Stackoverflow.com/users/19574157", "pm_score": 0, "selected": false, "text": "def firstN(n):\n print(*(range(n)))\n\nfirstN(10)\n\n# 0 1 2 3 4 5 6 7 8 9\n" }, { "answer_id": 7426...
2022/10/29
[ "https://Stackoverflow.com/questions/74244936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20365222/" ]
74,244,959
<p>I am trying on a code using React with an input and a button. When I click on a button I would like to clear the input or it is not the case. Here is my code :</p> <pre><code>import { useState } from &quot;react&quot;; import &quot;./styles.css&quot;; const App = () =&gt; { const [finalValue, setFinalValue] = useState(true); const changevalue = () =&gt; { setFinalValue(!finalValue); }; return ( &lt;div className=&quot;App&quot;&gt; {finalValue ? ( &lt;input type=&quot;text&quot; placeholder=&quot; E-mail&quot; className=&quot;mt-1 block w-full border-none bg-gray-100 h-11 rounded-xl shadow-lg hover:bg-blue-100 focus:bg-blue-100 focus:ring-0&quot; /&gt; ) : ( &lt;input type=&quot;text&quot; placeholder=&quot; Pseudo&quot; className=&quot;mt-1 block w-full border-none bg-gray-100 h-11 rounded-xl shadow-lg hover:bg-blue-100 focus:bg-blue-100 focus:ring-0&quot; /&gt; )} &lt;button onClick={() =&gt; changevalue()}&gt;Change input&lt;/button&gt; &lt;/div&gt; ); }; export default App; </code></pre> <p>Here is my code : <a href="https://codesandbox.io/s/wandering-fire-hj8d84?file=/src/App.js:0-823" rel="nofollow noreferrer">https://codesandbox.io/s/wandering-fire-hj8d84?file=/src/App.js:0-823</a></p> <p>Could you help me please ?</p> <p>Thank you very much !</p> <p>NB : I tried to use <code>value</code> but I was not able to type on the input and I also tried to use <code>defaultValue</code> without any success.</p>
[ { "answer_id": 74256078, "author": "Arifa Chan", "author_id": 19574157, "author_profile": "https://Stackoverflow.com/users/19574157", "pm_score": 0, "selected": false, "text": "def firstN(n):\n print(*(range(n)))\n\nfirstN(10)\n\n# 0 1 2 3 4 5 6 7 8 9\n" }, { "answer_id": 7426...
2022/10/29
[ "https://Stackoverflow.com/questions/74244959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20235980/" ]
74,244,988
<p>imagine I have a simple database like this</p> <p><a href="https://i.stack.imgur.com/l7sJy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l7sJy.png" alt="ERD" /></a></p> <p>I want to execute this SQL query using SQLAlchemy to get only 10 latest results of toys with certain Child_id belonging to some parent.</p> <pre><code>toys = Toy.query.filter(Toy.child_id == 77).filter(Child.parent_id == 'parent1').order_by(Toys.id.desc()).limit(limit).all() </code></pre> <p>But if I execute this, I get only 1 result.</p> <p>Echoing the query, I get</p> <pre><code>&quot;SELECT toys.id AS toys_id, toys.toy_type AS toy_type FROM toys, children WHERE toys.child_id = 77 ORDER BY records.id DESC LIMIT 10;&quot; </code></pre> <p>Executing this raw query, I get 10 of the same toys results.</p> <p>There is a total of 15 children of this parent. If I put the query limit to 20, I get 15 of the same toys results and 5 of the same different toys results. It always gives the number of the same toys results as the amount of children.</p> <p>So I guess it has something to do with the joining the tables and limiting the results...</p>
[ { "answer_id": 74245110, "author": "Gerballi", "author_id": 20358885, "author_profile": "https://Stackoverflow.com/users/20358885", "pm_score": -1, "selected": false, "text": "Session.query(Toys).filter(Child_id == 77).limit(10).all()" }, { "answer_id": 74245909, "author": "u...
2022/10/29
[ "https://Stackoverflow.com/questions/74244988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13027580/" ]
74,244,996
<p>I am trying to replace some IDs in a column.</p> <p>I am reading an excel file using <code>pd.read_excel</code> and storing it in a data frame:</p> <pre><code>df_A2C = pd.read_excel(file_loc1, index_col=None, na_values=['NA']) </code></pre> <p>This can be reproduced with</p> <pre><code>df_A2C = pd.DataFrame({'FROM_ID': [1, 1, 1, 1, 1], 'TO_ID': [7, 26, 71, 83, 98], 'DURATION_H': [0.528555555555556, 0.512511111111111, 0.432452777777778, 0.599486111111111, 0.590516666666667], 'DIST_KM': [38.4398, 37.38515, 32.57571, 39.26188, 35.53107]}) </code></pre> <p>After this, I am checking to see the values which I want to replace using this code: <code>df_A2C.loc[(df_A2C['FROM_ID'] == 9)]</code></p> <p><strong>This gives an output:</strong></p> <pre><code>FROM_ID TO_ID DURATION_H DIST_KM FROM_ID 9 7 1.183683 89.26777 9 9 26 1.167639 88.21312 9 9 71 1.087581 83.40369 9 9 83 1.254614 90.08985 9 9 98 1.245642 86.35904 9 </code></pre> <p>Now, I am trying to replace <code>FROM_ID</code> values <code>9</code> with <code>8</code>.</p> <p>I have tried the following codes.</p> <p><code>df_A2C['FROM_ID'] = df_A2C['FROM_ID'].replace('9','8')</code></p> <p>Also,</p> <p><code>df_A2C.loc[ df_A2C[&quot;FROM_ID&quot;] == &quot;9&quot;, &quot;FROM_ID&quot;] = &quot;8&quot;</code></p> <p>To test the results, I am doing <code>df_A2C.loc[(df_A2C['FROM_ID'] == 8)]</code></p> <p><strong>output:</strong></p> <pre><code>FROM_ID TO_ID DURATION_H DIST_KM FROM_ID </code></pre> <p>None of these are working.</p> <p>I want to replace <code>FROM_ID values</code> <code>9</code> with <code>8</code>. I do not want to create another column, just want to replace existing column values.</p> <p><strong>Am I making any mistakes here?</strong></p>
[ { "answer_id": 74245139, "author": "Rodrigo Guzman", "author_id": 13315525, "author_profile": "https://Stackoverflow.com/users/13315525", "pm_score": 3, "selected": true, "text": "df_A2C['FROM_ID'] = df_A2C['FROM_ID'].apply(lambda x: 8 if x==9 else x)\n" }, { "answer_id": 7428970...
2022/10/29
[ "https://Stackoverflow.com/questions/74244996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13373167/" ]
74,245,008
<p>I have these as <strong>strings</strong>: <code>{ column01 \ column02 \ column01 }</code>(for other countries <code>{ column01 , column02 , column01 }</code>). I want them evaluated as a array as if copy pasted.</p> <p><a href="https://i.stack.imgur.com/Q4Kdz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q4Kdz.png" alt="array range" /></a></p> <p>The array string range is created automatically, based on the selection of the user. I created a dynamically personalized dataset based on a sheet <code>studeertijden</code> named. The user can easily select the wanted tables by checkboxes, so by Google Sheets ARRAY range (formula). I try to copy these content to an other sheet ... to make the required data available for Google Data Studio.</p> <p>The contents of page <code>studeertijden</code> is NOT important. Let's say, a cell in <code>'legende-readme'!B39</code> returns a <strong>string</strong> with the required columns/data in a format like this:</p> <pre><code>{ studeertijden!A:A \ studeertijden!B:B} </code></pre> <p>If I put this in an empty sheet, by copy and paste, <strong>it works fine</strong> : <br/></p> <pre><code>={ studeertijden!A:A \ studeertijden!B:B} </code></pre> <p><strong>How can it be done automatically???</strong> <br/>my first thought was by <code>indirect</code> ...</p> <h5>What I've tried(Does NOT work):</h5> <p>Cell <code>'legende - readme'!B39</code> contains:<br/></p> <pre><code>{ studeertijden!A:A \ studeertijden!B:B} </code></pre> <ul> <li><code>=indirect('legende - readme'!B39)</code> <br/>returns :</li> </ul> <blockquote> <p><code>#REF!</code> - It is not a valid cell/range reference.</p> </blockquote> <ul> <li><code>={ indirect('legende - readme'!B39) }</code> returns :</li> </ul> <blockquote> <p><code>#REF!</code> - <code>It is not a valid cell/range reference.</code></p> </blockquote> <ul> <li><code>={'legende - readme'!B39}</code> <br/>returns : <code>{ studeertijden!A:A \ studeertijden!B:B}</code></li> </ul> <p><em>Note</em> : For European users, use a '\' [backslash] as the column separator. Instead of the ',' [comma].</p>
[ { "answer_id": 74246533, "author": "player0", "author_id": 5632629, "author_profile": "https://Stackoverflow.com/users/5632629", "pm_score": -1, "selected": false, "text": "={\"1\" , \"2\"}\n\n={\"1\" \\ \"2\"}\n" }, { "answer_id": 74247885, "author": "The God of Biscuits", ...
2022/10/29
[ "https://Stackoverflow.com/questions/74245008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1912544/" ]
74,245,037
<p>Problem: <code>isActive</code> (add active class to link) is not working.</p> <p>My NavLink component is not working. I posted this problem several times in stack overflow no one solved my problem instead of solving they are tagging another question which doesn't solve my problem.</p> <p>This is the home component:</p> <pre><code>import React from 'react'; // import Nav from './navbar'; import { NavLink } from &quot;react-router-dom&quot;; import &quot;../App.css&quot;; export default function home() { return ( &lt;div&gt; &lt;NavLink to=&quot;/&quot; style={isActive =&gt; ({ color: isActive ? &quot;green&quot; : &quot;blue&quot; })} &gt; home &lt;/NavLink&gt; &lt;NavLink to=&quot;/about&quot; style={isActive =&gt; ({ color: isActive ? &quot;green&quot; : &quot;blue&quot; })} &gt; about &lt;/NavLink&gt; &lt;h1&gt;Home page Here&lt;/h1&gt; &lt;/div&gt; ) } </code></pre> <p>This is the &quot;About&quot; component:</p> <pre><code>import React from 'react'; // import Nav from './navbar'; import { NavLink } from 'react-router-dom'; import &quot;../App.css&quot;; export default function about() { return ( &lt;&gt; &lt;NavLink to=&quot;/&quot; style={isActive =&gt; ({ color: isActive ? &quot;green&quot; : &quot;blue&quot;, backgroundColor: isActive ? &quot;red&quot; : &quot;white&quot; })} &gt; home &lt;/NavLink&gt; &lt;NavLink to=&quot;/about&quot; style={isActive =&gt; ({ color: isActive ? &quot;green&quot; : &quot;blue&quot;, backgroundColor: isActive ? &quot;red&quot; : &quot;white&quot; })} &gt; about &lt;/NavLink&gt; &lt;h1&gt;About page here&lt;/h1&gt; &lt;/&gt; ) } </code></pre> <p><a href="https://i.stack.imgur.com/uuHq3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uuHq3.png" alt="Result of this code" /></a></p> <p>I tried so many times and so many ways but the result is always same shown in above picture. I want <code>isActive</code> feature to work fine and should add active class when I click on about or anything else in navbar</p>
[ { "answer_id": 74246533, "author": "player0", "author_id": 5632629, "author_profile": "https://Stackoverflow.com/users/5632629", "pm_score": -1, "selected": false, "text": "={\"1\" , \"2\"}\n\n={\"1\" \\ \"2\"}\n" }, { "answer_id": 74247885, "author": "The God of Biscuits", ...
2022/10/29
[ "https://Stackoverflow.com/questions/74245037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17445692/" ]
74,245,041
<p>I have developed a project using identity server. I'm trying to query with a token I got from the identity server through an API. Two applications are running on the same pc. If I publish both the identity server and the api with the ip address, I get the following error when I make a request. How can I fix this error?</p> <p><a href="https://i.stack.imgur.com/1uysd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1uysd.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74246533, "author": "player0", "author_id": 5632629, "author_profile": "https://Stackoverflow.com/users/5632629", "pm_score": -1, "selected": false, "text": "={\"1\" , \"2\"}\n\n={\"1\" \\ \"2\"}\n" }, { "answer_id": 74247885, "author": "The God of Biscuits", ...
2022/10/29
[ "https://Stackoverflow.com/questions/74245041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3029067/" ]
74,245,043
<p>Given the following code in python which checks whether an string of <code>n</code> size is palindromic:</p> <pre><code>def is_palindromic(s): return all(s[i] == s[~i] for i in range(len(s) // 2)) </code></pre> <p>What is the space complexity of this code? Is it <code>O(1)</code> or <code>O(n)</code>?</p> <p>The <code>all</code> function <a href="https://docs.python.org/3/library/functions.html#all" rel="nofollow noreferrer">gets</a> an iterable as a parameter;</p> <p>So does it mean the <code>s[i] == s[~i] for i in range(len(s) // 2)</code> expression is an iterable (container) that stores <code>n</code> values in memory?</p> <p>Or maybe it behaves like an iterator that computes and returns the values one by one without any additional space?</p>
[ { "answer_id": 74246533, "author": "player0", "author_id": 5632629, "author_profile": "https://Stackoverflow.com/users/5632629", "pm_score": -1, "selected": false, "text": "={\"1\" , \"2\"}\n\n={\"1\" \\ \"2\"}\n" }, { "answer_id": 74247885, "author": "The God of Biscuits", ...
2022/10/29
[ "https://Stackoverflow.com/questions/74245043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7313912/" ]
74,245,080
<p>I am trying to change the value of a global variable using a function.</p> <p>Here is my js code:</p> <pre><code>var name=&quot;Samir&quot;; var status=true; function func1 () { status=false; name=&quot;sunny&quot; } func1(); console.log(name); console.log(status); </code></pre> <p>This works fine, but I was curious about how to implement the same functionality using typescript. Please guide me</p>
[ { "answer_id": 74246533, "author": "player0", "author_id": 5632629, "author_profile": "https://Stackoverflow.com/users/5632629", "pm_score": -1, "selected": false, "text": "={\"1\" , \"2\"}\n\n={\"1\" \\ \"2\"}\n" }, { "answer_id": 74247885, "author": "The God of Biscuits", ...
2022/10/29
[ "https://Stackoverflow.com/questions/74245080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17348251/" ]
74,245,100
<p>this question came in my onsite Amazon interview. Can someone come up with an optimizated solution? What data structure would you use to store the sessions?</p> <p>Given the start and end time of a session, find the maximum number of sessions that were active at the same time.</p> <p>Example:</p> <p>ID. Start Time , End Time</p> <ol> <li><p>1 , 4</p> </li> <li><p>3 , 5</p> </li> <li><p>2 , 7</p> </li> <li><p>5 , 10</p> </li> </ol> <p>Answer: 3</p> <p>I was able to come up with a brute-force solution. I stored the sessions in list of lists [[s1,e1],[s2,e2]]. I ran a loop for each unit of time through each session in the list and calculated the maximum number of overlaps. Obviously, this is not efficient. What can I use for a more efficient solution? Would it be better to store the start and end times in two different arrays?</p>
[ { "answer_id": 74247600, "author": "Nusrat Jahan", "author_id": 20315115, "author_profile": "https://Stackoverflow.com/users/20315115", "pm_score": 1, "selected": false, "text": "int maxSession( vector<vector<int>>meeting ){\n int sz = meeting.size();\n unordered_map<int, int> umap...
2022/10/29
[ "https://Stackoverflow.com/questions/74245100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14909389/" ]
74,245,105
<p>I have a pandas.DataFrame with data from various news articles in the Urdu language, and I'm using the Natural Language Toolkit (NLTK) to scrape through it for use in my n-gram language model. For this, I have to initially tokenise the data, which is stored in a <strong>'News Text'</strong> column inside my pandas.DataFrame, and then store it inside a list that will be used to find the n-grams. However, the data I have is very large, <strong>111,862</strong> rows (precisely), and using a <strong>'for'</strong> loop to iterate through the pandas.DataFrame is extremely slow, taking well over 30 minutes to iterate through all the rows in the specific column and store them inside a list.</p> <pre><code>for i in range(0, len(dataframe)): tokens+=nltk.tokenize.word_tokenize(str(dataframe[&quot;News Text&quot;][i])) </code></pre> <p>I was wondering if there's a faster way to iterate through all the rows in a specific column in the pandas.DataFrame, and then store the data inside a list. I'd appreciate any assistance regarding this! :)</p> <p><strong>N-Gram Language Model:</strong></p> <pre><code>dataframe=pd.read_excel(&quot;urdu-news-dataset-1M.xlsx&quot;) # Importing the dataset. dataframe=dataframe.drop([&quot;Index&quot;], axis=1) # Dropping any unnecessary columns from the dataset. tokens=[] for i in range(0, len(dataframe)): tokens+=nltk.tokenize.word_tokenize(str(dataframe[&quot;News Text&quot;][i])) # Tokenising all the words in the dataset, and storing them in a list. unigram=[] bigram=[] trigram=[] quadgram=[] quingram=[] tokenized_text=[] for token in tokens: token=list(map(lambda x: x.lower(), token)) # Converting all the words to lowercase. for word in token: if word== '.': token.remove(word) # Removing all the punctuations ('.'). else: unigram.append(word) # Appending all the words to the unigram list. tokenized_text.append(token) # Appending all the tokenised words to another list. # Finding all the bigrams, trigrams, quadgrams and quingrams (respectively). bigram.extend(list(nltk.ngrams(token, 2,pad_left=True, pad_right=True))) trigram.extend(list(nltk.ngrams(token, 3, pad_left=True, pad_right=True))) quadgram.extend(list(nltk.ngrams(token, 4, pad_left=True, pad_right=True))) quingram.extend(list(nltk.ngrams(token, 5, pad_left=True, pad_right=True))) # Finding the frequencies of all the bigrams, trigrams, quadgrams and quingrams (respectively). frequency_bigram=FreqDist(bigram) frequency_trigram=FreqDist(trigram) frequency_quadgram=FreqDist(quadgram) frequency_quingram=FreqDist(quingram) # Prediction model to find the subsequent word/sentence, given the previous word. # In this case, each &quot;word&quot; represents an alphabet from the Urdu lexicon. bigram_model=defaultdict(Counter) trigram_model=defaultdict(Counter) quadgram_model=defaultdict(Counter) quingram_model=defaultdict(Counter) for i, j in frequency_bigram: if(i!=None and j!=None): bigram_model[i][j]+=frequency_bigram[i,j] for i, j, k in frequency_trigram: if(i!=None and j!=None and k!=None): trigram_model[(i,j)][k]+=frequency_trigram[(i,j,k)] for i, j, k, l in frequency_quadgram: if(i!=None and j!=None and k!=None and l!=None): quadgram_model[(i,j,k)][l]+=frequency_quadgram[(i,j,k,l)] for i, j, k, l, m in frequency_quingram: if(i!=None and j!=None and k!=None and l!=None and m!=None): quingram_model[(i,j,k,l)][m]+=frequency_quingram[(i,j,k,l,m)] sentence=&quot;&quot; # Function to randomly return a word based on its occurrence in relation to the input word(s), from the dataset. def predict_word(count): return random.choice(list(count.elements())) input_words=&quot;ق&quot;, &quot;ب&quot; # Input words cannot be more than two at a time. # Otherwise, the index becomes out of range. print(&quot;&quot;.join(input_words)) sentence=&quot;&quot;.join(input_words) # Generating an article containing 200 words, using the n-gram language model. # The input words are the first two words of the article. # The last line of the output is the complete article. for i in range(0, 200): suffix=predict_word(trigram_model[input_words]) sentence=sentence+suffix print(sentence) input_words=input_words[1], suffix </code></pre> <p><strong>Example:</strong></p> <pre><code>for i in range(0, 500): # Iterates through the first 500 rows of the dataset. tokens+=nltk.tokenize.word_tokenize(str(dataframe[&quot;News Text&quot;][i])) </code></pre> <p><strong>Output:</strong></p> <pre><code> قب قبل قبلز قبلزم قبلزمی قبلزمیں قبلزمیںگ قبلزمیںگل قبلزمیںگلن قبلزمیںگلنگ قبلزمیںگلنگا قبلزمیںگلنگاو قبلزمیںگلنگاور قبلزمیںگلنگاوری قبلزمیںگلنگاوریو قبلزمیںگلنگاوریون قبلزمیںگلنگاوریونا قبلزمیںگلنگاوریونات قبلزمیںگلنگاوریوناتی قبلزمیںگلنگاوریوناتیا قبلزمیںگلنگاوریوناتیاد قبلزمیںگلنگاوریوناتیادہ قبلزمیںگلنگاوریوناتیادہن قبلزمیںگلنگاوریوناتیادہنا قبلزمیںگلنگاوریوناتیادہنائ ... قبلزمیںگلنگاوریوناتیادہنائیںفوڈشیخیاںوفاعظمارولیےیہیںکمالیادلہربرعیادیقاتھارتباریشگولترسیڈینئیںانہیںانےکرنے2800563006503610440902020091994707826300فیصداریاانڈزارینونستانٹسزاروبورٹیکھےکروںمزہترسدانبھی قبلزمیںگلنگاوریوناتیادہنائیںفوڈشیخیاںوفاعظمارولیےیہیںکمالیادلہربرعیادیقاتھارتباریشگولترسیڈینئیںانہیںانےکرنے2800563006503610440902020091994707826300فیصداریاانڈزارینونستانٹسزاروبورٹیکھےکروںمزہترسدانبھیم قبلزمیںگلنگاوریوناتیادہنائیںفوڈشیخیاںوفاعظمارولیےیہیںکمالیادلہربرعیادیقاتھارتباریشگولترسیڈینئیںانہیںانےکرنے2800563006503610440902020091994707826300فیصداریاانڈزارینونستانٹسزاروبورٹیکھےکروںمزہترسدانبھیمت قبلزمیںگلنگاوریوناتیادہنائیںفوڈشیخیاںوفاعظمارولیےیہیںکمالیادلہربرعیادیقاتھارتباریشگولترسیڈینئیںانہیںانےکرنے2800563006503610440902020091994707826300فیصداریاانڈزارینونستانٹسزاروبورٹیکھےکروںمزہترسدانبھیمتی </code></pre>
[ { "answer_id": 74247600, "author": "Nusrat Jahan", "author_id": 20315115, "author_profile": "https://Stackoverflow.com/users/20315115", "pm_score": 1, "selected": false, "text": "int maxSession( vector<vector<int>>meeting ){\n int sz = meeting.size();\n unordered_map<int, int> umap...
2022/10/29
[ "https://Stackoverflow.com/questions/74245105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17403667/" ]
74,245,113
<p>I am working with styling all my components and the only thing I can't make it is all cards the same size. what should I add to my styling to fix it? I used display grid for the cards and display flex insede of card, also I styled image but it still some of them are different size</p> <p><a href="https://i.stack.imgur.com/7rX3D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7rX3D.png" alt="enter image description here" /></a></p> <p>Here is my code ItemsComponent.js:</p> <pre><code>import React, { useState, useEffect } from &quot;react&quot;; import { Link } from &quot;react-router-dom&quot;; import &quot;./styles/ItemComponent.css&quot;; function ItemsComponent() { const [items, setItems] = useState([]); const [search, setSearch] = useState(&quot;&quot;); const [filterItems, setFilterItems] = useState(&quot;&quot;); // Fetching Data useEffect(() =&gt; { const fetchedData = async () =&gt; { try { const response = await fetch(`https://fakestoreapi.com/products`); const data = await response.json(); console.log(&quot;Data&quot;, data); setItems(data); } catch (error) { console.log(error); } }; fetchedData(); }, []); const handleSubmit = (e) =&gt; { e.preventDefault(); }; return ( &lt;&gt; &lt;main&gt; &lt;div className=&quot;search&quot;&gt; &lt;form onSubmit={handleSubmit}&gt; &lt;div className=&quot;search-items&quot;&gt; &lt;input type=&quot;text&quot; placeholder=&quot;Search...&quot; onChange={(e) =&gt; setSearch(e.target.value)} /&gt; &lt;button className=&quot;btn-light btn-search&quot;&gt;Search&lt;/button&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;div className=&quot;categories&quot;&gt; &lt;button className=&quot;btn-dark category&quot; onClick={() =&gt; setFilterItems(&quot;&quot;)} &gt; All &lt;/button&gt; &lt;button className=&quot;btn-dark category&quot; onClick={() =&gt; setFilterItems(&quot;men's clothing&quot;)} &gt; Men's Clothing &lt;/button&gt; &lt;button className=&quot;btn-dark category&quot; onClick={() =&gt; setFilterItems(&quot;women's clothing&quot;)} &gt; Women's Closing &lt;/button&gt; &lt;button className=&quot;btn-dark category&quot; onClick={() =&gt; setFilterItems(&quot;jewelery&quot;)} &gt; Jewelry &lt;/button&gt; &lt;button className=&quot;btn-dark category&quot; onClick={() =&gt; setFilterItems(&quot;electronics&quot;)} &gt; Electronics &lt;/button&gt; &lt;/div&gt; &lt;/main&gt; &lt;div className=&quot;grid-container&quot;&gt; {Array.from(items) .filter((item) =&gt; !filterItems || item.category === filterItems) .filter( (value) =&gt; !search || value.title.toLowerCase().includes(search.toLowerCase()) ) .map((item) =&gt; ( &lt;div key={item.id} className=&quot;item-container&quot;&gt; &lt;div className=&quot;card&quot;&gt; &lt;h3 className=&quot;title&quot;&gt;{item.title}&lt;/h3&gt; &lt;img src={item.image} alt={item.title} /&gt; &lt;h5 className=&quot;price&quot;&gt;£ {item.price}&lt;/h5&gt; &lt;button className=&quot;btn-dark btn-buy&quot;&gt; &lt;Link to={`/${item.id}`} className=&quot;btn-link&quot;&gt; Buy Now &lt;/Link&gt; &lt;/button&gt; &lt;/div&gt; &lt;/div&gt; ))} &lt;/div&gt; &lt;/&gt; ); } export default ItemsComponent; </code></pre> <p>And here css styling:</p> <pre><code>h2 { text-align: center; margin: 30px 0 auto auto; } /* Categories Style */ .categories { display: flex; justify-content: center; margin: 30px; } .category { margin: 0 20px; } .category:hover { background-color: var(--btn-light-color); color: var(--primary-dark-color); transition: 0.7; } /* Creating Item Card */ .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); grid-row: 1rem; gap: 2rem; justify-content: center; margin: 15rem auto; } .item-container { } .card { margin: 1rem; border-radius: 10px; box-shadow: 0 5px 20px rgba(88 88 88 /20%); display: flex; flex-direction: column; justify-content: space-between; max-width: 400px; padding: 1em 1em 1.5em; border-radius: 1px solid transparent; } img { display: block; max-width: 100px; height: 100px; height: auto; margin: 0 auto; } .price { text-align: center; margin: 10px 0; font-weight: 700; } .title { text-align: center; margin: 30px 15px; font-size: 18px; } /* style doesn't apply */ .btn-buy a .btn-link { text-decoration: none; color: var(--btn-light-color); } .btn-buy:hover { background-color: var(--secondary-dark-color); transition: 0.7; color: var(--primary-color); } /* Style Search Bar */ .search { display: flex; flex-direction: row; justify-content: center; margin-top: 3rem; } input { width: 500px; height: 30px; outline: none; padding: 7px; border: 1px solid var(--primary-dark-color); border-radius: 10px; margin: 30px 20px; } input:focus { box-shadow: 0 5px 20px rgba(88 88 88 /20%); } .btn-search { margin-left: 30px; } .btn-search:hover { background-color: var(--secondary-dark-color); color: var(--primary-color); transition: 0.7; } /* =======Media Queries (Tablets)========= */ @media screen and (max-width: 1024px) { .grid-container { grid-template-columns: 1fr 1fr; gap: 1.2rem; } input { width: 450px; } .btn-search { margin-left: 10px; } } /* ==========Media Queries (Mobies) ===========*/ @media screen and (max-width: 600px) { .grid-container { grid-template-columns: 1fr; gap: 1rem; } input { width: 300px; } } </code></pre> <p>Thank you in advince.</p>
[ { "answer_id": 74247600, "author": "Nusrat Jahan", "author_id": 20315115, "author_profile": "https://Stackoverflow.com/users/20315115", "pm_score": 1, "selected": false, "text": "int maxSession( vector<vector<int>>meeting ){\n int sz = meeting.size();\n unordered_map<int, int> umap...
2022/10/29
[ "https://Stackoverflow.com/questions/74245113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19831350/" ]
74,245,115
<p>I need to format a string dictionary before convert it into dict I tried it with regex:</p> <pre><code> decmark_reg = re.compile('(?&lt;=\d),(?=\d)') dict_decmark = decmark_reg.sub('.',dict_quotes) convertedDict = json.loads(dict_decmark) </code></pre> <p>but then I realized it mess with &quot;fingerOne_OffTimes&quot; values</p> <pre><code> dict_str = '{&quot;level&quot;:0,6, &quot;params&quot;:{ &quot;startLvlTime&quot;:1114.3851318359375, &quot;fingerOne_OffTimes&quot;:[459,4716491699219,78532]}} </code></pre> <p>desired result</p> <pre><code> dict_str = '{&quot;level&quot;:0.6, # 0,6 -&gt; 0.6 &quot;params&quot;:{ &quot;startLvlTime&quot;:1114.3851318359375, &quot;fingerOne_OffTimes&quot;:[459,4716491699219,78532]}} # no change </code></pre> <p>Would need a pattern that detect all comas but ones which have quot mark right behind</p>
[ { "answer_id": 74245143, "author": "Wiktor Stribiżew", "author_id": 3832970, "author_profile": "https://Stackoverflow.com/users/3832970", "pm_score": 0, "selected": false, "text": "decmark_reg = re.compile(r'(\\d+(?:,\\d+){2,})|(?<=\\d),(?=\\d)')\ndict_decmark = decmark_reg.sub(lambda x:...
2022/10/29
[ "https://Stackoverflow.com/questions/74245115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10245686/" ]
74,245,118
<p>I'm basically wondering if there is a difference in performance, or any other pros and cons, between the following 2 code snippets. Are there any objective reasons to use one over the other, or is it just personal preference?</p> <pre><code>const prop1 = useSelector((state) =&gt; state.appModel.prop1); const prop2 = useSelector((state) =&gt; state.appModel.prop2); const prop3 = useSelector((state) =&gt; state.appModel.prop3); const prop4 = useSelector((state) =&gt; state.appModel.prop4); </code></pre> <pre><code>const { prop1, prop2, prop3, prop4, } = useSelector((state) =&gt; ({ prop1: state.appModel.prop1, prop2: state.appModel.prop2, prop3: state.appModel.prop3, prop4: state.appModel.prop4, })); </code></pre> <p>The second option instinctively feels like it might be more performant, because it only uses useSelector once, but then I wonder if one property changing may cause more re-renders because they're all grouped together.</p> <p>UPDATE:</p> <p>Also wondering if this even shorter version has any pros and cons?</p> <pre><code>const { prop1, prop2, prop3, prop4 } = useSelector((state) =&gt; state.appModel); </code></pre> <p>Apologies if this is a duplicate, I tried searching but wasn't entirely sure of the terminology to search for, and couldn't see any matching examples.</p>
[ { "answer_id": 74245582, "author": "flosisa", "author_id": 20232830, "author_profile": "https://Stackoverflow.com/users/20232830", "pm_score": 1, "selected": false, "text": "string" } ]
2022/10/29
[ "https://Stackoverflow.com/questions/74245118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1818129/" ]
74,245,120
<p>The following Twilio code doesn't work. This is my webhook handler in an ASP.NET (Core) 6.0 app.</p> <pre><code>[AllowAnonymous] [HttpPost] [Route(&quot;webhook-url&quot;)] public IActionResult PostTwilioMessageReceived([FromForm] TwilioMessageReceivedFormModel formModel) { // logging code etc. var response = new Twilio.TwiML.MessagingResponse(); response.AddText($&quot;You sent '{formModel.Body}' but our systems are dumb and can't process this yet.&quot;); return new TwiMLResult(response); } </code></pre> <p>There are no errors. I don't receive the message, and my delivery status webhook doesn't appear to be called.</p> <p>The method above is called as I see it in my logs.</p> <p>Note - There is no &quot;to&quot; address. I have adapted sample code from Twilio's documentation which also does nothing to either read the sender address or configure the response with a recipient or other correlation ID.</p> <p><a href="https://www.twilio.com/docs/whatsapp/tutorial/send-and-receive-media-messages-whatsapp-csharp-aspnet#generate-twiml-in-your-application" rel="nofollow noreferrer">https://www.twilio.com/docs/whatsapp/tutorial/send-and-receive-media-messages-whatsapp-csharp-aspnet#generate-twiml-in-your-application</a></p> <hr /> <p>I've modified my logging to make doubly sure my webhook is being called. It is. And in Twilio's log there's no acknowledgement of the reply my webhook attempts to produce.</p> <p>To be clear, the code above is using Twilio's libraries.</p>
[ { "answer_id": 74246578, "author": "IObert", "author_id": 3821022, "author_profile": "https://Stackoverflow.com/users/3821022", "pm_score": 0, "selected": false, "text": "text/xml" }, { "answer_id": 74280056, "author": "Swimburger", "author_id": 2919731, "author_profi...
2022/10/29
[ "https://Stackoverflow.com/questions/74245120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/107783/" ]
74,245,130
<p>I'm trying to make something like a &quot;clicker&quot; on buttons for 2 person's, but my variable +=1 is not working in this program. My code:</p> <pre><code>from tkinter import * import turtle wn = turtle.Screen() wn.title(&quot;Pong by Daniel&quot;) wn.bgcolor(&quot;black&quot;) wn.setup(width=800, height=600) wn.tracer(0) score_a = 0 score_b = 0 pen = turtle.Turtle() pen.speed(0) pen.color(&quot;white&quot;) pen.penup() pen.hideturtle() pen.goto(0, 240) pen.write(&quot;a:0 b: 0&quot;, align=&quot;center&quot;, font=(&quot;Courier&quot;, 24, &quot;normal&quot;)) button_a = Button( text=&quot;a&quot;) button_a.place(x=530, y=300) button_b = Button( text=&quot;b&quot;) button_b.place(x=130, y=300) def button_a(): score_a+= 1 pen.clear() pen.write(&quot;a:{} b: {}&quot;.format(score_a, score_b), align=&quot;center&quot;, font=(&quot;Courier&quot;, 24, &quot;normal&quot;)) def button_b(): score_b += 1 pen.clear() pen.write(&quot;a:{} b: {}&quot;.format(score_a, score_b), align=&quot;center&quot;, font=(&quot;Courier&quot;, 24, &quot;normal&quot;)) while True: wn.update() turtle.onclick(button_a) turtle.onclick(button_b) </code></pre> <p>i cant put those variables in def, bcs it would reset all the time(i think), somebody have any idea, opinion on this? Im new in programming, and need to learn a lot.</p> <p>I have tried using it without def, but i need it when im using turtle.onclick, i dont know how to move from this point.</p>
[ { "answer_id": 74246578, "author": "IObert", "author_id": 3821022, "author_profile": "https://Stackoverflow.com/users/3821022", "pm_score": 0, "selected": false, "text": "text/xml" }, { "answer_id": 74280056, "author": "Swimburger", "author_id": 2919731, "author_profi...
2022/10/29
[ "https://Stackoverflow.com/questions/74245130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20365399/" ]
74,245,131
<p>I'm trying to create a Springboot Get API endpoint but I get a 404 not found error' here is my code</p> <p>profile.java</p> <pre><code>@Getter @Setter public class Profile { private String slackUsername; private Boolean backend; private Integer age; private String bio; </code></pre> <p>ProfileController</p> <pre><code>@RestController public class ProfileController { @Autowired private Profile profile; @GetMapping(path = &quot;/profile&quot;) private ResponseEntity&lt;String&gt; userInfo(){ profile.setSlackUsername(&quot;Ajava&quot;); profile.setBackend(true); profile.setAge(00); profile.setBio(&quot;My name is Anakhe Ajayi, I'm learning Java everyday and I love Jesus&quot;); return ResponseEntity.ok(profile.toString()); } </code></pre> <p>Main</p> <pre><code>@SpringBootApplication @ComponentScan(&quot;com/ajavacode/HNGBackendStage1/api.profile&quot;) public class HngBackendStage1Application { public static void main(String[] args) { SpringApplication.run(HngBackendStage1Application.class, args); } } </code></pre> <p><a href="https://i.stack.imgur.com/6Oc9t.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6Oc9t.png" alt="Project folder structur" /></a></p> <p>porm.xml <a href="https://i.stack.imgur.com/PQ7XC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PQ7XC.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74246578, "author": "IObert", "author_id": 3821022, "author_profile": "https://Stackoverflow.com/users/3821022", "pm_score": 0, "selected": false, "text": "text/xml" }, { "answer_id": 74280056, "author": "Swimburger", "author_id": 2919731, "author_profi...
2022/10/29
[ "https://Stackoverflow.com/questions/74245131", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17266758/" ]
74,245,144
<p>I would like to check an input (parameter) of a stored procedure if it has many spaces and empty, not just 1 space like so: <code>' '</code> '. I tried :</p> <pre><code>IF column IS NULL or TRIM(column IS NULL) THEN RAICE NOTICE 'input is empty spaces'; END IF; </code></pre> <p>But the spaces input still passes through.</p>
[ { "answer_id": 74246578, "author": "IObert", "author_id": 3821022, "author_profile": "https://Stackoverflow.com/users/3821022", "pm_score": 0, "selected": false, "text": "text/xml" }, { "answer_id": 74280056, "author": "Swimburger", "author_id": 2919731, "author_profi...
2022/10/29
[ "https://Stackoverflow.com/questions/74245144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19855121/" ]
74,245,175
<p>I am new in ReactJs. I have code below:</p> <pre><code>{users.map((user, index) =&gt; ( &lt;tr key={user.id}&gt; &lt;td&gt;{ index+1 }&lt;/td&gt; &lt;td&gt;{user.name}&lt;/td&gt; &lt;td&gt;{user.email}&lt;/td&gt; &lt;td&gt;{user.gender}&lt;/td&gt; &lt;td&gt;{user.status}&lt;/td&gt; &lt;/tr&gt; ))} </code></pre> <p>My question is how to add if condition in the code, e.g:</p> <pre><code>if (user.status) == &quot;0&quot; return &quot;In-Active&quot; else if (user.status) == &quot;1&quot; return &quot;Active&quot; else if (user.status) == &quot;2&quot; return &quot;Disabled&quot; </code></pre>
[ { "answer_id": 74245209, "author": "Varun Kaklia", "author_id": 18574568, "author_profile": "https://Stackoverflow.com/users/18574568", "pm_score": 0, "selected": false, "text": "{users.map((user, index) => ( \n <tr key={user.id}> \n <td>{ index+1 }</td> \n <td>{user.nam...
2022/10/29
[ "https://Stackoverflow.com/questions/74245175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2944921/" ]
74,245,218
<p>I have 2 queries, customers and contacts and I want to show the orders of each customer in a sheet in excel as follows:</p> <p><strong>CUSTOMERS</strong></p> <pre><code>ID NAME 1 CLIENT A 2 CLIENT B 3 CLIENT C </code></pre> <p><strong>CONTACTS</strong></p> <pre><code>ID CUSTOMER_ID NAME PHONE 1 1 NAME 1 999 2 1 NAME 2 000 3 2 NAME 3 888 4 2 NAME 4 333 5 2 NAME 5 111 6 3 NAME 6 777 7 3 NAME 7 555 8 1 NAME 8 444 </code></pre> <p><strong>RESULT</strong></p> <pre><code>CLIENT A NAME 1 999 NAME 2 000 NAME 8 444 CLIENT B NAME 3 888 NAME 4 333 NAME 5 111 CLIENT C NAME 6 777 NAME 7 555 </code></pre> <p>I don't know much about Excel and I need some guidance on how to do it.</p> <p>Thanks</p>
[ { "answer_id": 74245717, "author": "Mayukh Bhattacharya", "author_id": 8162520, "author_profile": "https://Stackoverflow.com/users/8162520", "pm_score": 2, "selected": true, "text": "let\n\n //Source Table CONTACTStbl\n SourceOne = Excel.CurrentWorkbook(){[Name=\"CONTACTStbl\"]}[Co...
2022/10/29
[ "https://Stackoverflow.com/questions/74245218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2426415/" ]
74,245,220
<p>Tell me how to optimize the deletion of data from a Postgre table I have a table like this:</p> <pre><code>CREATE TABLE IF NOT EXISTS test ( group varchar(255), id varchar(255), type varchar(255), ); INSERT INTO test (group, id, type) VALUES ('1', 'qw', 'START'), ('1', 'er', 'PROCESS'), ('1', 'ty', 'FINISH'); INSERT INTO test (group, id, type) VALUES ('2', 'as', 'START'), ('2', 'df', 'PROCESS'), ('2', 'fg', 'ERROR'); INSERT INTO test (group, id, type) VALUES ('3', 'zx', 'START'), ('3', 'cv', 'PROCESS'), ('3', 'ty', 'ERROR'); INSERT INTO test (group, id, type) VALUES ('4', 'df', 'START'), ('4', 'gh', 'PROCESS'), ('4', 'fg', 'ERROR'), ('4', 'ty', 'FINISH'); </code></pre> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>group</th> <th>id</th> <th>type</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>qw</td> <td>START</td> </tr> <tr> <td>1</td> <td>er</td> <td>PROCESS</td> </tr> <tr> <td>1</td> <td>ty</td> <td>FINISH</td> </tr> <tr> <td>2</td> <td>as</td> <td>START</td> </tr> <tr> <td>2</td> <td>df</td> <td>PROCESS</td> </tr> <tr> <td>2</td> <td>fg</td> <td>ERROR</td> </tr> <tr> <td>3</td> <td>zx</td> <td>START</td> </tr> <tr> <td>3</td> <td>cv</td> <td>PROCESS</td> </tr> <tr> <td>3</td> <td>ty</td> <td>ERROR</td> </tr> <tr> <td>4</td> <td>df</td> <td>START</td> </tr> <tr> <td>4</td> <td>gh</td> <td>PROCESS</td> </tr> <tr> <td>4</td> <td>fgv</td> <td>ERROR</td> </tr> <tr> <td>4</td> <td>ty</td> <td>FINISH</td> </tr> </tbody> </table> </div> <p>It contains operations combined by one value in the GROUP field But not all operations reach the end and do not have an operation with the value FINISH in the list, but have type ERROR, like the rows with GROUP 2 and 3 This table is 1 terabyte I want to delete all chains of operations that did not end with the FINISH status, what is the best way to optimize this?</p> <p>My code looks like this:</p> <pre><code>delete from TEST for_delete where for_delete.group in ( select group from TEST error where error.type='ERROR' and error.group NOT IN (select group from TEST where type='FINISH') ); </code></pre> <p>But for a plate with such a volume, I think it will be terribly slow, can I somehow improve my code?</p>
[ { "answer_id": 74245921, "author": "a_horse_with_no_name", "author_id": 330315, "author_profile": "https://Stackoverflow.com/users/330315", "pm_score": 2, "selected": false, "text": "NOT EXISTS" }, { "answer_id": 74245959, "author": "Francesco Della Maggiora", "author_id"...
2022/10/29
[ "https://Stackoverflow.com/questions/74245220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20003532/" ]
74,245,229
<p>I'm working with a list of notes in React Native, and I was using a bad-performant method to select/deselect the notes when I'm &quot;edit mode&quot;. Everytime I selected a note, the application had to re-render the entire list everytime. If I do a test with 100 notes, I get input lags when I select/deselect a note, obviously.</p> <p>So I decided to move the &quot;select state&quot; to the single Child component. By doing this, I'm having the re-render only on that component, so it's a huge improvement of performance. Until here, everything's normal.</p> <p>The problem is when I'm disabling edit mode. If I select, for example, 3 notes, and I disable the &quot;edit mode&quot;, those notes will remain selected (indeed also the style will persist). I'd like to reset the state of all the selected note, or finding a valid alternative.</p> <p>I recreated the scene using React (not React Native) on CodeSandbox with a Parent and a Child: <a href="https://codesandbox.io/s/loving-field-bh0k9k" rel="nofollow noreferrer">https://codesandbox.io/s/loving-field-bh0k9k</a></p> <p>The behavior is exactly the same. I hope you can help me out. Thanks.</p> <p><strong>tl;dr</strong>:</p> <p><em>Use-case</em>:</p> <ol> <li>Go in Edit Mode by selecting a note for .5s</li> <li>Select 2/3 elements by clicking on them</li> <li>Disable Edit Mode by selecting a note for .5s</li> </ol> <p><em>Expectation</em>: all elements get deselected (state of children resetted)</p> <p><em>Reality</em>: elements don't get deselected (state of children remains the same)</p>
[ { "answer_id": 74245921, "author": "a_horse_with_no_name", "author_id": 330315, "author_profile": "https://Stackoverflow.com/users/330315", "pm_score": 2, "selected": false, "text": "NOT EXISTS" }, { "answer_id": 74245959, "author": "Francesco Della Maggiora", "author_id"...
2022/10/29
[ "https://Stackoverflow.com/questions/74245229", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6830511/" ]
74,245,242
<p>I want to perform the selection of a group of lines in a text file to get all jobs related to an ipref The test file is like this : job numbers : (1,2,3), ip ref : (10,12,10)</p> <p>text file : 1 ... (several lines of text) xxx 10 2 ... (several lines of text) xxx 12 3 ... (several lines of text) xxx 10</p> <p>i want to select job numbers for IPref=10.</p> <p>Code :</p> <pre><code>#!/usr/bin/python import re import sys fic=open('test2.xml','r') texte=fic.read() fic.close() #pattern='\n?\d(?!(?:\n?xxx \d{2}\n)*)xxx 10' pattern='\n?\d.*?xxx 10' result= re.findall(pattern,texte, re.DOTALL) i=1 for match in result: print(&quot;\nmatch:&quot;,i) i=i+1 print(match) </code></pre> <p>Result :</p> <pre><code>match: 1 1 a b xxx 10 match: 2 1 a b xxx 12 1 a b xxx 10 </code></pre> <p>i have tried to replace .* by a a negative lookahead assertion to only select if no expr like <code>&quot;\n?xxx \d{2}\n&quot;</code> is before &quot;xxx 10&quot; :</p> <pre><code>pattern='\n?\d(?!(?:\n?xxx \d{2}\n)*)xxx 10' </code></pre> <p>but it is not working ...</p>
[ { "answer_id": 74245277, "author": "The fourth bird", "author_id": 5424988, "author_profile": "https://Stackoverflow.com/users/5424988", "pm_score": 2, "selected": true, "text": "^\\d(?:\\n(?!xxx \\d+$).*)*\\nxxx 10$\n" }, { "answer_id": 74245469, "author": "Frederic Faure", ...
2022/10/29
[ "https://Stackoverflow.com/questions/74245242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20365230/" ]
74,245,244
<p>I was testing release mode of my app and the firebase auth is not working, so i google it and find out that i have to register SHA1 for release mode, and to get it we need keysotre file which i generated using command:</p> <pre><code>keytool -genkey -v -keystore release.keystore -alias AndroidReleaseKey -keyalg RSA -keysize 2048 -validity 10000 </code></pre> <p>i was taking help of this documentaion: <a href="https://docs.flutter.dev/deployment/android" rel="nofollow noreferrer">Click here</a></p> <p>and <a href="https://stackoverflow.com/questions/20453249/apk-signing-error-failed-to-read-key-from-keystore">THIS STACKOVERFLOW QUESTION</a></p> <p>but now when i run <code>./gradlew signingreport</code> i am getting this</p> <p><a href="https://i.stack.imgur.com/fbhUG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fbhUG.png" alt="getting somthing unespacted result" /></a></p> <p>i want the SHA1 key for release mode can anyone help me through it and also my android studio is not working fine so give me answers that doesn't require it.</p>
[ { "answer_id": 74245277, "author": "The fourth bird", "author_id": 5424988, "author_profile": "https://Stackoverflow.com/users/5424988", "pm_score": 2, "selected": true, "text": "^\\d(?:\\n(?!xxx \\d+$).*)*\\nxxx 10$\n" }, { "answer_id": 74245469, "author": "Frederic Faure", ...
2022/10/29
[ "https://Stackoverflow.com/questions/74245244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17878348/" ]
74,245,260
<p>I currently have a simple method which initiate a <code>ChromeDriver</code> using the following method:</p> <pre><code>public void ChromeDriver() { ChromeDriverStart(); } </code></pre> <p><code>ChromeDriverStart()</code> refers to a public method in which I set the options for the driver which I have set using <code>IWebDriver</code>. Now let's say I will initiate a driver named <code>driverx</code>, I only want it to be initiated if there is not already an instance of <code>driverx </code> active. So far I tried the following if-statement inside the method: <code>if (driverx = null) </code></p> <p>My goal is to not start another instance of driverx when calling the method ChromeDriver().</p> <p>Whole Code:</p> <pre><code>public IWebDriver 1driver; public IWebDriver 2driver; public IWebDriver 3driver; public IWebDriver 4driver; public void DriverStart() { 1driver = new ChromeDriver(); } public void Driver() { if (driver1 = null) { DriverStart(); } } </code></pre>
[ { "answer_id": 74245277, "author": "The fourth bird", "author_id": 5424988, "author_profile": "https://Stackoverflow.com/users/5424988", "pm_score": 2, "selected": true, "text": "^\\d(?:\\n(?!xxx \\d+$).*)*\\nxxx 10$\n" }, { "answer_id": 74245469, "author": "Frederic Faure", ...
2022/10/29
[ "https://Stackoverflow.com/questions/74245260", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20365482/" ]
74,245,335
<p>I am looking to have something run once when the react app first loads and only the one time. At first, one is inclined to make use of the <code>useEffect</code> hook:</p> <pre><code> useEffect(() =&gt; { console.log(&quot;Effect hook.&quot;); }, []); </code></pre> <p>The problem with this approach is that when I put it in my <code>App</code> component, the <code>useEffect</code> hook runs <strong>AFTER</strong> mounting. Subsequently, the following will fail because stuff won't be defined when the child component renders:</p> <pre class="lang-js prettyprint-override"><code>function App() { let stuff; // Define the supported configs on mount. This will only run at mount time. useEffect(() =&gt; { console.log(&quot;Effect hook.&quot;); stuff = getSomeStuff(); }, []); // console.log(&quot;About to return.&quot;); return ( &lt;div&gt; &lt;ComponentThatNeedsStuff stuff={stuff} /&gt; &lt;/div&gt; ); } </code></pre> <p>and you will see the following printed:</p> <pre><code>About to return. Effect hook. </code></pre> <p>If you only want the function <code>getSomeStuff</code> to run once but you need the stuff for child components, what is the best way to handle that?</p>
[ { "answer_id": 74245381, "author": "7.oz", "author_id": 12564580, "author_profile": "https://Stackoverflow.com/users/12564580", "pm_score": 2, "selected": false, "text": "const App = () => {\n const [stuff, setStuff] = useState();\n\n useEffect(() => {\n console.log(\"Effect hook.\"...
2022/10/29
[ "https://Stackoverflow.com/questions/74245335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4427375/" ]
74,245,342
<p>As the title suggests I'm trying to send a Post request using a token granted via oauth2, The problem is that the request is rejected by the server and the error code is</p> <p>OpenSSL Error messages: error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure</p> <p>My code:</p> <pre><code> $url = &quot;https://webserviceapl.anaf.ro/test/FCTEL/rest/upload?standard=UBL&amp;cif=18220220&quot;; $curl = curl_init($url); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $headers = array( &quot;Accept: application/json&quot;, &quot;Authorization: Bearer /*my token here*/&quot;, &quot;Content-Type: application/json&quot;, &quot;Content-Length: 0&quot;, ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); //curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); //curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $resp = curl_exec($curl); $err = curl_error($curl); curl_close($curl); var_dump($err); var_dump($resp); </code></pre> <p>I tried disabling ssl verification that resulted with the same error.</p> <p>I have the impression that the server wants me to present something other than the bearer token, like</p> <pre><code>//curl_setopt($curl, CURLOPT_CAINFO, $caFile); //curl_setopt($curl, CURLOPT_SSLKEY, $keyFile); //curl_setopt($curl, CURLOPT_SSLCERT, $certFile); //curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $certPass); </code></pre> <p>But I have no idea from where to get a valid certificate.</p> <p>The bearer token (if that is what I got) was granted to me via Postman App. The flow was: Registration with username/password, got a user id/secret, setup auth url, callback url, token url, made the request from postman, the server gave me a code which i exchanged for the token. At the exchange moment the server asked for a certificate stored on a thumb drive. I entered the thumbs password and received the token. The thumb itself it's enrolled in their system for my comapny.</p> <p>Any help pointing me in the right direction is appreciated</p> <p>Open ssl flags a problem with self signed certificate on my side and with No client certificate CA names sent. It points to the same error that my code gets, meaning: 50370000:error:0A000410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:ssl\record\rec_layer_s3.c:1584:SSL alert number 40</p> <pre><code>C:\Users\77BBA&gt;openssl s_client -showcerts -servername webserviceapl.anaf.ro -connect webserviceapl.anaf.ro:443 CONNECTED(000001AC) depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA verify error:num=19:self-signed certificate in certificate chain verify return:1 depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA verify return:1 depth=1 C = US, O = &quot;DigiCert, Inc.&quot;, CN = RapidSSL Global TLS RSA4096 SHA256 2022 CA1 verify return:1 depth=0 CN = *.anaf.ro verify return:1 50370000:error:0A000410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:ssl\record\rec_layer_s3.c:1584:SSL alert number 40 --- Certificate chain 0 s:CN = *.anaf.ro i:C = US, O = &quot;DigiCert, Inc.&quot;, CN = RapidSSL Global TLS RSA4096 SHA256 2022 CA1 a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256 v:NotBefore: Sep 16 00:00:00 2022 GMT; NotAfter: Sep 16 23:59:59 2023 GMT -----BEGIN CERTIFICATE----- MIIHhjCCBW6gAwIBAgIQD3EWjbe8XpRkIZ5HV4H7IzANBgkqhkiG9w0BAQsFADBc MQswCQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xNDAyBgNVBAMT K1JhcGlkU1NMIEdsb2JhbCBUTFMgUlNBNDA5NiBTSEEyNTYgMjAyMiBDQTEwHhcN MjIwOTE2MDAwMDAwWhcNMjMwOTE2MjM1OTU5WjAUMRIwEAYDVQQDDAkqLmFuYWYu cm8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvVtPBtnNqMFOBVR6E xWwFcvajFV/sF3nhWTtYVGVi5BRF6ZyMQLRkvp/H9b9hwZZJxvqV6tudMJx7Aoee itzmoL9togWLXKBlSSJIxrhULH9eiG7H39R+KJ0BoRYmuVbL2Ycza6zAhFF1dtyu B3ArITpBGusgULSCBMoJVOrpfXY5IUIQREv/ael/Vc/zAtyzcYRGYdbzIJkKi2n+ Qu/7i7y7f/p70he8xqNYRCX3Z72qg83W8five+0TPf9F9HutmolKjDWv6kK6Krh4 hHUiINMHT57uRHIiBfzY7yoKtIduGqUbhaL5FgmnWaP2bOhvQ+DQkrbLA+KzG5yP Jqx3AgMBAAGjggOKMIIDhjAfBgNVHSMEGDAWgBTwnIX9op99j8lou9XUiU0dvtOQ /zAdBgNVHQ4EFgQUUvGNbwLTelD2DQlF4p0GyyJ/jwIwHQYDVR0RBBYwFIIJKi5h bmFmLnJvggdhbmFmLnJvMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEF BQcDAQYIKwYBBQUHAwIwgZ8GA1UdHwSBlzCBlDBIoEagRIZCaHR0cDovL2NybDMu ZGlnaWNlcnQuY29tL1JhcGlkU1NMR2xvYmFsVExTUlNBNDA5NlNIQTI1NjIwMjJD QTEuY3JsMEigRqBEhkJodHRwOi8vY3JsNC5kaWdpY2VydC5jb20vUmFwaWRTU0xH bG9iYWxUTFNSU0E0MDk2U0hBMjU2MjAyMkNBMS5jcmwwPgYDVR0gBDcwNTAzBgZn gQwBAgEwKTAnBggrBgEFBQcCARYbaHR0cDovL3d3dy5kaWdpY2VydC5jb20vQ1BT MIGHBggrBgEFBQcBAQR7MHkwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmRpZ2lj ZXJ0LmNvbTBRBggrBgEFBQcwAoZFaHR0cDovL2NhY2VydHMuZGlnaWNlcnQuY29t L1JhcGlkU1NMR2xvYmFsVExTUlNBNDA5NlNIQTI1NjIwMjJDQTEuY3J0MAkGA1Ud EwQCMAAwggF9BgorBgEEAdZ5AgQCBIIBbQSCAWkBZwB2AOg+0No+9QY1MudXKLyJ a8kD08vREWvs62nhd31tBr1uAAABg0U4G3IAAAQDAEcwRQIgXKXP6DyHVLE6JjKH 6EdCbQ7Z8/jItUgCS8SQUNf4+FsCIQDLeSgcBVBYX9U23rJDS6lU/9xvqy1IrzX3 58OzDUzGSAB2ADXPGRu/sWxXvw+tTG1Cy7u2JyAmUeo/4SrvqAPDO9ZMAAABg0U4 G7IAAAQDAEcwRQIgAVrKviO7Hfs1/+ECK9tj8veA250WD3Kshh9XlR2rlnsCIQDx FGyhayXK2XGbooiOxh4dQ6AEm/dmqSHj0bPywRfXiQB1ALNzdwfhhFD4Y4bWBanc EQlKeS2xZwwLh9zwAw55NqWaAAABg0U4G+oAAAQDAEYwRAIgd0uk8Rgo1nECf2sa iFWmPFAcrbnSAB2ZmpgjkmP22mYCIEPh2eUFRVB7YsQfCM9QehZNiFpXRg6zQ4Da aIWWiWftMA0GCSqGSIb3DQEBCwUAA4ICAQAs4jrVxMPmq2v4j8aK8oUhGWPjaKot CjRS4QA/DhSYOL7qcDDaRmx90p9SVtXTSm+SfVYKgHAFL7rWZ+w0YZnKMFzrKavk zMqyA8IsFTEGMvL/lOu8uGD7Jbxm81dwBUHrynUXr6Y24T3hlVjo7OjfSfd7hL3x hgH0DA3d7B5+jFVogxrzJeqw+ZQAOWYo+YKTqxIfcaOZKzHIs1EjqBHwK6JUkOj1 J+2cYDT8hSGPwaNpeJ5YKVWwYtLM9JPWsZOCrzZHwCshu8kD5sgpZFmLNnclJZcn mb65/ccoHVsxQl2pK3N8GUBddronSWoTIjnbC+/FsphYNYhGy9nSTkKCU8KawiaD 3+c3lucnS3VmTqHTclvIVQazWq5eEDkNPtZSrTxyNWTJXPHhRomAOFc4YP3xYYmi e96Ff6SRe+El0E38Y0bqv4fn6GmOoTnn2N4SNE3bZL42o0y37Ft800KI8dfhYxAl Cqe1iGFLyLPF8IxXNKdNZLppQoriDQcPHkP9ReRmBJX1d0Ge39/QD7Wmee6pK1ku mfg0cF0Poj0IzIpPcS3chIpO57lz3Xf3IRoea68aXEPwbPfsg1dD8rj+ZS0iqrGh +4ZAXu8rMEyy1VXUklfCIcGDeNzQZ8JJSGKKpaYq3VazcHxEMUOtm7ZE+tXO7pnG efpIQNy9XE/14w== -----END CERTIFICATE----- 1 s:C = US, O = &quot;DigiCert, Inc.&quot;, CN = RapidSSL Global TLS RSA4096 SHA256 2022 CA1 i:C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA a:PKEY: rsaEncryption, 4096 (bit); sigalg: RSA-SHA256 v:NotBefore: May 4 00:00:00 2022 GMT; NotAfter: Nov 9 23:59:59 2031 GMT -----BEGIN CERTIFICATE----- MIIFyzCCBLOgAwIBAgIQCgWbJfVLPYeUzGYxR3U4ozANBgkqhkiG9w0BAQsFADBh MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD QTAeFw0yMjA1MDQwMDAwMDBaFw0zMTExMDkyMzU5NTlaMFwxCzAJBgNVBAYTAlVT MRcwFQYDVQQKEw5EaWdpQ2VydCwgSW5jLjE0MDIGA1UEAxMrUmFwaWRTU0wgR2xv YmFsIFRMUyBSU0E0MDk2IFNIQTI1NiAyMDIyIENBMTCCAiIwDQYJKoZIhvcNAQEB BQADggIPADCCAgoCggIBAKY5PJhwCX2UyBb1nelu9APen53D5+C40T+BOZfSFaB0 v0WJM3BGMsuiHZX2IHtwnjUhLL25d8tgLASaUNHCBNKKUlUGRXGztuDIeXb48d64 k7Gk7u7mMRSrj+yuLSWOKnK6OGKe9+s6oaVIjHXY+QX8p2I2S3uew0bW3BFpkeAr LBCU25iqeaoLEOGIa09DVojd3qc/RKqr4P11173R+7Ub05YYhuIcSv8e0d7qN1sO 1+lfoNMVfV9WcqPABmOasNJ+ol0hAC2PTgRLy/VZo1L0HRMr6j8cbR7q0nKwdbn4 Ar+ZMgCgCcG9zCMFsuXYl/rqobiyV+8U37dDScAebZTIF/xPEvHcmGi3xxH6g+dT CjetOjJx8sdXUHKXGXC9ka33q7EzQIYlZISF7EkbT5dZHsO2DOMVLBdP1N1oUp0/ 1f6fc8uTDduELoKBRzTTZ6OOBVHeZyFZMMdi6tA5s/jxmb74lqH1+jQ6nTU2/Mma hGNxUuJpyhUHezgBA6sto5lNeyqc+3Cr5ehFQzUuwNsJaWbDdQk1v7lqRaqOlYjn iomOl36J5txTs0wL7etCeMRfyPsmc+8HmH77IYVMUOcPJb+0gNuSmAkvf5QXbgPI Zursn/UYnP9obhNbHc/9LYdQkB7CXyX9mPexnDNO7pggNA2jpbEarLmZGi4grMmf AgMBAAGjggGCMIIBfjASBgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQWBBTwnIX9 op99j8lou9XUiU0dvtOQ/zAfBgNVHSMEGDAWgBQD3lA1VtFMu2bwo+IbG8OXsj3R VTAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMC MHYGCCsGAQUFBwEBBGowaDAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuZGlnaWNl cnQuY29tMEAGCCsGAQUFBzAChjRodHRwOi8vY2FjZXJ0cy5kaWdpY2VydC5jb20v RGlnaUNlcnRHbG9iYWxSb290Q0EuY3J0MEIGA1UdHwQ7MDkwN6A1oDOGMWh0dHA6 Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEdsb2JhbFJvb3RDQS5jcmwwPQYD VR0gBDYwNDALBglghkgBhv1sAgEwBwYFZ4EMAQEwCAYGZ4EMAQIBMAgGBmeBDAEC AjAIBgZngQwBAgMwDQYJKoZIhvcNAQELBQADggEBAAfjh/s1f5dDdfm0sNm74/dW MbbsxfYV1LoTpFt+3MSUWvSbiPQfUkoV57b5rutRJvnPP9mSlpFwcZ3e1nSUbi2o ITGA7RCOj23I1F4zk0YJm42qAwJIqOVenR3XtyQ2VR82qhC6xslxtNf7f2Ndx2G7 Mem4wpFhyPDT2P6UJ2MnrD+FC//ZKH5/ERo96ghz8VqNlmL5RXo8Ks9rMr/Ad9xw Y4hyRvAz5920myUffwdUqc0SvPlFnahsZg15uT5HkK48tHR0TLuLH8aRpzh4KJ/Y p0sARNb+9i1R4Fg5zPNvHs2BbIve0vkwxAy+R4727qYzl3027w9jEFC6HMXRaDc= -----END CERTIFICATE----- 2 s:C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA i:C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA1 v:NotBefore: Nov 10 00:00:00 2006 GMT; NotAfter: Nov 10 00:00:00 2031 GMT -----BEGIN CERTIFICATE----- MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt 43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg 06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= -----END CERTIFICATE----- --- Server certificate subject=CN = *.anaf.ro issuer=C = US, O = &quot;DigiCert, Inc.&quot;, CN = RapidSSL Global TLS RSA4096 SHA256 2022 CA1 --- No client certificate CA names sent Client Certificate Types: RSA sign, DSA sign, ECDSA sign Requested Signature Algorithms: RSA+SHA256:DSA+SHA256:ECDSA+SHA256:RSA+SHA384:DSA+SHA384:ECDSA+SHA384:RSA+SHA512:DSA+SHA512:ECDSA+SHA512:RSA+SHA1:DSA+SHA1:ECDSA+SHA1 Shared Requested Signature Algorithms: RSA+SHA256:DSA+SHA256:ECDSA+SHA256:RSA+SHA384:DSA+SHA384:ECDSA+SHA384:RSA+SHA512:DSA+SHA512:ECDSA+SHA512 Peer signing digest: SHA256 Peer signature type: RSA Server Temp Key: ECDH, prime256v1, 256 bits --- SSL handshake has read 4876 bytes and written 465 bytes Verification error: self-signed certificate in certificate chain --- New, TLSv1.2, Cipher is ECDHE-RSA-AES128-GCM-SHA256 Server public key is 2048 bit Secure Renegotiation IS supported Compression: NONE Expansion: NONE No ALPN negotiated SSL-Session: Protocol : TLSv1.2 Cipher : ECDHE-RSA-AES128-GCM-SHA256 Session-ID: A9F5C347ED68A6DA711C963E34102EC0923BB3B6B5546A35C8C2801DC5603F92 Session-ID-ctx: Master-Key: 902B17A4EE2A1806BC8238AF23E4B0B1F7F70A5C38E11B81124BCBC444834A8C2BD5B944F243970551A522D1213532E3 PSK identity: None PSK identity hint: None SRP username: None Start Time: 1666949305 Timeout : 7200 (sec) Verify return code: 19 (self-signed certificate in certificate chain) Extended master secret: yes --- </code></pre>
[ { "answer_id": 74245692, "author": "Steffen Ullrich", "author_id": 3081018, "author_profile": "https://Stackoverflow.com/users/3081018", "pm_score": 2, "selected": true, "text": "...\n* TLSv1.2 (IN), TLS handshake, Request CERT (13):\n...\n* error:14094410:SSL routines:ssl3_read_bytes:ss...
2022/10/29
[ "https://Stackoverflow.com/questions/74245342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4583217/" ]
74,245,349
<p>So I started with python some days ago and now tried to make a function that gives me all subpages of websites. I know it may not be the most elegant function but I had been pretty proud to see it working. But for some reason unknown to me, my function does not work anymore. I could've sworn I haven't changed that function since it worked the last time. But after hours of attempts to debug I am slowly doubting myself. Can you maybe take a look why my function does not output to a .txt file anymore? I just get handed an empty text file. Though if I delete it atleast creates a new (empty) one.</p> <p>I tried to move the save strings part out of the try block, which didn't. work. I also tried <code>all_urls.flush()</code> to maybe save everything. I restarted the PC in the hopes that something in the background accessed the file and made me unable to write on it. I also renamed the file it supposed to save as, so as to generate something truly fresh. Still the same problem. I also controlled that the <code>link</code> from the loop gets given as a string, so that shouldn't be a problem. I also tried:</p> <pre><code>print(link, file=all_urls, end='\n') </code></pre> <p>as a replacement to</p> <pre><code>all_urls.write(link) all_urls.write('\n') </code></pre> <p>with no result.</p> <p>My full function:</p> <pre><code>def get_subpages(url): # gets all subpage links from a website that start with the given url from urllib.request import urlopen, Request from bs4 import BeautifulSoup links = [url] tested_links = [] to_test_links = links # open a .txt file to save results into all_urls = open('all_urls.txt', 'w') problematic_pages = open('problematic_pages.txt', 'w') while len(to_test_links)&gt;0: for link in to_test_links: print('the link we are testing right now:', link) # add the current link to the tested list tested_links.append(link) try: print(type(link)) all_urls.write(link) all_urls.write('\n') # Save it to the -txt file and make an abstract # get the link ready to be accessed req = Request(link) html_page = urlopen(req) soup = BeautifulSoup(html_page, features=&quot;html.parser&quot;) # empty previous temporary links templinks = [] # move the links on the subpage link to templinks for sublink in soup.findAll('a'): templinks.append(sublink.get('href')) # clean off accidental 'None' values templinks = list(filter(lambda item: item is not None, templinks)) for templink in templinks: # make sure we have still the correct website and don't accidentally crawl instagram etc. # also avoid duplicates if templink.find(url) == 0 and templink not in links: links.append(templink) #and lastly refresh the to_test_links list with the newly found links before going back into the loop to_test_links = (list(set(links) ^ set(tested_links))) except: # Save it to the ERROR -txt file and make an abstract problematic_pages.write(link) problematic_pages.write('\n') print('ERROR: All links on', link, 'not retrieved. If need be check for new subpages manually.') all_urls.close() problematic_pages.close() return links </code></pre>
[ { "answer_id": 74245692, "author": "Steffen Ullrich", "author_id": 3081018, "author_profile": "https://Stackoverflow.com/users/3081018", "pm_score": 2, "selected": true, "text": "...\n* TLSv1.2 (IN), TLS handshake, Request CERT (13):\n...\n* error:14094410:SSL routines:ssl3_read_bytes:ss...
2022/10/29
[ "https://Stackoverflow.com/questions/74245349", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20364643/" ]
74,245,369
<p><strong>Model:</strong></p> <pre><code> class JobCycle(models.Model): dateReceived = models.DateField(blank=True, null=True) dueDate = models.DateField(blank=True, null=True) dateOut = models.DateField(blank=True, null=True) fee = models.IntegerField(blank=True, null=True) def __str__(self): return &quot;Job Cycle&quot; + str(self.id) def save(self, *args, **kwargs): if self.dateReceived and self.dueDate: if self.dateReceived &gt; self.dueDate: raise ValidationError( 'Due date will never be greater than the received date') super(JobCycle, self).save(*args, **kwargs) </code></pre> <p><strong>I want to make a calculation, the due date will never exceed the received date. i Want to do this in the model</strong></p>
[ { "answer_id": 74245428, "author": "Omri", "author_id": 11814273, "author_profile": "https://Stackoverflow.com/users/11814273", "pm_score": 1, "selected": false, "text": "def __str__" }, { "answer_id": 74290414, "author": "Mohsin Maqsood", "author_id": 11561910, "auth...
2022/10/29
[ "https://Stackoverflow.com/questions/74245369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17486887/" ]
74,245,410
<p>I am a newbie to polars and have a very few knowledge in pandas.</p> <p>pandas df</p> <pre><code> a b c 0 Yes No No 1 No No No 2 Yes No Yes </code></pre> <p>polars df</p> <pre><code>│ a ┆ b ┆ c │ │ --- ┆ --- ┆ --- │ │ str ┆ str ┆ str │ ╞═════╪═════╪═════╡ │ Yes ┆ No ┆ No │ ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤ │ No ┆ No ┆ No │ ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤ │ Yes ┆ No ┆ Yes │ └─────┴─────┴─────┘ </code></pre> <p>In pandas, i can execute this and outputs as expected: <code>pd_df.iloc[pd.np.where(pd_df[pd_df.columns.to_list()].eq('Yes').any(1))].drop_duplicates()</code>.</p> <pre><code> a b c 0 Yes No No 2 Yes No Yes </code></pre> <p>I'd like to know how can I get same output with polars. Thank you.</p>
[ { "answer_id": 74245428, "author": "Omri", "author_id": 11814273, "author_profile": "https://Stackoverflow.com/users/11814273", "pm_score": 1, "selected": false, "text": "def __str__" }, { "answer_id": 74290414, "author": "Mohsin Maqsood", "author_id": 11561910, "auth...
2022/10/29
[ "https://Stackoverflow.com/questions/74245410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1302018/" ]
74,245,422
<p>My code structure:</p> <p><img src="https://i.stack.imgur.com/HcQxb.png" alt="code structure 1" /></p> <p><img src="https://i.stack.imgur.com/rP3j5.png" alt="code structure 2" /></p> <p>When I import model from accounts app to to_do app:</p> <pre><code>#in to_do/models.py from ..accounts.models import Account </code></pre> <p>I have this error:</p> <pre><code> File &quot;/home/ghost/projects/django_projects/To_Do_App/to_do_list/to_do/models.py&quot;, line 2, in &lt;module&gt; from ..accounts.models import Account ImportError: attempted relative import beyond top-level package </code></pre> <p>How to fix it?</p>
[ { "answer_id": 74245452, "author": "marsninja", "author_id": 20295394, "author_profile": "https://Stackoverflow.com/users/20295394", "pm_score": 1, "selected": false, "text": "__init__.py" }, { "answer_id": 74245713, "author": "SM1L3_B0T", "author_id": 19459737, "auth...
2022/10/29
[ "https://Stackoverflow.com/questions/74245422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19459737/" ]
74,245,429
<p>I have floating buttons on my interface and need to create a surrounding area for improved user experience purposes: if the mouse click miss the floating button it may select some other object on the background, therefore an undesired result.</p> <p>What I achieved is shown below: a square grey background covering areas around those buttons. The result is not good because the grey area is not 'harmonic' with its contents: is not evenly positioned from its content.</p> <p>I'm working with <code>width: 10%</code> and <code>left: 46%</code> properties. From what I've noticed some cases the <code>width</code> should be different (probably 11%), but not a harmonic result either.</p> <p>Any ideas on how can I achieve a harmonic result?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.lowerButtons { background-color: #36404a; border: 2px solid #FFF; display: block; position: fixed; cursor: pointer; height: 40px; width: 40px; text-align: center; border-radius: 35px; bottom: 40px; color: #FFF; font-size: 20px; margin: 0 auto; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="floatingButtons" style="display: contents;"&gt; &lt;div style="background-color: #b6c0c973; display: block; position: fixed; height: 90px; width: 10%; text-align: center; bottom: 10px; color: #fff; font-size: 20px; margin: 0 auto; left: 46%; border-radius: 40px;"&gt; &lt;div id="buttonA" class="lowerButtons" style="left: 47.5%;"&gt; &lt;i class="fa fa-pencil" style="margin-top: 9px;"&gt;&lt;/i&gt; &lt;/div&gt; &lt;div id="buttonB" class="lowerButtons" style="left: 52.5%;"&gt; &lt;i class="fa fa-remove" style="margin-top: 9px;"&gt;&lt;/i&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;</code></pre> </div> </div> </p> <p>Visual result:</p> <p><a href="https://i.stack.imgur.com/VwK0K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VwK0K.png" alt="Current settings compare" /></a></p>
[ { "answer_id": 74245569, "author": "Mohammed Ahmed", "author_id": 4292093, "author_profile": "https://Stackoverflow.com/users/4292093", "pm_score": 0, "selected": false, "text": "position: fixed;" }, { "answer_id": 74245635, "author": "Andrei Fedorov", "author_id": 664119...
2022/10/29
[ "https://Stackoverflow.com/questions/74245429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19210262/" ]
74,245,449
<p>I am wring a PowerShell to print dates of upcoming 4 Fridays.</p> <pre><code>$date = Get-Date for ($num = 1 ; $num -le 4 ; $num++){ while ($Date.DayOfWeek -ne &quot;Friday&quot;) {$date = $date.AddDays($num)} $datestr = $date.ToString('dd-MM-yyyy') echo $datestr $SomeVar = &quot;Friday - &quot; + $num + &quot; - &quot; + $datestr echo $SomeVar } </code></pre> <p>Output :</p> <pre><code>04-11-2022 Friday - 1 - 04-11-2022 04-11-2022 Friday - 2 - 04-11-2022 04-11-2022 Friday - 3 - 04-11-2022 04-11-2022 Friday - 4 - 04-11-2022 </code></pre> <p>Here I am able to print the single date of upcoming Friday. But, I wanted to print the dates of upcoming 4 Fridays.</p> <p>Can you please help me out what I am missing or any better way to Print Dates Upcoming Specific day.</p> <p>Thank you.</p>
[ { "answer_id": 74245473, "author": "GregC", "author_id": 90475, "author_profile": "https://Stackoverflow.com/users/90475", "pm_score": 0, "selected": false, "text": "$dateStr = $date.ToString('dd-MM-yyyy')\n" }, { "answer_id": 74246355, "author": "Theo", "author_id": 9898...
2022/10/29
[ "https://Stackoverflow.com/questions/74245449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5146622/" ]
74,245,499
<p>I am currently working on a project that has 2 very large sql tables Users and UserDocuments having around million and 2-3 millions records respectively. I have a query that will return the count of all the documents that each indvidual user has uploaded provided the document is not rejected. A user can have multiple documents against his/her id. My current query:-</p> <pre><code>SELECT u.user_id, u.name, u.date_registered, u.phone_no, t1.docs_count, t1.last_uploaded_on FROM Users u JOIN( SELECT user_id, MAX(updated_at) AS last_uploaded_on, SUM(CASE WHEN STATUS != 2 THEN 1 ELSE 0 END) AS docs_count FROM UserDocuments WHERE user_id IN( SELECT user_id FROM Users WHERE region_id = 1 AND city_id = 8 AND user_type = 1 AND user_suspended = 0 AND is_enabled = 1 AND verification_status = -1 ) AND document_id IN('1', '2', '3', '4', '10', '11') GROUP BY user_id ORDER BY user_id ASC ) t1 ON u.user_id = t1.user_id WHERE docs_count &lt; 6 AND region_id = 1 AND city_id = 8 AND user_type = 1 AND user_suspended = 0 AND is_enabled = 1 AND verification_status = -1 LIMIT 1000, 100 </code></pre> <p>Currently the query is taking very long around 20 secs to return data with indexes. can someone suggest some tweaks in the follwing query to gain some more preformance out of it.</p>
[ { "answer_id": 74245473, "author": "GregC", "author_id": 90475, "author_profile": "https://Stackoverflow.com/users/90475", "pm_score": 0, "selected": false, "text": "$dateStr = $date.ToString('dd-MM-yyyy')\n" }, { "answer_id": 74246355, "author": "Theo", "author_id": 9898...
2022/10/29
[ "https://Stackoverflow.com/questions/74245499", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14888728/" ]
74,245,526
<pre><code> List&lt;User&gt; allusers = []; List&lt;User&gt; selectedUsers = []; List&lt;User&gt; selectableUsers = allusers - selectedUsers </code></pre> <p>Is anyone able to help me how to get selectableUsers list here? I am trying to subtract the selected users from all users so that the search function eliminates selectedUsers?</p> <p>I want to filter users based on the selection.</p> <p>View for getting and searching users. Issue is that selected user gets into the search once again. Expected behavior is that &quot;selected&quot; users shouldn't come up in the &quot;selectable&quot; user list.</p> <pre><code>class SearchGroup extends StatefulWidget { const SearchGroup({Key? key}) : super(key: key); @override State&lt;SearchGroup&gt; createState() =&gt; _SearchGroupState(); } class _SearchGroupState extends State&lt;SearchGroup&gt; { final TextEditingController _searchController = TextEditingController(); List&lt;User&gt; _users = []; List&lt;User&gt; _selectedUsers = []; List&lt;User&gt; _selectableUsers = []; @override void initState() { super.initState(); var setAllUsers = Set.from(_users); var setSelectedUsers = Set.from(_selectedUsers); _selectableUsers .addAll(List.from(setAllUsers.difference(setSelectedUsers))); } _clearSearch() { WidgetsBinding.instance .addPostFrameCallback((_) =&gt; _searchController.clear()); setState(() =&gt; _selectableUsers = []); } @override void dispose() { super.dispose(); _searchController.dispose(); } @override Widget build(BuildContext context) { final currentUserUid = Provider.of&lt;UserProvider&gt;(context).getUser?.uid ?? ''; return Scaffold( appBar: AppBar( title: TextField( controller: _searchController, hintText: 'Search &amp; select users by fullname', suffixIcon: _selectableUsers.isEmpty ? Icon(Icons.search, size: 20.0, color: Color.fromARGB(255, 235, 228, 228)) : IconButton( iconSize: 15, icon: Icon(CupertinoIcons.clear_circled_solid), onPressed: _clearSearch, color: Color.fromARGB(255, 235, 228, 228)), ), onSubmitted: (input) async { if (input.trim().isNotEmpty) { List&lt;User&gt; users = await Provider.of&lt;DatabaseService&gt;(context, listen: false) .searchUsers(currentUserUid, input); _selectedUsers.forEach((user) =&gt; users.remove(user)); _selectableUsers.forEach((user) =&gt; users.remove(user)); setState(() { _selectableUsers = users; }); } }), body: Column( children: [ Padding( padding: const EdgeInsets.only(left: 5.0), child: Container( width: double.infinity, height: 100, child: ListView.builder( itemCount: _selectedUsers.length, scrollDirection: Axis.horizontal, itemBuilder: (BuildContext context, int index) { User selectedUser = _selectedUsers[index]; return Container( margin: EdgeInsets.all(10), width: 60, height: 60, decoration: BoxDecoration(shape: BoxShape.circle), child: GestureDetector( onTap: () { _selectedUsers.remove(selectedUser); _selectableUsers.insert(0, selectedUser); setState(() {}); }, child: Stack( alignment: AlignmentDirectional.bottomEnd, children: [ CircleAvatar( radius: 60, child: CachedNetworkImage( imageUrl: selectedUser.profileImageUrl, imageBuilder: (context, imageProvider) =&gt; Container( height: 60, width: 60, decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(100)), image: DecorationImage( image: imageProvider, fit: BoxFit.cover, ), ), ), ), ), Positioned( top: 3, child: Icon( Icons.remove_circle, size: 20, color: Colors.red, ), ), ], ), ), ); }), ), ), Expanded( child: ListView.separated( separatorBuilder: (BuildContext context, int index) { return const Divider(thickness: 1.0); }, itemCount: _selectedUsers.length + _selectableUsers.length, itemBuilder: (BuildContext context, int index) { if (index &lt; _selectedUsers.length) { User selectedUser = _selectedUsers[index]; return ListTile( leading: CircleAvatar( radius: 28, child: CachedNetworkImage( imageUrl: selectedUser.profileImageUrl, imageBuilder: (context, imageProvider) =&gt; Container( decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(30)), image: DecorationImage( image: imageProvider, fit: BoxFit.cover), ), ), ), ), title: Text( selectedUser.fullname, style: TextStyle(fontSize: 14), ), trailing: Icon(Icons.check_circle, color: blueColor), onTap: () { _selectedUsers.remove(selectedUser); _selectableUsers.insert(0, selectedUser); setState(() {}); }, ); } else { int userIndex = index - _selectedUsers.length; User user = _selectableUsers[userIndex]; return ListTile( leading: CircleAvatar( radius: 28, child: CachedNetworkImage( imageUrl: user.profileImageUrl, imageBuilder: (context, imageProvider) =&gt; Container( decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(50)), image: DecorationImage( image: imageProvider, fit: BoxFit.cover), ), ), ), ), title: Text( user.fullname, style: TextStyle(fontSize: 14), ), trailing: Icon( CupertinoIcons.circle, color: Colors.grey, ), onTap: () { _selectedUsers.add(user); _selectableUsers.remove(user); setState(() {}); }, ); } }, ), ), ], ), ); } } </code></pre>
[ { "answer_id": 74245579, "author": "eamirho3ein", "author_id": 10306997, "author_profile": "https://Stackoverflow.com/users/10306997", "pm_score": 2, "selected": true, "text": "onSubmitted: (input) async {\n if (input.trim().isNotEmpty) {\n List<User> users = await Provider.of<...
2022/10/29
[ "https://Stackoverflow.com/questions/74245526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12391204/" ]
74,245,527
<p>My data frame comprises 3 columns, a grouping factor, <code>Current_Date</code>, and <code>Start_Date</code> (by definition, <code>Current_Date</code> ≥ <code>Start_Date</code>; date format is <code>dmy</code>), with multiple duplicates of dates in each column and a lag of varying length between them. Some dates overlap between groups, but some don't.</p> <p>The real data is hundreds of thousands rows long, so my problem is finding an efficient way to assign for each row the <code>unique</code> number of overlaps between the entire <code>Date</code> column (<code>by</code> the grouping factor), and the <code>seq</code> of dates defined by the time window (<code>Start_Date</code> to <code>Current_Date</code>), which is specific for each row.</p> <p>A dummy data is presented below, with the desired result of added <code>Dates_in_range</code> column, but without the grouping factor, which I don't know how to handle in <code>for</code>-loop format (e.g., there is only one unique date in the window between 21-10-22 and 21-10-22, but three unique dates in the window between 21-10-22 and 28-10-22):</p> <pre><code> Current_Date Start_Date Dates_in_range 1 21-10-22 21-10-22 1 2 26-10-22 26-10-22 1 3 26-10-22 21-10-22 2 4 26-10-22 26-10-22 1 5 26-10-22 21-10-22 2 6 28-10-22 26-10-22 2 7 28-10-22 28-10-22 1 8 28-10-22 21-10-22 3 </code></pre> <p>My solution is based on creating two types of lists containing dates, by using <code>for</code>-loops, and adding each type as a temporary column into the data table: first type is identical lists of all dates shared by the entire data set (or a group within it) repeated over all rows in the data table (or a group within it); second type is row-specific lists, derived from the time window specified by <code>Current_Date</code> and <code>Start_Date</code>. I then find an <code>intersect</code> between the two list columns for each row, applying another <code>for</code>-loop.</p> <p>A reproducible code is attached below:</p> <pre><code> library(data.table) ## Load the data set dt = data.table(Current_Date= c(&quot;21-10-22&quot;,&quot;26-10-22&quot;,&quot;26-10-22&quot;,&quot;26-10-22&quot;,&quot;26-10-22&quot;,&quot;28-10-22&quot;,&quot;28-10-22&quot;,&quot;28-10-22&quot;), Start_Date = c(&quot;21-10-22&quot;,&quot;26-10-22&quot;,&quot;21-10-22&quot;,&quot;26-10-22&quot;,&quot;21-10-22&quot;,&quot;26-10-22&quot;,&quot;28-10-22&quot;,&quot;21-10-22&quot;)) # Specify dates into DMY date format library(lubridate) dt$Current_Date&lt;- dmy(dt$Current_Date) dt$Start_Date &lt;- dmy(dt$Start_Date) ## Create a list of all current dates within the data set (= Current_Date column) Dates_all &lt;- as.list(dt$Current_Date) # Add the list as a Dates_all column to the data set dt$All_dates &lt;- list() for (i in 1:length(dt[, Current_Date])){ dt$All_dates[[i]] &lt;- Dates_all } ## Create a list of sequences of all possible dates within the date period (from Start_Date to Current_Date) for each row Date_window &lt;- list() for (i in 1:length(dt[, Current_Date])){ Date_window[[i]] &lt;- as.list(seq(as.Date(dt[i, Start_Date]), as.Date(dt[i, Current_Date]), by=&quot;days&quot;)) } # Add the list as a Date_window column to the data set dt$Date_window &lt;- Date_window ## Add the Dates_in_range column containing the number of dates from Current_Date column, occurring in the row-specific time window for (i in 1:length(dt[, Current_Date])){ dt$Dates_in_range[[i]] &lt;- length(intersect(dt$Date_window[[i]], dt$All_dates[[i]])) } # Cleanup &amp; print dt[, c(&quot;Date_window&quot;,&quot;All_dates&quot;) := NULL] rm(Dates_all, Date_window, i) print(dt) </code></pre> <p>I suspect it can be accomplished using <code>foverlaps</code> function, but I am not sure how to apply it in this case.</p> <p>Thanks in advance!</p>
[ { "answer_id": 74245834, "author": "Josh White", "author_id": 20289207, "author_profile": "https://Stackoverflow.com/users/20289207", "pm_score": 0, "selected": false, "text": "vapply()" }, { "answer_id": 74246180, "author": "Ric Villalba", "author_id": 6912817, "auth...
2022/10/29
[ "https://Stackoverflow.com/questions/74245527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20341350/" ]
74,245,549
<p>I have 30,000 products in my database, but only a few hundred of them have actual useful information.</p> <p>I want to generate <code>/product/[productId]</code> pages statically to make the loading faster.</p> <p>Statically generating all 30,000 pages fails on Vercel because it takes too long.</p> <p>Is there a way to generate the <code>/product/[productId]</code> pages statically for few hundred <code>productId</code>s and dynamically for the rest?</p>
[ { "answer_id": 74245834, "author": "Josh White", "author_id": 20289207, "author_profile": "https://Stackoverflow.com/users/20289207", "pm_score": 0, "selected": false, "text": "vapply()" }, { "answer_id": 74246180, "author": "Ric Villalba", "author_id": 6912817, "auth...
2022/10/29
[ "https://Stackoverflow.com/questions/74245549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2076046/" ]
74,245,550
<p>I have a this logfile:</p> <pre><code>19-3-2020 01:37:31.995 INFO 18 188 mailbox allocated for rsvp 19-3-2020 01:37:32.039 INFO 14 194 creating mailslot for dump 19-3-2020 01:37:32.082 INFO 18 194 out of INFO allcations 19-3-2020 01:37:32.119 INFO 18 188 creating mailslot for RSVP client API 19-3-2020 01:37:32.157 INFO 10 187 creating socket for traffic CONTROL module 19-3-2020 01:37:32.157 INFO 19 186 transaction 17327 begin 19-3-2020 01:37:32.276 INFO 11 188 loopback to avoid ERROR 19-3-2020 01:37:32.276 INFO 15 187 end transaction 17327 19-3-2020 01:37:32.314 INFO 13 189 creating mailslot for terminate </code></pre> <p>I need to count the amount of transactions that have a beginning and end</p> <p>I tried using the defaultdic library but clearly its just the first lines cause im not sure what to do next:</p> <pre><code>from collections import defaultdict transactions = defaultdict(dict) with open('logfile.log', 'r') as f: </code></pre>
[ { "answer_id": 74245834, "author": "Josh White", "author_id": 20289207, "author_profile": "https://Stackoverflow.com/users/20289207", "pm_score": 0, "selected": false, "text": "vapply()" }, { "answer_id": 74246180, "author": "Ric Villalba", "author_id": 6912817, "auth...
2022/10/29
[ "https://Stackoverflow.com/questions/74245550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20365610/" ]
74,245,555
<p>I know that a process switches between user mode and kernel mode for running. I am confused that for every line of code, we should possibly need the kernel. Below is the example, could I get explanation of the kernels role in execution of the following coding lines. Does the following actually require kernel mode.</p> <p>if(a &lt; 0) a++</p>
[ { "answer_id": 74246034, "author": "drk1", "author_id": 19508355, "author_profile": "https://Stackoverflow.com/users/19508355", "pm_score": 1, "selected": false, "text": "syscall" }, { "answer_id": 74246094, "author": "Krutarth Vaishnav", "author_id": 17034033, "autho...
2022/10/29
[ "https://Stackoverflow.com/questions/74245555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14316064/" ]
74,245,587
<p>I am trying to remove a specific div and it's content from a large number of Wordpress posts. Instead of just using 'display:none' to make the div invisible, I would like it to be removed permanently. That's why I prefer to remove the div and it's content from the SQL database. The div looks like this:</p> <pre><code>&lt;div class=&quot;inhoud&quot;&gt;&lt;h3&gt;abc bac&lt;/h3&gt;&lt;ul&gt; &lt;li&gt;&lt;a href=&quot;a&quot;&gt;abc bac&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href=&quot;b&quot;&gt;abc bac&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href=&quot;c&quot;&gt;abc bac&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;/div&gt; </code></pre> <p>In short, I would like all divs with the class <code>inhoud</code> to be removed from the posts content.</p> <p>I have tried several things, including this regular expression:</p> <pre><code>UPDATE `wp_posts` SET `post_content` = REGEXP_REPLACE(post_content,'&lt;div class=&quot;inhoud&quot;&gt;.*?&lt;/div&gt;','') </code></pre> <p>That didn't do much. What am I doing wrong and what is the correct approach to this?</p>
[ { "answer_id": 74246034, "author": "drk1", "author_id": 19508355, "author_profile": "https://Stackoverflow.com/users/19508355", "pm_score": 1, "selected": false, "text": "syscall" }, { "answer_id": 74246094, "author": "Krutarth Vaishnav", "author_id": 17034033, "autho...
2022/10/29
[ "https://Stackoverflow.com/questions/74245587", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20365725/" ]
74,245,596
<p>Currently I'm studying and I received task to write query (join 4 tables: people, goods, orders and order details). So main table Order_details has two columns: Order_id and Good_id, in order to make possible to have many goods in one order (e.g. order with id = 1 has 3 rows in Order_details table but has different goods primary keys in each row). So the problem is that I don't know any other possible methods(besides using group by, distinct or over()) to receive only one row of each order in Order_details table (like I would get by using for example Distinct keyword). I'm receiving completely same rows of each order (with same Order_id and Good_id) but i don't know how to get only one row of each order. Here's my query(so basically i need to select sum of all goods in order but i don't think that it really matters in my problem) and scheme (if it'll help) By the way I'm working with MYSQL.</p> <pre><code>SELECT Order_details.Order_id, Orders.Date, People.First_name, People.Surname, ( SELECT SUM(Goods.Price * Order_details.Quantity) FROM Order_details, Goods WHERE Order_details.Good_id = Goods.Good_id AND Order_details.Order_id = Orders.Order_id ) AS Total_price FROM Order_details, Goods, Orders, People WHERE Order_details.Order_id = Orders.Order_id AND Order_details.Good_id = Goods.Good_id AND Order_details.Order_id = Orders.Order_id AND Orders.Person_id = People.Person_id ORDER BY Order_id ASC; </code></pre> <p><a href="https://i.stack.imgur.com/ETZZt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ETZZt.png" alt="Scheme" /></a></p> <p>I have tried several methods, but still cant figure it out. Maybe somehow it is possible with subquery? But i'm not sure... (I have tried method with UNION but it's not the key as well)</p>
[ { "answer_id": 74246034, "author": "drk1", "author_id": 19508355, "author_profile": "https://Stackoverflow.com/users/19508355", "pm_score": 1, "selected": false, "text": "syscall" }, { "answer_id": 74246094, "author": "Krutarth Vaishnav", "author_id": 17034033, "autho...
2022/10/29
[ "https://Stackoverflow.com/questions/74245596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20365624/" ]
74,245,599
<p>I want to put every five members of my list in a list as the value of my dictionary but the duplicate numbers should not be added in the individual values and I need to implement this program in Python in the shortest possible order.</p> <p>For example if the list is <code>lst = [9, 9, 9, 2, 3, 4, 5, 5, 6, 6]</code>, the result dictionary should be <code>d = {1: [9, 2, 3], 2: [4, 5, 6]}</code>.</p> <p>Another example is <code>lst = [8, 6, 1, 9, 1, 0, 2, 8]</code> and the result dictionary is <code>{1: [8, 6, 1, 9], 2: [0, 2, 8]}</code></p>
[ { "answer_id": 74245759, "author": "jvx8ss", "author_id": 11107859, "author_profile": "https://Stackoverflow.com/users/11107859", "pm_score": 1, "selected": false, "text": "dict.fromkeys" }, { "answer_id": 74245784, "author": "S.B", "author_id": 13944524, "author_prof...
2022/10/29
[ "https://Stackoverflow.com/questions/74245599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20360938/" ]
74,245,603
<p>I have two data frames <code>exp.kirp.log2</code> and <code>g_list</code> where the rownames of <code>exp.kirp.log2</code> matches the <code>g_list$hgnc_symbol</code>, but they are in <strong>different orders</strong>. I want to replace the rownames of <code>exp.kirp.log2</code> with the <code>gene_list$ensembl_gene_id</code> based on the matching <code>g_list$hgnc_symbol</code>.</p> <pre><code># Obtain g_list genes &lt;- rownames(exp.kirp.log2) ensembl = useEnsembl(biomart = &quot;genes&quot;, dataset = &quot;hsapiens_gene_ensembl&quot;, GRCh = 37, verbose = T) ensembl &lt;- useDataset(dataset = &quot;hsapiens_gene_ensembl&quot;, mart = ensembl) g_list &lt;- getBM(attributes = c('ensembl_gene_id','hgnc_symbol'), filters='hgnc_symbol',values=genes, mart=ensembl) g_list &lt;- g_list[order(g_list$hgnc_symbol),] rownames(exp.kirp.log2) &lt;- g_list$ensembl_gene_id %in% g_list[match(rownames(exp.kirp.log2), g_list$hgnc_symbol),2] </code></pre> <p>Traceback:</p> <pre><code>Error in `.rowNamesDF&lt;-`(x, value = value) : invalid 'row.names' length </code></pre> <p><code>exp.kirp</code></p> <pre><code>dput(exp.kirp.log2[1:20,1:20]) structure(list(TCGA.2K.A9WE.01A = c(7.65342121905285, 2.03892776611756, -0.96100202120249, 6.35598354101006, 14.3511850042327, -Inf, 10.3737643425674, 3.79382306985866, -Inf, 10.0819596419255, 9.44832324553207, 4.20886056913751, -0.96100202120249, -Inf, -Inf, -Inf, 5.36085937172008, 9.78880184184623, 10.3776687573505, 11.16757118884), TCGA.2Z.A9J1.01A = c(5.09389393824392, 5.2160706644244, -Inf, 6.93597002271109, 12.4136523086721, -Inf, 11.1918237390263, 2.98724809259115, -Inf, 10.1912122382252, 9.9623840324273, 4.71517403960983, -Inf, -Inf, -Inf, -Inf, 6.22565668754941, 10.3398477765017, 10.3103072842012, 11.1287210937383), TCGA.2Z.A9J2.01A = c(5.51854458067276, 4.11644793551166, -Inf, 7.5307754013178, 12.2744679621487, -Inf, 9.93114303849412, -Inf, -Inf, 10.3189198720956, 10.2574585613045, 4.11644793551166, -Inf, -Inf, -Inf, 0.309059742501585, 6.16707286132018, 10.2991951943744, 10.5852157015366, 11.5823040757623), TCGA.2Z.A9J3.01A = c(4.70168212029528, 3.34111759260469, 3.57815377007565, 7.54694769203808, 10.1689338100564, -Inf, 9.96839262629172, 5.28865017271056, -Inf, 9.87305770150294, 9.75535162798677, 3.57815377007565, -Inf, -Inf, -Inf, -Inf, 6.170389794965, 10.238532641469, 9.94050095178643, 11.0690397931313), TCGA.2Z.A9J5.01A = c(7.99645936536463, 5.20408983959317, 1.64952349150802, 6.89258167250936, 13.6832285748428, -Inf, 10.3714563849361, 2.6495004987031, -Inf, 10.4176870383992, 10.0652444551968, 6.86867071663319, -Inf, -Inf, -Inf, -0.350522494468264, 5.98935248863472, 10.1079093507719, 11.2050505161752, 11.6645692817891 ), TCGA.2Z.A9J6.01A = c(5.13719199914349, 6.63590381796106, -1.00057719346275, 6.92859654071157, 12.0367193976262, -Inf, 10.8202555636581, 5.50707469845262, -Inf, 10.3262700402849, 9.91216810777653, 5.94179415093086, -Inf, -Inf, -Inf, -Inf, 5.52284042813955, 10.0653680664815, 10.5954686012028, 11.2355920880251), TCGA.2Z.A9J7.01A = c(6.95117512427229, 2.24944534108584, -Inf, 7.25014205824679, 10.9656928148969, 1.07949758402178, 10.5991523452113, 4.32744306245973, -Inf, 10.4556415168452, 9.46537845450025, 3.66448284036468, -Inf, -Inf, -0.920570684997085, -Inf, 6.72337288854289, 10.0139441477751, 9.28408724134641, 11.4833270722276), TCGA.2Z.A9J8.01A = c(3.61712213221935, 5.39472334226273, -Inf, 7.92111077839189, 11.9975977242282, -1.58251200148633, 9.91379851626213, 5.10394657615628, -Inf, 9.95999222715916, 9.90779350021794, 5.82683572660569, -Inf, -Inf, -Inf, -Inf, 7.85831302551685, 10.3997246047534, 11.7402171909708, 11.7246448152361), TCGA.2Z.A9J9.01A = c(6.05389548011115, -1.41888982477445, -Inf, 5.73237232300075, 14.8647326244225, -1.41888982477445, 10.4697437586612, 4.51174000542664, -0.419082711336792, 9.28576885726015, 9.21399581402162, -1.41888982477445, -Inf, -Inf, -Inf, -Inf, 6.0887945976893, 9.39798410008432, 9.51616568261168, 11.1846268780251), TCGA.2Z.A9JD.01A = c(3.15639661659767, 4.2623504664045, -Inf, 8.66937017282105, 10.9506421354115, -Inf, 10.8015070949819, 1.37484474128973, -Inf, 9.51027580369917, 10.0114476969219, 4.30081927275683, -Inf, -Inf, -Inf, -Inf, 5.9232585434528, 10.1410206692489, 10.9093204661635, 11.1601119970792), TCGA.2Z.A9JE.01A = c(4.55671142771396, 0.976583597876997, -Inf, 7.39711669725343, 11.338916568945, 0.976583597876997, 11.4922670603536, 2.97656526897918, -Inf, 10.098748119083, 9.84075338026455, 5.28034764124523, -Inf, -Inf, -Inf, -Inf, 5.7709822912126, 10.6735346943631, 10.5435725361632, 11.1417882886223), TCGA.2Z.A9JG.01A = c(7.27924748225939, 3.74051746156171, 2.8145094080944, 5.79197812282256, 12.0865056775331, -Inf, 10.327056990394, 3.53698537579194, -Inf, 10.5780583590704, 10.8649068477431, 6.57473428966518, -Inf, -Inf, -Inf, -Inf, 7.25413670394464, 9.83577157545057, 10.6502486545903, 11.1906393649786), TCGA.2Z.A9JI.01A = c(8.20162111992077, 5.71548707501235, 0.393526032228356, 5.73826794012289, 12.7954861179578, 2.61595767716595, 10.0094938620897, 5.20091233325219, -Inf, 9.93400880935778, 9.75330735360058, 5.21798676951157, -Inf, -Inf, -Inf, -Inf, 7.0082672553098, 9.74081003982032, 10.7382235152475, 11.6720072357516), TCGA.2Z.A9JJ.01A = c(6.26475409489153, -0.415229871442725, 4.46742296017359, 6.39123499553712, 12.8198023802381, -Inf, 11.7916439373724, 2.04421923663312, -Inf, 9.53606689182685, 10.3591574288036, -1.41503749927884, -Inf, -Inf, -Inf, -Inf, 5.71406413888836, 10.0630462305102, 10.2195932783632, 11.455724780085 ), TCGA.2Z.A9JK.01A = c(5.9386386584728, 6.15383572961508, -Inf, 6.96731849612975, 14.0309071832818, -1.46076672913396, 10.1870344226096, 1.99855658313033, -Inf, 9.35930526481309, 9.09945932891836, 4.68887411799513, 1.99855658313033, -Inf, -Inf, -1.46076672913396, 6.2670469517503, 9.44376099865969, 10.3192560726034, 11.2260646035167), TCGA.2Z.A9JL.01A = c(7.02541755196655, 3.6235742674856, 0.623585972399712, 6.53709878587009, 12.9644083075158, -0.961282892427146, 11.008714051357, 7.39616034553605, -Inf, 10.2035151452418, 9.55233575995403, 4.03861176676445, -Inf, -Inf, -Inf, -Inf, 6.02729341208669, 10.2444014184424, 10.8539915160092, 10.9360755463691), TCGA.2Z.A9JM.01A = c(5.91786850792426, 5.24907362097786, 1.28557977040279, 6.72907414917957, 13.7490268867095, -Inf, 10.9548399985167, 4.00806552147407, -Inf, 10.1222822552784, 9.55238706244896, 5.47146712618562, -Inf, -Inf, -Inf, -1.03622996892924, 6.23045858328003, 10.2600151849016, 10.4635183450003, 10.7143794759862), TCGA.2Z.A9JN.01A = c(4.09355172548716, -Inf, -Inf, 7.28292161137752, 12.2911433534863, -Inf, 10.8165919471646, -1.22398025935253, -Inf, 8.92443634456794, 9.76180168782627, -1.22398025935253, -1.22398025935253, -Inf, -Inf, -Inf, 7.12910679128811, 10.6459390192132, 10.9762453349304, 11.3740122319006), TCGA.2Z.A9JO.01A = c(5.31084177712261, -0.707218250772154, 0.292663973396858, 7.23068817327933, 13.1978705809921, 3.38016145559557, 9.83862580682156, -Inf, -Inf, 9.54417855835282, 10.3479785104067, 5.93655314137344, -Inf, -Inf, -Inf, -Inf, 6.95803180123955, 10.5275135616911, 10.7557094705532, 11.5723066760841), TCGA.2Z.A9JP.01A = c(6.28494714327597, 0.226878404196269, 1.22687840419627, 7.45773299323875, 13.34336295947, -Inf, 11.208058065601, 1.22687840419627, -Inf, 10.0414301364209, 9.66875435596374, 4.51225217454896, -Inf, -Inf, -Inf, 0.226878404196269, 6.145710058105, 9.94538047931203, 10.6250568350002, 11.0719455710567 )), row.names = c(&quot;A1BG&quot;, &quot;A1CF&quot;, &quot;A2BP1&quot;, &quot;A2LD1&quot;, &quot;A2M&quot;, &quot;A2ML1&quot;, &quot;A4GALT&quot;, &quot;A4GNT&quot;, &quot;AAA1&quot;, &quot;AAAS&quot;, &quot;AACS&quot;, &quot;AACSL&quot;, &quot;AADAC&quot;, &quot;AADACL2&quot;, &quot;AADACL3&quot;, &quot;AADACL4&quot;, &quot;AADAT&quot;, &quot;AAGAB&quot;, &quot;AAK1&quot;, &quot;AAMP&quot; ), class = &quot;data.frame&quot;) </code></pre> <p><code>g_list</code></p> <pre><code>&gt; dput(g_list[1:20,1:2]) structure(list(ensembl_gene_id = c(&quot;ENSG00000121410&quot;, &quot;ENSG00000148584&quot;, &quot;ENSG00000175899&quot;, &quot;ENSG00000166535&quot;, &quot;ENSG00000128274&quot;, &quot;ENSG00000118017&quot;, &quot;ENSG00000094914&quot;, &quot;ENSG00000081760&quot;, &quot;ENSG00000114771&quot;, &quot;ENSG00000261846&quot;, &quot;ENSG00000197953&quot;, &quot;ENSG00000188984&quot;, &quot;ENSG00000204518&quot;, &quot;ENSG00000109576&quot;, &quot;ENSG00000103591&quot;, &quot;ENSG00000115977&quot;, &quot;ENSG00000127837&quot;, &quot;ENSG00000129673&quot;, &quot;ENSG00000090861&quot;, &quot;ENSG00000124608&quot;), hgnc_symbol = c(&quot;A1BG&quot;, &quot;A1CF&quot;, &quot;A2M&quot;, &quot;A2ML1&quot;, &quot;A4GALT&quot;, &quot;A4GNT&quot;, &quot;AAAS&quot;, &quot;AACS&quot;, &quot;AADAC&quot;, &quot;AADACL2&quot;, &quot;AADACL2&quot;, &quot;AADACL3&quot;, &quot;AADACL4&quot;, &quot;AADAT&quot;, &quot;AAGAB&quot;, &quot;AAK1&quot;, &quot;AAMP&quot;, &quot;AANAT&quot;, &quot;AARS&quot;, &quot;AARS2&quot;)), row.names = c(NA, 20L), class = &quot;data.frame&quot;) </code></pre>
[ { "answer_id": 74245759, "author": "jvx8ss", "author_id": 11107859, "author_profile": "https://Stackoverflow.com/users/11107859", "pm_score": 1, "selected": false, "text": "dict.fromkeys" }, { "answer_id": 74245784, "author": "S.B", "author_id": 13944524, "author_prof...
2022/10/29
[ "https://Stackoverflow.com/questions/74245603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20076555/" ]
74,245,630
<p>I tried running the following command in PS:</p> <pre><code>Get-EventLog -LogName Security | findstr 4720 </code></pre> <p>The result I got seems to be squished as if the column widths need to be adjusted. How can I view all the text that is after the ellipses (...)? See screenshot: <a href="https://i.imgur.com/fqV5qIs.png" rel="nofollow noreferrer">https://i.imgur.com/fqV5qIs.png</a></p> <p>How to view the returned info in full?</p>
[ { "answer_id": 74245759, "author": "jvx8ss", "author_id": 11107859, "author_profile": "https://Stackoverflow.com/users/11107859", "pm_score": 1, "selected": false, "text": "dict.fromkeys" }, { "answer_id": 74245784, "author": "S.B", "author_id": 13944524, "author_prof...
2022/10/29
[ "https://Stackoverflow.com/questions/74245630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20365825/" ]
74,245,645
<p>I have just read Google's Cloud SQL's high availability <a href="https://cloud.google.com/sql/docs/postgres/high-availability" rel="nofollow noreferrer">documentation</a>.</p> <p>From what I understood in order for Google to:</p> <ul> <li>Guarantee no data loss in case of primary node failure.</li> <li>Allow clients to use standby node as read replica with strong consistency.</li> </ul> <p>Google has to replicate writes in a <strong>synchronous</strong> way across multiple zones.</p> <p>This seems like a very costly operation that should affect write transactions' latency. I however personally have not observed any significant latency differences between HA and non-HA version of GCP's Postgres.</p> <p>How is it possible?</p>
[ { "answer_id": 74245759, "author": "jvx8ss", "author_id": 11107859, "author_profile": "https://Stackoverflow.com/users/11107859", "pm_score": 1, "selected": false, "text": "dict.fromkeys" }, { "answer_id": 74245784, "author": "S.B", "author_id": 13944524, "author_prof...
2022/10/29
[ "https://Stackoverflow.com/questions/74245645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3364192/" ]
74,245,666
<p>I have a data frame with column A (Sample_id), column B (Prey), and column C (Count). Column B has 3 factors: P1, P2, P3. I want to remove all Sample_id's where P3 does not occur - in other words, retain only the Sample_id's where P3 does occur.</p> <p>Essentially, I want to go from this original dataset :</p> <pre><code>df_orig &lt;- data.frame(Sample_id = rep(c('S1', 'S2', 'S3'), each = 3), Prey = rep(c('P1', 'P2', 'P3'), times = 3), Count = (c(10, 16, 0, 5, 0, 0, 6, 2, 9))) </code></pre> <p>to this reduced dataset:</p> <pre><code>df_red &lt;- data.frame(Sample_id = rep(c('S3'), each = 3), Prey = rep(c('P1', 'P2', 'P3'), times = 1), Count = (c(6, 2, 9))) </code></pre> <p>I think I should be able to achieve this with dplyr filter somehow, but my attempts (see below) removes the prey groups P2 and P1. Rather, I need to filter where a condition is met (i.e. retain Sample_id where P3 occurs).</p> <p>How do I do this?</p> <pre><code>library(dplyr) df_red &lt;- df_orig %&gt;% group_by(Sample_id) %&gt;% filter(Prey == &quot;P3&quot;) %&gt;% ungroup() </code></pre>
[ { "answer_id": 74245732, "author": "Josh White", "author_id": 20289207, "author_profile": "https://Stackoverflow.com/users/20289207", "pm_score": 0, "selected": false, "text": "df_orig %>%\n filter(Sample_id == \"S3\")\n" }, { "answer_id": 74245755, "author": "zephryl", ...
2022/10/29
[ "https://Stackoverflow.com/questions/74245666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15907342/" ]
74,245,683
<p>I'm trying to extract specific words from text blocks. The blocks themselves look like that.</p> <pre><code>soundeffect = { name = event_ship_explosion sounds = { sound = event_ship_explosion } volume = 0.2 max_audible = 1 max_audible_behaviour = fail } soundeffect = { name = event_ship_bridge sounds = { sound = event_ship_bridge sound = event_ship_bridge_02 sound = event_ship_bridge_03 } volume = 0.3 max_audible = 1 max_audible_behaviour = fail } </code></pre> <p>They are quite similar but the main difference is that inside a <code>sounds</code> block, there can be multiple instance of <code>sound</code>. Whether there is a single or multiple instance of <code>sound</code>, I want to be able to extract all of them.</p> <p>Basically, for each <code>soundeffect</code> blocks, I want to extract a pair of words containing what's on the right of <code>name = </code> and what's on the right of <code>sound = </code> (Multiple time, if applicable).</p> <p>I came up with this RegEx so far and when testing it (on websites like <a href="https://regex101.com/r/MgaLZN/1" rel="nofollow noreferrer">https://regex101.com/r/MgaLZN/1</a>) it seems to be working as it shows that the <code>Sound</code> named capturing group has 3 matches. <a href="https://i.stack.imgur.com/IApPU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IApPU.png" alt="Regex101 result" /></a></p> <p>The RegEx: <code>name\s*=\s*(?&lt;Group&gt;\w+)\s*sounds\s*=\s*{\s*(?&gt;sound\s*=\s*(?&lt;Sound&gt;\w+)\s*)+}</code></p> <p>However, when using PowerShell, only the last instance of what's to the right of <code>sound = </code> is retained. The previous matches are overridden. To transform all of that in an array of objects that I can then exploit (Using <code>ConvertFrom-Text</code> - <a href="https://github.com/jdhitsolutions/PSScriptTools/blob/master/docs/ConvertFrom-Text.md" rel="nofollow noreferrer">https://github.com/jdhitsolutions/PSScriptTools/blob/master/docs/ConvertFrom-Text.md</a>). If you take the second <code>soundeffect</code> block, this is the result I get:</p> <pre><code>Group Sound ----- ----- event_ship_bridge event_ship_bridge_03 </code></pre> <p>When I'm looking for something like that instead:</p> <pre><code>Group Sound ----- ----- event_ship_bridge @(event_ship_bridge, event_ship_bridge_02, event_ship_bridge_03} </code></pre> <p>I'm finally wondering if what I want to do is even possible with RegEx so I'm interested by all inputs you can give me. :)</p> <p>Edit: here's the PowerShell code I'm using at the moment:</p> <pre><code>$Text | Select-String -Pattern $Regex -AllMatches | ForEach-Object { [string]$GroupName = $_.Matches.Groups[$Regex.GroupNumberFromName(&quot;Group&quot;)] | % { $_.Value } [string]$SoundName = $_.Matches.Groups[$Regex.GroupNumberFromName(&quot;Sound&quot;)] | % { $_.Value } } $GroupName $SoundName </code></pre> <p>Which returns the following result as if the <code>-AllMatches</code> parameter was not respected.</p> <pre><code>event_ship_explosion event_ship_explosion </code></pre>
[ { "answer_id": 74246295, "author": "jkiiski", "author_id": 5747548, "author_profile": "https://Stackoverflow.com/users/5747548", "pm_score": 3, "selected": true, "text": "Captures" }, { "answer_id": 74246863, "author": "Luuk", "author_id": 724039, "author_profile": "h...
2022/10/29
[ "https://Stackoverflow.com/questions/74245683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2679970/" ]
74,245,688
<p>I have two entities with a many-to-many relationship, and I have a third entity to represent this relationship, these are classroom user and userclassroom respectively. I want to retrieve a specific classroom, users registered in this classroom, and messages from this classroom, I wrote the following query for this:</p> <pre><code>await _genericRepository.GetAsync(x =&gt; x.Id.ToString() == request.classroomId, x =&gt; x.Messages, x =&gt; x.Tags, x =&gt; x.Users); </code></pre> <p>But the related entities in the returned data are constantly repeating themselves, you can check it from the picture below.</p> <p><a href="https://i.stack.imgur.com/Ffzm3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ffzm3.png" alt="enter image description here" /></a></p> <p>Is this normal or is it an error, if it is an error, what is the solution?</p> <p>Entities:</p> <pre><code>public class AppUser: IdentityUser { public ICollection&lt;UserClassroom&gt; Classrooms { get; set; } public List&lt;Message&gt; Messages { get; set; } } public class Classroom { public Guid Id { get; set; } public string Name { get; set; } public List&lt;Tag&gt; Tags { get; set; } public List&lt;Message&gt; Messages { get; set; } public virtual ICollection&lt;UserClassroom&gt; Users { get; set; } } public class UserClassroom { public string UserId { get; set; } public Guid ClassroomId { get; set; } public AppUser AppUser { get; set; } public Classroom Classroom { get; set; } public DateTime JoinDate { get; set; } = DateTime.Now; } </code></pre>
[ { "answer_id": 74246295, "author": "jkiiski", "author_id": 5747548, "author_profile": "https://Stackoverflow.com/users/5747548", "pm_score": 3, "selected": true, "text": "Captures" }, { "answer_id": 74246863, "author": "Luuk", "author_id": 724039, "author_profile": "h...
2022/10/29
[ "https://Stackoverflow.com/questions/74245688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14982493/" ]
74,245,694
<p>I'm getting this TypeError</p> <pre><code>TypeError: Cannot read properties of undefined (reading 'files') </code></pre> <p>and cannot find a solution. my app is using react and I'm getting this error while handling a setState hook.</p> <pre><code> const handleCapImage = (event) =&gt; { setPostImage(event.target.files[0]); }; </code></pre> <p>React element where I'm calling it</p> <pre><code>&lt;input type=&quot;file&quot; id=&quot;file&quot; ref={inputFile} style={{ display: &quot;none&quot; }} onChange={handleCapImage} /&gt; </code></pre>
[ { "answer_id": 74246295, "author": "jkiiski", "author_id": 5747548, "author_profile": "https://Stackoverflow.com/users/5747548", "pm_score": 3, "selected": true, "text": "Captures" }, { "answer_id": 74246863, "author": "Luuk", "author_id": 724039, "author_profile": "h...
2022/10/29
[ "https://Stackoverflow.com/questions/74245694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10916344/" ]
74,245,735
<p>I'm trying out Quasar for the first time to build an SPA. I'm having a problem with the router. I already built a simple sign-in page in <code>src/pages/LoginPage.vue</code>, and then I added the appropriate route object to <code>src/router/routes.js</code></p> <pre class="lang-js prettyprint-override"><code>const routes = [ { path: &quot;/login&quot;, component: () =&gt; import(&quot;pages/LoginPage.vue&quot;), }, { path: &quot;/&quot;, component: () =&gt; import(&quot;layouts/MainLayout.vue&quot;), children: [{ path: &quot;&quot;, component: () =&gt; import(&quot;pages/IndexPage.vue&quot;) }], }, // Always leave this as last one, // but you can also remove it { path: &quot;/:catchAll(.*)*&quot;, component: () =&gt; import(&quot;pages/ErrorNotFound.vue&quot;), }, ]; export default routes; </code></pre> <p>I leave <code>src/router/index.js</code> the way it's generated by <code>quasar-cli</code>.</p> <p>And then I try opening <code>http://localhost:9000/login</code> in the browser.</p> <h2>Expected result</h2> <p>Page loads with <code>LoginPage</code> as the content. URL bar displays the intended address, or maybe an added trailing slash.</p> <h2>Actual result</h2> <p>Address gets redirected to <code>http://localhost:9000/login#/</code> or <code>http://localhost:9000/login/#/</code>, depending on whether or not you put trailing slash when you type it in.</p> <p>Page displays the <code>/</code> instead (<code>IndexPage</code> wrapped in <code>MainLayout</code>).</p> <h2>Additional info</h2> <pre><code>» Dev mode............... spa » Pkg quasar............. v2.10.0 » Pkg @quasar/app-vite... v1.1.3 </code></pre>
[ { "answer_id": 74246295, "author": "jkiiski", "author_id": 5747548, "author_profile": "https://Stackoverflow.com/users/5747548", "pm_score": 3, "selected": true, "text": "Captures" }, { "answer_id": 74246863, "author": "Luuk", "author_id": 724039, "author_profile": "h...
2022/10/29
[ "https://Stackoverflow.com/questions/74245735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2190916/" ]
74,245,736
<p>I have the following situation.</p> <p>I cannot change launch Dart configurations anymore since the button is missing. I think I hid it by accident but I cannot make it appear anymore.</p> <p><a href="https://i.stack.imgur.com/0cSOK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0cSOK.png" alt="enter image description here" /></a></p> <p>Launch.json is still accessible but the button has disappeared.</p> <p>Any help is appreciated, I don't really want to reinstall VS Code and I don't think it would help.</p>
[ { "answer_id": 74245823, "author": "riciloma", "author_id": 4663815, "author_profile": "https://Stackoverflow.com/users/4663815", "pm_score": 2, "selected": true, "text": "Command" } ]
2022/10/29
[ "https://Stackoverflow.com/questions/74245736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4663815/" ]
74,245,768
<p>I've been using Angular for quite some time and when I need to controle the ui css classes, usually what I do is a direct property binding to toggle it's state, for example:</p> <pre><code>// HTML &lt;div class=&quot;panel&quot; [class.active]=&quot;isActive&quot; (click)=&quot;toggleActive()&quot;&gt;...&lt;/div&gt; // Angular public toggleActive() { this.isActive = !this.isActive; } </code></pre> <p>There is also the possibility to achive this same result using @ViewChild, for example:</p> <pre><code>// HTML &lt;div class=&quot;panel&quot; #myPanel (click)=&quot;toggleActive()&quot;&gt;...&lt;/div&gt; // Angular @ViewChild('myPanel') myPanel!: ElementRef; public toggleActive() { const el = this.myPanel.nativeElement as HTMLElement; el.classList.contains('active') ? el.classList.remove('active') : el.classList.add('active'); } </code></pre> <p>My question is, is there any difference between these 2 methods? For instance, performance impact, best practices, etc.. Anything that would justify going with one way or another?</p>
[ { "answer_id": 74248712, "author": "Petr Averyanov", "author_id": 4019404, "author_profile": "https://Stackoverflow.com/users/4019404", "pm_score": 1, "selected": false, "text": "isActive" } ]
2022/10/29
[ "https://Stackoverflow.com/questions/74245768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3106828/" ]
74,245,785
<p>Hi I stumbled upon something strange, I wanted to stop the emission of particle system as follows:</p> <pre><code>laser.GetComponent&lt;ParticleSystem&gt;().emission.enabled = false; </code></pre> <p>But I get error <code>CS1612</code> (cannot modify the return value cause it is not a variable)</p> <p>But</p> <pre><code>var emissionModule = laser.GetComponent&lt;ParticleSystem&gt;().emission; emissionModule.enabled = false; </code></pre> <p>Works, now I searched about this issue but everyone says you can't do it because the return value is returned by value and not by reference, but this can't be true because the code above does indeed change the emission module to <code>false</code> in game, it didn't change a local copy in my code it actually changed it on the reference, so my question is why creating a variable first does anything different then just changing it on the same line? it would have worked in JS/Python</p> <p><strong>If</strong> I had to do something like</p> <pre><code>var emissionModule = laser.GetComponent&lt;ParticleSystem&gt;().emission; emissionModule.enabled = false; laser.GetComponent&lt;ParticleSystem&gt;().emission = emissionModule </code></pre> <p>I would have understand this issue better, but I <strong>don't</strong> need to do it like here, I don't need to assign it back again somewhy, it works fine as I showed in the 2nd example so it doesn't make sense, emissionModule seems to be a reference and not a value copy</p> <hr /> <hr /> <p><strong>TL;DR version:</strong><br /> Here is a full example of the code:</p> <pre><code>void changeLasers(bool isActive) { foreach (GameObject laser in lasers) { var emissionModule = laser.GetComponent&lt;ParticleSystem&gt;().emission; emissionModule.enabled = isActive; } } </code></pre> <p>Which is weird, it <strong>works</strong> but I didn't need to assign it back again so why couldn't I do it in 1 line? seems weird that c# forces me to use another variable here. This gives the <code>CS1612</code> error:</p> <pre><code>void changeLasers(bool isActive) { foreach (GameObject laser in lasers) { laser.GetComponent&lt;ParticleSystem&gt;().emission.enabled = isActive; } } </code></pre>
[ { "answer_id": 74245984, "author": "derHugo", "author_id": 7111561, "author_profile": "https://Stackoverflow.com/users/7111561", "pm_score": 2, "selected": false, "text": "EmissionModule" } ]
2022/10/29
[ "https://Stackoverflow.com/questions/74245785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3324330/" ]
74,245,788
<p>I have a main navbar with a scroll animation on my website. I wanted to created a fixed, little (and nontransparent) utility bar that would always stay on the top of my site.</p> <p><strong>This is what I have now:</strong></p> <p><a href="https://imgur.com/a/A1s5B1I" rel="nofollow noreferrer">https://imgur.com/a/A1s5B1I</a></p> <p><strong>And this is what happens when I add the utility bar to it:</strong></p> <p><a href="https://i.stack.imgur.com/ryyK0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ryyK0.jpg" alt="Utility" /></a></p> <p>I've tried multiple stuff and I have no idea how to fix this.</p> <p><strong>This is my utility navbar code:</strong></p> <pre><code>export const UtilityNav = styled.nav` background: yellow; position: sticky; min-height: 40px; /* padding-bottom: 20px; */ /* margin-top: 20px; */ /* margin-top: -10px; */ display: flex; justify-content: center; align-items: center; font-size: 1rem; top: 0; z-index: 10; `; </code></pre> <p><strong>And this is my main Navbar code:</strong></p> <pre><code>export const Nav = styled.nav` background: ${({ scrollNav }) =&gt; (scrollNav ? '#81A687' : 'transparent')}; min-height: 80px; margin-top: -80px; display: flex; justify-content: center; align-items: center; font-size: 1rem; position: sticky; top: 0; z-index: 8; transition: 0.8s all ease; @media screen and (max-width: 960px) { transition: 0.8s all ease; } `; </code></pre> <p>The negative <strong>margin-top: -80px</strong> makes the navbar transparent before scrolling down. I think this is something I need to work on, but the most logical (at least for me) change to <strong>margin-top: -110px;</strong> (NavBar height + UtilityBar height) didn't work... :-( I have no other ideas. I'm looking for the easiest way, I'm completely new to this.</p> <p>Thanks in advance!</p>
[ { "answer_id": 74246249, "author": "DraGonM", "author_id": 19844393, "author_profile": "https://Stackoverflow.com/users/19844393", "pm_score": 0, "selected": false, "text": "relative" }, { "answer_id": 74253962, "author": "kwi", "author_id": 17767762, "author_profile"...
2022/10/29
[ "https://Stackoverflow.com/questions/74245788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17767762/" ]
74,245,802
<p>I need to convert time from list of dictionaries, that I made from json file, to date time format the json file looks like this</p> <pre><code>{&quot;name&quot;: &quot;Thomas&quot;, &quot;time_created&quot;: 1665070563, &quot;gender&quot;: null} {&quot;name&quot;: &quot;Lisa&quot;, &quot;time_created&quot;: 1665226717, &quot;gender&quot;: &quot;female&quot;, &quot;age&quot;: 59} {&quot;name&quot;: &quot;James&quot;, &quot;time_created&quot;: 1664913997, &quot;gender&quot;: &quot;male&quot;, &quot;last_name&quot;: &quot;Rogers&quot;} {&quot;name&quot;: &quot;Helen&quot;, &quot;time_created&quot;: 1664651357, &quot;gender&quot;: &quot;female&quot;, &quot;last_name&quot;: &quot;Scott&quot;} {&quot;name&quot;: &quot;Nora&quot;, &quot;time_created&quot;: 1664689732, &quot;gender&quot;: &quot;female&quot;, &quot;age&quot;: null} </code></pre> <p>I try to write this code</p> <pre><code>import jsonlines import datetime with jsonlines.open('data.jsonl', 'r') as jsonl_f: lst = [obj for obj in jsonl_f] for value_man in lst: for value in value_man.keys(): value['time_created'] = datetime.datetime.fromtimestamp(value['time_created']) print(lst) </code></pre> <p>but I have a error here</p> <blockquote> <p>value['time_created'] = str(datetime.datetime.fromtimestamp(value['time_created'])) TypeError: string indices must be integers</p> </blockquote>
[ { "answer_id": 74246249, "author": "DraGonM", "author_id": 19844393, "author_profile": "https://Stackoverflow.com/users/19844393", "pm_score": 0, "selected": false, "text": "relative" }, { "answer_id": 74253962, "author": "kwi", "author_id": 17767762, "author_profile"...
2022/10/29
[ "https://Stackoverflow.com/questions/74245802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14687764/" ]
74,245,806
<p>I am using the REST Countries API to retrieve data from different countries, the point is to generate a HTML code to insert, depending on the country data.</p> <p>But as I'm trying to point the language data in my HTML code, it of course returns me an object.</p> <p>Here are two examples of the data from the API:</p> <pre><code>languages: {cat: 'Catalan'} languages: {fra: 'French'} </code></pre> <p>The line of code in my HTML:</p> <pre><code>&lt;p class=&quot;country__row&quot;&gt;&lt;span&gt;️&lt;/span&gt;${data.languages}&lt;/p&gt; </code></pre> <p>I would like to retrieve the values of the first field in those objects (Catalan or French) without having to, of course, write <code>${data.languages.fra}</code> in my HTML code.</p> <p>Thank you for your help.</p> <p>I tried <code>${data.languages[0]}</code> and <code>${data.languages[0].value}</code>, doesn't work.</p>
[ { "answer_id": 74245900, "author": "Trishant Pahwa", "author_id": 6072570, "author_profile": "https://Stackoverflow.com/users/6072570", "pm_score": 1, "selected": false, "text": "Object.keys()" }, { "answer_id": 74245947, "author": "user11877521", "author_id": 11877521, ...
2022/10/29
[ "https://Stackoverflow.com/questions/74245806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20365919/" ]
74,245,829
<p>Is it possible to filter SQLite column values in <strong>SQL</strong> based on whether the value is numeric or textual? I have seen references to using <code>CAST</code> for this purpose. However, it appears to be useless as <code>SELECT CAST('1a' AS NUMERIC)</code> passes the check for a numeric type.</p>
[ { "answer_id": 74247431, "author": "anefeletos", "author_id": 1237786, "author_profile": "https://Stackoverflow.com/users/1237786", "pm_score": 0, "selected": false, "text": "SELECT [FilterColumn] FROM [Table] WHERE [FilterColumn]='0' OR (ceiling(log([FilterColumn],10)) =LENGTH([FilterC...
2022/10/29
[ "https://Stackoverflow.com/questions/74245829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17472988/" ]
74,245,840
<p>I am new in flutter and i have some codes to build textfield. i want to make an initial value in textfield but this is from input in another class.</p> <pre><code>class TextFieldEdit extends StatefulWidget { TextFieldEdit({ Key? key, required this.title, required this.hintTxt, required this.controller, required this.defaultTxt, }) : super(key: key); final String title, hintTxt; final controller; final defaultTxt; @override State&lt;TextFieldEdit&gt; createState() =&gt; _TextFieldEditState(); } class _TextFieldEditState extends State&lt;TextFieldEdit&gt; { TextEditingController _controller = TextEditingController(); @override void initState() { super.initState(); _controller.text = defaultTxt; } @override Widget build(BuildContext context) { return ... } </code></pre> <p>in <code>_TextFieldEditState</code> class at the _controller.text i want to get value from <code>defaultTxt</code> in <code>TextFieldEdit</code> class. But how can i send it to <code>_TextFieldEditState</code> class?</p> <p>the error message is : Undefined name 'defaultTxt'. Try correcting the name to one that is defined, or defining the name.</p>
[ { "answer_id": 74245873, "author": "eamirho3ein", "author_id": 10306997, "author_profile": "https://Stackoverflow.com/users/10306997", "pm_score": 2, "selected": false, "text": "widget." }, { "answer_id": 74245985, "author": "Yeasin Sheikh", "author_id": 10157127, "au...
2022/10/29
[ "https://Stackoverflow.com/questions/74245840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14322829/" ]