qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
74,262,004
<p>My structure is as follows:</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>.root-div { display: inline-block; background-image: url('...'); background-size: cover; width: 100vw; height: 100vh; position: relative; } .auth { margin: 3rem auto; width: 95%; max-width: 25rem; border-radius: 6px; background-color: darkcyan; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 1rem; text-align: center; } .btn { /* should be showing part of the root-div's background image */ }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div className="root-div"&gt; &lt;div className="auth"&gt; &lt;button className="btn"&gt;Submit&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;</code></pre> </div> </div> </p> <p>I would like for my button to show through to the root-div's background image. Setting it to transparent of course doesn't work because auth's styles are then shown. What would be some approaches to achieve this effect? Thank you.</p>
[ { "answer_id": 74262488, "author": "Avais", "author_id": 6314076, "author_profile": "https://Stackoverflow.com/users/6314076", "pm_score": 2, "selected": true, "text": ".btn {\n background-image: url('https://unsplash.it/640/425');\n background-size:cover;\n background-attachmen...
2022/10/31
[ "https://Stackoverflow.com/questions/74262004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4852315/" ]
74,262,062
<p>Im trying to get the location for sotre from google maps but my code sometimes gets it for a store and sometimes it doesnt get it for another. here the link to the google colab</p> <p><a href="https://colab.research.google.com/drive/1ncrffQMGyeudUkMiGSrCfssifVScfYa-?usp=sharing" rel="nofollow noreferrer">https://colab.research.google.com/drive/1ncrffQMGyeudUkMiGSrCfssifVScfYa-?usp=sharing</a></p> <p>you can see in the end that it gets it for &quot;blaze&quot; and not for &quot;apple&quot; or &quot;ferrari&quot;</p> <p>why and how can this be?</p> <p>NOTE: it is NOT about the page having to load, i made it wait up until 20 seconds and it still does not work.</p> <p>i expect to get the location for each link i give it to it</p>
[ { "answer_id": 74262732, "author": "KunduK", "author_id": 10885684, "author_profile": "https://Stackoverflow.com/users/10885684", "pm_score": 1, "selected": false, "text": "xpath" }, { "answer_id": 74262786, "author": "Eugeny Okulik", "author_id": 12023661, "author_pr...
2022/10/31
[ "https://Stackoverflow.com/questions/74262062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20370678/" ]
74,262,066
<p>I want to give my input type as password so I want it as censored. I want to use &quot;obscureText: true,&quot; so it works but when I want to declare it a function and add a button that will show the password when you click and hide when you click it again. I am trying to add suffix property and IconButton(); but it is not working.</p> <pre><code>bool hide() { return true; } @override Widget build(BuildContext context){ return Form( key: loginClass, ... Padding( padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 8), child: TextFormField( controller: password, obscureText: hide(), decoration: const InputDecoration( labelText: &quot;Password&quot;, hintText: &quot;Enter your password&quot;, border: OutlineInputBorder(), icon: Icon(Icons.lock), // Suffix line. suffix: IconButton( icon: Icon(Icons.visibility_rounded), onPressed: !hide, // Error line. ), ), validator: (String? value) { if (value == null || value.isEmpty) { return 'Please enter your password'; } return null; }, ), ), ... } </code></pre> <p>Error:</p> <pre><code>Performing hot restart... Syncing files to device Android SDK built for x86... lib/login.dart:107:31: Error: Not a constant expression. onPressed: !hide, ^^^^ lib/login.dart:107:31: Error: A value of type 'bool Function()' can't be assigned to a variable of type 'bool'. onPressed: !hide, ^ lib/login.dart:107:30: Error: The argument type 'bool' can't be assigned to the parameter type 'void Function()?'. onPressed: !hide, ^ Restarted application in 218ms. </code></pre> <p>I want to add a icon button. Once you click it, the password will be shown but if you click again will be censored.</p>
[ { "answer_id": 74262095, "author": "Tirth Patel", "author_id": 4593315, "author_profile": "https://Stackoverflow.com/users/4593315", "pm_score": 0, "selected": false, "text": "onPressed" }, { "answer_id": 74262178, "author": "Vivek Tarsariya", "author_id": 20201716, "...
2022/10/31
[ "https://Stackoverflow.com/questions/74262066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19661302/" ]
74,262,070
<p>I am using a ConcurrentHashMap, and I need to iterate over all its elements when calculating a new element that is not present yet and do some other modifications possibly over the same map.</p> <p>I wanted those operations be atomic, and block the ConcurrentHashMap to prevent from getting an exception derived from concurrency.</p> <p>The solution I programmed was to synchronize the ConcurrentHashMap object with itself as lock, but Sonar reports a major issue, so I do not know whether that solution is correct</p> <p>Proposed code:</p> <p>Modification to the original text</p> <pre><code>public class MyClass&lt;K, V&gt; { ConcurrentHashMap&lt;K, V&gt; map = new ConcurrentHashMap&lt;&gt;(); public V get(K key) { return map.computeIfAbsent(key, this::calculateNewElement); } protected V calculateNewElement(K key) { V result; // the following line throws the sonar issue: synchronized(map) { // calculation of the new element (assignating it to result) // with iterations over the whole map // and possibly with other modifications over the same map } return result; } } </code></pre> <p>This code triggers a Sonar major issue:</p> <blockquote> <p>Multi-threading - Synchronization performed on util.concurrent instance</p> <p>findbugs:JLM_JSR166_UTILCONCURRENT_MONITORENTER</p> <p>This method performs synchronization on an object that is an instance of a class from the java.util.concurrent package (or its subclasses). Instances of these classes have their own concurrency control mechanisms that are orthogonal to the synchronization provided by the Java keyword synchronized. For example, synchronizing on an AtomicBoolean will not prevent other threads from modifying the AtomicBoolean.</p> <p>Such code may be correct, but should be carefully reviewed and documented, and may confuse people who have to maintain the code at a later date.</p> </blockquote>
[ { "answer_id": 74267724, "author": "Francisco Javier Rojas", "author_id": 5698125, "author_profile": "https://Stackoverflow.com/users/5698125", "pm_score": 0, "selected": false, "text": "public class MyClass<K, V> {\n ConcurrentHashMap<K, V> map = new ConcurrentHashMap<>();\n\n pub...
2022/10/31
[ "https://Stackoverflow.com/questions/74262070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5698125/" ]
74,262,089
<p>I am using <code>rxjs</code> for filter and find the include value. but getting an error as <code>TypeError: value.includes is not a function</code> any one correct me please?</p> <p>here is my function:</p> <pre><code> fetchPaginatedList(pageSize, searchTerm) { return this.list$ .pipe( map((list) =&gt; list.filter((item) =&gt; Object.values(item).some((value) =&gt; value.includes(searchTerm) ) ) ), map((list) =&gt; ({ size: list.length.toString(), list: list.splice(0, pageSize), })) ) .toPromise(); } </code></pre> <p>what is the correct way to integrate the <code>include</code> with rxjs filter?</p>
[ { "answer_id": 74264593, "author": "user2024080", "author_id": 2024080, "author_profile": "https://Stackoverflow.com/users/2024080", "pm_score": 1, "selected": true, "text": "fetchPaginatedList(pageSize, searchTerm) {\n return this.list$\n .pipe(\n map((l...
2022/10/31
[ "https://Stackoverflow.com/questions/74262089", "https://Stackoverflow.com", "https://Stackoverflow.com/users/218349/" ]
74,262,103
<p>I have To-Do list elements which can expand and collapse by pressing the associated button.</p> <p><a href="https://i.stack.imgur.com/nz27l.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nz27l.gif" alt="Android Emulator. Same behavior on my physical Android device" /></a></p> <p>By pressing on the EXPAND Button the height of the Animated ScrollView gets adjusted. From 0 to 100 when expanding and from 100 to 0 when collapsing. When we expand two list-objects at the same time, the screen begins to flicker.</p> <p>Here the code of one single todo-element (it is abbreviated, means the DONE button is not in it):</p> <pre class="lang-js prettyprint-override"><code> import React, { useState, useRef, memo } from 'react'; import { Animated, Text, View, Button, ScrollView } from 'react-native'; import longText from '../data/data'; const ListObject = (props) =&gt; { //Object Expand and Collapse feature const expandValue = useRef(new Animated.Value(0)).current; const [expandState, setExpand] = useState(false); const expandAnimation = () =&gt; { Animated.timing(expandValue, {toValue: 100, duration: 1000, useNativeDriver: false}).start(); setExpand(true); } const collapseAnimation = () =&gt; { Animated.timing(expandValue, {toValue: 0, duration: 1000, useNativeDriver: false}).start(); setExpand(false); } return ( &lt;View style={{ margin: props.margin }}&gt; &lt;View style={{ flexDirection: 'row', backgroundColor: 'grey', borderRadius: 10, }}&gt; &lt;Button title='EXPAND' style={{ flex: 1, backgroundColor: 'blue', }} onPress={ expandState ? collapseAnimation : expandAnimation } /&gt; &lt;/View&gt; &lt;Animated.ScrollView style={{ flex: 1, paddingHorizontal: 40, backgroundColor: 'grey', borderRadius: 10, maxHeight: expandValue }}&gt; &lt;Text&gt;{ props.text }&lt;/Text&gt; &lt;/Animated.ScrollView&gt; &lt;/View&gt; ); } export default memo(ListObject); </code></pre> <p>Here is the code for the App. To make a collection of all todo-elements, I map over a list and assign a key to each element:</p> <pre class="lang-js prettyprint-override"><code>mport React, { useRef, useState } from 'react'; import { Animated, StyleSheet, ScrollView, Text, View, SafeAreaView, Button } from 'react-native'; import longText from './src/data/data'; import ListObject from './src/components/list-object' const styles = StyleSheet.create({ safeContainer: { flex: 1.2 }, headerContainer: { flex: 0.2, flexDirection: 'column', justifyContent: 'center', backgroundColor: 'lightblue', }, headerFont: { fontSize: 50, textAlign: 'center', }, scrollContainer: { flex: 1 } }); const App = () =&gt; { const numbers = [1,2,3,4,5,6,7,8,9]; const listItems = numbers.map((number) =&gt; &lt;ListObject key={number.toString()} margin={10} headerText='I am the header of the to-do element' text={longText} /&gt; ) return ( &lt;SafeAreaView style={ styles.safeContainer } &gt; &lt;View style={ styles.headerContainer }&gt; &lt;Text style={ [styles.headerFont] }&gt;LIST MAKER&lt;/Text&gt; &lt;/View&gt; &lt;ScrollView style={ styles.scrollContainer }&gt; {listItems} &lt;/ScrollView&gt; &lt;/SafeAreaView&gt; ); }; export default App; </code></pre> <p>I expected no flickering. The flickering appears also on my physical Android device. I have searched for similar problems and checked other libraries how they implement it.</p>
[ { "answer_id": 74262462, "author": "Nensi Kasundra", "author_id": 7846071, "author_profile": "https://Stackoverflow.com/users/7846071", "pm_score": 1, "selected": false, "text": "import Accordion from 'react-native-collapsible/Accordion';\n\nconst [activeSections, setActiveSessions] = us...
2022/10/31
[ "https://Stackoverflow.com/questions/74262103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20378303/" ]
74,262,108
<p>i got a problem with composer In the VM instance, php and some packages installed(listed in composer.lock file) When i try to install new package at local(i copy package folder from another VM can install via internet) the old composer.lock which list installed package will be replace with information of only new package i install.</p> <p>step:</p> <p>i update composer.json with new package</p> <pre><code>{ &quot;repositories&quot;: [ { &quot;packagist&quot;: false }, { &quot;type&quot;: &quot;path&quot;, &quot;url&quot;: &quot;/path/to/artifact/&quot; } ], &quot;require&quot;: { &quot;firebase/php-jwt&quot;: &quot;^6.4&quot; } } </code></pre> <p>then run php composer.phar update</p> <pre><code>new package installed but composer.lock just have only new package(php-jwt) all other contents deleted Loading composer repositories with package information Updating dependencies Lock file operations: 1 install, 0 updates, 50 removals - Removing cakephp/debug_kit (2.2.9) - Removing clue/stream-filter (v1.6.0) - Removing composer/installers (v1.12.0) - Removing doctrine/instantiator (1.4.1) ... - Locking firebase/php-jwt (6.4.0) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 1 install, 0 updates, 0 removals - Downloading firebase/php-jwt (6.4.0) - Installing firebase/php-jwt (6.4.0): Extracting archive 1 package suggestions were added by new dependencies, use `composer suggest` to see details. Generating autoload files No security vulnerability advisories found </code></pre> <p>what i can do for install new package and update(append) information to composer.lock instead of add only new package to it?</p> <p>Update: i change update command to require, the same result</p> <pre><code>php composer.phar require /path/to/artifact/ </code></pre>
[ { "answer_id": 74273346, "author": "Bl457Xor", "author_id": 19983298, "author_profile": "https://Stackoverflow.com/users/19983298", "pm_score": 1, "selected": false, "text": "composer update\n" }, { "answer_id": 74280685, "author": "hakre", "author_id": 367456, "autho...
2022/10/31
[ "https://Stackoverflow.com/questions/74262108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6440802/" ]
74,262,112
<p>I would like to ignore the default values after calling asdict()</p> <pre><code>@dataclass class A: a: str b: bool = True </code></pre> <p>so if I call</p> <pre><code>a = A(&quot;1&quot;) result = asdict(a, ignore_default=True) assert {&quot;a&quot;: &quot;1&quot;} == result # the &quot;b&quot;: True should be deleted </code></pre>
[ { "answer_id": 74293119, "author": "rv.kvetch", "author_id": 10237506, "author_profile": "https://Stackoverflow.com/users/10237506", "pm_score": 3, "selected": true, "text": "dataclasses" }, { "answer_id": 74293357, "author": "S.B", "author_id": 13944524, "author_prof...
2022/10/31
[ "https://Stackoverflow.com/questions/74262112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412137/" ]
74,262,125
<p><strong>What the problem is:</strong></p> <p>I'm trying to implement a class that will have two specializations, one for integral types and one for all others. The first version that came to my mind:</p> <pre><code> #include &lt;type_traits&gt; template&lt;typename T, typename std::enable_if_t&lt;std::is_integral&lt;T&gt;::value, bool&gt; = true&gt; class Test { }; template&lt;typename T, typename std::enable_if_t&lt;!std::is_integral&lt;T&gt;::value, bool&gt; = true&gt; class Test { }; </code></pre> <p>But GCC fails with the following error when I try to <a href="https://godbolt.org/z/hefKvMzqj" rel="nofollow noreferrer">compile</a> the code above:</p> <pre><code> &lt;source&gt;:2:84: error: template parameter 'typename std::enable_if&lt;std::is_integral&lt;_Tp&gt;::value, bool&gt;::type &lt;anonymous&gt;' template&lt;typename T, typename std::enable_if_t&lt;std::is_integral&lt;T&gt;::value, bool&gt; = true&gt; ^~~~ &lt;source&gt;:6:85: note: redeclared here as 'typename std::enable_if&lt;(! std::is_integral&lt;_Tp&gt;::value), bool&gt;::type &lt;anonymous&gt;' template&lt;typename T, typename std::enable_if_t&lt;!std::is_integral&lt;T&gt;::value, bool&gt; = true&gt; ^~~~ </code></pre> <p>However, using a similar technique for functions <a href="https://godbolt.org/z/PWGqbeMP5" rel="nofollow noreferrer">compiles</a> without problems:</p> <pre><code> #include &lt;type_traits&gt; template&lt;typename T, typename std::enable_if_t&lt;std::is_integral&lt;T&gt;::value, bool&gt; = true&gt; void test() { } template&lt;typename T, typename std::enable_if_t&lt;!std::is_integral&lt;T&gt;::value, bool&gt; = true&gt; void test() { } </code></pre> <p><strong>What I am trying to achieve:</strong></p> <ol> <li>First of all, I want to understand why the version with functions compiles, but the version with classes does not.</li> <li>My second goal is to implement a class that satisfies the conditions that I specified at the very beginning.</li> </ol> <p><strong>What I have tried:</strong></p> <p>Using partial specializations solves problem 2:</p> <pre><code> #include &lt;type_traits&gt; template&lt;typename T, bool = std::is_integral&lt;T&gt;::value&gt; class Test; template&lt;typename T&gt; class Test&lt;T, true&gt; { }; template&lt;typename T&gt; class Test&lt;T, false&gt; { }; </code></pre> <p>But this approach is bad because it allows to use <code>Test&lt;float, true&gt;</code> and if I understand correctly (please correct me if I'm wrong), then specialization for integral types will be used, which is not what I want.</p> <p><strong>Summarizing:</strong></p> <p>I'll just duplicate my goals in the form of questions:</p> <ol> <li>Why does the version with functions compile, but the version with classes doesn't?</li> <li>How can I implement a class that satisfies the conditions that I specified at the very beginning?</li> </ol>
[ { "answer_id": 74293119, "author": "rv.kvetch", "author_id": 10237506, "author_profile": "https://Stackoverflow.com/users/10237506", "pm_score": 3, "selected": true, "text": "dataclasses" }, { "answer_id": 74293357, "author": "S.B", "author_id": 13944524, "author_prof...
2022/10/31
[ "https://Stackoverflow.com/questions/74262125", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16326021/" ]
74,262,126
<p>I have variable like this (input comes from Terragrunt):</p> <pre><code>zones: zone_a: - name: &quot;test&quot; type: &quot;A&quot; value: &quot;127.0.7.2&quot; - name: &quot;test2&quot; type: &quot;A&quot; value: &quot;127.0.7.3&quot; zone_b: - name: &quot;test3&quot; type: &quot;A&quot; value: &quot;127.0.7.5&quot; - name: &quot;test4&quot; type: &quot;A&quot; value: &quot;127.0.7.6&quot; </code></pre> <p>How can I loop through it in Terraform. <code>for_each</code> doesn't seem to work as it doesn't accept list.</p> <p>I would like to have many records like so:</p> <pre><code>resource &quot;cloudflare_record&quot; &quot;record&quot; { zone_id = &quot;zone_a&quot; name = &quot;test&quot; value = &quot;127.0.7.2&quot; type = &quot;A&quot; } </code></pre> <p>The same would go for every record in every zone.</p>
[ { "answer_id": 74263302, "author": "Chris Doyle", "author_id": 1212401, "author_profile": "https://Stackoverflow.com/users/1212401", "pm_score": 2, "selected": true, "text": "variable \"zones\" {\n type = any\n default = {\n zone_a = [\n {\n name = \"test\"\n t...
2022/10/31
[ "https://Stackoverflow.com/questions/74262126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9223556/" ]
74,262,137
<p>I am trying to update multiple values at the same time,</p> <p>Table values</p> <pre><code>UniqueRef, Name 1101, AA01 1102, AA02 1103, AA03 </code></pre> <p>I want to update UniqueRef for all of 1101, 1102 and 1103 to different values e.g 1101 will be updated to 1101AB ect</p> <p>how can I do this in bulk than one at a time?</p>
[ { "answer_id": 74263302, "author": "Chris Doyle", "author_id": 1212401, "author_profile": "https://Stackoverflow.com/users/1212401", "pm_score": 2, "selected": true, "text": "variable \"zones\" {\n type = any\n default = {\n zone_a = [\n {\n name = \"test\"\n t...
2022/10/31
[ "https://Stackoverflow.com/questions/74262137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11148700/" ]
74,262,148
<p>I'm designing an Instagram clone. I had a problem with the story feature. When the story opened, I made the lines above. These lines are made up of divs. They all have a common class. I made this for CSS design. But I made an active id that won't happen to all of them.</p> <p>Those with active id will be white and their opacity will be 1. Those who do not have this id will have an opacity of 0.5</p> <p>It works when you assign a single id. But when I assign the second id, only the first one works.</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-js lang-js prettyprint-override"><code>const active = document.getElementById("active"); active.style.backgroundColor = "white"; active.style.opacity = 1;</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>.flex-container { display: flex; flex-direction: row; } .flex-container-item { background-color: rgb(255, 255, 255); opacity: 0.5; padding: 1px; flex: 1pt; margin-right: 5px; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="flex-container"&gt; &lt;div class="flex-container-item" id="active"&gt;A&lt;/div&gt; &lt;div class="flex-container-item"&gt;B&lt;/div&gt; &lt;div class="flex-container-item"&gt;C&lt;/div&gt; &lt;div class="flex-container-item"&gt;D&lt;/div&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
[ { "answer_id": 74262346, "author": "ognjenj", "author_id": 19675559, "author_profile": "https://Stackoverflow.com/users/19675559", "pm_score": 2, "selected": true, "text": ".active {\n background-color: white;\n opacity: 1;\n }\n" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74262148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20337722/" ]
74,262,149
<p>I've cloned a project which uses Yarn 1.x and am trying to run it, but I can't find a way to get the right version of Yarn. I think I must be missing something.</p> <p>Commented Terminal session:</p> <pre class="lang-bash prettyprint-override"><code># using node16.18.0 $ nvm use v16 Now using node v16.18.0 (npm v8.19.2) # start with no yarn installed $ yarn --version zsh: command not found: yarn # package.json has packageManager set for Yarn v1.22.19 $ cat package.json | grep packageManager &quot;packageManager&quot;: &quot;yarn@1.22.19&quot; # enable corepack, and it ignores the packageManager version $ corepack enable $ yarn --version 3.2.4 # manually ask corepack to use v1.22.19, but it again ignores this $ corepack prepare yarn@1.22.19 --activate Preparing yarn@1.22.19 for immediate activation... $ yarn --version 3.2.4 # manually ask corepack to run yarn 1.22.19, but it again ignores it $ corepack yarn@1.22.19 --version 3.2.4 </code></pre> <p>So using Corepack I don't seem to be able to convince it to use version of Yarn.</p> <p>In addition installing using <code>npm install -g</code> also doesn't seem to work correctly.</p> <pre class="lang-bash prettyprint-override"><code># disable corepack so there's no yarn installed $ corepack disable $ yarn --version zsh: command not found: yarn # install yarn v1.22.19 $ npm install -g yarn@1.22.19 added 1 package, and audited 2 packages in 326ms found 0 vulnerabilities # somehow it's installed 3.2.4 again $ yarn --version 3.2.4 </code></pre>
[ { "answer_id": 74262922, "author": "Callum M", "author_id": 1375972, "author_profile": "https://Stackoverflow.com/users/1375972", "pm_score": 0, "selected": false, "text": "corepack" }, { "answer_id": 74551446, "author": "Mathéo R.", "author_id": 5410123, "author_prof...
2022/10/31
[ "https://Stackoverflow.com/questions/74262149", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1375972/" ]
74,262,169
<p>On my migration file I have a number of new fields creation.</p> <pre><code>create_table :mytable do |t| t.string :my_field, null: false ......... </code></pre> <p>And I am getting the following</p> <pre><code> Metrics/AbcSize: Assignment Branch Condition size for change is too high. [&lt;1, 17, 0&gt; 17.03/17] </code></pre> <p>What is the proper way to avoid that?</p>
[ { "answer_id": 74262922, "author": "Callum M", "author_id": 1375972, "author_profile": "https://Stackoverflow.com/users/1375972", "pm_score": 0, "selected": false, "text": "corepack" }, { "answer_id": 74551446, "author": "Mathéo R.", "author_id": 5410123, "author_prof...
2022/10/31
[ "https://Stackoverflow.com/questions/74262169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15907304/" ]
74,262,202
<p>I want to add C++ class like this <em>notchedrectangle.hpp</em> to QML:</p> <pre><code>#ifndef NOTCHEDRECTANGLE_HPP #define NOTCHEDRECTANGLE_HPP #include &lt;QtQml/qqmlregistration.h&gt; #include &lt;QQuickPaintedItem&gt; class NotchedRectangle : public QQuickPaintedItem { Q_OBJECT Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) QML_ELEMENT public: NotchedRectangle(); void paint(QPainter* painter) override; QColor color() const; void setColor(QColor color); signals: void colorChanged(); private: QColor m_color; }; #endif // NOTCHEDRECTANGLE_HPP </code></pre> <p>I have qmake build system, but don't know - what should I add in qmake file.</p> <p>My filesystem looks like that:</p> <p><a href="https://i.stack.imgur.com/cmkBx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cmkBx.png" alt="enter image description here" /></a></p> <p>I tried to add to qmake file this strings:</p> <pre><code>CONFIG += qmltypes QML_IMPORT_NAME = UI.NR QML_IMPORT_MAJOR_VERSION = 1 INCLUDEPATH += UI/NotchedRectangle </code></pre> <p>But they will cause error:</p> <blockquote> <p>[Makefile.Debug:1175: qlauncher_metatypes.json] Error 1</p> </blockquote> <p>Can you help me, please?</p>
[ { "answer_id": 74262922, "author": "Callum M", "author_id": 1375972, "author_profile": "https://Stackoverflow.com/users/1375972", "pm_score": 0, "selected": false, "text": "corepack" }, { "answer_id": 74551446, "author": "Mathéo R.", "author_id": 5410123, "author_prof...
2022/10/31
[ "https://Stackoverflow.com/questions/74262202", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9780820/" ]
74,262,224
<p>I am using a browseSupportFragment element in my android tv app having headers enabled and a single row for every header the problem is when i select the first item of every row by scrolling down, or when i select a header of the header list, the function <code>getSelectedPosition</code> return 0 always</p> <p>it return the right index of row when i select the second item in the row</p> <p>i am pretty sure that this is a bug !!</p> <p>below the code of onItemSelected</p> <pre><code> @Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { int pos = getSelectedPosition();//this return 0 if i scroll down between headers } </code></pre>
[ { "answer_id": 74262303, "author": "Malo", "author_id": 3276411, "author_profile": "https://Stackoverflow.com/users/3276411", "pm_score": 0, "selected": false, "text": " @Override\npublic int getSelectedPosition() {\n return super.getSelectedPosition();\n}\n" }, { "answer_id...
2022/10/31
[ "https://Stackoverflow.com/questions/74262224", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3276411/" ]
74,262,283
<p>I am working through a tutorial on the Microsoft Learn area for uploading image data in the cloud with Azure storage.</p> <p>The tutorial instructs users to deploy a web app from a public Github sample repository, configure web app settings, and then save it to a storage account.</p> <p>I have completed the steps: Hi there,</p> <p>I am working through a tutorial on the Microsoft Learn area for uploading image data in the cloud with Azure storage.</p> <p><a href="https://learn.microsoft.com/en-us/azure/event-grid/storage-upload-process-images?tabs=dotnet%2Cazure-powershell#feedback" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/event-grid/storage-upload-process-images?tabs=dotnet%2Cazure-powershell#feedback</a></p> <p>The tutorial instructs users to deploy a web app from a public Github sample repository, configure web app settings, and then save it to a storage account.</p> <p>I have completed the steps:</p> <p>Deploy the sample app from the GitHub repository Configure web app settings I am halfway through the 'Upload an Image' section, but the image isn't showing in the Microsoft Azure Storage account I have.</p> <p>Any ideas of what to check? Is there a way I can check my web app configuration settings, including viewing the linked storage account? Thanks,</p> <p>Robert</p>
[ { "answer_id": 74263051, "author": "FerdiS", "author_id": 8399428, "author_profile": "https://Stackoverflow.com/users/8399428", "pm_score": 0, "selected": false, "text": "Connect-AzAccount\n\n$resourceGroupName = \"your_resource_group_name\"\n$webAppName = \"your_webapp_name\"\n...
2022/10/31
[ "https://Stackoverflow.com/questions/74262283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2308269/" ]
74,262,332
<p>I have a table named <code>Users</code>, with userId as one of the column, the user can be in any one of given 5 possible states which are (Unregistered, registered, subscribed, premier, unsubscribed).</p> <p>I want a query which can give me a list of all those userIds which have gone through all the states.</p> <p>Can someone help me out with that.</p> <p>i am sharing a sample schema as well to understand the problem better</p> <pre><code>userId state created_at 1 Unregistered 1/10/22 2 Unregistered 4/10/22 3 registered 4/10/22 2 registered 5/10/22 1 registered 7/10/22 1 subscribed 12/10/22 2 subscribed 13/10/22 2 premier 22/10/22 2 unsubscribed 23/10/22 3 unsubscribed 25/10/22 1 unsubscribed 25/10/22 </code></pre> <p>here, as you can see, only userId = 2 can be the correct answer, as it is going through all the required states.</p>
[ { "answer_id": 74262449, "author": "VvdL", "author_id": 15589010, "author_profile": "https://Stackoverflow.com/users/15589010", "pm_score": 2, "selected": true, "text": "userid" }, { "answer_id": 74262626, "author": "Ergest Basha", "author_id": 16461952, "author_profi...
2022/10/31
[ "https://Stackoverflow.com/questions/74262332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7783649/" ]
74,262,344
<p>Using TSQL <a href="https://learn.microsoft.com/en-us/sql/t-sql/xml/insert-xml-dml?view=sql-server-ver16" rel="nofollow noreferrer"><code>modify</code></a> how can I initialise a null column with a root XML element, and use the value of a column to create/populate a nested element?</p> <p>From what I can tell, there's no way to create a root XML node on a NULL column using <code>modify</code>.</p> <p>Example table...</p> <pre><code>Id Val MyXML 1 2 NULL 2 5 NULL </code></pre> <p>Expected outcome...</p> <pre><code>1 2 &lt;data&gt;&lt;val&gt;2&lt;/val&gt;&lt;/data&gt; 2 5 &lt;data&gt;&lt;val&gt;5&lt;/val&gt;&lt;/data&gt; </code></pre> <p>The only way I can figure out doing it is the nasty string concatenation...</p> <pre><code>UPDATE MyTable SET MyXML = '&lt;data&gt;&lt;val&gt;' + CONVERT(VARCHAR(10),Val) + '&lt;/val&gt;&lt;/data&gt;' </code></pre> <p>Or having two queries, the first to create the root, the second to add the element...</p> <pre><code>UPDATE MyTable SET MyXML = '&lt;data&gt;&lt;/data&gt;' UPDATE MyTable SET MyXML.modify('insert &lt;val&gt;{sql:column(&quot;Val&quot;)}&lt;/val&gt; into /data[1]') </code></pre> <p>Ideally I'd like something like this, but I cannot figure out if it's possible...</p> <pre><code>UPDATE MyTable SET MyXML.modify('insert &lt;data&gt;&lt;val&gt;{sql:column(&quot;Val&quot;)}&lt;/val&gt;&lt;/data&gt;') </code></pre>
[ { "answer_id": 74262427, "author": "TZHX", "author_id": 519348, "author_profile": "https://Stackoverflow.com/users/519348", "pm_score": 2, "selected": true, "text": "UPDATE MyTable\nSET MyXML = (\n SELECT [Val] AS [val]\n FOR XML PATH('data'), TYPE\n)\nWHERE MyXML IS NULL\n" }, ...
2022/10/31
[ "https://Stackoverflow.com/questions/74262344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/930393/" ]
74,262,367
<p>In this scenario:</p> <ul> <li>website.com - Server 1 - GTM installed and tracking - Shopify</li> <li>another.website.com - Server 2 - not tracking scripts currently installed - WordPress</li> </ul> <p>What is the best way to track data through Google Analytics 4 in the above scenario?</p> <p>Should I add the Google Tag Manager ID from GA4 in to &quot;another.website.com&quot; - Server 2 - using <a href="https://gtm4wp.com/" rel="nofollow noreferrer">GTM4WP</a>? Assuming GA4 will handle the rest.</p> <p>Or are there some more advanced settings to be set up?</p> <p>Kind regards,</p> <p>Greg</p>
[ { "answer_id": 74266314, "author": "BNazaruk", "author_id": 3700993, "author_profile": "https://Stackoverflow.com/users/3700993", "pm_score": 1, "selected": false, "text": "go to your GA4 property" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74262367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1219149/" ]
74,262,405
<p>When a blur event occurs it should rounds out the number entered to the closest factor of 15 within 60 (minutes).</p> <p>This works:</p> <ul> <li>When you enter 12 the input value updates to 15</li> <li>When you enter 24 the input value updates to 30</li> </ul> <p>This does not work:</p> <ul> <li>When you enter 12 the input value updates to 15</li> <li>When you enter 11 the input value stays 11</li> </ul> <p>My expectation is the input value always falls back to the corrected number even if it is the same while maintaining the functionality of the buttons 0 to 45 below.</p> <pre><code>import React, { useState } from &quot;react&quot;; const InputComponent = ({ defaultValue }) =&gt; { const [value, setValue] = useState(); const [newValue, setNewValue] = useState(); const roundMinutesTo15 = () =&gt; { const rounded = (Math.round(value / 15) * 15) % 60; setNewValue(rounded); }; return ( &lt;&gt; &lt;input min=&quot;0&quot; max=&quot;0&quot; maxLength=&quot;2&quot; type=&quot;text&quot; // key={newValue ? newValue : defaultValue} defaultValue={newValue ? newValue : defaultValue} // onChange={(e) =&gt; setValue(e.currentTarget.value)} onBlur={() =&gt; roundMinutesTo15()} /&gt; &lt;br /&gt; {/* this works */} New Value: {newValue} &lt;br /&gt; &lt;button type=&quot;button&quot; onClick={() =&gt; setNewValue(0)}&gt;0&lt;/button&gt; &lt;button type=&quot;button&quot; onClick={() =&gt; setNewValue(15)}&gt;15&lt;/button&gt; &lt;button type=&quot;button&quot; onClick={() =&gt; setNewValue(30)}&gt;30&lt;/button&gt; &lt;button type=&quot;button&quot; onClick={() =&gt; setNewValue(45)}&gt;45&lt;/button&gt; &lt;/&gt; ); }; InputComponent.defaultProps = { defaultValue: 0 }; export default InputComponent; </code></pre> <p><a href="https://codesandbox.io/s/wizardly-minsky-6dm8fc?file=/src/InputComponent.jsx:0-810" rel="nofollow noreferrer">Codesandbox</a></p>
[ { "answer_id": 74266314, "author": "BNazaruk", "author_id": 3700993, "author_profile": "https://Stackoverflow.com/users/3700993", "pm_score": 1, "selected": false, "text": "go to your GA4 property" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74262405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1395587/" ]
74,262,436
<p>everyone. I have a one-to-multiple observation, but the &quot;many observations&quot; are in one row. I'd like to break it into many rows (as many as the size of the answer), identifying by the id, just like the image below. I'll relate de &quot;yes/no&quot; answers to how the ones who like apple consumes it and how who doesn't, consumes it. Imma doing all in R. Thanks in advance. <a href="https://i.stack.imgur.com/P2gfF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P2gfF.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74262510, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": true, "text": "separate_rows" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74262436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19613162/" ]
74,262,458
<p>I want to set default function in my child Widget in a constructor.</p> <p>Basically, I have two widgets</p> <ol> <li>Login (Parent Widget)</li> <li>AppButton (Child Widget)</li> </ol> <p>Here is my AppButton.dart</p> <p><a href="https://i.stack.imgur.com/zJnOe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zJnOe.png" alt="AppButton.dart" /></a></p> <p>And I am calling this child widget in Login.dart (Parent) like this:</p> <pre><code>AppButton(title: &quot;Login&quot;) </code></pre> <p>Please give me a way that to set default function without making &quot;onPress&quot; required for it's Parent (Login.dart)</p> <p>TIA</p>
[ { "answer_id": 74262584, "author": "eamirho3ein", "author_id": 10306997, "author_profile": "https://Stackoverflow.com/users/10306997", "pm_score": 2, "selected": false, "text": "static" }, { "answer_id": 74262964, "author": "Sayyid J", "author_id": 15366030, "author_p...
2022/10/31
[ "https://Stackoverflow.com/questions/74262458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13088083/" ]
74,262,476
<p>I have a button in the top right corner of my app and I want to animate something with this button in the middle of the screen. Once the animation ends, I want the button to offset itself with an animation to its original position.</p> <p>Is there something like <code>offset(to: positionOfButton)</code> ?</p> <p>Right now my Top bar with the coin amount button is in a separate view.</p> <pre><code>VStack { TopBar() // Other button in the middle of screen } </code></pre>
[ { "answer_id": 74262584, "author": "eamirho3ein", "author_id": 10306997, "author_profile": "https://Stackoverflow.com/users/10306997", "pm_score": 2, "selected": false, "text": "static" }, { "answer_id": 74262964, "author": "Sayyid J", "author_id": 15366030, "author_p...
2022/10/31
[ "https://Stackoverflow.com/questions/74262476", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20338777/" ]
74,262,496
<p>I'm getting 404 errors on a specific path pattern say xyz/index.html, how to return custom HTML content instead of a 404 Not Found error?</p>
[ { "answer_id": 74262584, "author": "eamirho3ein", "author_id": 10306997, "author_profile": "https://Stackoverflow.com/users/10306997", "pm_score": 2, "selected": false, "text": "static" }, { "answer_id": 74262964, "author": "Sayyid J", "author_id": 15366030, "author_p...
2022/10/31
[ "https://Stackoverflow.com/questions/74262496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17610082/" ]
74,262,518
<p>But it works fine with <code>Instruments-&gt;Time Profiler</code>.</p> <p>All the other documents are closed.</p> <p>Am trying to find a tool to find how much memory is used by my c++ code.</p>
[ { "answer_id": 74377800, "author": "Ben Visness", "author_id": 1177139, "author_profile": "https://Stackoverflow.com/users/1177139", "pm_score": 1, "selected": false, "text": "zsh" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74262518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20051077/" ]
74,262,593
<p>I have created a python script, which I want to run every time a new email arrives in outlook Inbox. So far I have written this VBA code:</p> <pre><code>Sub test() Shell &quot;C:\Users\dimitrios\Anaconda3\Scripts\activate.bat &amp; python C:\Users\dimitrios\test\outlookconnnectivity.py&quot; End Sub </code></pre> <p>The code calls the outlookConnectivity.py script manually. My problem is how I can do that every time a new email arrives.</p> <p>I found online some solutions, which i tried, but did not work</p>
[ { "answer_id": 74377800, "author": "Ben Visness", "author_id": 1177139, "author_profile": "https://Stackoverflow.com/users/1177139", "pm_score": 1, "selected": false, "text": "zsh" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74262593", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20378646/" ]
74,262,606
<p>I build a ecommerce website and have multiple p tag that describe the product. I want that the product description will be align according to vertical line no matter the size of the word that precedes it. I want to know if this is possible to achieve this using perhaps flexbox or something like that but not table.</p> <p>What I have now using gap and flexbox:</p> <p><a href="https://i.stack.imgur.com/YoZhQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YoZhQ.png" alt="This is what I get" /></a></p> <p>Code:</p> <pre><code>p { display:flex; gap: 50px; } &lt;p&gt;&lt;span&gt; Material:&lt;/span&gt; &lt;span &gt; 18k Gold Plating&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span&gt; One:&lt;/span&gt; &lt;span &gt; 18k Plating&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span&gt; Twotwo:&lt;/span&gt; &lt;span &gt; 18k Yellow Plating&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span&gt; threethree:&lt;/span&gt; &lt;span &gt; 18k Gold Plating&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span&gt; Four:&lt;/span&gt; &lt;span &gt; 18k Gold&lt;/span&gt;&lt;/p&gt; </code></pre> <p>What I want:</p> <p><a href="https://i.stack.imgur.com/tuHCb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tuHCb.png" alt="Good one" /></a></p>
[ { "answer_id": 74377800, "author": "Ben Visness", "author_id": 1177139, "author_profile": "https://Stackoverflow.com/users/1177139", "pm_score": 1, "selected": false, "text": "zsh" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74262606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19533023/" ]
74,262,612
<p>I've done a program which counts income per family member and gives a result of funding. There is a problem when one of the family member's &quot;earns negative value&quot; (has a loss), I want it to count negative values as 0.</p> <p>Example of right answer:</p> <pre><code>Family members: 4 Children in family: 2 Input family member income (yearly): 414575 Input family member income (yearly): -12500 Input family member income (yearly): 0 Input family member income (yearly): 0 (Monthly) income per person: 8636.98 Amount of funding: 3200 </code></pre> <p>My result is</p> <pre class="lang-py prettyprint-override"><code>a = int(input('Family members : ')) b = int(input('Children in family ')) income = c = ('Input family member income YEARLY : ') stop = &quot;Wrong Data.&quot; if a &lt; b and a &lt;= 0 or b &lt; 0: print(stop) elif a == b: print(stop) else: lst = [] for n in range(a): incomes = float(input(c)) lst.append(incomes) g = round(sum(lst) / (12 * a), 2) z = print(&quot;MONTLY income per person: &quot;, g) if g &lt; 1500: print(&quot;Amount of funding: &quot;, (800 * b) + (1200 * (a - b))) elif g &gt;= 1500: print(&quot;Amount of funding: &quot;, (500 * b) + (1100 * (a - b))) elif g &gt; 2500: print(&quot;Amount of funding: &quot;, (300 * b) + (900 * (a - b))) </code></pre> <p>I've tried IF function</p> <pre><code>if g &lt; 0: g = 0 </code></pre> <p>but it only counts it as 0 when whole family income is negative (when sum is &lt; 0), and I need it to count every inputed negative income as 0.</p>
[ { "answer_id": 74262707, "author": "en3rgizer", "author_id": 18420456, "author_profile": "https://Stackoverflow.com/users/18420456", "pm_score": 0, "selected": false, "text": "for n in range(a):\n incomes = float(input(c))\n if incomes > 0:\n lst.append(incomes)\n...
2022/10/31
[ "https://Stackoverflow.com/questions/74262612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20378645/" ]
74,262,616
<p>I am trying to implement a listview where I will show the questions of a quiz and each questions will have 4 radio buttons. But when the list gets bigger like 30-50 items the listview scroll becomes very sloppy and laggy. without radio but only text scroll works smooth. Please help me if you have faced similar issue.</p> <p>I tried to use SingleChildScrollview on top of Listview but I didn't get any solutions. I think the problem is with Radio. I dont why this widget is so heavy.</p>
[ { "answer_id": 74262707, "author": "en3rgizer", "author_id": 18420456, "author_profile": "https://Stackoverflow.com/users/18420456", "pm_score": 0, "selected": false, "text": "for n in range(a):\n incomes = float(input(c))\n if incomes > 0:\n lst.append(incomes)\n...
2022/10/31
[ "https://Stackoverflow.com/questions/74262616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7881309/" ]
74,262,620
<p>Dears,</p> <p>How To Remove Characters from String based on Some Conditions ? Knowing that I have one string where I need to :</p> <ol> <li>STEP 01 : Remeove vowels</li> <li>STEP 02 : Remove Duplicate consonants and keep the 1st appeared one.</li> <li>STEP 03 : Remove 1st and Last Characters if string starts/Ends with a given letter.</li> </ol> <p>Example : Word : <strong>Transmuted</strong></p> <p>After Step01 ( Removing Vowels) =&gt; <strong>Trnsmtd</strong> After Step02 ( Removing Duplicate Consnants , here &quot;2nd t&quot;, &quot;2nd n&quot;, &quot;2nd s&quot; ) ==&gt; <strong>Trnsmd</strong> After Step03 ( Removing 1st and Last Characters if word starts or ends with &quot;t&quot; and &quot;d&quot; =&gt; <strong>rnsm</strong></p> <p>Here is my first part of python Script , need the remaining 2 Steps:</p> <pre><code>string = &quot;Transmuted&quot; vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'] result = &quot;&quot; for i in range(len(string)): if string[i] not in vowels: result = result + string[i] print(&quot;\nAfter removing Vowels: &quot;, result) </code></pre> <p><strong>OUTPUT</strong> : After removing Vowels: Trnsmtd</p>
[ { "answer_id": 74262707, "author": "en3rgizer", "author_id": 18420456, "author_profile": "https://Stackoverflow.com/users/18420456", "pm_score": 0, "selected": false, "text": "for n in range(a):\n incomes = float(input(c))\n if incomes > 0:\n lst.append(incomes)\n...
2022/10/31
[ "https://Stackoverflow.com/questions/74262620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20301481/" ]
74,262,632
<p>I have a dataframe where all the column names are dates. When I use <code>.read_csv()</code>, pandas reads these column names as strings. Is there a way to specify that I want the column names to be datetime objects.</p> <p>Ideally I need this to be done as part of the <code>.read_csv()</code> call, rather than an additional line afterwards.</p> <p>For example, the csv file looks something like</p> <pre><code>df = pd.DataFrame({'2022-10-25': [0, 1, 1], '2022-10-26': [1, 1, 0]}) </code></pre> <p>and when I call <code>.read_csv()</code>, I want the column headers to be datetime objects, rather than strings.</p>
[ { "answer_id": 74265130, "author": "ggeop", "author_id": 5544416, "author_profile": "https://Stackoverflow.com/users/5544416", "pm_score": -1, "selected": true, "text": "df = pd.DataFrame({'2022-10-25': [0, 1, 1], '2022-10-26': [1, 1, 0]})\n" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74262632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10199560/" ]
74,262,650
<p>I have a df with with several columns which have only True/False values. I want to create another column whose value will tell me which column has a <code>True</code> value. HEre's an example:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>index</th> <th>bol_1</th> <th>bol_2</th> <th>bol_3</th> <th>criteria</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>True</td> <td>False</td> <td>False</td> <td><code>bol_1</code></td> </tr> <tr> <td>2</td> <td>False</td> <td>True</td> <td>False</td> <td><code>bol_2</code></td> </tr> <tr> <td>3</td> <td>True</td> <td>True</td> <td>False</td> <td>[<code>bol_1</code>, <code>bol_2</code>]</td> </tr> </tbody> </table> </div> <p>My objective is to know which rows have True values(at least 1), and which columns are responsible for those True values. I want to be able to some basic statistics on this new column, e.g. for how many rows is bol_1 the unique column to have a True values.</p>
[ { "answer_id": 74265130, "author": "ggeop", "author_id": 5544416, "author_profile": "https://Stackoverflow.com/users/5544416", "pm_score": -1, "selected": true, "text": "df = pd.DataFrame({'2022-10-25': [0, 1, 1], '2022-10-26': [1, 1, 0]})\n" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74262650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3482266/" ]
74,262,686
<p>I'm new in docker, try to google this issue, bit found nothing.</p> <p>I have to create nexus image from sonatype/nexus3 and change password in admin.password file after creating image.</p> <p>It's my <strong>Dockerfile</strong>:</p> <pre><code>FROM sonatype/nexus3 WORKDIR /nexus-data RUN [&quot;/bin/bash&quot;, &quot;-c&quot;, &quot;echo root &gt;&gt; admin.password&quot;] </code></pre> <p>and when i check the file admin.password (<strong>docker exec &lt;container&gt; cat admin.password</strong>) i have this result: <strong>root</strong></p> <p>And Authorization works if i run continer from sonatype/nexus3 image from docker hub (with default UUID password).</p> <p>What should i do?</p> <p>I am thinking that maybe i rewrite admin profile or delete it somehow?</p>
[ { "answer_id": 74265130, "author": "ggeop", "author_id": 5544416, "author_profile": "https://Stackoverflow.com/users/5544416", "pm_score": -1, "selected": true, "text": "df = pd.DataFrame({'2022-10-25': [0, 1, 1], '2022-10-26': [1, 1, 0]})\n" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74262686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19752924/" ]
74,262,687
<p>Sorting a vector of integers is straight forward as demonstrated <a href="https://stackoverflow.com/a/69764256/4139143">here</a>. However, a vector of floats is more complicated due to potential NaN's and floating point operations.</p> <p>I would like to &quot;combine&quot; the two methods below to get the indicies that would sort a vector of floats, without sorting the actual input vector.</p> <pre><code>// returns the indices that would sort a vector of ints fn argsort&lt;T: Ord&gt;(data: &amp;[T]) -&gt; Vec&lt;usize&gt; { let mut indices = (0..data.len()).collect::&lt;Vec&lt;_&gt;&gt;(); indices.sort_by_key(|&amp;i| &amp;data[i]); indices } </code></pre> <p>and</p> <pre><code>use std::cmp::Ordering; // returns a sorted vector of floats that may contain NaNs, with NaNs at the end fn sort(arr: &amp;Vec&lt;f64&gt;) -&gt; Vec&lt;f64&gt; { let mut out = arr.clone(); out.sort_by(|&amp;a, &amp;b| { match (a.is_nan(), b.is_nan()) { (true, true) =&gt; Ordering::Equal, (true, false) =&gt; Ordering::Greater, (false, true) =&gt; Ordering::Less, (false, false) =&gt; a.partial_cmp(&amp;b).unwrap(), } }); return out; } </code></pre> <p>How can I return a vector of <code>usize</code> indices that would sort an input vector of floats containing NaNs?</p>
[ { "answer_id": 74263286, "author": "LeoCenturion", "author_id": 9077262, "author_profile": "https://Stackoverflow.com/users/9077262", "pm_score": 3, "selected": true, "text": " fn sort(arr: &Vec<f64>) -> Vec<usize> {\n let mut out = (0..arr.len()).collect::<Vec<usize>>();\n out.s...
2022/10/31
[ "https://Stackoverflow.com/questions/74262687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4139143/" ]
74,262,710
<p>In the following Javascript code, why is the exception caught in example 1 and 2, but not in example 3?</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-js lang-js prettyprint-override"><code>const f1 = async () =&gt; { console.log("f1()"); } const f2 = async () =&gt; { throw new Error("error from f2"); } const errorHandler = (error) =&gt; { console.error("caught in errorHandler: " + error); } // Example 1 (caught): f1().then(() =&gt; { throw new Error("error from anonymous") }).catch(errorHandler); // Example 2 (caught): f1().then(async () =&gt; { await f2(); }).catch(errorHandler); // Example 3 (not caught): f1().then(() =&gt; { f2(); }).catch(errorHandler);</code></pre> </div> </div> </p> <p>In particular, examples 1 and 3 appear to be completely identical to me, but why is one caught and not the other?</p>
[ { "answer_id": 74263286, "author": "LeoCenturion", "author_id": 9077262, "author_profile": "https://Stackoverflow.com/users/9077262", "pm_score": 3, "selected": true, "text": " fn sort(arr: &Vec<f64>) -> Vec<usize> {\n let mut out = (0..arr.len()).collect::<Vec<usize>>();\n out.s...
2022/10/31
[ "https://Stackoverflow.com/questions/74262710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/315976/" ]
74,262,716
<p>I'm using <a href="https://api.positionstack.com/v1/reverse" rel="nofollow noreferrer">Positionstack API</a> to build my APP with a location function on Android. The API works well when I test it on java in the local environment. However, it keeps returning a syntax error message and an Error 400 code when I send the request on Android Studio through an activity.</p> <p>The error message</p> <pre><code>I/System.out: 400 I/System.out: {&quot;error&quot;:{&quot;code&quot;:&quot;bad_request&quot;,&quot;message&quot;:&quot;Could not decode value from JSON format. Error was: \u0022Syntax error\u0022.&quot;}} </code></pre> <p>The class of sending requests. It works well in the local environment but fails on the emulator. It establishes a HttpUrlConnection and uses the GET method to retrieve the result from API. It returns a 400 status code on the Android Studio emulator.</p> <pre><code>import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; public class NetTest { public static String sendRequest(String urlParam, String coordinate){ HttpURLConnection con = null; BufferedReader buffer = null; StringBuffer resultBuffer = null; InputStream is; try{ // prepare the params and send request URL url = new URL(urlParam); con = (HttpURLConnection) url.openConnection(); con.setConnectTimeout(5000); con.setReadTimeout(5000); con.setRequestMethod(&quot;POST&quot;); con.setRequestProperty(&quot;Content-Type&quot;,&quot;application/json;charset=UTF-8&quot;); con.setDoOutput(true); con.set // DataOutputStream wr = new DataOutputStream(con.getOutputStream()); // wr.writeBytes(&quot;access_key=xxx&quot;); // wr.writeBytes(&quot;query=-33.7,127&quot;); // wr.flush(); // wr.close(); System.out.println(&quot;message out&quot;); // receive response int responseCode = con.getResponseCode(); System.out.println(responseCode); if (responseCode == 200) { is = con.getInputStream(); }else { is = con.getErrorStream(); } resultBuffer = new StringBuffer(); String line; buffer = new BufferedReader(new InputStreamReader(is,&quot;UTF-8&quot;)); while ((line = buffer.readLine()) != null){ resultBuffer.append(line); } return resultBuffer.toString(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return &quot;&quot;; } public static void main(String[] args) { String coordinate = &quot;-33.7,127&quot;; String url = &quot;http://api.positionstack.com/v1/reverse&quot;; System.out.println(sendRequest(url,coordinate)); } } </code></pre> <p>The manifest</p> <pre><code> &lt;application android:usesCleartextTraffic=&quot;true&quot;&gt; ... &lt;/application&gt; &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt; </code></pre> <p>Thanks a lot!</p> <p>The problem may be the encoding method of Android, but I don't know how to change it, or even see it.</p>
[ { "answer_id": 74263286, "author": "LeoCenturion", "author_id": 9077262, "author_profile": "https://Stackoverflow.com/users/9077262", "pm_score": 3, "selected": true, "text": " fn sort(arr: &Vec<f64>) -> Vec<usize> {\n let mut out = (0..arr.len()).collect::<Vec<usize>>();\n out.s...
2022/10/31
[ "https://Stackoverflow.com/questions/74262716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18654282/" ]
74,262,718
<p>Hi everyone in the database a column called attachments stores data like this</p> <pre><code>&quot;a:3:{s:6:\&quot;saveTo\&quot;;s:7:\&quot;wpmedia\&quot;;s:14:\&quot;attachmentType\&quot;;s:6:\&quot;images\&quot;;s:11:\&quot;attachments\&quot;;a:1:{i:0;a:6:{s:12:\&quot;attachmentId\&quot;;i:176165;s:4:\&quot;file\&quot;;s:68:\&quot;https://www.yallamission.com/wp-content/uploads/2022/10/MG_00283.jpg\&quot;;s:8:\&quot;fileName\&quot;;s:12:\&quot;MG_00283.jpg\&quot;;s:9:\&quot;thumbnail\&quot;;s:76:\&quot;https://www.yallamission.com/wp-content/uploads/2022/10/MG_00283-150x150.jpg\&quot;;s:8:\&quot;fileSize\&quot;;s:9:\&quot;292.85 KB\&quot;;s:8:\&quot;fileType\&quot;;s:10:\&quot;image/jpeg\&quot;;}}} </code></pre> <p>i need to fetch the image url only yet i am unable to do it successfully as i don't understand this format</p> <p>I tried to use php functions and substr() yet the text before and after has dynamic content and no fixed standard.</p>
[ { "answer_id": 74263955, "author": "Siddhartha Choubey", "author_id": 17292471, "author_profile": "https://Stackoverflow.com/users/17292471", "pm_score": 2, "selected": true, "text": "unserialize($variable)" }, { "answer_id": 74268165, "author": "Rick James", "author_id":...
2022/10/31
[ "https://Stackoverflow.com/questions/74262718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20058869/" ]
74,262,725
<p>I have a table that records user transactions like this (simplified version) in BigQuery</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>user</th> <th>transaction_date</th> <th>label</th> <th>cost</th> </tr> </thead> <tbody> <tr> <td>a</td> <td>2021-10-31 10:30:00</td> <td>y1</td> <td>10</td> </tr> <tr> <td>b</td> <td>2021-10-31 10:30:00</td> <td>y2</td> <td>10</td> </tr> <tr> <td>c</td> <td>2021-10-31 10:30:00</td> <td>y1</td> <td>10</td> </tr> <tr> <td>a</td> <td>2021-11-31 10:30:00</td> <td>y1</td> <td>10</td> </tr> <tr> <td>a</td> <td>2021-12-31 10:30:00</td> <td>y2</td> <td>10</td> </tr> <tr> <td>b</td> <td>2021-11-31 10:30:00</td> <td>y3</td> <td>10</td> </tr> <tr> <td>c</td> <td>2021-11-31 10:30:00</td> <td>y1</td> <td>10</td> </tr> <tr> <td>b</td> <td>2021-12-31 10:30:00</td> <td>y2</td> <td>10</td> </tr> <tr> <td>c</td> <td>2021-12-31 10:30:00</td> <td>y1</td> <td>10</td> </tr> </tbody> </table> </div> <p>I am interested in information related to cost and current/next label. How can I use LEAD() to return the next different label as label_next?</p> <p>i.e</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>user</th> <th>transaction_date</th> <th>label</th> <th>cost</th> <th>label_next</th> </tr> </thead> <tbody> <tr> <td>a</td> <td>2021-10-31 10:30:00</td> <td>y1</td> <td>10</td> <td>y2</td> </tr> <tr> <td>b</td> <td>2021-10-31 10:30:00</td> <td>y2</td> <td>10</td> <td>y3</td> </tr> <tr> <td>c</td> <td>2021-10-31 10:30:00</td> <td>y1</td> <td>10</td> <td>y3</td> </tr> <tr> <td>a</td> <td>2021-11-31 10:30:00</td> <td>y1</td> <td>10</td> <td>y2</td> </tr> <tr> <td>a</td> <td>2021-12-31 10:30:00</td> <td>y2</td> <td>10</td> <td>y5</td> </tr> <tr> <td>b</td> <td>2021-11-31 10:30:00</td> <td>y3</td> <td>10</td> <td>y2</td> </tr> <tr> <td>c</td> <td>2021-11-31 10:30:00</td> <td>y1</td> <td>10</td> <td>y3</td> </tr> <tr> <td>b</td> <td>2021-12-31 10:30:00</td> <td>y2</td> <td>10</td> <td>null</td> </tr> <tr> <td>c</td> <td>2021-12-31 10:30:00</td> <td>y3</td> <td>10</td> <td>null</td> </tr> <tr> <td>a</td> <td>2021-12-31 18:30:00</td> <td>y5</td> <td>10</td> <td>null</td> </tr> </tbody> </table> </div> <p>standard LEAD() would return just the next label i.e. for row 1 (user a) would return y1 as the same user is registered with the same label once before being seen with a different label.</p> <p>I think I have one solution that involves: grouping by user, label and calculate min and max transaction_date then use LEAD() to get label_next per grouping and join that table on the initial table on user and transaction_date inside min and max transaction_date</p> <p>But is there a way to do it differently?</p>
[ { "answer_id": 74263955, "author": "Siddhartha Choubey", "author_id": 17292471, "author_profile": "https://Stackoverflow.com/users/17292471", "pm_score": 2, "selected": true, "text": "unserialize($variable)" }, { "answer_id": 74268165, "author": "Rick James", "author_id":...
2022/10/31
[ "https://Stackoverflow.com/questions/74262725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18221785/" ]
74,262,731
<p>I have a text file containing values as follow:</p> <pre><code>&lt;data&gt; &lt;values=11.0200004578 -1.17999994755 -16.1200008392 /&gt; &lt;values=97.0999984741 -0.449999988079 2.16000008583 /&gt; &lt;values=41.7299995422 60.6699981689 43.75 /&gt; &lt;/data&gt; </code></pre> <p>I am trying to get it as this:</p> <pre><code>&lt;data&gt; &lt;values A=&quot;11.0200004578&quot; B=&quot;-1.17999994755&quot; C=&quot;-16.1200008392 /&gt; &lt;values A=&quot;97.0999984741&quot; B=&quot;-0.449999988079&quot; C=&quot;2.16000008583 /&gt; &lt;values A=&quot;41.7299995422&quot; B=&quot;60.6699981689&quot; C=&quot;43.75 /&gt; &lt;/data&gt; </code></pre> <p>For the first part, it's easy, it is just a sed replacement</p> <pre><code>sed 's#&lt;values=#&lt;values A=&quot;#' </code></pre> <p>But I cannot manage to find a way for the other values.</p>
[ { "answer_id": 74262963, "author": "anubhava", "author_id": 548225, "author_profile": "https://Stackoverflow.com/users/548225", "pm_score": 2, "selected": false, "text": "A, B, C" }, { "answer_id": 74263281, "author": "pqnet", "author_id": 686184, "author_profile": "h...
2022/10/31
[ "https://Stackoverflow.com/questions/74262731", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4467828/" ]
74,262,737
<p>I'm experimenting with creating a NuGet package. I can create a package from a stand-alone class library project and it works fine. However, I'm seeing an error when I try to create a package from a class library project that references another class library project in the same solution.</p> <p>I'm trying to create a NuGet package from a .NET Core 3.1 class library project, <code>MyPackage</code>, which references another .NET Core 3.1 class library project, <code>ReferencedClassLibrary</code>, in the same solution.</p> <p>When I pack the <code>MyPackage</code> project (via Visual Studio Solution Explorer &gt; right click the project file &gt; Pack) a *.nupkg file is created in the bin\debug folder. If I copy that *.nupkg file to the local NuGet package source I set up for testing, I can install the package into another solution.</p> <p>However, during install of that NuGet package into another solution an error message is displayed:</p> <blockquote> <p>NU1101: Unable to find package ReferencedClassLibrary. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, NuGet Personal Package Source, nuget.org</p> </blockquote> <p>where &quot;NuGet Personal Package Source&quot; is the name of my local package source.</p> <p>How do I include <code>ReferencedClassLibrary</code> as part of NuGet package <code>MyPackage</code>? Do I need to use NuGet.exe to pack the project with its dependencies or is there a way to do it via Visual Studio?</p>
[ { "answer_id": 74263421, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": true, "text": "ReferencedClassLibrary" }, { "answer_id": 74271944, "author": "Simon Tewsi", "author_id": 216440, ...
2022/10/31
[ "https://Stackoverflow.com/questions/74262737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/216440/" ]
74,262,752
<p>i am trying to upload an image as a profile picture in laravel bootstrap auth package. in this i am trying to change some package files to upload image. also i added a column in users table.</p> <pre><code>protected function create(array $data) { return User::create([ 'name' =&gt; $data['name'], 'email' =&gt; $data['email'], 'password' =&gt; Hash::make($data['password']), 'campus_id' =&gt; $data['campus_id'], 'role' =&gt; $data['role'], 'remarks' =&gt; $data['remarks'], 'image' =&gt; $data['image'], ]); } </code></pre> <p>i make changes in Auth controller in validation function also makes some changes in user store function</p>
[ { "answer_id": 74263182, "author": "NIKUNJ KOTHIYA", "author_id": 14870617, "author_profile": "https://Stackoverflow.com/users/14870617", "pm_score": 1, "selected": true, "text": "protected function create(array $data)\n {\n $imageName = time().'.'.$data['image']->extension();\...
2022/10/31
[ "https://Stackoverflow.com/questions/74262752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20378235/" ]
74,262,753
<p>I am writing a method with a generic List&lt;T&gt; as an argument. I want to limit T to Integer, Float and Double with this:</p> <pre class="lang-java prettyprint-override"><code>private Method(List&lt;T&gt; list) { this.list = list; } public static &lt;T extends Integer&gt; Method&lt;T&gt; create(List&lt;T&gt; list) { return new Method&lt;&gt;(list); } public static &lt;T extends Float&gt; Method&lt;T&gt; create(List&lt;T&gt; list) { return new Method&lt;&gt;(list); } public static &lt;T extends Double&gt; Method&lt;T&gt; create(List&lt;T&gt; list) { return new Method&lt;&gt;(list); } </code></pre> <p>But I get this error:</p> <pre><code>error: name clash: &lt;T#1&gt;create(List&lt;T#1&gt;) and &lt;T#2&gt;create(List&lt;T#2&gt;) have the same erasure public static &lt;T extends Float&gt; Method&lt;T&gt; create(List&lt;T&gt; list) { ^ where T#1,T#2 are type-variables: T#1 extends Float declared in method &lt;T#1&gt;create(List&lt;T#1&gt;) T#2 extends Integer declared in method &lt;T#2&gt;create(List&lt;T#2&gt;) </code></pre> <p>I get the same error for T#1 extends Double as well.</p> <p>The code is based on <a href="https://stackoverflow.com/a/48824392">this</a> answer, which works well. So I think the problem is related to the fact that I used a list of generics as an input instead of a single generic.</p> <p>How can I fix this? Is there some way to give Java the ability to discern between the different instances?</p>
[ { "answer_id": 74263182, "author": "NIKUNJ KOTHIYA", "author_id": 14870617, "author_profile": "https://Stackoverflow.com/users/14870617", "pm_score": 1, "selected": true, "text": "protected function create(array $data)\n {\n $imageName = time().'.'.$data['image']->extension();\...
2022/10/31
[ "https://Stackoverflow.com/questions/74262753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20378526/" ]
74,262,779
<p>I would like to be informed, if a (Android) USB device of a specific interface (USB debugging) is connected to my Windows computer.</p> <p>For this, I'm trying to use .Net with this code:</p> <pre><code>const string GUID_DEVINTERFACE_ANDROID = &quot;f72fe0d4-cbcb-407d-8814-9ed673d0dd6b&quot;; const string usbDeviceSelector = &quot;System.Devices.InterfaceClassGuid:=\&quot;{&quot; + GUID_DEVINTERFACE_ANDROID + &quot;}\&quot; AND System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True&quot;; _usbDeviceWatcher = DeviceInformation.CreateWatcher( usbDeviceSelector, new string[] { &quot;System.Devices.InterfaceEnabled&quot; }, DeviceInformationKind.AssociationEndpoint); _usbDeviceWatcher.Updated += UsbDeviceWatcher_Updated; </code></pre> <p>Unfortunately, the event will not be thrown to my <code>UsbDeviceWatcher_Update</code> function.</p> <p>I don't want to be informed about a specific device, I want to be notified about all devices, which supports this interface.</p> <p><strong>How can I get an event, if an device with this special interface will be connected / disconnected from my computer?</strong></p> <p>If there is a <code>WinUsb</code> solution for this, I would be happy too.</p>
[ { "answer_id": 74263182, "author": "NIKUNJ KOTHIYA", "author_id": 14870617, "author_profile": "https://Stackoverflow.com/users/14870617", "pm_score": 1, "selected": true, "text": "protected function create(array $data)\n {\n $imageName = time().'.'.$data['image']->extension();\...
2022/10/31
[ "https://Stackoverflow.com/questions/74262779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20138168/" ]
74,262,807
<p>I am trying to validate s String url in my java application using @Pattern annotation of the javax validation library.</p> <pre><code>@Pattern(message = &quot;Must be a valid URL&quot;, regexp = &quot;https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&amp;//=]*)&quot;) </code></pre> <p>When i submit a url in the url in this format; <code>https://www.test.com</code> it is successful but url in this format <code>https://api-apps.testapp.systems/test-service/v1/test</code>, it fails the validation.</p> <p>The issue is with the <code>.com</code> The same url with <code>.systems</code> fail but with <code>.com</code> passes.</p> <p>How can i make my regular expression allow all kinds of urls .com, .edu or .systems regardless ??</p>
[ { "answer_id": 74263182, "author": "NIKUNJ KOTHIYA", "author_id": 14870617, "author_profile": "https://Stackoverflow.com/users/14870617", "pm_score": 1, "selected": true, "text": "protected function create(array $data)\n {\n $imageName = time().'.'.$data['image']->extension();\...
2022/10/31
[ "https://Stackoverflow.com/questions/74262807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9420892/" ]
74,262,811
<p>I am trying to develop a function which will calculate the means, standard error, and confidence intervals of some survey data. I need to do this repeatedly over a number of different variables with a bunch of different filter statements.</p> <p><strong>DATA</strong></p> <pre><code>df &lt;- data.frame(address_id = rep(c(1,1,1,2,2,2,3,3,3,4,4,4),5), person_id = rep(c(1,2,3),20), sex = as.factor(rep(c(&quot;male&quot;,&quot;female&quot;),30)), response_var = as.factor(rep(seq(1,6,1))), weight = runif(60, 50, 200)) </code></pre> <p><strong>Example that works without function</strong></p> <pre><code># create survey design design &lt;- survey::svydesign(data = df, strata = ~ address_id, id = ~ person_id, nest = TRUE, weights = ~ weight) # calcualte weighted mean mean_se &lt;- survey::svymean(~sex, design) # calculate confidence intervals ci &lt;- survey::confint(df_mean) </code></pre> <p><strong>My function</strong></p> <pre><code>create_mean_and_cis &lt;- function(data, var){ design &lt;- survey::svydesign(data = data, strata = ~ address_id, id = ~ person_id, nest = TRUE, weights = ~ weight) mean_se &lt;- survey::svymean(~{{var}}, design) ci &lt;- confint(mean_se)%&gt;% tibble::as_tibble()%&gt;% tibble::rownames_to_column(&quot;variable&quot;) output &lt;- mean_se%&gt;% tibble::as_tibble()%&gt;% tibble::rownames_to_column(&quot;variable&quot;)%&gt;% dplyr::left_join(ci) return(output) } # function call create_mean_and_cis(sex) </code></pre> <p>When I run, I get an error message saying:</p> <pre><code>Error in survey::svydesign(data = data, strata = ~address_id, id = ~person_id, : object 'sex' not found </code></pre> <p>I can't understand what is going wrong. The tidy evaluation works perfectly when I use the curly-curly &quot;{{var}}&quot; within other functions. Why doesn't it work here? Can anyone help?</p> <p>I have tried several variations of quasiquotation including: !!enquo(sex), sym(sex), !!sym(sex), {{sex}}, eval(parse(sex)). None of which have yielded working results.</p>
[ { "answer_id": 74262962, "author": "Allan Cameron", "author_id": 12500315, "author_profile": "https://Stackoverflow.com/users/12500315", "pm_score": 2, "selected": false, "text": "data" }, { "answer_id": 74263793, "author": "MrFlick", "author_id": 2372064, "author_pro...
2022/10/31
[ "https://Stackoverflow.com/questions/74262811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16412869/" ]
74,262,820
<p>I have a table:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th style="text-align: left;">client_id</th> <th style="text-align: center;">Date</th> <th style="text-align: right;">Resolution</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">1</td> <td style="text-align: center;">2022-10-15</td> <td style="text-align: right;">CANCELLED</td> </tr> <tr> <td style="text-align: left;">2</td> <td style="text-align: center;">2022-10-25</td> <td style="text-align: right;">CANCELLED</td> </tr> <tr> <td style="text-align: left;">3</td> <td style="text-align: center;">2022-10-16</td> <td style="text-align: right;">CANCELLED</td> </tr> <tr> <td style="text-align: left;">3</td> <td style="text-align: center;">2022-10-17</td> <td style="text-align: right;">REJECTED</td> </tr> <tr> <td style="text-align: left;">4</td> <td style="text-align: center;">2022-10-08</td> <td style="text-align: right;">CANCELLED</td> </tr> <tr> <td style="text-align: left;">4</td> <td style="text-align: center;">2022-10-20</td> <td style="text-align: right;">APPROVED</td> </tr> <tr> <td style="text-align: left;">5</td> <td style="text-align: center;">2022-10-03</td> <td style="text-align: right;">CANCELLED</td> </tr> <tr> <td style="text-align: left;">5</td> <td style="text-align: center;">2022-10-04</td> <td style="text-align: right;">APPROVED</td> </tr> </tbody> </table> </div> <p>Desired results:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th style="text-align: left;">client_id</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">1</td> </tr> <tr> <td style="text-align: left;">2</td> </tr> <tr> <td style="text-align: left;">4</td> </tr> </tbody> </table> </div> <p>I need to get all customers IDs who have been CANCELLED and within five days didn't have REJECTED or APPROVED the application. How can I achieve that?</p>
[ { "answer_id": 74262944, "author": "Nenad Zivkovic", "author_id": 612181, "author_profile": "https://Stackoverflow.com/users/612181", "pm_score": 1, "selected": false, "text": "SELECT * FROM table t1\nWHERE t1.Resolution = 'CANCELLED'\nAND NOT EXISTS\n(\n SELECT * FROM table t2\n WHE...
2022/10/31
[ "https://Stackoverflow.com/questions/74262820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16623816/" ]
74,262,830
<p>I have a table <code>Events</code> in LibreOffice Base with a Firebird database (version 3.0.8) that records how many times an event occurs. Example below:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Date</th> <th>EventCount</th> </tr> </thead> <tbody> <tr> <td>22-04-01</td> <td>15</td> </tr> <tr> <td>22-09-30</td> <td>10</td> </tr> <tr> <td>22-10-01</td> <td>1</td> </tr> <tr> <td>22-10-04</td> <td>1</td> </tr> </tbody> </table> </div> <p>I would like to create a query to output the number of days from today since the 3rd event occurred. In the example above, the third event to date would be <code>22-09-30</code>.</p> <p>I assume the code would look something like:</p> <pre><code>SELECT &quot;Date&quot; WHERE DATEDIFF(DAY, CURRENT_DATE, DATE '30-09-2022') AS &quot;Third Last Event&quot; FROM &quot;Events&quot; </code></pre> <p>However, <code>DATE '30-09-2022'</code> is not a fixed value. I am just using it as an example of what the third event would be in the above example's case. Given that new rows would be added to this table and more values would be added to <code>EventCount</code>, it would change on a regular basis.</p> <p>What would I have to replace <code>DATE '30-09-2022'</code> with, so that I could run the query and have it return the value in the <code>Date</code> column that corresponds with the third <code>EventCount</code> from <code>CURRENT_DATE</code>?</p>
[ { "answer_id": 74263459, "author": "user13964273", "author_id": 13964273, "author_profile": "https://Stackoverflow.com/users/13964273", "pm_score": 0, "selected": false, "text": "create procedure DaysSinceNthEvent(n integer) returns (days integer) as\n declare c integer;\n declare dd d...
2022/10/31
[ "https://Stackoverflow.com/questions/74262830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9834199/" ]
74,262,859
<p>So I want to output the max PRICE of a List.<a href="https://i.stack.imgur.com/jNy2P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jNy2P.png" alt="My method who finds the max Price" /></a></p> <p>Now I need the i-1 element of the for loop to get the index and then print it as a List how should it be ? <a href="https://i.stack.imgur.com/TAh1E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TAh1E.png" alt="enter image description here" /></a></p> <p>I have some exprience in C# where I think this works there but in Java it doesnt. :/</p>
[ { "answer_id": 74263459, "author": "user13964273", "author_id": 13964273, "author_profile": "https://Stackoverflow.com/users/13964273", "pm_score": 0, "selected": false, "text": "create procedure DaysSinceNthEvent(n integer) returns (days integer) as\n declare c integer;\n declare dd d...
2022/10/31
[ "https://Stackoverflow.com/questions/74262859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20370979/" ]
74,262,861
<p>I was trying to swap two arrays using pointers. What I wanted was to swap using a call by reference.</p> <p>This code I wrote is given below</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; void swap(int **a, int **b) { int *temp = (int*)malloc(5*sizeof(int)); temp = *a; *a = *b; *b = temp; } int main() { int arr1[] = {1, 2, 3, 4, 5}; int arr2[] = {6, 7, 8, 9, 10}; swap((int**)&amp;arr1, (int**)&amp;arr2); for(int i=0; i&lt;5; i++) printf(&quot;%d\t&quot;, arr1[i]); printf(&quot;\n&quot;); for(int i=0; i&lt;5; i++) printf(&quot;%d\t&quot;, arr2[i]); printf(&quot;\n&quot;); } </code></pre> <p>The output of the code is:</p> <pre><code>6 7 3 4 5 1 2 8 9 10 </code></pre> <p>instead of:</p> <pre><code>6 7 8 9 10 1 2 3 4 5 </code></pre> <p>What did I do wrong?</p>
[ { "answer_id": 74262983, "author": "Some programmer dude", "author_id": 440558, "author_profile": "https://Stackoverflow.com/users/440558", "pm_score": 2, "selected": false, "text": "void swap(int **pparr1, int **pparr2)\n{\n int *temp = *pparr1;\n *pparr1 = *pparr2;\n *pparr2 =...
2022/10/31
[ "https://Stackoverflow.com/questions/74262861", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4729641/" ]
74,262,873
<p>I have two objects, a variable (username), and a list (products) of products and costs</p> <pre><code>usernames = ['Dave','mary','John'] products (nested list) [['pr1', '40.0', 'pr2', '50.0', 'pr4', '70.0'],['pr2', '35.5', 'pr3', '36.0', 'pr4', '65.5'], ['pr1', '23.0', 'pr2', '45,4']] </code></pre> <p>All prices are unique to each customer. Similarly, the product set is also unique to each customer, so I cant say take a specific index such as products[0] and it would always be 'pr1'.</p> <p>I've zipped the two objects together:</p> <pre><code>for x,y in zip(usernames,products): print(x,y) &gt;&gt;&gt;&gt; dave, ['pr1', '40.0', 'pr2', '50.0', 'pr4', '70.0'] </code></pre> <p>This gets me part way there, but I cant figure out how to append in the missing Products and 'N/A' for each username.</p> <p>My end goal is a view that looks like this, dropping the 'pr' product keys so that I can use this to visualise the data:</p> <pre><code> dave ['40.0', '50.0', 'N/A', '70.0'] Mary ['N/A', '35.5', '36.0, '65.5'] John ['23.0, '45.4', 'N/A', 'N/A'] </code></pre> <p>Please help Python masters, I've been trying everything for hours and I'm all out of ideas..</p>
[ { "answer_id": 74262983, "author": "Some programmer dude", "author_id": 440558, "author_profile": "https://Stackoverflow.com/users/440558", "pm_score": 2, "selected": false, "text": "void swap(int **pparr1, int **pparr2)\n{\n int *temp = *pparr1;\n *pparr1 = *pparr2;\n *pparr2 =...
2022/10/31
[ "https://Stackoverflow.com/questions/74262873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20377996/" ]
74,262,879
<p>I am not able to run my code and produce an image under header 2</p> <p>Are there any reason why as I have already input the right code.</p> <p>I believe another css layout is blocking the image from popping out. Below here is the code to check</p> <pre><code>&lt;div class=&quot;login-box&quot;&gt; &lt;h2&gt;Login&lt;/h2&gt; &lt;form&gt; &lt;div class=&quot;user-box&quot;&gt; &lt;input type=&quot;text&quot; name=&quot;&quot; required=&quot;&quot;&gt; &lt;label&gt;Username&lt;/label&gt; &lt;/div&gt; &lt;div class=&quot;user-box&quot;&gt; &lt;input type=&quot;password&quot; name=&quot;&quot; required=&quot;&quot;&gt; &lt;label&gt;Password&lt;/label&gt; &lt;/div&gt; &lt;a href=&quot;#&quot;&gt; &lt;span&gt;&lt;/span&gt; &lt;span&gt;&lt;/span&gt; &lt;span&gt;&lt;/span&gt; &lt;span&gt;&lt;/span&gt; Submit &lt;/a&gt; &lt;/form&gt; &lt;/div&gt; &lt;div class=&quot;section-container&quot;&gt; &lt;h2 class=&quot;title-container&quot;&gt;Here are my other socials you can find me on &lt;/h2&gt; &lt;img src=&quot;//placekitten.com/150/150&quot; alt=&quot;&quot;&gt;Image &lt;/div&gt; </code></pre> <p>My CSS below</p> <pre><code>html { height: 100%; } body { margin:0; padding:0; font-family: sans-serif; background: linear-gradient(#141e30, #243b55); } .login-box { position: absolute; top: 78%; left: 50%; width: 400px; padding: 30px; transform: translate(-50% , -50%); background: rgba(0,0,0,.5); box-sizing: border-box; box-shadow: 0 15px 25px rgba(0,0,0,.6); border-radius: 20px; } .login-box h2 { margin: 0 0 30px; padding: 0; color: #fff; text-align: center; } .login-box .user-box { position: relative; } .login-box .user-box input { width: 100%; padding: 10px 0; font-size: 16px; color: #fff; margin-bottom: 30px; border: none; border-bottom: 1px solid #fff; outline: none; background: transparent; } .login-box .user-box label { position: absolute; top:0; left: 0; padding: 10px 0; font-size: 16px; color: #fff; pointer-events: none; transition: .5s; } .login-box .user-box input:focus ~ label, .login-box .user-box input:valid ~ label { top: -20px; left: 0; color: #03e9f4; font-size: 12px; } .login-box form a { position: relative; display: inline-block; padding: 10px 20px; color: #03e9f4; font-size: 16px; text-decoration: none; text-transform: uppercase; overflow: hidden; transition: .5s; margin-top: 40px; letter-spacing: 4px } .login-box a:hover { background: #03e9f4; color: #fff; border-radius: 5px; box-shadow: 0 0 5px #03e9f4, 0 0 25px #03e9f4, 0 0 50px #03e9f4, 0 0 100px #03e9f4; } .login-box a span { position: absolute; display: block; } .login-box a span:nth-child(1) { top: 0; left: -100%; width: 100%; height: 2px; background: linear-gradient(90deg, transparent, #03e9f4); animation: btn-anim1 1s linear infinite; } @keyframes btn-anim1 { 0% { left: -100%; } 50%,100% { left: 100%; } } .login-box a span:nth-child(2) { top: -100%; right: 0; width: 2px; height: 100%; background: linear-gradient(180deg, transparent, #03e9f4); animation: btn-anim2 1s linear infinite; animation-delay: .25s } @keyframes btn-anim2 { 0% { top: -100%; } 50%,100% { top: 100%; } } .login-box a span:nth-child(3) { bottom: 0; right: -100%; width: 100%; height: 2px; background: linear-gradient(270deg, transparent, #03e9f4); animation: btn-anim3 1s linear infinite; animation-delay: .5s } @keyframes btn-anim3 { 0% { right: -100%; } 50%,100% { right: 100%; } } .login-box a span:nth-child(4) { bottom: -100%; left: 0; width: 2px; height: 100%; background: linear-gradient(360deg, transparent, #03e9f4); animation: btn-anim4 1s linear infinite; animation-delay: .75s } @keyframes btn-anim4 { 0% { bottom: -100%; } 50%,100% { bottom: 100%; } } .section-container { display: flex; flex-direction: column; justify-content: flex-start; text-align: left; width: 100%; background-image: linear-gradient( 60deg, rgba(57, 60, 90, 0.85), rgba(180, 180, 120, 0.5) ); background-position: center; background-size: cover; font-weight: bold; text-shadow: rgb(56, 50, 50) 1px 1px } .title-container { display: block; color: white; text-shadow: 2px 2px black; width: 40%; padding: 30px; margin-bottom: 20%; margin-right: 50px; border-top: 1px black solid; } </code></pre> <p>I tried to put the img code under . but did not get the image to pop up under the h2 tag</p>
[ { "answer_id": 74262983, "author": "Some programmer dude", "author_id": 440558, "author_profile": "https://Stackoverflow.com/users/440558", "pm_score": 2, "selected": false, "text": "void swap(int **pparr1, int **pparr2)\n{\n int *temp = *pparr1;\n *pparr1 = *pparr2;\n *pparr2 =...
2022/10/31
[ "https://Stackoverflow.com/questions/74262879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18071008/" ]
74,262,895
<pre><code>SELECT CONCAT(CONCAT(FIRST_NAME, ' '), LAST_NAME) AS &quot;Fn and Ln&quot;, JOB_ID AS &quot;Job_title&quot;, CASE COMMISSION_PCT WHEN NULL THEN SALARY WHEN '-' THEN SALARY ELSE (COMISSION_PCT * SALARY) * 12 END AS &quot;Year income&quot; FROM HR.EMPLOYEES </code></pre> <p>I have to find year income of employee considering premium. If there is no premium i have to just ignore it. In my code i get 'ORA-00904: &quot;COMISSION_PCT&quot;: invalid identifier' i dont know what is the reason. Dtype of COMISSION_PCT NUMBER(2,2) and SALARY dtype is NUMBER(8,2).</p> <p>Clarification: Specify the amount of annual income of each employee, given that the bonus is indicated as a percentage</p> <p><a href="https://i.stack.imgur.com/p8KRJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p8KRJ.png" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/mQ6l3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mQ6l3.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74262983, "author": "Some programmer dude", "author_id": 440558, "author_profile": "https://Stackoverflow.com/users/440558", "pm_score": 2, "selected": false, "text": "void swap(int **pparr1, int **pparr2)\n{\n int *temp = *pparr1;\n *pparr1 = *pparr2;\n *pparr2 =...
2022/10/31
[ "https://Stackoverflow.com/questions/74262895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18502120/" ]
74,262,899
<p>I am currently start a kafka Connector in <code>--daemon</code> mode below:</p> <pre class="lang-bash prettyprint-override"><code>bin/connect-standalone.sh -daemon \ /kafka/config/connect-standalone.properties \ /kafka/config/custom-connector.properties </code></pre> <p>How do I stop this connector process gracefully?</p> <p>I am currenlty using <code>top</code> command to locate a java process and use <code>kill -15 pid</code> to stop it. I found this quite not practical because I cannot specify the connector by some properties to stop it.</p> <p>Is there any way to stop a <code>kafka connector</code> in a way like executing a command below? Or any better alternatives?</p> <pre class="lang-bash prettyprint-override"><code>kafka/bin/kafka-connect-stop.sh \ /kafka/config/connect-standalone.properties </code></pre>
[ { "answer_id": 74262983, "author": "Some programmer dude", "author_id": 440558, "author_profile": "https://Stackoverflow.com/users/440558", "pm_score": 2, "selected": false, "text": "void swap(int **pparr1, int **pparr2)\n{\n int *temp = *pparr1;\n *pparr1 = *pparr2;\n *pparr2 =...
2022/10/31
[ "https://Stackoverflow.com/questions/74262899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14032355/" ]
74,262,904
<pre><code>import 'dart:io'; import 'package:flutter/material.dart' as material ; import 'package:flutter/services.dart'; import 'package:pdf/pdf.dart'; import 'package:pdf/widgets.dart' as pw; class PdfParagraphApi { static Future&lt;void&gt; generate(key) async { final pdf = pw.Document(); final img = pw.MemoryImage(await rootBundle.load('assets/img.png')).buffer.asUint8List(); pdf.addPage( pw.MultiPage( build: (context) =&gt; &lt;pw.Widget&gt;[ pw.Image(img), ]), ); } } </code></pre> <p>i'm trying to create a pdf with an image inside it and i'm using the library pdf/widgets.dart to create the image as i found in flutters documentation but i'm facing a problem. the error message is the following : The function 'MemoryImage' isn't defined. Try importing the library that defines 'MemoryImage', correcting the name to the name of an existing function, or defining a function named 'MemoryImage'.dartundefined_function</p> <pre><code>insert image into pdf not working </code></pre>
[ { "answer_id": 74262983, "author": "Some programmer dude", "author_id": 440558, "author_profile": "https://Stackoverflow.com/users/440558", "pm_score": 2, "selected": false, "text": "void swap(int **pparr1, int **pparr2)\n{\n int *temp = *pparr1;\n *pparr1 = *pparr2;\n *pparr2 =...
2022/10/31
[ "https://Stackoverflow.com/questions/74262904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7206608/" ]
74,262,937
<p>i'm creating a wordpress plugin with React - haven't really ever used React before this, so I'm probably misunderstanding something crucial but this is what I'm trying to achieve: You have a button that creates a question for a quiz and then to every button you can add multiple solutions:</p> <pre><code>DOMquestions = questions.map((question) =&gt; &lt;div&gt; &lt;div&gt; {question.qIdTitle} &lt;/div&gt; &lt;div&gt; Type: {question.qTypeTitle} &lt;/div&gt; &lt;div&gt; Question title &lt;input type={&quot;text&quot;} onChange={question.title = handleTextInputChange}&gt;&lt;/input&gt; &lt;/div&gt; &lt;div&gt; Question description &lt;input type={&quot;text&quot;} onChange={question.desc = handleTextInputChange}&gt;&lt;/input&gt; &lt;/div&gt; &lt;button onClick={() =&gt; question.addS(question)}&gt;Add a solution&lt;/button&gt; &lt;div&gt; { question.solutions.map((solution) =&gt; { return &lt;div&gt;Solution data and fields appear here&lt;/div&gt; } ) } &lt;/div&gt; &lt;/div&gt; ); console.log(DOMquestions); ReactDOM.render(&lt;div class='w-100'&gt;{DOMquestions}&lt;/div&gt;, qc); </code></pre> <p>The idea is that every Function object has an array full of solution objects inside of it</p> <p>the addS function pushes a new solution object to the array - so I already have my array The question is how should I go about rendering it on screen Thanks in advance</p>
[ { "answer_id": 74262983, "author": "Some programmer dude", "author_id": 440558, "author_profile": "https://Stackoverflow.com/users/440558", "pm_score": 2, "selected": false, "text": "void swap(int **pparr1, int **pparr2)\n{\n int *temp = *pparr1;\n *pparr1 = *pparr2;\n *pparr2 =...
2022/10/31
[ "https://Stackoverflow.com/questions/74262937", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7306778/" ]
74,262,942
<p>I am trying to create a page layout where I render:</p> <ul> <li>A fixed width side bar</li> <li>A main content section with <ul> <li>A header row (title + button)</li> <li>A table</li> </ul> </li> </ul> <p>The table may hold quite a few columns and I don't want them to get squished together. Instead, I would like the table to scroll horizontally. However, what ends up happening is that the table expands its container and creates a horizontal scroll on the main layout. The scrollbar doesn't show up in the table itself.</p> <p>You can see the code and the problem in action here:</p> <ul> <li><a href="https://jsfiddle.net/dsaltares/egf7238z/4/" rel="nofollow noreferrer">Fiddle</a></li> <li><a href="https://www.loom.com/share/ef1491cedba04955b55b4b097a4c99af" rel="nofollow noreferrer">Video</a></li> </ul> <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>.App { display: flex; flex-direction: row; width: 100%; } .Sidebar { display: block; width: 150px; background-color: red; flex-grow: 0; flex-shrink: 0; flex-basis: 150px; } .Main { display: flex; flex-direction: column; width: 100%; background-color: green; } .TitleBar { display: flex; flex-direction: row; align-items: center; justify-content: space-between; width: 100%; } .TableContainer { width: 100%; position: relative; overflow-x: scroll; } .Table { width: 100%; table-layout: auto; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="App"&gt; &lt;div class="Sidebar"&gt;Sidebar&lt;/div&gt; &lt;main class="Main"&gt; &lt;div class="TitleBar"&gt; &lt;div&gt;Title&lt;/div&gt; &lt;div&gt; &lt;button&gt;Create&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="TableContainer"&gt; &lt;table class="Table"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Prop 1&lt;/th&gt; &lt;th&gt;Prop 2&lt;/th&gt; &lt;th&gt;Prop 3&lt;/th&gt; &lt;th&gt;Actions&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;Item 1&lt;/td&gt; &lt;td&gt;Value 1.a&lt;/td&gt; &lt;td&gt;Value 1.b&lt;/td&gt; &lt;td&gt;Value 1.c&lt;/td&gt; &lt;td&gt; &lt;button&gt;Edit&lt;/button&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Item 2&lt;/td&gt; &lt;td&gt;Value 2.a&lt;/td&gt; &lt;td&gt;Value 2.b&lt;/td&gt; &lt;td&gt;Value 2.c&lt;/td&gt; &lt;td&gt; &lt;button&gt;Edit&lt;/button&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; &lt;/main&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
[ { "answer_id": 74263563, "author": "shotgun02", "author_id": 8077687, "author_profile": "https://Stackoverflow.com/users/8077687", "pm_score": 0, "selected": false, "text": "overflow-x: scroll" }, { "answer_id": 74263654, "author": "Avais", "author_id": 6314076, "auth...
2022/10/31
[ "https://Stackoverflow.com/questions/74262942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/494512/" ]
74,262,972
<p>I am struggling to convert these html attributes I extracted from widget tag to an object so I can change some of its values. Following are the attributes.</p> <pre><code>widget=&quot;fixtures&quot; competition=&quot;1&quot; season=&quot;2020&quot; match=&quot;123&quot; template=&quot;cell&quot; live=&quot;true&quot; sport=&quot;hockey&quot; </code></pre> <p>What I have tried is JSON.stringify and JSON.parse but nothing seems to be working.</p> <p>This is what I have done, the ending result seems like object but when I try to access one of any key from it I get undefined.</p> <pre><code>htmlAttribs = htmlAttribs.replace(/[=]/g, ':'); htmlAttribs = htmlAttribs.replace(/[ ]/g, ', '); htmlAttribs = `{${htmlAttribs}}`; htmlAttribs = JSON.stringify(htmlAttribs);
 htmlAttribs = JSON.parse(htmlAttribs); console.log(htmlAttribs); </code></pre>
[ { "answer_id": 74263180, "author": "Mohsin", "author_id": 7151449, "author_profile": "https://Stackoverflow.com/users/7151449", "pm_score": 1, "selected": true, "text": "htmlAttribs = htmlAttribs.replace(/[=]/g, ':');\nhtmlAttribs = htmlAttribs.replace(/[ ]/g, ', ');\n\nconst obj = eval(...
2022/10/31
[ "https://Stackoverflow.com/questions/74262972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7151449/" ]
74,262,975
<p>Recently a change was made to our code and I'm stuck as far as how to fix it. Originally we had the routes on our controllers set up as</p> <pre><code>[Route(&quot;api/v1/product/[controller]&quot;)] [ApiController] </code></pre> <p>And this was modified to accomodate versioning as follows:</p> <pre><code>[Route(&quot;api/v{version:apiVersion}/product/[controller]&quot;)] [ApiVersion(&quot;1.0&quot;)] </code></pre> <p>And now the app is throwing the following error:</p> <pre><code>InvalidOperationException: The constraint reference 'apiVersion' could not be resolved to a type. Register the constraint type with 'Microsoft.AspNetCore.Routing.RouteOptions.ConstraintMap'. </code></pre> <p>The dev that implemented this is unavailable, so I'm looking for suggestions until they get back. Seems to work fine in our dev environment but can't run it locally. We're running .NET 6 and this is the startup code:</p> <pre><code> if (enableSwagger) { services .AddSwaggerGen(c =&gt; { c.SwaggerDoc(EngineExtensions.API_ENGINE_VERSION, new Microsoft.OpenApi.Models.OpenApiInfo { Title = EngineExtensions.API_ENGINE_NAME, Version = EngineExtensions.API_ENGINE_VERSION }); c.CustomSchemaIds(type =&gt; type.FullName); }); } </code></pre> <p>referencing this in appsettings</p> <pre><code>&quot;api_engine_version&quot;: &quot;v1&quot;, </code></pre>
[ { "answer_id": 74263180, "author": "Mohsin", "author_id": 7151449, "author_profile": "https://Stackoverflow.com/users/7151449", "pm_score": 1, "selected": true, "text": "htmlAttribs = htmlAttribs.replace(/[=]/g, ':');\nhtmlAttribs = htmlAttribs.replace(/[ ]/g, ', ');\n\nconst obj = eval(...
2022/10/31
[ "https://Stackoverflow.com/questions/74262975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2584472/" ]
74,262,989
<p>I have 3 arrays. I want to loop through arr1 and then compare that each object in arr1 contains objects of arr2 and arr3 with chai assertion. The following is what I have tried and it failed</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-js lang-js prettyprint-override"><code>const arr1=[{name="Alice"},{name="Bob"}] const arr2=[{name="Alice"}] const arr3=[{name="Bob"}] for (let i = 0, len = arr1.length; i &lt; len; i++) { expect(arr1[i]).to.deep.equal(arr2|| arr3); }</code></pre> </div> </div> </p>
[ { "answer_id": 74263304, "author": "Silviu Burcea", "author_id": 1051677, "author_profile": "https://Stackoverflow.com/users/1051677", "pm_score": 1, "selected": false, "text": "const arr4 = [...arr2, ...arr3];\nfor (let i = 0, len = arr1.length; i < len; i++) {\n expect(arr1[i]).to.dee...
2022/10/31
[ "https://Stackoverflow.com/questions/74262989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8604137/" ]
74,262,993
<p>I am trying to create a login system in Java and I have saved admin information in a text file in this format:</p> <pre><code>Hannah,Joshua,Female,373ac,admin123 Leena,Kevin,Female,3283c,admin123 </code></pre> <p>The fourth index (<code>373ac</code>) is their username and fifth (<code>admin123</code>) is the password. Each admin will get a new username and a separate line in the file.</p> <p>Each time an admin logs in, they will input their name and the program should search through the file with the line that starts with their name and compare the username and password, so they can log in. I think the best way is a 2D array. I have this code so far but it's not reading it as a 2D array but just one array with all the lines. Like this:</p> <pre><code>[Hannah,Joshua,Female,373ac,admin123,Leena,Kevin,Female,3283c,admin123] </code></pre> <p>Can you please help me out?</p> <pre><code>public class ReadFile { public static void main(String[] args) throws Exception { BufferedReader bufReader = new BufferedReader(new FileReader(&quot;Admin.txt&quot;)); ArrayList&lt;String&gt; listofLines = new ArrayList&lt;&gt;(); String line = bufReader.readLine(); while (null != (line = in.readLine())) { listofLines.add(line); } bufReader.close(); int [][] map = new int[bufReader.size()][]; int q = 0; for (int i = 0; i &lt; map.length; q++) { String[] rooms = bufReader.get(i).split(&quot;,&quot;); map[i] = new int[rooms.length]; for (int w = 0; w &lt; rooms.length; w++) { map[q][w] = Integer.parseInt(rooms[w]); } System.out.println(Arrays.toString(map[q])); } } } </code></pre>
[ { "answer_id": 74263304, "author": "Silviu Burcea", "author_id": 1051677, "author_profile": "https://Stackoverflow.com/users/1051677", "pm_score": 1, "selected": false, "text": "const arr4 = [...arr2, ...arr3];\nfor (let i = 0, len = arr1.length; i < len; i++) {\n expect(arr1[i]).to.dee...
2022/10/31
[ "https://Stackoverflow.com/questions/74262993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
74,262,994
<p>How to correct the second capital letter of each word into lower case after entering the third letter in lower case?</p> <p>Example:</p> <p>&quot;INput&quot; will be corrected into &quot;Input&quot; (since the first and second letter are capital letters) &quot;INP&quot; will not be corrected.</p> <p>A function that converts a string would suffice:</p> <pre><code>function autoCorrect(input) { return &quot;corrected input&quot;; } </code></pre> <p>My question is different to existing posts like</p> <blockquote> <p>Using Javascript, how to capitalize each word in a String excluding acronyms</p> </blockquote> <blockquote> <p>Is there a way to ignore acronyms in a title case method</p> </blockquote> <blockquote> <p>Convert string to Title Case with JavaScript</p> </blockquote> <p>I don't want to convert a string to title case in such a way that every new word begins with a capital(uppercase) letter but correct two consecutive upper case letters at the beginning of each word.</p> <p>This seems to work, even if it is not the most elagant solution. Suggestions for improvement are welcome.</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-js lang-js prettyprint-override"><code> String.prototype.isUpperCase = function() { return this.toString() === this.toUpperCase(); } var str = "SOme Text THat NO YEs END"; var str2 = str[0] || ''; for (var i = 0; i &lt; str.length; i++) { const next1 = str[i + 1] || ''; const next2 = str[i + 2] || ''; if (str[i].isUpperCase() &amp;&amp; next1.isUpperCase() &amp;&amp; !next2.isUpperCase()) { str2 += str[i+1].toLowerCase() || ''; } else { str2 += str[i+1] || ''; } } console.log(str2);</code></pre> </div> </div> </p>
[ { "answer_id": 74263025, "author": "Ankit", "author_id": 19757319, "author_profile": "https://Stackoverflow.com/users/19757319", "pm_score": 0, "selected": false, "text": "var str = \"SOme Text THat NO YEs END\";\nvar str2 = str[0] || '';\n\nfor (var i = 0; i < str.length; i++) {\n cons...
2022/10/31
[ "https://Stackoverflow.com/questions/74262994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10132321/" ]
74,263,002
<p>I'm trying to build a react component that is showing a random number based of an API response. But I notice that the number displayed is infinitely re-rendered and it when I check the server console, it receives infinite request from react. How to solve this? I am using react state to display the number.</p> <p>API randomnumber.js</p> <pre><code>var express = require('express'); var router = express.Router(); /* GET home page. */ router.get('/', function (req, res, next) { let randomNumber = Math.floor(Math.random() * 100); res.send({ &quot;number&quot;: randomNumber }) }); module.exports = router; </code></pre> <p>React Component</p> <pre><code>import react, { useEffect, useState } from &quot;react&quot; import axios from 'axios' interface Props { } export default function RandomNumber(props: Props) { const [number, setNumber] = useState(0); axios({ method: &quot;get&quot;, url: &quot;/api/random-number&quot;, }).then( ((result) =&gt; { setNumber(result.data.number) }) ) return ( &lt;&gt; &lt;h1&gt;{number}&lt;/h1&gt; &lt;/&gt; ) } </code></pre> <p>I want the server to return 1 random number per request, and react will render that number.</p>
[ { "answer_id": 74263025, "author": "Ankit", "author_id": 19757319, "author_profile": "https://Stackoverflow.com/users/19757319", "pm_score": 0, "selected": false, "text": "var str = \"SOme Text THat NO YEs END\";\nvar str2 = str[0] || '';\n\nfor (var i = 0; i < str.length; i++) {\n cons...
2022/10/31
[ "https://Stackoverflow.com/questions/74263002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13219800/" ]
74,263,014
<p>Actually, I read someone code and they define props using <code>defineProps&lt;({})&gt;()</code> syntax and I research about it and didn't find anything which helps me to understand about this syntax.</p> <p><strong>How I Define Props</strong></p> <pre><code>defineProps({ }) </code></pre> <p><strong>How other developer define props</strong></p> <pre><code>defineProps&lt;({ })&gt;() </code></pre> <p>I want to know what's the difference between both syntax.</p> <p>Thanks in Advance</p> <p>I actually don't know about two different syntax of defining props in Vue 3 script setup. So, I've tried to ask a question so that I can understand about both syntaxes.</p>
[ { "answer_id": 74263025, "author": "Ankit", "author_id": 19757319, "author_profile": "https://Stackoverflow.com/users/19757319", "pm_score": 0, "selected": false, "text": "var str = \"SOme Text THat NO YEs END\";\nvar str2 = str[0] || '';\n\nfor (var i = 0; i < str.length; i++) {\n cons...
2022/10/31
[ "https://Stackoverflow.com/questions/74263014", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17161252/" ]
74,263,016
<p>How can I return a shared observable from a services' method? I want to get only one call to the request and share it between subscribers. I can get the expected result if I assign the method to a public field but then I cannot pass a param to it.</p> <p>here is the service:</p> <pre><code>@Injectable({ providedIn: 'root', }) export class FetchService { private entries$ = new Subject&lt;number&gt;(); constructor() {} refreshEntries(id: number) { this.entries$.next(id); } getEntries(id = 0) { return this.entries$.pipe( startWith(id), mergeMap((id) =&gt; this.requestEntries(id)), shareReplay(1), ); } requestEntries(id: number) { console.log('requestEntries'); return of([1, 2, 3]); } } </code></pre> <p>and the call:</p> <pre><code>this.entries$ = this.service.getEntries(0); // called with async pipe in template this.service.getEntries(0).subscribe((entries) =&gt; console.log(entries)); </code></pre> <p>I want the <code>console.log('requestEntries')</code> to be called once.</p> <p>it works if I make it without the getEntries method but then I can pass the id to the call. I've omitted the code with the id for now, as it returns some cached data. <a href="https://stackblitz.com/edit/angular-ivy-smyalx?file=src/app/app.component.ts" rel="nofollow noreferrer">Stackblitz</a></p>
[ { "answer_id": 74263718, "author": "Robin Dijkhof", "author_id": 2564847, "author_profile": "https://Stackoverflow.com/users/2564847", "pm_score": 2, "selected": true, "text": "export class FetchService {\n private entries: Observable<number[]>[] = [];\n\n constructor() {}\n\n refresh...
2022/10/31
[ "https://Stackoverflow.com/questions/74263016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3464690/" ]
74,263,033
<p>I need to connect to my database but I keep getting an error that says &quot;driver not found&quot;.</p> <p>I have added <strong>mariadb-java-client-3.0.8.jar</strong> jar file and it is still not working.</p> <p><img src="https://i.stack.imgur.com/u7wbb.png" alt="image of the jar file in classpath" /></p> <p>And this works pretty well on NetBeans, but I need to know how to fix that in VScode IDE. Do you know what I am missing?</p> <pre><code>import java.sql.Connection; import java.sql.DriverManager; public class App { public static void main(String[] args) throws Exception { try { Connection conn = DriverManager.getConnection(&quot;jdbc:mariadb://localhost:3306/cpit305-project&quot;, &quot;root&quot;, &quot;&quot;); System.out.println(&quot;working&quot;); } catch (Exception e) { System.err.println(e); } } } </code></pre> <p>The exception:</p> <blockquote> <p>java.sql.SQLException: No suitable driver found for jdbc:mariadb://localhost:3306/cpit305-project</p> </blockquote>
[ { "answer_id": 74569784, "author": "JialeDu", "author_id": 19133920, "author_profile": "https://Stackoverflow.com/users/19133920", "pm_score": 0, "selected": false, "text": "-" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74263033", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19117499/" ]
74,263,080
<p>I want to remove the dashes and keep only the first 4 substrings except for the last character.</p> <pre><code>sub.maf.barcode &lt;- gsub(&quot;^([^-]*-[^-]*-[^-]*-[^-]*).{1}$&quot;, &quot;\\1&quot;, ori.maf.barcode$Tumor_Sample_Barcode) &gt; ori.maf.barcode$Tumor_Sample_Barcode[1:5] [1] &quot;TCGA-2K-A9WE-01A-11D-A382-10&quot; &quot;TCGA-2Z-A9J1-01A-11D-A382-10&quot; [3] &quot;TCGA-2Z-A9J2-01A-11D-A382-10&quot; &quot;TCGA-2Z-A9J3-01A-12D-A382-10&quot; [5] &quot;TCGA-2Z-A9J5-01A-21D-A382-10&quot; </code></pre> <p>Expected output:</p> <pre><code>[1] &quot;TCGA-2K-A9WE-01&quot; &quot;TCGA-2Z-A9J1-01&quot; [3] &quot;TCGA-2Z-A9J2-01&quot; &quot;TCGA-2Z-A9J3-01&quot; [5] &quot;TCGA-2Z-A9J5-01&quot; </code></pre>
[ { "answer_id": 74263357, "author": "Allan Cameron", "author_id": 12500315, "author_profile": "https://Stackoverflow.com/users/12500315", "pm_score": 1, "selected": false, "text": "gsub('.-[^-]*-[^-]*-.[^-]*$', \"\", ori.maf.barcode$Tumor_Sample_Barcode)\n#> [1] \"TCGA-2K-A9WE-01\" \"TCGA...
2022/10/31
[ "https://Stackoverflow.com/questions/74263080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20076555/" ]
74,263,087
<p>We have a deployment with a large replicas number ( &gt; 1 ) that we must deploy in the same zone.</p> <p>We stumbled upon this documentation section: <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#an-example-of-a-pod-that-uses-pod-affinity" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#an-example-of-a-pod-that-uses-pod-affinity</a></p> <p>which explains how to schedule pods in zones that already have other pods that match certain labels.</p> <p>however, there are no other pods that our deployment depends upon. all other workloads are replicated and spread across multiple zones, and this is the first deployment that we would like to keep in a single zone.</p> <p>also, we thought about explicitly setting the zone for this deployment, but in case of zone failure, it will become unavailable until we notice and explicitly set it to another zone. so setting the exact zone won't work here.</p> <p>any insights here? and thanks!</p>
[ { "answer_id": 74273097, "author": "Blender Fox", "author_id": 2017590, "author_profile": "https://Stackoverflow.com/users/2017590", "pm_score": 1, "selected": false, "text": "failure-domain" }, { "answer_id": 74307410, "author": "moficodes", "author_id": 10272405, "a...
2022/10/31
[ "https://Stackoverflow.com/questions/74263087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4254084/" ]
74,263,098
<p>I had previously asked a <a href="https://stackoverflow.com/questions/74163663/get-current-logged-in-user-in-the-service-in-blazor-server-on-cookie-based-authe">question</a> that was <a href="https://stackoverflow.com/a/74219805/4444757">answered</a> properly, but the problem is that when my custom <code>AuthenticationStateProvider</code> is registered as a scoped</p> <pre><code>services.AddScoped&lt;AuthenticationStateProvider, CustomAuthenticationStateProvider&gt;(); </code></pre> <p>I get the following error:</p> <pre><code>System.InvalidOperationException: GetAuthenticationStateAsync was called before SetAuthenticationState </code></pre> <p>But, when it is registered as a singleton, it works correctly, However, the single instance creates for the lifetime of the application domain by <code>AddSingelton</code>, and so this is not good.(Why? <a href="https://stackoverflow.com/a/72224965/4444757">Because of</a> :))</p> <p>What should I do to register my custom <code>AuthenticationStateProvider</code> as a scoped, but its value is not null?</p> <p><strong>Edit:</strong><br /> According to <code>@MrC aka Shaun Curtis</code> Comment:<br /> It's my <code>CustomAuthenticationStateProvider</code>:</p> <pre><code> public class CustomAuthenticationStateProvider : RevalidatingServerAuthenticationStateProvider { private readonly IServiceScopeFactory _scopeFactory; public CustomAuthenticationStateProvider(ILoggerFactory loggerFactory, IServiceScopeFactory scopeFactory) : base(loggerFactory) =&gt; _scopeFactory = scopeFactory ?? throw new ArgumentNullException(nameof(scopeFactory)); protected override TimeSpan RevalidationInterval { get; } = TimeSpan.FromMinutes(30); protected override async Task&lt;bool&gt; ValidateAuthenticationStateAsync( AuthenticationState authenticationState, CancellationToken cancellationToken) { // Get the user from a new scope to ensure it fetches fresh data var scope = _scopeFactory.CreateScope(); try { var userManager = scope.ServiceProvider.GetRequiredService&lt;IUsersService&gt;(); return await ValidateUserAsync(userManager, authenticationState?.User); } finally { if (scope is IAsyncDisposable asyncDisposable) { await asyncDisposable.DisposeAsync(); } else { scope.Dispose(); } } } private async Task&lt;bool&gt; ValidateUserAsync(IUsersService userManager, ClaimsPrincipal? principal) { if (principal is null) { return false; } var userIdString = principal.FindFirst(ClaimTypes.UserData)?.Value; if (!int.TryParse(userIdString, out var userId)) { return false; } var user = await userManager.FindUserAsync(userId); return user is not null; } } </code></pre> <p>And it's a program configuration and service registration:</p> <pre><code>public void ConfigureServices(IServiceCollection services) { services.AddRazorPages(); services.AddServerSideBlazor(); #region Authentication //Authentication services.AddDbContextFactory&lt;ApplicationDbContext&gt;(options =&gt; { options.UseSqlServer( Configuration.GetConnectionString(&quot;LocalDBConnection&quot;), serverDbContextOptionsBuilder =&gt; { var minutes = (int)TimeSpan.FromMinutes(3).TotalSeconds; serverDbContextOptionsBuilder.CommandTimeout(minutes); serverDbContextOptionsBuilder.EnableRetryOnFailure(); }) .AddInterceptors(new CorrectCommandInterceptor()); ; }); //add policy services.AddAuthorization(options =&gt; { options.AddPolicy(CustomRoles.Admin, policy =&gt; policy.RequireRole(CustomRoles.Admin)); options.AddPolicy(CustomRoles.User, policy =&gt; policy.RequireRole(CustomRoles.User)); }); // Needed for cookie auth. services .AddAuthentication(options =&gt; { options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme; }) .AddCookie(options =&gt; { options.SlidingExpiration = false; options.LoginPath = &quot;/&quot;; options.LogoutPath = &quot;/login&quot;; //options.AccessDeniedPath = new PathString(&quot;/Home/Forbidden/&quot;); options.Cookie.Name = &quot;.my.app1.cookie&quot;; options.Cookie.HttpOnly = true; options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest; options.Cookie.SameSite = SameSiteMode.Lax; options.Events = new CookieAuthenticationEvents { OnValidatePrincipal = context =&gt; { var cookieValidatorService = context.HttpContext.RequestServices.GetRequiredService&lt;ICookieValidatorService&gt;(); return cookieValidatorService.ValidateAsync(context); } }; }); #endregion //AutoMapper services.AddAutoMapper(typeof(MappingProfile).Assembly); //CustomAuthenticationStateProvider services.AddScoped&lt;AuthenticationStateProvider, CustomAuthenticationStateProvider&gt;(); . . } </code></pre>
[ { "answer_id": 74274969, "author": "MrC aka Shaun Curtis", "author_id": 13065781, "author_profile": "https://Stackoverflow.com/users/13065781", "pm_score": 0, "selected": false, "text": "var scope = _scopeFactory.CreateScope();\n/...\nvar userManager = scope.ServiceProvider.GetRequiredSe...
2022/10/31
[ "https://Stackoverflow.com/questions/74263098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4444757/" ]
74,263,133
<p>Even though I used @CrossOrigin annotation this error still appears. Spring boot app is running on 8080 port and react app is running on 3000 port.</p> <p><a href="https://i.stack.imgur.com/7urvA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7urvA.png" alt="image of backend controller" /></a></p> <p>Error:</p> <p><a href="https://i.stack.imgur.com/uRUUg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uRUUg.png" alt="Error in console" /></a></p> <p>If further information is needed, please let me know.</p>
[ { "answer_id": 74274969, "author": "MrC aka Shaun Curtis", "author_id": 13065781, "author_profile": "https://Stackoverflow.com/users/13065781", "pm_score": 0, "selected": false, "text": "var scope = _scopeFactory.CreateScope();\n/...\nvar userManager = scope.ServiceProvider.GetRequiredSe...
2022/10/31
[ "https://Stackoverflow.com/questions/74263133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16349670/" ]
74,263,140
<p>whith this strategy i would like to have the open trade in exactly moment of ema crossovers, but all time I have open trade when the next candle open. It is often a problem because at the ema crossovers I have a bullish push but at the opening of the next candle can be bearish causing the loss of the trade. Can you help me? thanks</p> <pre><code>//@version=5 strategy(title='MARCO 18/20', overlay=true) // STEP 1: // Make inputs that set the take profit % (optional) FastPeriod = input.int(title='Fast MA Period', defval=18, group='Moving Average') SlowPeriod = input.int(title='Slow MA Period', defval=20, group='Moving Average') TPPerc = input.float(title='Long Take Profit (%)', defval=0.11, group='TP &amp; SL') SLPerc = input.float(title='Long Stop Loss (%)', defval=4.4, group='TP &amp; SL') TP_Ratio = input.float(title='Sell Postion Size % @ TP', defval=100, group='TP &amp; SL', tooltip='Example: 100 closing 100% of the position once TP is reached') / 100 // Calculate moving averages fastSMA = ta.sma(close, FastPeriod) slowSMA = ta.sma(close, SlowPeriod) // Calculate trading conditions enterLong = ta.crossover(fastSMA, slowSMA) // Plot moving averages plot(series=fastSMA, color=color.new(color.green, 0), title='Fase MA') plot(series=slowSMA, color=color.new(color.red, 0), title='Slow MA') // STEP 2: // Figure out take profit price percentAsPoints(pcnt) =&gt; strategy.position_size != 0 ? math.round(pcnt / 100.0 * strategy.position_avg_price / syminfo.mintick) : float(na) percentAsPrice(pcnt) =&gt; strategy.position_size != 0 ? (pcnt / 100.0) * strategy.position_avg_price : float(na) current_position_size = math.abs(strategy.position_size) initial_position_size = math.abs(ta.valuewhen(strategy.position_size[1] == 0.0, strategy.position_size, 0)) TP = strategy.position_avg_price + percentAsPoints(TPPerc) * syminfo.mintick * strategy.position_size / math.abs(strategy.position_size) SL = strategy.position_avg_price - percentAsPoints(SLPerc) * syminfo.mintick * strategy.position_size / math.abs(strategy.position_size) // Submit entry orders if enterLong strategy.entry(id='Long', direction=strategy.long) // STEP 3: // Submit exit orders based on take profit price if strategy.position_size &gt; 0 strategy.exit('TP', from_entry='Long', limit=TP, stop=SL) // Plot take profit values for confirmation plot(series=strategy.position_size &gt; 0 ? TP : na, color=color.new(color.green, 0), style=plot.style_circles, linewidth=1, title='Take Profit') plot(series=strategy.position_size &gt; 0 ? SL : na, color=color.new(color.red, 0), style=plot.style_circles, linewidth=1, title='Stop Loss') </code></pre>
[ { "answer_id": 74274969, "author": "MrC aka Shaun Curtis", "author_id": 13065781, "author_profile": "https://Stackoverflow.com/users/13065781", "pm_score": 0, "selected": false, "text": "var scope = _scopeFactory.CreateScope();\n/...\nvar userManager = scope.ServiceProvider.GetRequiredSe...
2022/10/31
[ "https://Stackoverflow.com/questions/74263140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19766762/" ]
74,263,158
<p>I am making a stored function that should trough a varchar make a query but I am loosing the hours in my Date variable.</p> <p>This is a working query that should give me the following records.</p> <pre><code>SELECT RESERVATIONS.NUMERO, RESERVATIONS.DATE_DEBUT_PRECIS, RESERVATIONS.DATE_FIN_PRECIS FROM RESERVATIONS, LIGNES_RESERVATIONS, OBJETS, CLIENTS WHERE LIGNES_RESERVATIONS.OBJ_NUMERO = 261 AND LIGNES_RESERVATIONS.OBJ_SOCIETES_ID = 5 AND LIGNES_RESERVATIONS.SOCIETES_ID = 5 AND OBJETS.NUMERO = LIGNES_RESERVATIONS.OBJ_NUMERO AND OBJETS.SOCIETES_ID = LIGNES_RESERVATIONS.OBJ_SOCIETES_ID AND OBJETS.SOCIETES_ID = 5 AND RESERVATIONS.SOCIETES_ID = 5 AND RESERVATIONS.DEMANDE = 0 AND RESERVATIONS.ANNULER = 0 AND LIGNES_RESERVATIONS.RES_NUMERO = RESERVATIONS.NUMERO AND LIGNES_RESERVATIONS.RES_SOCIETES_ID = RESERVATIONS.SOCIETES_ID AND CLIENTS.NUMERO = RESERVATIONS.CLI_NUMERO AND CLIENTS.SOCIETES_ID = RESERVATIONS.CLI_SOCIETES_ID AND CLIENTS.SOCIETES_ID = 5 AND (TO_DATE('03.10.2022 23:00', 'dd.mm.YYYY hh24:mi') &gt; RESERVATIONS.DATE_DEBUT_PRECIS AND TO_DATE('03.10.2022 07:00', 'dd.mm.YYYY hh24:mi') &lt; RESERVATIONS.DATE_FIN_PRECIS) </code></pre> <p>NUMERO DATE_DEBUT DATE_FIN 94065 03.10.22 03.10.22</p> <p>93995 03.10.22 03.10.22</p> <p>The problem is that the given dates and time in the request are comming from a variable.</p> <p>This is how I make my query in my function :</p> <pre><code>sql_stmt VARCHAR2(2000) := 'SELECT RESERVATIONS.NUMERO, RESERVATIONS.DATE_DEBUT_PRECIS, RESERVATIONS.DATE_FIN_PRECIS FROM RESERVATIONS, LIGNES_RESERVATIONS, OBJETS, CLIENTS WHERE LIGNES_RESERVATIONS.OBJ_NUMERO = '||P_OBJET||' AND LIGNES_RESERVATIONS.OBJ_SOCIETES_ID = '||P_SOCIETE||' AND LIGNES_RESERVATIONS.SOCIETES_ID = '||P_SOCIETE||' AND OBJETS.NUMERO = LIGNES_RESERVATIONS.OBJ_NUMERO AND OBJETS.SOCIETES_ID = LIGNES_RESERVATIONS.OBJ_SOCIETES_ID AND OBJETS.SOCIETES_ID = '||P_SOCIETE||' AND RESERVATIONS.SOCIETES_ID = '||P_SOCIETE||' AND RESERVATIONS.DEMANDE = 0 AND RESERVATIONS.ANNULER = 0 AND LIGNES_RESERVATIONS.RES_NUMERO = RESERVATIONS.NUMERO AND LIGNES_RESERVATIONS.RES_SOCIETES_ID = RESERVATIONS.SOCIETES_ID AND CLIENTS.NUMERO = RESERVATIONS.CLI_NUMERO AND CLIENTS.SOCIETES_ID = RESERVATIONS.CLI_SOCIETES_ID AND CLIENTS.SOCIETES_ID = '||P_SOCIETE||' AND '|| P_DATE_FIN ||' &gt; RESERVATIONS.DATE_DEBUT_PRECIS AND '|| P_DATE_DEBUT ||' &lt; RESERVATIONS.DATE_FIN_PRECIS'; </code></pre> <p>But then, my query looks like this</p> <pre><code>SELECT RESERVATIONS.NUMERO, RESERVATIONS.DATE_DEBUT_PRECIS, RESERVATIONS.DATE_FIN_PRECIS FROM RESERVATIONS, LIGNES_RESERVATIONS, OBJETS, CLIENTS WHERE LIGNES_RESERVATIONS.OBJ_NUMERO = 261 AND LIGNES_RESERVATIONS.OBJ_SOCIETES_ID = 5 AND LIGNES_RESERVATIONS.SOCIETES_ID = 5 AND OBJETS.NUMERO = LIGNES_RESERVATIONS.OBJ_NUMERO AND OBJETS.SOCIETES_ID = LIGNES_RESERVATIONS.OBJ_SOCIETES_ID AND OBJETS.SOCIETES_ID = 5 AND RESERVATIONS.SOCIETES_ID = 5 AND RESERVATIONS.DEMANDE = 0 AND RESERVATIONS.ANNULER = 0 AND LIGNES_RESERVATIONS.RES_NUMERO = RESERVATIONS.NUMERO AND LIGNES_RESERVATIONS.RES_SOCIETES_ID = RESERVATIONS.SOCIETES_ID AND CLIENTS.NUMERO = RESERVATIONS.CLI_NUMERO AND CLIENTS.SOCIETES_ID = RESERVATIONS.CLI_SOCIETES_ID AND CLIENTS.SOCIETES_ID = 5 AND 03.10.2022 &gt; RESERVATIONS.DATE_DEBUT_PRECIS AND 03.10.2022 &lt; RESERVATIONS.DATE_FIN_PRECIS </code></pre> <p>As we can see, there's no hours specification in the query so I tried to force it to be in the query by doing so : &quot;TO_CHAR(P_DATE_FIN, 'dd.mm.YYYY hh24:mi')&quot;. However it didn't work and I couldn't get any results from my query so I tried to make it convert back into a Date value in my query like this : &quot;TO_DATE('''|| TO_CHAR(P_DATE_FIN, 'dd.mm.YYYY hh24:mi')&quot; (the TO_DATE function was supposed to be executed during the query but it just crashed my database.</p>
[ { "answer_id": 74274969, "author": "MrC aka Shaun Curtis", "author_id": 13065781, "author_profile": "https://Stackoverflow.com/users/13065781", "pm_score": 0, "selected": false, "text": "var scope = _scopeFactory.CreateScope();\n/...\nvar userManager = scope.ServiceProvider.GetRequiredSe...
2022/10/31
[ "https://Stackoverflow.com/questions/74263158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19230372/" ]
74,263,159
<p>I've found a code here pretty good to retrieve some data I need (<a href="https://stackoverflow.com/questions/58702437/python-yahoo-finance-error-market-cap-intdata-get-quote-yahoostrmarketcap">Python yahoo finance error market_cap=int(data.get_quote_yahoo(str)[&#39;marketCap&#39;]) TypeError: &#39;int&#39; object is not callable</a>):</p> <pre><code> tickers=[&quot;AAPL&quot;,&quot;GOOG&quot;,&quot;RY&quot;,&quot;HPQ&quot;] # Get market cap (not really necessary for you) market_cap_data = web.get_quote_yahoo(tickers)['marketCap'] # Get the P/E ratio directly pe_data = web.get_quote_yahoo(tickers)['trailingPE'] # print stock and p/e ratio for stock, pe in zip(tickers, pe_data): print(stock, pe) # More keys that can be used ['language', 'region', 'quoteType', 'triggerable', 'quoteSourceName', 'currency', 'preMarketChange', 'preMarketChangePercent', 'preMarketTime', 'preMarketPrice', 'regularMarketChange', 'regularMarketChangePercent', 'regularMarketTime', 'regularMarketPrice', 'regularMarketDayHigh', 'regularMarketDayRange', 'regularMarketDayLow', 'regularMarketVolume', 'regularMarketPreviousClose', 'bid', 'ask', 'bidSize', 'askSize', 'fullExchangeName', 'financialCurrency', 'regularMarketOpen', 'averageDailyVolume3Month', 'averageDailyVolume10Day', 'fiftyTwoWeekLowChange', 'fiftyTwoWeekLowChangePercent', 'fiftyTwoWeekRange', 'fiftyTwoWeekHighChange', 'fiftyTwoWeekHighChangePercent', 'fiftyTwoWeekLow', 'fiftyTwoWeekHigh', 'dividendDate', 'earningsTimestamp', 'earningsTimestampStart', 'earningsTimestampEnd', 'trailingAnnualDividendRate', 'trailingPE', 'trailingAnnualDividendYield', 'marketState', 'epsTrailingTwelveMonths', 'epsForward', 'sharesOutstanding', 'bookValue', 'fiftyDayAverage', 'fiftyDayAverageChange', 'fiftyDayAverageChangePercent', 'twoHundredDayAverage', 'twoHundredDayAverageChange', 'twoHundredDayAverageChangePercent', 'marketCap', 'forwardPE', 'priceToBook', 'sourceInterval', 'exchangeDataDelayedBy', 'tradeable', 'firstTradeDateMilliseconds', 'priceHint', 'exchange', 'shortName', 'longName', 'messageBoardId', 'exchangeTimezoneName', 'exchangeTimezoneShortName', 'gmtOffSetMilliseconds', 'market', 'esgPopulated', 'price'] </code></pre> <p>I would like to retrieve most of the commented fields at the end of the previous code, but I've done this so far:</p> <pre><code>import pandas_datareader as web tickers = [&quot;AAPL&quot;, &quot;GOOG&quot;, &quot;RY&quot;, &quot;SAB.MC&quot;] market_cap_data = web.get_quote_yahoo(tickers)['marketCap'] pe_data = web.get_quote_yahoo(tickers)['trailingPE'] fiftytwo_low_data = web.get_quote_yahoo(tickers)['fiftyTwoWeekLowChangePercent'] for stock, mcap, pe, fiftytwo_low in zip(tickers, market_cap_data, pe_data, fiftytwo_low_data): print(stock, mcap, pe, fiftytwo_low) </code></pre> <p>Obviously I could continue with my brute force, but do you know any way to make the code more elegant to retrieve the whole string of fields with column names?</p> <pre><code>['language', 'region', 'quoteType', 'triggerable', 'quoteSourceName', 'currency', 'preMarketChange', 'preMarketChangePercent', 'preMarketTime', 'preMarketPrice', 'regularMarketChange', 'regularMarketChangePercent', 'regularMarketTime', 'regularMarketPrice', 'regularMarketDayHigh', 'regularMarketDayRange', 'regularMarketDayLow', 'regularMarketVolume', 'regularMarketPreviousClose', 'bid', 'ask', 'bidSize', 'askSize', 'fullExchangeName', 'financialCurrency', 'regularMarketOpen', 'averageDailyVolume3Month', 'averageDailyVolume10Day', 'fiftyTwoWeekLowChange', 'fiftyTwoWeekLowChangePercent', 'fiftyTwoWeekRange', 'fiftyTwoWeekHighChange', 'fiftyTwoWeekHighChangePercent', 'fiftyTwoWeekLow', 'fiftyTwoWeekHigh', 'dividendDate', 'earningsTimestamp', 'earningsTimestampStart', 'earningsTimestampEnd', 'trailingAnnualDividendRate', 'trailingPE', 'trailingAnnualDividendYield', 'marketState', 'epsTrailingTwelveMonths', 'epsForward', 'sharesOutstanding', 'bookValue', 'fiftyDayAverage', 'fiftyDayAverageChange', 'fiftyDayAverageChangePercent', 'twoHundredDayAverage', 'twoHundredDayAverageChange', 'twoHundredDayAverageChangePercent', 'marketCap', 'forwardPE', 'priceToBook', 'sourceInterval', 'exchangeDataDelayedBy', 'tradeable', 'firstTradeDateMilliseconds', 'priceHint', 'exchange', 'shortName', 'longName', 'messageBoardId', 'exchangeTimezoneName', 'exchangeTimezoneShortName', 'gmtOffSetMilliseconds', 'market', 'esgPopulated', 'price'] </code></pre> <p>thanks</p>
[ { "answer_id": 74274969, "author": "MrC aka Shaun Curtis", "author_id": 13065781, "author_profile": "https://Stackoverflow.com/users/13065781", "pm_score": 0, "selected": false, "text": "var scope = _scopeFactory.CreateScope();\n/...\nvar userManager = scope.ServiceProvider.GetRequiredSe...
2022/10/31
[ "https://Stackoverflow.com/questions/74263159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19424245/" ]
74,263,178
<p>I'm trying to turn a list of tables on this page into a Pandas DataFrame: <a href="https://intermediaries.hsbc.co.uk/products/product-finder/" rel="nofollow noreferrer">https://intermediaries.hsbc.co.uk/products/product-finder/</a></p> <p>I want to select the customer type box only and select one of the elements (from first to last) and then click find product to display the table for each one before concatenating all the DataFrames into 1 DataFrame.</p> <p>So far I have managed to select the first element and print the table but I can't seem to turn it into a pandas DataFrame as I get a value error: Must pass 2-d input. shape=(1, 38, 12)</p> <p>This is my code:</p> <pre><code>def product_type_button(self): select = Select(self.driver.find_element_by_id('Availability')) try: select.select_by_visible_text('First time buyer') except NoSuchElementException: print('The item does not exist') time.sleep(5) self.driver.find_element_by_xpath('//button[@type=&quot;button&quot; and (contains(text(),&quot;Find product&quot;))]').click() time.sleep(5) def create_dataframe(self): data1 = pd.read_html(self.driver.page_source) print(data1) data2 = pd.DataFrame(data1) time.sleep(5) data2.to_csv('Data1.csv') </code></pre> <p>I would like to find a way to print the table for each element, maybe selecting by index instead? and then concatenating into one DataFrame. Any help would be appreciated.</p>
[ { "answer_id": 74263342, "author": "Andrej Kesely", "author_id": 10035985, "author_profile": "https://Stackoverflow.com/users/10035985", "pm_score": 3, "selected": true, "text": "re" }, { "answer_id": 74263382, "author": "ozacha", "author_id": 5726768, "author_profile...
2022/10/31
[ "https://Stackoverflow.com/questions/74263178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19795989/" ]
74,263,211
<p>I need to update the backend pool (Maintenance) used by an existing routing rule in Azure Frontdoor to a different existing backend pool (Maintenance2). Here is the UI screen from where it can be done. Can someone advise on how to do this via PowerShell. I have tried via the cmdlets (<a href="https://learn.microsoft.com/en-us/powershell/module/az.frontdoor/set-azfrontdoor?view=azps-9.0.1" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/powershell/module/az.frontdoor/set-azfrontdoor?view=azps-9.0.1</a> ) but unable to get the correct set of commands.</p> <p><a href="https://i.stack.imgur.com/xlhWy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xlhWy.png" alt="enter image description here" /></a></p> <p>I have tried via the cmdlets (<a href="https://learn.microsoft.com/en-us/powershell/module/az.frontdoor/set-azfrontdoor?view=azps-9.0.1" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/powershell/module/az.frontdoor/set-azfrontdoor?view=azps-9.0.1</a> ) but unable to get the correct set of commands.</p>
[ { "answer_id": 74263342, "author": "Andrej Kesely", "author_id": 10035985, "author_profile": "https://Stackoverflow.com/users/10035985", "pm_score": 3, "selected": true, "text": "re" }, { "answer_id": 74263382, "author": "ozacha", "author_id": 5726768, "author_profile...
2022/10/31
[ "https://Stackoverflow.com/questions/74263211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20379092/" ]
74,263,221
<p>I want to use <code>ref.read()</code> in the widget I created. But it requires ConsumerStatefulWidget to use. how can i use <code>ref.read()</code> in widget below.</p> <pre><code> class LoginWidget{ static SizedBox buildLogin(BuildContext context,TextEditingController email,TextEditingController password){ return SizedBox( width: MediaQuery.of(context).size.width, child: Column( children: [ const SizedBox(height: 50), emailTextField(), const SizedBox(height: 15), passwordTextField(), const SizedBox(height: 15), loginButton(context), const SizedBox(height: 15), buildBoldText(&quot;Or&quot;,Colors.black), const SizedBox(height: 15), icons(context), const SizedBox(height: 15), buildBoldText(&quot;Forgot your password?&quot;, Colors.blue), const SizedBox(height: 45), ], ), ); } </code></pre>
[ { "answer_id": 74264137, "author": "john", "author_id": 16146701, "author_profile": "https://Stackoverflow.com/users/16146701", "pm_score": 0, "selected": false, "text": "Consumer" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74263221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18884610/" ]
74,263,230
<p>I have some problems running the code:</p> <p><a href="https://i.stack.imgur.com/KJ0gW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KJ0gW.png" alt="enter image description here" /></a></p> <p>When I run the above code it shows the following: <a href="https://i.stack.imgur.com/2ZWZY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2ZWZY.png" alt="enter image description here" /></a></p> <p>Is it an error or not? How to make the code show only the results without the other lines.</p>
[ { "answer_id": 74264137, "author": "john", "author_id": 16146701, "author_profile": "https://Stackoverflow.com/users/16146701", "pm_score": 0, "selected": false, "text": "Consumer" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74263230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20175792/" ]
74,263,235
<p>I want to do a search and replace on the textual part of the content of the HTML elements.</p> <p>E.g., replacing <code>foo</code> with <code>&lt;b&gt;bar&lt;/b&gt;</code> in</p> <pre><code>&lt;div id=&quot;foo&quot;&gt;foo &lt;i&gt;foo&lt;/i&gt; hi foo hi&lt;/div&gt; </code></pre> <p>should result in</p> <pre><code>&lt;div id=&quot;foo&quot;&gt;&lt;b&gt;bar&lt;/b&gt; &lt;i&gt;&lt;b&gt;bar&lt;/b&gt;&lt;/i&gt; hi &lt;b&gt;bar&lt;/b&gt; hi&lt;/div&gt; </code></pre> <p>I already have a working version in Perl, but the HTML parser there is buggy:</p> <pre class="lang-perl prettyprint-override"><code>#!/usr/bin/env perl ## use strict; use warnings; use v5.34.0; use Mojo::DOM; ## my $input = do { local $/; &lt;STDIN&gt; }; my $dom = Mojo::DOM-&gt;new($input); $dom-&gt;descendant_nodes-&gt;grep(sub { $_-&gt;type eq 'text' }) -&gt;each(sub{ $_-&gt;replace(s/(sth)/&lt;span class=&quot;todo at_tag&quot;&gt;$1&lt;\/span&gt;/gr) }); say $dom; </code></pre>
[ { "answer_id": 74263432, "author": "Bhargav", "author_id": 15358800, "author_profile": "https://Stackoverflow.com/users/15358800", "pm_score": 0, "selected": false, "text": ".replace" }, { "answer_id": 74263470, "author": "0stone0", "author_id": 5625547, "author_profi...
2022/10/31
[ "https://Stackoverflow.com/questions/74263235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1410221/" ]
74,263,285
<p>Is it possible to use <a href="https://docs.opencv.org/4.x/db/d39/classcv_1_1DescriptorMatcher.html" rel="nofollow noreferrer">OpenCV DescriptorMatcher</a> to match two arrays of points instead of two Descriptors generated by feature extraction functions?</p> <p>I'd like to use OpenCV for point set registration, and I've obtained the two points sets without using feature extraction functions.</p>
[ { "answer_id": 74371267, "author": "MarcoM", "author_id": 3306091, "author_profile": "https://Stackoverflow.com/users/3306091", "pm_score": 0, "selected": false, "text": "method = cv2.DESCRIPTOR_MATCHER_BRUTEFORCE_L1\nmatcher = cv2.DescriptorMatcher_create(method)\nmatches = matcher.matc...
2022/10/31
[ "https://Stackoverflow.com/questions/74263285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3306091/" ]
74,263,349
<pre><code>launchWhatsapp(String mobileNumber,BuildContext context) async { var whatsapp = mobileNumber; var whatsappAndroid =Uri.parse(&quot;whatsapp://send?phone=$whatsapp&amp;text=hello&quot;); if (await canLaunchUrl(whatsappAndroid)) { await launchUrl(whatsappAndroid); } else { ScaffoldMessenger.of(context).showSnackBar( const SnackBar( content: Text(&quot;WhatsApp is not installed on the device&quot;), ), ); } } </code></pre> <p>Here, I have used url_launcher plugin,</p> <p><a href="https://pub.dev/packages/url_launcher" rel="nofollow noreferrer">https://pub.dev/packages/url_launcher</a></p> <p>But the mobile number is fixed for all time, mobileNumber = &quot;9876543211&quot;</p> <p>Now, I want to redirect on whatsapp and open chat on this number for food ordering. so everytime number will be same.</p> <p>By launchWhatsapp method it redirect me on whatsapp but it shows me that, this number is not registered or saved in your contacts. How do I open chat screen on whatsapp from any device from my flutter app.</p>
[ { "answer_id": 74263490, "author": "Vrusti Patel", "author_id": 14299145, "author_profile": "https://Stackoverflow.com/users/14299145", "pm_score": 1, "selected": false, "text": " var whatsapp = mobileNumber;\n" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74263349", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14299145/" ]
74,263,384
<p>I have seen a lot of codes and I don't understand what is better practice to use <code>if</code> or <code>if not</code>.</p> <p>I am putting an example here:</p> <pre><code>if result: return some_value else: raise Exception </code></pre> <p>OR</p> <pre><code>if not result: raise Exception return result </code></pre> <p>I just don't know which one is better practice and why. Would love to get your inputs.</p>
[ { "answer_id": 74264693, "author": "NeoUKR", "author_id": 17342447, "author_profile": "https://Stackoverflow.com/users/17342447", "pm_score": -1, "selected": false, "text": "if result:\n return some_value\nelse:\n raise Exception\n" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74263384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9985278/" ]
74,263,385
<p>I am looking for a way to print a PDF file in my laravel application. I have only found on the internet solutions to print the PDF in the web browser. Is there a package that allows me to view a PDF directly in a native Control webBrowser? Thanks in advance!</p>
[ { "answer_id": 74268460, "author": "Broshi", "author_id": 999270, "author_profile": "https://Stackoverflow.com/users/999270", "pm_score": 1, "selected": false, "text": "$file = 'filename.pdf';\n$filename = 'filename.pdf';\n\nheader('Content-type: application/pdf');\nheader('Content-Dispo...
2022/10/31
[ "https://Stackoverflow.com/questions/74263385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14158852/" ]
74,263,390
<pre><code>Set rng = Sheets(&quot;Before&quot;).Range(&quot;B1:B11&quot;) Set rng2 = Sheets(&quot;After&quot;).Range(&quot;B1:B11&quot;) 'create chart Set cht = Sheets(&quot;Plot&quot;).Shapes.AddChart2 'Give chart some data cht.Chart.SetSourceData Source:=rng cht.Chart.SetSourceData Source:=rng2 </code></pre> <p>when I using this two code:</p> <pre><code>cht.Chart.SetSourceData Source:=rng cht.Chart.SetSourceData Source:=rng2 </code></pre> <p>the first chart is draw but it is replace by the second chart. How to combine two chart into one diagram?</p> <p>I already try declare one variable to add the two chart. But it is unsuccessful.</p>
[ { "answer_id": 74495786, "author": "Jon Peltier", "author_id": 485674, "author_profile": "https://Stackoverflow.com/users/485674", "pm_score": 0, "selected": false, "text": "SetSourceData" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74263390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20379249/" ]
74,263,396
<p>I have an app on the Google Playstore and I want a way to alert my users whenever I deploy a new version of the app. I want to know how to make this possible. Does Google Playstore provide any APIs or SDKs to make this possible?</p> <p>I use React-native for development, incase the answer may depend on this.</p>
[ { "answer_id": 74495786, "author": "Jon Peltier", "author_id": 485674, "author_profile": "https://Stackoverflow.com/users/485674", "pm_score": 0, "selected": false, "text": "SetSourceData" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74263396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11492241/" ]
74,263,411
<p>I am trying to construct a type for row in table. All I know is that keys must be string, and key values must be string or number or boolean. I have this:</p> <pre><code>type Row = Record&lt;string, number | string | boolean&gt;; interface User { name: string } const objArr: User[] = [ {name: 'John'}, {name: 'Jack'} ] const testArr: Row[] = objArr </code></pre> <p>But there is an error:</p> <pre><code>Type 'User[]' is not assignable to type 'Row[]'. Type 'User' is not assignable to type 'Row'. Index signature for type 'string' is missing in type 'User'.(2322) </code></pre> <p>I am not sure how to construct a type for object of unknown shape...</p>
[ { "answer_id": 74263678, "author": "caTS", "author_id": 18244921, "author_profile": "https://Stackoverflow.com/users/18244921", "pm_score": -1, "selected": false, "text": "type Row = Record<string, number | string | boolean>;\n\ninterface User {\n name: string\n}\n\nconst objArr: User...
2022/10/31
[ "https://Stackoverflow.com/questions/74263411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007935/" ]
74,263,416
<p>The following code comes from <a href="https://louisdx.github.io/cxx-prettyprint/" rel="nofollow noreferrer">cxx-prettyprint</a> , which implements detecting whether type T has a corresponding member</p> <pre class="lang-cpp prettyprint-override"><code>#include&lt;iostream&gt; #include&lt;vector&gt; #include&lt;type_traits&gt; using namespace std; struct sfinae_base { using yes = char; using no = yes[2]; }; template &lt;typename T&gt; struct has_const_iterator : private sfinae_base { private: template &lt;typename C&gt; static yes&amp; test(typename C::const_iterator*); template &lt;typename C&gt; static no&amp; test(...); public: static const bool value = sizeof(test&lt;T&gt;(nullptr)) == sizeof(yes); using type = T; }; template &lt;typename T&gt; struct has_begin_end : private sfinae_base { private: template &lt;typename C&gt; static yes&amp; f(typename std::enable_if&lt; std::is_same&lt;decltype(static_cast&lt;typename C::const_iterator(C::*)() const&gt;(&amp;C::begin)), typename C::const_iterator(C::*)() const&gt;::value&gt;::type*); template &lt;typename C&gt; static no&amp; f(...); template &lt;typename C&gt; static yes&amp; g(typename std::enable_if&lt; std::is_same&lt;decltype(static_cast&lt;typename C::const_iterator(C::*)() const&gt;(&amp;C::end)), typename C::const_iterator(C::*)() const&gt;::value, void&gt;::type*); template &lt;typename C&gt; static no&amp; g(...); public: static bool const beg_value = sizeof(f&lt;T&gt;(nullptr)) == sizeof(yes); static bool const end_value = sizeof(g&lt;T&gt;(nullptr)) == sizeof(yes); }; int main() { vector&lt;int&gt; sa{ 1,2,3,4,5 }; cout &lt;&lt; has_const_iterator&lt;vector&lt;int&gt;&gt;::value; cout&lt;&lt;has_begin_end&lt;vector&lt;int&gt;&gt;::beg_value; cout &lt;&lt; has_begin_end&lt;vector&lt;int&gt;&gt;::end_value; return 0; } </code></pre> <p><a href="https://godbolt.org/z/GnPrzaeTo" rel="nofollow noreferrer">run it online</a></p> <p>Some time later I read someone else's blog and changed it to this</p> <pre class="lang-cpp prettyprint-override"><code>#include&lt;utility&gt; #include&lt;iostream&gt; #include&lt;vector&gt; using namespace std; template &lt;typename T&gt; struct has_const_iterator { private: template &lt;typename U&gt; static constexpr decltype(std::declval&lt;U::const_iterator&gt;(), bool()) test(int) { return true; } template &lt;typename U&gt; static constexpr bool test(...) { return false; } public: static const bool value = test&lt;T&gt;(1); //为什么这个不对? using type = T; }; template &lt;typename T&gt; struct has_begin_end { private: template &lt;typename U&gt; static constexpr decltype(std::declval&lt;U&gt;().begin(), bool()) f(int) { return true; } template &lt;typename U&gt; static constexpr bool f(...) { return false; } template &lt;typename U&gt; static constexpr decltype(std::declval&lt;U&gt;().end(), bool()) g(int) { return true; } template &lt;typename U&gt; static constexpr bool g(...) { return false; } public: static bool const beg_value = f&lt;T&gt;(2); static bool const end_value = g&lt;T&gt;(2); }; int main() { vector&lt;int&gt; sa{ 1,2,3,4,5 }; cout &lt;&lt; has_const_iterator&lt;vector&lt;int&gt;&gt;::value; cout&lt;&lt;has_begin_end&lt;vector&lt;int&gt;&gt;::beg_value; cout &lt;&lt; has_begin_end&lt;vector&lt;int&gt;&gt;::end_value; return 0; } </code></pre> <p><a href="https://godbolt.org/z/Mn6b1aKqe" rel="nofollow noreferrer">run it online</a></p> <p>For the first piece of code it shows 111<br /> For the second piece of code it shows 011<br /> Snippet 2 was working fine a few months ago, but not now.<br /> My question is, what's wrong with the second one,and why it was good before and now goes wrong?</p> <p>Added: I found <a href="https://stackoverflow.com/a/55270925/13792395">this</a>, what does he mean by <code>introduce ODR violations</code>?</p>
[ { "answer_id": 74263680, "author": "463035818_is_not_a_number", "author_id": 4117728, "author_profile": "https://Stackoverflow.com/users/4117728", "pm_score": 1, "selected": false, "text": "typename" }, { "answer_id": 74263681, "author": "Nelfeal", "author_id": 3854570, ...
2022/10/31
[ "https://Stackoverflow.com/questions/74263416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13792395/" ]
74,263,439
<p>I'm not able to get value of parameters like aldScanningInterval = 30 sec</p> <p>Here is the sample_file.xml:</p> <pre><code>&lt;raml&gt;&lt;cmData&gt; &lt;managedObject class=&quot;com.nokia.srbts.eqm:APEQM&quot; distName=&quot;MRBTS-Template/EQM-1/APEQM-1&quot; version=&quot;EQM21A_2012_002&quot; operation=&quot;create&quot;&gt; &lt;p name=&quot;aldScanningInterval&quot;&gt;30 sec&lt;/p&gt; &lt;p name=&quot;berMajorAlarmThreshold&quot;&gt;-12&lt;/p&gt; &lt;p name=&quot;berMinorAlarmThreshold&quot;&gt;-13&lt;/p&gt; &lt;/managedObject&gt; </code></pre> <p>And this is the code:</p> <pre><code>const XmlReader = require('xml-reader'); const xml = fs.readFileSync(&quot;./publish/DATA/A2G/templates/sample_file.xml&quot;, &quot;utf8&quot;); const xmlr = XmlReader.parseSync(xml); const xmlQuery = require('xml-query'); xmlQuery(xmlr).children().children().map(node =&gt; console.log(node.attributes.distName + &quot;\n Params:\n &quot; + node.children.map(child =&gt; child.attributes.name + &quot;=&quot; + child.value + &quot;\n&quot;))); </code></pre> <p>What I get in console is:</p> <pre><code>Okt 31 13:30:54 S5-VPN a2gc[2835315]: MRBTS-Template/EQM-1/APEQM-1 Okt 31 13:30:54 S5-VPN a2gc[2835315]: Params: Okt 31 13:30:54 S5-VPN a2gc[2835315]: aldScanningInterval= Okt 31 13:30:54 S5-VPN a2gc[2835315]: ,berMajorAlarmThreshold= Okt 31 13:30:54 S5-VPN a2gc[2835315]: ,berMinorAlarmThreshold= </code></pre> <p>The value is not coming. Why? I tried also with .text and becomes undefined.</p> <p>This is what comes from:</p> <pre><code>xmlQuery(xmlr).children().children().map(node =&gt; console.log(node.children)); Okt 31 13:41:47 S5-VPN a2gc[2838984]: [ { name: 'p', Okt 31 13:41:47 S5-VPN a2gc[2838984]: type: 'element', Okt 31 13:41:47 S5-VPN a2gc[2838984]: value: '', Okt 31 13:41:47 S5-VPN a2gc[2838984]: parent: Okt 31 13:41:47 S5-VPN a2gc[2838984]: { name: 'managedObject', Okt 31 13:41:47 S5-VPN a2gc[2838984]: type: 'element', Okt 31 13:41:47 S5-VPN a2gc[2838984]: value: '', Okt 31 13:41:47 S5-VPN a2gc[2838984]: parent: [Object], Okt 31 13:41:47 S5-VPN a2gc[2838984]: attributes: [Object], Okt 31 13:41:47 S5-VPN a2gc[2838984]: children: [Circular] }, Okt 31 13:41:47 S5-VPN a2gc[2838984]: attributes: { name: 'aldScanningInterval' }, Okt 31 13:41:47 S5-VPN a2gc[2838984]: children: [ [Object] ] }, </code></pre> <p>Thank you in advance.</p>
[ { "answer_id": 74264351, "author": "João Paulo", "author_id": 6921249, "author_profile": "https://Stackoverflow.com/users/6921249", "pm_score": 1, "selected": false, "text": " xmlQuery(child).text() \n" }, { "answer_id": 74313154, "author": "Tuan Anh Tran", "author_id": 2...
2022/10/31
[ "https://Stackoverflow.com/questions/74263439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6921249/" ]
74,263,466
<p>I am trying to publish a website (or webapp, not sure how to tell which it is) in Visual Studio 2019, .Net Framework v4.5.1. It builds without a problem but always throws an error when I try to publish:</p> <pre><code>Error BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its base types. </code></pre> <p>The error refers to this button:</p> <pre><code>&lt;asp:Button ID=&quot;btnSearch&quot; CssClass=&quot;subButton&quot; runat=&quot;server&quot; /&gt; </code></pre> <p>Which fires this in the code behind:</p> <pre><code>Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Search.Click </code></pre> <p>This button is already on our live website working fine, and hasn't been changed in years so I don't understand why it is suddenly a problem. All the answers I have seen online suggest adding a WithEvents clause - but there is nowhere to put it because the button is not defined in code.</p> <p>Can anyone suggest how I solve this?</p>
[ { "answer_id": 74264351, "author": "João Paulo", "author_id": 6921249, "author_profile": "https://Stackoverflow.com/users/6921249", "pm_score": 1, "selected": false, "text": " xmlQuery(child).text() \n" }, { "answer_id": 74313154, "author": "Tuan Anh Tran", "author_id": 2...
2022/10/31
[ "https://Stackoverflow.com/questions/74263466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17901650/" ]
74,263,473
<p>I would like to align some equations and have equation numbering simultaneously. When I render it to pdf, it works as expected, however, when I render it to HTML the alignment works, but no numbers appear.</p> <p><strong>MWE</strong>:</p> <pre><code>--- title: &quot;equation example&quot; format: html --- \begin{align} x &amp;= 2y\\ x^2 &amp;= 2y*2y \end{align} </code></pre> <p>I could use cross-referencing like this</p> <pre><code>$$ x = 2y $$ {#eq-1} $$ x^2 = 2y*2y $$ {#eq-2} </code></pre> <p>but then I loose the alignment.</p> <p><strong>Edit 1:</strong> This is the output when the format is pdf. The equations are aligned at the &amp;-sign. I would like to reproduce that for html as well. <a href="https://i.stack.imgur.com/GVn4I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GVn4I.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74264351, "author": "João Paulo", "author_id": 6921249, "author_profile": "https://Stackoverflow.com/users/6921249", "pm_score": 1, "selected": false, "text": " xmlQuery(child).text() \n" }, { "answer_id": 74313154, "author": "Tuan Anh Tran", "author_id": 2...
2022/10/31
[ "https://Stackoverflow.com/questions/74263473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14137004/" ]
74,263,491
<p>I am trying to get the highest element from a group with the class .bottom and set them all to have a height of that value.</p> <p>My code I have now:</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-js lang-js prettyprint-override"><code> equalHeight(){ const newsBlokken = document.querySelectorAll('#news .bottom'); let highest = 0; newsBlokken.forEach(function(item) { console.log(item.getBoundingClientRect().height); const itemH = item.getBoundingClientRect().height; highest = items &gt; highest ? itemH : highest; }); console.log(highest); }</code></pre> </div> </div> </p> <p>The weird thing is that if I console log <code>item</code> I get <code>150</code> 3 times and if I log <code>highest</code> I also get <code>150</code> while one of the elements is definitely larger.</p> <p>If I just console log <code>newsBlokken</code> outside of the loop and inspect the array I see that the last one has: <code>offsetHeight: 195</code> while the first two have <code>150</code>. How come it doesn't get the <code>195</code>? <code>ClientHeight</code> also has <code>195</code> for the last element.</p> <p>What am I missing?</p> <p>As you can see the elements are not the same height:</p> <p><a href="https://i.stack.imgur.com/qMVqr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qMVqr.png" alt="enter image description here" /></a></p> <p>HTML:</p> <pre><code>&lt;section id=&quot;news&quot; class=&quot;wrapper pb-0&quot;&gt; &lt;div class=&quot;row&quot;&gt; &lt;div class=&quot;col-12 news-top&quot; style=&quot;padding-bottom: 242px;&quot;&gt; &lt;div class=&quot;container-fluid&quot;&gt; &lt;div class=&quot;d-flex justify-content-lg-between justify-content-center&quot;&gt; &lt;h2 class=&quot;dark pb-4&quot;&gt;Our latest news&lt;/h2&gt; &lt;a class=&quot;button d-none d-lg-inline-flex&quot; href=&quot;#&quot;&gt; &lt;span&gt;View more&lt;/span&gt; &lt;span class=&quot;icon-arrow-right&quot;&gt;&lt;/span&gt; &lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;col-12 news-content&quot;&gt; &lt;div class=&quot;container-fluid&quot;&gt; &lt;div class=&quot;swiper-container swiper-initialized swiper-horizontal swiper-pointer-events swiper-backface-hidden&quot; style=&quot;margin-top: -242px;&quot;&gt; &lt;div class=&quot;swiper-wrapper&quot; style=&quot;transform: translate3d(0px, 0px, 0px);&quot;&gt; &lt;div class=&quot;swiper-slide swiper-slide-active&quot; style=&quot;width: 443.333px; margin-right: 25px;&quot;&gt; &lt;a class=&quot;&quot; href=&quot;&quot;&gt; &lt;div class=&quot;news&quot;&gt; &lt;img src=&quot;img.jpg&quot; alt=&quot;alt&quot;&gt; &lt;div class=&quot;bottom&quot;&gt; &lt;h3&gt;Title&lt;/h3&gt; &lt;span class=&quot;icon-arrow-right&quot;&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/a&gt; &lt;/div&gt; &lt;div class=&quot;swiper-slide swiper-slide-next&quot; style=&quot;width: 443.333px; margin-right: 25px;&quot;&gt; &lt;a class=&quot;&quot; href=&quot;&quot;&gt; &lt;div class=&quot;news&quot;&gt; &lt;img src=&quot;img.jpg&quot; alt=&quot;alt&quot;&gt; &lt;div class=&quot;bottom&quot;&gt; &lt;h3&gt;Title&lt;/h3&gt; &lt;span class=&quot;icon-arrow-right&quot;&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/a&gt; &lt;/div&gt; &lt;div class=&quot;swiper-slide&quot; style=&quot;width: 443.333px; margin-right: 25px;&quot;&gt; &lt;a class=&quot;&quot; href=&quot;&quot;&gt; &lt;div class=&quot;news&quot;&gt; &lt;img src=&quot;img.jpg&quot; alt=&quot;alt&quot;&gt; &lt;div class=&quot;bottom&quot;&gt; &lt;h3&gt;Title&lt;/h3&gt; &lt;span class=&quot;icon-arrow-right&quot;&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/section&gt; </code></pre>
[ { "answer_id": 74263717, "author": "Siddiqui Affan", "author_id": 14928212, "author_profile": "https://Stackoverflow.com/users/14928212", "pm_score": 1, "selected": false, "text": "Math.max()" }, { "answer_id": 74263941, "author": "Helping Hands", "author_id": 17498311, ...
2022/10/31
[ "https://Stackoverflow.com/questions/74263491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5941337/" ]
74,263,494
<p>In my <code>Class Items():</code> I have an <code>.__init__</code> function that initiates 7 variables. Then I have a subclass <code>Toys(Items):</code> it uses all 7 variables initiated as the Items + 3 extra variables. All of the variables are set when the object is created.</p> <p>Simplified Example of what I’m doing now:</p> <pre class="lang-py prettyprint-override"><code>Class Items(): def __init__(self, name, color, size): self.name = name # etc. Class Toys(Items): def __init__(self, name, color, size, shape, noise) self.name = name # etc. </code></pre> <p>I’ve tried, static variables but it doesn’t work since the variables affect all instances of Toys and each one needs to be different. I’ve tried using the Super function but it kicks errors for having too many args. I’m currently working through @classmethod to see what happens.</p> <p>Am I already doing it properly by overriding, or is there a better way to work the problem?</p>
[ { "answer_id": 74263578, "author": "Epsi95", "author_id": 6660638, "author_profile": "https://Stackoverflow.com/users/6660638", "pm_score": 3, "selected": true, "text": "args, kewargs" }, { "answer_id": 74263582, "author": "Alex L", "author_id": 9792594, "author_profi...
2022/10/31
[ "https://Stackoverflow.com/questions/74263494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20379184/" ]
74,263,527
<p>This is a function to get integer numbers from Console, this parte works right. The trouble is in the part of write the values from the array.</p> <pre><code>Console.WriteLine(&quot;Function get numbers...&quot;); static int[] numbers(int[] values){ for(int ind = 0; ind &lt; 10; ind++){ Console.WriteLine(&quot;Type a number: &quot;); values[ind]= int.Parse(Console.ReadLine()); } return values; } numbers(new int[10]); for(int s= 1; s &lt; 10; s++){ Console.WriteLine(numbers(new int[s])); } </code></pre> <p>I I looked in the documentation but I didn't find a solution.</p>
[ { "answer_id": 74263578, "author": "Epsi95", "author_id": 6660638, "author_profile": "https://Stackoverflow.com/users/6660638", "pm_score": 3, "selected": true, "text": "args, kewargs" }, { "answer_id": 74263582, "author": "Alex L", "author_id": 9792594, "author_profi...
2022/10/31
[ "https://Stackoverflow.com/questions/74263527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12277897/" ]
74,263,583
<p>I run a HttpTrigger Azure Function which runs above 5 seconds. Locally it works like a charm but deployed it returns &quot;(500) Internal Server Error&quot;.</p> <p>EDIT: It only happens if I deploy it to a FunctionApp with Private Endpoints enabled.</p> <p>Steps to reproduce (fails):</p> <pre><code>using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.Extensions.Logging; using System.Threading; using System.Threading.Tasks; namespace MyTest.TestFunction { public class TestFunction { [FunctionName(&quot;TestFunction&quot;)] public static async Task&lt;IActionResult&gt; Run([HttpTrigger(AuthorizationLevel.Function, &quot;get&quot;, &quot;post&quot;, Route = null)] HttpRequest req, ILogger log) { log.LogInformation(&quot;Before sleep&quot;); Thread.Sleep(7000); log.LogInformation(&quot;After sleep&quot;); return new OkObjectResult($&quot;Hello&quot;); } } } </code></pre> <p>Steps to reproduce (works):</p> <pre><code>using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.Extensions.Logging; using System.Threading; using System.Threading.Tasks; namespace MyTest.TestFunction { public class TestFunction { [FunctionName(&quot;TestFunction&quot;)] public static async Task&lt;IActionResult&gt; Run([HttpTrigger(AuthorizationLevel.Function, &quot;get&quot;, &quot;post&quot;, Route = null)] HttpRequest req, ILogger log) { log.LogInformation(&quot;Before sleep&quot;); Thread.Sleep(2000); log.LogInformation(&quot;After sleep&quot;); return new OkObjectResult($&quot;Hello&quot;); } } } </code></pre> <p>My host.json looks like this:</p> <pre><code>{ &quot;version&quot;: &quot;2.0&quot;, &quot;logging&quot;: { &quot;applicationInsights&quot;: { &quot;samplingSettings&quot;: { &quot;isEnabled&quot;: true, &quot;excludedTypes&quot;: &quot;Request&quot; } } }, &quot;functionTimeout&quot;: &quot;00:15:00&quot;, } </code></pre> <p>FYI: The non-test function does not use sleep but just takes longer then 5 seconds.</p>
[ { "answer_id": 74263578, "author": "Epsi95", "author_id": 6660638, "author_profile": "https://Stackoverflow.com/users/6660638", "pm_score": 3, "selected": true, "text": "args, kewargs" }, { "answer_id": 74263582, "author": "Alex L", "author_id": 9792594, "author_profi...
2022/10/31
[ "https://Stackoverflow.com/questions/74263583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20379246/" ]
74,263,584
<p>first I want to apologize for my English, but I have one question: in the code below I want to cut some values after the point, so ho can I do it? BUT <em>Without using any Built methods!</em></p> <pre class="lang-cs prettyprint-override"><code>static void Main(string[] args) { int[] array = { 6, 2, 3, 2, 12, 1 }; double arithmethicAverage; arithmethicAverage = ArithmethicAverage(array); Console.WriteLine($&quot;Arithmetic average of array is: {arithmethicAverage} &quot;); // ==&gt; 4,333333333333333 but i need to print:--&gt; 4,33 } public static double ArithmethicAverage(int[] array) { double result = 0; for (int i = 0; i &lt; array.Length; i++) { result += array[i]; } result /= array.Length; return result; } </code></pre>
[ { "answer_id": 74263692, "author": "MahdiShams", "author_id": 14269229, "author_profile": "https://Stackoverflow.com/users/14269229", "pm_score": 2, "selected": false, "text": "arithmethicAverage.ToString(\"0.00\")\n" }, { "answer_id": 74263706, "author": "cemahseri", "au...
2022/10/31
[ "https://Stackoverflow.com/questions/74263584", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19577619/" ]
74,263,615
<p>i want to enable and disable a textfield when i click on a radio button in flutter. so when the user enabales the radiobutton the text field is enable and vise versa. `</p> <pre><code>ListTile( title: const Text('Per Kilometer Policy'), leading: Radio&lt;SingingCharacter&gt;( value: SingingCharacter.unchecked, groupValue: _character, fillColor: MaterialStateColor.resolveWith( (states) =&gt; Colors.black), onChanged: (SingingCharacter? isKiloChecked) { setState(() { _character = isKiloChecked; }); }, ), TextFormField( enabled: _kilometerButtonDisable, onSaved: (Value) =&gt; print(kiloMeter), decoration: InputDecoration( hintStyle: TextStyle( fontFamily: &quot;Proxima Nova&quot;, fontWeight: FontWeight.w300, ), border: InputBorder.none, labelStyle: TextStyle( color: Color(0xffFAFAFA), ), ), inputFormatters: [ FilteringTextInputFormatter.allow(RegExp(r&quot;[0-9]+|\s&quot;)) ], controller: kiloMeter, validator: (value) { if (value != null &amp;&amp; value.isEmpty || value != 1000) { return 'Please enter your Kilometer'; } return null; }, ), </code></pre> <p>`</p>
[ { "answer_id": 74263692, "author": "MahdiShams", "author_id": 14269229, "author_profile": "https://Stackoverflow.com/users/14269229", "pm_score": 2, "selected": false, "text": "arithmethicAverage.ToString(\"0.00\")\n" }, { "answer_id": 74263706, "author": "cemahseri", "au...
2022/10/31
[ "https://Stackoverflow.com/questions/74263615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6143170/" ]
74,263,644
<p>I have a container with width <code>MediaQuery.of(context).size.width / 1.75</code>.When I minimize screen size text inside the container is overflowing.</p> <p>This is the output I got now:</p> <p><a href="https://i.stack.imgur.com/v52YG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v52YG.png" alt="enter image description here" /></a></p> <pre><code>class ProfileTopPortion extends StatelessWidget { const ProfileTopPortion({ Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, body: Column( children: [ Padding( padding: const EdgeInsets.all(18.0), child: Container( width: MediaQuery.of(context).size.width / 1.75, decoration: BoxDecoration( border: Border.all(color: Color(0xffEBEBEB), width: 0.4), color: Color(0xfffbfbfa), ), child: Row( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(left: 20.0), child: MouseRegion( cursor: SystemMouseCursors.click, child: GestureDetector( onTap: () { // Get.toNamed('/events',arguments: 0); }, child: Padding( padding: const EdgeInsets.only(top: 0.0), child: SvgPicture.asset( allowDrawingOutsideViewBox: true, Images.avatar, ), )), ), ), SizedBox( width: 20, ), Column( // mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'First Name', ), SizedBox( height: 6, ), Text( 'Engineer', ), SizedBox( height: 20, ), Row( children: [ Column( // mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Email', ), SizedBox( height: 10, ), Text( 'Organization', ), ], ), SizedBox( width: 30, ), Column( mainAxisSize: MainAxisSize.min, // mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'testEmail1235@gmail.com', ), SizedBox( height: 10, ), Text(&quot;Test12346@gma.com&quot;), ], ) ], ), SizedBox( height: 25, ), ], ), ], ), ), ), ], ), ); } } </code></pre> <p>I tried flexible and expanded widgets but nothing works.</p>
[ { "answer_id": 74263735, "author": "Manish Dayma", "author_id": 20067845, "author_profile": "https://Stackoverflow.com/users/20067845", "pm_score": 0, "selected": false, "text": "Expanded( child: Column(\n mainAxisSize: MainAxisSize.min,\n ...
2022/10/31
[ "https://Stackoverflow.com/questions/74263644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11118094/" ]
74,263,674
<p>I'm stuck with the logic. So here it is, I have one model class Note:</p> <pre><code>data class Note( val id: Int, val title: String, val description: String, val date: Long = System.currentTimeMillis() ) </code></pre> <p>I have a list of multiple notes in my app <code>List&lt;Note&gt;</code>. And I need a way to convert that list into a Map. Where key will be the <code>date: Long</code>, and the value will be <code>List&lt;Note&gt;</code>. So: <code>Map&lt;Long, List&lt;Note&gt;&gt;</code> . I need to group those notes by the day of the month. For example, if multiple notes were created on October 31th, then they should be grouped in a single list of Notes, within a Map.</p> <p>I'm really not sure how can I achieve that. Always had troubles with those date values. I will appreciate any help. :)</p>
[ { "answer_id": 74264008, "author": "Tenfour04", "author_id": 506796, "author_profile": "https://Stackoverflow.com/users/506796", "pm_score": 3, "selected": true, "text": "equals" }, { "answer_id": 74264213, "author": "TheLibrarian", "author_id": 3434763, "author_profi...
2022/10/31
[ "https://Stackoverflow.com/questions/74263674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14836193/" ]
74,263,675
<p>I have a dataset of analysis in the form:</p> <pre><code>| Compound | Concentration |SampleID| </code></pre> <p>There are 200 sample IDs, with 9000 unique Compounds giving a df with 63,000 rows. (not every compound is found in every sample)</p> <p>What I would like to do is take the ten most frequently occurring compounds and create a subset so I can graph their concentrations using a boxplot or similar</p> <p>I've tried using the below, but this leads to an error, and also only filters the top ten (so they're all the same compound)</p> <pre><code>df %&gt;% arrange(desc(df$Concentration)) %&gt;% slice(1:10, preserve=T) %&gt;% ggplot(., aes(x=df$Compound,y=df$Concentration))+ geom_point()+ theme(axis.text.x = element_text(angle = 45, hjust = 1)) + labs(x=&quot;Compound&quot;, y=&quot;Frequency&quot;) </code></pre> <p>My other thought would be</p> <pre><code> arrange(desc(as.data.frame(table(df$Compound)))) %&gt;% slice(1:50, preserve=T) %&gt;% ggplot(., aes(x=df$Compound,y=df$Concentration))+ geom_point()+ theme(axis.text.x = element_text(angle = 45, hjust = 1)) + labs(x=&quot;Compound&quot;, y=&quot;Frequency&quot;) </code></pre> <p>Neither work. I feel like I need to make a df with a list of the top 10, then filter my df to give dftop and then subset my df to just those elements</p> <p>Can anyone help simplify this?</p>
[ { "answer_id": 74263948, "author": "zephryl", "author_id": 17303805, "author_profile": "https://Stackoverflow.com/users/17303805", "pm_score": 2, "selected": true, "text": "dplyr::starwars" }, { "answer_id": 74264127, "author": "langtang", "author_id": 4447540, "autho...
2022/10/31
[ "https://Stackoverflow.com/questions/74263675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20379355/" ]
74,263,695
<p>I wrote my first app using nodejs,reactjs and spring using <a href="https://www.baeldung.com/spring-boot-react-crud" rel="nofollow noreferrer">this</a> tutorial and all went fine except for the buttons that are not working as expected because when I click on them, the link is updated in the browser address but the page is not loaded until I press F5 to reload.</p> <p>Is hard to explain without an image so I attached a print screen with some text.</p> <p>So I can add customers, delete and edit... but after every click on a button, I must press F5 to actually load the destination page. I tried this in Chrome, Edge and Opera and in all browsers the behaviour is the same.</p> <p>This seems to be very basic but I don't know what to search on google to fix it, I tried to search documentation about the button tag but in everything I read I can't even find the attributes listed in the tutorial.</p> <p>The button syntax is &quot;&lt;Button size=&quot;sm&quot; color=&quot;primary&quot; tag={Link} to={&quot;/clients/&quot; + client.id}&gt;Edit&quot; and attributes like &quot;tab&quot; and &quot;to&quot; don't seem to be documented in the reactjs documentation.</p> <p><a href="https://i.stack.imgur.com/k7PAQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k7PAQ.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74263948, "author": "zephryl", "author_id": 17303805, "author_profile": "https://Stackoverflow.com/users/17303805", "pm_score": 2, "selected": true, "text": "dplyr::starwars" }, { "answer_id": 74264127, "author": "langtang", "author_id": 4447540, "autho...
2022/10/31
[ "https://Stackoverflow.com/questions/74263695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1510155/" ]
74,263,742
<p>I have code that looks like:</p> <pre><code>vector&lt;unique_ptr&lt;Foo&gt;&gt; foos = ... // Init vector. // Do some stuff. func(std::move(foos)); // func should now own foos, I'm done with them. </code></pre> <pre><code>// Takes ownership of foos. void func(vector&lt;unique_ptr&lt;Foo&gt;&gt;&amp;&amp; foos); </code></pre> <p>Now inside <code>func</code> I want to refactor out a bit of code into a separate function that needs to use <code>foos</code>. I am wondering how to do this. The options I considered are:</p> <pre><code>void util_func1(const vector&lt;Foo*&gt;&amp; foos); // Does not take ownership of foos void util_func2(const vector&lt;unique_ptr&lt;Foo&gt;&gt;&amp; foos); // Does not take ownership of foos </code></pre> <p>The first option seems in line with the recommendation for (non-vectors of) unique_ptr, if a function takes ownership, pass unique_ptr by value, if a function doesn't take ownership pass by raw ptr/ref. If I understand correctly, the recommendation is to never pass unique_ptr by const-ref. Which is essentially what <code>util_func2</code> is doing.</p> <p>My problems is that now <code>func</code> has gotten pretty ugly:</p> <pre><code>void func(vector&lt;unique_ptr&lt;Foo&gt;&gt;&amp;&amp; foos) { vector&lt;Foo*&gt; raw_ptr_foos; raw_ptr_foos.reserve(foos.size()); for (auto foo : foos) raw_ptr_foos.push_back(foo.get()); util_func1(raw_ptr_foos); } </code></pre> <p>So is <code>util_func2</code> the correct way to do this or should I bite the bullet and write the ugly conversion to <code>raw_ptr_foos</code> or is there a 3rd way?</p>
[ { "answer_id": 74265344, "author": "Caleth", "author_id": 2610810, "author_profile": "https://Stackoverflow.com/users/2610810", "pm_score": 0, "selected": false, "text": "template <typename P, typename T>\nconcept points_to = requires(P p) {\n { *p } -> std::common_reference_with<T &>...
2022/10/31
[ "https://Stackoverflow.com/questions/74263742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/919578/" ]