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,245,227
Equivalence but not congruence<p>All</p> <p>I'm working on sf/plf chapter Equiv. There is an exercise</p> <blockquote> <p>We've shown that the [cequiv] relation is both an equivalence and a congruence on commands. Can you think of a relation on commands that is an equivalence but <em>not</em> a congruence?</p> </blockq...
<p>There are other equivalences than &quot;behavioral equivalence&quot;. An equivalence is any relation which is reflexive, symmetric and transitive. A congruence is a structure-preserving equivalence.</p> <p>A common example for an equivalence which is a congruence is arithmetic modulo n. Equality say modulo 10 is an ...
Equivalence but not congruence
coq
0
46
1
72,247,114
72,247,114
1
true
2022-05-15T02:49:53.093Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Equivalence but not congruence<p>All</p> <p>I'm working on sf/plf chapter Equiv. There is an exercise</p> <blockquote> <p>We've shown that the [cequiv] relat...
72,366,737
How to extract multiple string part from string in scala?<p>I have string in which I have to get some string and store it in variable.</p> <pre><code>data source=local/SQL,1433;initial catalog=Employee;user id=user_first;password=abc@123;encrypt=true;connectretrycount=3;connection timeout=30; </code></pre> <p>I need to...
<p>What do you mean by &quot;it's not feasible&quot;? It works just fine:</p> <pre class="lang-scala prettyprint-override"><code>// s is the same string you provided s.split(&quot;;&quot;).map { keyVal =&gt; val Array(key, value, _*) = keyVal.split(&quot;=&quot;, 2) key -&gt; value } // result -&gt; res2: Array...
How to extract multiple string part from string in scala?
scala|apache-spark
1
46
1
72,366,957
72,366,957
1
true
2022-05-24T16:58:05.707Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to extract multiple string part from string in scala?<p>I have string in which I have to get some string and store it in variable.</p> <pre><code>data so...
72,243,009
How add a row of 0 to a dataframe<p>I have this dataframe in R</p> <pre><code>mat &lt;-structure(list(a = c(2, 5, 90, 77, 56), b = c(45, 78, 98, 55, 63), c = c(77, 85, 3, 22, 4), d = c(52, 68, 4, 25, 79), e = c(14, 73, 91, 87, 94)), class = &quot;data.frame&quot;, row.names = c(NA, -5L )) </code></pre> <p>and I want ...
<p>We can use <code>rbind</code></p> <pre><code>mat &lt;- rbind(0, mat) </code></pre> <p>-output</p> <pre><code>mat a b c d e 1 0 0 0 0 0 2 2 45 77 52 14 3 5 78 85 68 73 4 90 98 3 4 91 5 77 55 22 25 87 6 56 63 4 79 94 </code></pre>
How add a row of 0 to a dataframe
r|dataframe|row
-1
46
2
72,243,015
72,243,015
2
true
2022-05-14T18:39:55.570Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How add a row of 0 to a dataframe<p>I have this dataframe in R</p> <pre><code>mat &lt;-structure(list(a = c(2, 5, 90, 77, 56), b = c(45, 78, 98, 55, 63), c ...
72,245,531
What is the scale of time complexity of this algorithm?<p>I have a list of list, in different length, and my algorithm runs on every element in the sub lists.</p> <p>What should be my time complexity?</p> <p>I don't know if it's okay to write O(n * m), as n length of parent list and m is the average length of t E sub l...
<p>If you have <code>n</code> sublists with <code>m</code> elements each, <code>n*m</code> represents the total number of elements being processed, hence it has a complexity of <code>O(n*m)</code>.</p> <p>If your sublists have an unequal number of elements, it is okay to summarise it as <code>O(N)</code>, where <code>N...
What is the scale of time complexity of this algorithm?
list|algorithm|time-complexity|big-o
1
46
3
72,245,538
72,245,538
2
true
2022-05-15T04:33:46.110Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the scale of time complexity of this algorithm?<p>I have a list of list, in different length, and my algorithm runs on every element in the sub lists...
72,244,161
Kqlmagic returns No valid xcolumn<p>The following example query works in the Azure Data Explorer UI but not with Kqlmagic in Jupyter Notebook.</p> <pre><code>%%kql let min_t = toscalar(demo_make_series1 | summarize min(TimeStamp)); let max_t = toscalar(demo_make_series1 | summarize max(TimeStamp)); demo_make_series1 | ...
<p>This indeed looks like a bug in KqlMagic rendering. We shall check and update. Meanwhile you can use mv-expand before rendering. Regardless, in make-series I suggest you avoid using the deprecated range(...) syntax in favor of 'from ... to ... step ...'. Here is the updated query:</p> <pre><code>%%kql let min_t = to...
Kqlmagic returns No valid xcolumn
azure-data-explorer|kql|kqlmagic
1
46
1
72,245,856
72,245,856
2
true
2022-05-14T22:04:51.550Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kqlmagic returns No valid xcolumn<p>The following example query works in the Azure Data Explorer UI but not with Kqlmagic in Jupyter Notebook.</p> <pre><code...
72,254,996
How to import my own current package using venv Python?<p>This problem may be kind of confusing, but I'm currently working on an open source python package. The folder structure looks as follows:</p> <pre><code>my_package: |- __init__.py |- file.py |- example.py </code></pre> <p>Each file looks as follows, respec...
<p>You need to install the package. There should be a <code>setup.py</code> folder at the root directory of the project. Go to that directory in your terminal, and run</p> <pre><code>python -m pip install --editable . </code></pre> <p>This will install that package (and any dependencies) in your virtual env.</p> <p>By ...
How to import my own current package using venv Python?
python
0
46
1
72,255,062
72,255,062
2
true
2022-05-16T06:38:25.617Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to import my own current package using venv Python?<p>This problem may be kind of confusing, but I'm currently working on an open source python package. ...
72,257,815
How json authentication works with symfony?<p>I can’t figure out what’s blocking. I’ve been following the symfony documentation.</p> <p>/security.yaml</p> <pre><code>security: # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords password_hashers: Symfony\Component\Security\Core\Use...
<p>Ok i change</p> <pre><code>check_path: api_login </code></pre> <p>by</p> <pre><code>check_path: app_api_login </code></pre> <p>check_path must bee same as name: 'app_api_login' omg ....</p>
How json authentication works with symfony?
php|json|symfony|symfony6
0
46
1
72,259,722
72,259,722
2
true
2022-05-16T10:31:57.023Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How json authentication works with symfony?<p>I can’t figure out what’s blocking. I’ve been following the symfony documentation.</p> <p>/security.yaml</p> <p...
72,269,333
Data transfer: JSON → SQL<p></p> <p>I would like to ask You for some help. In our production I would like to transfer many kind of data and I've decided to choose using of JSON for that. I've created the JSON string with all data on the side of the app and now I need to store it into my DB by using of stored procedure....
<p>I think you need this:</p> <pre><code>DECLARE @json NVARCHAR(MAX) = '{&quot;production&quot;:{&quot;repairs&quot;:{&quot;2&quot;:{&quot;1&quot;:3},&quot;4&quot;:{&quot;3&quot;:5},&quot;7&quot;:{&quot;2&quot;:2,&quot;4&quot;:4}}}}' SELECT RowId = ROW_NUMBER() OVER (ORDER BY CONVERT(int, j1.[key]), CONVERT(int, j2...
Data transfer: JSON → SQL
sql|json|sql-server|data-transform
1
46
1
72,269,423
72,269,423
2
true
2022-05-17T06:51:42.927Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Data transfer: JSON → SQL<p></p> <p>I would like to ask You for some help. In our production I would like to transfer many kind of data and I've decided to c...
72,279,140
Star rating "Turned Around" - HTML, CSS<p>I want to make a star rating by hiding the input (radio buttons) and just displaying the label (which is star shaped). By clicking on one of the stars, all stars before it should become yellow too. So I wrote the following:</p> <p>HTML and CSS creating radio buttons and labels:...
<p>A simple solution would be to add a container with <code>display:flex;</code> and use <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction" rel="nofollow noreferrer">flex-direction</a> to reverse the elements. Because the elements are displayed in the DOM reversed, you will need to be sure to rev...
Star rating "Turned Around" - HTML, CSS
html|css|input|label
2
46
2
72,279,682
72,279,682
2
true
2022-05-17T18:39:53.923Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Star rating "Turned Around" - HTML, CSS<p>I want to make a star rating by hiding the input (radio buttons) and just displaying the label (which is star shape...
72,261,984
Draw circle with PIL (Old ones doesn't works)<p>I am trying to draw a circle with PIL, but I get an attribute error.</p> <p>Current code is for square.</p> <p>Part of code to draw:</p> <pre><code>youtube = Image.open(f&quot;cache/thumb{videoid}.png&quot;) image1 = changeImageSize(1280, 720, youtube) image2 = image1.con...
<p>You can use either <code>ImageDraw.arc()</code> or <code>ImageDraw.ellipse</code>.</p> <pre class="lang-py prettyprint-override"><code>from PIL import Image, ImageDraw # Image size W, H = 100, 100 # Bounding box points X0 = int(W / 4) X1 = int(X0 * 3) Y0 = int(H / 4) Y1 = int(X0 * 3) # Bounding box bbox = [X0, Y0...
Draw circle with PIL (Old ones doesn't works)
python|python-3.x|python-imaging-library
0
46
1
72,280,135
72,280,135
2
true
2022-05-16T15:48:32.730Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Draw circle with PIL (Old ones doesn't works)<p>I am trying to draw a circle with PIL, but I get an attribute error.</p> <p>Current code is for square.</p> <...
72,284,916
SwiftUI: Update Tab Bar Badge when Core Data item is added<p>This Problem drives me nuts: I have a small SwiftUi iOS App which works with Core data. All works fine, I can add edit etc. But the app is tab bar based ad I want one tabs badge updated when a record is added to core data.</p> <p>So I thought I listen to the ...
<p>The <code>hasChanges</code> is not published property, so it does not trigger <code>onChange</code>, try instead to use notification directly, like</p> <pre><code> .onReceive(NotificationCenter.default.publisher(for: NSManagedObjectContext.didChangeObjectsNotification, o...
SwiftUI: Update Tab Bar Badge when Core Data item is added
ios|swift|swiftui
2
46
1
72,285,151
72,285,151
2
true
2022-05-18T07:33:33.483Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SwiftUI: Update Tab Bar Badge when Core Data item is added<p>This Problem drives me nuts: I have a small SwiftUi iOS App which works with Core data. All work...
72,285,943
How to load data outside Django view?<p>If i have some Django views like 'first', 'second' and so on, and i want to load some data outside this views but use it inside views.</p> <p>Here is an example to understand my idea.</p> <pre><code>#function execution time is long, that is why i want to laod it only once when ru...
<p>this approach doesn't work when you start project localy with <code>python manage.py runserver</code>, it only works once, when project starts, and then you need to reload project every time. This is because everything in <code>any_views.py</code> loads only once, when project starts, except your functions. So you h...
How to load data outside Django view?
django|postgresql
1
46
2
72,286,226
72,286,226
2
true
2022-05-18T08:46:18.353Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to load data outside Django view?<p>If i have some Django views like 'first', 'second' and so on, and i want to load some data outside this views but use...
72,287,201
How to overload + operator in a Template array class to add every element with the same Index together<p>I somewhat successfully overloaded the + operator to add 2 arrays of the same size together.</p> <p>This is my current code:</p> <pre class="lang-cpp prettyprint-override"><code>//.h #pragma once #include &lt;iostr...
<p>In the declaration of the operator function:</p> <pre><code>MyArray&lt;T, S&gt; operator+(const MyArray&amp; secondSummand) const; </code></pre> <p>When you use plain <code>MyArray</code> it's implied to be <code>MyArray&lt;T, S&gt;</code>. The template arguments <code>T</code> and <code>S</code> are the same as for...
How to overload + operator in a Template array class to add every element with the same Index together
c++|templates|operator-overloading
0
46
1
72,287,415
72,287,415
2
true
2022-05-18T10:10:47.817Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to overload + operator in a Template array class to add every element with the same Index together<p>I somewhat successfully overloaded the + operator to...
72,287,474
Can someone explain why this if else in Python is not working<p>Very new to Python and I can't get to understand why the inputs is passing through as TRUE with second condition. I was expecting to print &quot;,&quot; instead I'm getting &quot;.&quot;:</p> <pre><code>def define_punctuation(inputs): text = inputs.spl...
<p>You must use like this</p> <pre><code>def define_punctuation(inputs): text = inputs.split() if (text[len(text) - 1] != '/end') and (text[0] == 'how' or text[0] == 'when' or text[0] == 'what' or text[0] == 'why'): text = '?' print(text) elif (text[0] != 'how' or text[0] != 'when' or text[...
Can someone explain why this if else in Python is not working
python
0
46
2
72,287,763
72,287,763
2
true
2022-05-18T10:30:29.927Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can someone explain why this if else in Python is not working<p>Very new to Python and I can't get to understand why the inputs is passing through as TRUE wi...
72,296,383
Adding data labels for totals as well as class-specific values in a stacked column chart<h2>Main question</h2> <p>When creating a stacked column chart using R's <code>ggplot2</code> library, how can I add data labels for the column totals as well as data labels for each individual class/value?</p> <h2>Context</h2> <p>I...
<p>The issue is that you specified <code>fill=hsys</code> as a global aesthetic inside <code>ggplot()</code> which is inherited by all layers. To fix that you could make <code>fill=hsys</code> a local aes of <code>geom_bar</code> or add <code>inherit.aes=FALSE</code> to <code>geom_text</code> to prevent inheritance of ...
Adding data labels for totals as well as class-specific values in a stacked column chart
r|ggplot2|graph|data-visualization
0
46
1
72,296,538
72,296,538
2
true
2022-05-18T21:48:45.077Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Adding data labels for totals as well as class-specific values in a stacked column chart<h2>Main question</h2> <p>When creating a stacked column chart using ...
72,297,050
Class method returns None<p>I did a few modifications to the Bellman-Ford to get some data I need to compare but I can't seem to be able to get some of the information I need from the return the PrintArr method, while it prints the 'dist_list' the return won't take it nor am I being able to create the object using list...
<p>The <code>None</code> comes from:</p> <pre><code>print(g.BellmanFord(0)) </code></pre> <p><code>BellmanFord</code> never returns anything useful under any circumstances (it either falls off the end and implicitly returns <code>None</code>, or executes a plain <code>return</code>, which also return <code>None</code>)...
Class method returns None
python|class|return|return-value|return-type
-1
46
1
72,297,090
72,297,090
2
true
2022-05-18T23:32:01.857Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Class method returns None<p>I did a few modifications to the Bellman-Ford to get some data I need to compare but I can't seem to be able to get some of the i...
72,301,345
Deserialize array of objects with dynamic property name<p>I have a service that accepts JSON like this</p> <pre><code>[ { &quot;key1&quot;: &quot;value1&quot; }, { &quot;key2&quot;: &quot;value2&quot; }, { &quot;key3&quot;: &quot;value3&quot; } ] </code></pre> <p>And I'm trying to fi...
<p>Dynamic property names are a nightmare (are there any rules regarding the key names?). You should aim for a structure like this:</p> <pre><code>[ { &quot;key&quot;: &quot;key1&quot; &quot;value&quot;: &quot;value1&quot; }, { &quot;key&quot;: &quot;key2&quot; &quot;value&quot;: &quot;...
Deserialize array of objects with dynamic property name
java|jackson
-2
46
2
72,301,442
72,301,442
2
true
2022-05-19T08:45:05.597Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Deserialize array of objects with dynamic property name<p>I have a service that accepts JSON like this</p> <pre><code>[ { &quot;key1&quot;: &quot;va...
72,303,820
Task restart immediately after completion while parallel processing<p>I have to restart all task immediately after completion of the same. Please have a look into my program below;</p> <pre><code>class Program { static async Task Main(string[] args) { int _count = 1; while (...
<p>Your program currently runs the three tasks concurrently, (asynchronously) waits for them all to complete, and then does that in a loop.</p> <p>If you want to run <em>each task</em> in a loop, then you just move the loop:</p> <pre><code>static async Task ProcessTasksAsync() { Task&lt;int&gt; taskA = LoopA(10); T...
Task restart immediately after completion while parallel processing
c#|.net|async-await|console-application|task-parallel-library
1
46
1
72,303,945
72,303,945
2
true
2022-05-19T11:34:39.810Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Task restart immediately after completion while parallel processing<p>I have to restart all task immediately after completion of the same. Please have a look...
72,303,123
Row_wise and column_wise fill NA's using fill and down/across<p>I have the following data and I am trying to &quot;clean&quot; it. I want to do 3 things:</p> <ul> <li> <ol> <li>Fill the <code>NA</code>'s in column <code>...2</code> to have something like:</li> </ol> </li> </ul> <pre><code> Andalucía Almería ...
<p>This may be done in a more compact way - i.e make use of <code>na.rm</code> in <code>unite</code> to remove the <code>NA</code>, then instead of double <code>t</code>ranspose, just <code>order</code> the rows to return the first observation as non-NA before converting the row to column name</p> <pre><code>library(dp...
Row_wise and column_wise fill NA's using fill and down/across
r|dplyr
2
46
2
72,307,397
72,307,397
2
true
2022-05-19T10:42:42.350Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Row_wise and column_wise fill NA's using fill and down/across<p>I have the following data and I am trying to &quot;clean&quot; it. I want to do 3 things:</p>...
72,312,528
Java 11 handle unmodifiable map<p>I have a class to process some files which is uploaded zipped. And a method to unzip and fill a <code>HashMap</code> and convert to an <code>Collection.unmodifiableMap</code>.</p> <pre><code>public class MyClass extends HttpServlet { ... private Map&lt;String, String&gt; rnaseqfil...
<p>servlets are quite annoying. Think of the notion that any given servlet is likely going to run many times, and probably many times simultaneously, as various users hit your site.</p> <p>They are the worst of both worlds: The servlet spec <strong>does not</strong> guarantee that the system initializes a new object fo...
Java 11 handle unmodifiable map
java|servlets|collections|hashmap|unmodifiable
0
46
1
72,312,776
72,312,776
2
true
2022-05-20T01:02:38.777Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Java 11 handle unmodifiable map<p>I have a class to process some files which is uploaded zipped. And a method to unzip and fill a <code>HashMap</code> and co...
72,319,164
type sql_identifier does not exis<p>So I am trying to run this function</p> <pre><code>CREATE OR REPLACE FUNCTION TableIteration() RETURNS TABLE(table_schema text, table_name text) LANGUAGE plpgsql AS $$ DECLARE tgt_schema varchar; list varchar[] := ARRAY[ 'sometext1', 'sometext2', 'sometext3'...
<p>The information schema columns have a strange data type (which - I think - is mandated by the SQL standard). Just cast them to text:</p> <pre><code>'SELECT t.table_schema::text, t.table_name::text from information_schema.tables t'; </code></pre>
type sql_identifier does not exis
postgresql
0
46
1
72,319,218
72,319,218
2
true
2022-05-20T12:45:49.417Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: type sql_identifier does not exis<p>So I am trying to run this function</p> <pre><code>CREATE OR REPLACE FUNCTION TableIteration() RETURNS TABLE(table_sch...
72,322,852
SQL time slot checking<p>Consider someone booked a time slot for 5:00pm to 6:30pm. If another person is trying to book for 4:00pm to 5:30pm, booking should be made invalid selection. So how can we check the time slot is already taken, using sql.</p>
<p>You can simply use below query:</p> <pre><code>SELECT * FROM bookings WHERE '4:00pm' &lt;= enddate AND '5:30pm'&gt;= startdate; </code></pre>
SQL time slot checking
sql|database
-1
46
2
72,323,181
72,323,181
2
true
2022-05-20T17:39:50.197Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL time slot checking<p>Consider someone booked a time slot for 5:00pm to 6:30pm. If another person is trying to book for 4:00pm to 5:30pm, booking should b...
72,338,713
How to perform Base64 on top of HASH in Java<p>I have the following example in Javascript, I can't seem to find the equivalent in Java for it</p> <pre><code>var rapyd_signature = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA256(data, key)); rapyd_signature = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(rapyd_sig...
<p>You initialized <code>hmacSHA256</code> … and then you didn’t do anything with it.</p> <p>You need to actually hash the data, by calling <code>hmacSHA256.doFinal</code>:</p> <pre><code>Mac hmacSHA256 = Mac.getInstance(&quot;HmacSHA256&quot;); SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(StandardChars...
How to perform Base64 on top of HASH in Java
java|encoding
-1
46
1
72,339,423
72,339,423
2
true
2022-05-22T15:00:28.753Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to perform Base64 on top of HASH in Java<p>I have the following example in Javascript, I can't seem to find the equivalent in Java for it</p> <pre><code>...
72,350,065
C# How to paste 2D array[,] onto second 2D array[,] on specified indexes<p>is there any better (less complex) way to paste the smaller array[,] to the bigger array[,] than looping through them? My code:</p> <pre><code>private void PasteRoomIntoTheMap(GameObject[,] room, (int, int) positionOnTheMap) { (int, int) roo...
<p>Short answer: <strong>No</strong></p> <p>Longer answer:</p> <p>Multidimensional arrays are really a wrapper around a 1D array, with some special code to handle indices etc. It does however lack some useful features.</p> <p>You could perhaps improve your example code a bit by copying entire columns or rows using <a h...
C# How to paste 2D array[,] onto second 2D array[,] on specified indexes
c#|arrays
1
46
2
72,350,379
72,350,379
2
true
2022-05-23T14:13:44.360Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C# How to paste 2D array[,] onto second 2D array[,] on specified indexes<p>is there any better (less complex) way to paste the smaller array[,] to the bigger...
72,376,349
Excel Change "x h x m" Format into minutes only<p>I am Trying to change the Excel cells which contain hours and minutes with &quot;h&quot; and &quot;m&quot; into minutes only. The Problem here that the letters h &amp; m are in the cell.</p> <p>What i need it to look like:</p> <p><strong>2h 30m --&gt; 150</strong></p> ...
<p>You could try something like this:</p> <p><a href="https://i.stack.imgur.com/CU7sV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CU7sV.png" alt="enter image description here" /></a></p> <pre><code>=IF(ISNUMBER(SEARCH(&quot;h&quot;;A1));VALUE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1;&quot; &quot;;&quo...
Excel Change "x h x m" Format into minutes only
excel|excel-formula
1
46
4
72,377,286
72,377,286
2
true
2022-05-25T10:56:53.210Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Excel Change "x h x m" Format into minutes only<p>I am Trying to change the Excel cells which contain hours and minutes with &quot;h&quot; and &quot;m&quot; ...
72,384,776
Having options on both side of a menu<p>I am a beginner at HTML, and I was trying to make a web page to gain experience. I wanted to create this menu but I want it to have options on both sides of it. Just like the HOME, ABOUT ME, etc. options is on the right side, I want similar options on the left side too but am not...
<p>One possible solution would be to use a <a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/" rel="nofollow noreferrer">flexbox</a> with <code>justify-content: space-between;</code></p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-co...
Having options on both side of a menu
html|css
-1
46
1
72,385,307
72,385,307
2
true
2022-05-25T22:28:52.737Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Having options on both side of a menu<p>I am a beginner at HTML, and I was trying to make a web page to gain experience. I wanted to create this menu but I w...
72,379,959
Tidyselect in custom function<p>I want to make a custom function that I can apply to a range of variables in a data frame using the <code>var1:var20</code> tidyselect syntax, but I'm running into an error. A basic example below:</p> <pre><code>library(dplyr) mtcars test_func &lt;- function(start_var,end_var) { mutate...
<p>Here's a potential solution:</p> <pre><code>library(dplyr) test_func &lt;- function(data, start_var, end_var) { data %&gt;% mutate(across({{start_var}}:{{end_var}}, ~ifelse(.x!=0,.x+1000,.x))) } mtcars %&gt;% test_func(mpg, hp) </code></pre> <p>I changed your &quot;else&quot; arg to 1000 to highlight the...
Tidyselect in custom function
r|dplyr|tidyselect
0
46
2
72,380,127
72,380,127
2
true
2022-05-25T14:57:19.923Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Tidyselect in custom function<p>I want to make a custom function that I can apply to a range of variables in a data frame using the <code>var1:var20</code> t...
72,294,641
Obtain and use UAC credential in Powershell to run job<p>I'm writing a configuration script that has to do a few things that require UAC approval, and I was hoping ideally to achieve approximating &quot;$session = sudo -v&quot; so that I can mix elevated/non-elevated and not require the user to sit at the screen for th...
<ul> <li><p>No, there is no way to cache a UAC confirmation, unfortunately.</p> <ul> <li>Conceivably - though I don't think it is worth it - you could start a single, elevated session in the background in which you roll your own IPC, such as by reading commands from a file and saving the results back to a different fil...
Obtain and use UAC credential in Powershell to run job
windows|powershell
1
46
1
72,295,689
72,295,689
2
true
2022-05-18T19:00:56.207Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Obtain and use UAC credential in Powershell to run job<p>I'm writing a configuration script that has to do a few things that require UAC approval, and I was ...
72,269,583
How to write SQL statement to select for data broken up for each month of the year?<p>I am looking for a way to write an SQL statement that selects data for each month of the year, separately.</p> <p>In the SQL statement below, I am trying to count the number of instances in the TOTAL_PRECIP_IN and TOTAL_SNOWFALL_IN co...
<p>Your table structure is too unclear to tell you the exact query you will need. But a general easy idea is to build the sum of your value and then group by monthname and/or by month. Sice you wrote you only want sum values greater 0, you can just put this condition in the where clause. So your query will be something...
How to write SQL statement to select for data broken up for each month of the year?
sql
1
46
1
72,269,925
72,269,925
2
true
2022-05-17T07:10:34.163Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to write SQL statement to select for data broken up for each month of the year?<p>I am looking for a way to write an SQL statement that selects data for ...
72,270,534
Unable to query data using like with lots of special characters(%) in MySQL<p>I inserted the value below to a users table,</p> <pre><code>~\`!@%23$%^%26*()-=_+{}[]|\\:;\&quot;'&lt;&gt;?,./ </code></pre> <p>then query it with like, got nothing , however the <code>=</code> works correct, why the <code>LIKE</code> claus...
<p>You can use concat like this (not sure MySQL or another DB type there, but the principle is the same):</p> <pre><code>select * from users where name like '%' || '~`!@%23$%^%26*()-=\_+{}[]|\\\\:;\\&quot;\'&lt;&gt;?,./' || '%'; </code></pre> <p>Here's <a href="https://dbfiddle.uk/?rdbms=mysql_8.0&amp;fiddle=4527ea8cc...
Unable to query data using like with lots of special characters(%) in MySQL
sql
1
46
2
72,270,798
72,270,798
2
true
2022-05-17T08:22:30.817Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unable to query data using like with lots of special characters(%) in MySQL<p>I inserted the value below to a users table,</p> <pre><code>~\`!@%23$%^%26*()...
72,352,750
How do I find the class of the object that's assigned to a variable?<p>I have some code like this, where I don't know what class was assigned to <code>someObject</code>:</p> <pre class="lang-cs prettyprint-override"><code>public ISomeInterface someObject; public void DoThing() { someObject.DoAnotherThing(); } </co...
<p>You can <em>also</em> do the same thing while you're debugging. If you're stopped at a break point you can enter that expression in the Watch window below.</p> <p><a href="https://i.stack.imgur.com/Prlku.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Prlku.png" alt="enter image description here" ...
How do I find the class of the object that's assigned to a variable?
c#|visual-studio
0
46
2
72,352,831
72,352,831
2
true
2022-05-23T17:42:20.790Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I find the class of the object that's assigned to a variable?<p>I have some code like this, where I don't know what class was assigned to <code>someOb...
72,258,280
Grouping with Python<p>I have a dataset I am trying to group by some common values and then sum up some other values. The tricky part is I want to add some sort of weighting that keeps the largest number, I'll try to elaborate more below:</p> <p>I've created a dummy data frame that is along the lines of my data just fo...
<p>IIUC, you can use:</p> <pre><code>(df # convert to numeric .assign(Visits=pd.to_numeric(df['Visits'])) # ensure the top row per group is the highest visits .sort_values(by=['Family', 'Visits'], ascending=False) # for groups per Family .groupby('Family', sort=False, as_index=False) # aggregate per group: Cell ...
Grouping with Python
python|pandas
1
46
1
72,258,319
72,258,319
2
true
2022-05-16T11:11:33.630Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Grouping with Python<p>I have a dataset I am trying to group by some common values and then sum up some other values. The tricky part is I want to add some s...
72,271,149
In Oracle 10g how can i store this format 1/4/2022 12:00:00 AM in Column of type Date<p>I want to store this <strong>1/4/2022 12:00:00 AM</strong> in column of type Date but i get this error <strong>ORA-01843: not a valid month</strong> can i get any help if it is possible to do this in oracle</p>
<p>Use <code>to_date</code> function with appropriate format model.</p> <p>In your example, it is unclear what <code>1/4/2022</code> represents (is it 1st of April or 4th of January) so I tried to guess it.</p> <pre><code>SQL&gt; create table test (col date); Table created. SQL&gt; insert into test (col) values (to_d...
In Oracle 10g how can i store this format 1/4/2022 12:00:00 AM in Column of type Date
sql|oracle
0
46
1
72,271,203
72,271,203
2
true
2022-05-17T09:04:37.523Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In Oracle 10g how can i store this format 1/4/2022 12:00:00 AM in Column of type Date<p>I want to store this <strong>1/4/2022 12:00:00 AM</strong> in column ...
72,240,650
scrapy image pipeline filename unsing other crawled info<p>Is there any way to name a crawled image with other info(text) that we get with the spider? for example in this case I want images with the article title and article published date that I got in spider:</p> <p><strong>spider file</strong></p> <pre><code># lines...
<p>One way to go about this is to overwrite the <code>get_media_requests</code> method and set the image name there on the image requests <code>meta</code> attribute, so you can access it in the <code>file_path</code> method.</p> <p>The following example will work if you pass one image url as string to <code>image_urls...
scrapy image pipeline filename unsing other crawled info
python|scrapy|scrapy-pipeline
2
46
1
72,243,552
72,243,552
2
true
2022-05-14T13:25:51.170Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: scrapy image pipeline filename unsing other crawled info<p>Is there any way to name a crawled image with other info(text) that we get with the spider? for ex...
72,263,262
Convert hours in decimal to duration and add to another column<p>I have one column that is a time of day (start_time), and a second that is a duration in hours that's in decimal format (duration_hours).</p> <p>I'd like to convert the duration into HH:MM and then add it to the start time to create a new variable (end_ti...
<p>The <code>hms</code> is just the number of seconds, so you may do</p> <pre><code>transform(data, end_time=as_hms(as.POSIXct(paste(Sys.Date(), start_time)) + duration_hours*60^2)) # id start_time duration_hours end_time # 1 a 06:30:00 6.47 12:58:12 # 2 b 17:05:30 5.30 22:23:30 </code></pre...
Convert hours in decimal to duration and add to another column
r|lubridate|huawei-mobile-services
1
46
2
72,263,635
72,263,635
2
true
2022-05-16T17:26:43.830Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert hours in decimal to duration and add to another column<p>I have one column that is a time of day (start_time), and a second that is a duration in hou...
72,260,954
Git mv Files According to Regex Substitution<p>I am trying to rename a large number of incorrectly named files, which are tracked in my local git repo. The files are currently of the form <code>foo.txt_1.txt</code>. And I want to change them to <code>foo.txt</code>.</p> <p>This is what I have been experimenting with so...
<p>This is easier with a for loop around it.</p> <pre class="lang-sh prettyprint-override"><code>for f in *_1.txt; do echo git mv $f ${f/_1.txt/} done </code></pre> <p>This will echo the commands it would run so you can check it's correct. Remove &quot;echo&quot; from before the &quot;git&quot; command to actually ...
Git mv Files According to Regex Substitution
bash|git|xargs
1
46
1
72,261,141
72,261,141
2
true
2022-05-16T14:36:08.300Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Git mv Files According to Regex Substitution<p>I am trying to rename a large number of incorrectly named files, which are tracked in my local git repo. The f...
72,261,323
Transpose specified columns columns to rows with grouped data<p>I have a dataframe like this:</p> <pre><code> household person R01 R02 R03 R04 R05 1 1 1 NA 1 7 7 NA 2 1 2 1 NA 7 7 NA 3 1 3 3 3 NA 11 NA 4 1 4 3 3 11 NA NA 5 2 ...
<p>Referring to my <a href="https://stackoverflow.com/a/72230856/10068985">previous answer</a>, you can transpose the matrx within <code>group_modify()</code>:</p> <pre class="lang-r prettyprint-override"><code>library(dplyr) df %&gt;% group_by(household) %&gt;% group_modify(~ { mat &lt;- t(.x[-1][1:nrow(.x)])...
Transpose specified columns columns to rows with grouped data
r|dataframe|dplyr
2
46
4
72,261,602
72,261,602
2
true
2022-05-16T15:00:25.437Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Transpose specified columns columns to rows with grouped data<p>I have a dataframe like this:</p> <pre><code> household person R01 R02 R03 R04 R05 1 ...
72,247,655
Extend a dataframe with values and next dates<p>I have to following dataframe:</p> <pre><code> value time 1 177.059998 2022-05-13 </code></pre> <p>And this array of numbers:</p> <pre><code>[[192.62466] [189.60422] [186.8717 ] [191.22443]] </code></pre> <p>I want to create new rows in the dataframe wi...
<p>You can use:</p> <pre><code># Assuming 'time' column is a DatetimeIndex df['time'] = pd.to_datetime(df['time']) df1 = pd.DataFrame({'value': np.array(m).flatten(), 'time': pd.date_range(df['time'].max(), periods=len(m)+1, freq='D', inclusive='right')}) ...
Extend a dataframe with values and next dates
python|pandas
0
46
2
72,247,746
72,247,746
3
true
2022-05-15T11:03:52.977Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Extend a dataframe with values and next dates<p>I have to following dataframe:</p> <pre><code> value time 1 177.059998 2022-05-13 </code></pr...
72,252,117
Why Net::DNS::Resolver does not return IP for localhost?<p>I am inside docker container. When I run: <code>perl -Ilocal/lib/perl5 -MNet::DNS::Resolver -e 'print Net::DNS::Resolver-&gt;new()-&gt;query( &quot;999781edb101&quot; )'</code> it returns nothing.<br /> But <code>nslookup</code> does:</p> <pre class="lang-sh pr...
<p>Judging from the docs and your debug output, you want <code>Net::DNS::Resolver-&gt;new(defnames =&gt; 0)</code> to pass unqualified names (with no dots) directly to the server, instead of always appending the default domain.</p>
Why Net::DNS::Resolver does not return IP for localhost?
perl|nslookup
0
46
1
72,252,491
72,252,491
3
true
2022-05-15T20:54:03.413Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why Net::DNS::Resolver does not return IP for localhost?<p>I am inside docker container. When I run: <code>perl -Ilocal/lib/perl5 -MNet::DNS::Resolver -e 'pr...
72,259,095
How do I create a column of numeric existing data in R?<p>I have a data frame of 22 columns and 240 rows.</p> <p>I want to create a new column with Likert Scale numeric values depending the column value.</p> <p>I want to have a new column named Result with Result == 2 if one of the columns of secretary rows &gt;= 1 els...
<p>You can use case_when, like this:</p> <pre><code> data %&gt;% mutate(Result = case_when( profession == &quot;secretary&quot; &amp; (e.count.descrition &gt;= 1 | euse.count.description &gt;=1 | ne.count.title &gt;= 1) ~ 2, prof...
How do I create a column of numeric existing data in R?
r|dataframe|likert
0
46
2
72,259,278
72,259,278
3
true
2022-05-16T12:17:58.763Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I create a column of numeric existing data in R?<p>I have a data frame of 22 columns and 240 rows.</p> <p>I want to create a new column with Likert Sc...
72,283,572
search in array of array, and return results in one array<p>using the following array of arrays I need to make a search by letter, if it finds that element it should return in one array</p> <p>example</p> <pre><code>const data= [[ &quot;car&quot;, &quot;plane&quot;, &quot;boat&quot; ], [ &qu...
<p>flat the array and filter it by checking if the substring is included in each element</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>const data= [[ "car", "plane"...
search in array of array, and return results in one array
javascript|arrays|search|indexof
-1
46
1
72,283,634
72,283,634
3
true
2022-05-18T05:22:13.297Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: search in array of array, and return results in one array<p>using the following array of arrays I need to make a search by letter, if it finds that element i...
72,287,650
How to include array of struct defined in another header in C?<p>I have the below files:</p> <ul> <li><code>swaps.c</code>:</li> </ul> <pre><code>#include &quot;swaps.h&quot; #include &quot;./poolutils.h&quot; double someFunction(struct Pool pools[]){ //do some stuff } int main(){ struct Pool pool1 = {&quot;A&quot;,&...
<p>Simply add</p> <pre><code>#include &quot;./poolutils.h&quot; </code></pre> <p>to your <code>swaps.h</code> too, if <code>swaps.h</code> needs the <code>Pool</code> struct definition.</p> <p>Since you've dutifully put include guards in <code>poolutils.h</code>, you can use the header multiple times in a single compil...
How to include array of struct defined in another header in C?
arrays|c|struct|header-files
0
46
1
72,287,687
72,287,687
3
true
2022-05-18T10:41:08.190Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to include array of struct defined in another header in C?<p>I have the below files:</p> <ul> <li><code>swaps.c</code>:</li> </ul> <pre><code>#include &q...
72,293,819
Average of profit per day (excluding present day) responsive to data validation menu for time period<p>I have a formula taken from this question: <a href="https://stackoverflow.com/questions/72281280/average-profit-per-day-formula-in-1-single-cell/72281765#72281765">Average profit per day formula in 1 single cell</a></...
<p>use:</p> <pre><code>=INDEX(AVERAGE(QUERY(IFNA(QUERY( INDEX(SORTN(QUERY(SORT({INT(B3:B), D3:D}, ROW(B3:B), ), &quot;where Col1 &lt;&gt; &quot;&amp;TODAY()&amp;&quot;and Col1 &gt;= &quot;&amp;TODAY()-VLOOKUP(SUBSTITUTE(F2, &quot; &quot;, ), {&quot;24HOURS&quot;,1; &quot;2DAYS&quot;,2; &quot;3DAYS&quot;,3; &quot;7DAY...
Average of profit per day (excluding present day) responsive to data validation menu for time period
arrays|sorting|google-sheets|google-sheets-formula|flatten
1
46
1
72,295,938
72,295,938
3
true
2022-05-18T17:49:50.563Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Average of profit per day (excluding present day) responsive to data validation menu for time period<p>I have a formula taken from this question: <a href="ht...
72,316,710
Is it OK to shutdown socket after write all data to it?<p>I'm writing simple http server. I want to <code>shutdown</code> socket after server send all data. I considered that compare return byte of <code>write()</code> to socket with actuall content length, but I had read that the return value just means that data move...
<p>The OS <strong>does not</strong> discard data you have written when you call shutdown(SHUT_WR). If the other end already shut down its end (you can tell because you received 0 bytes) then you should be able to close the socket, and the OS will keep it open until it has finished sending everything.</p> <p>The FIN is ...
Is it OK to shutdown socket after write all data to it?
sockets|server|tcp
1
46
1
72,317,306
72,317,306
3
true
2022-05-20T09:36:07.730Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it OK to shutdown socket after write all data to it?<p>I'm writing simple http server. I want to <code>shutdown</code> socket after server send all data. ...
72,316,974
Writing If loop in R<p>I want write if loop in R in correct way when I apply this code I get an error (Error: unexpected 'else' in &quot;else&quot;)</p> <pre><code>if(shapiro.test(X)$p.value&gt;=0.05 &amp;&amp; t.test(X, alternative = &quot;two.sided&quot;)$p.value&gt;=0.05){ rp&lt;-1} else if (shapiro.test(X)$p.valu...
<p>This isn't a loop. It's a series of conditional statements. It's also inefficient. You only need to write each test once. You could get <code>rp</code> without any if statements at all by considering the following:</p> <ol> <li>The expression <code>shapiro.test(X)$p.value &lt; 0.05</code> will evaluate to either <c...
Writing If loop in R
r
1
46
2
72,317,795
72,317,795
3
true
2022-05-20T09:57:57.037Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Writing If loop in R<p>I want write if loop in R in correct way when I apply this code I get an error (Error: unexpected 'else' in &quot;else&quot;)</p> <pre...
72,321,473
Array in JavaScript is undefined<p>I am very new to JavaScript but have good experience with C and java. For whatever reason my code below will not fill in the array with values other than undefined. I'm trying to simply fill an array with a random set of numbers for a blackjack game</p> <p><div class="snippet" data-la...
<ol> <li><code>Math.random</code> is a function; use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random" rel="nofollow noreferrer"><code>Math.random()</code></a></li> <li>Same for <code>push</code>, use <a href="https://developer.mozilla.org/nl/docs/Web/JavaScript/Refe...
Array in JavaScript is undefined
javascript|undefined
2
46
2
72,321,548
72,321,548
3
true
2022-05-20T15:34:21.310Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Array in JavaScript is undefined<p>I am very new to JavaScript but have good experience with C and java. For whatever reason my code below will not fill in t...
72,334,097
Is there any pratical difference for atom and null in Common Lisp if they receive a list as an argument?<p>I am using SBCL, Emacs, and Slime. According to the book <em>Symbolic Computation: A gentle introduction to Common Lisp</em>, the definition of <code>atom</code> is:</p> <blockquote> <p>The ATOM predicate returns ...
<p>A list is either:</p> <ul> <li>the empty list, <code>()</code> <em>aka</em> <code>nil</code>, which is not a cons;</li> <li>or a cons of any object and a list.</li> </ul> <p><code>null</code> returns true only for <code>nil</code>; <code>atom</code> returns true for any object which is not a cons.</p> <p>Therefore, ...
Is there any pratical difference for atom and null in Common Lisp if they receive a list as an argument?
null|logic|common-lisp
1
46
1
72,338,845
72,338,845
3
true
2022-05-22T00:46:39.600Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there any pratical difference for atom and null in Common Lisp if they receive a list as an argument?<p>I am using SBCL, Emacs, and Slime. According to th...
72,341,623
Can Collections.sort() take treeSet as first argument? If not why?<p>I have my 'Person' <code>class</code> as follows -</p> <pre><code>public class Person implements Comparable&lt;Person&gt; { private int marks; private String name; Person(int marks, String name) { this.marks = marks; this....
<p>The first argument to <code>Collections.sort</code> is of type <code>List&lt;T&gt;</code>. So you can only pass <code>List</code> objects to it, not <code>Set</code> objects, or anything else.</p> <p>This is sensible. The reason is that <code>Set</code> objects are of two types.</p> <ul> <li>There are those that a...
Can Collections.sort() take treeSet as first argument? If not why?
java|list|collections|set|comparator
0
46
1
72,341,663
72,341,663
3
true
2022-05-22T22:11:06.550Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can Collections.sort() take treeSet as first argument? If not why?<p>I have my 'Person' <code>class</code> as follows -</p> <pre><code>public class Person im...
72,343,065
Is there a way in R to total specific columns that aren't integers?<p>Really stuck with a problem in R and hoping to get some help on it.</p> <p>Consider the following table:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Vars</th> <th>Democrats(M.F)</th> <th>Republicans(M.F)</th> </tr> </...
<p>A <code>base</code> solution:</p> <pre class="lang-r prettyprint-override"><code>df[] &lt;- lapply(df, as.character) rbind( df, c(HOW = &quot;Total&quot;, lapply(df[-1], \(x) paste(rowSums(sapply(strsplit(x, &quot; . &quot;), as.numeric)), collapse = &quot; . &quot;))) ) # HOW Democrats Repubs # 1 1 ...
Is there a way in R to total specific columns that aren't integers?
r|dataframe|dplyr
1
46
2
72,343,207
72,343,207
3
true
2022-05-23T03:44:41.910Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way in R to total specific columns that aren't integers?<p>Really stuck with a problem in R and hoping to get some help on it.</p> <p>Consider the...
72,361,709
Serialising compressed data to JSON produces a larger outcome than uncompressed<p>I have some code which takes a string and if it is above a given threshold, it compresses it. The result is then serialised to JSON and converted into an Azure Service Bus Message object.</p> <p>The problem is that the compressed version ...
<p>Firstly, you shouldn't expect compression to <em>always</em> reduce the size. If that were always true, you could keep applying compression recursively and end up with an empty result which could be decompressed to &quot;anything at all&quot;.</p> <p>But the real problem is that you're taking JSON (inherently text),...
Serialising compressed data to JSON produces a larger outcome than uncompressed
.net|serialization|gzip
0
46
1
72,361,781
72,361,781
3
true
2022-05-24T11:01:03.573Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Serialising compressed data to JSON produces a larger outcome than uncompressed<p>I have some code which takes a string and if it is above a given threshold,...
72,385,148
How to find row index of common rows between two matrices in R<p>I have two matrices, a is 3000 by 3, b is 1000 by 3. Each row of a or b (e.g. a[,221]) is a 3-vector. I would like to find the row index of a which contains the common rows between a and b. Could you please help? I did a %in% b but seems not right. Thanks...
<pre><code>match(do.call(paste, data.frame(a)), do.call(paste, data.frame(b))) </code></pre> <p>or even:</p> <pre><code>A &lt;- data.frame(a) B &lt;- cbind(id = seq(nrow(b)), setNames(data.frame(b), names(A))) merge(A, B, all.x = TRUE) </code></pre>
How to find row index of common rows between two matrices in R
r
0
46
1
72,385,224
72,385,224
3
true
2022-05-25T23:32:28.773Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to find row index of common rows between two matrices in R<p>I have two matrices, a is 3000 by 3, b is 1000 by 3. Each row of a or b (e.g. a[,221]) is a ...
72,294,742
php evaluate condition using NOT operator<p>I have 4 sales offices, as soon as all 4 sales offices have received 20 leads each, only sales office no 4 should then receive the rest of the leads for the day. I need some help with creating the condition to basically check if sales office 1-4 have each received 20 leads an...
<p>Your current logic check for all office count you have to check each of them separately.</p> <pre><code>if ($sales_office1_count &lt; 20 || $sales_office2_count &lt; 20 || $sales_office3_count &lt; 20) { //distribute leads to sales office 1-4 in order of 1-4 } else { //only send leads to sales office no ...
php evaluate condition using NOT operator
php
1
46
1
72,294,830
72,294,830
3
true
2022-05-18T19:09:42.783Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: php evaluate condition using NOT operator<p>I have 4 sales offices, as soon as all 4 sales offices have received 20 leads each, only sales office no 4 should...
72,328,414
How would I transform an array into a list<p>So basically, what I want is that if I have an array like this one:</p> <pre><code>[&quot;item&quot;, &quot;item1&quot;, &quot;item2&quot;, &quot;item2&quot;, &quot;item2&quot;] </code></pre> <p>it should be changed into:</p> <pre><code> - Item\n- Item1\n- Item2 (3x) </code>...
<p>You can do something like this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>const data = ["item", "item1", "item2", "item2", "item2"] const result = Object.entries( da...
How would I transform an array into a list
javascript|discord.js
1
46
1
72,328,489
72,328,489
3
true
2022-05-21T09:44:31.853Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How would I transform an array into a list<p>So basically, what I want is that if I have an array like this one:</p> <pre><code>[&quot;item&quot;, &quot;item...
72,310,073
Why are my nested If conditions not working?<p>Using bash to write this script. For some reason my second IF condition is not working. I never get the message &quot;FALSE result&quot; when the condition is false. BTW, I need to nest two more if conditions but wanted to get this first one working. Any suggestions?</p> <...
<p>There are two problems here. The first is that <code>condition</code> is a fixed string, and will never be equal to either &quot;true&quot; or &quot;false&quot;. If it's supposed to be a variable, you need to use <code>&quot;$condition&quot;</code> to get its value (the <code>$</code> is required to get the variable...
Why are my nested If conditions not working?
bash|shell
-1
46
2
72,310,217
72,310,217
3
true
2022-05-19T19:24:25.100Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why are my nested If conditions not working?<p>Using bash to write this script. For some reason my second IF condition is not working. I never get the messag...
72,398,342
Verifying Account Transfer in Dafny<p>I'm trying to verify a simple account transfer in Dafny, and this is what I came up with:</p> <pre><code>function sum(items: seq&lt;int&gt;): int decreases |items| { if items == [] then 0 else items[0] + sum(items[1..]) } method transfer(accounts: array&lt;int&gt;, bal...
<p>Here is one way to do it.</p> <p>The problem is that Dafny does not know anything about the <code>sum</code> function, so we have to teach it a few facts.</p> <pre><code>function sum(items: seq&lt;int&gt;): int decreases |items| { if items == [] then 0 else items[0] + sum(items[1..]) } lemma sum_append(...
Verifying Account Transfer in Dafny
dafny|formal-verification
3
46
2
72,399,125
72,399,125
3
true
2022-05-26T21:44:27.670Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Verifying Account Transfer in Dafny<p>I'm trying to verify a simple account transfer in Dafny, and this is what I came up with:</p> <pre><code>function sum(i...
72,362,075
Different `String` function behavior in Chromium and Safari<p>If you run the following code in the browser console, then you get different results in Chromium and Safari.</p> <pre class="lang-js prettyprint-override"><code>String(function() { &lt;!-- }).length </code></pre> <p>Chromium returns:</p> <p><code>19</code></...
<p>The reason here is not the different linebreak symbols, but in fact Safari adds a space before the <code>()</code> function parentheses in its syntax. Try this to compare the characters side by side more easily:</p> <pre><code>String(function() { }).split(&quot;&quot;) </code></pre> <p>You will see that in Chrome, i...
Different `String` function behavior in Chromium and Safari
javascript
3
46
1
72,362,235
72,362,235
4
true
2022-05-24T11:28:42.667Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Different `String` function behavior in Chromium and Safari<p>If you run the following code in the browser console, then you get different results in Chromiu...
72,348,202
How to show log between current branch and its remote counterpart<p>Sometimes after fetching from remote repository I see my branch is behind:</p> <pre><code>&gt; git status On branch develop Your branch is behind 'origin/develop' by 7 commits, and can be fast-forwarded. (use &quot;git pull&quot; to update your local...
<p>Yes, a short and branch-agnostic way is to use the <code>@{upstream}</code> <a href="https://git-scm.com/docs/revisions#Documentation/revisions.txt-emltbranchnamegtupstreamemegemmasterupstreamememuem" rel="nofollow noreferrer">construct</a> :</p> <pre><code>git log ..@{u} </code></pre> <p>(Note : since the first par...
How to show log between current branch and its remote counterpart
git|git-log
2
46
1
72,348,324
72,348,324
4
true
2022-05-23T12:01:50.637Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to show log between current branch and its remote counterpart<p>Sometimes after fetching from remote repository I see my branch is behind:</p> <pre><code...
72,315,220
Adding values in columns from 2 dataframes<p>I have 2 dataframes as below, some of the index values could be common between the two and I would like to add the values across the two if same index is present. The output should have all the index values present (from 1 &amp; 2) and their cumulative values.</p> <pre><code...
<p>Use <a href="https://pandas.pydata.org/docs/reference/api/pandas.Series.add.html#pandas.Series.add" rel="nofollow noreferrer"><code>Series.add</code></a> and <a href="https://pandas.pydata.org/docs/reference/api/pandas.Series.fillna.html" rel="nofollow noreferrer"><code>Series.fillna</code></a></p> <pre><code>df1['B...
Adding values in columns from 2 dataframes
python|pandas|dataframe
1
46
2
72,315,516
72,315,516
4
true
2022-05-20T07:40:59.043Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Adding values in columns from 2 dataframes<p>I have 2 dataframes as below, some of the index values could be common between the two and I would like to add t...
72,329,651
Kotlin - Do kotlin list filter creates a new list object?<pre><code>fun main() { var list1 = listOf(&quot;AAAA&quot;, &quot;ASAS&quot;, &quot;ADDAD&quot;, &quot;AS&quot;) var list2 = list1 println(list2 === list1) list2 = list2 .filter { it.length &gt;= 3 } println(list2 === list1) } </code></pre> <p>The ...
<p>Indeed, <code>filter</code> does create a new list.</p> <p>And when you do</p> <pre><code>list2 = list2 .filter { it.length &gt;= 3 } </code></pre> <p>you are assigning that new list to <code>list2</code>, so now <code>list2</code> stops referring to what <code>list1</code> refers to, and starts to refer to the ...
Kotlin - Do kotlin list filter creates a new list object?
java|kotlin|collections
3
46
1
72,329,762
72,329,762
5
true
2022-05-21T12:41:06.130Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kotlin - Do kotlin list filter creates a new list object?<pre><code>fun main() { var list1 = listOf(&quot;AAAA&quot;, &quot;ASAS&quot;, &quot;ADDAD&quot;, ...
72,326,192
Do I want the buttons to change color when I click on them?<p>I want that when I click on the buttons it changes color. This is for a slider, the error is that it does not change color when I click, the only thing that changes is the image and I have tried several ways but it has not worked. I put the color in the css ...
<p>You code has 2 issues:</p> <p>The following lines of code needs to have a space or else the <code>className</code> gets concatenated to <code>quadrateactive</code> instead of being <code>quadrate active</code>. You can fix that by changing the following lines of code:</p> <p><strong>From:</strong></p> <pre class="la...
Do I want the buttons to change color when I click on them?
javascript|html|css
1
46
1
72,326,239
72,326,239
-2
true
2022-05-21T02:13:11.243Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Do I want the buttons to change color when I click on them?<p>I want that when I click on the buttons it changes color. This is for a slider, the error is th...
72,983,857
How do I include outlier points in the boxplot min and max range?<p><a href="https://i.stack.imgur.com/MvtzW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MvtzW.png" alt="enter image description here" /></a></p> <p>For WT_C57BL6, the boxplot is reading the bottom points as outliers. I want the boxp...
<p>Points are plotted as &quot;outliers&quot;, when they are 1.5 times the interquartile range (IQR) beyond the box. This can be adjusted with the <code>coef</code> parameter, which is 1.5 by default. Increasing it will include more points.</p> <p>For example, compare</p> <pre><code>ggplot(mtcars, aes(factor(cyl), hp))...
How do I include outlier points in the boxplot min and max range?
r|ggplot2|boxplot|outliers
0
46
1
72,985,126
72,985,126
1
true
2022-07-14T16:33:07.097Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I include outlier points in the boxplot min and max range?<p><a href="https://i.stack.imgur.com/MvtzW.png" rel="nofollow noreferrer"><img src="https:/...
72,867,731
"import json" doesn't import the json.loads() function (I'm working with Flask here)<p>I'm using Flask on Visual Studio Community 2022 and I'm trying to access a json file and return the object. Here's my code :</p> <pre><code>import json app = Flask(__name__) @app.route('/') def index(): return &quot;Index&quot;...
<p>Do not call that function <code>json</code>. You are also using module with that name. That would redefine the name of <code>json</code>.</p>
"import json" doesn't import the json.loads() function (I'm working with Flask here)
python
0
46
1
72,867,802
72,867,802
1
true
2022-07-05T10:18:12.453Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: "import json" doesn't import the json.loads() function (I'm working with Flask here)<p>I'm using Flask on Visual Studio Community 2022 and I'm trying to acce...
73,007,910
How can I join a table to itself having it look like it's three tables?<p>Honestly, I don't know how to join a table to itself to solve this problem.</p> <p>I have a table that stored it's record in the format below: <a href="https://i.stack.imgur.com/7A6EX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur...
<p>You can get the result by grouping on the subject name, but then you will have to use an aggregate function. Here is an example:</p> <pre><code>CREATE TABLE #StudentGrades ( [SUBJECT] VARCHAR(50), [STUDENT_ID] VARCHAR(3), [SCORE] INT, [TERM] VARCHAR(50) ) INSERT INT...
How can I join a table to itself having it look like it's three tables?
php|mysql|sql
-3
46
2
73,008,109
73,008,109
1
true
2022-07-16T22:00:40.173Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I join a table to itself having it look like it's three tables?<p>Honestly, I don't know how to join a table to itself to solve this problem.</p> <p>...
72,775,494
take information from an array and load it to a table<p>thanks for reading my post!</p> <p>I've been trying to create a function that will take the objects in an array of employee data and display them in a table.</p> <p>Within the class called 'system', I have system.giveAllEmployees(), which returns the array of all ...
<p>I suspect a careless error:</p> <p><strong>change</strong><br /> <code>if (x.employeeName === y.name) {</code><br /> <strong>to</strong><br /> <code>if (y.employeeName === x.name) {</code></p> <p>full code:<br /> for info -&gt; <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/insertRow" rel...
take information from an array and load it to a table
javascript|html|arrays|datatables
1
46
1
72,776,046
72,776,046
1
true
2022-06-27T16:33:18.790Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: take information from an array and load it to a table<p>thanks for reading my post!</p> <p>I've been trying to create a function that will take the objects i...
73,007,882
How to work with listviews correctly for displaying text<p>I'm trying to display an message, but unfortunately I think I'll need to change my method.</p> <p>So I've resumed some code</p> <pre><code> child: FutureBuilder&lt;List&lt;Product&gt;&gt;( future: products, ...
<p>The solution that comes to mind is to make products only equal to the products that have a difference of days from today of zero, so then based on <code>products.length</code> you can either return a <code>Text()</code> (<code>if products.length == 0</code>) or call <code>ListView.builder</code> (<code>if products.l...
How to work with listviews correctly for displaying text
flutter|dart|listview
0
46
3
73,008,189
73,008,189
1
true
2022-07-16T21:55:33.283Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to work with listviews correctly for displaying text<p>I'm trying to display an message, but unfortunately I think I'll need to change my method.</p> <p>...
72,963,479
Get data from two collection with specific data Mongo<p>Get data from two collection from first collection(test1) all data and from second collection (test2) customer name using createdBy and updatedBy from test1 collection.</p> <p>In createdBy and updatedBy I want fullname from test2 collection:</p> <p><strong>Test1 c...
<p>If I've understood correctly, you can use <a href="https://www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/" rel="nofollow noreferrer">$lookup</a> like this:</p> <p>This query do a &quot;join&quot; between &quot;Test1&quot; and &quot;Test2&quot; using <code>updatedBy</code> and <code>_id</code> fie...
Get data from two collection with specific data Mongo
sql|node.js|mongodb|nodes
0
46
2
72,963,656
72,963,656
1
true
2022-07-13T08:54:42.450Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get data from two collection with specific data Mongo<p>Get data from two collection from first collection(test1) all data and from second collection (test2)...
72,822,662
Why does every df value change when using Spark regexp_replace()?<p>I want to use <code>regexp_replace()</code> in PySpark to convert all question marks and back slashes in my data frame to null values. This is the code I used:</p> <pre class="lang-py prettyprint-override"><code>question = &quot;?&quot; empty_str = &qu...
<p>With <code>regexp_replace</code> you cannot replace values to null, you will need another method, e.g. <a href="https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.DataFrame.replace.html#pyspark.sql.DataFrame.replace" rel="nofollow noreferrer"><code>replace</code></a></p> <pre class...
Why does every df value change when using Spark regexp_replace()?
regex|apache-spark|pyspark|null|regexp-replace
2
46
2
72,822,759
72,822,759
1
true
2022-06-30T22:30:59.400Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does every df value change when using Spark regexp_replace()?<p>I want to use <code>regexp_replace()</code> in PySpark to convert all question marks and ...
72,779,305
Is there a way for Python to accept non-string literal input?<p>This problem has been getting in my way over and over:</p> <p>Is there any way to make the input() function in python not be read as a string, nor an integer, nor a float? Let me explain:</p> <p>I am trying to make an input where I can reference a variable...
<p>Using <a href="https://stackoverflow.com/questions/15369106/input-a-symbolic-function-in-a-python-code">Sympy</a></p> <p>Note: Similar to <a href="https://stackoverflow.com/questions/15369106/input-a-symbolic-function-in-a-python-code">this</a> previous question:</p> <p><strong>Code</strong></p> <pre><code>import sy...
Is there a way for Python to accept non-string literal input?
python
-1
46
3
72,779,426
72,779,426
1
true
2022-06-27T23:37:54.937Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way for Python to accept non-string literal input?<p>This problem has been getting in my way over and over:</p> <p>Is there any way to make the in...
72,831,288
Python Equivalent to Javascript index assignment<p>Original code in JS:</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>// applying crossover for (let i = cxpoint1; i &lt; cxpo...
<p>To fully understand the code one would need to know how the arrays p1 and p2 look like, but I assume they are integer-arrays. You select an integer from that array in the inner statement that then is the index for the outer statement.</p> <p>It works exactly the same in python:</p> <pre><code>ind1 = [1, 2, 3, 4, 5] ...
Python Equivalent to Javascript index assignment
javascript|python|arrays
0
46
2
72,831,393
72,831,393
1
true
2022-07-01T15:10:17.040Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python Equivalent to Javascript index assignment<p>Original code in JS:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data...
72,994,448
Cut out substrings of a URL in Google Spreadsheets with different characters?<p>I want to cut out substrings from this url <code>XY.com/de/haus/dach-ziegel-stein/</code> and put the values each in its own columns in Google Spreadsheet.<br /> I want to cut out by <code>/</code> and by <code>-</code>.</p> <p>With this ur...
<p>You can use the following single formula for a range</p> <pre><code>=INDEX(IFERROR(SPLIT( REGEXREPLACE( REGEXREPLACE(A125:A128,&quot;^\w+\.\w+\/&quot;,&quot; &quot;), &quot;\/|\-&quot;,&quot; &quot;),&quot; &quot;))) </code></pre> <p><em><strong>(do adjus...
Cut out substrings of a URL in Google Spreadsheets with different characters?
google-sheets|google-sheets-formula|regex-replace
-1
46
2
72,994,664
72,994,664
1
true
2022-07-15T13:04:34.920Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cut out substrings of a URL in Google Spreadsheets with different characters?<p>I want to cut out substrings from this url <code>XY.com/de/haus/dach-ziegel-s...
72,769,620
Join multiple tables with getting total number of rows from 3rd table<p>Trying to join 4 - 5 tables at once as of wanted to grab multiple data which is stored in 5 tables on in 5th table i am trying to count total number of players that have been joined the tournament this is working fine but the main problem which I a...
<p>You're mixing an aggregate function (<code>count()</code>) with plain column names in your <code>SELECT</code> clause and that is giving unexpected results. See: <a href="https://stackoverflow.com/questions/5920070/why-cant-you-mix-aggregate-values-and-non-aggregate-values-in-a-single-select">Why can&#39;t you mix A...
Join multiple tables with getting total number of rows from 3rd table
php|mysql|codeigniter
0
46
1
72,775,013
72,775,013
1
true
2022-06-27T09:13:28.807Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Join multiple tables with getting total number of rows from 3rd table<p>Trying to join 4 - 5 tables at once as of wanted to grab multiple data which is store...
72,860,613
PHP autoloader does not work in multiple files<p>In my project I have the following directories (please see the image attached). For the project to work correctly, I have to include my <code>autoloader.php</code> file into two files: <code>index.php</code> and <code>classes/FormController.php</code></p> <p>When using m...
<p>You use <code>return</code> when it fails to find the class in the first path, so it never tries the second.</p> <p>Consider something like:</p> <pre><code> spl_autoload_register('myAutoLoader'); function myAutoLoader(string $className) { $path = ['classes/', '']; $extension = '....
PHP autoloader does not work in multiple files
php
0
46
1
72,861,026
72,861,026
1
true
2022-07-04T18:08:54.450Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP autoloader does not work in multiple files<p>In my project I have the following directories (please see the image attached). For the project to work corr...
73,010,732
Scipy BasinHopping not returning correct global minima<p>I'm working with the following scipy code.</p> <pre><code>import numpy as np from scipy.optimize import basinhopping n_iter = 100 @np.vectorize def f(x): return ( x * np.sin(x) + 2*x) ** 2 x0 = -6 minimizer_kwargs = {&quot;method&quot;: &quot;BFGS&quot;} ...
<p>If you increase <code>n_iter</code> to <code>1000</code> it works!</p> <p>The output is</p> <pre><code>&quot;global minimum: x = 0.0000, f(x0) = 0.0000&quot; </code></pre> <p>It is a stochastic algorithm and in this case it requires some more attempts, indeed using</p> <pre><code>import numpy as np from scipy.optimi...
Scipy BasinHopping not returning correct global minima
python|numpy|optimization|scipy|scipy-optimize
0
46
1
73,010,747
73,010,747
1
true
2022-07-17T09:40:01.543Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Scipy BasinHopping not returning correct global minima<p>I'm working with the following scipy code.</p> <pre><code>import numpy as np from scipy.optimize imp...
72,884,752
Spring mongodb: How to make repositories work with the inheritance structure?<p>I have a collection that stores different documents representing instances of classes inheriting from the same abstract parent class. For each class I have a mongorepository defined as <code>MongoRepository&lt;Volvo, String&gt;</code> that ...
<p>One easy solution is to have a collection for each derived class. Annotating each model with that concrete collection make sure that spring only fetches the concrete car model.</p> <p>Consider the following example:</p> <pre class="lang-kotlin prettyprint-override"><code>abstract class Car( @field:Id var id:...
Spring mongodb: How to make repositories work with the inheritance structure?
spring|mongodb
0
46
1
72,889,922
72,889,922
1
true
2022-07-06T13:49:37.977Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spring mongodb: How to make repositories work with the inheritance structure?<p>I have a collection that stores different documents representing instances of...
72,933,084
How to pass subnet ids to aws_network_interface which has count attribute<p>I am getting the 3 existing subnet ids using data resource as below</p> <pre><code>data &quot;aws_subnet&quot; &quot;AZA&quot; { vpc_id = var.vpc_id filter { name = &quot;tag:Name&quot; values = [&quot;my-subnet-1a&quot;] } } <...
<p>The better way is to use <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets#filter" rel="nofollow noreferrer">aws_subnets</a> (not <code>aws_subnet</code>):</p> <pre><code>data &quot;aws_subnets&quot; &quot;AZ&quot; { filter { name = &quot;tag:Name&quot; value...
How to pass subnet ids to aws_network_interface which has count attribute
amazon-web-services|terraform|terraform-provider-aws
0
46
2
72,933,130
72,933,130
1
true
2022-07-11T02:05:23.350Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to pass subnet ids to aws_network_interface which has count attribute<p>I am getting the 3 existing subnet ids using data resource as below</p> <pre><cod...
72,884,508
How to change the year of a date POSIXct column based on thier index interval?<p>My data looks like this:</p> <pre><code>&gt; dput(head(nAUR,50)) structure(list(date = structure(c(1483440272, 1484304241, 1484564041, 1484823831, 1485428001, 1485687791, 1486032161, 1486291941, 1486551731, 1486896101, 1487155881, 148741...
<p>You could use <code>`year&lt;-`()</code> from <code>lubridate</code> to replace the year of a datetime object.</p> <pre class="lang-r prettyprint-override"><code>library(dplyr) library(lubridate) nAUR %&gt;% mutate(date2 = if_else(between(date, 1484304241, 1489747821), `year&lt;-`(date, 2...
How to change the year of a date POSIXct column based on thier index interval?
r|date|posixct
1
46
1
72,885,050
72,885,050
1
true
2022-07-06T13:33:57.590Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change the year of a date POSIXct column based on thier index interval?<p>My data looks like this:</p> <pre><code>&gt; dput(head(nAUR,50)) structure(l...
72,944,206
Is there a way to save a Django object and update other objects without a recursion loop?<p>I have a Django model:</p> <pre><code>class Event(models.Model): fk = models.ForeignKey(Foreign, null=True, on_delete=models.SET_NULL) display = display = models.BooleanField(default=True) ... </code></pre> <p>I'd like ...
<p>You can work <a href="https://docs.djangoproject.com/en/dev/ref/models/querysets/#update" rel="nofollow noreferrer"><strong><code>.update(…)</code></strong> <sup>[Django-doc]</sup></a> a <code>QuerySet</code> of other objects, with:</p> <pre><code>from django.db.models import Q class Event(models.Model): fk = m...
Is there a way to save a Django object and update other objects without a recursion loop?
python|django|django-models
1
46
1
72,944,246
72,944,246
1
true
2022-07-11T20:17:07.787Z
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 save a Django object and update other objects without a recursion loop?<p>I have a Django model:</p> <pre><code>class Event(models.Model): ...
72,998,200
Compiler can't infer type while using Newtype class Constraint purescript<p>I was trying to write a function that can get the data that a newtype wraps.</p> <pre><code>newtype Person = Person {name :: String, age :: Int} getRecord :: forall r. Newtype Person r =&gt; Person -&gt; r getRecord (Person p) = p </code></pre...
<p>Constraint solving happens when <em>calling</em> the function, but not when <em>defining</em> one.</p> <p>At call site, the compiler will solve the <code>Newtype Person r</code> constraint and figure out that <code>r ~ { age :: Int, name :: String }</code>, so you can use its fields.</p> <p>But at definition site, t...
Compiler can't infer type while using Newtype class Constraint purescript
functional-programming|purescript
0
46
1
73,006,954
73,006,954
1
true
2022-07-15T18:19:42.360Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Compiler can't infer type while using Newtype class Constraint purescript<p>I was trying to write a function that can get the data that a newtype wraps.</p> ...
72,990,050
filter array of objects and add object if condition is met<p>This is my array</p> <pre><code>{&quot;idSect&quot;:55, &quot;DenumireSect&quot;:null, &quot;idSpec&quot;:55, &quot;denumireSpece&quot;:&quot;Hematologie&quot;}, {&quot;idSect&quot;:32, &quot;DenumireSect&quot;:null, &quot;idSpec&quot;:27, &quot;denumireSpece...
<p>The only thing you would really need to do is remap your array with the values you would like, and call that in your computed property. You can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="nofollow noreferrer">array.prototype.map()</a> in JAvascript, t...
filter array of objects and add object if condition is met
javascript|arrays|vue.js
0
46
4
72,990,465
72,990,465
1
true
2022-07-15T06:51:25.580Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: filter array of objects and add object if condition is met<p>This is my array</p> <pre><code>{&quot;idSect&quot;:55, &quot;DenumireSect&quot;:null, &quot;idS...
72,790,215
SqlAlchemy 2.x with specific columns makes scalars() return non-orm objects<p>This question is probably me not understanding architecture of (new) sqlalchemy, typically I use code like this:</p> <pre><code>query = select(models.Organization).where( models.Organization.organization_id == organization_id ) result = a...
<blockquote> <p>My understanding so far was that in new sqlalchemy we should always call scalars() on the query</p> </blockquote> <p>That is mostly true, but only for queries that return whole ORM objects. Just a regular <code>.execute()</code></p> <pre class="lang-py prettyprint-override"><code> query = select(Paym...
SqlAlchemy 2.x with specific columns makes scalars() return non-orm objects
python|sqlalchemy
0
46
1
72,791,280
72,791,280
2
true
2022-06-28T16:35:20.710Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SqlAlchemy 2.x with specific columns makes scalars() return non-orm objects<p>This question is probably me not understanding architecture of (new) sqlalchemy...
72,794,249
What is the name of the Long class in Kotlin JNI?<p>This Kotlin function</p> <pre><code> @JvmStatic external fun registerNativeWindowFromSurface(): Integer; </code></pre> <p>is found by with return type <code>java/lang/Integer</code> but when I add a Long:</p> <pre><code> @JvmStatic external fun registerNativeWindowFro...
<p><code>Integer</code> is not the Kotlin-native integer type. <code>Integer</code> is an alias to <code>java.lang.Integer</code>. <code>Int</code> is the Kotlin integer type.</p> <pre><code>@JvmStatic external fun registerNativeWindowFromSurface(): Int @JvmStatic external fun registerNativeWindowFromSurface(id: Long):...
What is the name of the Long class in Kotlin JNI?
java|c|kotlin|java-native-interface
0
46
1
72,794,352
72,794,352
2
true
2022-06-28T23:36:54.083Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the name of the Long class in Kotlin JNI?<p>This Kotlin function</p> <pre><code> @JvmStatic external fun registerNativeWindowFromSurface(): Integer; ...
72,792,390
UML Activity Diagram question, in terms of displaying buttons?<p>Not sure if this is the correct way to represent the flow between the &quot;Home&quot; page button, &quot;Culture&quot; page button and the &quot;Song&quot; page button (as all these buttons are present in all of the pages, where the user is able to click...
<p>Why did you choose an activity diagram for this purpose? A state machine diagram is more appropriate. Clicking on a menu option transfers the application to a different state. You can use a superstate to model the transitions that can be made in any application state.</p> <p><a href="https://i.stack.imgur.com/c1ODg....
UML Activity Diagram question, in terms of displaying buttons?
uml|activity-diagram
3
46
1
72,796,857
72,796,857
2
true
2022-06-28T19:50:44.247Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: UML Activity Diagram question, in terms of displaying buttons?<p>Not sure if this is the correct way to represent the flow between the &quot;Home&quot; page ...
72,802,179
EventStore and EventMetadata in .net 6<p>When I append events to the eventstream log I'm using ...</p> <pre><code>var myEvents = events.Select(@event =&gt; new EventData( Guid.NewGuid(), @event.GetType().Name, true, Serialize(@event), null //metadata )...
<p>Metadata is just a JSON object. You can serialize it the same way you do it with the event data.</p> <p>I am not sure why you use the <code>EventMetadata</code> type from <code>System.Diagnostics.Eventing.Reader</code> as it has nothing to do with the EventStoreDB client.</p> <p>You don't necessarily need to store t...
EventStore and EventMetadata in .net 6
.net|event-sourcing|eventstoredb
0
46
1
72,802,480
72,802,480
2
true
2022-06-29T13:22:51.380Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: EventStore and EventMetadata in .net 6<p>When I append events to the eventstream log I'm using ...</p> <pre><code>var myEvents = events.Select(@event =&gt; n...
72,807,760
Traversing a linked-list<p>I created a simple node class, and solution class with an insert method, a display method, along with Main. I am trying to insert 4 numbers into the linked-list and have it display the entire list. At most I am only able to have it display 2 of the numbers. The issue is most likely in my inse...
<p>Yes, the problem is in the <code>insert</code> method:</p> <pre><code> while (head.next != null) { // From now on you have the initial head got lost head = head.next; } </code></pre> <p>Quick amendment is to change <code>while</code> into <code>for</code>:</p> <pre><code> public static Nod...
Traversing a linked-list
c#|linked-list
1
46
1
72,808,203
72,808,203
2
true
2022-06-29T20:56:04.677Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Traversing a linked-list<p>I created a simple node class, and solution class with an insert method, a display method, along with Main. I am trying to insert ...
72,812,356
How to use the %T>% pipe after ggplot?<p>Let's take a look at the following two pieces of code:</p> <pre><code>mtcars %&gt;% ggplot(aes(x = cyl, y = mpg))+ geom_line() </code></pre> <p>This works and creates the following plot:</p> <p><a href="https://i.stack.imgur.com/w3k2l.png" rel="nofollow noreferrer"><img ...
<p>You need to wrap the <code>ggplot</code> call in a <code>print</code> so you get both calls. You can use the following code:</p> <pre class="lang-r prettyprint-override"><code>library(tidyverse) #&gt; Warning: package 'ggplot2' was built under R version 4.1.2 #&gt; Warning: package 'tibble' was built under R version...
How to use the %T>% pipe after ggplot?
r|ggplot2|pipeline
3
46
1
72,812,418
72,812,418
2
true
2022-06-30T08:10:48.477Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use the %T>% pipe after ggplot?<p>Let's take a look at the following two pieces of code:</p> <pre><code>mtcars %&gt;% ggplot(aes(x = cyl, y = mpg)...
72,828,987
Perform array treatment with reduce<p>I have an array that i need to treat to extract and form a new object, this is the code i run right now:</p> <pre><code>data_proces = Object.values(selectedData.reduce((r, { Code, Description, Price}) =&gt; { r[Description] ??= { Code, Description, Units: 0, Price: 0 , Tota...
<p>You can simply create an array of <code>Description</code> properties that you don't want summed and create unique keys if the iterated description is included in the array. Here using the third <code>index</code> parameter of the <code>reduce()</code> callback.</p> <p><div class="snippet" data-lang="js" data-hide="...
Perform array treatment with reduce
javascript|arrays|object|reduce
0
46
1
72,829,289
72,829,289
2
true
2022-07-01T12:02:03.147Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Perform array treatment with reduce<p>I have an array that i need to treat to extract and form a new object, this is the code i run right now:</p> <pre><code...
72,837,339
how to copy part of rows based on group by 'id' in R?<p>I have a data frame such as below:</p> <pre><code>id Date Age Sex PP Duration cd nh W_B R_B 583 99/07/19 51 2 NA 1 0 0 6.2 4.26 583 99/07/23 51 2 NA NA NA NA 7 4.35 30...
<p>Another option using <code>na.locf</code>:</p> <pre class="lang-r prettyprint-override"><code>df &lt;- read.table(text=&quot;id Date Age Sex PP Duration cd nh W_B R_B 583 99/07/19 51 2 NA 1 0 0 6.2 4.26 583 99/07/23 51 2 NA NA NA ...
how to copy part of rows based on group by 'id' in R?
r|copy
-1
46
2
72,837,620
72,837,620
2
true
2022-07-02T07:37:57.523Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to copy part of rows based on group by 'id' in R?<p>I have a data frame such as below:</p> <pre><code>id Date Age Sex PP Duration cd ...
72,834,291
Rust SDL2 Timer: How can I return timer object from the function?<p>I am using sdl2 crate and I am trying to create a simple &quot;context&quot; object with timer inside of it. I have the following code</p> <pre><code>extern crate sdl2; struct Ctx&lt;'a, 'b&gt; { timer: sdl2::timer::Timer&lt;'a, 'b&gt;, } impl&lt...
<p>The secret is in the <code>PhantomData</code>. <a href="https://docs.rs/sdl2/0.35.2/src/sdl2/timer.rs.html#68" rel="nofollow noreferrer">The full type as declared inside <code>Timer</code> is <code>PhantomData&lt;&amp;'b ()&gt;</code></a>, and <a href="https://docs.rs/sdl2/0.35.2/src/sdl2/timer.rs.html#17" rel="nofo...
Rust SDL2 Timer: How can I return timer object from the function?
rust
2
46
1
72,843,415
72,843,415
2
true
2022-07-01T20:21:48.377Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Rust SDL2 Timer: How can I return timer object from the function?<p>I am using sdl2 crate and I am trying to create a simple &quot;context&quot; object with ...
72,851,341
Looping pipe operator code through multiple Dataframe in R<p>does anyone know how I can loop pipe operator code through multiple dataframe?</p> <p>I've quite a few dataframe named over the years (df_1990, df_1991 ... df_2020). However, not all years are included, (i.e. df_1993, df_2012 and 3 more years are not availabl...
<p>Personally I would move the data wrangling code in a function and would then use <code>lapply</code> to loop over your list of data frames.</p> <pre class="lang-r prettyprint-override"><code>library(dplyr) df_list &lt;- list(df, df, df) prep_data &lt;- function(x) { x %&gt;% group_by(Item) %&gt;% summari...
Looping pipe operator code through multiple Dataframe in R
r|dataframe|loops|for-loop|data-manipulation
2
46
2
72,852,737
72,852,737
2
true
2022-07-04T02:53:04.033Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Looping pipe operator code through multiple Dataframe in R<p>does anyone know how I can loop pipe operator code through multiple dataframe?</p> <p>I've quite...
72,854,274
Site is fast on localhost but slow on server<p>I'm using XAMPP on Windows 10 to serve a website, and the website is very fast on localhost, but very slow on my public domain address. Why is that? My internet speed should be fine.</p>
<p>try to load all CSS files in starting and put all js files at the end and remove unwanted comments or files. this might help to improve the speed of your site. and also the resolution or maybe size of images which you use in your site it will make much faster your website.</p>
Site is fast on localhost but slow on server
javascript|php
-2
46
1
72,854,339
72,854,339
2
true
2022-07-04T09:08:15.530Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Site is fast on localhost but slow on server<p>I'm using XAMPP on Windows 10 to serve a website, and the website is very fast on localhost, but very slow on ...
72,858,526
Kotlin: ListVew inside a fragment<p>i am trying to create a very simple listview inside a fragment but there is something that i am doing wrong and the list view doesnt show on the screen.</p> <p>this is my <code>fragmentWifi.kt</code>:</p> <pre><code>import android.os.Bundle import androidx.fragment.app.Fragment impor...
<p>Just to explain what's going on</p> <pre><code> override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_wifi, container, false) ...
Kotlin: ListVew inside a fragment
android|kotlin|listview|android-fragments
0
46
3
72,860,761
72,860,761
2
true
2022-07-04T14:45:04.400Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kotlin: ListVew inside a fragment<p>i am trying to create a very simple listview inside a fragment but there is something that i am doing wrong and the list ...
72,863,393
web.xml error when using 'HttpOnly' and 'Secure' attributes<p>I want to make my JSF application less vulnerable to session hijacking. So I have added the following code to the web.xml file.</p> <pre><code>&lt;session-config&gt; &lt;session-timeout&gt; 60 &lt;/session-timeout&gt; &lt;cookie-config&gt...
<p><code>http-only</code> element comes before <code>secure</code> element in the sequence. See <a href="https://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-common_4_0.xsd" rel="nofollow noreferrer">web-common_4_0.xsd</a> for the <code>cookie-configType</code> type description.</p> <p>Your config should ...
web.xml error when using 'HttpOnly' and 'Secure' attributes
jsf|web.xml|session-hijacking
2
46
1
72,866,851
72,866,851
2
true
2022-07-05T02:18:54.147Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: web.xml error when using 'HttpOnly' and 'Secure' attributes<p>I want to make my JSF application less vulnerable to session hijacking. So I have added the fol...
72,870,923
How to make button visible in scrollview if it's related textfield has been focused<p>I have a <code>ScrollView</code> which contains <code>VStack</code> which contains a large amount of entries. The amount is not important it is just that you have to scroll to get to a <code>TextField</code> at the end of the list. Be...
<p>Here is a possible solution - based on <code>scrollTo</code>, focused state, and animation alignment, latter is important, because focused state update happens much earlier than keyboard appears.</p> <p>Tested with Xcode 13.4 / iOS 15.5</p> <p><a href="https://i.stack.imgur.com/Y4oLJ.gif" rel="nofollow noreferrer"><...
How to make button visible in scrollview if it's related textfield has been focused
ios|swift|swiftui|scrollview
1
46
1
72,871,979
72,871,979
2
true
2022-07-05T14:13:43.660Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make button visible in scrollview if it's related textfield has been focused<p>I have a <code>ScrollView</code> which contains <code>VStack</code> whi...
72,873,362
How to rotate 90 deg of 2D array inside 3D array?<p>I have a 3D array consist of 2D arrays, I want to rotate only the 2D arrays inside the 3D array without changing the order, so it will become a 3D array consist of rotated 3D arrays.</p> <p>For example, I have a 3D array like this.</p> <pre><code>foo = np.array([[[1, ...
<p>You can use <a href="https://numpy.org/doc/stable/reference/generated/numpy.rot90.html" rel="nofollow noreferrer"><code>numpy.rot90</code></a> by setting axes that you want to rotate.</p> <pre><code>foo = np.array([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]) rotated_foo = np.rot90(foo, axes=(2,1)) print(rot...
How to rotate 90 deg of 2D array inside 3D array?
python|arrays|python-3.x|numpy|multidimensional-array
4
46
3
72,873,568
72,873,568
2
true
2022-07-05T17:24:20.210Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to rotate 90 deg of 2D array inside 3D array?<p>I have a 3D array consist of 2D arrays, I want to rotate only the 2D arrays inside the 3D array without c...
72,874,381
"an error has occured in the script on this page" when trying to display htm file through xaml api<p>This might be a little too specific, but whenever I run this code, I get an error.</p> <pre><code>private void WebBrowser_Clicked(object sender, RoutedEventArgs e) { wb.Navigate(&quot;C:/Users/intern...
<p>If you are using the old WPF WebBrowser control be sure to add <code>&lt;meta charset=&quot;utf-8&quot; http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot; /&gt;</code> to the head of your page. If you don't it will use IE6 rendering which isn't supported by Bing Maps. This is documented here: <a href...
"an error has occured in the script on this page" when trying to display htm file through xaml api
javascript|bing-maps
1
46
1
72,874,746
72,874,746
2
true
2022-07-05T19:05:08.663Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: "an error has occured in the script on this page" when trying to display htm file through xaml api<p>This might be a little too specific, but whenever I run ...
72,876,022
Fill a dataframe with the output of a loop<p>I'm trying to concatenate the output of a loop into dataframe. This example is totally unrealistic, but just to try to demonstrate my problem, my error and the result I need.</p> <pre><code>for a in range(1,4): list1 = [&quot;22&quot;, &quot;23&quot;, &quot;24&quot;, &q...
<p>You can do</p> <pre><code>l = [] for a in range(1, 4): list1 = [&quot;22&quot;, &quot;23&quot;, &quot;24&quot;, &quot;25&quot;] list2 = [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;] l.append(pd.DataFrame({'Num': list1, 'Alpha': list2})) out = pd.concat(l,ignore_index = True) </code></...
Fill a dataframe with the output of a loop
python|python-3.x|pandas
1
46
3
72,876,062
72,876,062
2
true
2022-07-05T22:05:18.753Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fill a dataframe with the output of a loop<p>I'm trying to concatenate the output of a loop into dataframe. This example is totally unrealistic, but just to ...
72,876,101
'import' and 'from import' behaves differently<p>As per my understanding, the difference between 'import' and 'from import' in Python is: 'import' imports the whole library, 'from import' imports a specific member or members of the library, and there should not be any behavioral difference.</p> <p>As per this, I was ex...
<blockquote> <p>'import' imports the whole library, 'from import' imports a specific member or members of the library, and there should not be any behavioral difference.</p> </blockquote> <p>Both versions - assuming the module has not already been imported - cause the top-level code to execute and a <code>module</code>...
'import' and 'from import' behaves differently
python|python-3.x
1
46
1
72,876,233
72,876,233
2
true
2022-07-05T22:16:54.117Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: 'import' and 'from import' behaves differently<p>As per my understanding, the difference between 'import' and 'from import' in Python is: 'import' imports th...
72,877,813
group_by is sorting numbers out of order in R<p>I'm trying to make a stacked histogram, and have run into issues grouping/sorting data that I haven't been able to resolve. For example, when I group my data, the output says that 100 &lt; 90 (I think because 1 &lt; 9), and I can't figure out how to get R to group using t...
<p>When you using the ggplot2 command, just convert the &quot;CoOc&quot; to numeric (x = as.numeric(CoOc)) and then plot.</p> <pre><code>library(tidyverse) # Fake data Sims &lt;- seq(1,100,1) CoOc &lt;- sample(90:140, 100, replace = TRUE) Out &lt;- sample(c(&quot;A Wins&quot;, &quot;B Wins&quot;, &quot;Tie&quot;), 100...
group_by is sorting numbers out of order in R
r|sorting|ggplot2|grouping|histogram
-1
46
1
72,877,868
72,877,868
2
true
2022-07-06T03:59:33.723Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: group_by is sorting numbers out of order in R<p>I'm trying to make a stacked histogram, and have run into issues grouping/sorting data that I haven't been ab...
72,880,246
Create Regex to remove string and character from row values<p>I have a column in my dataframe that looks like this:</p> <pre><code>branching_loc &lt;- c(&quot;([preliminary_arm_1][antibiotic_arm] = '1') and [was_review_done]='1'&quot;, &quot;[preliminary_arm_1][antibiotic_arm] = '1' and [was_review_...
<p>A possible solution:</p> <pre class="lang-r prettyprint-override"><code>library(tidyverse) df %&gt;% mutate(branching_loc = str_remove(branching_loc, &quot;\\[preliminary_arm_1\\]&quot;)) #&gt; branching_loc #&gt; 1 ([antibiotic_arm] = '1') and [was_review_done]='1' #&gt; ...
Create Regex to remove string and character from row values
r|dplyr
2
46
3
72,880,459
72,880,459
2
true
2022-07-06T08:31:45.830Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create Regex to remove string and character from row values<p>I have a column in my dataframe that looks like this:</p> <pre><code>branching_loc &lt;- c(&quo...
72,884,246
How can I move all files from one folder to another? GCP, cloud storage<p>I need to move exactly all files from one folder in cloud storage to another, how can I do it? I have seen gsutil command, but I cannot find how to move all files.</p> <p>I will be grateful if you help me with that</p>
<p>A folder in a storage bucket is just a prefix (see <a href="https://cloud.google.com/storage/docs/cloud-console#_creatingfolders" rel="nofollow noreferrer">documentation</a>).</p> <p>So, what you want to do is change the prefix and according to GCS <a href="https://cloud.google.com/storage/docs/gsutil/commands/mv#re...
How can I move all files from one folder to another? GCP, cloud storage
google-cloud-platform|google-cloud-storage
1
46
1
72,884,759
72,884,759
2
true
2022-07-06T13:16:36.073Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I move all files from one folder to another? GCP, cloud storage<p>I need to move exactly all files from one folder in cloud storage to another, how c...