question_id
int64
37.6M
73.2M
input_text
stringlengths
88
52.4k
output_text
stringlengths
37
35.6k
title
stringlengths
15
150
tags
stringlengths
1
107
q_score
int64
-19
397
view_count
int64
3
879k
answer_count
int64
1
21
accepted_answer_id
int64
37.6M
73.8M
answer_id
int64
37.6M
73.8M
a_score
int64
-5
1.29k
is_accepted
bool
1 class
creation_date
stringlengths
20
24
input_text_instruct
stringlengths
251
52.6k
72,101,133
How can use GoogleMap and get data put into array from firestore database?<p>How can use GoogleMap and get data put into array from firestore database?</p> <p>Now I can used default data and realize used marker in GoogleMap, but I need to get data from firestore database, so how could I did?</p> <p>in my code,</p> <pre...
<p>tried this one</p> <pre><code>loadData() async { final Uint8List markerIcon = await getBytesFromAsset('assets/campsite.png', 100); await FirebaseFirestore.instance.collection('Campsite').get().then( (querySnapshot) { querySnapshot.docs.forEach((element) { _markers.add( ...
How can use GoogleMap and get data put into array from firestore database?
firebase|flutter|google-cloud-firestore
0
26
1
72,107,072
72,107,072
2
true
2022-05-03T14:40:55.323Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can use GoogleMap and get data put into array from firestore database?<p>How can use GoogleMap and get data put into array from firestore database?</p> <...
72,107,343
How to merge three dataframes with same columns, different rows containing strings, float, etc?<p>I have three dataframes (df1,df2,df3) that share the same columns with the following types:</p> <pre><code>Unnamed: 0 int64 _id object dataNotificacao object cnes ...
<p>You didn't post the code you're running, but it sounds like you're passing the dataframe variable names into pd.concat as strings. It should be:</p> <pre><code>pd.concat([df1, df2, df3]) </code></pre> <p>rather than:</p> <pre><code>pd.concat(['df1','df2','df3']) </code></pre>
How to merge three dataframes with same columns, different rows containing strings, float, etc?
python|pandas|concatenation
0
25
1
72,107,374
72,107,374
2
true
2022-05-04T02:24:29.477Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to merge three dataframes with same columns, different rows containing strings, float, etc?<p>I have three dataframes (df1,df2,df3) that share the same c...
72,109,006
Java Swing: Why are my panels layered? I can't see my first panel<p>I'm trying to have one panel appear under the other (textPanel to appear under mainPanel).</p> <p>But instead, textPanel is appearing overtop of mainPanel:</p> <pre><code> FlatLightLaf.setup(); FlatLightLaf.supportsNativeWindowDecorations(); ...
<p>The default, when adding one component, without further arguments, to a <code>JFrame</code> is that the component in question will take up the entire client area, since <code>JFrame</code> uses a <code>BorderLayout</code> by default. So, your solution is to <em>use</em> a further argument, telling it to add it at th...
Java Swing: Why are my panels layered? I can't see my first panel
java|swing|panel
0
26
1
72,111,360
72,111,360
2
true
2022-05-04T06:58:19.170Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Java Swing: Why are my panels layered? I can't see my first panel<p>I'm trying to have one panel appear under the other (textPanel to appear under mainPanel)...
72,112,636
How can i check on null?<p>I have void func:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>//change state in select void _onChangeSelect(Color? newValue) { setState...
<p>you need to provide a fallback then, a color to use when it is null. for example</p> <pre><code>//change state in select void _onChangeSelect(Color? newValue) { setState(() { _selectedValue = newValue ?? Colors.white; }); } </code></pre> <p>or if you want to keep the old value</p> <pre><c...
How can i check on null?
flutter|dart
0
26
1
72,112,843
72,112,843
2
true
2022-05-04T12:02:17.863Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can i check on null?<p>I have void func:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class=...
72,113,512
Firebase database expiring - changing rules<p>My database has due to expire in two days because of rules security. I changed the default test rules yesterday, it is possible that they have not yet been noted, but to make sure they are sufficient to keep my database from expiring, I am asking you about it. Are these rul...
<p>The rules you show don't have an expiration date, so data access won't change based on the date anymore. Whether they're &quot;OK&quot; is a different matter though.</p> <p>The Realtime Database rules you show give each user access to only their own data, which is a common practice and shown in the Firebase document...
Firebase database expiring - changing rules
firebase|firebase-realtime-database|firebase-security
0
262
1
72,114,310
72,114,310
2
true
2022-05-04T13:08:56.480Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Firebase database expiring - changing rules<p>My database has due to expire in two days because of rules security. I changed the default test rules yesterday...
72,114,089
How do I check what R used as reference level for my dichotomous outcome in a GEE analysis (using geepack)?<p>I've got clustered patient data of 700 patients (clustered into two groups for two different hospitals). I'm trying to figure out if a certain cardiovacsular risk factor <code>exposure</code> (factor with 3 lev...
<p>I think you are misunderstanding something here. <code>outcome_pres</code> is your outcome, which you define as a binomial distribution, and has the values 0 and 1:</p> <pre><code>str(data) tibble [570 x 6] (S3: tbl_df/tbl/data.frame) $ id : num [1:570] 23 30 92 122 132 141 157 158 167 175 ... $ group ...
How do I check what R used as reference level for my dichotomous outcome in a GEE analysis (using geepack)?
r|mixed-models|multi-level
0
22
1
72,114,410
72,114,410
2
true
2022-05-04T13:48:30.597Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I check what R used as reference level for my dichotomous outcome in a GEE analysis (using geepack)?<p>I've got clustered patient data of 700 patients...
72,114,471
How to make a list using Networkx in Python<p>I have a list,</p> <pre><code>selected=[[0,5,9,10,0],[0,2,4,7,8,0],[0,1,3,6,0]] </code></pre> <p>It's a route of 3 cars.I want to convert it below,</p> <pre><code>selected1=[(0,5),(5,9),(9,10),(10,0),(0,2),(2,4),(4,7),(7,8),(8,0),(0,1),(1,3),(3,6),(6,0)] </code></pre> <p>I ...
<p>Using a list comprehension might do the work :</p> <pre><code>selected=[[0,5,9,10,0],[0,2,4,7,8,0],[0,1,3,6,0]] selected1 = [(s[i], s[i+1]) for s in selected for i in range(len(s)-1)] # [(0, 5), (5, 9), (9, 10), (10, 0), (0, 2), (2, 4), (4, 7), (7, 8), (8, 0), (0, 1), (1, 3), (3, 6), (6, 0)] </code></pre>
How to make a list using Networkx in Python
python|list|networkx
0
19
1
72,114,606
72,114,606
2
true
2022-05-04T14:12:44.537Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make a list using Networkx in Python<p>I have a list,</p> <pre><code>selected=[[0,5,9,10,0],[0,2,4,7,8,0],[0,1,3,6,0]] </code></pre> <p>It's a route o...
72,114,481
DotDash and TwoDash linetypes not working in ggplot2 R<p>I am trying to plot twodash and dotdash, but I only get dash as the output.</p> <pre><code>set.seed(111) var &lt;- rep(c(&quot;SP1&quot;,&quot;SP2&quot;,&quot;AB1&quot;,&quot;AB2&quot;), times = 5) var.val &lt;- rnorm(20,5,1) level &lt;- rep(c(100,200,300,400), e...
<p>Try setting <code>linetype</code> as part of the aesthetic in your <code>ggplot</code> call:</p> <pre><code>ggplot(df, aes(x = level, y = var.val, col = var, group = var, linetype = var)) + # set linetype geom_point(aes(fill = var), colour=&quot;white&quot;,pch=21, size=4, stroke = 1, alpha = 0.7, dat...
DotDash and TwoDash linetypes not working in ggplot2 R
r|ggplot2
0
24
1
72,114,648
72,114,648
2
true
2022-05-04T14:13:15.200Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: DotDash and TwoDash linetypes not working in ggplot2 R<p>I am trying to plot twodash and dotdash, but I only get dash as the output.</p> <pre><code>set.seed(...
72,115,119
Execute multiline query with Kubectl + exec + PSQL<p>I'm trying to run a query with Kubectl , as follows:</p> <pre><code>kubectl -n employeesns exec -ti employeedpoddb-0 -- psql -d db_people -U postgres -c 'create extension if not exists dblink;' -c 'SELECT dbemployees.&quot;empId&quot; , dbemployees.&quot;createdAt&...
<p>It's because your inner <code>'</code> is not escaped; you'll see the same thing locally</p> <pre><code>$ echo 'hello 'world' from shell' </code></pre> <p>you just need to escape those inner quotes, or change the outer to <code>&quot;</code> and then escape those usages, based on your needs</p> <pre class="lang-sh p...
Execute multiline query with Kubectl + exec + PSQL
postgresql|kubernetes|exec|psql|kubectl
0
260
1
72,115,706
72,115,706
2
true
2022-05-04T14:54:47.290Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Execute multiline query with Kubectl + exec + PSQL<p>I'm trying to run a query with Kubectl , as follows:</p> <pre><code>kubectl -n employeesns exec -ti empl...
72,116,161
How do I use class_name to link two specific columns<p>I have a model called Company, this model is used for both companies and clients, I know this is not the best approach for companies/clients but the software I'm working on was built that way and to change that, it would take months of job.</p> <pre><code>class Com...
<p>If I understand your question correctly (in the first para you mentioned clients and in the second you are saying customers so I am assuming clients == customers and customer is also a <code>Company</code> object) you are trying to do this:</p> <pre><code>class Order &lt; ActiveRecord::Base belongs_to :company ...
How do I use class_name to link two specific columns
ruby-on-rails|rails-activerecord
0
34
1
72,116,612
72,116,612
2
true
2022-05-04T16:10:52.120Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I use class_name to link two specific columns<p>I have a model called Company, this model is used for both companies and clients, I know this is not t...
72,117,546
How can I use substitude within `geom_textabline`'s label?<p>I am trying to use <code>substitute</code> to substitute some values into the label text of <code>geom_textabline</code>. However, it is constantly giving me the following error:</p> <blockquote> <p>Error in <code>check_aesthetics()</code>: ! Aesthetics must ...
<p>The label generated by <code>substitute</code> is being interpreted as having length 3. A workaround is to <code>deparse</code> the substitute and use <code>parse = TRUE</code>:</p> <pre class="lang-r prettyprint-override"><code>library(geomtextpath) #&gt; Loading required package: ggplot2 dSlope &lt;- 2 fontSize &...
How can I use substitude within `geom_textabline`'s label?
r|ggplot2
0
28
1
72,117,697
72,117,697
2
true
2022-05-04T18:02:06.757Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I use substitude within `geom_textabline`'s label?<p>I am trying to use <code>substitute</code> to substitute some values into the label text of <cod...
72,118,644
How to filter users that have multiple rows where row1="value1" and row2="condition2", ... in SQL?<p>A have the following data</p> <pre><code>id user_id visited_country 1 12 Spain 2 12 France 3 14 England 4 14 France 5 16 Canada 6 14 Spain 7 16 Mexico </code></pre> <p>I want ...
<p>One aggregation approach might be:</p> <pre class="lang-sql prettyprint-override"><code>SELECT user_id FROM yourTable GROUP BY user_id HAVING SUM(visited_country = 'Spain') &gt; 0 AND SUM(visited_country = 'France') &gt; 0 AND SUM(visited_country = 'England') = 0; </code></pre>
How to filter users that have multiple rows where row1="value1" and row2="condition2", ... in SQL?
mysql|sql
0
27
1
72,118,706
72,118,706
2
true
2022-05-04T19:46:34.347Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to filter users that have multiple rows where row1="value1" and row2="condition2", ... in SQL?<p>A have the following data</p> <pre><code>id user_id visi...
72,120,190
How to check if a list contains a specific words which is part of another list<p>Hello I am new to python this may be something small but I am finding it difficult on how to get output for this</p> <p>I have below list &quot;sgList&quot; which I want to check if it contains any of the specific words which is another li...
<p>One option is to wrap a generator expression in <code>any</code>. The idea is we iterate over each string in <code>checkforstrings</code> and see if it's in any string in <code>sgList</code>:</p> <pre class="lang-py prettyprint-override"><code>out = any(s in sg for s in checkforstrings for sg in sgList) </code></pre...
How to check if a list contains a specific words which is part of another list
python|python-3.x
0
20
2
72,120,237
72,120,237
2
true
2022-05-04T22:44:17.610Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to check if a list contains a specific words which is part of another list<p>Hello I am new to python this may be something small but I am finding it dif...
72,096,726
How to Fix Type 'Emits' has no call signatures, in vue 3 using script setup and typescript?<p>I have below code which is working fine but I'm getting below warnings in IDE :</p> <p><code>TS2349: This expression is not callable.   Type 'Emits' has no call signatures</code></p> <p>Here's the code :</p> <pre class="lang-h...
<p>The type argument given to <code>defineEmits</code> declares the allowed function signatures for the resulting <code>emit()</code> call.</p> <p>Since you want to be able to call <code>emit()</code> with <code>&quot;canOnline&quot;</code> as the first argument, and a boolean as the second argument, the <code>Emits</c...
How to Fix Type 'Emits' has no call signatures, in vue 3 using script setup and typescript?
typescript|vue.js|vuejs3|vue-composition-api
0
270
1
72,121,232
72,121,232
2
true
2022-05-03T08:32:32.830Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to Fix Type 'Emits' has no call signatures, in vue 3 using script setup and typescript?<p>I have below code which is working fine but I'm getting below w...
72,125,252
from module import * using full path in python<p>How do I write a code equivalent to</p> <pre><code>from mymodule import * </code></pre> <p>for a module in a given full path?</p> <p>My question is similar to this question: <a href="https://stackoverflow.com/questions/67631/how-do-i-import-a-module-given-the-full-path">...
<p>I think the easiest way is to add your full path to <code>sys.path</code>:</p> <pre><code>import sys sys.path.append('&lt;path_to_folder_with_your_module&gt;') from mymodule import * </code></pre>
from module import * using full path in python
python|python-3.x|import
0
29
1
72,125,417
72,125,417
2
true
2022-05-05T09:57:02.040Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: from module import * using full path in python<p>How do I write a code equivalent to</p> <pre><code>from mymodule import * </code></pre> <p>for a module in a...
72,125,571
How do i stop the rails sever?<p>I run this command to start my server</p> <pre><code>rails s -b 10.x.x.x </code></pre> <p>then I got this error</p> <pre><code>[1013] * Puma version: 5.2.2 (ruby 2.6.3-p62) (&quot;Fettisdagsbulle&quot;) [1013] * Min threads: 2 [1013] * Max threads: 2 [1013] * Environment: development...
<p>There are several utilities to get the PID of a proccess listening on a port.</p> <pre><code>lsof -i :3000 </code></pre> <p>Will get you the PID and then you can kill it with <code>kill [PID]</code> or force it with <code>kill -9 [PID]</code></p>
How do i stop the rails sever?
ruby-on-rails|ruby|pid
0
30
1
72,125,672
72,125,672
2
true
2022-05-05T10:21:29.280Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do i stop the rails sever?<p>I run this command to start my server</p> <pre><code>rails s -b 10.x.x.x </code></pre> <p>then I got this error</p> <pre><co...
72,115,505
Why is white box testing sometimes called glass box testing?<p>In some references, I have found that white box testing is sometimes called glass box testing. I would like to know what are the reasons behind that.</p>
<p>Black Box Testing: You can not peek inside the box (i.e. the code), all you know is the interface/API of the system under test</p> <p>White Box Testing: You can peek inside the box. White, because it is the &quot;oposite&quot; of black. I have not heard of Glass Box Testing before, but it actually makes sense, becau...
Why is white box testing sometimes called glass box testing?
unit-testing|testing|white-box-testing
0
20
1
72,129,432
72,129,432
2
true
2022-05-04T15:21:53.183Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why is white box testing sometimes called glass box testing?<p>In some references, I have found that white box testing is sometimes called glass box testing....
72,131,156
Capture data element with multiple buttons in Javascript<p>I have a store selector page that has multiple buttons for a user to select a store. Each button has a data element identifying the store ID of corresponding button (&quot;data-store-id&quot;). When a user clicks on the button, I want to capture the id of the s...
<p>You can use <code>document.querySelectorAll</code> to match all <code>.button</code> elements. Then you can iterate them all using <code>forEach</code>. In this example I bound all elements to the <code>click</code> event:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="f...
Capture data element with multiple buttons in Javascript
javascript
0
31
2
72,131,289
72,131,289
2
true
2022-05-05T17:13:01.957Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Capture data element with multiple buttons in Javascript<p>I have a store selector page that has multiple buttons for a user to select a store. Each button h...
72,132,301
How to print minimal value from two dimensional array<p>Hello everyone here is my code:</p> <pre><code>n =[[34,2,55,24,22],[31,22,4,7,333]] for r in n: for c in r: print(c,end = &quot; &quot;) print() sums=[] for i in n: sum=0 for num in i: sum+=int(num) sums.append(sum) print(*sums) m...
<p>You only need to get the minimum of each row, not the minimum of that.</p> <pre><code>print(*(min(row) for row in n)) </code></pre>
How to print minimal value from two dimensional array
python|arrays|python-3.x|list
0
30
2
72,132,332
72,132,332
2
true
2022-05-05T18:54:30.493Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to print minimal value from two dimensional array<p>Hello everyone here is my code:</p> <pre><code>n =[[34,2,55,24,22],[31,22,4,7,333]] for r in n: fo...
72,134,274
neo4j datetime wrong translation to 1970<p>I have nodes with datetime and when using conversion as: <a href="https://community.neo4j.com/t/cannot-construct-date-time-from-no-value-failure-when-processing-file/34973/3" rel="nofollow noreferrer">https://community.neo4j.com/t/cannot-construct-date-time-from-no-value-failu...
<p>You are using <code>epochmillis</code> which expect to get the timestamp in milliseconds, but your <code>created_at</code> is in seconds. Just multiply it by 1000 before inserting to <code>epochmillis</code></p>
neo4j datetime wrong translation to 1970
datetime|neo4j|utc
0
22
1
72,136,932
72,136,932
2
true
2022-05-05T22:33:31.640Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: neo4j datetime wrong translation to 1970<p>I have nodes with datetime and when using conversion as: <a href="https://community.neo4j.com/t/cannot-construct-d...
72,139,417
SQLAlchemy use calculated column<p>I want some code like below:</p> <pre><code>distance = (Robot.pose_x)**2 + (Robot.pose_y)**2 robot_filtered = session.query(Robot).filter(distance &gt; 100).all() </code></pre> <p>But it gives <code>TypeError: unsupported operand type(s) for ** or pow(): 'InstrumentedAttribute' and 'i...
<p>Using <code>sqlalchemy.func</code> will likely do the job, I've never done this so you'll have to test the exact syntax, but it should be something like this:</p> <pre><code>distance = func.pow(Robot.pose_x, 2) + func.pow(Robot.pose_y, 2) </code></pre>
SQLAlchemy use calculated column
python|sqlalchemy
0
33
1
72,139,495
72,139,495
2
true
2022-05-06T09:43:37.547Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQLAlchemy use calculated column<p>I want some code like below:</p> <pre><code>distance = (Robot.pose_x)**2 + (Robot.pose_y)**2 robot_filtered = session.quer...
72,139,477
Pandas Dataframe Categorical data transformation<p>I am having pandas dataframe as follows:</p> <pre><code>import pandas as pd # dictionary with list object in values # Item=[Item1, Item2, Item3] details = { 'Date' : ['2022-01-09', '2022-01-09', '2022-01-09', '2022-01-10', '2022-01-10'], 'Item' : ['Item1', ...
<p>Use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.pivot_table.html" rel="nofollow noreferrer"><code>DataFrame.pivot_table</code></a> with <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.assign.html" rel="nofollow noreferrer"><code>DataFrame.as...
Pandas Dataframe Categorical data transformation
python|pandas|dataframe
0
33
1
72,139,508
72,139,508
2
true
2022-05-06T09:48:15.617Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas Dataframe Categorical data transformation<p>I am having pandas dataframe as follows:</p> <pre><code>import pandas as pd # dictionary with list obje...
72,139,448
Error with default value in enum field when define model class<p>Hello I have the following model:</p> <pre><code>class Status(Enum): scheduled: 'scheduled' recording: 'recording' complete: 'complete' failed: 'failed' @dataclass class Record(db.Model): __tablename__ = 'records' id: int sta...
<p>The correct syntax to define enums in Python is:</p> <pre><code>class Status(Enum): scheduled = 'scheduled' </code></pre> <p>What you did was type hinting.</p>
Error with default value in enum field when define model class
python|flask|sqlalchemy|flask-sqlalchemy
0
34
1
72,139,837
72,139,837
2
true
2022-05-06T09:45:54.653Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Error with default value in enum field when define model class<p>Hello I have the following model:</p> <pre><code>class Status(Enum): scheduled: 'schedul...
72,138,892
How to include model attribute automatically?<p>I have the <code>User</code> model which define the following attribute:</p> <pre><code>public function getAvatarUrlAttribute() { return 'https://i.pravatar.cc/300?u=' . $this-&gt;email; } </code></pre> <p>I usually access to this attribute using something like:</...
<p>You need to explicitly tell Laravel that you want to include it when you convert it to an array using <a href="https://laravel.com/docs/9.x/eloquent-serialization#appending-values-to-json" rel="nofollow noreferrer"><code>appends</code></a>:</p> <pre class="lang-php prettyprint-override"><code>&lt;?php class User { ...
How to include model attribute automatically?
php|laravel|eloquent|laravel-8
0
36
1
72,139,857
72,139,857
2
true
2022-05-06T09:03:43.550Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to include model attribute automatically?<p>I have the <code>User</code> model which define the following attribute:</p> <pre><code>public function getAv...
72,139,911
How do I import a full package but still call specific methods from a package directly?<p>I'm trying to both a module and an import from a module.</p> <p>I've been using <code>from time import sleep</code> for a few years now, but I'm wanting access to more of the features from the package.</p> <p>My issue is if I use ...
<p>Use the <code>*</code> keyword.</p> <pre class="lang-py prettyprint-override"><code>from time import * </code></pre> <p>But beware, it is generally bad practice as you might get some naming clashes, and using <code>time.sleep()</code> makes it clear to whoever reading the code which module you are using.</p>
How do I import a full package but still call specific methods from a package directly?
python
0
15
1
72,139,931
72,139,931
2
true
2022-05-06T10:19:33.717Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I import a full package but still call specific methods from a package directly?<p>I'm trying to both a module and an import from a module.</p> <p>I'v...
72,139,687
How to use mutate() +across() only for specific rows<p>The data:</p> <pre><code>df &lt;- tribble( ~name, ~val.I, ~val.V, ~`val.%`, &quot;Peter&quot;, 123, 12.4, 14, &quot;Peter in %&quot;, 111, 532, 57, &quot;Harald&quot;, 2222, 3333, 444, &quot;Harald in %&quot;, 22, 15, 203, ) </code></pre> <p>I would like ...
<p>A <code>dplyr</code> option with <code>mutate</code> and <code>across</code> using <code>matches</code> for the specific columns. You can use the following code:</p> <pre><code>library(dplyr) df %&gt;% mutate(across(matches(&quot;.I|.V&quot;), ~ if_else(row_number() %in% grep(&quot;in %&quot;, name), ./100, .)))...
How to use mutate() +across() only for specific rows
r|dplyr|stringr
0
157
2
72,139,969
72,139,969
2
true
2022-05-06T10:02:52.600Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use mutate() +across() only for specific rows<p>The data:</p> <pre><code>df &lt;- tribble( ~name, ~val.I, ~val.V, ~`val.%`, &quot;Peter&quot;, 123...
72,140,073
Alternative for File.createTempFile?<p>I don't want the extra number after file name when it is created using createTempFile. But I believe it is not possible to remove them. (<a href="https://stackoverflow.com/questions/28334440/how-to-change-default-name-in-createtempfile">How to change default name in createTempFile...
<p>You can create a temporary directory, which will be created in the directory that according to your operating system is the right place to create temporary directories, using <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/nio/file/Files.html#createTempDirectory(java.nio.file.Path,java.lan...
Alternative for File.createTempFile?
java|file
0
46
1
72,140,145
72,140,145
2
true
2022-05-06T10:31:56.600Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Alternative for File.createTempFile?<p>I don't want the extra number after file name when it is created using createTempFile. But I believe it is not possibl...
72,140,513
Create unique row values in new column based on matching criteria in R<p>I have a dataframe with one identifier column of unique values, and one column which contains specific criteria.</p> <p>I want to create a new identifier column of unique values, but where the value also contains information about which criteria i...
<p>You can just add <code>group_by(Criteria)</code>:</p> <pre><code>library(dplyr) df %&gt;% group_by(Criteria) %&gt;% mutate( ID2 = case_when( Criteria == &quot;Crit 1&quot; ~ paste0(&quot;x&quot;, seq_along(Criteria)), Criteria == &quot;Crit 2&quot; ~ paste0(&quot;y&quot;, seq_along(Criteria)), ...
Create unique row values in new column based on matching criteria in R
r|dplyr
0
28
1
72,140,566
72,140,566
2
true
2022-05-06T11:08:25.397Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create unique row values in new column based on matching criteria in R<p>I have a dataframe with one identifier column of unique values, and one column which...
72,140,479
How to merge two lists using LINQ Suming a especific field when the id matched<p>Considering I have 2 list (firstList and secondList), both with same properties, but with diffent values.</p> <p>I need the result merge both lists, but it must consider the case the field IdALuno match de Id of the second List it should ...
<p>You can use <code>System.Linq</code> to:</p> <ol> <li>Group by <code>IdALuno</code> and sum all <code>Nota</code>.</li> <li>Order by <code>IdALuno</code>.</li> </ol> <pre class="lang-cs prettyprint-override"><code>using System.Linq; List&lt;Semestre&gt; result = new List&lt;Semestre&gt;(); result.AddRange(semestre...
How to merge two lists using LINQ Suming a especific field when the id matched
c#|list|linq
0
66
1
72,140,569
72,140,569
2
true
2022-05-06T11:05:14.470Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to merge two lists using LINQ Suming a especific field when the id matched<p>Considering I have 2 list (firstList and secondList), both with same proper...
72,140,380
VSCode how to know when editor is not split?<p>Until now, I used <code>cmd+2</code> to split the editor on Visual Studio Code and then <code>cmd+1</code> and <code>cmd+2</code> to move between the split editors. This shortcut stopped working for some reason, and I can't set it on the keyboard shortcut menu either. I ch...
<p>The <a href="https://code.visualstudio.com/api/references/when-clause-contexts#available-contexts" rel="nofollow noreferrer"><code>multipleEditorGroups</code> when clause context</a> returns true when there's more than one editor group open.</p>
VSCode how to know when editor is not split?
visual-studio-code
0
27
2
72,140,607
72,140,607
2
true
2022-05-06T10:56:54.190Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: VSCode how to know when editor is not split?<p>Until now, I used <code>cmd+2</code> to split the editor on Visual Studio Code and then <code>cmd+1</code> and...
72,140,363
Is there a way to force using annotation only on a var property<p>I'm making an annotation processor for encrypting personal data due to law. So in order to encrypt those field it should be able to set new value so I want my annotation to force using only on a var property.</p> <pre><code>@Retention(AnnotationRetention...
<p>If you only include <code>PROPERTY_SETTER</code> in the annotation targets, the annotation can only be applied to property setters, which is effectively what you want - since a property setter <em>implies</em> a mutable property.</p> <pre><code>@Retention(AnnotationRetention.RUNTIME) @Target(AnnotationTarget.PROPERT...
Is there a way to force using annotation only on a var property
kotlin|annotation-processing
0
71
1
72,140,640
72,140,640
2
true
2022-05-06T10:55:41.177Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to force using annotation only on a var property<p>I'm making an annotation processor for encrypting personal data due to law. So in order to ...
72,140,810
How to insert text after a certain string in a file with variables<p>I have these variables:</p> <pre><code>file_path=&quot;/home/dir/file.xml&quot; string=&quot;&lt;host mac='0A:00:DD:D2:00:02' name='vfp-20vr' ip='10.10.1.122'/&gt;&quot; </code></pre> <p>This is the content of <code>file.xml</code></p> <pre><code>&lt;...
<p>You are not too far:</p> <pre class="lang-sh prettyprint-override"><code>sed -i &quot;/&lt;dhcp&gt;/a \ \ \ \ \ \ ${string}&quot; &quot;${file_path}&quot; </code></pre> <ul> <li><code>-i</code> to change input file</li> <li><code>/&lt;dhcp&gt;/</code> to select only <code>dhcp</code> open tag</li> <li>(<code>\ </cod...
How to insert text after a certain string in a file with variables
string|bash|sed|match
0
84
7
72,141,091
72,141,091
2
true
2022-05-06T11:32:44.523Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to insert text after a certain string in a file with variables<p>I have these variables:</p> <pre><code>file_path=&quot;/home/dir/file.xml&quot; string=&...
72,140,789
Azure Data Factory - Parameter interpolation<p>I'm trying to add a pipeline parameter into the body of a post request to an Azure Function app in Azure Data Factory. It appears that the string isn't getting replaced, but the Microsoft documentation suggests I'm doing it the right way. See here: <a href="https://docs.mi...
<p>As mentioned in this <a href="https://docs.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions" rel="nofollow noreferrer">document</a>, wrap your parameter inside braces <code>@{pipeline().parameters.ParameterName}</code>.</p> <p>Below is the example with my sample API post body:</p> <p...
Azure Data Factory - Parameter interpolation
azure|azure-functions|azure-data-factory
0
143
1
72,141,146
72,141,146
2
true
2022-05-06T11:30:42.377Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Azure Data Factory - Parameter interpolation<p>I'm trying to add a pipeline parameter into the body of a post request to an Azure Function app in Azure Data ...
72,141,234
Allows CSS Grid columns to be shorter than the Grid Gap to prevent overflow<p>I'm working on my <a href="https://v4.tocas-ui.com/en-us/grid.html" rel="nofollow noreferrer">grid system</a> that allows up to 16 columns per row and each was divided with <code>1rem</code> gap.</p> <p><a href="https://i.stack.imgur.com/O5RZ...
<p>Use <code>min()</code> on the gap to decrease it when the container is small:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.grid { display: grid; gap: min(1rem, 5%)...
Allows CSS Grid columns to be shorter than the Grid Gap to prevent overflow
css|css-grid
0
149
1
72,141,381
72,141,381
2
true
2022-05-06T12:08:00.780Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Allows CSS Grid columns to be shorter than the Grid Gap to prevent overflow<p>I'm working on my <a href="https://v4.tocas-ui.com/en-us/grid.html" rel="nofoll...
72,141,213
How to fix not working keybind in WebStorm IDE<p>I generally have a bunch of custom keybinds for WebStorm, but this one particularly does not work - <code>Select opened file</code>. I've bound it with different key combinations (see screenshots below), and also I've verified that it does not conflict with any MacOS key...
<p>It's a known usability issue, <a href="https://youtrack.jetbrains.com/issue/IDEA-271054" rel="nofollow noreferrer">IDEA-271054</a>. The actual action you need assigning a shortcut to is <strong>Other | Select File in Project View</strong>:</p> <p><a href="https://i.stack.imgur.com/ERLCm.png" rel="nofollow noreferrer...
How to fix not working keybind in WebStorm IDE
webstorm|jetbrains-ide|key-bindings
0
21
1
72,141,549
72,141,549
2
true
2022-05-06T12:06:10.883Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to fix not working keybind in WebStorm IDE<p>I generally have a bunch of custom keybinds for WebStorm, but this one particularly does not work - <code>Se...
72,141,604
Cannot get div items ordered out of sequence with bootstrap<p>I have included the <code>bootstrap 3.4.1</code> in my <code>Angular 12</code> project and placed this HTML on my <code>app.component</code> page:</p> <pre><code>&lt;div class=&quot;container&quot;&gt; ... &lt;div class=&quot;d-flex row&quot;&gt; &lt...
<p>Those <a href="https://getbootstrap.com/docs/4.0/layout/grid/#order-classes" rel="nofollow noreferrer">utility classes</a> belong to bootstrap 4, you can use <code>order-first</code> and <code>order-last</code> to simplify</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="f...
Cannot get div items ordered out of sequence with bootstrap
css|twitter-bootstrap-3|flexbox
0
26
1
72,141,792
72,141,792
2
true
2022-05-06T12:38:02.387Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cannot get div items ordered out of sequence with bootstrap<p>I have included the <code>bootstrap 3.4.1</code> in my <code>Angular 12</code> project and plac...
72,141,782
FieldError at /teacher/8/. Cannot resolve keyword 'teacher' into field. Choices are: classroom, faculty, faculty_id, id, name<p>I reach the error in my django project when I was trying to display my view. The problem seems like related to the Course model but i honestly dont know where to begin with it.</p> <p>My Teach...
<p>This happens because of the following line:</p> <pre><code>course = Course.objects.filter(teacher=teacher) </code></pre> <p>The <code>Course</code> model has no field <code>teacher</code>, so you can't filter by it. To fix it there are two options:</p> <p>Add a field to <code>Course</code>:</p> <pre><code>teacher = ...
FieldError at /teacher/8/. Cannot resolve keyword 'teacher' into field. Choices are: classroom, faculty, faculty_id, id, name
python|django
0
41
1
72,142,197
72,142,197
2
true
2022-05-06T12:53:20.907Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: FieldError at /teacher/8/. Cannot resolve keyword 'teacher' into field. Choices are: classroom, faculty, faculty_id, id, name<p>I reach the error in my djang...
72,142,063
Changing key name of a dictionary by comparing while keeping key value python<p>I have a dict with two strings &quot;Candy-one&quot; and &quot;Candy-two&quot; as the key and Capacity as the key pair. I wish to replace the strings &quot;Candy-one&quot; and &quot;Candy-two&quot; with the Brand-Name which has the same can...
<p>Using a double loop is not efficient (quadratic complexity).</p> <p>Here is how I would solve it:</p> <pre><code>def Brand(f,p): # create a mapping dictionary d = {tuple(x[2:4]): x[0] for x in p[1:]} # output a new dictionary with replaced keys # or old key if a new one is not found return {d.ge...
Changing key name of a dictionary by comparing while keeping key value python
python|dictionary|for-loop|while-loop
0
40
3
72,142,354
72,142,354
2
true
2022-05-06T13:14:02.567Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Changing key name of a dictionary by comparing while keeping key value python<p>I have a dict with two strings &quot;Candy-one&quot; and &quot;Candy-two&quot...
72,142,018
cdi bean lack of value when accessed through public field<p>I have a configuration class, which I inject into another class.</p> <p>Configuration class looks as follows:</p> <pre><code>@RequestScoped public class Configuration { @ConfigProperty(name = &quot;VALUE&quot;) public String value; public String ...
<p>This is expected, because your <code>Configuration</code> bean is <code>@RequestScoped</code>. The request scope is one of so-called <em>normal scopes</em>, and whenever you <code>@Inject</code> a normal-scoped bean, you will always get a so-called <em>client proxy</em>.</p> <p>The client proxy exists to lookup the ...
cdi bean lack of value when accessed through public field
java|dependency-injection|cdi|quarkus
0
47
1
72,142,435
72,142,435
2
true
2022-05-06T13:10:41.883Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: cdi bean lack of value when accessed through public field<p>I have a configuration class, which I inject into another class.</p> <p>Configuration class looks...
72,142,526
Azure SQL: generate JSON with column as key<p>I have the below data in my sql server table</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Name</th> <th>Value</th> <th>ValueHash</th> </tr> </thead> <tbody> <tr> <td>country</td> <td>aaa</td> <td>zzz</td> </tr> <tr> <td>lastname</td> <td>ccc<...
<p>Unfortunately, SQL Server does not have <code>JSON_AGG</code> or <code>JSON_OBJECT_AGG</code>. So you need to hack it with <code>STRING_AGG</code> and <code>STRING_ESCAPE</code></p> <pre class="lang-sql prettyprint-override"><code>SELECT '{' + STRING_AGG( CONCAT( '&quot;', STRING_ESCAPE(u.Name, 'json')...
Azure SQL: generate JSON with column as key
sql|json|sql-server|azure-sql-database
0
39
3
72,142,701
72,142,701
2
true
2022-05-06T13:46:52.487Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Azure SQL: generate JSON with column as key<p>I have the below data in my sql server table</p> <div class="s-table-container"> <table class="s-table"> <thead...
72,143,252
accessing object json.`params` (reserved keyword) from (dynamic)json in c#<p>I am calling an api which returns some json. The format of the received json is as follows:</p> <pre><code>{ &quot;method&quot;: &quot;depth.update&quot;, &quot;params&quot;: [ true, { &quot;asks&quot;: [ [ ...
<p>Because <code>params</code> is a keyword for c#, you can try to use <code>@</code> to escape <a href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/" rel="nofollow noreferrer">keyword</a></p> <pre><code>json.@params </code></pre>
accessing object json.`params` (reserved keyword) from (dynamic)json in c#
c#|json
0
35
1
72,143,280
72,143,280
2
true
2022-05-06T14:37:04.617Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: accessing object json.`params` (reserved keyword) from (dynamic)json in c#<p>I am calling an api which returns some json. The format of the received json is ...
72,142,753
Custom Provider: Object literal may only specify known properties, and 'provide' does not exist in type<p>I'm trying to replace my logger provider in a unit test file with a stubbed provider so that I don't get logs during unit tests from the tested module. I'm getting the following error:</p> <pre><code>error TS2322: ...
<p>Custom providers go in the <code>providers</code> array, not the <code>imports</code>. Providers <strong>never</strong> go in the <code>imports</code> array.</p>
Custom Provider: Object literal may only specify known properties, and 'provide' does not exist in type
typescript|testing|nestjs
0
223
1
72,143,774
72,143,774
2
true
2022-05-06T14:02:12.280Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Custom Provider: Object literal may only specify known properties, and 'provide' does not exist in type<p>I'm trying to replace my logger provider in a unit ...
72,143,731
Checking if the entered date is the start of a quarter<p>Good afternoon! Can you please tell me how to implement a function that checks if the passed date is the beginning of the quarter? I tried to implement validation using the moment.js library and created a function</p> <pre><code>const isStartOfQuarter = (date: st...
<p>I would not suggest using momentjs. Even the authors <a href="https://momentjs.com/docs/" rel="nofollow noreferrer">recommend using alternatives</a> for new developments.</p> <p>In this case it is quite easy to do with native JavaScript, as there aren't that many quarters after all:</p> <p><div class="snippet" data-...
Checking if the entered date is the start of a quarter
javascript|typescript|date|validation|momentjs
0
48
2
72,143,889
72,143,889
2
true
2022-05-06T15:12:13.627Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Checking if the entered date is the start of a quarter<p>Good afternoon! Can you please tell me how to implement a function that checks if the passed date is...
72,143,750
Flutter: Using a (Future) http post request in ChangeNotifier<p>in one of my ChangeNotifier, if have an authentificate method. This is a method, that gets an auth - token with a Future gettoken function and then sets the some values of the LoginController class.</p> <p>When I call the <strong>.authentificate</strong> u...
<p>Change <code>authenticate</code> function to asynchronous and await <code>getToken</code>.</p> <pre><code> Future&lt;void&gt; authenticate(String username,String password) async { final token_string = await getToken(username, password); ... notifyListeners(); } </code></pre>
Flutter: Using a (Future) http post request in ChangeNotifier
flutter|flutter-provider
0
49
1
72,143,976
72,143,976
2
true
2022-05-06T15:13:08.390Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flutter: Using a (Future) http post request in ChangeNotifier<p>in one of my ChangeNotifier, if have an authentificate method. This is a method, that gets an...
72,144,072
tag occurrences of a value multiple times inn column based on dates using pandas<p>Below is my dataframe:</p> <pre><code>df = pd.DataFrame({'ID':[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 'date': ['2020-12-1', '2020-12-2', '2020-12-3', '2020-12-4', '2020-12-10', '2020-12-11', ...
<p>Chain <code>cumsum</code> with <code>shift</code></p> <pre><code>df['id2'] = df.name.ne(df.name.shift()).cumsum() df Out[456]: ID date name id2 0 1 2020-12-1 a 1 1 1 2020-12-2 a 1 2 1 2020-12-3 a 1 3 1 2020-12-4 a 1 4 1 2020-12-10 b 2 5 1 2020-12...
tag occurrences of a value multiple times inn column based on dates using pandas
python|pandas
0
36
1
72,144,103
72,144,103
2
true
2022-05-06T15:36:19.337Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: tag occurrences of a value multiple times inn column based on dates using pandas<p>Below is my dataframe:</p> <pre><code>df = pd.DataFrame({'ID':[1, 1, 1, 1,...
72,143,841
Generate multiple new pandas dataframes using lists and for loops<p>I have the following dataframe:</p> <pre><code>import pandas as pd import numpy as np from numpy import rec, nan df1=pd.DataFrame.from_records(rec.array([(202001L, 2020L, 'apples', 'CA', 100L), (202002L, 2020L, 'apples', 'CA', 150L), ...
<p>Another approach to @VMSMani 's answer would be to leverage dictionaries:</p> <pre class="lang-py prettyprint-override"><code>df_annual = {} for c in df1['country'].unique(): df_annual[c] = df1.where(df1['country'] == c).groupby(['year', 'prod', 'country']).sum()[['rev']] </code></pre> <p>the &quot;only&quot; di...
Generate multiple new pandas dataframes using lists and for loops
python|python-3.x|pandas|dataframe|numpy
0
64
2
72,144,227
72,144,227
2
true
2022-05-06T15:19:15.297Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Generate multiple new pandas dataframes using lists and for loops<p>I have the following dataframe:</p> <pre><code>import pandas as pd import numpy as np fro...
72,143,980
Issues with Pytorch and Torchvision on MAC M1 - python / conda<p>Im trying to run Pytorch and Torchvision on Mac M1. I follow these instructions successfully install pytorch and run it natively on apple - <a href="https://betterprogramming.pub/how-to-install-pytorch-on-apple-m1-series-512b3ad9bc6" rel="nofollow norefer...
<p>Solved this - the issues was in the Torchvision functional.py script.</p> <ul> <li>In the error it mentioned which files were trying to pull this function . I searched in /Users/gracecol/miniconda3/envs/tv/lib/python3.10/site-packages/torchvision/transforms</li> </ul> <p>for PILLOW_VERSION and in functional.py I had...
Issues with Pytorch and Torchvision on MAC M1 - python / conda
python|pytorch|conda|torchvision
0
796
1
72,144,453
72,144,453
2
true
2022-05-06T15:29:29.370Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Issues with Pytorch and Torchvision on MAC M1 - python / conda<p>Im trying to run Pytorch and Torchvision on Mac M1. I follow these instructions successfully...
72,144,134
How does one close stdin from the windows CMD prompt?<p>I know that one can close <code>stdin</code> when executing a command from a Linux CLI using logic such as:</p> <pre><code>0&lt;&amp;- &lt;command&gt; </code></pre> <p>This simulates/emulates running an application unattended, or within a CI/CD system such as Jenk...
<p>You can try</p> <pre><code>command &lt;nul </code></pre> <p>which basically means &quot;take any input from the NUL device (as an infinite source of &quot;CRLF&quot;'s). This works as long as <code>command</code> takes its input from STDIN (like the <code>pause</code> command) <em>and</em> doesn't flush the input bu...
How does one close stdin from the windows CMD prompt?
windows|batch-file|cmd|stdin
0
101
1
72,144,494
72,144,494
2
true
2022-05-06T15:40:32.763Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How does one close stdin from the windows CMD prompt?<p>I know that one can close <code>stdin</code> when executing a command from a Linux CLI using logic su...
72,142,901
Function not found when converting string to boolean in Firestore security rules<p>I'm writing a <a href="https://firebase.google.com/docs/rules/basics" rel="nofollow noreferrer">security rule on Firestore</a> that converts a string into a boolean. According to the <a href="https://firebase.google.com/docs/reference/ru...
<p><em>firebaser here</em></p> <p>I checked with our engineering team who looked at the code for this part of the rules engine, and this may have been some wishful thinking on the part of the writer of that documentation: no built-in <code>bool</code> function exists.</p> <p>The good news is that you can define a funct...
Function not found when converting string to boolean in Firestore security rules
firebase|google-cloud-firestore|firebase-security
0
40
1
72,144,636
72,144,636
2
true
2022-05-06T14:12:35.167Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Function not found when converting string to boolean in Firestore security rules<p>I'm writing a <a href="https://firebase.google.com/docs/rules/basics" rel=...
72,144,281
Parsing list in bash<p>I have a text file which looks like this:</p> <pre><code>... unique_trigger = item1 item2 item3 ... itemN unique_end_trigger ... </code></pre> <p>Is there a quick (maybe on-liner if possible) bash script I could use to parse the ...
<p>perl:</p> <pre class="lang-sh prettyprint-override"><code>perl -0777 -pE 's/.*unique_trigger\s*=\s*(.*)unique_end_trigger.*/$1/s; s/^\s+//gm' file.txt </code></pre> <pre class="lang-none prettyprint-override"><code>item1 item2 item3 ... itemN </code></pre>
Parsing list in bash
bash|shell
0
121
5
72,145,485
72,145,485
2
true
2022-05-06T15:51:56.557Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Parsing list in bash<p>I have a text file which looks like this:</p> <pre><code>... unique_trigger = item1 item2 item3 ...
72,145,195
What is this R call with current continuation code doing?<p>Here is a small chunk of R from Luke Tierney's codetools package:</p> <pre class="lang-r prettyprint-override"><code>if (! exists(&quot;callCC&quot;)) callCC &lt;- function(fun) { value &lt;- NULL delayedAssign(&quot;throw&quot;, return(value)) fun...
<p>Have you read the help page?</p> <blockquote> <p>callCC provides a non-local exit mechanism that can be useful for early termination of a computation. callCC calls fun with one argument, an exit function. The exit function takes a single argument, the intended return value. If the body of fun calls the exit function...
What is this R call with current continuation code doing?
r
0
30
1
72,145,666
72,145,666
2
true
2022-05-06T17:12:23.930Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is this R call with current continuation code doing?<p>Here is a small chunk of R from Luke Tierney's codetools package:</p> <pre class="lang-r prettypr...
72,142,560
Vibrate after a button is clicked (x) amount of times<p>As the title says i am trying to trigger a vibration when the button is clicked x amount of times. For example when the button is clicked 3 times I want a vibration.</p> <p>This is the code i am using:</p> <pre><code>import SwiftUI import AudioToolbox struct Con...
<p>You'd need increment a value, then once the value is reached do something. It's fairly straightforward, a simple approach could be done like this below.</p> <pre class="lang-swift prettyprint-override"><code>import SwiftUI import AudioToolbox struct ContentView: View { @State var value = 0 var body: some Vi...
Vibrate after a button is clicked (x) amount of times
ios|swift|swiftui
0
77
1
72,145,909
72,145,909
2
true
2022-05-06T13:48:39.610Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Vibrate after a button is clicked (x) amount of times<p>As the title says i am trying to trigger a vibration when the button is clicked x amount of times. Fo...
72,145,599
FFmpeg change video speed with -r vs -filter and setpts<p>If I want to change the video speed with ffmpeg,</p> <p>what exactly is the difference changing the fps:</p> <p><code>ffmpeg -y -r 10 -i video.mp4 video_new_fps.mp4</code></p> <p>or using filter and setpts:</p> <p><code>ffmpeg -i video.mp4 -filter:v &quot;setpts...
<p>IMO, the latter is a universal safer approach. If the input video stream uses a constant framerate, then both should result in the identical output. If the input framerate is variable, <code>-r</code> input option will mess up the timing, I presume.</p>
FFmpeg change video speed with -r vs -filter and setpts
ffmpeg|video-processing|frame-rate
0
288
1
72,146,132
72,146,132
2
true
2022-05-06T17:53:04.617Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: FFmpeg change video speed with -r vs -filter and setpts<p>If I want to change the video speed with ffmpeg,</p> <p>what exactly is the difference changing the...
72,146,100
Is there any way to return the color of a JTextField?<p>For example if you set the color of a textfield as <code>Color.RED</code>, is there a method to actually return that color?</p> <p>I found a method in the Oracle logs called <code>getCaretColor()</code> but it doesn't seem to return the right thing...</p>
<p>JTextField inherits <code>getBackground()</code> and <code>getForeground()</code> from Component. If I understand your question, that should get you the values.</p>
Is there any way to return the color of a JTextField?
java|swing
0
39
2
72,146,365
72,146,365
2
true
2022-05-06T18:45:32.510Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there any way to return the color of a JTextField?<p>For example if you set the color of a textfield as <code>Color.RED</code>, is there a method to actua...
72,146,526
How can you graph multiple overlapping 18 month periods with daily data?<p>I am doing an exploratory data analysis for data that is collected at the daily level over many years. The relevant time period is about 18 - 20 months from the same date each year. What I would like to do is visually inspect these 18 month peri...
<p>Since you have overlapping spans of time, I think we can <code>lapply</code> over your end dates, mutate the data a little, then use normal <code>ggplot2</code> aesthetics to color them.</p> <pre class="lang-r prettyprint-override"><code>spans &lt;- bind_rows(lapply(mdy(&quot;11/10/2010&quot;, &quot;11/10/2011&quot;...
How can you graph multiple overlapping 18 month periods with daily data?
r|ggplot2|time-series
0
38
1
72,146,718
72,146,718
2
true
2022-05-06T19:29:52.877Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can you graph multiple overlapping 18 month periods with daily data?<p>I am doing an exploratory data analysis for data that is collected at the daily le...
72,147,318
Is there a solution for a bitwise logical AND (&) operator between two Enum values in C#<p>Consider the following simple Flags Enum in C#:</p> <pre><code>[Flags] public enum CountingEnum { Zero = 0, One = 1 &lt;&lt; 0, Two = 1 &lt;&lt; 1, Three = Two | One, Four = 1 &lt;&lt; 2, Five = Four | One...
<p>If their signs are not important, you can try to unsigned integer type conversion.</p> <pre><code>public static bool Contains(this Enum value, Enum target) { uint y = Convert.ToUInt32(value); uint z = Convert.ToUInt32(target) return (y &amp; z) == z; } </code></pre>
Is there a solution for a bitwise logical AND (&) operator between two Enum values in C#
c#|enums|bitwise-operators|bitwise-and|enum-flags
0
95
1
72,147,429
72,147,429
2
true
2022-05-06T21:01:34.280Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a solution for a bitwise logical AND (&) operator between two Enum values in C#<p>Consider the following simple Flags Enum in C#:</p> <pre><code>[Fl...
72,147,631
(Pandas, Python) Selecting indices of a parent DF based on shared column values with a child DF<p>(I recently asked this question on r/learnpython (<a href="https://www.reddit.com/r/learnpython/comments/uifnc5/pandas_selecting_indices_of_a_parent_df_based_on/" rel="nofollow noreferrer">here</a>), but didn't get any fee...
<p>One option is to use <code>MultiIndex.map</code>:</p> <pre class="lang-py prettyprint-override"><code>cols = ['x1','x2'] X['A'] = X.set_index(cols).index.map(Y.set_index(cols)['A']).fillna(0).astype(int) </code></pre> <p>Another option is left-merge on two columns:</p> <pre class="lang-py prettyprint-override"><code...
(Pandas, Python) Selecting indices of a parent DF based on shared column values with a child DF
python|pandas|dataframe
0
40
2
72,147,786
72,147,786
2
true
2022-05-06T21:39:45.323Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: (Pandas, Python) Selecting indices of a parent DF based on shared column values with a child DF<p>(I recently asked this question on r/learnpython (<a href="...
72,148,050
SQL Find Most Frequent Route<div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Departure</th> <th>Destination</th> <th>FlightCount</th> </tr> </thead> <tbody> <tr> <td>A</td> <td>B</td> <td>5</td> </tr> <tr> <td>B</td> <td>A</td> <td>4</td> </tr> <tr> <td>A</td> <td>C</td> <td>7</td> </tr> <tr> <t...
<p>You can standardize the order of departure and destination by ordering them lexicographically using <code>least</code> and <code>greatest</code>:</p> <pre class="lang-sql prettyprint-override"><code>WITH standardized AS ( SELECT least(departure, destination) location1, greatest(departure, destination)...
SQL Find Most Frequent Route
sql
0
32
1
72,148,171
72,148,171
2
true
2022-05-06T22:41:21.690Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL Find Most Frequent Route<div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Departure</th> <th>Destination</th> <th>FlightCount</th>...
72,146,787
How to add ObjectId only if the ObjectID is not present in the array in mongodb using mongoose?<p>so I have a schema where I want to add ObjectID to an array of id's in mongoose, I tried adding it unique, but did not work. Most likely because I need to iterate to check, but not sure how to do so in mongoose/mongodb. Ca...
<p>Looking at the <a href="https://mongoosejs.com/docs/subdocs.html#adding-subdocs-to-arrays" rel="nofollow noreferrer">Mongoose docs for adding subdocs to arrays</a>, I think you should be able to use <code>addToSet</code> instead of <code>push</code>:</p> <pre><code>result.favoriteSellers.push(seller_id); </code></pr...
How to add ObjectId only if the ObjectID is not present in the array in mongodb using mongoose?
node.js|mongodb|express|mongoose
0
54
1
72,148,435
72,148,435
2
true
2022-05-06T19:59:18.400Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add ObjectId only if the ObjectID is not present in the array in mongodb using mongoose?<p>so I have a schema where I want to add ObjectID to an array...
72,147,168
Errors loading GeoJSON exported from R's sf package into Mapbox Studio<p>I am trying to learn how to use Mapbox Studio, but I can't figure out how to upload GeoJSON files that I export from R's sf package using the <code>st_write()</code> function. For example, see the R code below:</p> <pre><code>library(tigris) state...
<p>I suggest that you avoid using <code>EPSG:3857</code> when working with GeoJSON files, and stick to WGS84 (<code>EPSG:4326</code>).</p> <p>The <em>current</em> GeoJSON standard allows only WGS84 - see <a href="https://datatracker.ietf.org/doc/html/rfc7946#section-4" rel="nofollow noreferrer">https://datatracker.ietf...
Errors loading GeoJSON exported from R's sf package into Mapbox Studio
r|mapbox|sf|mapbox-studio
0
68
1
72,149,241
72,149,241
2
true
2022-05-06T20:43:34.437Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Errors loading GeoJSON exported from R's sf package into Mapbox Studio<p>I am trying to learn how to use Mapbox Studio, but I can't figure out how to upload ...
72,147,226
Better/Efficient way to filter out Spark Dataframe rows with multiple conditions<p>I have a dataframe look like this below</p> <pre><code> id pub_date version unique_id c_id p_id type source lni001 20220301 1 64WP-UI-POLI 002 P02 org internet lni00...
<p><code>dense_rank()</code> can be used to find out top versions based on id &amp; type. This can be used to retain only the top record in each group.</p> <pre><code>input.withColumn(&quot;rank&quot;, dense_rank() over (Window.partitionBy($&quot;id&quot;,$&quot;type&quot;).orderBy($&quot;version&quot;.desc))) .filte...
Better/Efficient way to filter out Spark Dataframe rows with multiple conditions
dataframe|scala|apache-spark
0
56
1
72,149,305
72,149,305
2
true
2022-05-06T20:51:26.750Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Better/Efficient way to filter out Spark Dataframe rows with multiple conditions<p>I have a dataframe look like this below</p> <pre><code> id pub_d...
72,149,650
How to clear user uploaded images if the limit of files exceeded in jquery<p>I have a simple form where a user can upload multiple images. I only want the user to upload 4 images at once, so I did the following:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div cl...
<p>I will implement the disable attribute strategy as I said in the comments:</p> <pre><code>$(&quot;#myfile&quot;).on(&quot;change&quot;, function() { if ($(&quot;#myfile&quot;)[0].files.length &gt; 4) { alert(&quot;You can select only 4 images&quot;); $(&quot;.form-control&quot;).prop(&quot;disabled&quot;,tru...
How to clear user uploaded images if the limit of files exceeded in jquery
javascript|html|jquery|forms|image
0
29
2
72,149,694
72,149,694
2
true
2022-05-07T05:09:19.267Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to clear user uploaded images if the limit of files exceeded in jquery<p>I have a simple form where a user can upload multiple images. I only want the us...
72,147,750
Kubernetes pod went down<p>I am pretty new to Kubernetes so I don't have much idea. Last day a pod went down and I was thinking if I would be able to recover the tmp folder.</p> <p>So basically I want to know that when a pod in Kubernetes goes down, does it lose access to the &quot;/tmp&quot; folder ?</p>
<p>Unless you configure otherwise, this folder will be considered storage within the container, and the contents will be lost when the container terminates.</p> <p>Similarly to how you can run a container in docker, write something to the filesystem within the container, then stop and remove the container, start a new ...
Kubernetes pod went down
kubernetes|kubernetes-pod
0
72
1
72,150,079
72,150,079
2
true
2022-05-06T21:56:23.347Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kubernetes pod went down<p>I am pretty new to Kubernetes so I don't have much idea. Last day a pod went down and I was thinking if I would be able to recover...
72,150,211
In Typescript "keyof Record<string, string>" is not "string"<p>I'm hitting this wall since days now and I'm not sure anymore if I'm the problem or if typescript is broken...</p> <p>I defined a generic class with the generic extending <code>Record&lt;string, string&gt;</code>:</p> <pre class="lang-js prettyprint-overrid...
<p>You can <a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#extracttype-union" rel="nofollow noreferrer">extract</a> only strings from <code>string | number | symbol</code> in the method signature.</p> <p>Instead of</p> <pre><code>fields: (keyof T)[] </code></pre> <p>you can write</p> <pre><code...
In Typescript "keyof Record<string, string>" is not "string"
typescript|typescript-generics
0
507
2
72,150,495
72,150,495
2
true
2022-05-07T07:00:58.003Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In Typescript "keyof Record<string, string>" is not "string"<p>I'm hitting this wall since days now and I'm not sure anymore if I'm the problem or if typescr...
72,149,268
Git - Commit and push local changes without losing file diffs?<p>I'm in <code>VSCode</code> and just made a ton of changes on my branch. I have a rough draft that would be a shame to lose due to to not backing up online. So naturally it would be smart to <code>git add .</code> my changes, then <code>git push origin myB...
<p>You make a commit and push it to make the remote backup.</p> <p>Then you discard the commit locally with</p> <pre><code>git reset HEAD~ </code></pre> <p>This points your branch to the previous commit and leaves all changes in the files so that you can see the diffs.</p> <p>Be aware that you will have to force-push y...
Git - Commit and push local changes without losing file diffs?
git|github|visual-studio-code|version-control|ide
0
183
3
72,150,532
72,150,532
2
true
2022-05-07T03:32:03.993Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Git - Commit and push local changes without losing file diffs?<p>I'm in <code>VSCode</code> and just made a ton of changes on my branch. I have a rough draft...
72,150,542
Highlighting text (user input)<p>I'm trying to involve coding a simple component to highlight substrings of text provided by a user</p> <p>but I'm getting errors when I'm trying to get the value from a text-area and compare it against a input area</p> <pre><code>import React from &quot;react&quot;; const Highlighted =...
<pre><code>const text = &lt;textarea data-testid=&quot;source-text&quot; /&gt;; const highlight = &lt;input data-testid=&quot;search-term&quot; /&gt;; </code></pre> <p>You cannot get values directly from JSX.</p> <p>Instead of doing that, you can set <code>useState</code> for those variables (as states), and use <code>...
Highlighting text (user input)
javascript|reactjs
0
39
1
72,150,725
72,150,725
2
true
2022-05-07T07:53:20.297Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Highlighting text (user input)<p>I'm trying to involve coding a simple component to highlight substrings of text provided by a user</p> <p>but I'm getting er...
72,151,206
How to use async calls in WPF event handlers<p>I have this event handler in WPF with async call.</p> <pre><code>private void Button_Click(object sender, RoutedEventArgs e) { var folderStructure = restApiProvider.GetFolderStructure(); } </code></pre> <p>Here is the implementation of <code>GetFolderStructure()</code>...
<p>Make the calling method async and await the result:</p> <pre class="lang-cs prettyprint-override"><code>private async void Button_Click(object sender, RoutedEventArgs e) { var folderStructure = await restApiProvider.GetFolderStructure(); } </code></pre>
How to use async calls in WPF event handlers
c#|wpf|asynchronous|async-await|restsharp
0
229
1
72,151,318
72,151,318
2
true
2022-05-07T09:26:44.190Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use async calls in WPF event handlers<p>I have this event handler in WPF with async call.</p> <pre><code>private void Button_Click(object sender, Rout...
72,151,222
Can we make folder inside template package of SpringBoot Application?<p>I have been working on dummy Web application, and there are lot html file in template which I want to organize. I am getting an error when I have keeping them in folder inside Templete, what is the procedure for that?</p> <p>I am using thymleaf and...
<p>How do you call those templates in sub-folders? Should be like this:</p> <pre class="lang-java prettyprint-override"><code>@RequestMapping(&quot;/endpoint&quot;) public String getMyPageItem() { return &quot;my-folder/folder/item&quot;; } </code></pre> <p>where <code>my-folder</code> inside <code>/resources/templ...
Can we make folder inside template package of SpringBoot Application?
java|spring|spring-boot|thymeleaf
0
127
1
72,151,381
72,151,381
2
true
2022-05-07T09:28:52.213Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can we make folder inside template package of SpringBoot Application?<p>I have been working on dummy Web application, and there are lot html file in template...
72,151,352
Find nth occurrence of a character in a row and replace it in Python, in order to fix/replace a wrong/leftover ";" separator in a text file<p>I would like to import a <strong>text file, with 14 columns with the symbol &quot;;&quot; as a column separator</strong>. So, if we have 14 columns, it means we'll find 13 &quot;...
<p>You should not replace that semi-colon with another character, but instead wrap the string with double quotes (and escape any double quotes that might already be part of the string by doubling them). This is how in CSV syntax you can include such delimiters. In fact, it is not bad practice to wrap such text with dou...
Find nth occurrence of a character in a row and replace it in Python, in order to fix/replace a wrong/leftover ";" separator in a text file
python|pandas|string|list|replace
0
155
2
72,151,564
72,151,564
2
true
2022-05-07T09:47:13.647Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find nth occurrence of a character in a row and replace it in Python, in order to fix/replace a wrong/leftover ";" separator in a text file<p>I would like to...
72,138,942
How to Initial android Exoplayer play and pause buttons with custom UI?<p>I'm using Exoplayer 2.17.1 and want to customize UI. Everything works OK but it can not Initialize the play and pause buttons as you can see in the photo and show both of them and it doesn't work.</p> <p><a href="https://i.stack.imgur.com/mx7dA.p...
<p>In StyledPlayerView there is no two buttons to play and pause video, and you should change below codes:</p> <pre><code>&lt;ImageView android:id=&quot;@id/exo_play&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:theme=&quot;@style/clickablevie...
How to Initial android Exoplayer play and pause buttons with custom UI?
android-studio|exoplayer2.x
0
547
2
72,151,610
72,151,610
2
true
2022-05-06T09:07:15.707Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to Initial android Exoplayer play and pause buttons with custom UI?<p>I'm using Exoplayer 2.17.1 and want to customize UI. Everything works OK but it can...
72,151,600
value of set::find() if not found in container<p>I am trying to understand <code>std::find()</code>. Below is my code.</p> <blockquote> <p><code>std::set::find</code> searches the container for an element equivalent to <code>val</code> and returns an iterator to it if found, <strong>otherwise it returns an iterator to ...
<blockquote> <pre><code>auto a2 = s1.find(100); cout &lt;&lt; &quot;find(100) : &quot; &lt;&lt; *a2 &lt;&lt; endl; </code></pre> </blockquote> <p>Here you dereference (<code>*a2</code>) the end iterator. That is undefined behaviour - remember that <code>s1.end()</code> points to <em>one past the last element</em> and ...
value of set::find() if not found in container
c++|algorithm|stl|iterator|c++17
0
76
3
72,151,685
72,151,685
2
true
2022-05-07T10:23:49.987Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: value of set::find() if not found in container<p>I am trying to understand <code>std::find()</code>. Below is my code.</p> <blockquote> <p><code>std::set::fi...
72,150,046
how to insert multiple checkbox values into database?<p>So, I have a form in that i have two check boxes and both can be checked but when i check both the data is not going into database only the first value is inserting.</p> <p>I tried using getParameterValues, also gave it as an array in bean and also tried some jque...
<p>I guess, the problem is with duplicated name in form - <code>p_act</code>:</p> <pre class="lang-html prettyprint-override"><code> &lt;input type = &quot;checkbox&quot; name = &quot;p_act&quot; value = &quot;In_Stock&quot; &gt; &lt;input type = &quot;checkbox&quot; name = &quot;p_act&quot; value = &quot;Out_Of_Stock...
how to insert multiple checkbox values into database?
java|jsp|servlets|semantic-ui
0
290
1
72,151,949
72,151,949
2
true
2022-05-07T06:30:22.273Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to insert multiple checkbox values into database?<p>So, I have a form in that i have two check boxes and both can be checked but when i check both the da...
72,152,000
how to perform cron jobs every 5 minutes inside docker<p>I want to perform cron jobs every minute for feeds.sh and every 5 minutes for reminder.sh inside docker container. It was able to run every minutes for feeds.sh. However for reminder.sh, it cannot run every 5 minutes as it keep throwing the error <code>/bin/ash:...
<p>Add it on a separate line.</p> <p>When you use &amp;&amp; with cron, it's expecting multiple cron jobs to add for the same cron frequency.</p> <p>eg.</p> <p><code>0 * * * * a &amp;&amp; b</code></p> <p>Hence why it says &quot;*/5 not found&quot; because that's the <code>b</code> above - it thinks it's a cron script ...
how to perform cron jobs every 5 minutes inside docker
docker|cron|dockerfile
0
1,308
2
72,152,013
72,152,013
2
true
2022-05-07T11:20:33.973Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to perform cron jobs every 5 minutes inside docker<p>I want to perform cron jobs every minute for feeds.sh and every 5 minutes for reminder.sh inside doc...
72,151,742
compilation error at overload when using replacerFunction callback<p>I have a function that generates random word:</p> <pre><code>const randomWord = () =&gt; { return &quot;obbooobb&quot;.replace(/([ob])/g, (match: string) =&gt; { if (match === &quot;o&quot;) { // something } if ...
<p>You haven't specified a return type on the callback passed to replace, and as written it doesn't provide a return value so is inferred to be undefined. Either specify the return type, or make sure all code paths return a value of the expected type (string)</p>
compilation error at overload when using replacerFunction callback
typescript|compiler-errors|deno
0
24
1
72,152,094
72,152,094
2
true
2022-05-07T10:44:11.937Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: compilation error at overload when using replacerFunction callback<p>I have a function that generates random word:</p> <pre><code>const randomWord = () =&gt;...
72,146,688
How to plot vectors orthogonal to quadmesh?<p>I am trying to use the <code>rgl</code> package in R to plot unit vectors orthogonal to each cell in a quadmesh. I've used <a href="https://mdsumner.github.io/geo-comp-graphics-oghub/the-mesh3d-format.html#quads" rel="nofollow noreferrer">this page</a> for a bit of guidance...
<p>This is tricky. The fundamental insights are that:</p> <ol> <li>Each square in the mesh can be thought of as a plane</li> <li>Each plane can be defined by a formula z = <strong>a</strong>x + <strong>b</strong>y + <strong>c</strong></li> <li>The coefficients <strong>a</strong>, <strong>b</strong> and <strong>c</stron...
How to plot vectors orthogonal to quadmesh?
r|rgl
0
50
2
72,152,315
72,152,315
2
true
2022-05-06T19:48:14.927Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to plot vectors orthogonal to quadmesh?<p>I am trying to use the <code>rgl</code> package in R to plot unit vectors orthogonal to each cell in a quadmesh...
72,148,547
Create macro to simplify declaration of deeply nested enum?<p>I want to use deeply nested enums to represent blocks in my game:</p> <pre class="lang-rust prettyprint-override"><code>enum Element { Void, Materal(Material) } enum Material { Gas(Gas), NonGas(NonGas) } enum NonGas { Liquid(Liquid), Solid(Solid) } enum Soli...
<p>Using cdhowie's <code>From</code> idea, I think you'd only need trait impls from your lowest level enums. You can skip ones like <code>impl From&lt;Material&gt; for Element</code> because you need a child to create a <code>Material</code>, so it doesn't really make sense to start at that level.</p> <pre class="lang-...
Create macro to simplify declaration of deeply nested enum?
rust|enums
0
47
1
72,152,411
72,152,411
2
true
2022-05-07T00:24:43.100Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create macro to simplify declaration of deeply nested enum?<p>I want to use deeply nested enums to represent blocks in my game:</p> <pre class="lang-rust pre...
72,152,950
React Native Swift Escaping closure<p>I am trying to implement a native module in React native using Swift for IOS.</p> <p>I have a function <strong>getRandomFoodWithCompletionHandler()</strong> Where I am trying to fetch something from the API and then sending it back to JS through the bridge using promises. I use <st...
<p>Make your <code>resolve: RCTPromiseResolveBlock</code> parameter an escaping block:</p> <pre><code>func getRandomFoodWithCompletionHandler( _ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock ) { </code></pre> <p>An &quot;escaping&quot; block is essentially a block that can b...
React Native Swift Escaping closure
swift|react-native
0
107
1
72,152,970
72,152,970
2
true
2022-05-07T13:23:00.100Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React Native Swift Escaping closure<p>I am trying to implement a native module in React native using Swift for IOS.</p> <p>I have a function <strong>getRando...
72,153,127
Explanation on [ (n) ] or [ fields ] [ (p) ] in PostgreSQL docs<p>I'm reading through the PostgreSQL docs and didn't find examples or explanations on the syntax used there. For example <a href="https://www.postgresql.org/docs/current/datatype.html" rel="nofollow noreferrer">on the documentation page for data types</a> ...
<p>The syntax is described in the <a href="https://www.postgresql.org/docs/current/notation.html" rel="nofollow noreferrer">Conventions</a> page of the manual.</p> <p>For instance, <code>[(n)]</code> means that <em>optionally</em> there is a numeric value in parentheses.</p>
Explanation on [ (n) ] or [ fields ] [ (p) ] in PostgreSQL docs
postgresql|documentation
0
19
1
72,153,193
72,153,193
2
true
2022-05-07T13:47:01Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Explanation on [ (n) ] or [ fields ] [ (p) ] in PostgreSQL docs<p>I'm reading through the PostgreSQL docs and didn't find examples or explanations on the syn...
72,153,337
Updating a string variable from within nested for loop in Scala<p>I have a Dataframe which I am trying converting to html table syntax as a string in Scala:</p> <p><strong>sample_df:</strong> which is of type DataFrame = Dataset[Row]</p> <pre><code>|Name|Country|Occupation|Years_Experience| |Bob |USA | Engineer | 5...
<p>Not sure what you mean by &quot;dataframe&quot; in this context (you can't iterate spark dataframes like this), but assuming you are talking about a normal sequence, this <a href="https://scastie.scala-lang.org/498jNQHJTnmaOlGlPy7wzA" rel="nofollow noreferrer">works for me</a>.</p> <p>Having said that, this is a ver...
Updating a string variable from within nested for loop in Scala
string|scala|nested-loops
0
29
1
72,153,482
72,153,482
2
true
2022-05-07T14:17:11.023Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Updating a string variable from within nested for loop in Scala<p>I have a Dataframe which I am trying converting to html table syntax as a string in Scala:<...
72,153,461
Search operation in imbalanced binary search tree<p>I could not understand and think of a scenario when a search operation in an imbalanced binary search tree could be more efficient than in a balanced binary search tree. If the binary search tree is highly skewed, then it might take the form of a linked list at which ...
<p>There are some cases where an imbalanced tree <em>could</em> be better. Take the following two trees as an example:</p> <p><a href="https://i.stack.imgur.com/CGsWy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CGsWy.png" alt="balanced and unbalanced search trees" /></a></p> <p>The idea behind a ...
Search operation in imbalanced binary search tree
algorithm|binary-search-tree
0
37
1
72,153,880
72,153,880
2
true
2022-05-07T14:30:48.530Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Search operation in imbalanced binary search tree<p>I could not understand and think of a scenario when a search operation in an imbalanced binary search tre...
72,153,927
Merge 2 dataframes with same column headers creating subheaders<p>I have 2 dataframes to do with Covid-19</p> <pre><code>df_infect Dates Australia Bahamas ....... 1/22/20 0 0 ....... 1/23/20 0 1 ....... </code></pre> <p>and</p> <pre><code>df_dea...
<p>You can merge on <code>Dates</code> with appropriate suffixes; then split the column names to create MultiIndex columns:</p> <pre class="lang-py prettyprint-override"><code>out = pd.merge(df_infect, df_death, on='Dates', suffixes=('_infected','_dead')).set_index('Dates') out.columns = out.columns.str.split('_', expa...
Merge 2 dataframes with same column headers creating subheaders
python|python-3.x|pandas|dataframe|pandas-merge
0
198
2
72,154,016
72,154,016
2
true
2022-05-07T15:28:57.097Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Merge 2 dataframes with same column headers creating subheaders<p>I have 2 dataframes to do with Covid-19</p> <pre><code>df_infect Dates Australia ...
72,154,006
"error: break statement not within loop or switch" in arduino one<p>i don´t have any idea of coding but i´m doing a school exersice and it gives me the error of the title</p> <pre><code>while (distancia&lt;200 &amp;&amp; distancia&gt;100); { lcd.print(&quot;ALTO&quot;); delay(1000); lcd.clear(); delay(1000); ...
<p>Here</p> <pre><code> while (distancia&lt;200 &amp;&amp; distancia&gt;100); --------------------------------------^ </code></pre> <p>remove that semicolon, it terminates the <code>while</code> right there</p> <pre><code> while (distancia&lt;200 &amp;&amp; distancia&gt;100) </code></pre>
"error: break statement not within loop or switch" in arduino one
c++|arduino|tinkercad
0
108
1
72,154,042
72,154,042
2
true
2022-05-07T15:38:06.250Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: "error: break statement not within loop or switch" in arduino one<p>i don´t have any idea of coding but i´m doing a school exersice and it gives me the error...
72,143,208
getAuth().onAuthStateChanged not called, async not resolving in capacitor?<p>This may be a firebase issue or a capacitor issue with promises - I'm building an iOS app with capacitor and NextJS.</p> <p>I'm finding async functions (at least to firebase) aren't completing even when they're successful, for example a call t...
<p>You seem to have the following problem: <a href="https://github.com/robingenz/capacitor-firebase-authentication/issues/78" rel="nofollow noreferrer">https://github.com/robingenz/capacitor-firebase-authentication/issues/78</a></p> <p>This was the solution (Source: <a href="https://harryherskowitz.com/2021/08/23/fireb...
getAuth().onAuthStateChanged not called, async not resolving in capacitor?
ios|firebase|next.js|capacitor
0
130
1
72,154,048
72,154,048
2
true
2022-05-06T14:33:42.417Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: getAuth().onAuthStateChanged not called, async not resolving in capacitor?<p>This may be a firebase issue or a capacitor issue with promises - I'm building a...
72,154,020
Using a PHP array inside a JS For loop<p>I explored a bunch of related questions but to no avail. I use <code>json_encode</code> to pass on a PHP variable to JS and it works fine. <code>&lt;?php echo json_encode($datasets[0]);?&gt;);</code></p> <p>But when I try to do the same thing inside a JS <code>for</code> loop us...
<p>PHP executes before any of the JavaScript executes, so it cannot evaluate <code>$datasets[i]</code>, because that <code>i</code> is not known in PHP. Moreover, it would only evaluate it once, because there is no PHP loop.</p> <p>The way to do this, is to let PHP pass the whole data set to JavaScript:</p> <pre class=...
Using a PHP array inside a JS For loop
javascript|php
0
31
2
72,154,093
72,154,093
2
true
2022-05-07T15:39:37.930Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using a PHP array inside a JS For loop<p>I explored a bunch of related questions but to no avail. I use <code>json_encode</code> to pass on a PHP variable to...
72,154,177
Reading File from another Package in Java using getResourceAsStream()<p>I am trying to read a file called &quot;numbers.txt&quot; which is filled with int numbers (one int per line, no empty lines). I want to put the numbers into an array and return this array (method <code>readIntsFromFile</code>). Unfoutnetly the Fil...
<p>The string value you pass to <code>SomeClass.class.getResource()</code> (as well as <code>getResourceAsStream</code>, of course) has two 'modes'.</p> <ol> <li><p>It looks 'relative to the package of <code>SomeClass</code>', which means, effectively, if you ask for e.g. <code>&quot;img/load.png&quot;</code>, and <cod...
Reading File from another Package in Java using getResourceAsStream()
java|classloader|readfile
0
59
1
72,154,328
72,154,328
2
true
2022-05-07T15:56:32.080Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reading File from another Package in Java using getResourceAsStream()<p>I am trying to read a file called &quot;numbers.txt&quot; which is filled with int nu...
72,154,291
Response Code 301 while sending request from Android<p>I need help, my app was working fine but after renew of Domain name, I started getting error 301. Is something to be fixed in my below code? Though if I use <a href="https://Google.com" rel="nofollow noreferrer">https://Google.com</a> with same code, response code ...
<p>Your site is being redirected to <code>https://innovativeapps.me</code>. When you use the <code>http://</code> schema, it redirects and returns a 301 letting you know that you need to update your url.</p>
Response Code 301 while sending request from Android
java|android|httpurlconnection
0
37
1
72,154,422
72,154,422
2
true
2022-05-07T16:10:23.607Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Response Code 301 while sending request from Android<p>I need help, my app was working fine but after renew of Domain name, I started getting error 301. Is s...
72,153,965
C++ method for non class or struct<p>Is there any way in C++ to have a method for variable which is not a class or struct? Suppose I have a defined type <code>dogs</code> for convenience.</p> <pre><code>using dogs = std::unordered_map&lt;std::string, dog&gt;; dogs d; </code></pre> <p>Now, what I want to achieve is to h...
<p>Your <code>d.print()</code> means invocation of the method <code>print</code> that <code>std::unordered_map&lt;std::string, dog&gt;</code> actually hasn't. You can't add new methods to an existing class in C++ in contrast to e.g. Python because C++ is a statically typed language. The only way to add new method to a ...
C++ method for non class or struct
c++
0
56
2
72,154,433
72,154,433
2
true
2022-05-07T15:34:05.763Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C++ method for non class or struct<p>Is there any way in C++ to have a method for variable which is not a class or struct? Suppose I have a defined type <cod...
72,154,504
podman exec --env-file seemingly not working<p>trying to run the following command:</p> <pre><code>podman exec -it --env-file=./env/local.env bbss superset fab create-admin \ --username ${BBSS_ADMIN_USERNAME} \ --firstname ${BBSS_ADMIN_FIRSTNAME} \ --lastname ${BBSS_ADMIN_LASTNAME} \ --email ${BBSS_ADM...
<p>Remember that your <em>local</em> shell interprets variable references before executing a command. If you run...</p> <pre><code>podman exec mycontainer somecomand $SOMEVARIABLE </code></pre> <p>Then the value of <code>$SOMEVARIABLE</code> comes from your local shell, not from the shell inside the container. To make...
podman exec --env-file seemingly not working
podman
0
508
1
72,154,607
72,154,607
2
true
2022-05-07T16:36:08.207Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: podman exec --env-file seemingly not working<p>trying to run the following command:</p> <pre><code>podman exec -it --env-file=./env/local.env bbss superset ...
72,154,578
Build a dataframe in a nested for loop<p>I have a nested for loop, and I want to build a dataframe with it. Here is an example of my code:</p> <pre><code>for id in range( 3): for i in range(2): x = i + id y = id-i </code></pre> <p>My ids are three, I want to put the value of x and y ...
<p>Instead of a nested loop, you could use numpy broadcasting to build <code>x</code> columns and <code>y</code> columns separately:</p> <pre class="lang-py prettyprint-override"><code>import numpy as np inner_loop_lim = 2 id_lim = 3 df = pd.DataFrame({'id':range(id_lim)}) df[[f'x_{i}' for i in range(inner_loop_lim)]] ...
Build a dataframe in a nested for loop
python|pandas|dataframe
0
39
1
72,154,633
72,154,633
2
true
2022-05-07T16:46:53.013Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Build a dataframe in a nested for loop<p>I have a nested for loop, and I want to build a dataframe with it. Here is an example of my code:</p> <pre><code>for...
72,155,120
How to create inmutable and singleton objects in python?<p>I'm trying to create a class that holds some data and is &quot;shared&quot; in all the code. Like the strings in Python: they are shared everywhere, as they are immutable, and only one instance with a particular value exists. I want to create the class on deman...
<p>You can define an immutable dataclass with the <code>frozen=True</code> parameter. Making a dataclass <code>frozen</code> automatically makes it hashable, so you can just use <code>functools.cache</code> instead of implementing your own cache:</p> <pre><code>from dataclasses import dataclass from functools import c...
How to create inmutable and singleton objects in python?
python|singleton|immutability
0
184
1
72,155,215
72,155,215
2
true
2022-05-07T17:54:24.657Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create inmutable and singleton objects in python?<p>I'm trying to create a class that holds some data and is &quot;shared&quot; in all the code. Like ...
72,155,059
Access Model Method for Multiple Objects in Django<p>Let's say I have created a model in Django that looks like this:</p> <pre><code>class Book(models.Model): author = models.CharField(max_length=64) ... (other attributes) def author_pretty(self): return &quot;[··&quot; + self.author + &quot;··]&q...
<p>It depends on how you are going to use it, if it is one by one on a template, use the method as a property</p> <pre><code>@property def author_pretty(self): return &quot;[··&quot; + self.author + &quot;··]&quot; </code></pre> <p>However if you want something cleaner and for some reason you need them all in ...
Access Model Method for Multiple Objects in Django
python|django|django-models
0
68
1
72,155,429
72,155,429
2
true
2022-05-07T17:46:41.513Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Access Model Method for Multiple Objects in Django<p>Let's say I have created a model in Django that looks like this:</p> <pre><code>class Book(models.Model)...
72,153,465
'The library has not yet been initialized' when I use @microsoft/teams-js in nuxtjs<p>this happened when I tried to use @microsoft/teams-js for Single Sign-on (SSO) purposes in nuxtjs.</p> <pre><code>&lt;template&gt; &lt;Tutorial /&gt; &lt;/template&gt; &lt;script&gt; export default { name: 'IndexPage', async mo...
<p>Initialize the library, before calling other methods, as per the documentation:</p> <pre><code>microsoftTeams.initialize() </code></pre> <p>This of course only works when running in a Teams app (tab or personal)</p>
'The library has not yet been initialized' when I use @microsoft/teams-js in nuxtjs
javascript|vue.js|nuxt.js|microsoft-teams
0
341
1
72,155,849
72,155,849
2
true
2022-05-07T14:31:22.733Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: 'The library has not yet been initialized' when I use @microsoft/teams-js in nuxtjs<p>this happened when I tried to use @microsoft/teams-js for Single Sign-o...
72,155,898
Select count for total times foreign key exists in table with join<p>My table setup is as follows</p> <h2>Shortlist</h2> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>id (primary key)</th> <th>property_id(foreign key)</th> <th>user_id</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>100</td> <...
<p>To count the <code>property_id</code>s you can use a correlated subquery:</p> <pre><code>SELECT s.user_id, s.property_id, p.id, p.account_number, (select Count(*) from Shortlist s2 where s2.property_id = s.property_id) shortlistCount FROM shortlist s JOIN property p ON s.property_id = p.id WHERE s.user_id = 2 L...
Select count for total times foreign key exists in table with join
mysql|count
0
24
1
72,156,032
72,156,032
2
true
2022-05-07T19:44:58.427Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Select count for total times foreign key exists in table with join<p>My table setup is as follows</p> <h2>Shortlist</h2> <div class="s-table-container"> <tab...
72,156,193
How to type initial value in React Context of object data fetched from API<p>I cannot figure out how to type properly initial value of createContext.</p> <p>This is what I have in the interface of data:</p> <pre><code>lineSectionsDefectsDetailsData: LineSectionsDefectWarningDetailsType; </code></pre> <p>And that's prec...
<p>If <code>undefined</code> is a valid value for any <code>type</code> then you can use the <code>|</code> operator to define correct type definitions.</p> <pre><code>type LineSectionsDefectWarningDetailsType = { id: string; timestamp: Date; type: string; imageUrl: string; lineId: string; kilometer: number...
How to type initial value in React Context of object data fetched from API
reactjs|typescript
0
21
1
72,156,293
72,156,293
2
true
2022-05-07T20:38:05.717Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to type initial value in React Context of object data fetched from API<p>I cannot figure out how to type properly initial value of createContext.</p> <p>...
72,156,664
How to get data through eloquent with multiple hasMany relations<p>I have the following tables:</p> <p><code>users</code></p> <pre><code>| id | name | -------------- | 1 | user1 | | 2 | user2 | </code></pre> <p><code>countries</code></p> <pre><code>| id | name | --------------------- | 1 | Netherlands | | ...
<p>You can use filtered with when you retrieve the list of countries</p> <pre><code>$userId = auth()-&gt;id(); $countries = Country::with(['vatNumbers' =&gt; function($vatQuery) use ($userId) { $vatQuery-&gt;where('user_id', $userId); })-&gt;get(); </code></pre> <p>When you check in blade for the relation <...
How to get data through eloquent with multiple hasMany relations
php|laravel|eloquent|eloquent-relationship
0
128
1
72,156,710
72,156,710
2
true
2022-05-07T22:04:01.377Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get data through eloquent with multiple hasMany relations<p>I have the following tables:</p> <p><code>users</code></p> <pre><code>| id | name | -----...
72,156,653
Compare two elements of the same Numpy array through broadcasting<p>I have a numpy array of 2000 elements and I want to find out the indexes in which the element minus the next element divided by itself is bigger than x.</p> <p>Something like:</p> <pre><code>a[abs(a[i] - a[i+1])/a[i+1] &gt; x] </code></pre> <p>I am loo...
<p>You can use slicing. Start with the array including all but the last value (because the last one has no next value to compare it to), and index it with a Boolean expression: The same array, minus the shifted array starting at index 1, and divided by the shifted array. These operations will all happen element-wise in...
Compare two elements of the same Numpy array through broadcasting
python-3.x|numpy|array-broadcasting
0
38
1
72,156,736
72,156,736
2
true
2022-05-07T22:02:12.907Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Compare two elements of the same Numpy array through broadcasting<p>I have a numpy array of 2000 elements and I want to find out the indexes in which the ele...
72,156,735
Pandas create a new column containing index based on the value of another one<p>I have a dataframe like this:</p> <pre><code>a 4.0 5.5 5.5 6.7 7.9 7.9 9.4 </code></pre> <p>I want to a add a new column named <code>b</code>, 'indexing' the values in first one. The new dataframe would look like:</p> <pre><code>a b 4....
<p>You can use <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.factorize.html" rel="nofollow noreferrer"><code>pd.factorize</code></a>:</p> <pre class="lang-py prettyprint-override"><code>codes, uniques = pd.factorize(df['a']) df['b'] = codes </code></pre> <p>(or <code>df['b'] = codes + 1</c...
Pandas create a new column containing index based on the value of another one
pandas|pandas-groupby
0
61
1
72,156,764
72,156,764
2
true
2022-05-07T22:19:10.277Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas create a new column containing index based on the value of another one<p>I have a dataframe like this:</p> <pre><code>a 4.0 5.5 5.5 6.7 7.9 7.9 9.4 ...
72,155,009
syn::Field.attrs doesn't contain inert attributes<p>Given the following struct definition:</p> <pre><code>#[derive(Builder)] pub struct Command { executable: String, #[builder(each = &quot;arg&quot;)] args: Vec&lt;String&gt;, #[builder(each = &quot;env&quot;)] env: Vec&lt;String&gt;, current_dir...
<p>I think you might just be interpreting the terminal output incorrectly since when I cloned your fork and removed the test code that failed to compile this is the output I got for the test with the attributes:</p> <pre class="lang-rs prettyprint-override"><code>test tests/07-repeated-field.rs ... ok WARNINGS: ┈┈┈┈┈┈...
syn::Field.attrs doesn't contain inert attributes
rust
0
60
1
72,156,999
72,156,999
2
true
2022-05-07T17:41:35.687Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: syn::Field.attrs doesn't contain inert attributes<p>Given the following struct definition:</p> <pre><code>#[derive(Builder)] pub struct Command { executa...
72,157,055
Fixing column names and renaming them after grouping the dataframe by two columns<p>I have a dataframe:</p> <pre><code>{'ARTICLE_ID': {0: 111, 1: 111, 2: 222, 3: 222, 4: 222}, 'CITEDIN_ARTICLE_ID': {0: 11, 1: 11, 2: 11, 3: 22, 4: 22}, 'enrollment': {0: 10, 1: 10, 2: 10, 3: 10, 4: 10}, 'Trial_year': {0: 2017, 1: 2017, 2...
<p>You can modify the columns:</p> <pre class="lang-py prettyprint-override"><code>df_grouped.columns = [f&quot;{i}_{j}&quot; if j!='' else i for i,j in df_grouped.columns] </code></pre> <p>or use <code>NamedAgg</code> from the beginning:</p> <pre class="lang-py prettyprint-override"><code>df_grouped = (df.groupby(['AU...
Fixing column names and renaming them after grouping the dataframe by two columns
python|python-3.x|pandas|dataframe|pandas-groupby
0
27
1
72,157,091
72,157,091
2
true
2022-05-07T23:30:24.800Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fixing column names and renaming them after grouping the dataframe by two columns<p>I have a dataframe:</p> <pre><code>{'ARTICLE_ID': {0: 111, 1: 111, 2: 222...
72,149,863
symfony 5 form type define the labels<p>I created the CRUD for my entity and I need to somehow define the labels for the fields of the entity.</p> <p>I can define them in the form type, for example:</p> <pre><code>$builder -&gt;add('name' , null, [ 'attr' =&gt; ['autofocus' =&gt; true], 'label' =&gt...
<p>Yes is this the best practies, in official documentation explained here <a href="https://symfony.com/doc/current/reference/forms/types/form.html#label-translation-parameters" rel="nofollow noreferrer">https://symfony.com/doc/current/reference/forms/types/form.html#label-translation-parameters</a></p>
symfony 5 form type define the labels
symfony
0
59
1
72,157,204
72,157,204
2
true
2022-05-07T05:55:36.823Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: symfony 5 form type define the labels<p>I created the CRUD for my entity and I need to somehow define the labels for the fields of the entity.</p> <p>I can d...