qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
74,257,726
<p>I have looked into this thread <a href="https://stackoverflow.com/questions/3653065/get-local-ip-address-in-node-js">Get local IP address in Node.js</a>, where I want to implement a piece of code:</p> <pre class="lang-js prettyprint-override"><code>import net from 'net'; const getNetworkIP = (callback: any) =&gt; { var socket = net.createConnection(80, 'www.google.com'); socket.on('connect', function () { const sa = socket.address(); callback(undefined, sa.address); socket.end(); }); socket.on('error', function (e) { callback(e, 'error'); }); }; </code></pre> <p>I can not call <code>sa.address</code> because the <code>socket.address()</code> will return either <code>{}</code> or <code>net.AddressInfo</code>. How to deal with this common code scenario in typescript? How can I access the <code>address</code> attribute safely?</p>
[ { "answer_id": 74257802, "author": "Bergi", "author_id": 1048572, "author_profile": "https://Stackoverflow.com/users/1048572", "pm_score": 2, "selected": false, "text": "@types/node" }, { "answer_id": 74257859, "author": "jsejcksn", "author_id": 438273, "author_profil...
2022/10/31
[ "https://Stackoverflow.com/questions/74257726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16475217/" ]
74,257,736
<p>At <a href="https://stackoverflow.com/questions/2257993/how-to-display-all-methods-of-an-object">this thread</a> it is suggested that <code>Object.getOwnPropertyNames</code> should return all properties of an object including functions. But when I do the following;</p> <pre><code>let date1 = new Date(); Object.getOwnPropertyNames(date1); </code></pre> <p>this returns 0 results. But <code>date1</code> has methods like <code>date1.toISOString()</code>.</p> <p>How can I fetch all those methods?</p>
[ { "answer_id": 74257802, "author": "Bergi", "author_id": 1048572, "author_profile": "https://Stackoverflow.com/users/1048572", "pm_score": 2, "selected": false, "text": "@types/node" }, { "answer_id": 74257859, "author": "jsejcksn", "author_id": 438273, "author_profil...
2022/10/31
[ "https://Stackoverflow.com/questions/74257736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/929902/" ]
74,257,757
<p>I've encountered this issue in a longer script and have simplified here to show the minimal code required to reproduce it (I think). It outputs numbers followed by letters: 1 a 1 b 1 c... 2 a 2 b 2 c... all the way to &quot;500 z&quot;</p> <pre><code>Function Write-HelloWorld { Param($number) write-host -Object $number } $numbers = 1..500 $letters = &quot;a&quot;..&quot;z&quot; $Function = get-command Write-HelloWorld $numbers | ForEach-Object -Parallel { ${function:Write-HelloWorld} = $using:Function foreach($letter in $using:letters) { Write-HelloWorld -number &quot;$_ $letter&quot; } } </code></pre> <p>I'm seeing 2 types of sporadically (not every time I run it):</p> <ol> <li>&quot;The term 'write-host' is not recognized as a name of a cmdlet, function, script file, or executable program.&quot; As understand it, write-host should always be available. Adding the line &quot;Import-Module Microsoft.PowerShell.Utility&quot; just before the call to write-host didn't help</li> <li>Odd output like the below, specifically all the &quot;write-host :&quot; lines.</li> </ol> <p><a href="https://i.stack.imgur.com/Uug1t.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Uug1t.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74257802, "author": "Bergi", "author_id": 1048572, "author_profile": "https://Stackoverflow.com/users/1048572", "pm_score": 2, "selected": false, "text": "@types/node" }, { "answer_id": 74257859, "author": "jsejcksn", "author_id": 438273, "author_profil...
2022/10/31
[ "https://Stackoverflow.com/questions/74257757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7661250/" ]
74,257,759
<p>I need to convert a string value similar to <code>.904</code> and <code>-.904</code> to a double. I haven't found any simple and direct way to do so, except to copy each character to another string and manually add the zero and then covert to double.</p>
[ { "answer_id": 74257988, "author": "NineBerry", "author_id": 101087, "author_profile": "https://Stackoverflow.com/users/101087", "pm_score": 3, "selected": true, "text": "CultureInfo.InvariantCulture" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74257759", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15205696/" ]
74,257,790
<p>I am testing my authentication with the <code>django.test.Client</code> and two tests cases fail because once I test my <code>test_login_success</code> test case, the other tests fail because the user remains authenticated, even when I am instantiating a new client in the class <code>setUp</code> and even deleting the user in the <code>tearDown</code>.</p> <p>My code:</p> <pre><code>from django.test import Client, TestCase from app.users.models import User class TestLogin(TestCase): def setUp(self): super().setUp() self.email = 'test@test.com' self.password = 'SomeRandomPass96' User.objects.create_user(email=self.email, password=self.password) self.client = Client() def tearDown(self): User.objects.filter(email=self.email).delete() super().tearDown() def test_not_authenticated(self): # success the first time, fails after test_login_success is executed for the first time. user = User.objects.get(email=self.email) assert not user.is_authenticated def test_login_success(self): # always success self.client.post( '/users/login/', {'email': self.email, 'password': self.password} ) user = User.objects.get(email=self.email) assert user.is_authenticated def test_login_wrong_credentials(self): # success the first time, fails after test_login_success is executed for the first time. self.client.post( '/users/login/', {'email': self.email, 'password': 'wrongPassword123'} ) user = User.objects.get(email=self.email) assert not user.is_authenticated </code></pre>
[ { "answer_id": 74270908, "author": "JohnnyBola", "author_id": 12685944, "author_profile": "https://Stackoverflow.com/users/12685944", "pm_score": 1, "selected": false, "text": "logout" }, { "answer_id": 74280245, "author": "Gonzalo Dambra", "author_id": 10922372, "aut...
2022/10/31
[ "https://Stackoverflow.com/questions/74257790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10922372/" ]
74,257,861
<p>I can't find the solution to my idea. I get an error. I would like to create a big function that takes an array to change such as <code>[1,2,3,42,342,34,3,3,2,4,5,2,3]</code>, a list with proper numbers <code>listToFind = [1,2,3,4]</code>, and an internal function. The internal function creates a dictionary with <code>listToFind</code> and returns it to a big function where I want to iterate through the array, checking if the <code>i</code> (value) is in a dictionary.</p> <p>I'm getting the error:</p> <blockquote> <p>&quot;Value of type '(Int) -&gt; [Int : Bool]' has no subscripts&quot;</p> </blockquote> <p>after <code>if someFunc[i] != nil {</code></p> <pre class="lang-swift prettyprint-override"><code>func myFuncBig (arrayToChange: [Int], listToTakeToFind: [Int], someFunc: (Int) -&gt; [Int:Bool]) -&gt; [Int] { var sortedList = [Int]() for i in arrayToChange { if someFunc[i] != nil { sortedList.append(i) } } return sortedList } </code></pre> <pre class="lang-swift prettyprint-override"><code>func createDict (array: [Int]) -&gt; [Int:Bool] { var dictToReturn = [Int: Bool]() for item in array { dictToReturn[item] = true } return dictToReturn } </code></pre> <p>It's not clear how to return a dictionary and find a value by key in it because going through the dictionary like <code>dict[i]</code> works without closures.</p>
[ { "answer_id": 74258340, "author": "workingdog support Ukraine", "author_id": 11969817, "author_profile": "https://Stackoverflow.com/users/11969817", "pm_score": 0, "selected": false, "text": "someFunc" }, { "answer_id": 74259629, "author": "Joakim Danielson", "author_id"...
2022/10/31
[ "https://Stackoverflow.com/questions/74257861", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20375238/" ]
74,257,872
<p>I've installed pystencils in python on windows, but it has the error when I try to import.</p> <p>&quot;Visual Studio not found. Write path to VS folder in pystencils config&quot;.</p> <p>I've installed Visual Studio, and have opened the pystencils config file, but how exactly do I write the path:</p> <p>C:\Program Files\Microsoft Visual Studio</p> <p>to the file?</p> <p>I tried looking for a simple explanation for this, but couldn't find any. I've probably missed something basic.</p> <p>Below is the config code, which is a .py file.</p> <pre><code> from copy import copy from collections import defaultdict from dataclasses import dataclass, field from types import MappingProxyType from typing import Union, Tuple, List, Dict, Callable, Any, DefaultDict from pystencils import Target, Backend, Field from pystencils.typing.typed_sympy import BasicType from pystencils.typing.utilities import collate_types import numpy as np # TODO: There exists DTypeLike in NumPy which would be better than type for type hinting, to new at the moment # from numpy.typing import DTypeLike # TODO: CreateKernelConfig is bloated think of more classes better usage, factory whatever ... # Proposition: CreateKernelConfigs Classes for different targets? @dataclass class CreateKernelConfig: &quot;&quot;&quot; **Below all parameters for the CreateKernelConfig are explained** &quot;&quot;&quot; target: Target = Target.CPU &quot;&quot;&quot; All targets are defined in :class:`pystencils.enums.Target` &quot;&quot;&quot; backend: Backend = None &quot;&quot;&quot; All backends are defined in :class:`pystencils.enums.Backend` &quot;&quot;&quot; function_name: str = 'kernel' &quot;&quot;&quot; Name of the generated function - only important if generated code is written out &quot;&quot;&quot; data_type: Union[type, str, DefaultDict[str, BasicType], Dict[str, BasicType]] = np.float64 &quot;&quot;&quot; Data type used for all untyped symbols (i.e. non-fields), can also be a dict from symbol name to type. If specified as a dict ideally a defaultdict is used to define a default value for symbols not listed in the dict. If a plain dict is provided it will be transformed into a defaultdict internally. The default value will then be specified via type collation then. &quot;&quot;&quot; default_number_float: Union[type, str, BasicType] = None &quot;&quot;&quot; Data type used for all untyped floating point numbers (i.e. 0.5). By default the value of data_type is used. If data_type is given as a defaultdict its default_factory is used. &quot;&quot;&quot; default_number_int: Union[type, str, BasicType] = np.int64 &quot;&quot;&quot; Data type used for all untyped integer numbers (i.e. 1) &quot;&quot;&quot; iteration_slice: Tuple = None &quot;&quot;&quot; Rectangular subset to iterate over, if not specified the complete non-ghost layer part of the field is iterated over &quot;&quot;&quot; ghost_layers: Union[bool, int, List[Tuple[int]]] = None &quot;&quot;&quot; A single integer specifies the ghost layer count at all borders, can also be a sequence of pairs ``[(x_lower_gl, x_upper_gl), .... ]``. These layers are excluded from the iteration. If left to default, the number of ghost layers is determined automatically from the assignments. &quot;&quot;&quot; cpu_openmp: Union[bool, int] = False &quot;&quot;&quot; `True` or number of threads for OpenMP parallelization, `False` for no OpenMP. If set to `True`, the maximum number of available threads will be chosen. &quot;&quot;&quot; cpu_vectorize_info: Dict = None &quot;&quot;&quot; A dictionary with keys, 'vector_instruction_set', 'assume_aligned' and 'nontemporal' for documentation of these parameters see vectorize function. Example: '{'instruction_set': 'avx512', 'assume_aligned': True, 'nontemporal':True}' &quot;&quot;&quot; cpu_blocking: Tuple[int] = None &quot;&quot;&quot; A tuple of block sizes or `None` if no blocking should be applied &quot;&quot;&quot; omp_single_loop: bool = True &quot;&quot;&quot; If OpenMP is active: whether multiple outer loops are permitted &quot;&quot;&quot; gpu_indexing: str = 'block' &quot;&quot;&quot; Either 'block' or 'line' , or custom indexing class, see `pystencils.gpucuda.AbstractIndexing` &quot;&quot;&quot; gpu_indexing_params: MappingProxyType = field(default=MappingProxyType({})) &quot;&quot;&quot; Dict with indexing parameters (constructor parameters of indexing class) e.g. for 'block' one can specify '{'block_size': (20, 20, 10) }'. &quot;&quot;&quot; # TODO Markus rework this docstring default_assignment_simplifications: bool = False &quot;&quot;&quot; If `True` default simplifications are first performed on the Assignments. If problems occur during the simplification a warning will be thrown. Furthermore, it is essential to know that this is a two-stage process. The first stage of the process acts on the level of the `pystencils.AssignmentCollection`. In this part, `pystencil.simp.create_simplification_strategy` from pystencils.simplificationfactory will be used to apply optimisations like insertion of constants to remove pressure from the registers. Thus the first part of the optimisations can only be executed if an `AssignmentCollection` is passed. The second part of the optimisation acts on the level of each Assignment individually. In this stage, all optimisations from `sympy.codegen.rewriting.optims_c99` are applied to each Assignment. Thus this stage can also be applied if a list of Assignments is passed. &quot;&quot;&quot; cpu_prepend_optimizations: List[Callable] = field(default_factory=list) &quot;&quot;&quot; List of extra optimizations to perform first on the AST. &quot;&quot;&quot; use_auto_for_assignments: bool = False &quot;&quot;&quot; If set to `True`, auto can be used in the generated code for data types. This makes the type system more robust. &quot;&quot;&quot; index_fields: List[Field] = None &quot;&quot;&quot; List of index fields, i.e. 1D fields with struct data type. If not `None`, `create_index_kernel` instead of `create_domain_kernel` is used. &quot;&quot;&quot; coordinate_names: Tuple[str, Any] = ('x', 'y', 'z') &quot;&quot;&quot; Name of the coordinate fields in the struct data type. &quot;&quot;&quot; allow_double_writes: bool = False &quot;&quot;&quot; If True, don't check if every field is only written at a single location. This is required for example for kernels that are compiled with loop step sizes &gt; 1, that handle multiple cells at once. Use with care! &quot;&quot;&quot; skip_independence_check: bool = False &quot;&quot;&quot; Don't check that loop iterations are independent. This is needed e.g. for periodicity kernel, that access the field outside the iteration bounds. Use with care! &quot;&quot;&quot; class DataTypeFactory: &quot;&quot;&quot;Because of pickle, we need to have a nested class, instead of a lambda in __post_init__&quot;&quot;&quot; def __init__(self, dt): self.dt = dt def __call__(self): return BasicType(self.dt) def _check_type(self, dtype_to_check): if isinstance(dtype_to_check, str) and (dtype_to_check == 'float' or dtype_to_check == 'int'): self._typing_error() if isinstance(dtype_to_check, type) and not hasattr(dtype_to_check, &quot;dtype&quot;): # NumPy-types are also of type 'type'. However, they have more properties self._typing_error() @staticmethod def _typing_error(): raise ValueError(&quot;It is not possible to use python types (float, int) for datatypes because these &quot; &quot;types are ambiguous. For example float will map to double. &quot; &quot;Also the string version like 'float' is not allowed, e.g. use 'float64' instead&quot;) def __post_init__(self): # ---- Legacy parameters if not isinstance(self.target, Target): raise ValueError(&quot;target must be provided by the 'Target' enum&quot;) # ---- Auto Backend if not self.backend: if self.target == Target.CPU: self.backend = Backend.C elif self.target == Target.GPU: self.backend = Backend.CUDA else: raise NotImplementedError(f'Target {self.target} has no default backend') if not isinstance(self.backend, Backend): raise ValueError(&quot;backend must be provided by the 'Backend' enum&quot;) # Normalise data types for dtype in [self.data_type, self.default_number_float, self.default_number_int]: self._check_type(dtype) if not isinstance(self.data_type, dict): dt = copy(self.data_type) # The copy is necessary because BasicType has sympy shinanigans self.data_type = defaultdict(self.DataTypeFactory(dt)) if isinstance(self.data_type, dict) and not isinstance(self.data_type, defaultdict): for dtype in self.data_type.values(): self._check_type(dtype) dt = collate_types([BasicType(dtype) for dtype in self.data_type.values()]) dtype_dict = self.data_type self.data_type = defaultdict(self.DataTypeFactory(dt), dtype_dict) assert isinstance(self.data_type, defaultdict), &quot;At this point data_type must be a defaultdict!&quot; for dtype in self.data_type.values(): self._check_type(dtype) self._check_type(self.data_type.default_factory()) if self.default_number_float is None: self.default_number_float = self.data_type.default_factory() if not isinstance(self.default_number_float, BasicType): self.default_number_float = BasicType(self.default_number_float) if not isinstance(self.default_number_int, BasicType): self.default_number_int = BasicType(self.default_number_int) </code></pre>
[ { "answer_id": 74258340, "author": "workingdog support Ukraine", "author_id": 11969817, "author_profile": "https://Stackoverflow.com/users/11969817", "pm_score": 0, "selected": false, "text": "someFunc" }, { "answer_id": 74259629, "author": "Joakim Danielson", "author_id"...
2022/10/31
[ "https://Stackoverflow.com/questions/74257872", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6264721/" ]
74,257,877
<p>I would like my Y axis to start at 1 on the x-axis, my first data point, and end at 3, my last data point, at the moment there is a cell on each side of my plot making the plot look like it starts in the middle of the graph. My x axis is categorical</p> <p>I've tried fiddling with all the functions in the GGstream PDF (there aren't that many). I am wondering if the fix lays within the &quot;mapping&quot; function but I can't seem to get it to work, the PDF gives no indication how to use it, with the only option as &quot;NULL&quot;. I have tried using GGPlot2 language such as</p> <ul> <li>scale_x_discrete(limits=c(&quot;1&quot;, &quot;2&quot; &quot;3&quot;)</li> </ul> <p>and</p> <ul> <li>coord_cartesian(xlim = c(1,3))</li> </ul> <p>But I still have this extra &quot;padding&quot; around my data</p> <p>Reprex:</p> <pre><code>library(ggstream) Date &lt;- c(&quot;1&quot;, &quot;1&quot;, &quot;2&quot;, &quot;2&quot;, &quot;3&quot;, &quot;3&quot;) Taxon &lt;- c(&quot;Turtle&quot;, &quot;Invert&quot;, &quot;Turtle&quot;, &quot;Invert&quot;, &quot;Turtle&quot;, &quot;Invert&quot;) Freq &lt;- c(&quot;100&quot;, &quot;50&quot;, &quot;50&quot;, &quot;2&quot;, &quot;35&quot;, &quot;0&quot;) stream &lt;- data.frame(Date, Taxon, Freq) stream$Date &lt;- as.factor(stream$Date) ggplot(stream, aes(x = Date, y = Freq, fill = Taxon)) + geom_stream (extra_span = 0.8, bw = 1, sorting = c( &quot;onset&quot;), type = &quot;ridge&quot;) </code></pre>
[ { "answer_id": 74258340, "author": "workingdog support Ukraine", "author_id": 11969817, "author_profile": "https://Stackoverflow.com/users/11969817", "pm_score": 0, "selected": false, "text": "someFunc" }, { "answer_id": 74259629, "author": "Joakim Danielson", "author_id"...
2022/10/31
[ "https://Stackoverflow.com/questions/74257877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13895984/" ]
74,257,890
<p>Hi Im trying to sum values of one column if 'ID' matches for all in a dataframe</p> <p>For example</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>ID</th> <th>Gender</th> <th>value</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Male</td> <td>5</td> </tr> <tr> <td>1</td> <td>Male</td> <td>6</td> </tr> <tr> <td>2</td> <td>Female</td> <td>3</td> </tr> <tr> <td>3</td> <td>Female</td> <td>0</td> </tr> <tr> <td>3</td> <td>Female</td> <td>9</td> </tr> <tr> <td>4</td> <td>Male</td> <td>10</td> </tr> </tbody> </table> </div> <p>How do I get the following table</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>ID</th> <th>Gender</th> <th>value</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Male</td> <td>11</td> </tr> <tr> <td>2</td> <td>Female</td> <td>3</td> </tr> <tr> <td>3</td> <td>Female</td> <td>9</td> </tr> <tr> <td>4</td> <td>Male</td> <td>10</td> </tr> </tbody> </table> </div> <p>In the example above, ID with Value 1 is now showed just once and its value has been summed up (same for ID with value 3).</p> <p>Thanks</p> <p>Im new to Pyspark and still learning. I've tried count(), select and groupby() but nothing has resulted in what Im trying to do.</p>
[ { "answer_id": 74258340, "author": "workingdog support Ukraine", "author_id": 11969817, "author_profile": "https://Stackoverflow.com/users/11969817", "pm_score": 0, "selected": false, "text": "someFunc" }, { "answer_id": 74259629, "author": "Joakim Danielson", "author_id"...
2022/10/31
[ "https://Stackoverflow.com/questions/74257890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20309930/" ]
74,257,908
<p>I am developing an application that has a quite sizeable amount of Queries and Mutation. Structures for data are often not complex, but there is plenty of them, so I have made myself a snippet, that generates the most common things repeating throughout them. This snippet also generates an input for mutations so it can be used for both simple and complex data structures. In quite a bit of instances, the input is just for adding a name. The API is supposed to be used mainly by my fronted, but after the app gets mature enough should be publicly available. Is doing this a problem in terms on conventions?</p> <p>Sample of what I mean</p> <pre class="lang-js prettyprint-override"><code>/*============================================= Types =============================================*/ interface AddSampleSchemaInput { input: AddSampleSchema } interface AddSampleSchema { name: string } /*============================================= Main =============================================*/ export const SampleSchemaModule = { typeDefs: gql` type Mutation { addSampleSchema(input: AddSampleSchemaInput): SampleSchema! } type SampleSchema { _id: ID! name: String! } input AddSampleSchemaInput { name: String! } ` , resolvers: { Mutation: { addSampleSchema: async (parents: any, args: AddSampleSchemaInput, context: GraphqlContext) =&gt; { } } } } </code></pre> <p>Sample of what I assume it should be.</p> <pre class="lang-js prettyprint-override"><code>/*============================================= Main =============================================*/ export const SampleSchemaModule = { typeDefs: gql` type Mutation { addSampleSchema(name: String): SampleSchema! } type SampleSchema { _id: ID! name: String! } ` , resolvers: { Mutation: { addSampleSchema: async (parents: any, args: { name: string }, context: GraphqlContext) =&gt; { } } } } export default SampleSchemaModule </code></pre> <p>Would usage of the first code example be a problem. This means using input (input AddSampleSchemaInput), even if it were to contain just a single value (in this case name).</p> <p>Or in other words is using input for every mutation a problem no matter the complexity.</p> <p>Or the impact on frontent:</p> <pre class="lang-js prettyprint-override"><code>addDogBreed({ variables: { input: { name: &quot;Retriever&quot;, avergeHeight: 0.65 } } }) addDog({ variables: { input: { name: &quot;Charlie&quot; } } }) // ======= VS ======= addDogBreed({ variables: { input: { name: &quot;Retriever&quot;, avergeHeight: 0.65 } } }) addDog({ variables: { name: &quot;Charlie&quot; } }) </code></pre> <p>In this case, is having the first one instead of the second one a problem?</p>
[ { "answer_id": 74258340, "author": "workingdog support Ukraine", "author_id": 11969817, "author_profile": "https://Stackoverflow.com/users/11969817", "pm_score": 0, "selected": false, "text": "someFunc" }, { "answer_id": 74259629, "author": "Joakim Danielson", "author_id"...
2022/10/31
[ "https://Stackoverflow.com/questions/74257908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20241005/" ]
74,257,915
<p>I looked at Microsoft's documentation, the best practice should be the second one. But I'm still puzzled by that. I used both constructors in my program without any problems. I would like to know what exactly the difference is?</p> <pre><code>public class Person { // fields private string _firstName; private string _lastName; // data accessor public string FirstName { get { return _firstName; } set { _firstName = value; } } public string LastName { get { return _lastName; } set { _lastName = value; } } // constructor public Person(string fn, string ln) { _firstName = fn; _lastName = ln; } } </code></pre> <pre><code>public class Person { // fields private string _firstName; private string _lastName; // data accessor public string FirstName { get { return _firstName; } set { _firstName = value; } } public string LastName { get { return _lastName; } set { _lastName = value; } } // constructor public Person(string fn, string ln) { FirstName = fn; LastName = ln; } } </code></pre>
[ { "answer_id": 74257970, "author": "John Wu", "author_id": 2791540, "author_profile": "https://Stackoverflow.com/users/2791540", "pm_score": 0, "selected": false, "text": "public class Person\n{\n public string FirstName { get; set; }\n public string LastName { get; set; }\n}\n" ...
2022/10/31
[ "https://Stackoverflow.com/questions/74257915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
74,257,959
<p>In this webpage: <a href="https://www.centris.ca/en/properties%7Efor-sale%7Ebrossard?view=Thumbnail" rel="nofollow noreferrer">https://www.centris.ca/en/properties~for-sale~brossard?view=Thumbnail</a></p> <p>I am trying to do two things:</p> <ol> <li>get the price of the listings</li> <li>get the MLS number of the listings</li> </ol> <pre><code>from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By import time url = 'https://www.centris.ca/en/properties~for-sale~brossard?view=Thumbnail' def scrap_pages(driver): listings = driver.find_elements(By.CLASS_NAME, 'description') if listings[-1].text.split('/n')[0] == '': del listings[-1] for listing in listings: print(listing.text.split('\n')) price = listing.text.split('\n')[0] prop_type = listing.text.split('\n')[1] addr = listing.text.split('\n')[2] city = listing.text.split('\n')[3] sector = listing.text.split('\n')[4] bedrooms = listing.text.split('\n')[5] bathrooms = listing.text.split('\n')[6] listing_item = { 'price': price, 'Address': addr, 'property Type': prop_type, 'city': city, 'bedrooms': bedrooms, 'bathrooms': bathrooms, 'sector': sector } centris_list.append(listing_item) if __name__ == '__main__': chrome_options = Options() chrome_options.add_experimental_option(&quot;detach&quot;, True) #chrome_options.add_argument(&quot;headless&quot;) driver = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options) centris_list=[] driver.get(url) total_pages = driver.find_element(By.CLASS_NAME,'pager-current').text.split('/')[1].strip() for i in range(1,int(total_pages)): scrap_pages(driver) driver.find_element(By.CSS_SELECTOR,'li.next&gt; a').click() time.sleep(0.8) </code></pre> <p>my code above already gets the price, but not in a way I would like. I don't like the fact that I had to get the whole description, and then go through the whole text/split/list selection. I tried to grab the price via one of the following methods below but none of it worked. They all returned unable to find element error. and if I can get price to work I might be able to adapt it the rest of the data too.</p> <pre><code>#price= listing.find_element(By.CLASS_NAME, 'price').text #price= listing.find_element(By.XPATH, './/*[@id=&quot;divMainResult&quot;]/div[1]/div/div[2]/a/div[2]/span[1]').text #price= listing.find_element(By.XPATH, './/*[@id=&quot;divMainResult&quot;]/div[1]/div/div[2]/a/div[2]/meta[2]').text #price = listing.find_element(By.CSS_SELECTOR, '#divMainResult &gt; div:nth-child(1) &gt; div &gt; div.description &gt; a &gt; div.price').text </code></pre> <p>the 2nd part of the question, getting the MLS number, unforunately I was never able to get it working, they all returned unable to find element error. But if I look at the HTML source of the webpage, I can see each listing does come with a MLS number: <a href="https://imgur.com/a/ZEoTLoO" rel="nofollow noreferrer">https://imgur.com/a/ZEoTLoO</a></p> <pre><code>#mls= listing.find_element(By.TAG_NAME, 'MlsNumberNoStealth').text #mls = listing.find_element(By.CSS_SELECTOR, '#MlsNumberNoStealth').text #mls = listing.find_element(By.ID, 'MlsNumberNoStealth').text #mls = listing.find_element(By.XPATH, './/*[@id=&quot;MlsNumberNoStealth&quot;]/p').text #mls = listing.find_elements(By.TAG_NAME, 'div') #mls = listing.find_elements(By.ID, 'MlsNumberNoStealth') </code></pre>
[ { "answer_id": 74258096, "author": "Owen Silberman", "author_id": 17703991, "author_profile": "https://Stackoverflow.com/users/17703991", "pm_score": 0, "selected": false, "text": "h1.style.display = \"block\" " }, { "answer_id": 74262299, "author": "Prophet", "author_id"...
2022/10/31
[ "https://Stackoverflow.com/questions/74257959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/943222/" ]
74,257,966
<p>i want to replace remove/replace every whitespace in a string which is not after a comma. I already searched for a suitable regex but i did not find one. Here is a sample of the strings i want to modify:</p> <pre><code>{id=565189.0, server=Ealyn, merchantName=Nox, activeMerchants=[{id=f01b617d-2dc7-4597-2297-08dabad9a125, name=Nox, zone=Nebel horn, card={name=Bergstrom, rarity=2.0}, rapport={name=Energy X7 Capsule, rarity=3.0}, votes=0.0}]} </code></pre> <p>should change to (_ trough replace)</p> <pre><code>{id=565189.0, server=Ealyn, merchantName=Nox, activeMerchants=[{id=f01b617d-2dc7-4597-2297-08dabad9a125, name=Nox, zone=Nebel_horn, card={name=Bergstrom, rarity=2.0}, rapport={name=Energy_X7_Capsule, rarity=3.0}, votes=0.0}]} </code></pre> <p>Can someone with a high knowledge then me over regular expression's create one for this case? Thanks in advance</p> <p>I already tried this expression:</p> <pre><code>(^|[^,])\\s+ </code></pre> <p>.. but it always removed a character with the whitespace</p>
[ { "answer_id": 74258053, "author": "John Gilmer", "author_id": 2317585, "author_profile": "https://Stackoverflow.com/users/2317585", "pm_score": 0, "selected": false, "text": "replaceAll" }, { "answer_id": 74258054, "author": "E Joseph", "author_id": 18011737, "author...
2022/10/31
[ "https://Stackoverflow.com/questions/74257966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12626216/" ]
74,258,031
<p>I just added a new file to the <a href="https://metacpan.org/dist/PDL-IO-Touchstone" rel="nofollow noreferrer">PDL::IO::Touchstone</a> distribution and noticed that CPAN's indexer says version is undef since <code>$VERSION</code> is missing:</p> <pre><code> module : PDL::IO::MDIF version: undef in file: PDL-IO-Touchstone-1.009/lib/PDL/IO/MDIF.pm status : indexed </code></pre> <p>So ::MDIF does not have <code>$VERSION</code> but really it is the same as the distribution version as noted in Makefile.PL:</p> <pre class="lang-perl prettyprint-override"><code>my %WriteMakefileArgs = ( VERSION_FROM =&gt; 'lib/PDL/IO/Touchstone.pm', ... ); </code></pre> <p><strong>Questions:</strong></p> <ul> <li>So does this module within the distribution need a version?</li> <li>If so, should the new module's <code>$VERSION</code> be maintained separately from <code>$VERSION</code> provided by <code>VERSION_FROM</code> in <code>Makefile.PL</code>? <ul> <li>I could do <code>$VERSION = $PDL::IO::Touchstone::VERSION</code> but not sure if CPAN will figure that out. Will it?</li> </ul> </li> </ul> <p>I looked around and found lots of discussion of versioning practices, but nothing about versions of modules within the same Perl distribution package. Please share what the best practice here should be, I'm new to Perl modules and this is the first 2-file distribution that I've pushed out.</p> <p>I'm sure I'll update the primary file when releasing a new dist, but not sure if I'll remember to bump the version of other modules in the dist when they change. It would be nice if there is a low-maintenance option here.</p> <h1>Update</h1> <p>I tried the suggestion in some answers below. Neither of these work:</p> <ul> <li><p><code>$VERSION = do { use PDL::IO::Touchstone; $PDL::IO::Touchstone::VERSION };</code></p> </li> <li><p><code>use PDL::IO::Touchstone; our $VERSION = $PDL::IO::Touchstone::VERSION;</code></p> </li> </ul> <p>This is the MDIF.pm file at github: <a href="https://github.com/KJ7LNW/perl-PDL-IO-Touchstone/blob/master/lib/PDL/IO/MDIF.pm#L22" rel="nofollow noreferrer">https://github.com/KJ7LNW/perl-PDL-IO-Touchstone/blob/master/lib/PDL/IO/MDIF.pm#L22</a></p> <p>CPAN still shows <code>version: undef</code>:</p> <pre><code>Status: Version parsing problem =============================== module : PDL::IO::MDIF version: undef ... </code></pre> <p>Ok, so who gets the checkmark... any other ideas?</p>
[ { "answer_id": 74263907, "author": "ikegami", "author_id": 589924, "author_profile": "https://Stackoverflow.com/users/589924", "pm_score": 3, "selected": false, "text": "VERSION_FROM" }, { "answer_id": 74264406, "author": "brian d foy", "author_id": 2766176, "author_p...
2022/10/31
[ "https://Stackoverflow.com/questions/74258031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14055985/" ]
74,258,049
<p>I'm creating a method that splits a 2D array into 4 parts.</p> <p>For example if the grid is:</p> <pre><code>1 5 6 2 3 1 6 5 6 3 9 4 3 8 4 2 </code></pre> <p>The method should return this:</p> <pre><code>1 5 3 1 6 2 6 5 6 3 3 8 9 4 4 2 </code></pre> <p>The code I have only prints the 2D array into a grid. What I was thinking was to create 4 new grids in the method and then, with a series of forloops and if statements, print each new grid. that's why there are 4 2d arrays in the method. Any suggestions?</p> <pre><code>public class problem { public static void main(String[] args) { double[][] array1 = { {1, 5, 6, 2}, { 3, 1, 6, 5}, { 6, 3, 9, 4}, {3, 8, 4, 2} }; splitGrid(array1); } public static void splitGrid( double[][] grid ) { //Create four new grids here double[][] TopLeft; double[][] TopRight; double[][] BottomLeft; double[][] BottonRight; // Filling the top-left grid for( int i = 0; i &lt; grid.length; i++) { System.out.println(); for(int j = 0; j &lt; grid[i].length; j++) { System.out.print(grid[i][j] + &quot; &quot; ); } } } } </code></pre>
[ { "answer_id": 74258383, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "{topLeft, topRight, bottomLeft, bottomRight}" }, { "answer_id": 74259563, "author": "mrkachariker", "author_...
2022/10/31
[ "https://Stackoverflow.com/questions/74258049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20187389/" ]
74,258,055
<p>My Ubuntu server version is 22.04 and Python is 3.10.6. And the pip version is 22.0.2</p> <pre><code>pip install htttp </code></pre> <p>The above command was entered to install the http module, but an error occurred.</p> <pre><code>Collecting http Downloading http-0.02.tar.gz (32 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─&gt; [31 lines of output] Traceback (most recent call last): File &quot;&lt;string&gt;&quot;, line 2, in &lt;module&gt; File &quot;&lt;pip-setuptools-caller&gt;&quot;, line 34, in &lt;module&gt; File &quot;/tmp/pip-install-wt_twpw1/http_e204a51ec15142428e42fe97cce6fbe8/setup.py&quot;, line 3, in &lt;module&gt; import http File &quot;/tmp/pip-install-wt_twpw1/http_e204a51ec15142428e42fe97cce6fbe8/http/__init__.py&quot;, line 17, in &lt;module&gt; from request import Request ModuleNotFoundError: No module named 'request' Error in sys.excepthook: Traceback (most recent call last): File &quot;/usr/lib/python3/dist-packages/apport_python_hook.py&quot;, line 72, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes File &quot;/usr/lib/python3/dist-packages/apport/__init__.py&quot;, line 5, in &lt;module&gt; from apport.report import Report File &quot;/usr/lib/python3/dist-packages/apport/report.py&quot;, line 21, in &lt;module&gt; from urllib.request import urlopen File &quot;/usr/lib/python3.10/urllib/request.py&quot;, line 88, in &lt;module&gt; import http.client File &quot;/tmp/pip-install-wt_twpw1/http_e204a51ec15142428e42fe97cce6fbe8/http/__init__.py&quot;, line 17, in &lt;module&gt; from request import Request ModuleNotFoundError: No module named 'request' </code></pre> <p>Looking at the error contents, it seemed that the request module was not installed. so</p> <pre><code>pip install request </code></pre> <p>However, the request module also cannot be installed.</p> <pre><code>ERROR: Could not find a version that satisfies the requirement request (from versions: none) ERROR: No matching distribution found for request </code></pre> <p>I need some help.</p>
[ { "answer_id": 74258123, "author": "Renato Araújo", "author_id": 7066934, "author_profile": "https://Stackoverflow.com/users/7066934", "pm_score": 2, "selected": false, "text": "import http" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74258055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19329152/" ]
74,258,061
<p>I'm new in react and js and I'm attempting to create an array from a declared array of json objects and a second array from user inputs. The idea is I have a list of objects existing, and the user can add to this list as many items as they like.</p> <p>My problem is I can only currently add one more item to my list, and subsequent items over write it. I believe my issue lies in the line:</p> <pre><code>let newBooks = [{title, author, rating}] </code></pre> <p>but I'm having trouble correcting it.</p> <pre><code> const addBookToList = () =&gt; { let newBooks = [{title, author, rating}] const allBooks = [...FAVOURITE_BOOKS, ...newBooks] setBooks(allBooks) setTitle(&quot;&quot;) setAuthor(&quot;&quot;) setRating(&quot;&quot;) } </code></pre> <p>For reference, everything I'm working on is within index.js</p>
[ { "answer_id": 74258097, "author": "windowsill", "author_id": 5708566, "author_profile": "https://Stackoverflow.com/users/5708566", "pm_score": 3, "selected": true, "text": "const App = () => {\n const [books, setBooks] = useState(FAVORITE_BOOKS);\n\n const addBook = () => {\n const...
2022/10/31
[ "https://Stackoverflow.com/questions/74258061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20243017/" ]
74,258,118
<p>I want to search for data using a primary key, with PO as an example. Btw, I'm new to Laravel. Below is my code for my controller. I want to make the system go to the new page if the data that was searched exists(click on search button). If not, it will stay on the same page. Actually, I don't know whether my code is correct or not.</p> <pre><code>public function supplierindex(){ $supp_details = Supplier::where('PO','LIKE','%'.$searchPO.'%')-&gt;get(); return view ('frontend.praiBarcode.getweight') -&gt;with('supp_details',$supp_details); } public function searchindex() { return view ('frontend.praiBarcode.getweight'); } public function searchPO() { $searchPO = Supplier::where('PO','like',&quot;%&quot;.$search.&quot;%&quot;)-&gt;get(); if (Supplier::where('PO','like',&quot;%&quot;.$search.&quot;%&quot;)-&gt;exists()) { return view('frontend.praiBarcode.getweight',compact('searchPO')); } else { return view('frontend.praiBarcode.index'); } } </code></pre> <p>Below is my code in blade.php. However, the data does not come out on the screen.</p> <pre><code> &lt;div class= &quot;form-group&quot;&gt; @foreach ($supp_details as s) &lt;div style=&quot;font-size: 16px;&quot; class=&quot;form-group row&quot;&gt; &lt;label for=&quot;supp_name&quot; class = &quot;col-sm-2&quot;&gt;PO&lt;/label&gt; &lt;label for=&quot;supp_name&quot; class = &quot;col-sm-1&quot;&gt;:&lt;/label&gt; &lt;div class=&quot;col-sm-7&quot;&gt; &lt;label&gt; {{ $s-&gt;PO }}&lt;/label&gt; &lt;/div&gt; &lt;/div&gt; @endforeach </code></pre>
[ { "answer_id": 74258097, "author": "windowsill", "author_id": 5708566, "author_profile": "https://Stackoverflow.com/users/5708566", "pm_score": 3, "selected": true, "text": "const App = () => {\n const [books, setBooks] = useState(FAVORITE_BOOKS);\n\n const addBook = () => {\n const...
2022/10/31
[ "https://Stackoverflow.com/questions/74258118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15702465/" ]
74,258,133
<p>I am building a multiplayer game, qne I am trying to have the server send data about ONLY the players that are being displayed on a player's screen, to avoid unneeded player data being sent.</p> <p>Say I have an array like this</p> <pre><code>var players = [ { x: 100, y: 100, range: 50, id: 1}, { x: 150, y: 100, range: 100, id: 2}, { x: 250, y: 150, range: 50, id: 3}, .... ] </code></pre> <p>(Note: the data doesn't need to be in an array, it can be in any type of storage based on what would be efficient)</p> <p>To calculate if a player is in another player's range, I just need to check the distance between the 2 players, and if the distance is less than the range of the player, then the other player is in range with the first player.</p> <p>Code example:</p> <pre><code>const distance = (x1, y1, x2, y2) =&gt; Math.hypot(x2 - x1, y2 - y1); function isPlayerInRange(player,checkPlayer) { return distance(player.x, player.y, checkPlayer.x, checkPlayer.y) &lt; player.range } </code></pre> <p>Now my goal is to find what player's are in which players range. An example out would be like this:</p> <pre><code>[ {id: 1, inRange: [3,4]}, {id: 2, inRange: []}, {id: 3, inRange: [1]} ] </code></pre> <p>Where inRange is the list of id's of the player's that are in range.</p> <p>Each player has a different range because in my game, players can <em>grow</em> causing them to see more of the map.</p> <p>Now my initial solution was somewhat like this:</p> <pre><code>result = []; players.forEach((player)=&gt;{ result[player.id].push({ id: player.id, inRange: [] }) players.forEach((checkPlayer)=&gt;{ if(isPlayerInRange(player, checkPlayer)) result[result.length-1].inRange.push(checkPlayer.id) }); }); </code></pre> <p>Now while this solution does technically work, it is very inefficient, having a O(N^2) complexity.</p> <p>What does this mean? Well basically the more players there are, the exponentially complex this loop gets</p> <p>For example:</p> <p>2 players - 4 calculations<br> 3 players - 9 calculations<br> 4 players - 16 calculations<br> and so on... until<br> 100 players - 10,000 calculations</p> <p>For a game that should handle many hundred players in a single server, this is not a valid solution.</p> <p>Is it possible to do this operation with a O(N), O(2N) or even better O(log N) complexity, and if so, how would it be done in pseudocode?</p> <p>Thanks.</p>
[ { "answer_id": 74258451, "author": "Nick", "author_id": 9473764, "author_profile": "https://Stackoverflow.com/users/9473764", "pm_score": 1, "selected": false, "text": "O(N)" }, { "answer_id": 74258663, "author": "chrslg", "author_id": 20037042, "author_profile": "htt...
2022/10/31
[ "https://Stackoverflow.com/questions/74258133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15916361/" ]
74,258,160
<blockquote> <p><strong>Moderator Note</strong>: This appears to be a service outage. Stack Overflow <a href="https://meta.stackoverflow.com/a/255746">cannot provide support for this issue</a></p> </blockquote> <pre><code> &gt; Failed to list versions for com.google.http-client:google-http-client-android. &gt; Unable to load Maven meta-data from https://jcenter.bintray.com/com/google/http-client/google-http-client-android/maven-metadata.xml. &gt; Could not HEAD 'https://jcenter.bintray.com/com/google/http-client/google-http-client-android/maven-metadata.xml'. &gt; Read timed out </code></pre> <p>I was trying to build an Android app, but I got the above error. When I connect to “https://jcenter.bintray.com/com/google/http-client/google-http-client-android/maven-metadata.xml”, an nginx 403 error appears. Is JCenter down? What should I do?</p>
[ { "answer_id": 74258237, "author": "honam wong", "author_id": 14875052, "author_profile": "https://Stackoverflow.com/users/14875052", "pm_score": 3, "selected": false, "text": "jCenter" }, { "answer_id": 74258280, "author": "Madray Haven", "author_id": 18322863, "auth...
2022/10/31
[ "https://Stackoverflow.com/questions/74258160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10518324/" ]
74,258,198
<p>I am writing a module in C# which needs to retrieve the effective rights on a resource for a given Active Directory user account. I'm attempting to pinvoke the <a href="https://learn.microsoft.com/en-us/windows/win32/api/aclapi/nf-aclapi-geteffectiverightsfromaclw" rel="nofollow noreferrer">GetEffectiveRightsFromAcl</a> C function to do this. The function is returning an exception:</p> <p><code>System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.</code></p> <p>From my extremely limited knowledge of unmanaged programming, I'm lead to believe that maybe one of the pointers I'm passing into the function (or the TRUSTEE struct) isn't actually pointing to the place in memory that I think it does.</p> <p>Here's my code:</p> <pre class="lang-cs prettyprint-override"><code>class Program { const Int32 NO_MULTIPLE_TRUSTEE = 0; const Int32 TRUSTEE_IS_SID = 0; const Int32 TRUSTEE_IS_USER = 1; [DllImport(&quot;advapi32.dll&quot;, SetLastError = true)] static extern UInt32 GetEffectiveRightsFromAcl( IntPtr pAcl, ref TRUSTEE pTrustee, ref Int32 pAclRights); [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)] struct TRUSTEE { public IntPtr pMultipleTrustee; public Int32 MultipleTrusteeOperation; public Int32 TrusteeForm; public Int32 TrusteeType; [MarshalAs(UnmanagedType.LPStr)] public String ptstrName; } static void Main(string[] args) { var SID = new WindowsIdentity(&quot;company\user1&quot;).user ?? throw new ArgumentException(&quot;User does not exist&quot;); IntPtr fileACLHandle = getFileSecurityHandle(&quot;C:\temp\test.txt&quot;); //Confirmed working via the pinvoked GetNamedSecurityInfo C function var trustee = new TRUSTEE { pMultipleTrustee = IntPtr.Zero, MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE, TrusteeForm = TRUSTEE_IS_SID, TrusteeType = TRUSTEE_IS_USER, ptstrName = SID.Value }; Int32 pAclRights = 0; UInt32 result = GetEffectiveRightsFromAcl(fileACLHandle, ref trustee, ref pAclRights); if (result != 0) { Int32 hResult = Marshal.GetLastWin32Error(); var ex = new Win32Exception(hResult); Console.WriteLine(ex.ToString()); return; } Console.WriteLine($&quot;Rights: {pAclRights}&quot;); } } </code></pre> <p>Thanks in advance for any help!</p>
[ { "answer_id": 74258237, "author": "honam wong", "author_id": 14875052, "author_profile": "https://Stackoverflow.com/users/14875052", "pm_score": 3, "selected": false, "text": "jCenter" }, { "answer_id": 74258280, "author": "Madray Haven", "author_id": 18322863, "auth...
2022/10/31
[ "https://Stackoverflow.com/questions/74258198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4664256/" ]
74,258,230
<p>I am converting a map containing sub class values to a map of super class values using the below listed approach. Is there a better / recommended way to achieve the same?</p> <pre><code>class SuperClass{ private String name; // getters, setters and copyOf } class SubClass extends SuperClass { private String id; // getters and setters } Map&lt;String, SuperClass&gt; superClassMap = subclass .entrySet() .stream() .collect( Collectors.toMap(Entry::getKey, entry -&gt; SuperClass.copyOf(entry.getValue())) ); </code></pre> <p>EDIT:</p> <p>Below is the reverse operation that I am performing -</p> <pre><code>superClassMap .entrySet() .stream() .collect( Collectors.toMap( Entry::getKey, entry -&gt; SubClass .builder() .setName(entry.getValue().getName()) .setId(anotherMap.get(entry.getKey()).getId()) .build() ) ); </code></pre>
[ { "answer_id": 74258237, "author": "honam wong", "author_id": 14875052, "author_profile": "https://Stackoverflow.com/users/14875052", "pm_score": 3, "selected": false, "text": "jCenter" }, { "answer_id": 74258280, "author": "Madray Haven", "author_id": 18322863, "auth...
2022/10/31
[ "https://Stackoverflow.com/questions/74258230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1042646/" ]
74,258,238
<p>I am trying to perform a similar VLOOKUP as described in this <a href="https://youtu.be/VemzjFWBdM4" rel="nofollow noreferrer">tutorial</a> where I'm pulling info from multiple separate workbooks using google apps script to avoid a very cumbersome formula with multiple links. I've used the solution provided in this <a href="https://stackoverflow.com/questions/69818704/google-app-scripts-google-sheets-equivalent-of-vlookup-importrange-using-m">post</a>. I have a master sheet containing record IDs (column A) that will receive data from various workbooks when the record ID is found. In my master workbook there is also a sheet with the IDs of the various workbooks.</p> <p>I believe the issue with my code is within the ForEach block. Each vs range is treated separately. So the first range executes and pastes into the master, then the second executes and pastes into the master BUT replaces what was put there from the first range, and so forth. Can I concat all the ranges into one array to prevent loss of information from the previous execution? Is that the solution here?</p> <p>`</p> <pre><code>function updateMaster() { const mss = SpreadsheetApp.getActiveSpreadsheet(); const msh = mss.getSheetByName('Data'); const mDB = msh.getRange(&quot;A2:A&quot; + msh.getLastRow()).getValues(); //Gets ID's from Master Spreadsheet const ish = mss.getSheetByName('Sheet IDs'); const ivs = ish.getRange('A1:A' + ish.getLastRow()).getValues().flat(); ivs.forEach((id,i) =&gt; { let ss = SpreadsheetApp.openById(id); let sh = ss.getSheetByName('Sep 22'); let vs = sh.getRange(&quot;A2:L&quot; + sh.getLastRow()).getValues(); //Get's ID's from individual sheets Logger.log(vs) // Create an object for searching the values of column &quot;A&quot;. const obj = vs.reduce((o, [a,,,,,,,,,, ...kl]) =&gt; ((o[a] = kl), o), {}); // Create an array for putting to the Spreadsheet. const values = mDB.map(([g]) =&gt; obj[g] || [&quot;&quot;, &quot;&quot;]); // Put the array to the Spreadsheet. msh.getRange(2, 7, values.length, 2).setValues(values); }); } </code></pre> <p>`</p>
[ { "answer_id": 74258493, "author": "pgSystemTester", "author_id": 11732320, "author_profile": "https://Stackoverflow.com/users/11732320", "pm_score": 0, "selected": false, "text": "Select * where Col1 is not null order by Col1" }, { "answer_id": 74260242, "author": "Jamie", ...
2022/10/31
[ "https://Stackoverflow.com/questions/74258238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20123838/" ]
74,258,242
<p>I'm trying to find the starting coordinates of a small 2D array (b) in a large numpy 2D array (a), I've written this method but it's too complicated and slow, does anyone have a better idea?</p> <pre><code>a=[[5 4 5 9 3 4 6 2 5 3] [8 3 5 4 3 4 5 8 4 4] [5 7 8 5 2 3 3 6 8 8] [4 5 6 2 6 5 6 7 9 3] [3 6 8 2 8 7 3 8 8 8]] b=[[2 3 3] [6 5 6]] </code></pre> <pre><code>def screen_match(img1,img2): match_1=list(img1.T[1]) img_len=len(match_1) # img2=img2.tolist() is_match=False position=[] for i in range(img2.shape[1]): img2_col=img2[:, i].tolist() for j in range(len(img2_col)): img2_cut=img2_col[j:j+img_len] if match_1== img2_cut: inner_col=i+1 for m in range(2,img1.shape[1]): inner_img1 = list(img1.T[m]) for n in range(i+1,img2.shape[1]): inner_img2_col = img2[:, inner_col].tolist() inner_img2_cut = inner_img2_col[j:j + img_len] if inner_img1==inner_img2_cut: is_match=True break else: is_match=False break inner_col += 1 if not is_match:break if is_match: position=[i,j] break if is_match:break if is_match: print(position) break return position </code></pre>
[ { "answer_id": 74258493, "author": "pgSystemTester", "author_id": 11732320, "author_profile": "https://Stackoverflow.com/users/11732320", "pm_score": 0, "selected": false, "text": "Select * where Col1 is not null order by Col1" }, { "answer_id": 74260242, "author": "Jamie", ...
2022/10/31
[ "https://Stackoverflow.com/questions/74258242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20200974/" ]
74,258,249
<p>I coded some javascript to play an interval within an mp3 file, which works fine in plain html/javascript</p> <pre><code>&lt;audio id=&quot;myAudio&quot; preload=&quot;auto&quot; src=&quot;http://filename.mp3&quot; type=&quot;audio/mpeg&quot; /&gt; </code></pre> <p><a href="https://jsfiddle.net/vz03m41p/4/" rel="nofollow noreferrer">https://jsfiddle.net/vz03m41p/4/</a></p> <p>But when I copy it into React, I get a javascript error.</p> <pre><code>&lt;audio ref=&quot;myAudio&quot; preload=&quot;auto&quot; src=&quot;http://filename&quot; type=&quot;audio/mpeg&quot; /&gt; </code></pre> <p><a href="https://codesandbox.io/s/infallible-turing-d29sp5?file=/src/App.js" rel="nofollow noreferrer">https://codesandbox.io/s/infallible-turing-d29sp5?file=/src/App.js</a></p> <p>Anybody have any idea what I'm doing wrong in the React version?</p>
[ { "answer_id": 74258308, "author": "Sebastian Gudiño", "author_id": 12641617, "author_profile": "https://Stackoverflow.com/users/12641617", "pm_score": 2, "selected": false, "text": "document.getElementById" }, { "answer_id": 74258361, "author": "Jigen", "author_id": 1821...
2022/10/31
[ "https://Stackoverflow.com/questions/74258249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18693139/" ]
74,258,271
<p>I want to add a text portion under the title section where I can write but when I try to amend the function it keeps adding the text to the title section which I do not want it to do. Is there a solution?</p> <p>As previously mentioned, I tried to add text below the title section (so I can write things on the webpage). However, when I try to introduce new text, it adds text within the image title, not the</p> <p>Website Page:</p> <pre><code>import React from 'react'; import '../../App.css'; function AboutMe() { return ( &lt;div className='aboutme'&gt; &lt;h1&gt;About Me&lt;/h1&gt; &lt;div className='aboutmetext'&gt; Text &lt;/div&gt; &lt;/div&gt; ); } export default AboutMe; </code></pre> <p>CSS:</p> <pre><code>* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'PT Sans', sans-serif; } .home, .articles, .aboutme, .sign-up { display: flex; height: 90vh; align-items: center; justify-content: center; font-size: 3rem; } .articles { background-image: url('/images/IMG_nappy_936094.jpg'); background-position: center; background-size: cover; background-repeat: no-repeat; color: #fff; font-size: 100px; } .aboutmetext{ color: black; font-family: 'Courier New', Courier, monospace; justify-content: bottom; background-color: white; background-position: bottom; padding: 4rem; } .aboutme { background-image: url('/images/img-7.jpg'); background-position: center; background-size: cover; color: #fff; font-size: 100px; } .sign-up { background-image: url('/images/img-home.jpg'); background-position: center; background-size: cover; background-repeat: no-repeat; color: #fff; font-size: 100px; } </code></pre>
[ { "answer_id": 74258308, "author": "Sebastian Gudiño", "author_id": 12641617, "author_profile": "https://Stackoverflow.com/users/12641617", "pm_score": 2, "selected": false, "text": "document.getElementById" }, { "answer_id": 74258361, "author": "Jigen", "author_id": 1821...
2022/10/31
[ "https://Stackoverflow.com/questions/74258271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19731420/" ]
74,258,272
<p>I have associative array.Operation of the below code is that it will sum all the array index's value which key is similar, but i did not understand how it operated.</p> <pre><code>function add_array_vals($arr) { $sums = []; foreach ( $arr as $key =&gt; $val ) { $key = strtoupper($key); if ( !isset($sums[$key]) ) { $sums[$key] = 0; } $sums[$key] = ( $sums[$key] + $val ); } return $sums; } $array = ['KEY' =&gt; 5, 'TEST' =&gt; 3, 'Test' =&gt; 10, 'Key'=&gt; 2]; $sums = add_array_vals($array); var_dump($sums); //Outputs // KEY =&gt; int(7) // TEST =&gt; int(13) </code></pre> <p>i have problem in two portion of above code one is:</p> <blockquote> <p>if ( !isset($sums[$key]) ) { $sums[$key] = 0; }</p> </blockquote> <p>another is:</p> <blockquote> <p>$sums[$key] = ( $sums[$key] + $val );</p> </blockquote> <p>In this portion,how it identify the same key of array to sum them because keys position is random.</p> <p>It will be really helpful if anyone clarify it.</p>
[ { "answer_id": 74258453, "author": "Emily Cs", "author_id": 20375779, "author_profile": "https://Stackoverflow.com/users/20375779", "pm_score": -1, "selected": false, "text": "if ( !isset($sums[$key]) ) { $sums[$key] = 0; }\n" }, { "answer_id": 74258577, "author": "symlink", ...
2022/10/31
[ "https://Stackoverflow.com/questions/74258272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11772876/" ]
74,258,276
<p>i want receive the array data in Android</p> <p><a href="https://i.stack.imgur.com/VYL5M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VYL5M.png" alt="```" /></a></p> <pre><code>profileAPI.getBadge().enqueue(new Callback&lt;SingleResult&gt;() { @Override public void onResponse(Call&lt;SingleResult&gt; call, Response&lt;SingleResult&gt; response) { if(response.isSuccessful() &amp;&amp; response.body() != null) { SingleResult data = response.body(); //here } } } </code></pre> <p>I need data from badges 1 to 6. Values in one boolean object</p>
[ { "answer_id": 74258453, "author": "Emily Cs", "author_id": 20375779, "author_profile": "https://Stackoverflow.com/users/20375779", "pm_score": -1, "selected": false, "text": "if ( !isset($sums[$key]) ) { $sums[$key] = 0; }\n" }, { "answer_id": 74258577, "author": "symlink", ...
2022/10/31
[ "https://Stackoverflow.com/questions/74258276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19623086/" ]
74,258,301
<p>I am new with MAUI and I cannot find any solution in the web, I want just delete any control or component. A component can be a listView, button, or anything.</p> <p>For example I the following code:</p> <pre><code>&lt;ContentPage xmlns=&quot;http://schemas.microsoft.com/dotnet/2021/maui&quot; xmlns:x=&quot;http://schemas.microsoft.com/winfx/2009/xaml&quot; x:Class=&quot;MauiApp2.Prueba&quot; Title=&quot;Prueba&quot;&gt; &lt;StackLayout VerticalOptions=&quot;Center&quot;&gt; &lt;ListView x:Name=&quot;FruitListView&quot;&gt; &lt;ListView.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;TextCell Text=&quot;{Binding FruitName}&quot; /&gt; &lt;/DataTemplate&gt; &lt;/ListView.ItemTemplate&gt; &lt;/ListView&gt; &lt;Button x:Name=&quot;btnDelete&quot; Text=&quot;Random Color&quot; HorizontalOptions=&quot;Center&quot; VerticalOptions=&quot;Center&quot; Clicked=&quot;btnDelete_Clicked&quot; /&gt; &lt;/StackLayout&gt; </code></pre> <p>How can I delete the entire <code>&lt;ListView&gt;</code> when I click the button <code>btnDelete</code>?</p> <p>I have this:</p> <pre><code> private void btnDelete_Clicked(object sender, EventArgs e) { FruitListView. ; } </code></pre> <p>I cant find any reference to delete this <code>ListView</code> component, is it possible through backend code?</p>
[ { "answer_id": 74258387, "author": "Taunting French Guard", "author_id": 4626833, "author_profile": "https://Stackoverflow.com/users/4626833", "pm_score": 1, "selected": false, "text": "ListView" }, { "answer_id": 74258504, "author": "Jason", "author_id": 1338, "autho...
2022/10/31
[ "https://Stackoverflow.com/questions/74258301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6091709/" ]
74,258,332
<p>I'm trying to make some logic that tells me if the actual Unity game just loaded, or if just SceneManager just loaded scene 0. Is there a way to check this? Thank you!</p>
[ { "answer_id": 74259530, "author": "derHugo", "author_id": 7111561, "author_profile": "https://Stackoverflow.com/users/7111561", "pm_score": 2, "selected": false, "text": "static" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74258332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14193957/" ]
74,258,368
<p>In my project, I used pandas and pymysql to read the database. The default setting is that pymysql will automatically disconnect after 8 hours if you do not perform any operation after creating a link.</p> <p>I used close () to close the link, but the database shows that the link exists and has not been operated for more than 80000 seconds</p> <p>python 3.10.5</p> <p>I tried to close it with close(), but it didn't seem to work</p>
[ { "answer_id": 74259530, "author": "derHugo", "author_id": 7111561, "author_profile": "https://Stackoverflow.com/users/7111561", "pm_score": 2, "selected": false, "text": "static" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74258368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20375700/" ]
74,258,401
<p>I am trying to run a simple glm model like this.</p> <pre><code> library(dplyr) library(purrr) library(tidyr) library(broom) data(&quot;mtcars&quot;) head(mtcars) mtcars$Name &lt;- row.names(mtcars) row.names(mtcars) &lt;- NULL glm(mpg ~ wt, data=mtcars) </code></pre> <p>No issues so far.</p> <p>Next I am trying to run this model on every subgroup of <code>gear</code> i.e <code>gear=3, gear=4, gear=5</code> so I am running my glm model within a dlply function like this.</p> <pre><code> Model1 &lt;- plyr::dlply(mtcars, &quot;gear&quot;, function(x) tryCatch( glm(mpg ~ wt, data =x ), error = function(e) NA), .drop = TRUE) SummaryCars &lt;- map2_df(Model1, names(Model1), ~broom::tidy(.x, confint = TRUE)[2,] %&gt;% mutate(gear = .y)) </code></pre> <p>Now I have a third subgroup <code>carb</code>. This variable has 6 levels</p> <pre><code>table(mtcars$carb) 1 2 3 4 6 8 7 10 3 10 1 1 </code></pre> <p>Exclude carb levels 6 and 8. I like to run my model on <code>carb</code> levels 1,2,3,&amp;4. For each level of <code>gear</code>. But I like to exclude one level of carb during each iteration.</p> <p><strong>Model1</strong> - Carb Level 1,2,3 (<em><strong>Exclude data from carb= 4</strong></em>)</p> <pre><code> ``` Model1 &lt;- plyr::dlply(mtcars, &quot;gear&quot;, function(x) tryCatch( glm(mpg ~ wt, data =x ), error = function(e) NA), .drop = TRUE) SummaryCars &lt;- map2_df(Model1, names(Model1), ~broom::tidy(.x, confint = TRUE)[2,] %&gt;% mutate(gear = .y)) ``` </code></pre> <p>**Model2 ** - Carb Level 1,2,4 (<em><strong>Exclude data from carb= 3</strong></em>)</p> <pre><code> ``` Model1 &lt;- plyr::dlply(mtcars, &quot;gear&quot;, function(x) tryCatch( glm(mpg ~ wt, data =x ), error = function(e) NA), .drop = TRUE) SummaryCars &lt;- map2_df(Model1, names(Model1), ~broom::tidy(.x, confint = TRUE)[2,] %&gt;% mutate(gear = .y)) ``` </code></pre> <p>**Model3 ** - Carb Level 1,3,4 (<em><strong>Exclude data from carb= 2</strong></em>)</p> <pre><code> ``` Model1 &lt;- plyr::dlply(mtcars, &quot;gear&quot;, function(x) tryCatch( glm(mpg ~ wt, data =x ), error = function(e) NA), .drop = TRUE) SummaryCars &lt;- map2_df(Model1, names(Model1), ~broom::tidy(.x, confint = TRUE)[2,] %&gt;% mutate(gear = .y)) ``` </code></pre> <p>**Mode4l ** - Carb Level 2,3,4 (<em><strong>Exclude data from carb= 1</strong></em>)</p> <pre><code> ``` Model1 &lt;- plyr::dlply(mtcars, &quot;gear&quot;, function(x) tryCatch( glm(mpg ~ wt, data =x ), error = function(e) NA), .drop = TRUE) SummaryCars &lt;- map2_df(Model1, names(Model1), ~broom::tidy(.x, confint = TRUE)[2,] %&gt;% mutate(gear = .y)) ``` </code></pre> <p>As you can see I can run the model within each levels of Gear (3,4,5) but I am not sure how to add another loop on top of this where data from one level is exclude and rest are considered.</p> <p>Expected Final Results</p> <pre><code> Model SubModel Estimate Lower(CI) Upper(CI) stdError p Exclude carb= 4 Gear = 3 xxx xxxx xxxx xxx x Exclude carb= 4 Gear = 4 xxx xxxx xxxx xxx x Exclude carb= 4 Gear = 5 xxx xxxx xxxx xxx x Exclude carb= 3 Gear = 3 xxx xxxx xxxx xxx x Exclude carb= 3 Gear = 4 xxx xxxx xxxx xxx x Exclude carb= 3 Gear = 5 xxx xxxx xxxx xxx x Exclude carb= 2 Gear = 3 xxx xxxx xxxx xxx x Exclude carb= 2 Gear = 4 xxx xxxx xxxx xxx x Exclude carb= 2 Gear = 5 xxx xxxx xxxx xxx x Exclude carb= 1 Gear = 3 xxx xxxx xxxx xxx x Exclude carb= 1 Gear = 4 xxx xxxx xxxx xxx x Exclude carb= 1 Gear = 5 xxx xxxx xxxx xxx x </code></pre> <p>Any help is much appreciated. Thanks in advance.</p> <p>I have included the code in my question showing what I have tried.</p>
[ { "answer_id": 74259530, "author": "derHugo", "author_id": 7111561, "author_profile": "https://Stackoverflow.com/users/7111561", "pm_score": 2, "selected": false, "text": "static" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74258401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20375698/" ]
74,258,442
<p>Using the FormatStyle APIs, is there a way to format large numbers with trailing SI units like &quot;20M&quot; or &quot;10k&quot;? In particular I'm looking for a way to format large currency values like &quot;$20M&quot; with proper localization and currency symbols.</p> <p>I currently have a currency formatter:</p> <pre><code>extension FormatStyle where Self == FloatingPointFormatStyle&lt;Double&gt;.Currency { public static var dollars: FloatingPointFormatStyle&lt;Double&gt;.Currency { .currency(code: &quot;usd&quot;).precision(.significantDigits(2)) } } </code></pre> <p>I'd like to extend this to format <code>Double(20_000_000)</code> as &quot;$20M&quot;.</p>
[ { "answer_id": 74263172, "author": "lorem ipsum", "author_id": 12738750, "author_profile": "https://Stackoverflow.com/users/12738750", "pm_score": 2, "selected": true, "text": "struct" }, { "answer_id": 74264350, "author": "Joakim Danielson", "author_id": 9223839, "au...
2022/10/31
[ "https://Stackoverflow.com/questions/74258442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/97337/" ]
74,258,457
<p>I have a Windows Form in Visual Studio that is connected to a MS Access Database. The application is supposed to allow the user to type a report into a text box and save that data along with a time stamp as a record in the database. Everything seems to be working on the application end but the data isn't being saved or isn't showing up in the database.</p> <pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.OleDb; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Xml.Linq; namespace CapstoneProjectDataEntryApp { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void SubmitBtn_Click(object sender, EventArgs e) { OleDbConnection conn = new OleDbConnection(); conn.ConnectionString = @&quot;Provider=Microsoft.ACE.OLEDB.12.0;Data Source= C:\Users\Austin\Documents\School\CapstoneProjectDataEntryApp\ShabelReports.accdb&quot;; try { conn.Open(); string myEntry = EntryTB.Text; string myDateTime = DateTime.Now.ToString(); string myQuery = &quot;INSERT INTO ProgressReports (Report, DateTime) VALUES ('&quot; + myEntry + &quot;','&quot; + myDateTime + &quot;')&quot;; OleDbCommand cmd = new OleDbCommand(myQuery, conn); cmd.ExecuteNonQueryAsync(); MessageBox.Show(&quot;Data saved successfully!&quot;); } catch(Exception ex) { MessageBox.Show(&quot;Failed due to&quot; + ex.Message); } finally { conn.Close(); EntryTB.Text = &quot;&quot;; } } } } </code></pre> <p>I have tried just using the database as a data source, and just as a data connection, and both, and all have the same result. I'm new to what I'm doing so I don't know much about working with databases in Windows Forms</p>
[ { "answer_id": 74263172, "author": "lorem ipsum", "author_id": 12738750, "author_profile": "https://Stackoverflow.com/users/12738750", "pm_score": 2, "selected": true, "text": "struct" }, { "answer_id": 74264350, "author": "Joakim Danielson", "author_id": 9223839, "au...
2022/10/31
[ "https://Stackoverflow.com/questions/74258457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20375774/" ]
74,258,526
<p>I need Google Apps Script to perform the following:</p> <ol> <li>Clone a Google Sheets file</li> <li>In the cloned file, update the value of cell A1 to the current date and time (as value, not formula)</li> <li>Rename the cloned file as the current date in format &quot;YYYY-MM-DD&quot;</li> </ol> <p>I am struggling to get past section 2 after many hours to reading &amp; testing - Please help (and let me know where I'm going wrong!)</p> <pre><code>function cloneGoogleSheet() { //1. clone file const destFolder = DriveApp.getFolderById(&quot;107TOUuO6fABxYohvueivNGeZqJMNkfgX&quot;); //set destination folder in drive DriveApp.getFileById(&quot;16S3INZFMQDY3yguNZ2QHvzMQXI1Kf97DkSvcYyZeiHM&quot;).makeCopy(&quot;New File&quot;, destFolder); // clone source file into destination folder with name &quot;New File&quot; //2. set cell A1 on tab 1 to current date &amp; time var sheet = SpreadsheetApp.open(&quot;New File&quot;).getSheets()[0] //open &quot;New File&quot; var range = sheet.getRange(&quot;A1&quot;); // &quot;set range in new file&quot; range.setValue(now); // set the value in cell A1 to be current date &amp; time (as text, not formula) //3. rename file so it files in year-month-date order var formattedDateForFileName = Utilities.formatDate(now(),&quot;GMT+10&quot;,&quot;yyyy-mm-dd&quot;) //format date into YYYY-MM-DD (for filename) sheet.setName(&quot;Dashboard Archive - &quot;&amp; formattedDateForFileName) //rename file } </code></pre>
[ { "answer_id": 74263172, "author": "lorem ipsum", "author_id": 12738750, "author_profile": "https://Stackoverflow.com/users/12738750", "pm_score": 2, "selected": true, "text": "struct" }, { "answer_id": 74264350, "author": "Joakim Danielson", "author_id": 9223839, "au...
2022/10/31
[ "https://Stackoverflow.com/questions/74258526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20180210/" ]
74,258,581
<p>I have a dropdown whose menu items I am populating via a list (not hardcoded). I want a divider after the first item in that list. All the documentation on dividers I can find <em>only</em> deals with dividers in hardcoded lists. How do I do this?</p> <pre><code>&lt;Dropdown&gt; &lt;Dropdown.Toggle size='sm' variant='outline-primary'&gt;{selectedView}&lt;/Dropdown.Toggle&gt; &lt;Dropdown.Menu&gt; { viewList.filter( v =&gt; v !== selectedView ).map(view =&gt; { return ( &lt;Dropdown.Item value={view} key={view} &gt;{view}&lt;/Dropdown.Item&gt; // if the view = &quot;Create New&quot;, add divider after it ); }) } &lt;/Dropdown.Menu&gt; &lt;/Dropdown&gt; </code></pre> <p>I can't seem to do anything other than html / jsx elements in the map function, and I don't think there's any &quot;hidden&quot; attribute on a Dropdown.Divider.</p>
[ { "answer_id": 74263172, "author": "lorem ipsum", "author_id": 12738750, "author_profile": "https://Stackoverflow.com/users/12738750", "pm_score": 2, "selected": true, "text": "struct" }, { "answer_id": 74264350, "author": "Joakim Danielson", "author_id": 9223839, "au...
2022/10/31
[ "https://Stackoverflow.com/questions/74258581", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2117622/" ]
74,258,613
<p>I want to be able to &quot;make&quot; browser display errors, like forbidden, 503 etc...</p> <p>Is there some kind of sandbox where I could do this?</p> <p>I need the errors to be rendered in google chrome, then take a screen capture of browser window.</p> <p>Something like image under it, but force the browser to display something like this, maybe in Chrome dev tools could be done?</p> <p><a href="https://i.stack.imgur.com/B1SqL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B1SqL.jpg" alt="enter image description here" /></a></p>
[ { "answer_id": 74263172, "author": "lorem ipsum", "author_id": 12738750, "author_profile": "https://Stackoverflow.com/users/12738750", "pm_score": 2, "selected": true, "text": "struct" }, { "answer_id": 74264350, "author": "Joakim Danielson", "author_id": 9223839, "au...
2022/10/31
[ "https://Stackoverflow.com/questions/74258613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5771893/" ]
74,258,680
<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>.ent__food__image { display: flex; justify-content: end; } .bev__food__image { display: flex; justify-content: end; } .kids__food__image { display: flex; justify-content: end; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;main class="flex-container"&gt; &lt;!-- Entrees --&gt; &lt;div class="ent ent--container"&gt; &lt;div class="ent__food__image"&gt; &lt;img src="/food images/nutburger.jpeg" alt="nutburger" /&gt; &lt;/div&gt; &lt;h3&gt;Entrees&lt;/h3&gt; &lt;div class="ent__item__1"&gt; &lt;h4&gt;Millet Burger&lt;/h4&gt; &lt;p&gt; Millet patty served on whole wheat bun, with sauce, onions, pickles, tomatoes, romaine and sprouts. &lt;span&gt;7.59&lt;/span&gt; &lt;/p&gt; &lt;/div&gt; &lt;div class="ent__item__2"&gt; &lt;h4&gt;Nutburger&lt;/h4&gt; &lt;p&gt; Nutmeat patty served on a whole wheat bun with sauce, onions, pickles, tomatoes, romaine, and sprouts. &lt;span&gt;7.59&lt;/span&gt; &lt;/p&gt; &lt;/div&gt; &lt;div class="ent__item__3"&gt; &lt;h4&gt;Vegan Burrito&lt;/h4&gt; &lt;p&gt; Whole wheat tortilla with basmati rice, black or pinto beans, onions, tomatoes, hot sauce, sour cream, romaine and sprouts. &lt;span&gt;6.99&lt;/span&gt; &lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Beverages --&gt; &lt;div class="bev bev--container"&gt; &lt;div class="bev__food__image"&gt; &lt;img src="/food images/strawberry-smoothie.jpg" alt="Strawberry Smoothie" /&gt; &lt;/div&gt; &lt;h3&gt;Beverages&lt;/h3&gt; &lt;div class="bev__item__1"&gt; &lt;h4&gt;Lemonade&lt;/h4&gt; &lt;p&gt;Small - 3.49 Large - 3.79&lt;/p&gt; &lt;/div&gt; &lt;div class="bev__item__2"&gt; &lt;h4&gt;Pinapple&lt;/h4&gt; &lt;p&gt;Small - 3.49 Large - 3.79&lt;/p&gt; &lt;/div&gt; &lt;div class="bev__item__3"&gt; &lt;h4&gt;Strawberry Smoothie&lt;/h4&gt; &lt;p&gt;Small - 4.89 Large - 6.99&lt;/p&gt; &lt;/div&gt; &lt;div class="bev__item__4"&gt; &lt;h4&gt;Coffee&lt;/h4&gt; &lt;p&gt;1.79&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Kids Menu --&gt; &lt;div class="kids kids--container"&gt; &lt;div class="kids__food__image"&gt; &lt;img src="/food images/grilled-cheese.jpg" alt="Grilled Cheese" /&gt; &lt;/div&gt; &lt;h3&gt; Kids Menu &lt;span class="kids__description"&gt;Includes mini cookie and juice box&lt;/span &gt; &lt;/h3&gt; &lt;div class="kids__item__1"&gt; &lt;h4&gt;Grilled Cheese&lt;/h4&gt; &lt;p&gt;5.29&lt;/p&gt; &lt;/div&gt; &lt;div class="kids__item__2"&gt; &lt;h4&gt;Quesadilla&lt;/h4&gt; &lt;p&gt;5.29&lt;/p&gt; &lt;/div&gt; &lt;div class="kids__item__3"&gt; &lt;h4&gt;PGJ&lt;/h4&gt; &lt;p&gt;5.29&lt;/p&gt; &lt;/div&gt; &lt;div class="kids__item__4"&gt; &lt;h4&gt;Shake (Choco, van, straw)&lt;/h4&gt; &lt;p&gt;4.10&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/main&gt;</code></pre> </div> </div> </p> <p>Hello, I am learning flexbox and I'm kind of confused on how it all works. How can I turn what I have how now into the image below? I want the text and the images to be side by side like the image below. Or should I use grid to solve this issue? I'm also not sure if my HTML even would allow for this to be possible.</p> <p><a href="https://i.stack.imgur.com/XjFtY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XjFtY.png" alt="Flex-box drawing" /></a></p>
[ { "answer_id": 74263172, "author": "lorem ipsum", "author_id": 12738750, "author_profile": "https://Stackoverflow.com/users/12738750", "pm_score": 2, "selected": true, "text": "struct" }, { "answer_id": 74264350, "author": "Joakim Danielson", "author_id": 9223839, "au...
2022/10/31
[ "https://Stackoverflow.com/questions/74258680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19619367/" ]
74,258,729
<p>My project was working fine till tomorrow now I'm getting this error in my all projects which have <code>facebookLogin</code>.</p> <ul> <li><strong>pubspac.yaml</strong></li> </ul> <pre><code>flutter_login_facebook: ^1.6.0 </code></pre> <ul> <li><p><strong>compileSdkVersion</strong></p> <pre><code> compileSdkVersion 33 </code></pre> </li> <li><p><strong>minSdkVersion</strong></p> <pre><code> minSdkVersion 20 </code></pre> </li> <li><p><strong>repositories</strong></p> <pre><code> repositories { google() mavenCentral() } </code></pre> </li> <li><p><strong>dependencies</strong></p> <pre><code>dependencies { implementation &quot;org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version&quot; implementation platform('com.google.firebase:firebase-bom:29.2.1') implementation 'com.google.firebase:firebase-analytics-ktx' implementation 'com.facebook.android:facebook-login:latest.release' } </code></pre> </li> </ul> <p>I'm facing the below error.</p> <pre><code>* What went wrong: Execution failed for task ':app:checkDebugAarMetadata'. &gt; Could not resolve all files for configuration ':app:debugRuntimeClasspath'. &gt; Could not resolve com.facebook.android:facebook-login:latest.release. Required by: project :app &gt; Failed to list versions for com.facebook.android:facebook-login. &gt; Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/android/facebook-login/maven-metadata.xml. &gt; Could not HEAD 'https://jcenter.bintray.com/com/facebook/android/facebook-login/maven-metadata.xml'. &gt; Read timed out </code></pre>
[ { "answer_id": 74263447, "author": "Fredrik_Borgstrom", "author_id": 3596943, "author_profile": "https://Stackoverflow.com/users/3596943", "pm_score": 3, "selected": true, "text": "implementation 'com.facebook.android:facebook-login:latest.release'\n" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74258729", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19440771/" ]
74,258,738
<p>I am trying to compile my app in flutter, but when I do it, I get the following error in the console. I tried running <code>flutter clean</code> and then <code>flutter pub get</code> but it doesn't seem to work</p> <p><code> </code>Warning: elemento inesperado (URI:&quot;&quot;, local:&quot;base-extension&quot;). Los elementos esperados son &lt;{}codename&gt;,&lt;{}layoutlib&gt;,&lt;{}api-level&gt; /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/src/firebase_app.dart:18:25: Error: Member not found: 'FirebaseAppPlatform.verifyExtends'. FirebaseAppPlatform.verifyExtends(_delegate); ^^^^^^^^^^^^^</p> <p><code>FAILURE: Build failed with an exception.</code></p> <ul> <li><p>Where: Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159</p> </li> <li><p>What went wrong: Execution failed for task ':app:compileFlutterBuildRelease'.</p> </li> </ul> <blockquote> <p>Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1</p> </blockquote> <ul> <li><p>Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.</p> </li> <li><p>Get more help at <a href="https://help.gradle.org" rel="nofollow noreferrer">https://help.gradle.org</a></p> </li> </ul> <p>BUILD FAILED in 4m 16s Running Gradle task 'assembleRelease'... 262.0s Gradle task assembleRelease failed with exit code 1 `` <a href="https://i.stack.imgur.com/5tSzS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5tSzS.png" alt="console error" /></a></p> <p>I tried running flutter clean and then flutter pub get but it doesn't seem to work</p>
[ { "answer_id": 74269845, "author": "Mohamed dayaa zellagui", "author_id": 20383305, "author_profile": "https://Stackoverflow.com/users/20383305", "pm_score": 1, "selected": false, "text": "pubspec.yaml" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74258738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19261545/" ]
74,258,744
<p>I wanted to know if theres a way to override a method within the same class in scala.</p> <pre><code>class xyz { def a() : Unit = { var hello = &quot;Hello&quot; } def b() : Unit = { //method to override the functionality of b, for example lets say I want it to just print &quot;Hi, how is your day going&quot; until its somehow reset and after its resett it should go back to doing var hello = &quot;Hello&quot; } } def c() : Unit = { //reset a to do what it was doing earlier (var hello = &quot;Hello&quot;) } </code></pre> <p>Basically I want to compute <code>var hello = &quot;Hello&quot;</code> whenever <code>a()</code> is called until <code>b()</code> is called and then <code>a()</code> should print <code>&quot;Hi, how is your day going&quot;</code> until its reset when <code>c()</code> is called and then it should go back to performing <code>var hello = &quot;Hello&quot;</code>. Is there a way to use this, if not is there another way? I don't want to use conditionals. Thanks in advance.</p>
[ { "answer_id": 74269845, "author": "Mohamed dayaa zellagui", "author_id": 20383305, "author_profile": "https://Stackoverflow.com/users/20383305", "pm_score": 1, "selected": false, "text": "pubspec.yaml" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74258744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12045272/" ]
74,258,746
<p>I already have a method to pass data. It can only pass one argument, but I want it to pass at least two arguments. How can I do that?</p> <p>screen1</p> <pre><code>GestureDetector( onTap: () =&gt; Navigator.of(context).push(PageTransition(settings: RouteSettings( arguments:imageUrl,),type: PageTransitionType.fade, child: const ShowPictureScreen())), </code></pre> <p>Receive on Screen2</p> <pre><code>@override Widget build(BuildContext context) { final data = ModalRoute.of(context)!.settings; late String photoUrl; if (data.arguments == null) { photoUrl = &quot;empty&quot;; } else { photoUrl = data.arguments as String; } ... Text('photoUrl') </code></pre>
[ { "answer_id": 74258799, "author": "Udit", "author_id": 20272019, "author_profile": "https://Stackoverflow.com/users/20272019", "pm_score": 1, "selected": false, "text": "// screen1.dart\n..\nExpanded(\n child: RaisedButton(\n onPressed: () {\n Navigator.push(context,\n M...
2022/10/31
[ "https://Stackoverflow.com/questions/74258746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17636769/" ]
74,258,747
<p>I want to use FutureBuilder, but make it build after waiting for 2 async functions to end.</p> <p>In the Flutter docs, it says <code>Widget that builds itself based on the latest snapshot of interaction with a Future.</code> So it builds after one function, not waiting for the other.</p> <pre class="lang-dart prettyprint-override"><code>Future&lt;int&gt; futureInit() async { await functionA(); await functionB(); return 0; } </code></pre> <p>My code is like this, so the future builder builds after just function A.</p> <p>How can I make it wait for the both functions to end and then start building?</p>
[ { "answer_id": 74258836, "author": "harizh", "author_id": 16240306, "author_profile": "https://Stackoverflow.com/users/16240306", "pm_score": 0, "selected": false, "text": "Future<int> futureInit() async {\n await functionA().then((func) async {\n await functionB();\n });\n ...
2022/10/31
[ "https://Stackoverflow.com/questions/74258747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16857708/" ]
74,258,749
<p>I have this SQL query:</p> <pre><code>SELECT users.id, users.name, users.avatar, MAX(messages.created_at) max_created_at, MAX(messages.body) FILTER (WHERE messages.created_at = MAX(messages.created_at)) last_message, CASE WHEN(COUNT(messages.is_read) FILTER (WHERE is_read = false AND messages.from_id != 14) = 0) THEN true ELSE false END is_read, COUNT(messages.is_read) FILTER (WHERE is_read = false AND messages.from_id != 14) count_unread FROM messages INNER JOIN users ON messages.from_id = users.id OR messages.to_id = users.id WHERE (messages.from_id = 14 OR messages.to_id = 14) AND users.id != 14 GROUP BY users.id; </code></pre> <p>But, this query is showing an error</p> <blockquote> <p>Aggregate functions are not allowed in FILTER</p> </blockquote> <p>When I change</p> <pre><code>MAX(messages.body) FILTER (WHERE messages.created_at = MAX(messages.created_at)) last_message </code></pre> <p>to</p> <pre><code>MAX(messages.body) FILTER (HAVING messages.created_at = MAX(messages.created_at)) last_message </code></pre> <p>the query is now showing this error</p> <blockquote> <p>Syntax error at or near &quot;HAVING&quot;</p> </blockquote> <p>How to fix this?</p>
[ { "answer_id": 74259235, "author": "nikhil sugandh", "author_id": 6285600, "author_profile": "https://Stackoverflow.com/users/6285600", "pm_score": 0, "selected": false, "text": "select a.* from(\nSELECT\n users.id,\n users.name,\n users.avatar,\n MAX(messages.created_at) max...
2022/10/31
[ "https://Stackoverflow.com/questions/74258749", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16848125/" ]
74,258,764
<p>I'm currently working on FCC laravel 5.8 tutorial However, i'm trying to build it on laravel 8.</p> <p>Cant seem to find a way to make the route post work</p> <pre class="lang-php prettyprint-override"><code>Route::post('/p', [App\Http\Controllers\PostsController::class, 'store']); </code></pre> <pre><code>&lt;?php namespace App\Http\Controllers; use Illuminate\Http\Request; class PostsController extends Controller { public function create() { return view('posts.create'); } public function store(){ //dd('hit'); dd(request()-&gt;all()); } } </code></pre> <p>I've tried using @csrf</p>
[ { "answer_id": 74258811, "author": "Harshana", "author_id": 6952359, "author_profile": "https://Stackoverflow.com/users/6952359", "pm_score": 0, "selected": false, "text": "use App\\Http\\Controllers\\PostsController;\n \nRoute::post('/p', [PostsController::class, 'store']);\n" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74258764", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19689284/" ]
74,258,777
<p><a href="https://i.stack.imgur.com/4vVR1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4vVR1.png" alt="enter image description here" /></a></p> <p>I want to hide the details next to the code.</p> <p>I tried to hide it from the settings, but I couldn't find the option that enables me to hide it.</p>
[ { "answer_id": 74258811, "author": "Harshana", "author_id": 6952359, "author_profile": "https://Stackoverflow.com/users/6952359", "pm_score": 0, "selected": false, "text": "use App\\Http\\Controllers\\PostsController;\n \nRoute::post('/p', [PostsController::class, 'store']);\n" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74258777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19942910/" ]
74,258,796
<p>I have a data table in Oracle database in this format to keeps all the transactions in my system:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Customer ID</th> <th>Transaction ID</th> </tr> </thead> <tbody> <tr> <td>001</td> <td>trans_id_01</td> </tr> <tr> <td>001</td> <td>trans_id_02</td> </tr> <tr> <td>002</td> <td>trans_id_03</td> </tr> <tr> <td>003</td> <td>trans_id_04</td> </tr> </tbody> </table> </div> <p>As you see, each customer ID can generate many transactions in this table.</p> <p>Now I need to export the data from each day into CSV files with Apache Nifi. But the requirement is I need to have around 10k transactions in each file (this is not fixed, can have a bit more or less), with rows sorted by Customer ID. That should be simple, and I have done it with this processor: <a href="https://i.stack.imgur.com/1dAMN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1dAMN.png" alt="enter image description here" /></a></p> <p>But there's additional requirement to ensure each Customer ID should be in the same file. There should be no case where customer id 005 have some transactions in file no. 1 and another transaction in file no. 2.</p> <p>If I need to write this logic with pure coding, I think I can do DB query with pagination and write some codes to check for trailing data at the end to be compared with next page before writing each file. But when it comes to implementation with Nifi, I still have no idea how to do this.</p>
[ { "answer_id": 74280763, "author": "Mike Thomsen", "author_id": 284538, "author_profile": "https://Stackoverflow.com/users/284538", "pm_score": 2, "selected": false, "text": "ExecuteSQLRecord" }, { "answer_id": 74384195, "author": "Radit Panjapiyakul", "author_id": 157857...
2022/10/31
[ "https://Stackoverflow.com/questions/74258796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1578575/" ]
74,258,820
<p>Hi all I am having a hard time installing the PCL or point cloud library onto python using the function conda install -c conda-forge pcl. I am getting all types of errors and it is not installing pcl properly and there is something about a brew? Please help</p> <p>I have tried many things and even looked at the Point Cloud Library website, but I can't seem to find anything</p>
[ { "answer_id": 74280763, "author": "Mike Thomsen", "author_id": 284538, "author_profile": "https://Stackoverflow.com/users/284538", "pm_score": 2, "selected": false, "text": "ExecuteSQLRecord" }, { "answer_id": 74384195, "author": "Radit Panjapiyakul", "author_id": 157857...
2022/10/31
[ "https://Stackoverflow.com/questions/74258820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15150030/" ]
74,258,824
<p>I am trying to make an abstract class with method <code>callAction</code> which calls methods of class dynamically.</p> <p>I have tried to write this but I am getting error.</p> <pre><code>abstract export class BaseContoller { public callAction(method: keyof typeof this, parameters: any[]) { this[method](parameters); } } </code></pre> <p>Error - This expression is not callable. Type 'unknown' has no call signatures.ts(2349)</p> <p>Is there another way to achive this?</p>
[ { "answer_id": 74258876, "author": "JSmart523", "author_id": 7158380, "author_profile": "https://Stackoverflow.com/users/7158380", "pm_score": 0, "selected": false, "text": "this" }, { "answer_id": 74259282, "author": "Nick Vu", "author_id": 9201587, "author_profile":...
2022/10/31
[ "https://Stackoverflow.com/questions/74258824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14482706/" ]
74,258,837
<p>I have a singletone instance of window in my WPF application (which is not main window). Due to it's structure, this window only closes when the main window is closed; If the user closes this window, it becomes hidden. When I click on some image in main window, I want the following behaviour of second window:</p> <ol> <li>If window is hidden and image was clicked, I want to show it on top of all windows (but NOT by setting <code>Topmost = true</code>, I want just SHOW it on top, rather than fix it on top forever).</li> <li>If window is shown on top, there is nothing to do.</li> <li>If window is open, but covered by other window or minimized, I also want to show it on top only ONCE.</li> </ol> <p>What I have at the moment:</p> <pre><code>// In some application class private void Image_MouseDown(object sender, MouseButtonEventArgs e) { if (App.Current.MyWindow == null) { App.Current.MyWindow = WeightImageWindowView.Instance; } App.Current.MyWindow.ShowTop(); } ... // in MyWindow class public void ShowTop() { this.Topmost = true; this.Show(); if (this.WindowState == WindowState.Minimized) { this.WindowState = WindowState.Normal; } var a = this.Activate(); var b = this.Focus(); this.Topmost = false; } </code></pre> <p>I tried to use all these commands one by one, in pairs and all together, but didn't get the behaviour described above.</p>
[ { "answer_id": 74258876, "author": "JSmart523", "author_id": 7158380, "author_profile": "https://Stackoverflow.com/users/7158380", "pm_score": 0, "selected": false, "text": "this" }, { "answer_id": 74259282, "author": "Nick Vu", "author_id": 9201587, "author_profile":...
2022/10/31
[ "https://Stackoverflow.com/questions/74258837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20376128/" ]
74,258,842
<p>I need to use hashmap for this program... the code below is running but does not include hashmap.</p> <pre><code>function isSubstring(string1, string2, a, b) { if (a == 0) return true; if (b == 0) return false; if (string1[a - 1] == string2[b - 1]) return isSubstring(string1, string2, a - 1, 2 - 1); return isSubstring(string1, string2, a, b - 1); } let string1 = &quot;lofri&quot;; var punctLess = string1 .replace(/[.,\/#!$%\^&amp;\*;:{}=\-_`~()]/g, &quot;&quot;) .replace(/\s{2,}/g, &quot; &quot;); let string2 = &quot;hello, friend!&quot;; let a = string1.length; let b = string2.length; let result = isSubstring(punctLess, string2, a, b); if (result) { console.log(&quot;Yes&quot;); } else { console.log(&quot;No&quot;); } </code></pre> <p>This is what I've been changing:</p> <pre><code>function isSubstring(string1, string2, a, b) { if (a == 0) return true; if (b == 0) return false; if (string1[a - 1] == string2[b - 1]) return isSubstring(string1, string2, a - 1, 2 - 1); return isSubstring(string1, string2, a, b - 1); } const mp = new Map(); mp.set('string1', 'ello'); mp.set('string2', 'hello, friend!') var punctLess = mp[0].replace(/[.,\/#!$%\^&amp;\*;:{}=\-_`~()]/g,&quot;&quot;).replace(/\s{2,}/g,&quot; &quot;); let a = mp[0].length; let b = mp[1].length; let result = isSubstring(punctLess, string2, a, b); if (result){ console.log(&quot;Yes&quot;); } else { console.log(&quot;No&quot;); } </code></pre> <p>I focussed on getting this to work that I forgot I had to use hashmaps. I'm new to programming and need some guidance.</p>
[ { "answer_id": 74258876, "author": "JSmart523", "author_id": 7158380, "author_profile": "https://Stackoverflow.com/users/7158380", "pm_score": 0, "selected": false, "text": "this" }, { "answer_id": 74259282, "author": "Nick Vu", "author_id": 9201587, "author_profile":...
2022/10/31
[ "https://Stackoverflow.com/questions/74258842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18115709/" ]
74,258,854
<p>Validating Arrays not working in laraval 9.</p> <p>Request as follows</p> <pre><code>array:2 [ 0 =&gt; array:4 [ &quot;nic&quot; =&gt; &quot;908110248V&quot; &quot;employee_id&quot; =&gt; &quot;1&quot; &quot;request_id&quot; =&gt; &quot;2&quot; &quot;schedule_training_id&quot; =&gt; &quot;1&quot; ] 1 =&gt; array:4 [ &quot;nic&quot; =&gt; &quot;962930898v&quot; &quot;employee_id&quot; =&gt; &quot;2&quot; &quot;request_id&quot; =&gt; &quot;1&quot; &quot;schedule_training_id&quot; =&gt; &quot;1&quot; ] ] </code></pre> <p>validator code snipit as follows</p> <pre><code> $validator = Validator::make($request-&gt;input('data_attributes'), [ 'data_attributes.*.nic' =&gt; 'required|max:9' ]); </code></pre>
[ { "answer_id": 74258876, "author": "JSmart523", "author_id": 7158380, "author_profile": "https://Stackoverflow.com/users/7158380", "pm_score": 0, "selected": false, "text": "this" }, { "answer_id": 74259282, "author": "Nick Vu", "author_id": 9201587, "author_profile":...
2022/10/31
[ "https://Stackoverflow.com/questions/74258854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1371714/" ]
74,258,900
<h1>The code should print in the decreasing order</h1> <p><strong>Example:</strong> <em>input</em> a = &quot;Geek&quot;</p> <p><em>Output</em> Geek Gee Ge G END</p> <p>This is actually from geek for geeks I am trying to solve it using different variations</p> <pre><code>#User function Template for python3 class Solution: def pattern(self, S): n = len(S) for i in range (0, n): for j in range(0, n - i) : print(S[j], end = &quot;&quot;) print(&quot;&quot;) #{ # Driver Code Starts #Initial Template for Python 3 if __name__ == '__main__': T=int(input()) for i in range(T): S = input() # ob = Solution() answer = ob.pattern(S) for value in answer: print(value) # } Driver Code Ends </code></pre> <pre><code>Traceback (most recent call last): File &quot;/home/ba2f900c4eca91e4a091a2c7bf208eb5.py&quot;, line 22, in &lt;module&gt; for value in answer: TypeError: 'NoneType' object is not iterable </code></pre>
[ { "answer_id": 74258996, "author": "Flow", "author_id": 14121161, "author_profile": "https://Stackoverflow.com/users/14121161", "pm_score": 0, "selected": false, "text": "class Solution:\n def pattern(self,a):\n return [a[i:] for i in range(len(a))]\n\n\n# {\n# Driver Code Star...
2022/10/31
[ "https://Stackoverflow.com/questions/74258900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16066187/" ]
74,258,902
<p>I'm trying to build my android application which contains two libraries. In one library, a newer version of ffmpeg is being used. In another library, a dependency of that library is using an older version of ffmpeg. Trying to use pickFirst in the package options picks the WRONG libary. Is there ANY possible way to fix this, or is this just a limitation of Gradle?</p> <p>Here is the error I am getting</p> <pre><code>Execution failed for task ':app:mergeDebugNativeLibs'. &gt; A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction &gt; 2 files found with path 'lib/arm64-v8a/libavcodec.so' from inputs: </code></pre>
[ { "answer_id": 74258996, "author": "Flow", "author_id": 14121161, "author_profile": "https://Stackoverflow.com/users/14121161", "pm_score": 0, "selected": false, "text": "class Solution:\n def pattern(self,a):\n return [a[i:] for i in range(len(a))]\n\n\n# {\n# Driver Code Star...
2022/10/31
[ "https://Stackoverflow.com/questions/74258902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4957634/" ]
74,258,910
<p>We have Jenkins shared library project with some unit-tests that utilize Mockito. After an upgrade of Jenkins-core from version 2.325 to 2.326 tests start failing on the following line:</p> <pre><code>class DSLMock { DSLMock() { this.mock = mock(DSL.class) -&gt; when(mock.invokeMethod(eq(&quot;error&quot;), any())).then(new Answer&lt;String&gt;() { @Override String answer(InvocationOnMock invocationOnMock) throws Throwable { throw new AbortException((String) invocationOnMock.getArguments()[1][0]) } }) ... </code></pre> <p>with error:</p> <pre><code> org.mockito.exceptions.misusing.InvalidUseOfMatchersException: Misplaced or misused argument matcher detected here: -&gt; at com.devops.jenkins.testing.DSLMock.&lt;init&gt;(DSLMock.groovy:66) -&gt; at com.devops.jenkins.testing.DSLMock.&lt;init&gt;(DSLMock.groovy:66) You cannot use argument matchers outside of verification or stubbing. Examples of correct usage of argument matchers: when(mock.get(anyInt())).thenReturn(null); doThrow(new RuntimeException()).when(mock).someVoidMethod(anyObject()); verify(mock).someMethod(contains(&quot;foo&quot;)) This message may appear after an NullPointerException if the last matcher is returning an object like any() but the stubbed method signature expect a primitive argument, in this case, use primitive alternatives. when(mock.get(any())); // bad use, will raise NPE when(mock.get(anyInt())); // correct usage use Also, this error might show up because you use argument matchers with methods that cannot be mocked. Following methods *cannot* be stubbed/verified: final/private/equals()/hashCode(). Mocking methods declared on non-public parent classes is not supported. </code></pre> <p>I've tried to replace any() with methods like anyString() and just value like &quot;&quot; but still got same error. Also I've tried different stub syntax like</p> <pre><code>doAnswer(new Answer...).when(mock).invokeMethod(eq(&quot;error&quot;), any()) </code></pre> <p>In changelog <a href="https://www.jenkins.io/changelog-old/#v2.326" rel="nofollow noreferrer">https://www.jenkins.io/changelog-old/#v2.326</a> I see Groovy patch version has been upgraded:</p> <ul> <li>Upgrade Groovy from 2.4.12 to 2.4.21</li> </ul> <p>I wonder if that would cause the issue. Other dependencies versions are not changed:</p> <pre><code>&lt;groovy.version&gt;2.4.12&lt;/groovy.version&gt; &lt;junit-jupiter.version&gt;5.8.1&lt;/junit-jupiter.version&gt; &lt;mockito.core.version&gt;3.3.3&lt;/mockito.core.version&gt; </code></pre>
[ { "answer_id": 74258996, "author": "Flow", "author_id": 14121161, "author_profile": "https://Stackoverflow.com/users/14121161", "pm_score": 0, "selected": false, "text": "class Solution:\n def pattern(self,a):\n return [a[i:] for i in range(len(a))]\n\n\n# {\n# Driver Code Star...
2022/10/31
[ "https://Stackoverflow.com/questions/74258910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1820068/" ]
74,258,929
<p>what i'm trying to do is to check if 2 is before 4 in a array i used a for loop and condition check and i see that i'm going wrong in my first condition check. i want to make it so that if two is not in the loop it just breaks and if it sees that four is before it breaks as well.</p> <p>i put the print statement to see where i was going wrong and it seems to if(array[i] == two and it goes to the else and breaks. i also read that you can do it with another array but that sound off so i also wanted to ask if that was possible. <br/></p> <pre><code>public static void main(String[] args) { int[] check = {2, 3, 4, 2, 6}; System.out.println(universe42(check)); } private static boolean universe42(int[]array){ boolean check1 = false; boolean check2 = false; int two = 2; int four = 4; for(int i=0; i&lt; array.length; i++) { if (array[i] == two) { check1 = true; System.out.println(&quot;check1&quot;); } else { System.out.println(&quot;check-------&quot;); break; } if (array[i]== four){ check2=true; } } if(check1==true &amp;&amp; check2== true){ return true; } return false; } } </code></pre>
[ { "answer_id": 74258996, "author": "Flow", "author_id": 14121161, "author_profile": "https://Stackoverflow.com/users/14121161", "pm_score": 0, "selected": false, "text": "class Solution:\n def pattern(self,a):\n return [a[i:] for i in range(len(a))]\n\n\n# {\n# Driver Code Star...
2022/10/31
[ "https://Stackoverflow.com/questions/74258929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20017772/" ]
74,258,936
<p>I have tables like this:</p> <p>Table_0</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>CustomerID</th> <th>Trans_date</th> </tr> </thead> <tbody> <tr> <td>C001</td> <td>01-sep-22</td> </tr> <tr> <td>C001</td> <td>04-sep-22</td> </tr> <tr> <td>C001</td> <td>14-sep-22</td> </tr> <tr> <td>C002</td> <td>03-sep-22</td> </tr> <tr> <td>C002</td> <td>01-sep-22</td> </tr> </tbody> </table> </div> <p>Table_1</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>CustomerID</th> <th>Trans_date</th> </tr> </thead> <tbody> <tr> <td>C002</td> <td>18-sep-22</td> </tr> <tr> <td>C002</td> <td>20-sep-22</td> </tr> <tr> <td>C003</td> <td>02-sep-22</td> </tr> <tr> <td>C003</td> <td>28-sep-22</td> </tr> </tbody> </table> </div> <p>Table_2</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>CustomerID</th> <th>Trans_date</th> </tr> </thead> <tbody> <tr> <td>C004</td> <td>08-sep-22</td> </tr> <tr> <td>C004</td> <td>18-sep-22</td> </tr> <tr> <td>C004</td> <td>20-sep-22</td> </tr> <tr> <td>C005</td> <td>18-sep-22</td> </tr> </tbody> </table> </div> <p>How to create a new table where the new table consists of table_0, table_1 and table_2 in postgresql? thank you for help</p>
[ { "answer_id": 74258996, "author": "Flow", "author_id": 14121161, "author_profile": "https://Stackoverflow.com/users/14121161", "pm_score": 0, "selected": false, "text": "class Solution:\n def pattern(self,a):\n return [a[i:] for i in range(len(a))]\n\n\n# {\n# Driver Code Star...
2022/10/31
[ "https://Stackoverflow.com/questions/74258936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20233161/" ]
74,258,967
<p>I'm a beginner working with Processing trying to create a moving cloud sketch. They are to appear on mouseClick, and horizontally move across the screen.</p> <pre class="lang-processing prettyprint-override"><code>void mousePressed() { int newCloud { xpos: mouseX; ypos: mouseY; } clouds.push(newCloud); } </code></pre> <p>Here is the area I'm unable to fix, trying to work out the mousePressed part.</p> <p>and here is my full code! It seems a simple fix but I've tried a bunch of ways rewriting it without succsess.</p> <pre class="lang-processing prettyprint-override"><code>int[] clouds; int cloudx; int cloudy; int xpos, ypos; void setup() { size(600, 600); int cloudx=mouseX; int cloudy=mouseY; } void draw() { background(100); for (int i = 0; i &lt; clouds.length; i++) { int[] currentObj = clouds[i]; cloud(currentObj.xpos, currentObj.ypos, currentObj.size); currentObj.xpos += 0.5; currentObj.ypos += random(-0.5, 0.5); if (clouds[i].xpos &gt; width+20) { clouds.splice(i, 1); } } } void makeCloud (int x, int y){ fill(250); noStroke(); ellipse(x, y, 70, 50); ellipse(x + 10, y + 10, 70, 50); ellipse(x - 20, y + 10, 70, 50); } void mousePressed() { int newCloud { xpos: mouseX; ypos: mouseY; } clouds.push(newCloud); } </code></pre> <p>I had tried to make a new function, though the clouds wouldnt show, I also tried calling the makeCloud function though i know I need to be updating within this new function. Overall, I need help with how to write this statement for newCloud in the mousePressed function.</p>
[ { "answer_id": 74258996, "author": "Flow", "author_id": 14121161, "author_profile": "https://Stackoverflow.com/users/14121161", "pm_score": 0, "selected": false, "text": "class Solution:\n def pattern(self,a):\n return [a[i:] for i in range(len(a))]\n\n\n# {\n# Driver Code Star...
2022/10/31
[ "https://Stackoverflow.com/questions/74258967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20252503/" ]
74,258,994
<p>Suppose I have an array of size 100. Initially, let's assume that all the elements have a value of 0. Now, let's say I want to insert 60 elements such that the elements get filled evenly. I don't want all the elements to be filled from <code>arr[0]</code> to <code>arr[59]</code>. Rather, I want the whole array to be filled in such a way that the array looks filled. What algorithm can I use to achieve this?</p> <p>For eg-</p> <p>I have 5 elements to be filled (let's say with 1) in an array of size 10. Then the array should look like this:</p> <p><code>[1,0,1,0,1,0,1,0,1,0]</code></p> <p>In the case of 3 elements,</p> <p><code>[1,0,0,0,1,0,0,0,1,0]</code></p> <p>Is there any smart way to do this dynamically?</p>
[ { "answer_id": 74259091, "author": "Pranay Chandale", "author_id": 11873730, "author_profile": "https://Stackoverflow.com/users/11873730", "pm_score": 0, "selected": false, "text": "function populateArray(arraySize, arrayElements) {\nconst newArray = [];\nif (arraySize >= arrayElements) ...
2022/10/31
[ "https://Stackoverflow.com/questions/74258994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15387120/" ]
74,259,034
<p>I am developing an application which runs on docker containers. I have two node js applications where one is running on port number 5000 and another on 8888 in the docker. I would like to send http request to the node app's route which runs on port 8888 from node app 5000. but it is not working. but when I tried to access the same api end point of port 8888 application it is working fine on browser as well as a none dockerize node js app. can anyone help me to resolve the issue? below is my docker-compose.yml file</p> <pre class="lang-yaml prettyprint-override"><code>version: &quot;3.8&quot; services: node-sdc-service: build: context: . dockerfile: Dockerfile-dev environment: CHOKIDAR_USEPOLLING: 'true' container_name: node-sdc tty: true #restart: always ports: - &quot;0.0.0.0:3000:3000&quot; - &quot;0.0.0.0:4000:4000&quot; - &quot;0.0.0.0:5000:5000&quot; - &quot;0.0.0.0:8000:80&quot; volumes: - .:/usr/src/app yolov5-service: build: context: . dockerfile: Dockerfile-yolo environment: CHOKIDAR_USEPOLLING: 'true' container_name: yolo tty: true #restart: always ports: - &quot;0.0.0.0:8888:5000&quot; volumes: - .:/usr/src/app/server - ./training_data:/usr/src/coco - ./yolo_runs:/usr/src/app/runs mongo-sdc-service: # image: mongo:4.2-bionic image: mongo:5.0-focal # restart: always container_name: mongo-sdc environment: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: 1004 MONGO_INITDB_DATABASE: sdc volumes: - mongo-sdc-storage:/data/db ports: - 27020:27017 volumes: mongo-sdc-storage: </code></pre>
[ { "answer_id": 74259091, "author": "Pranay Chandale", "author_id": 11873730, "author_profile": "https://Stackoverflow.com/users/11873730", "pm_score": 0, "selected": false, "text": "function populateArray(arraySize, arrayElements) {\nconst newArray = [];\nif (arraySize >= arrayElements) ...
2022/10/31
[ "https://Stackoverflow.com/questions/74259034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8945820/" ]
74,259,036
<p>I have sequence date:</p> <pre><code>names&lt;-format(seq.Date(as.Date(&quot;2012-11-01&quot;),as.Date(&quot;2012-12-01&quot;), by = 'months'),format = &quot;%Y%m&quot;) </code></pre> <p>How can I get the last two digit, like the result for last two digits of names[1] is 11?</p>
[ { "answer_id": 74259091, "author": "Pranay Chandale", "author_id": 11873730, "author_profile": "https://Stackoverflow.com/users/11873730", "pm_score": 0, "selected": false, "text": "function populateArray(arraySize, arrayElements) {\nconst newArray = [];\nif (arraySize >= arrayElements) ...
2022/10/31
[ "https://Stackoverflow.com/questions/74259036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19912522/" ]
74,259,097
<p><strong>input</strong> :</p> <pre class="lang-json prettyprint-override"><code>{ &quot;accounts&quot;: { &quot;canara&quot;: 1, &quot;sbi&quot;: 0, &quot;axis&quot;: 1, &quot;hdfc&quot;: 0 } } </code></pre> <p><strong>expected output</strong> :</p> <pre class="lang-json prettyprint-override"><code>{ &quot;canara&quot;: 1, &quot;sbi&quot;: 0, &quot;axis&quot;: 1, &quot;hdfc&quot;: 0, &quot;total accounts&quot;: 2 } </code></pre> <p>I want the sum of all the accounts to be added in &quot;total accounts&quot;. how can I achieve this with jolt?</p>
[ { "answer_id": 74259745, "author": "kasptom", "author_id": 4880379, "author_profile": "https://Stackoverflow.com/users/4880379", "pm_score": 2, "selected": true, "text": "[\n {\n \"operation\": \"shift\",\n \"spec\": {\n \"accounts\": {\n \"*\": [\n \".&\",\n ...
2022/10/31
[ "https://Stackoverflow.com/questions/74259097", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19938449/" ]
74,259,120
<p>Say I have a dataframe, <code>df</code>, as below:</p> <pre><code> Client Number (#) Volume ($) Num. z-Score Vol. z-Score 0 ABC 63 131.22 1.17 0.68 1 DEF 44 98.71 2.68 1.35 2 JKL 17 64.15 0.45 0.57 3 PQR 75 180.47 0.88 1.43 4 XYZ 28 75.93 0.23 3.96 </code></pre> <p>I would like to sort it such that the maximum values of either of the last two columns appear as the first row. As z-Score tracks deviation from the mean with respect to SD, I am looking for the greatest deviation for either of my two measures (number, volume) and would rather not prioritise them.</p> <p>For instance, the current method I am using: <code>df.sort_values(['Num. z-Score','Vol. z-Score'], ascending=False)</code> , is discriminatory as it sorts by <code>'Num. z-Score'</code> first and would ONLY look at <code>'Vol. z-Score'</code> if there were any equal values.</p> <p>How can I instead sort the column in such a way that the final result looks as below:</p> <pre><code> Client Number (#) Volume ($) Num. z-Score Vol. z-Score 4 XYZ 28 75.93 0.23 3.96 1 DEF 44 98.71 2.68 1.35 0 ABC 63 131.22 1.17 0.68 3 PQR 75 180.47 0.88 1.03 2 JKL 17 64.15 0.45 0.57 </code></pre> <p>Any help would be greatly appreciated :)</p>
[ { "answer_id": 74259745, "author": "kasptom", "author_id": 4880379, "author_profile": "https://Stackoverflow.com/users/4880379", "pm_score": 2, "selected": true, "text": "[\n {\n \"operation\": \"shift\",\n \"spec\": {\n \"accounts\": {\n \"*\": [\n \".&\",\n ...
2022/10/31
[ "https://Stackoverflow.com/questions/74259120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19764896/" ]
74,259,147
<p>this is my form code</p> <pre><code>&lt;form action=&quot;action_page.html&quot; method=&quot;GET&quot;&gt; &lt;div&gt; &lt;label for=&quot;name&quot;&gt;First name:&lt;/label&gt; &lt;br&gt; &lt;input type=&quot;text&quot; id=&quot;fname&quot; name=&quot;fname&quot;&gt;&lt;br&gt;&lt;br&gt; </code></pre> <p>This is my JavaScript print execution &quot;action_page.html&quot;. I want this to print the form in another page.</p> <pre><code>&lt;script&gt; const resultsList = document.getElementById('result') new URLSearchParams(window.location.search).forEach((value, name) =&gt; { resultsList.append('${name}: ${value}') resultsList.append(document.createElement('br')) }) &lt;/script&gt; </code></pre>
[ { "answer_id": 74259745, "author": "kasptom", "author_id": 4880379, "author_profile": "https://Stackoverflow.com/users/4880379", "pm_score": 2, "selected": true, "text": "[\n {\n \"operation\": \"shift\",\n \"spec\": {\n \"accounts\": {\n \"*\": [\n \".&\",\n ...
2022/10/31
[ "https://Stackoverflow.com/questions/74259147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20376404/" ]
74,259,169
<p>I am struggling to grasp the sed command.</p> <p>I am working with gene annotation files. In particular, I convert gff3 to gtf files needed to execute cellranger-arc mkref. Both gffread and agat fail to do so perfectly on gff3 files from ncbi. My agat-gtf file doesn't contain 'transcript_id' as is.</p> <p>The gtf format is a tab delimited format, with the final column being for attributes. The attributes are separated using semicolons. Currently, my agat-gtf file has 'locus_tag' descriptors which I want to replace as 'transcript_id' with necessary quote marks around the name of the transcript. As an example, I want</p> <pre><code> ... ; locus_tag AbcdE_f1 ; ... </code></pre> <p>to be replaced with</p> <pre><code> ... ; transcript_id &quot;AbcdE_f1&quot; ; ... </code></pre> <p><br> I have tried <code>sed -i.bak &quot;s/locus_tag\([0-9a-zA-Z ,._-]{1,}\);/transcript_id \&quot;1\&quot;;/g&quot; myFile.gtf</code>, but it does nothing. <br> Thanks for any help.</p> <p>As per request (I'll include two lines as input) typical input</p> <p>sample:</p> <pre><code>ChrPT RefSeq exon 956 981 . + . Dbxref &quot;GeneID:38831453&quot; ; ID &quot;nbis-exon-1&quot; ; Parent PhpapaC_p1 ; gbkey exon ; gene &quot;3' rps12&quot; ; locus_tag PhpapaC_p1 ; product &quot;ribosomal protein S12&quot; &lt;br&gt; ChrPT RefSeq gene 1033 1500 . + . Dbxref &quot;GeneID:2546745&quot; ; ID &quot;nbis-gene-17&quot; ; Name rps7 ; gbkey Gene ; gene rps7 ; gene_biotype protein_coding ; locus_tag PhpapaCp002 </code></pre> <p>Desired output:</p> <pre><code> ChrPT RefSeq exon 956 981 . + . Dbxref &quot;GeneID:38831453&quot; ; ID &quot;nbis-exon-1&quot; ; Parent PhpapaC_p1 ; gbkey exon ; gene &quot;3' rps12&quot; ; transcript_id &quot;PhpapaC_p1&quot; ; product &quot;ribosomal protein S12&quot; &lt;br&gt; ChrPT RefSeq gene 1033 1500 . + . Dbxref &quot;GeneID:2546745&quot; ; ID &quot;nbis-gene-17&quot; ; Name rps7 ; gbkey Gene ; gene rps7 ; gene_biotype protein_coding ; transcript_id &quot;PhpapaCp002&quot; </code></pre>
[ { "answer_id": 74259473, "author": "HatLess", "author_id": 16372109, "author_profile": "https://Stackoverflow.com/users/16372109", "pm_score": 3, "selected": true, "text": "sed" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74259169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19982216/" ]
74,259,178
<p>Tailwind CSS is not applying to the app folder in the next.js v13, but it is working on the Pages and Components folder. In the tailwind.config file, I have added</p> <p>However, no CSS is being applied to components in app folder!</p> <pre><code>content: [ &quot;./pages/**/*.{js,ts,jsx,tsx}&quot;, &quot;./components/**/*.{js,ts,jsx,tsx}&quot;, &quot;./app/**/*.{js,ts,jsx,tsx}&quot;, ], </code></pre>
[ { "answer_id": 74260597, "author": "lorekkusu", "author_id": 20363793, "author_profile": "https://Stackoverflow.com/users/20363793", "pm_score": 3, "selected": false, "text": "experimental.appDir: true" }, { "answer_id": 74283737, "author": "Amark Wong", "author_id": 1077...
2022/10/31
[ "https://Stackoverflow.com/questions/74259178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15439532/" ]
74,259,215
<pre><code>A = [['0', '6', '4', '3'], ['0', '2', '8', '3'], ['0', '4', '1', '5'], ['0', '3', '2', '5']] B = ['0', '4', '1', '5'] </code></pre> <p>Say I want to find out at which line does B equal to the list. How do I write a solution for this?</p> <p>The answer would be the third line.</p> <p>I tried doing a for loop.</p>
[ { "answer_id": 74259250, "author": "Ramesh", "author_id": 18014805, "author_profile": "https://Stackoverflow.com/users/18014805", "pm_score": 0, "selected": false, "text": "A = [['0', '6', '4', '3'], ['0', '2', '8', '3'], ['0', '4', '1', '5'], ['0', '3', '2', '5']]\n\nB = ['0', '4', '1',...
2022/10/31
[ "https://Stackoverflow.com/questions/74259215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5502175/" ]
74,259,216
<p>I am trying to double numbers using Lambda function in python but can't understand the function that's all because I'm starting to learn python. Below is the function:</p> <pre><code>def myfunc(n): return lambda a : a * n mydoubler = myfunc(2) print(mydoubler(11)) </code></pre> <p>I just need to understand how this code is working. Any help will be much appreciated.</p>
[ { "answer_id": 74259250, "author": "Ramesh", "author_id": 18014805, "author_profile": "https://Stackoverflow.com/users/18014805", "pm_score": 0, "selected": false, "text": "A = [['0', '6', '4', '3'], ['0', '2', '8', '3'], ['0', '4', '1', '5'], ['0', '3', '2', '5']]\n\nB = ['0', '4', '1',...
2022/10/31
[ "https://Stackoverflow.com/questions/74259216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18878943/" ]
74,259,241
<p>I use the <a href="https://blog.cloudflare.com/turnstile-private-captcha-alternative/" rel="nofollow noreferrer">CloudFlare reCaptcha Turnstile</a> and want to customize the widget - remove the border and background color.</p> <p><img src="https://images.hothardware.com/contentimages/newsitem/59755/content/turnstile-verification-process-news.jpg" alt="Turnstile" /></p> <p>I think it’s possible with CSS or Javascript.</p> <p>Thanks for any help!</p>
[ { "answer_id": 74259250, "author": "Ramesh", "author_id": 18014805, "author_profile": "https://Stackoverflow.com/users/18014805", "pm_score": 0, "selected": false, "text": "A = [['0', '6', '4', '3'], ['0', '2', '8', '3'], ['0', '4', '1', '5'], ['0', '3', '2', '5']]\n\nB = ['0', '4', '1',...
2022/10/31
[ "https://Stackoverflow.com/questions/74259241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4703417/" ]
74,259,280
<p>The user submits the response to the poll it's not displaying the results from the database. This is the website <a href="http://josietaylor.byethost14.com/poll/" rel="nofollow noreferrer">http://josietaylor.byethost14.com/poll/</a> I'm unsure what's wrong and why nothing is showing? I didn't think I needed to add the HOST USER PASS BASE but I included it to see if it would work, still won't.</p> <ul> <li>After submitting the answer it's just blank, nothing at all is showing. Below is the code. It should show on the same page just reload it.</li> </ul> <p>*** Update Thank you to Ken Lee, I made a rookie mistake of not including the 'includes' file when uploading to my server. I fixed that, and now it's showing the &quot;results&quot; page but not actually displaying the results. I want it to show the different options and the results with the % from highest to lowest. This database isn't supposed to be safe as it's a project for college (first PHP/SQL class) and we aren't yet making it all secure.</p> <pre><code>&lt;?php include 'includes/dp.php'; //Function to create the page function createPage(){ if(!isset($_POST['food'])){ echo createQuestionare(); } //If all variables are set, add to database and display results else{ addToDataBase($_POST['food'], 'poll'); displayResults(); } } define(&quot;HOST&quot;, &quot;****&quot;); define(&quot;USER&quot;, &quot;****&quot;); define(&quot;PASS&quot;, &quot;****&quot;); define(&quot;BASE&quot;, &quot;****&quot;); $conn = mysqli_connect(HOST, USER, PASS, BASE); //Create questionare function createQuestionare(){ $content = &quot;&quot;; $content .= &quot;&lt;div class='main'&gt;&quot;; $content .= &quot;&lt;h1 class='title'&gt;Food Poll&lt;/h1&gt;&quot;; $content .= &quot;&lt;form action='.' method='post'&gt;&quot;; $content .= createQuestion(); //Close form $content .= &quot;&lt;input type='submit'&gt;&quot;; $content .= &quot;&lt;/form&gt;&quot;; $content .= &quot;&lt;/div&gt;&quot;; return $content; } //Create question function createQuestion(){ $arr = [&quot;Pizza&quot;, &quot;Burger&quot;, &quot;Salad&quot;, &quot;Pasta&quot;]; //Question to ask $content = &quot;&quot;; $content .= &quot;&lt;h1 class='question-text'&gt;Which food is most satisfying?&lt;/h1&gt;&quot;; //Create radio button and label for each possible question foreach($arr as $subject){ $content .= &quot;&lt;input type='radio' id='$subject' value='$subject' name='food'&gt;&quot;; $content .= &quot;&lt;label for='$subject'&gt;$subject&lt;/label&gt;&lt;br&gt;&quot;; } return $content; } //Function adds data to DB function addToDataBase($data, $DBName){ //Edit string to be lowercase $data = strtolower($data); $conn = connectToDB(); //Check database for primary key of answer $sql = &quot;SELECT * FROM $DBName WHERE name='$data';&quot;; $results = mysqli_query($conn, $sql); if(mysqli_num_rows($results) != 0){ $key = mysqli_fetch_array($results, MYSQLI_ASSOC)['id']; } //Increment vote number and insert value $sql = &quot;UPDATE $DBName SET votes = votes + 1 WHERE id=$key;&quot;; mysqli_query($conn, $sql); mysqli_close($conn); } //Function to display results function displayResults(){ $arr = ['poll']; //Create results content $content = ''; $content = '&lt;div class=&quot;main&quot;&gt;'; $content .= &quot;&lt;h1 class='title'&gt;Thank You!&lt;/h1&gt;&quot;; foreach($arr as $DBName){ $content .= '&lt;div class=&quot;result-container&quot;&gt;'; $content .= getResults($DBName); $content .= '&lt;/div&gt;'; } $content .= '&lt;/div&gt;'; echo $content; } //Function will display results highest to lowest function getResults($DBName){ $conn = connectToDB(); //Results $sql = &quot;SELECT * FROM $DBName;&quot;; $results = mysqli_query($conn, $sql); //Total $sql = &quot;SELECT SUM(votes) as total FROM $DBName;&quot;; $total = mysqli_query($conn,$sql); $total = mysqli_fetch_assoc($total)['total']; //Create an associate array with percentage and name $sortedArray = array(); while($row = mysqli_fetch_array($results, MYSQLI_ASSOC)){ $name = $row['name']; $percentage = round($row['votes']/$total * 100); $sortedArray[$name] = $percentage; } //Sort by percentage $content = ''; $content = '&lt;h1 class=&quot;result-text&quot;&gt;Results&lt;/h1&gt;'; arsort($sortedArray); //Display results foreach($sortedArray as $name =&gt; $percentage ){ $content .= &quot;&lt;h2&gt;&quot;. ucwords($name) .&quot; has $percentage% of the votes&lt;/h2&gt;&quot;; } mysqli_close($conn); return $content; } ?&gt; &lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt; &lt;head&gt; &lt;meta charset=&quot;utf-8&quot; /&gt; &lt;title&gt;Poll&lt;/title&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;css/style.css&quot;&gt; &lt;/head&gt; &lt;body&gt; &lt;?php createPage(); ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
[ { "answer_id": 74259250, "author": "Ramesh", "author_id": 18014805, "author_profile": "https://Stackoverflow.com/users/18014805", "pm_score": 0, "selected": false, "text": "A = [['0', '6', '4', '3'], ['0', '2', '8', '3'], ['0', '4', '1', '5'], ['0', '3', '2', '5']]\n\nB = ['0', '4', '1',...
2022/10/31
[ "https://Stackoverflow.com/questions/74259280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20376512/" ]
74,259,304
<p>I want to use NotifyIcon, but I don't want any icons to appear in the lower right field, is this possible? Or does anyone have an alternative solution suggestion? I want to send a notification until the user sees the notification, the visibility will be turned on, but there will not be any icon in the lower right part. It will only appear in the notification panel on the right.</p> <p>I tried to hide icon.But couldn't.</p>
[ { "answer_id": 74259250, "author": "Ramesh", "author_id": 18014805, "author_profile": "https://Stackoverflow.com/users/18014805", "pm_score": 0, "selected": false, "text": "A = [['0', '6', '4', '3'], ['0', '2', '8', '3'], ['0', '4', '1', '5'], ['0', '3', '2', '5']]\n\nB = ['0', '4', '1',...
2022/10/31
[ "https://Stackoverflow.com/questions/74259304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20059194/" ]
74,259,306
<p>I used personal token to clone private repository,then when I commit or push changes, there would a window ask for login github.</p> <p>Where can I setting so that don't need to login by browser everytimes?</p> <p>The ask window is:</p> <p><a href="https://i.stack.imgur.com/p8Oqt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p8Oqt.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74259661, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 1, "selected": false, "text": "git config --global credential.helper" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74259306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13646752/" ]
74,259,338
<p>The following code contains an example template <code>X</code>, where the data-member is unused, if the template is parametrized with other type than <code>A</code>. But the sizes of the objects <code>a</code> and <code>b</code> are the same, even with <code>-O3</code>, so the optimizer does not remove the unused data-member <code>x2</code>.</p> <pre><code>#include &lt;iostream&gt; #include &lt;cstdint&gt; #include &lt;type_traits&gt; struct A {}; struct B {}; template&lt;typename T&gt; struct X { int value() const { if constexpr(std::is_same_v&lt;T, A&gt;) { return x1 + x2; } else { return x1; } } private: int x1{0}; int x2{0}; }; int main() { X&lt;A&gt; a; X&lt;B&gt; b; std::cout &lt;&lt; sizeof(a) &lt;&lt; '\n'; std::cout &lt;&lt; sizeof(b) &lt;&lt; '\n'; return a.value() + b.value(); } </code></pre> <p>Now there are two questions:</p> <ol> <li>Is the optimizer not allowed (<code>as-if</code>-rule) to remove the unused data-member? Why?</li> <li>How to achieve the goal: that the class <code>X&lt;B&gt;</code> does not contain the unused data-member <code>x2</code>?</li> </ol> <p>There is a workaround with a base-class template and a specialisation for <code>A</code> that contains the data-member <code>x2</code>. But this solution is cumbersome. I wonder if there is a solution without using a base class?</p> <p>Edit: I don't think that using the <code>sizeof()</code> operator prevents the optimization:</p> <pre><code>//#include &lt;iostream&gt; #include &lt;cstdint&gt; #include &lt;type_traits&gt; struct A {}; struct B {}; template&lt;typename T&gt; struct X { int value() const { if constexpr(std::is_same_v&lt;T, A&gt;) { return x1 + x2; } else { return x1; } } private: int x1{0}; int x2{1}; }; X&lt;A&gt; a; X&lt;B&gt; b; int main() { // std::cout &lt;&lt; sizeof(a) &lt;&lt; '\n'; // std::cout &lt;&lt; sizeof(b) &lt;&lt; '\n'; return a.value() + b.value(); } </code></pre> <p>If you look a the assembly (e.g. compiler explorer) you see that the instances contain in both cases both data-members.</p>
[ { "answer_id": 74259661, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 1, "selected": false, "text": "git config --global credential.helper" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74259338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3359751/" ]
74,259,358
<p>Let x be a numeric vector. In Matlab typing:</p> <pre><code>y=1*(x&gt;0.1) </code></pre> <p>Gives a vector of the same size as x with ones and zeros depending on whether the corresponding element in x satisfies the condition. Is there a similar short hand statement in Python (or common library) to achieve this without a loop?</p>
[ { "answer_id": 74259661, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 1, "selected": false, "text": "git config --global credential.helper" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74259358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13963659/" ]
74,259,367
<p>I used a simple code for python in my VS Studio. Print (&quot;Welcome&quot;) when I run it through the run button it works fine but when I want to run it through typing the file name ( eg .\02_hello.py) and press enter it doesn't run and instead leave a blank line. I don't know what's wrong.please help</p> <p>I want the python code to run through typing the file name in terminal window of vs studio just as it works fine when I use the run button to run code. <a href="https://i.stack.imgur.com/xsoJB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xsoJB.jpg" alt="enter image description here" /></a></p>
[ { "answer_id": 74259402, "author": "n2coke", "author_id": 14523056, "author_profile": "https://Stackoverflow.com/users/14523056", "pm_score": 1, "selected": false, "text": "python ./02_hello.py\n" }, { "answer_id": 74259409, "author": "Kutay Kılıç", "author_id": 19274851,...
2022/10/31
[ "https://Stackoverflow.com/questions/74259367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20376570/" ]
74,259,400
<pre><code> FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:checkDebugAarMetadata'. &gt; Could not resolve all files for configuration ':app:debugRuntimeClasspath'. &gt; Could not resolve com.facebook.android:facebook-android-sdk:latest.release. Required by: project :app &gt; Failed to list versions for com.facebook.android:facebook-android-sdk. &gt; Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml. &gt; Could not HEAD 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml'. &gt; Read timed out * Try: &gt; Run with --stacktrace option to get the stack trace. &gt; Run with --info or --debug option to get more log output. &gt; Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 2m 8s Exception: Gradle task assembleDebug failed with exit code 1 Exited (sigterm) </code></pre> <p>this is the error I get while running the application</p> <p>i tried adding mavenCentral() in my build.gradle file as some of the suggestions out there but it didn't work for me. I also tried</p> <pre><code> implementation 'com.facebook.android:facebook-android-sdk:latest.release' </code></pre> <p>but it's still the same</p>
[ { "answer_id": 74259435, "author": "Goodham", "author_id": 19082714, "author_profile": "https://Stackoverflow.com/users/19082714", "pm_score": 0, "selected": false, "text": "allprojects {\n repositories {\n // Jcenter mirror\n maven { url \"https://maven.aliyun.com/repos...
2022/10/31
[ "https://Stackoverflow.com/questions/74259400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18313810/" ]
74,259,425
<p>This is my code</p> <pre><code>DateTimeFormField( decoration: InputDecoration( hintStyle: const TextStyle(color: Colors.black), errorStyle: const TextStyle(color: Colors.redAccent), border: OutlineInputBorder( borderRadius: BorderRadius.circular(20), ), hintText: 'MM DD, YYYY', filled: true, fillColor: Colors.grey[200], suffixIcon: const Icon(Icons.event_note), labelText: 'Select Date', ), mode: DateTimeFieldPickerMode.date, autovalidateMode: AutovalidateMode.always, validator: (e) =&gt; (e?.day ?? 0) == 1 ? 'Please not the first day' : null, onDateSelected: (DateTime value) { // value = populdate; }, ), </code></pre> <p>I want to put the selected date value into a variable. How to do that, tried many things but didn't get a solution.</p>
[ { "answer_id": 74259435, "author": "Goodham", "author_id": 19082714, "author_profile": "https://Stackoverflow.com/users/19082714", "pm_score": 0, "selected": false, "text": "allprojects {\n repositories {\n // Jcenter mirror\n maven { url \"https://maven.aliyun.com/repos...
2022/10/31
[ "https://Stackoverflow.com/questions/74259425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19151588/" ]
74,259,434
<p>I am having trouble solving the following problem. `</p> <pre><code> # This generates the target Matrix A = matrix(c(0.51,0.42, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0,0.35,0.49,0.43,0 , 0, 0, 0, 0, 0 , 0, 0, 0, 0,0.43,0.31,0.97, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0,0.70,0.42, 1 , 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 , 1, 0, 1, 0, 1, 0, 0, 0, 0, 0 , 0, 0, 0, 1, 0, 1, 0, 1, 0, 0 , 0, 0, 0, 0, 0, 0, 1, 0, 1), nrow = 8, byrow = T) # x is equal to the coefficients vector x = c(50,36,60,85,14,22,84,92,34,74) # y is equal to the product Ax = y y = A %*% X </code></pre> <p>`</p> <p>So let's say I did not know A but I do know x and y. How can I find the original Matrix A (or at very least a Matrix which would satisfy Ax=y) from only the x and y vectors?</p> <p>I really appreciate your time, thank you in advance.</p> <p>I have tried to follow the equation</p> <p><code>A = BX^-1</code></p> <p>However, this lead nowhere and the issue I think is around the non-square nature of the A matrix.</p>
[ { "answer_id": 74261443, "author": "Allan Cameron", "author_id": 12500315, "author_profile": "https://Stackoverflow.com/users/12500315", "pm_score": 3, "selected": true, "text": "A" }, { "answer_id": 74263726, "author": "G. Grothendieck", "author_id": 516548, "author_...
2022/10/31
[ "https://Stackoverflow.com/questions/74259434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20376635/" ]
74,259,436
<p>Hi i am trying to convert the following code using java 8 stream API.</p> <pre><code>private Point3d findClosestNodeToParentStartNode1(List&lt;Point3d&gt; points,Point3d parentStartVertex) { TreeMap&lt;Double, Point3d&gt; distanceMap = new TreeMap&lt;Double, Point3d&gt;(); for (Point3d point : points) { distanceMap.put(parentStartVertex.distanceTo(point), point); } return distanceMap.firstEntry().getValue(); } </code></pre> <p>I am trying to do something like</p> <pre><code>Map&lt;Double, Point3d&gt; result = points.stream().collect(Collectors.toMap(parentStartVertex.distanceTo(point-&gt;point) , point -&gt; point)); TreeMap&lt;Double, Point3d&gt; distanceMap = new TreeMap&lt;&gt;(result); return distanceMap.firstEntry().getValue(); </code></pre>
[ { "answer_id": 74259496, "author": "Teddy Tsai", "author_id": 16959486, "author_profile": "https://Stackoverflow.com/users/16959486", "pm_score": 0, "selected": false, "text": " Map<Double, Point3d> result = points.stream().collect(Collectors.toMap(parentStartVertex.distanceTo(point->po...
2022/10/31
[ "https://Stackoverflow.com/questions/74259436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4053106/" ]
74,259,437
<p><a href="https://i.stack.imgur.com/6HvoB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6HvoB.png" alt="enter image description here" /></a></p> <p>the string is coming like this, I want to add the objects if this objects id's are equal with this string array elements.</p> <p>I am fetching the data,I convert it as model List =&gt;<code>List&lt;DataDependantListModel&gt; listModel; </code> I have tried to create condition but I couldn't. here is the class model ;</p> <pre><code>class DataDependantListModel { String? id; String? name; DataDependantListModel({this.id, this.name}); DataDependantListModel.fromJson(Map&lt;String, dynamic&gt; json) { id = json['Id']; name = json['Name']; } Map&lt;String, dynamic&gt; toJson() { final Map&lt;String, dynamic&gt; data = &lt;String, dynamic&gt;{}; data['Id'] = id; data['Name'] = name; return data; } } debugPrint(&quot;visafamilyId : &quot; + visaFamilyId .toString()); debugPrint(&quot;visa family contain : &quot; + visaFamilyId.contains(&quot;6&quot;).toString()); </code></pre> <p><a href="https://i.stack.imgur.com/o9glK.png" rel="nofollow noreferrer">enter image description here</a></p>
[ { "answer_id": 74259496, "author": "Teddy Tsai", "author_id": 16959486, "author_profile": "https://Stackoverflow.com/users/16959486", "pm_score": 0, "selected": false, "text": " Map<Double, Point3d> result = points.stream().collect(Collectors.toMap(parentStartVertex.distanceTo(point->po...
2022/10/31
[ "https://Stackoverflow.com/questions/74259437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20376640/" ]
74,259,485
<p>What is the difference array.clear() and array = [] in the following two implementations.</p> <p>1)print output is [1,2,3,4,5]</p> <pre><code>class fistclass_(): def __init__(self): self.array = None def setarray(self): array = [1,2,3,4,5] self.array = array array = [] return class anotherclass_(): def copylist(self,array): self.a = array print(self.a) def main(): f = fistclass_() f.setarray() a = anotherclass_() a.copylist(f.array) main() </code></pre> <ol start="2"> <li>print empty array</li> </ol> <pre><code>class fistclass_(): def __init__(self): self.array = None def setarray(self): array = [1,2,3,4,5] self.array = array array.clear() return class anotherclass_(): def copylist(self,array): self.a = array print(self.a) def main(): f = fistclass_() f.setarray() a = anotherclass_() a.copylist(f.array) main() </code></pre>
[ { "answer_id": 74259513, "author": "Tim Roberts", "author_id": 1883316, "author_profile": "https://Stackoverflow.com/users/1883316", "pm_score": 1, "selected": false, "text": "array.clear()" }, { "answer_id": 74259558, "author": "DYZ", "author_id": 4492932, "author_pr...
2022/10/31
[ "https://Stackoverflow.com/questions/74259485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2467772/" ]
74,259,486
<p>I have the following function <code>public Mono&lt;Integer&gt; revertChange() { someService.someMethod() .retryWhen(3 times, with 150millis of delay, if specific error occured) .onError(e -&gt; log_the_error); } </code> And I have a simple unit test that summpose to verify that the <strong>someService.someMethod</strong> was called exactly 3 times `class Test {</p> <pre><code>@InjectMocks SomeService someService; @Test void shouldCallSomeServiceExactlythreetimes_whenErrorOccured() { verify(someService).someMethod(3)//someMethod invoked 3 times } </code></pre> <p>} `</p> <p>The problem is that the verify block does not catches that the <code>someMethod</code> was executed 3 times, it says only 1. I am using junit 5 and jmockit, maybe there are better alternatives specific for reactive mocks, any ideas guys?</p> <p>Verification block does not catch multiple execution of the method</p>
[ { "answer_id": 74259513, "author": "Tim Roberts", "author_id": 1883316, "author_profile": "https://Stackoverflow.com/users/1883316", "pm_score": 1, "selected": false, "text": "array.clear()" }, { "answer_id": 74259558, "author": "DYZ", "author_id": 4492932, "author_pr...
2022/10/31
[ "https://Stackoverflow.com/questions/74259486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6059174/" ]
74,259,497
<pre><code>n: 8 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 </code></pre> <p>How to print a number table like this in python with n that can be any number? I am using a very stupid way to print it but the result is not the one expected:</p> <pre><code>n = int(input('n: ')) if n == 4: print(' 0 1 2 3\n4 5 6 7\n8 9 10 11\n12 13 14 15') if n == 5: print(' 0 1 2 3 4\n5 6 7 8 9\n10 11 12 13 14\n15 16 17 18 19\n20 21 22 23 24') if n == 6: print(' 0 1 2 3 4 5\n6 7 8 9 10 11\n12 13 14 15 16 17\n18 19 20 21 22 23\n24 25 26 27 28 29\n30 31 32 33 34 35') if n == 7: print(' 0 1 2 3 4 5 6\n7 8 9 10 11 12 13\n14 15 16 17 18 19 20\n21 22 23 24 25 26 27\n28 29 30 31 32 33 34\n35 36 37 38 39 40 41\n42 43 44 45 46 47 48') if n == 8: print(' 0 1 2 3 4 5 6 7\n8 9 10 11 12 13 14 15\n16 17 18 19 20 21 22 23\n24 25 26 27 28 29 30 31\n32 33 34 35 36 37 38 39\n40 41 42 43 44 45 46 47\n48 49 50 51 52 53 54 55\n56 57 58 59 60 61 62 63') if n == 9: print(' 0 1 2 3 4 5 6 7 8\n9 10 11 12 13 14 15 16 17\n18 19 20 21 22 23 24 25 26\n27 28 29 30 31 32 33 34 35\n36 37 38 39 40 41 42 43 44\n45 46 47 48 49 50 51 52 53\n54 55 56 57 58 59 60 61 62\n63 64 65 66 67 68 69 70 71\n72 73 74 75 76 77 78 79 80') if n == 10: print(' 0 1 2 3 4 5 6 7 8 9\n10 11 12 13 14 15 16 17 18 19\n20 21 22 23 24 25 26 27 28 29\n30 31 32 33 34 35 36 37 38 39\n40 41 42 43 44 45 46 47 48 49\n50 51 52 53 54 55 56 57 58 59\n60 61 62 63 64 65 66 67 68 69\n70 71 72 73 74 75 76 77 78 79\n80 81 82 83 84 85 86 87 88 89\n90 91 92 93 94 95 96 97 98 99') </code></pre> <p>here is the result:</p> <pre><code>n: 8 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 </code></pre>
[ { "answer_id": 74259513, "author": "Tim Roberts", "author_id": 1883316, "author_profile": "https://Stackoverflow.com/users/1883316", "pm_score": 1, "selected": false, "text": "array.clear()" }, { "answer_id": 74259558, "author": "DYZ", "author_id": 4492932, "author_pr...
2022/10/31
[ "https://Stackoverflow.com/questions/74259497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20376552/" ]
74,259,506
<p>I'm not able to get the same <code>djbhash</code> in JavaScript that I was getting in Swift.</p> <pre><code>extension String { public func djbHash() -&gt; Int { return self.utf8 .map {return $0} .reduce(5381) { let h = ($0 &lt;&lt; 5) &amp;+ $0 &amp;+ Int($1) print(&quot;h&quot;, h) return h } } } </code></pre> <pre><code>var djbHash = function (string) { var h = 5381; // our hash var i = 0; // our iterator for (i = 0; i &lt; string.length; i++) { var ascii = string.charCodeAt(i); // grab ASCII integer h = (h &lt;&lt; 5) + h + ascii; // bitwise operations } return h; } </code></pre> <p>I tried using <code>BigInt</code>, but the value for the string &quot;QHChLUHDMNh5UTBUcgtLmlPziN42&quot; I'm getting is 17760568308754997342052348842020823769412069976n, compared to 357350748206983768 in Swift.</p>
[ { "answer_id": 74260179, "author": "Wouter Dijks", "author_id": 13440357, "author_profile": "https://Stackoverflow.com/users/13440357", "pm_score": 0, "selected": false, "text": "&" }, { "answer_id": 74262280, "author": "Martin R", "author_id": 1187415, "author_profil...
2022/10/31
[ "https://Stackoverflow.com/questions/74259506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5814171/" ]
74,259,573
<p>I am having trouble understanding how I am mean't to find the getLength() of an iterable in my homework. The class is supposed to be a &quot;toolkit&quot; with useful methods for working on iterables and iterators.</p> <pre><code> /** Computes the length of an Iterable. The length of an Iterable is the total number of entries it returns. public static &lt;T&gt; int getLength(Iterable&lt;T&gt; iterable) { int numEntries = 0; while(iterable.hasNext()) { numEntries++; iterable.next(); } return numEntries; } </code></pre> <p>This is what I currently have but I am getting this</p> <pre><code>Toolkit.java:30: error: cannot find symbol while(iterable.hasNext()) { ^ symbol: method hasNext() location: variable iterable of type Iterable&lt;T&gt; where T is a type-variable: T extends Object declared in method &lt;T&gt;getLength(Iterable&lt;T&gt;) </code></pre>
[ { "answer_id": 74259958, "author": "Hari", "author_id": 6434836, "author_profile": "https://Stackoverflow.com/users/6434836", "pm_score": -1, "selected": false, "text": "public static int size(`Iterable` data) {\n\n if (data instanceof Collection) {\n return ((Collection<?>) da...
2022/10/31
[ "https://Stackoverflow.com/questions/74259573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18442815/" ]
74,259,591
<p>To get the content of a document in EmEditor macros, it seems that the full content need to be selected first and then <strong>Window.Document.Selection.Text</strong> is used to get its content. But this would lose the current position and seletion status.</p> <p>Is there something like <strong>Window.Document.Content</strong> to do the job in a better way? Thank you!</p>
[ { "answer_id": 74274503, "author": "Hans", "author_id": 19358215, "author_profile": "https://Stackoverflow.com/users/19358215", "pm_score": 2, "selected": true, "text": "var content = \"\";\nnumberOfLines = document.GetLines();\nfor ( i = 1; i <= numberOfLines; i++ ) {\n content = con...
2022/10/31
[ "https://Stackoverflow.com/questions/74259591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17727069/" ]
74,259,592
<p>I have made a custom userstore by overriding the UniqueIDJDBCUserStoreManager class, based on this article <a href="https://nishothan-17.medium.com/custom-user-store-manager-for-wso2-identity-server-5-11-0-6e23a4ddf1bb" rel="nofollow noreferrer">https://nishothan-17.medium.com/custom-user-store-manager-for-wso2-identity-server-5-11-0-6e23a4ddf1bb</a> . My database has one table which has the username, password, email, name, and phone number.</p> <p>I was able to authenticate successfully. However, I am unable to send the OTP to the users phone number. Can anyone please guide me on how to send OTP to the user? Which properties do I have to set or override? Any help would be highly appreciated.</p> <p>I could not find any documentation on this so far.</p>
[ { "answer_id": 74294808, "author": "Anuradha Karunarathna", "author_id": 10055162, "author_profile": "https://Stackoverflow.com/users/10055162", "pm_score": 1, "selected": false, "text": "public Map<String, String> getUserPropertyValuesWithID(String userID, String[] propertyNames, String...
2022/10/31
[ "https://Stackoverflow.com/questions/74259592", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5409309/" ]
74,259,593
<p>I need to select records based on time(in second) listed in a MySQL database table, with a single query (no store procedures). The record set should contain all records where the sum total time equals or if needed exceeds a specific time. (Example, if i want get 4 random record where time(secound) sum is lessthen 30 second)</p> <p>Table :</p> <pre><code>+----+-------+ | id | times | +----+-------+ | 1 | 8| | 2 | 20| | 3 | 1| | 4 | 3| | 5 | 2| | 6 | 6| | 7 | 9| | 9 | 15| | 10 | 12| | 11 | 8| +----+-------+ </code></pre> <p>Like i want 4 record randomly, it's doesn't matter whis come first output will be like : 1</p> <pre><code>+----+-------+ | id | times | +----+-------+ | 2 | 20| | 3 | 1| | 5 | 2| | 6 | 6| +----+-------+ SUM OF ALL TIME IS 29 </code></pre> <p>2</p> <pre><code>+----+-------+ | id | times | +----+-------+ | 3 | 1| | 7 | 9| | 10 | 12| | 11 | 8| +----+-------+ SUM OF ALL TIME IS 30 </code></pre> <p>3</p> <pre><code>+----+-------+ | id | times | +----+-------+ | 1 | 8| | 5 | 2| | 4 | 3| | 9 | 15| +----+-------+ SUM OF ALL TIME IS 28 </code></pre> <p>Something like that</p>
[ { "answer_id": 74294808, "author": "Anuradha Karunarathna", "author_id": 10055162, "author_profile": "https://Stackoverflow.com/users/10055162", "pm_score": 1, "selected": false, "text": "public Map<String, String> getUserPropertyValuesWithID(String userID, String[] propertyNames, String...
2022/10/31
[ "https://Stackoverflow.com/questions/74259593", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20376771/" ]
74,259,599
<p>I'm trying to run the code below, but I keep getting the same error : &quot;ModuleNotFoundError: No module named 'basic_units'&quot;.</p> <pre><code>import sympy as sym import math import numpy as np import os import matplotlib.pyplot as plt from basic_units import radians fig, ax = plt.subplots(subplot_kw={'projection': 'polar'}) ax.plot([np.pi, np.pi], [0, 10], xunits=radians) plt.show() </code></pre> <p>I've seen that used in other code, but I just can't get it to work.</p> <p>I was trying to make a polar plot with the angles in radians, and this seemed to be the only solution I could find, so I tried to run this test, but I encountered this error</p>
[ { "answer_id": 74294808, "author": "Anuradha Karunarathna", "author_id": 10055162, "author_profile": "https://Stackoverflow.com/users/10055162", "pm_score": 1, "selected": false, "text": "public Map<String, String> getUserPropertyValuesWithID(String userID, String[] propertyNames, String...
2022/10/31
[ "https://Stackoverflow.com/questions/74259599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20324463/" ]
74,259,643
<p>Actually, i'm building a CSS Main Menu in Vue, it works fine when mouse hover it'll popup while hidden when mouse move out, but how can i also hide the menu when click on &quot;a&quot; hyperlink?</p> <p>I've try &quot;.menu a:active { display: none; }&quot;, but failed.</p> <pre class="lang-css prettyprint-override"><code>.menu { display: none; } .menu a { display: block; } .main:hover .menu { display: block; } </code></pre> <pre class="lang-html prettyprint-override"><code>&lt;div class=&quot;main&quot;&gt; &lt;button&gt;Main Menu Title&lt;/button&gt; &lt;div class=&quot;menu&quot;&gt; &lt;a&gt;Sub Menu Title&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
[ { "answer_id": 74294808, "author": "Anuradha Karunarathna", "author_id": 10055162, "author_profile": "https://Stackoverflow.com/users/10055162", "pm_score": 1, "selected": false, "text": "public Map<String, String> getUserPropertyValuesWithID(String userID, String[] propertyNames, String...
2022/10/31
[ "https://Stackoverflow.com/questions/74259643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/617179/" ]
74,259,671
<p>When I upload Laravel website form local to live server that I face this error</p> <p><code>SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `sessions` where `id` = E70KsnO9rKtK9ATW71zmd9AfGW1ek7nAhnD2wQjS limit 1) </code></p>
[ { "answer_id": 74259757, "author": "IslamYearul", "author_id": 14377742, "author_profile": "https://Stackoverflow.com/users/14377742", "pm_score": 1, "selected": false, "text": "DB_CONNECTION=MySQL\nDB_HOST=127.0.0.1\nDB_PORT=3306\nDB_DATABASE=pottered\nDB_USERNAME=root\nDB_PASSWORD=\n" ...
2022/10/31
[ "https://Stackoverflow.com/questions/74259671", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20376872/" ]
74,259,693
<p>My JSON file is not being properly displayed by my React script. What am I doing wrong? Any help will be appreciated. My App.js file is like:</p> <p>`</p> <pre><code>import &quot;./App.css&quot;; import title from &quot;./data/breaking.json&quot;; export default function App() { const { data } = title return ( &lt;div className=&quot;App&quot;&gt; {data} &lt;/div&gt; ); } </code></pre> <p>`</p> <p>My JSON file is like &quot;./data/breaking.json&quot;:</p> <p>`</p> <pre><code>{ &quot;pubDate&quot;:{ &quot;5&quot;:&quot;31-10-2022 06:26:18 UTC&quot;, &quot;1&quot;:&quot;31-10-2022 06:26:09 UTC&quot;, &quot;4&quot;:&quot;31-10-2022 06:24:07 UTC&quot;, &quot;3&quot;:&quot;31-10-2022 06:22:43 UTC&quot;, &quot;8&quot;:&quot;31-10-2022 06:21:59 UTC&quot;, &quot;2&quot;:&quot;31-10-2022 11:51:04 &quot;, &quot;7&quot;:&quot;31-10-2022 06:20:48 UTC&quot;, &quot;0&quot;:&quot;31-10-2022 02:20:33 &quot;, &quot;9&quot;:&quot;31-10-2022 06:20:17 UTC&quot;, &quot;10&quot;:&quot;31-10-2022 06:18:00 UTC&quot; }, &quot;timestamp&quot;:{ &quot;5&quot;:1667197578.0, &quot;1&quot;:1667197569.0, &quot;4&quot;:1667197447.0, &quot;3&quot;:1667197363.0, &quot;8&quot;:1667197319.0, &quot;2&quot;:1667197264.0, &quot;7&quot;:1667197248.0, &quot;0&quot;:1667197233.0, &quot;9&quot;:1667197217.0, &quot;10&quot;:1667197080.0 } </code></pre> <p>`</p> <p>I tried several solutions but none worked. I tried reformatting the JSON file, but that will be costly since the cron is already live. The JSON file gets periodically updated. So I was expecting it to render in real time on the browser.</p>
[ { "answer_id": 74259802, "author": "Nensi Kasundra", "author_id": 7846071, "author_profile": "https://Stackoverflow.com/users/7846071", "pm_score": 0, "selected": false, "text": "const data = title\nconsole.log(\"data==>\",data.pubDate)\nconsole.log(\"data==>\",data.timestamp)\n" }, ...
2022/10/31
[ "https://Stackoverflow.com/questions/74259693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20376881/" ]
74,259,697
<p>I have Nginx server running on machine, I set reverse proxy to angular docker app which runs on localhost:4200. Rerouting works well but angular app can't load static assets. Bellow is part of my conf.d file. If I use location to the root ( / ) everything works well looks like I missing something :(.</p> <p>`</p> <pre><code> location /auth { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://localhost:4200/; proxy_read_timeout 90; } </code></pre> <p>`</p> <p>I tried to set basehref in angular app to /auth but it doesn't work.</p>
[ { "answer_id": 74259802, "author": "Nensi Kasundra", "author_id": 7846071, "author_profile": "https://Stackoverflow.com/users/7846071", "pm_score": 0, "selected": false, "text": "const data = title\nconsole.log(\"data==>\",data.pubDate)\nconsole.log(\"data==>\",data.timestamp)\n" }, ...
2022/10/31
[ "https://Stackoverflow.com/questions/74259697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20376854/" ]
74,259,709
<p>Using Python, I would like to convert a list to string looks like this: I'm looking for a more elegant way then loops</p> <pre><code>cmd = ['cd ..', 'pwd', 'howami'] &quot;cd..; pwd; howami&quot; </code></pre> <p>Thanks in advance (it is my first question BTW, please be gentle)</p> <p>Roy</p> <pre><code>for cmdStr in cmd:
 cmdString += cmdStr + '; ' cmdString.rstrip('; ') </code></pre>
[ { "answer_id": 74259732, "author": "Origin", "author_id": 12289730, "author_profile": "https://Stackoverflow.com/users/12289730", "pm_score": 2, "selected": false, "text": "join" }, { "answer_id": 74259736, "author": "w8eight", "author_id": 11598566, "author_profile":...
2022/10/31
[ "https://Stackoverflow.com/questions/74259709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20376879/" ]
74,259,718
<p>In my table, I have a 'start_date' and 'end_date' column,</p> <p>eg:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>start_date</th> <th>end_date</th> </tr> </thead> <tbody> <tr> <td>2000/12/12</td> <td>2010/10/12</td> </tr> <tr> <td>1988/12/12</td> <td>2003/04/03</td> </tr> <tr> <td>1994/12/12</td> <td>2008/09/21</td> </tr> </tbody> </table> </div> <p>What is the statement that I need to use to extract the years between the start &amp; end date? I want to create &amp; view another column called <em><strong>AS 'num_years_worked'</strong></em> but I'm not sure what to input at the front.</p> <p>Tried a few variations from Google but couldn't get it to work.</p>
[ { "answer_id": 74259732, "author": "Origin", "author_id": 12289730, "author_profile": "https://Stackoverflow.com/users/12289730", "pm_score": 2, "selected": false, "text": "join" }, { "answer_id": 74259736, "author": "w8eight", "author_id": 11598566, "author_profile":...
2022/10/31
[ "https://Stackoverflow.com/questions/74259718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10237882/" ]
74,259,724
<p>here as you can see I am calling a service and response data is bind to ELEMENT_DATA variable. but hard corded value is only showing in UI. API response data not showing. while I am console the ELEMENT_DATA response data is already there. but it's not rendering on UI. what mistake I am doing here.</p> <p>I am using Angular and Angular material for ui.</p> <pre class="lang-js prettyprint-override"><code>import { Component, OnInit } from '@angular/core'; import { EnumsDataService } from '@app/management/services/enums/enums-data.service'; export interface PeriodicElement { inventoryId: string; inventoryName: string; } @Component({ selector: 'app-test-comp', templateUrl: './test-comp.component.html', styleUrls: ['./test-comp.component.scss'] }) export class TestCompComponent implements OnInit { // data:any=[]; ELEMENT_DATA: PeriodicElement[] = [ {inventoryId: &quot;1&quot;, inventoryName: 'Hydrogen'}, {inventoryId: &quot;2&quot;, inventoryName: 'Helium',}, ]; constructor(private _EnumsDataService: EnumsDataService) { } ngOnInit(): void { this.getInventoryTypes(); } getInventoryTypes() { this._EnumsDataService.getInventoryTypes().then((res:any) =&gt; { // this.inventoryTypes = _.concat([this.allTypes], res); console.log(res) res.map((item:any)=&gt;{ let obj={ inventoryId:item.invTypeId, inventoryName:item.invTypeName } this.ELEMENT_DATA.push(obj) }) }); console.log(&quot;ELEMENT_DATA---------------&quot;,this.ELEMENT_DATA) } displayedColumns: string[] = ['inventoryId', 'inventoryName']; dataSource = this.ELEMENT_DATA; } </code></pre> <p>angular material code for UI</p> <pre class="lang-html prettyprint-override"><code>&lt;table mat-table [dataSource]=&quot;dataSource&quot; class=&quot;mat-elevation-z8&quot;&gt; &lt;ng-container matColumnDef=&quot;inventoryId&quot;&gt; &lt;th mat-header-cell *matHeaderCellDef&gt; invId. &lt;/th&gt; &lt;td mat-cell *matCellDef=&quot;let element&quot;&gt; {{element.inventoryId}} &lt;/td&gt; &lt;/ng-container&gt; &lt;ng-container matColumnDef=&quot;inventoryName&quot;&gt; &lt;th mat-header-cell *matHeaderCellDef&gt; invName &lt;/th&gt; &lt;td mat-cell *matCellDef=&quot;let element&quot;&gt; {{element.inventoryName}} &lt;/td&gt; &lt;/ng-container&gt; &lt;tr mat-header-row *matHeaderRowDef=&quot;displayedColumns&quot;&gt;&lt;/tr&gt; &lt;tr mat-row *matRowDef=&quot;let row; columns: displayedColumns;&quot;&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre>
[ { "answer_id": 74259818, "author": "Fabian Strathaus", "author_id": 17298437, "author_profile": "https://Stackoverflow.com/users/17298437", "pm_score": 2, "selected": false, "text": "then" }, { "answer_id": 74259821, "author": "Mr. Stash", "author_id": 13625800, "auth...
2022/10/31
[ "https://Stackoverflow.com/questions/74259724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12056439/" ]
74,259,750
<p>Check first all model if it can be saved or not.Then save.</p> <p>i tried to saved data from query. i have 3 query :</p> <pre><code>$message_header-&gt;save(); $save_receive_info-&gt;save_receive_info_id = $message_header-&gt;id; $information_receive-&gt;save(); $information_chargeline-&gt;save_receive_info_details_id = $information_receive-&gt;id; $maklumat_chargeline-&gt;save(); </code></pre> <p>so, based on this query, first it saves $message_header, then if save_receive_info, but if receive_info has an error when saving, what can I do?</p> <p>I mean, I want to check whether all queries are executable or not then save. I have a problem with this because other queries are stored based on other id</p> <p>please help. and sorry for my broken english.</p>
[ { "answer_id": 74259843, "author": "Harshana", "author_id": 6952359, "author_profile": "https://Stackoverflow.com/users/6952359", "pm_score": 1, "selected": false, "text": "use Illuminate\\Support\\Facades\\DB;\n\ntry {\n DB::beginTransaction();\n\n $message_header->save();\n\n ...
2022/10/31
[ "https://Stackoverflow.com/questions/74259750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17209972/" ]
74,259,767
<p>How to implement onChange and value props so that Image uri could be saved outside the component? Using expo ImagePicker and React Native.</p> <pre><code>type PhotoComponentProps = { value: string | undefined; onChange: (value: string | undefined) =&gt; void; }; export function PhotoComponent({value, onChange} : PhotoComponentProps) { const [pickedImage, setImage] = React.useState&lt;string | null&gt;(null); const pickImage = async () =&gt; { const result = await ImagePicker.launchImageLibraryAsync({ mediaTypes: ImagePicker.MediaTypeOptions.Images, allowsEditing: false, aspect: [4, 3], quality: 1, }); if (!result.cancelled) { setImage(result.uri); } }; function deleteImage() { setImage(() =&gt; null); } return ( &lt;View&gt; &lt;Button onPress={deleteImage} /&gt; &lt;Button onPress={openCamera} /&gt; &lt;Button onPress={pickImage} /&gt; {pickedImage &amp;&amp; &lt;Image source={{ uri: pickedImage }} style={{ width: 200, height: 200 }}/&gt; } &lt;/View&gt; ); </code></pre> <p>}</p>
[ { "answer_id": 74259843, "author": "Harshana", "author_id": 6952359, "author_profile": "https://Stackoverflow.com/users/6952359", "pm_score": 1, "selected": false, "text": "use Illuminate\\Support\\Facades\\DB;\n\ntry {\n DB::beginTransaction();\n\n $message_header->save();\n\n ...
2022/10/31
[ "https://Stackoverflow.com/questions/74259767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19865521/" ]
74,259,797
<p>Basically need to create a class which is custom type that has two integers: -1 and 1, instead of all the integers that exist.</p> <p>If you would suggest using enum (never implemented before), could you please suggest how would that work.</p> <pre><code>public class PlusOrMinusOne{ private int plusOne=1; private int minusOne=-1; } </code></pre>
[ { "answer_id": 74259883, "author": "eol", "author_id": 3761628, "author_profile": "https://Stackoverflow.com/users/3761628", "pm_score": 0, "selected": false, "text": " public enum CustomNumber {\n PLUS_ONE(1),\n MINUS_ONE(-1);\n\n public final int value;\n\n ...
2022/10/31
[ "https://Stackoverflow.com/questions/74259797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16473333/" ]
74,259,832
<p>I am trying to fetch what are the available merge requests for my repository as mentioned in the <a href="http://repositories.compbio.cs.cmu.edu/help/api/merge_requests.md#:%7E:text=To%20get%20all%20merge%20requests,the%20list%20of%20merge%20requests." rel="nofollow noreferrer">link</a>. I have entered my user id and password when doing a get call ( see picture ). But the credentials entered are not considered and on output, it is showing a login page. I am trying to add these APIs for my automatic report generation, like how many MR are open and closed this week and some details like who created it and who has made review comments.</p> <p>Even I tried with curl command after creating a personalized access token</p> <pre><code>curl --header &quot;PRIVATE-TOKEN: mQ7cszUHymhyEze9Y8BC&quot; --header &quot;Sudo: dka07&quot; &quot;https://myrepo/-/merge_requests&quot; </code></pre> <p>I got a reply</p> <pre><code>&lt;html&gt;&lt;body&gt;You are being &lt;a href=&quot;https://mygitlab/users/sign_in&quot;&gt;redirected&lt;/a&gt;.&lt;/body&gt;&lt;/html&gt; </code></pre> <p>Any help appreciated</p> <p><a href="https://i.stack.imgur.com/Jpgaq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jpgaq.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74259883, "author": "eol", "author_id": 3761628, "author_profile": "https://Stackoverflow.com/users/3761628", "pm_score": 0, "selected": false, "text": " public enum CustomNumber {\n PLUS_ONE(1),\n MINUS_ONE(-1);\n\n public final int value;\n\n ...
2022/10/31
[ "https://Stackoverflow.com/questions/74259832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7457101/" ]