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,895,701 | Creating a matrix with values in Kotlin in convenience<p>I want to create the following one with a fancy notation:</p>
<pre><code>arrayOf(intArrayOf(4, 5), intArrayOf(5, 8), intArrayOf(1, 9), intArrayOf(8, 10), intArrayOf(1, 6))
</code></pre>
<p>at least, cannot I achieve something that looks as follows:</p>
<pre><code... | <p>If you simply don't like the wordiness of using <code>intArrayOf</code> you could define a shorter name to do the same, for example</p>
<pre><code>fun i(vararg e: Int) = intArrayOf(*e)
</code></pre>
<p>And then do</p>
<pre><code>arrayOf(i(4, 5), i(5, 8), i(1, 9), i(8, 10), i(1, 6))
</code></pre> | Creating a matrix with values in Kotlin in convenience | kotlin|matrix | 1 | 49 | 3 | 72,895,985 | 72,895,985 | 2 | true | 2022-07-07T09:48:42.333Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating a matrix with values in Kotlin in convenience<p>I want to create the following one with a fancy notation:</p>
<pre><code>arrayOf(intArrayOf(4, 5), i... |
72,900,041 | Playing background music with Sprite Kit<p>I am new to Sprite Kit and currently developing my first Game.
Now I want to add some background music (and maybe later some effects) to it and tried it with this piece of code:</p>
<pre><code>func playBackgroundMusic() {
// 1 - Create player
let url = Bundle.m... | <p>The <code>player</code> variable is local to the <code>playBackgroundPlayer</code> function. When you start playing the music, the function exits. When the function exits, <code>player</code> no longer exists. That would explain why the music stops.</p>
<p>The fix is to add a property for the AVAudioPlayer to the cl... | Playing background music with Sprite Kit | swift|sprite-kit | 1 | 49 | 1 | 72,904,763 | 72,904,763 | 2 | true | 2022-07-07T14:56:01.797Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Playing background music with Sprite Kit<p>I am new to Sprite Kit and currently developing my first Game.
Now I want to add some background music (and maybe ... |
72,923,039 | Python patched Class - method return_value returns MagicMock<p>I have a function that determines if a token can be pulled from environment variables, or from Google Cloud Secret Manager (via a custom class).</p>
<p>I am mocking the secret manager connection class so it doesn't actually connect to GCP, however the <code... | <h2>Cause of the problem</h2>
<p>Patching <code>SecretManagerConnection</code> class will replace it with a magic mock instance. When this class is instantiated in the <code>fetch_token</code> function, the instantiated class will return the <code>return_value</code> of mock instance which in your case is not properly ... | Python patched Class - method return_value returns MagicMock | python|pytest|pytest-mock | 2 | 49 | 1 | 72,923,313 | 72,923,313 | 2 | true | 2022-07-09T16:30:04.610Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python patched Class - method return_value returns MagicMock<p>I have a function that determines if a token can be pulled from environment variables, or from... |
72,926,243 | Regex - Would Like to Match Patterns Across Multiple Lines and Consolidate the Lines<p>I have a file of program code and would like to use Regex to combine multiple lines.
A typical series of lines might look this:</p>
<pre><code> rp = 10;
cp = 15;
wd = 2;
ht = 1;
dr = 3;
ds = 10 + 5 * x;
sp = 50;
... | <ul>
<li><kbd>Ctrl</kbd>+<kbd>H</kbd></li>
<li>Find what: <code>(?<!\);)\R(?!\w+\()</code></li>
<li>Replace with: <code>A SPACE</code></li>
<li><strong>CHECK</strong> <em>Wrap around</em></li>
<li><strong>CHECK</strong> <em>Regular expression</em></li>
<li><kbd>Replace all</kbd></li>
</ul>
<p><strong>Explanation:</s... | Regex - Would Like to Match Patterns Across Multiple Lines and Consolidate the Lines | regex|notepad++ | 0 | 49 | 1 | 72,927,199 | 72,927,199 | 2 | true | 2022-07-10T05:00:29.710Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex - Would Like to Match Patterns Across Multiple Lines and Consolidate the Lines<p>I have a file of program code and would like to use Regex to combine m... |
72,944,021 | Python's os.chmod behaves differently on Linux vs Windows<p>I do have a question for the community, from which I will either learn something new about Windows and Linux, or it will result in a Python bug.</p>
<p>I am trying to set the permissions of a file to be readable by the user only. I am using the <a href="https:... | <p>Please look at the <a href="https://docs.python.org/3/library/os.html#os.chmod" rel="nofollow noreferrer">documentation</a> for <code>os.chmod</code>.</p>
<blockquote>
<p>Note Although Windows supports chmod(), you can only set the file’s
read-only flag with it (via the stat.S_IWRITE and stat.S_IREAD
constants or a ... | Python's os.chmod behaves differently on Linux vs Windows | python|python-3.x|linux|windows|stat | 0 | 49 | 2 | 72,944,165 | 72,944,165 | 2 | true | 2022-07-11T19:59:38.723Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python's os.chmod behaves differently on Linux vs Windows<p>I do have a question for the community, from which I will either learn something new about Window... |
72,953,920 | Dataframe sort and remove on date<p>I have the following data frame</p>
<pre><code>import pandas as pd
from pandas import Timestamp
df=pd.DataFrame({
'Tech en Innovation Fonds': {0: '63.57', 1: '63.57', 2: '63.57', 3: '63.57', 4: '61.03', 5: '61.03', 6: 61.03}, 'Aandelen Index Fonds': {0: '80.22', 1: '80.22', 2: '80.2... | <p>You can use <code>.max()</code> with datetime columns like this:</p>
<pre><code>dfclean = df.loc[
(df['Datum'].dt.date < df['Datum'].max().date()) |
(df['Datum'] == df['Datum'].max())
]
</code></pre>
<p>Output:</p>
<pre><code> Tech en Innovation Fonds Aandelen Index Fonds Behoudend Mix Fonds \
0 ... | Dataframe sort and remove on date | python|pandas|dataframe | 1 | 49 | 4 | 72,954,026 | 72,954,026 | 2 | true | 2022-07-12T14:23:44.393Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dataframe sort and remove on date<p>I have the following data frame</p>
<pre><code>import pandas as pd
from pandas import Timestamp
df=pd.DataFrame({
'Tech ... |
72,964,456 | Is public IP we get in pod different from Node's public IP it is running?<p>I have pods running on different nodes. But when I execute the command
<code>curl -s checkip.dyndns.org</code>, I am getting the same public IP for all. So, is the pod's public IP different from the public IP of the node it is running?</p>
<p>A... | <p><code>...when I execute the command curl -s checkip.dyndns.org, I am getting the same public IP for all.</code></p>
<p>That's your NAT public IP.</p>
<p><code>I actually need the node's public IP address...</code></p>
<p>The node needs to run in a subnet that allows direct (no NAT) Internet access and have public IP... | Is public IP we get in pod different from Node's public IP it is running? | kubernetes | 1 | 49 | 1 | 72,964,589 | 72,964,589 | 2 | true | 2022-07-13T10:06:10.547Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is public IP we get in pod different from Node's public IP it is running?<p>I have pods running on different nodes. But when I execute the command
<code>curl... |
72,969,479 | How can I find the name of a JavaScript function<p>I have for example a function called "Apples()" and a function called "Pears()".
These are to be instantiated via various calls such as new Apples() or new Pears().
All of these new instances are to be stored in an array.</p>
<p>At some later point ... | <p>You can use the <code>Object.getPrototypeOf()</code> function to get the prototype. The constructor function will be in the prototype's <code>constructor</code> property, and you can get its name from the <code>name</code> property.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" dat... | How can I find the name of a JavaScript function | javascript|arrays|function | 0 | 49 | 2 | 72,969,557 | 72,969,557 | 2 | true | 2022-07-13T16:16:18.557Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I find the name of a JavaScript function<p>I have for example a function called "Apples()" and a function called "Pears()".
These... |
72,969,983 | SQL Server formating time returns null values<p>In my table I have two fields with <code>time(2)</code> type: <code>startTime</code> and <code>endTime</code>.</p>
<pre><code>SELECT startTime, endTime FROM ...
</code></pre>
<p>gives me time formated like this: <code>13:00:00</code>. I want to display time in my app with... | <p>You need to escape the colon <code>:</code> as <code>\:</code>. For example:</p>
<pre><code>SELECT FORMAT(startTime, 'hh\:mm') as startTime FROM t
</code></pre>
<p>Result:</p>
<pre><code>startTime
---------
12:00
13:00
</code></pre>
<p>See example at <a href="https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=1797... | SQL Server formating time returns null values | sql-server|tsql | 0 | 49 | 2 | 72,970,065 | 72,970,065 | 2 | true | 2022-07-13T16:57:57.100Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL Server formating time returns null values<p>In my table I have two fields with <code>time(2)</code> type: <code>startTime</code> and <code>endTime</code>... |
72,973,260 | Automaticaly creating users in Oracle Apex based on table values<p>Is there a way to automatically create a user in my application based on values in a table?</p>
<p>So I have a table named <code>EMP</code> as employee in that table I have attributes <code>name, surname, username</code> and <code>password</code>. What ... | <p>In such a case, maybe it would be better to use <strong>custom authentication</strong> scheme instead of default, built-in Apex authentication.</p>
<hr />
<p>How to create new users? Just <em>insert</em> them into the table. It would be a good idea to create a <strong>package</strong> which contains procedures used ... | Automaticaly creating users in Oracle Apex based on table values | oracle|authentication|plsql|oracle-apex | 0 | 49 | 1 | 72,975,962 | 72,975,962 | 2 | true | 2022-07-13T22:23:04.690Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Automaticaly creating users in Oracle Apex based on table values<p>Is there a way to automatically create a user in my application based on values in a table... |
72,977,404 | Spring keeps saying Repository is null everytime i do calls<p>I keep on running into the following error:</p>
<p>java.lang.NullPointerException: Cannot invoke "com.example.cinema.Repository.VideosRepository.save(Object)" because "com.example.cinema.Service.VideoService.videoRepository" is null</p>
<... | <p>Here is the error</p>
<pre><code>@Autowired
private static VideosRepository videoRepository;
</code></pre>
<p>remove <code>static</code> !</p>
<p>Spring can't autowire to static fields as those are created when the class is loaded initially in JVM and are for common use between different java instances. Spring inste... | Spring keeps saying Repository is null everytime i do calls | java|spring|mongodb|spring-boot | 0 | 49 | 1 | 72,977,476 | 72,977,476 | 2 | true | 2022-07-14T08:21:23.133Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spring keeps saying Repository is null everytime i do calls<p>I keep on running into the following error:</p>
<p>java.lang.NullPointerException: Cannot invok... |
72,972,960 | Need help in appending dictionary items in python<p>I am trying to get movies by genres from tmdb movie dataset by converting it into json.</p>
<p>There should be multiple entries for a specific genre like 'adventure', but all i get to see is the last record and seems like the previous records are getting overwritten. ... | <p>There are two obvious problems. You redefine <code>final_list</code> in the loop and you return during the first loop.</p>
<p>Fixing that will give you something like this:</p>
<pre><code>def myfunction(data, genre_name):
movie_dict = {}
final_list = []
for i in range(1,1000):
if genre_name in da... | Need help in appending dictionary items in python | python|json|dictionary | 2 | 49 | 3 | 72,977,946 | 72,977,946 | 2 | true | 2022-07-13T21:45:09.787Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Need help in appending dictionary items in python<p>I am trying to get movies by genres from tmdb movie dataset by converting it into json.</p>
<p>There shou... |
73,002,016 | querySelector of item by a pattern of id<p>I'm trying to get all elements with id <code>feed_item_{n}</code> where <code>{n}</code> can be any integer greater than 0.<br>
I know that I can use <code>document.querySelectorAll('[id^="feed_item_"]')</code> but that doesn't really help because I get also elements... | <p>Since it's not possible to use RegEx within attribute selectors, the only way is to filter your <code>querySelectorAll</code> result; and there.. you can use a regex to match only numbers after <code>feed_item_</code></p>
<p>It will be something like this</p>
<pre><code>let items = [...document.querySelectorAll('[id... | querySelector of item by a pattern of id | javascript|html | 1 | 49 | 2 | 73,002,096 | 73,002,096 | 2 | true | 2022-07-16T06:27:58.207Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
querySelector of item by a pattern of id<p>I'm trying to get all elements with id <code>feed_item_{n}</code> where <code>{n}</code> can be any integer greate... |
73,001,868 | pandas split string with $ special text style<p>I have an excel, the data has two $ , when I read it using pandas, it will convert them to a very special text style.</p>
<pre><code>import pandas as pd
df = pd.DataFrame({ 'Bid-Ask':['$185.25 - $186.10','$10.85 - $11.10','$14.70 - $15.10']})
</code></pre>
<p><a href="htt... | <p>Do not split. Using <code>str.extract</code> is likely the most robust:</p>
<pre><code>df[['Bid', 'Ask']] = df['Bid-Ask'].str.extract(r'(\d+(?:\.\d+)?)\D*(\d+(?:\.\d+)?)')
</code></pre>
<p>Output:</p>
<pre><code> Bid-Ask Bid Ask
0 $185.25 - $186.10 185.25 186.10
1 $10.85 - $11.10 10.85 ... | pandas split string with $ special text style | python|python-3.x|pandas|dataframe | 2 | 49 | 3 | 73,002,203 | 73,002,203 | 2 | true | 2022-07-16T05:54:26.137Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pandas split string with $ special text style<p>I have an excel, the data has two $ , when I read it using pandas, it will convert them to a very special tex... |
73,006,244 | Change script file extension in Apps Script online IDE<p>I've created a script using Apps Script in Google Sheets, and would like to code in TypeScript. I gather to do this you need to rename the default <code>.gs</code> file to <code>.ts</code>.</p>
<p><strong>How does one accomplish that in the online IDE?</strong> ... | <p>Typescript is currently not supported in Apps script editor. There is however, a feature request for the same here: <a href="https://issuetracker.google.com/issues/238057231" rel="nofollow noreferrer">https://issuetracker.google.com/issues/238057231</a></p>
<p>You may add a +1 or comment in the tracker explaining be... | Change script file extension in Apps Script online IDE | typescript|google-apps-script|google-sheets|ide | 0 | 49 | 1 | 73,006,440 | 73,006,440 | 2 | true | 2022-07-16T17:14:46.897Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change script file extension in Apps Script online IDE<p>I've created a script using Apps Script in Google Sheets, and would like to code in TypeScript. I g... |
73,009,383 | Column values based on month and year of 'date' column<p>I am working on a dataframe having above 25000 rows. The data spans between 2012 to 2021. In this I have a column date. I want to create another column called assessmentYear(AY), Where year, and month from a date column should be used to create values. Each asses... | <p>Use <code>to_period</code> to convert as quarter and <code>qyear</code> to a fiscal year:</p>
<pre><code>fyear = pd.to_datetime(df['Date']).dt.to_period('Q-SEP').dt.qyear
df['AY'] = 'AY' + df.groupby(fyear).ngroup().add(1).astype(str)
print(df)
# Output
Date AY
1 2019-09-19 AY1
2 2019-09-20 AY1
3 ... | Column values based on month and year of 'date' column | python|pandas|date | 2 | 49 | 1 | 73,009,481 | 73,009,481 | 2 | true | 2022-07-17T05:07:45.680Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Column values based on month and year of 'date' column<p>I am working on a dataframe having above 25000 rows. The data spans between 2012 to 2021. In this I ... |
73,010,834 | Class implements interface and expose it as property<p>Do you think the following code create some circular reference?</p>
<pre><code>public interface IMyInterface
{
}
public class MyClass : IMyInterface
{
public IMyInterface MyInterface { get; set; }
}
public class AnotherClass : IMyInterface
{
}
</cod... | <p>The way you done it using Interface is the right way to do it. No circular reference will occur.</p>
<p>Here's another similar question answered here on OS <a href="https://stackoverflow.com/questions/6928387/how-to-solve-circular-reference">here</a></p>
<p>Furthermore, here's another detailed example from <a href="... | Class implements interface and expose it as property | c# | 2 | 49 | 3 | 73,010,926 | 73,010,926 | 2 | true | 2022-07-17T09:58:48.750Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Class implements interface and expose it as property<p>Do you think the following code create some circular reference?</p>
<pre><code>public interface IMyInt... |
73,021,437 | Add new rows in R dataframe to fill time gaps<p>I have a data frame like this:</p>
<pre><code>df <- data.frame(
id = c(1, 2, 2),
time_0 = c(2, 3, 6),
time_1 = c(4, 5, 8),
event = 1,
time_end = 10)
df
#> id time_0 time_1 event time_end
#> 1 1 2 4 1 10
#> 2 2 3 ... | <p>Try this</p>
<pre><code>m <- data.frame(id = 0 , time_0 = 0, time_1 = 0)
k <- 1
for(i in unique(df$id)){
x <- sort(unique(c(0 , unlist(subset(df , id == i)[,2:3]) , 10)))
for(j in 1:(length(x)-1)){
m[k,] <- c(i , x[j] , x[j+1])
k <- k + 1
}
}
ans <- merge(m , df , by = ... | Add new rows in R dataframe to fill time gaps | r | 1 | 49 | 1 | 73,022,244 | 73,022,244 | 2 | true | 2022-07-18T11:14:45.100Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add new rows in R dataframe to fill time gaps<p>I have a data frame like this:</p>
<pre><code>df <- data.frame(
id = c(1, 2, 2),
time_0 = c(2, 3, 6),... |
73,024,612 | cx_oracle connection without DSN<p>I am maintaining some code where i came about a curious connection string of following type to an oracle database (from redhat linux):</p>
<pre><code>import cx_Oracle
cx_Oracle.Connection("username/password")
</code></pre>
<p>Notably no DSN is specified; User name and passwo... | <p>As Devyl mentioned, if you have ORACLE_SID or TWO_TASK environment variables set, they maybe used to make a connection.</p>
<p>E.g. see this answer <a href="https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:89412348059" rel="nofollow noreferrer">https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11... | cx_oracle connection without DSN | python|database|oracle|cx-oracle | 0 | 49 | 2 | 73,025,414 | 73,025,414 | 2 | true | 2022-07-18T15:10:59.157Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
cx_oracle connection without DSN<p>I am maintaining some code where i came about a curious connection string of following type to an oracle database (from re... |
73,027,309 | Z-Score computation of a Pandas' DataFrame returns differing classes<p>I am trying to calculate the Z-Score of a Pandas' DataFrame, using <a href="https://docs.scipy.org/doc/scipy-1.5.4/reference/generated/scipy.stats.zscore.html#scipy.stats.zscore" rel="nofollow noreferrer">scipy's zscore</a> method.
Though while succ... | <p>If we look at the source code of scipy's <code>zscore</code> in version <a href="https://github.com/scipy/scipy/blob/19acfed431060aafaa963f7e530c95e70cd4b85c/scipy/stats/stats.py#L2430" rel="nofollow noreferrer">v1.5.4</a> (such as on Host 1), we can see that the passed input gets converted to a numpy array using <c... | Z-Score computation of a Pandas' DataFrame returns differing classes | python|pandas|numpy|scipy | 0 | 49 | 1 | 73,029,004 | 73,029,004 | 2 | true | 2022-07-18T18:58:16.460Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Z-Score computation of a Pandas' DataFrame returns differing classes<p>I am trying to calculate the Z-Score of a Pandas' DataFrame, using <a href="https://do... |
73,029,782 | Display multiple records in one 1 row with multiple columns<p>I have a table that stores user info such as:</p>
<p><a href="https://i.stack.imgur.com/IADqU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IADqU.png" alt="enter image description here" /></a></p>
<p>I need to write a query that returns ... | <p>if number of statuses is fixed you can do this</p>
<pre class="lang-sql prettyprint-override"><code>Select
id user_id,
open_status,
open_status_date,
inprogress_status,
inprogress_status_date,
complete_status,
complete_status_date
from
(select user_id id from yourTable group by user_... | Display multiple records in one 1 row with multiple columns | sql|oracle|join|plsql | 0 | 49 | 3 | 73,029,866 | 73,029,866 | 2 | true | 2022-07-19T00:05:33.557Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Display multiple records in one 1 row with multiple columns<p>I have a table that stores user info such as:</p>
<p><a href="https://i.stack.imgur.com/IADqU.p... |
73,029,676 | How to plot addresses (Lat/Long) from a csv on JSON map.?<p>So I am trying to do something which seems relatively simple but is proving incredibly difficult. I have a .csv file with addresses and their correspondent latitude/longitude, I just want to plot those on a California JSON map like this one in python:</p>
<p><... | <p>your example link is just a GeoJSON geometry definition. Are you talking about a <a href="https://geopandas.org/en/stable/docs/user_guide/mapping.html#choropleth-maps" rel="nofollow noreferrer">Choropleth</a>?</p>
<p>If so, check out geopandas - you should be able to link your data to the polygons in the shape defin... | How to plot addresses (Lat/Long) from a csv on JSON map.? | python|pandas|geopandas|plotly-python | 0 | 49 | 1 | 73,043,140 | 73,043,140 | 2 | true | 2022-07-18T23:41:39.833Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to plot addresses (Lat/Long) from a csv on JSON map.?<p>So I am trying to do something which seems relatively simple but is proving incredibly difficult.... |
72,832,265 | How to loop and save values in new matrix<p>I have the following code which identifies the velocity values at different values of <code>KK</code>.</p>
<pre><code>load('Vq.mat')
KK=1;
ft = fftshift(fft2(Vq));
kx = [-70:1:70];
ky = [-70:1:70];
for i1=1:length(kx)
for i2=1:length(ky)
kh(i1,i2)=sqrt(kx(i1).^2+k... | <p>The following code is greatly simplified. The main idea is that you find the indices (<code>inds</code>) of <code>kh</code> values that are between <code>KK</code> and <code>KK+1</code> using <code>find</code> builtin function and sum the corresponding <code>ft</code> values at the same indices. You repeat this algo... | How to loop and save values in new matrix | matlab|loops|matrix | 1 | 49 | 1 | 72,835,196 | 72,835,196 | 2 | true | 2022-07-01T16:33:39.083Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to loop and save values in new matrix<p>I have the following code which identifies the velocity values at different values of <code>KK</code>.</p>
<pre><... |
72,910,916 | cv2 Splitting image into multiple files with unique filenames<p>I'm applying a matplotlib to an image with custom x,y axis positional labels, and I'm wanting to use cv2 (or other) to split the image into seperate files with the filename being that of the label. I'd like to split from the bottom-left working outward, mu... | <p>You need to modify the <code>for</code> loop that iterates through Y- axis in reverse. <a href="https://stackoverflow.com/questions/869885/loop-backwards-using-indices">See how to loop backwards using <code>for</code> loop</a></p>
<pre><code>for r in range(img.shape[0], 0, -128):
for c in range(0, im.shape[1], 1... | cv2 Splitting image into multiple files with unique filenames | python|opencv|matplotlib | 1 | 49 | 1 | 72,912,978 | 72,912,978 | 2 | true | 2022-07-08T11:45:51.593Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
cv2 Splitting image into multiple files with unique filenames<p>I'm applying a matplotlib to an image with custom x,y axis positional labels, and I'm wanting... |
72,835,195 | Accept/bypass cookies with Selenium<p>I'm trying to get a screen shot from of a website from an url
however how can I accept the cookies before the screen shot ?
If you have any idea or clue I will appreciate.</p>
<p>Here is a following picture example of cookies :</p>
<p><a href="https://i.stack.imgur.com/qV3KS.png" r... | <p>You have to click on accept-button to accept <code>cookie</code></p>
<pre><code>from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
import time
# selenium 4
from selenium import webdriver
from selenium.we... | Accept/bypass cookies with Selenium | python|selenium|cookies | 1 | 49 | 1 | 72,835,260 | 72,835,260 | 2 | true | 2022-07-01T22:40:46.667Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Accept/bypass cookies with Selenium<p>I'm trying to get a screen shot from of a website from an url
however how can I accept the cookies before the screen sh... |
73,027,524 | Turning data to wide-form<p>I have data in this format:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>ID</th>
<th>risk</th>
<th>severity</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>A</td>
<td>green</td>
</tr>
<tr>
<td>1</td>
<td>A</td>
<td>amber</td>
</tr>
<tr>
<td>1</td>
<td>A</td>
<... | <p>Good catch @r2evans, here is an even simpler solution with nest and unnest:</p>
<pre class="lang-r prettyprint-override"><code>library(dplyr)
library(tidyr)
df %>%
group_by(ID, risk) %>%
summarise(min_sev = first(severity),
max_sev = last(severity),
count = n()) %>%
group_by(I... | Turning data to wide-form | r|dplyr|wide-format-data | 0 | 49 | 1 | 73,027,585 | 73,027,585 | 2 | true | 2022-07-18T19:17:04.993Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Turning data to wide-form<p>I have data in this format:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>ID</th>
<th>risk</th>
<t... |
73,012,352 | In R, how do I get an if statement to recognize if input in double curly brackets is a certain value?<p>I'm building a function where users can select a column from a list of options, and within the function, I want to do an if statement where, if the x variable is one of the options that the function is designed to wo... | <p>You have to use:</p>
<pre><code>make_plot(test_data, x_variable = "ses")
</code></pre>
<p>or alternatively:</p>
<pre><code>ses <- "ses"
make_plot(test_data, x_variable = ses)
</code></pre>
<p>This error means that the object <code>ses</code> is not declared.</p>
<hr />
<p>If you want to be abl... | In R, how do I get an if statement to recognize if input in double curly brackets is a certain value? | r|rlang|curly-braces | 1 | 49 | 2 | 73,012,391 | 73,012,391 | 2 | true | 2022-07-17T13:52:06.667Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In R, how do I get an if statement to recognize if input in double curly brackets is a certain value?<p>I'm building a function where users can select a colu... |
73,007,432 | PySimpleGUI not looping as it should<p>I know it is a simple fix, but it's hard to find your own mistakes. I've been at it for a while and can't figure out why the window is behaving erratically.
I'm trying to capture voice events with speech-recognition (no problems here), and then count how many times the words was s... | <p>Your <code>while True</code> loop requires clicking the <code>Count</code> button again and again as the voice recognition starts only if the GUI reports a <code>Count</code> button click.
The code below should let your script behave as you expect it to behave. With the <code>Count</code> button click you enable the... | PySimpleGUI not looping as it should | python|speech-recognition|pysimplegui | 0 | 49 | 2 | 73,007,992 | 73,007,992 | 2 | true | 2022-07-16T20:24:21.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PySimpleGUI not looping as it should<p>I know it is a simple fix, but it's hard to find your own mistakes. I've been at it for a while and can't figure out w... |
72,884,015 | Dynamically checking subclass relationship in Scala 3<p>I am trying to port a solution for DomainEventHandlers and -Dispatcher from PHP8 to Scala 3. Handlers should specify a list of events they can handle (in a type-safe way, preferably, by their classes). Handlers are dynamically registered with the Dispatcher, which... | <p>Well, if your concrete event classes that you match aren't parametrized, it's pretty simple:</p>
<pre><code>trait Event[A]
case class IntEvent(x: Int) extends Event[Int]
case class StringEvent(x: String) extends Event[String]
object Dispatcher {
var handlers = List.empty[PartialFunction[Event[_], String]]
def... | Dynamically checking subclass relationship in Scala 3 | scala|reflection|scala-3 | 0 | 49 | 1 | 72,887,886 | 72,887,886 | 2 | true | 2022-07-06T13:00:24.227Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dynamically checking subclass relationship in Scala 3<p>I am trying to port a solution for DomainEventHandlers and -Dispatcher from PHP8 to Scala 3. Handlers... |
72,851,573 | Unknown way of declaring a variable<p>Any documentation for this kind of declaration?</p>
<pre><code>x: dict() = {}
y: list() = ()
</code></pre>
<p>also this works just fine:</p>
<pre><code>v: list(list((1,2))) = {}
v["str"] = 1
#v returns {'str': 1}
</code></pre>
<p>What I understand: Starting the reading fr... | <p>This syntax is supposed to annotate the variable <a href="https://docs.python.org/3/library/typing.html" rel="nofollow noreferrer">type</a>, but Python itself completely ignores it (except for making sure the syntax is correct and any variables used therein are defined). It will be read by a static type checker, usu... | Unknown way of declaring a variable | python | -1 | 49 | 1 | 72,851,607 | 72,851,607 | 2 | true | 2022-07-04T03:47:10.117Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unknown way of declaring a variable<p>Any documentation for this kind of declaration?</p>
<pre><code>x: dict() = {}
y: list() = ()
</code></pre>
<p>also this... |
72,963,472 | Pass [switch] inside Start-Job<p>There is a script for users to log in, it calls other scripts in turn, depending on the conditions.
In order to call scripts separately manually, the [switch]$Silent parameter has been added. Question - how to pass this parameter inside Start-Job? I tried to add to the list of arguments... | <p>Unfortunately, <strong>specifying pass-through arguments via <a href="https://docs.microsoft.com/powershell/module/microsoft.powershell.core/start-job" rel="nofollow noreferrer"><code>Start-Job</code></a>'s <code>-ArgumentList</code> (<code>-Args</code>) is limited to <em>positional</em> arguments</strong>, which <s... | Pass [switch] inside Start-Job | powershell | 2 | 49 | 2 | 72,967,196 | 72,967,196 | 2 | true | 2022-07-13T08:54:13.823Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pass [switch] inside Start-Job<p>There is a script for users to log in, it calls other scripts in turn, depending on the conditions.
In order to call scripts... |
72,849,295 | React Native, onPress not firing<p>Cannot get any output from my function <code>test()</code> which I have written in <code>Boxes.js</code> when I add <code>onPress={test}</code> to my <code>View</code> tag in <code>Dice.js</code>.
I have tried to add <code>test()</code> on tags like <code>Text</code>, then it works, b... | <p>If you wanna <code>Dice</code> to be clickable, use one the components that handles press events, like <a href="https://reactnative.dev/docs/pressable" rel="nofollow noreferrer"><code>Pressable</code></a>. Not all components accept an <code>onPress</code> property, <code>View</code> is one of them.</p>
<pre><code>im... | React Native, onPress not firing | javascript|reactjs|react-native | 1 | 49 | 2 | 72,849,348 | 72,849,348 | 2 | true | 2022-07-03T19:22:58.627Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React Native, onPress not firing<p>Cannot get any output from my function <code>test()</code> which I have written in <code>Boxes.js</code> when I add <code>... |
72,782,536 | How to remove a tag from newer commits in git?<p>I created a new tag <code>v1.0.0</code> and git tagged commits <code>a</code>, <code>b</code>, <code>c</code>, <code>d</code> with <code>v1.0.0</code>. <code>a, b, c, d</code> are the commit ids:</p>
<pre><code>d -> Newest
c
b
a -> Oldest
</code></pre>
<p>Here is a... | <h2>A git tag points at <em>one</em> commit</h2>
<blockquote>
<p>See how each commits are tagged with v1.0.0.</p>
</blockquote>
<p>This phrase from the question is a misunderstanding or misrepresentation of the information github is displaying.</p>
<p>The commits <code>a</code>, <code>b</code> and <code>c</code> are <e... | How to remove a tag from newer commits in git? | git|github | 2 | 49 | 1 | 72,783,296 | 72,783,296 | 2 | true | 2022-06-28T07:45:49.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to remove a tag from newer commits in git?<p>I created a new tag <code>v1.0.0</code> and git tagged commits <code>a</code>, <code>b</code>, <code>c</code... |
72,968,693 | How can I add new files to git based on their last modification date?<p>I work locally under Windows. I have a local git repo and already included some files. The folder (and subfolders) where I am working in includes many other files that are not yet tracked and not known to git. Some of these files have not been chan... | <p>Not possible with git only, but if you have "git bash" or WSL available, you should be able to run something like</p>
<pre><code>find . -type f -mtime -31 -not -path '*/.git/*' -exec git add -v -- {} +
</code></pre>
<p>to add files modified within the last 31 days.</p>
<p>Notes:</p>
<ul>
<li>If you only wa... | How can I add new files to git based on their last modification date? | bash|git|git-bash | 1 | 49 | 1 | 72,969,500 | 72,969,500 | 2 | true | 2022-07-13T15:17:24.397Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I add new files to git based on their last modification date?<p>I work locally under Windows. I have a local git repo and already included some files... |
72,781,926 | How to make the checking more robust and shorter?<p><strong>I wrote this code, but I dont uderstand why it works this way, especially using the third and fourth examples as input. Why the 'middle' position remains so behind? -in the number 5 (or index 2) using the [1, 3, 5, 6] array and the number 7 as target??</strong... | <h1>Problem</h1>
<p>The issue lies in the variable you are checking for after the <code>while</code> loop.</p>
<p>In a "classical" binary search algorithm, reaching beyond the <code>while</code> loop would indicate the <code>needle</code> isn't present in the <code>haystack</code>. In case of this problem, th... | How to make the checking more robust and shorter? | javascript|algorithm|search|big-o | 1 | 49 | 1 | 72,784,687 | 72,784,687 | 2 | true | 2022-06-28T06:54:20.867Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make the checking more robust and shorter?<p><strong>I wrote this code, but I dont uderstand why it works this way, especially using the third and fou... |
72,860,752 | Python local min/max while bin has not changed<p>I have a script that produces <strong>bins</strong> using <strong>np.digitize</strong> of values like so:</p>
<pre><code>| time | butter | bin |
| :---- | :------ | :--- |
| 2022-07-04 17:33:45+00:00 | 1.041967 | 3 |
| 2022-07-04 17:34:00+00:00 | 1.041967 | 4 |
| 2022-07... | <p>Here are two ways to do what your question asks, one using pandas and the other using numpy (<strong>UPDATED</strong> to reflect OP's clarification in comments regarding binning to be on the basis of contiguously grouped <code>bin</code> values):</p>
<pre class="lang-py prettyprint-override"><code>res = df.assign(bi... | Python local min/max while bin has not changed | python|numpy | 2 | 49 | 1 | 72,862,082 | 72,862,082 | 2 | true | 2022-07-04T18:25:46.277Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python local min/max while bin has not changed<p>I have a script that produces <strong>bins</strong> using <strong>np.digitize</strong> of values like so:</p... |
72,850,729 | Is there a difference between these two different forms of Sort (orderBy) in pySpark?<p>Say we have the following dataframe (which is borrowed from 'PySpark by Examples' website):</p>
<pre><code>simpleData = [("James","Sales","NY",90000,34,10000), \
("Michael","Sales&quo... | <p>If you look at the explain plan you'll see that both queries generate the same physical plan, so processing wise they are identical.</p>
<pre><code>df_sort1 = df.sort("department", "state")
df_sort2 = df.sort(col("department"), col("state"))
df_sort1.explain()
df_sort2.explai... | Is there a difference between these two different forms of Sort (orderBy) in pySpark? | apache-spark|pyspark|syntax | 2 | 49 | 2 | 72,854,428 | 72,854,428 | 2 | true | 2022-07-04T00:16:19.927Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a difference between these two different forms of Sort (orderBy) in pySpark?<p>Say we have the following dataframe (which is borrowed from 'PySpark ... |
72,791,971 | Query using CASE in left outer join takes long time to run<p>I am running a Postgres query with a <code>CASE</code> expression in a join condition. The query takes a long time to run. Is there a better way to optimize this query?</p>
<p>Code snippet:</p>
<pre><code>LEFT OUTER JOIN analyticsdatamart_gen_nontemporal_v1.d... | <p>For proper answer attach full query, table structure (with indexes) and execution plan.</p>
<p>Original <code>CASE</code> is quite complicated, but hard to say if it's responsible for query performance without information from execution plan.</p>
<pre><code>CASE
WHEN da.unique_key = fo.dimension__first_report__prim... | Query using CASE in left outer join takes long time to run | sql|postgresql|query-optimization|postgresql-performance | 0 | 49 | 1 | 72,792,104 | 72,792,104 | 2 | true | 2022-06-28T19:09:12.197Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Query using CASE in left outer join takes long time to run<p>I am running a Postgres query with a <code>CASE</code> expression in a join condition. The query... |
72,821,857 | How to exit the loop after finding the maximum value in array? Pyramids problem in Ruby<p>I have a problem with exiting the loop after finding the maximum value in array.</p>
<p>The job is:</p>
<p>Pyramids #1
Let's consider and array p of length n filled with unique numbers from (1..n) range - for example p=[1,3,4,2,5]... | <p>I don't believe the fundamental problem is exiting the loop, but is with the calculation being performed.</p>
<p>Suppose</p>
<pre><code>p = [4,5,1,2,3,6,5]
</code></pre>
<p>Here is a drawing of what the observer sees when viewing the buildings from the left</p>
<pre><code> [4,5,1,2,3,6,5]
■ ... | How to exit the loop after finding the maximum value in array? Pyramids problem in Ruby | arrays|ruby | -1 | 49 | 1 | 72,823,191 | 72,823,191 | 2 | true | 2022-06-30T20:49:13.467Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to exit the loop after finding the maximum value in array? Pyramids problem in Ruby<p>I have a problem with exiting the loop after finding the maximum va... |
72,999,654 | Matching FontAwesome background in icon bar<p>I'm trying to replicate this <a href="https://www.w3schools.com/howto/howto_css_icon_bar.asp" rel="nofollow noreferrer">W3 icon bar tutorial</a> for my website, and it uses FontAwesome icons.</p>
<p>HTML:</p>
<pre><code><link rel="stylesheet" href="https:/... | <p>You have two options:</p>
<h3>set the background of the icon <code>i</code> to transparent</h3>
<pre><code>.icon-bar i {
background: transparent;
}
</code></pre>
<p><strong>Snippet Below</strong></p>
<p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
<div class="snipp... | Matching FontAwesome background in icon bar | html|css|font-awesome|font-awesome-4 | 1 | 49 | 2 | 72,999,704 | 72,999,704 | 2 | true | 2022-07-15T21:13:12.667Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Matching FontAwesome background in icon bar<p>I'm trying to replicate this <a href="https://www.w3schools.com/howto/howto_css_icon_bar.asp" rel="nofollow nor... |
72,994,728 | Shading region between vertical and diagonal lines in ggplot<p>I am trying to use <code>ggplot</code> to shade the region between the vertical line and the diagonal line as shown below. Is there a way to do this?</p>
<pre><code>df <- data.frame(x=c(1,-1), y=c(1,-1))
ggplot(df, aes(x, y)) +
geom_point() +
geom_a... | <p>It is a bit tricky, but if you know the coordinates of the area (Inf), you can use them to fill the shades using <code>geom_polygon</code> like this:</p>
<pre class="lang-r prettyprint-override"><code>library(ggplot2)
df <- data.frame(x=c(1,-1), y=c(1,-1))
upper_area <- data.frame(x=c(-Inf,0,0),y=c(Inf,Inf,0))... | Shading region between vertical and diagonal lines in ggplot | r|ggplot2 | 0 | 49 | 3 | 72,994,981 | 72,994,981 | 2 | true | 2022-07-15T13:24:31.617Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Shading region between vertical and diagonal lines in ggplot<p>I am trying to use <code>ggplot</code> to shade the region between the vertical line and the d... |
72,780,847 | Golang: making the entire package OS specific<p>While I learnt that I can use go build tags (<code>// +build windows</code>) or filename suffix (<code>source_windows.go</code>) to make a go source file to be OS specific, is there a way to make all source files inside a package directory to be OS specific?</p>
<p>Guess:... | <p>No, the only way is to make all files inside that package follow file name pattern or have desired <a href="https://pkg.go.dev/cmd/go#hdr-Build_constraints" rel="nofollow noreferrer">build constraints</a> in them. File name pattern based <a href="https://pkg.go.dev/cmd/go#hdr-Build_constraints" rel="nofollow norefer... | Golang: making the entire package OS specific | go | 1 | 49 | 1 | 72,781,330 | 72,781,330 | 2 | true | 2022-06-28T04:46:48.963Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Golang: making the entire package OS specific<p>While I learnt that I can use go build tags (<code>// +build windows</code>) or filename suffix (<code>source... |
72,900,239 | How to delete trigger character when using vscode api completion feature?<p>I'm creating a vscode extension that requires some custom completion for json files. Is it possible to not show the trigger character when using autocompletions.</p>
<p>Here is what I mean :</p>
<p>Let's say the trigger character is '.'
In your... | <p>In general the trigger characters would be removed automatically but I believe because your trigger character <code>?</code> is a non-word character (at least in <code>json</code> files) that vscode returns <code>undefined</code> when trying to get the <code>wordRangeAtPosition(position)</code> and so does not repla... | How to delete trigger character when using vscode api completion feature? | typescript|visual-studio-code|triggers|vscode-extensions|completion | 2 | 49 | 1 | 72,902,878 | 72,902,878 | 2 | true | 2022-07-07T15:07:55.907Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to delete trigger character when using vscode api completion feature?<p>I'm creating a vscode extension that requires some custom completion for json fil... |
72,807,933 | Numpy / Flatten a list<p>I have create this of character</p>
<pre><code>list1 = [['20']*3,['35']*2,['40']*4,['10']*2,['15']*3]
</code></pre>
<p>result :</p>
<pre><code>[['20', '20', '20'], ['35', '35'], ['40', '40', '40', '40'], ['10', '10'], ['15', '15', '15']]
</code></pre>
<p>I can convert it into a single list usin... | <p>Use <a href="https://numpy.org/doc/stable/reference/generated/numpy.hstack.html" rel="nofollow noreferrer"><code>hstack()</code></a></p>
<pre><code>import numpy as np
list1 = [['20']*3,['35']*2,['40']*4,['10']*2,['15']*3]
flatlist = np.hstack(list1)
print(flatlist)
</code></pre>
<blockquote>
<p>['20' '20' '20' '35'... | Numpy / Flatten a list | python|numpy|numpy-ndarray | 2 | 49 | 2 | 72,808,045 | 72,808,045 | 2 | true | 2022-06-29T21:13:05.093Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Numpy / Flatten a list<p>I have create this of character</p>
<pre><code>list1 = [['20']*3,['35']*2,['40']*4,['10']*2,['15']*3]
</code></pre>
<p>result :</p>
... |
72,974,380 | Perform t-tests by groups<p>I am trying to do t test comparing control and treatment groups in a long table.</p>
<p>Part of table looks like this, the ones with T are the one with treatment while the ones without T are the controls and each group has triplicate:</p>
<div class="s-table-container">
<table class="s-table... | <p>You should separate the <code>Group</code> column into 2 columns, one indicates <code>ID</code> and the other indicates treatment(T) or control(C) groups.</p>
<pre class="lang-r prettyprint-override"><code>library(dplyr)
library(tidyr)
df2 <- df %>%
separate(Group, c("ID", "Group"), sep ... | Perform t-tests by groups | r|dplyr|t-test | 1 | 49 | 1 | 72,974,635 | 72,974,635 | 2 | true | 2022-07-14T01:54:18.477Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Perform t-tests by groups<p>I am trying to do t test comparing control and treatment groups in a long table.</p>
<p>Part of table looks like this, the ones w... |
72,768,786 | Is there findFirst with position in predicate in Kotlin<p>I need to find first element in a list which fits predicate. But I need to check with it position in predicate.</p>
<pre><code> list.findXXX { index, item ->
index > 19 && item.active
}
</code></pre>
<p>Is there such a function?</p> | <p>There is no such function yet, but you can easily write one yourself. It is not a lot of effort at all.</p>
<pre><code>public inline fun <T> Iterable<T>.findIndexed(predicate: (Int, T) -> Boolean): T? {
forEachIndexed { i, e -> if (predicate(i, e)) return e }
return null
}
</code></pre>
<p>... | Is there findFirst with position in predicate in Kotlin | kotlin | 1 | 49 | 3 | 72,769,006 | 72,769,006 | 3 | true | 2022-06-27T08:02:13.440Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there findFirst with position in predicate in Kotlin<p>I need to find first element in a list which fits predicate. But I need to check with it position i... |
72,793,468 | mysql noop or null statement equivalent<p>When coding I personally like to complete my flow control/structure before filling it in. To allow it to work in oracle I could just put a null; command <a href="https://docs.oracle.com/cd/E11882_01/appdev.112/e25519/null_statement.htm#LNPLS01330" rel="nofollow noreferrer">orac... | <p>MySQL supports a statement <code>DO <expression>;</code></p>
<p>See <a href="https://dev.mysql.com/doc/refman/8.0/en/do.html" rel="nofollow noreferrer">https://dev.mysql.com/doc/refman/8.0/en/do.html</a></p>
<p>It doesn't matter what the expression is, the statement does not return any results. The common use ... | mysql noop or null statement equivalent | mysql | 1 | 49 | 1 | 72,795,002 | 72,795,002 | 3 | true | 2022-06-28T21:45:06.663Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
mysql noop or null statement equivalent<p>When coding I personally like to complete my flow control/structure before filling it in. To allow it to work in or... |
72,800,694 | MariaDB make SELECT wait for other transactions to finish<p>I'm on <strong>MariaDB 10.6.5</strong>, and I have this code :</p>
<pre><code>$pdo->query("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;");
$pdo->query("SET autocommit = 0;");
try
{
$max_id = $pdo->query("SELECT MAX(id) F... | <p>You can use <code>GET_LOCK</code></p>
<p>add the query <code>DO GET_LOCK('lockname', 30)</code> at the start and <code>DO RELEASE_LOCK('lockname')</code> after the query.</p>
<p>So when User 1 starts the query it sets the lock <code>lockname</code> and only releases it when finished, If User 2 starts the script <cod... | MariaDB make SELECT wait for other transactions to finish | php|transactions|mariadb | 1 | 49 | 1 | 72,801,107 | 72,801,107 | 3 | true | 2022-06-29T11:32:56.810Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MariaDB make SELECT wait for other transactions to finish<p>I'm on <strong>MariaDB 10.6.5</strong>, and I have this code :</p>
<pre><code>$pdo->query(&quo... |
72,800,538 | How to compute triple product in 2D<p>I am following <a href="https://blog.winter.dev/2020/gjk-algorithm/" rel="nofollow noreferrer">this</a> article on how to code the GJK algorithm for collision detection, but instead of doing it in 3D, I do it in 2D.</p>
<p>However, at one point there is this piece of code :</p>
<pr... | <p>The vector cross triple product in 3D is</p>
<p><strong>p</strong> = <strong>a</strong>×(<strong>b</strong>×<strong>c</strong>)</p>
<p>The full expansion can be computed with the following matrix/vector product</p>
<pre><code>|px| | -ay*by-az*bz ay*bx az*bx | | cx |
|py| = | ax*by -ax*bx-az... | How to compute triple product in 2D | math|vector|language-agnostic|2d|cross-product | 1 | 49 | 1 | 72,801,371 | 72,801,371 | 3 | true | 2022-06-29T11:21:25.400Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to compute triple product in 2D<p>I am following <a href="https://blog.winter.dev/2020/gjk-algorithm/" rel="nofollow noreferrer">this</a> article on how ... |
72,803,062 | Converting a dictionary of lists to a pandas.DataFrame using predefined headers<p>I have a dictionary that looks like the following:</p>
<pre><code>date_pair_dict = {
"15-02-2022 15-02-2022": ["key 1 val 1", "key 1 val 2", "key 1 val 3"],
"15-02-2022 16-02-2022"... | <p>Like you said you can use a comprehension on your dict key/value pairs:</p>
<pre><code>import pandas as pd
date_pair_dict = {
"15-02-2022 15-02-2022": ["key 1 val 1", "key 1 val 2", "key 1 val 3"],
"15-02-2022 16-02-2022": ["key 2 val 1", "ke... | Converting a dictionary of lists to a pandas.DataFrame using predefined headers | python|dataframe|dictionary|dictionary-comprehension | 3 | 49 | 5 | 72,803,196 | 72,803,196 | 3 | true | 2022-06-29T14:24:07.710Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Converting a dictionary of lists to a pandas.DataFrame using predefined headers<p>I have a dictionary that looks like the following:</p>
<pre><code>date_pair... |
72,893,358 | Web scraping table shows no results<p>I want to scrape the main table from <a href="https://paperswithcode.com/sota/3d-object-detection-on-kitti-cars-moderate" rel="nofollow noreferrer">this page</a>.</p>
<p><a href="https://i.stack.imgur.com/DLdhk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DLdh... | <p>Because the webpage is not dynamic, you can find table in script block.</p>
<pre><code>import requests
import json
from bs4 import BeautifulSoup
url = 'https://paperswithcode.com/sota/3d-object-detection-on-kitti-cars-moderate'
response = requests.get(url)
soup = BeautifulSoup(response.text, 'lxml')
table_json = j... | Web scraping table shows no results | python|web-scraping|beautifulsoup | -2 | 49 | 1 | 72,893,572 | 72,893,572 | 3 | true | 2022-07-07T06:45:21.137Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Web scraping table shows no results<p>I want to scrape the main table from <a href="https://paperswithcode.com/sota/3d-object-detection-on-kitti-cars-moderat... |
72,894,192 | How to simulate a strong correlation of data with R<p>Sometimes I try to simulate data by using the <code>rnorm</code> function, which I have done below:</p>
<pre><code>mom.iq <- rnorm(n=1000,
mean=120,
sd=15)
kid.score <- rnorm(n=1000,
mean=45,
... | <p>What you are doing is to generate two independent variables; so, it is normal not to be correlated. What you can do is this:</p>
<pre><code># In order to make the values reproducible
set.seed(12345)
# Generate independent variable
x <- rnorm(n=1000, mean=120, sd=15)
# Generate the dependen variable
y <-... | How to simulate a strong correlation of data with R | r|ggpubr | 1 | 49 | 3 | 72,894,359 | 72,894,359 | 3 | true | 2022-07-07T07:56:26.477Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to simulate a strong correlation of data with R<p>Sometimes I try to simulate data by using the <code>rnorm</code> function, which I have done below:</p>... |
72,905,748 | How to check if a variable/loop in Python was True?<p>I'm learning Python and had a small issue. I have this loop:</p>
<pre><code>found = None
print ('Before', found)
for value in [ 41, 5, 77, 3, 21, 55, 6]:
if value == 21:
found = True
else:
found = False
print (found, value)
print ('Aft... | <p>You don't want to <em>reset</em> <code>found</code> to <code>False</code> once you've set it to <code>True</code>. Initialize it to <code>False</code>, then only set it to <code>True</code> if <code>value == 21</code>; don't do anything if <code>value != 21</code>.</p>
<pre><code>found = False
print ('Before', foun... | How to check if a variable/loop in Python was True? | python|python-3.x | -1 | 49 | 1 | 72,905,759 | 72,905,759 | 3 | true | 2022-07-08T01:21:47.910Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to check if a variable/loop in Python was True?<p>I'm learning Python and had a small issue. I have this loop:</p>
<pre><code>found = None
print ('Befor... |
72,909,817 | Reacts generate two input feilds dynamically instead of one<p>So this is my app which i have created in react and store data in firestore, i have a form in which ingredients is an array, i can dynamically add the input feilds and when i submit the form it gets submiited and the data gets stored in firebase. My problem ... | <p>As far as I have understood. Just do like below,</p>
<pre><code> const handleIngredientCount = () => {
setForm({
...form,
ingredients: [...form.ingredients, "", ""],
})
}
</code></pre>
<p>You will be created with two input fields simultaneously instead of one when you cl... | Reacts generate two input feilds dynamically instead of one | reactjs | 0 | 49 | 1 | 72,912,855 | 72,912,855 | 3 | true | 2022-07-08T10:07:07.347Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reacts generate two input feilds dynamically instead of one<p>So this is my app which i have created in react and store data in firestore, i have a form in w... |
72,916,081 | Is it possible to cause a function to return from within another function?<p>I'm not sure how to phrase this question exactly, but I'll give an example that explains what I am wondering about:</p>
<p>I have a function that is a permission check, let's call it A. And I call this function in another function, let's call ... | <p>You could create an exception</p>
<pre><code>class PermissionError(Exception):
pass
def permission_check_A(user):
# check if user has permission
if no_good():
raise PermissionError("No permission")
def another_function_B(user):
permission_check_A(user)
# do other stuff if user... | Is it possible to cause a function to return from within another function? | python | 1 | 49 | 2 | 72,916,177 | 72,916,177 | 3 | true | 2022-07-08T19:18:21.387Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to cause a function to return from within another function?<p>I'm not sure how to phrase this question exactly, but I'll give an example that ... |
72,921,238 | datatype of anonymous function vs named function in scala<p>I am curious to understand the datatype of anonymous function in Scala(2.13.8).</p>
<p>While reading Functional programming in Scala, I see below code</p>
<pre><code>scala> (x:Int,y:Int)=> x<y
</code></pre>
<p>As per the book, the output should be lik... | <p>Language defines some syntactic sugar which REPL follows:</p>
<ul>
<li>instead of <code>Tuple2(1, 2)</code> you can just do <code>(1, 2)</code></li>
<li>same for <code>Tulple3</code>, <code>Tuple4</code>, etc</li>
<li>instead of <code>Function1[Int, String]</code> you can use <code>Int => String</code></li>
<li>s... | datatype of anonymous function vs named function in scala | scala|functional-programming | -2 | 49 | 2 | 72,921,640 | 72,921,640 | 3 | true | 2022-07-09T12:07:56.487Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
datatype of anonymous function vs named function in scala<p>I am curious to understand the datatype of anonymous function in Scala(2.13.8).</p>
<p>While read... |
72,939,176 | R order list based on multiple characters from each item<p>I'd like to sort a list based on more than the first character of each item in that list. The list contains chr data though some of those characters are digits. I've been trying to use a combination of <code>substr()</code> and <code>order</code> but to no avai... | <p>This requires a bit of string parsing and converting to numeric:</p>
<pre class="lang-r prettyprint-override"><code>o <- sapply(strsplit(mylist, '\\D+'), function(x) min(as.numeric(x[nzchar(x)])))
mylist[order(o)]
#> [1] "0_times" "1-2_times" "3-10_times" ... | R order list based on multiple characters from each item | r | 2 | 49 | 1 | 72,939,262 | 72,939,262 | 3 | true | 2022-07-11T13:14:05.537Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R order list based on multiple characters from each item<p>I'd like to sort a list based on more than the first character of each item in that list. The list... |
72,950,216 | Error creating Controller using .NET cli codegenerator in ASP.NET MVC project<p>When I try to create controller using .NET cli codegenerator in my ASP.NET web mvc project:</p>
<pre><code>dotnet aspnet-codegenerator --project . controller -name "Controllers\TempController"
</code></pre>
<p>getting this error:... | <p>I presume you have put the "Controllers"-part in the name-parameter since you want it in the Controllers-folder. Use -outDir-parameter for the folder:</p>
<pre><code>dotnet aspnet-codegenerator --project . controller -name "TempController" -outDir "Controllers"
</code></pre>
<p>See doc... | Error creating Controller using .NET cli codegenerator in ASP.NET MVC project | c#|.net|asp.net-core|.net-core|command-line-interface | 1 | 49 | 1 | 72,950,422 | 72,950,422 | 3 | true | 2022-07-12T09:42:31.727Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error creating Controller using .NET cli codegenerator in ASP.NET MVC project<p>When I try to create controller using .NET cli codegenerator in my ASP.NET we... |
72,951,333 | Varnish Docker image not working for node js On localhost<p>I am trying to implement Varnish for a small small node js server</p>
<pre><code>(index.js)
const port = 80;
require("http").createServer((req, res) => {
res.write(new Date().toISOString());
res.end();
}).listen(port, () => {
conso... | <p>You have a problem in your varnish configuration. You have set:</p>
<pre><code>backend default {
.host = "127.0.0.1";
.port = "80";
}
</code></pre>
<p>But <code>127.0.0.1</code> (or <code>localhost</code>) means "this container", and your backend is not running inside the same c... | Varnish Docker image not working for node js On localhost | docker|dockerfile|varnish|varnish-vcl | -1 | 49 | 1 | 72,952,257 | 72,952,257 | 3 | true | 2022-07-12T11:08:20.047Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Varnish Docker image not working for node js On localhost<p>I am trying to implement Varnish for a small small node js server</p>
<pre><code>(index.js)
cons... |
72,953,321 | Nesting Rcpp functions<p>Is it possible to nest <code>Rcpp</code> functions in each other?
I have a dummy example right here:</p>
<pre><code>cppFunction(
'int add3(int x) {
return x+3;
}')
cppFunction(
'int add4(int x) {
return add3(x)+1;
}')
add3(2)
</code></pre>
<p>This does not work. How can I make this wo... | <p>The answers to your question get a little technical quickly, but are all provided in the <a href="https://cran.r-project.org/web/packages/Rcpp/vignettes/Rcpp-attributes.pdf" rel="nofollow noreferrer">Rcpp Attributes vignette</a>, and have been for a long time.</p>
<p>First off, you are more-or-less misusing <code>cp... | Nesting Rcpp functions | r|rcpp | 1 | 49 | 1 | 72,953,577 | 72,953,577 | 3 | true | 2022-07-12T13:42:26.210Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Nesting Rcpp functions<p>Is it possible to nest <code>Rcpp</code> functions in each other?
I have a dummy example right here:</p>
<pre><code>cppFunction(
'... |
72,963,022 | Flatten Lookup<TKey,TValue> to key-value pairs<p><code>lookup.SelectMany(x => x)</code> only returns values. Is there a way to retain keys associated with them?</p> | <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.linq.lookup-2?view=net-6.0" rel="nofollow noreferrer"><code>Lookup<TKey, TValue></code></a> implements <code>IEnumerable<IGrouping<TKey,TElement>></code> and <a href="https://docs.microsoft.com/en-us/dotnet/api/system.linq.igrouping-2?view... | Flatten Lookup<TKey,TValue> to key-value pairs | c#|linq | 0 | 49 | 1 | 72,963,137 | 72,963,137 | 3 | true | 2022-07-13T08:19:16.290Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flatten Lookup<TKey,TValue> to key-value pairs<p><code>lookup.SelectMany(x => x)</code> only returns values. Is there a way to retain keys associated with... |
73,022,302 | Python code not working when virtual environment is active but works when it is deactivated<p>I am using code that relies on the opencv library, the code is cloned from the following repo if someone wishes to reproduce this problem fully: <br> <a href="https://github.com/kmhmubin/Face-Recognition-Attendance-System" rel... | <p>You probably did a "pip install" without activating your virtualenv</p> | Python code not working when virtual environment is active but works when it is deactivated | python|python-3.x|opencv|virtualenv|python-venv | 0 | 49 | 3 | 73,022,542 | 73,022,542 | 3 | true | 2022-07-18T12:26:45.527Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python code not working when virtual environment is active but works when it is deactivated<p>I am using code that relies on the opencv library, the code is ... |
72,921,683 | What format is it? There are any way to translate to readable text in Python?<p>What format is it? There are any way to translate to readable text in Python?</p>
<pre><code>\xfe\xff\x00M\x00i\x00c\x00r\x00o\x00s\x00o\x00f\x00t\x00\xae\x00 \x00W\x00o\x00r\x00d\x00 \x002\x000\x001\x009
</code></pre> | <p>This is UTF-16 encoding. You can decode it like so:</p>
<pre class="lang-py prettyprint-override"><code>
s = b'\xfe\xff\x00M\x00i\x00c\x00r\x00o\x00s\x00o\x00f\x00t\x00\xae\x00 \x00W\x00o\x00r\x00d\x00 \x002\x000\x001\x009'
print(s.decode('utf16')) # Microsoft® Word 2019
</code></pre> | What format is it? There are any way to translate to readable text in Python? | python | 0 | 49 | 1 | 72,921,731 | 72,921,731 | 3 | true | 2022-07-09T13:18:01.563Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What format is it? There are any way to translate to readable text in Python?<p>What format is it? There are any way to translate to readable text in Python?... |
72,768,868 | How to separate elements in a pandas Dataframe<p>I am trying to handle the following dataframe</p>
<pre><code>import pandas as pd
df =pd.DataFrame(
data = {'m1' : [0,0,1,0,0,0,0,0,0,0,0],
'm2' : [0,0,0,0,0,1,0,0,0,0,0],
'm3' : [0,0,0,0,0,0,0,0,1,0,0],
'm4' : [0,1,0,0,0,0,0,0,0,0... | <p>Use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.any.html" rel="nofollow noreferrer"><code>DataFrame.any</code></a> or <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.max.html" rel="nofollow noreferrer"><code>DataFrame.max</code></a> with lef... | How to separate elements in a pandas Dataframe | python|pandas | 1 | 49 | 4 | 72,768,902 | 72,768,902 | 3 | true | 2022-06-27T08:09:06.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to separate elements in a pandas Dataframe<p>I am trying to handle the following dataframe</p>
<pre><code>import pandas as pd
df =pd.DataFrame(
data... |
72,770,323 | inotifywait ignore while loop<p>I am having trouble with using <code>inotifywait</code> properly.</p>
<p>My environment is CentOS 8 Stream with i7-9700</p>
<p><code>test.sh</code></p>
<pre class="lang-bash prettyprint-override"><code>#!/bin/bash
inotifywait -e modify ./test.txt |
while read dirname eventlist filename
... | <p>The normal behavior of <code>inotifywait</code> is to exit after it has captured an event.</p>
<p>If you want <code>inotifywait</code> to keep monitoring events, you have to use the <code>-m</code> option switch.</p>
<p>Also in your script, you read 3 arguments from the output if <code>inotifywait</code> whereas onl... | inotifywait ignore while loop | bash|shell|while-loop|inotify | 1 | 49 | 1 | 72,770,766 | 72,770,766 | 3 | true | 2022-06-27T10:08:07.407Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
inotifywait ignore while loop<p>I am having trouble with using <code>inotifywait</code> properly.</p>
<p>My environment is CentOS 8 Stream with i7-9700</p>
<... |
72,979,487 | Different transition for active and release button<p>I want to make different color transitions when someone clicks the button and releases again.</p>
<p>As you can see below, when you click the button, the color is instant but when you release it, it's not instant. How can I do this?</p>
<p><div class="snippet" data-l... | <p>Here is a trick using <code>text-shadow</code> that will replace the main color on hover and default state and for the active you use <code>color</code> with no transition:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snip... | Different transition for active and release button | html|css | 0 | 49 | 1 | 72,979,589 | 72,979,589 | 3 | true | 2022-07-14T11:06:00.603Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Different transition for active and release button<p>I want to make different color transitions when someone clicks the button and releases again.</p>
<p>As ... |
72,804,326 | Feeding a function output back to it as input parameter<p>I am writing a simple function and I want to iteratively run it so that it gets fed its own output, performs some operations and continues to do so until a certain number of times.</p>
<p>I have tried the following:</p>
<pre><code>def optimize(lst):
A = lst[... | <p>You just need to capture the value returned by the function and then pass it back to the function next time</p>
<pre><code>data = [1,2,3]
for i in range(3):
data = optimize(data)
</code></pre>
<p>Edit to add:</p>
<p>You don't need the "overwrite original list" operation because you are returning the ne... | Feeding a function output back to it as input parameter | python | 2 | 49 | 3 | 72,804,659 | 72,804,659 | 3 | true | 2022-06-29T15:46:59.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Feeding a function output back to it as input parameter<p>I am writing a simple function and I want to iteratively run it so that it gets fed its own output,... |
72,867,771 | What is the "base" of a git diff?<p>The XY question that I want to ask but suspect is not fully on topic is "How can I remember/memorise the various syntaxes of git diff?" The git diff syntaxes are (personally) confusing, and it's not clear to me how you can remember what they do <em>intuitively</em> (i.e. wi... | <p>What you've written is basically correct, but your <code>..</code> syntax is flipped,* and "base" is ambiguous so I'll use the terms "old" and "new". Here is a correct table:</p>
<ul>
<li><code>git diff <commit1> <commit2></code>: general syntax <em>(<commit1> is "... | What is the "base" of a git diff? | git|diff|git-diff | 1 | 49 | 2 | 72,869,189 | 72,869,189 | 3 | true | 2022-07-05T10:21:16Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the "base" of a git diff?<p>The XY question that I want to ask but suspect is not fully on topic is "How can I remember/memorise the various syn... |
72,868,700 | Why does SystemVerilog think 0.001 == 0?<p>I'm trying to take the absolute value of a number. C, Python, Matlab, etc. all have this kind of thing built in, but in Verilog you have to make your own. So I write this:</p>
<pre><code>function abs(shortreal x);
if (x >= 0.0) begin
abs = x;
end else begin... | <p>Since you did not explicitly declare the return type of your function, it returns a 1-bit value of type <code>logic</code>. This means that <code>abs</code> can only be the integer values 0 or 1, not a floating-point value (ignoring values <code>x</code> and <code>z</code> for this discussion).</p>
<p>You should c... | Why does SystemVerilog think 0.001 == 0? | system-verilog | 2 | 49 | 1 | 72,868,902 | 72,868,902 | 3 | true | 2022-07-05T11:29:50.640Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does SystemVerilog think 0.001 == 0?<p>I'm trying to take the absolute value of a number. C, Python, Matlab, etc. all have this kind of thing built in, b... |
72,978,598 | How to add Child and Grandchild XML tags by XML::LibXML?<p>I'm trying to make a simple XML file and add <code>Child</code> and <code>Grandchild</code> XML tags by <code>XML::LibXML</code>.</p>
<p>I made <code>country</code> and <code>location</code> tags as below, but I want to add child and grandchild tags under <code... | <p>Since <code><country></code> only has elements, not text, you should not use <code>$country->appendText('Jamaica');</code>. Similarly, you should not use <code>appendText</code> for <code><dev></code>.</p>
<p>You also need to create 3 child elements under <code><dev></code>: <code>Name</code>, ... | How to add Child and Grandchild XML tags by XML::LibXML? | perl|xml-libxml | 2 | 49 | 1 | 72,979,262 | 72,979,262 | 3 | true | 2022-07-14T09:53:03.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add Child and Grandchild XML tags by XML::LibXML?<p>I'm trying to make a simple XML file and add <code>Child</code> and <code>Grandchild</code> XML ta... |
72,936,403 | Inserting large XML document into Oracle<p>I have a table in Oracle:</p>
<pre class="lang-sql prettyprint-override"><code>CREATE TABLE foo (id NUMBER, document XMLType)
</code></pre>
<p>and I would typically insert data into it with SQL:</p>
<pre class="lang-sql prettyprint-override"><code>INSERT INTO foo VALUES (1, XM... | <p>In SQL, concatenate 4000 byte strings to <code>EMPTY_CLOB()</code>:</p>
<pre class="lang-sql prettyprint-override"><code>INSERT INTO foo (id, document)
VALUES (1, XMLTYPE(
EMPTY_CLOB()
|| 'first 4000 bytes...'
|| 'second 4000 bytes...'
|| 'etc.'
));
</code></pre>
<p>In PL/SQL, the limit for strings is 32,000... | Inserting large XML document into Oracle | sql|xml|oracle | 0 | 49 | 1 | 72,936,465 | 72,936,465 | 3 | true | 2022-07-11T09:33:30Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Inserting large XML document into Oracle<p>I have a table in Oracle:</p>
<pre class="lang-sql prettyprint-override"><code>CREATE TABLE foo (id NUMBER, docume... |
72,808,702 | Weighted sum of multiple matrices<p>I have a list of m <code>n x n</code> matrices and a list of m real values (alphas). The values of n and m can be quite large. I am trying to calculate the weighted sum of the matrices with weights in alphas.</p>
<p>I was wondering if there is a numpy function (or any other library) ... | <p>You can reshape <code>alpha_vals</code> so that it broadcasts across the first axis of <code>matrices</code> correctly:</p>
<pre><code>(np.array(alpha_vals)[:, None, None] * matrices).sum(axis=0)
</code></pre>
<p>Alternatively, you can adjust the strides of <code>matrices</code>, so that the last dimension correspon... | Weighted sum of multiple matrices | python|numpy|matrix-multiplication | 4 | 49 | 2 | 72,808,759 | 72,808,759 | 3 | true | 2022-06-29T23:00:01.463Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Weighted sum of multiple matrices<p>I have a list of m <code>n x n</code> matrices and a list of m real values (alphas). The values of n and m can be quite l... |
72,890,537 | Including function in React useEffect Dependency Array causes Unwanted Function Runs<p>In my React Typescript app, I am using a <code>useEffect</code> to call <code>eventTracker</code> whenever <code>wallet.address</code> changes.</p>
<pre><code>const wallet = useWallet();
const eventTracker = useAnalyticsEventTracker(... | <p>Your linter suggestion is correct, you just have to apply some memoization to avoid re-rendering.</p>
<p>Upon each render, <code>eventTracker</code> is re-created because you call <code>useAnalyticsEventTracker</code> that creates a new callback. Therefore, having it included in the dependency array will cause re-tr... | Including function in React useEffect Dependency Array causes Unwanted Function Runs | javascript|reactjs|typescript|react-hooks|use-effect | 2 | 49 | 2 | 72,890,785 | 72,890,785 | 4 | true | 2022-07-06T22:34:29.693Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Including function in React useEffect Dependency Array causes Unwanted Function Runs<p>In my React Typescript app, I am using a <code>useEffect</code> to cal... |
72,904,671 | Why does IntelliJ not see javaFx?<p>Why does IntelliJ not see javafx? I thought that it comes with the java JDK.
<a href="https://i.stack.imgur.com/zZb79.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zZb79.png" alt="enter image description here" /></a></p> | <p>JavaFX only comes with some JDK distributions (e.g. Azul Zulu JDK FX or BellSoft Liberica Full JDK), see the:</p>
<ul>
<li><a href="https://stackoverflow.com/tags/javafx/info">Installation section of the JavaFX tag</a>.</li>
</ul>
<p>Official documentation is at:</p>
<ul>
<li><a href="https://openjfx.io/openjfx-docs... | Why does IntelliJ not see javaFx? | java|intellij-idea|javafx | -4 | 49 | 1 | 72,904,732 | 72,904,732 | 4 | true | 2022-07-07T21:59:07.853Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does IntelliJ not see javaFx?<p>Why does IntelliJ not see javafx? I thought that it comes with the java JDK.
<a href="https://i.stack.imgur.com/zZb79.png... |
72,913,339 | How to pivot aggregated rows into columns<p>I have the following table:</p>
<pre><code>+-------+----------+------+------+
| price | quantity | year | name |
+-------+----------+------+------+
| 5 | 1 | 2022 | x |
| 7 | 3 | 2022 | y |
| 5 | 2 | 2022 | x |
| 5 | 3 | 20... | <p>You can use conditional aggregation and then an outer-aggregation to remove the NULL values and condense into a single row:</p>
<pre><code>select Max(x) x, Max(y) y
from (
select
case when name = 'x' then Round(SUM(price)/SUM(quantity), 2) end x,
case when name = 'y' then Round(SUM(price)/SUM(quantity), 2) ... | How to pivot aggregated rows into columns | mysql | 0 | 49 | 2 | 72,913,462 | 72,913,462 | 4 | true | 2022-07-08T14:59:51.990Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to pivot aggregated rows into columns<p>I have the following table:</p>
<pre><code>+-------+----------+------+------+
| price | quantity | year | name |
... |
72,920,042 | How do I remove the border of a Image Button in Tkinter?<p>I know how to remove the border of a Tkinter Button and Image. It is done pretty much exactly like how you do it for everything else</p>
<pre><code>borderwidth=0
</code></pre>
<p>What I need help with if why, even though I put that in the widget's 'design param... | <p>try hightlightthickness:</p>
<pre><code>theme1Button = Button(root, image=theme1, borderwidth=0, highlightthickness=0, background=selectedBackground, command=openCipher)
</code></pre> | How do I remove the border of a Image Button in Tkinter? | python|tkinter|tkinter-button|tkinter-label | 0 | 49 | 1 | 72,921,122 | 72,921,122 | 4 | true | 2022-07-09T08:39:39.947Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I remove the border of a Image Button in Tkinter?<p>I know how to remove the border of a Tkinter Button and Image. It is done pretty much exactly like... |
72,930,829 | Why this function that print array in reverse doesn't work<p>I'm trying to make a function that print array in reverse, but it doesn't work for me.</p>
<p>this is what I wrote (on online C compiler site):</p>
<pre><code>#include <stdio.h>
void print_reversed(int* a)
{
if (a[0]==0) {
break;
}... | <p>You are getting this error or similar:</p>
<pre class="lang-none prettyprint-override"><code><source>: In function 'print_reversed':
<source>:7:9: error: break statement not within loop or switch
7 | break;
</code></pre>
<p>As it says, <code>break</code> only works in a loop or a switch state... | Why this function that print array in reverse doesn't work | c | -1 | 49 | 1 | 72,930,851 | 72,930,851 | 4 | true | 2022-07-10T18:17:15.057Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why this function that print array in reverse doesn't work<p>I'm trying to make a function that print array in reverse, but it doesn't work for me.</p>
<p>th... |
72,927,025 | Is there a way to search for a specific column of a database table inside JetBrains IDEs (IntelliJ/RubyMine)?<p>JetBrains' IDE has a database client where you can view the different tables rows/columns.</p>
<p>I have a table with hundreds of columns. Is there a way to jump/search for a specific column? Otherwise, it's ... | <p>Yes, there is a way. Open a column list (Ctrl/Cmd+F12) and start typing.</p>
<p>Video example: <a href="https://youtu.be/U5SOD-eeK50?t=1221" rel="nofollow noreferrer">https://youtu.be/U5SOD-eeK50?t=1221</a></p> | Is there a way to search for a specific column of a database table inside JetBrains IDEs (IntelliJ/RubyMine)? | intellij-idea|jetbrains-ide|rubymine|datagrip | 0 | 49 | 1 | 72,938,434 | 72,938,434 | 4 | true | 2022-07-10T08:07:43.717Z | 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 search for a specific column of a database table inside JetBrains IDEs (IntelliJ/RubyMine)?<p>JetBrains' IDE has a database client where yo... |
72,978,953 | Add optional Parameter to Prototype<p>In a module (not written by me) I have a prototype sub that takes a code ref and returns result of eval:</p>
<pre><code>sub proto (&) {
my $code = shift;
my $r = eval {&$code};
return $r;
}
sub foo {
my $x = 1;
my $y = proto { $x = $x + 1; };
}
foo(... | <p>use a ';' in the prototype declaration to separate mandatory and optional parameters. And don't include a comma after the code block:</p>
<pre><code>sub foo(&;$) { my ($fn, $arg) = @_; ... }
foo { ... };
foo { ... } 1;
</code></pre>
<p>But in general it's best to avoid using prototypes unless you're trying to em... | Add optional Parameter to Prototype | perl|parameter-passing|prototype | 2 | 49 | 1 | 72,980,206 | 72,980,206 | 4 | true | 2022-07-14T10:20:58.110Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add optional Parameter to Prototype<p>In a module (not written by me) I have a prototype sub that takes a code ref and returns result of eval:</p>
<pre><code... |
72,899,690 | Laravel groupBy and pluck some values<p>I am using laravel 8.x and building rest API project.
I am stuck with a query.</p>
<p>I have a table</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>id</th>
<th>name</th>
<th>type</th>
<th>color</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Dog</td>... | <p>I will slightly improve the Erik answer.</p>
<pre class="lang-php prettyprint-override"><code> $animals = Animals::all()->groupBy('name')->map(function($item) {
return [
'name' => $item[0]['name'], // the name always the same
'type' => $item[0]['type'], ... | Laravel groupBy and pluck some values | php|laravel|eloquent|laravel-8 | 1 | 49 | 2 | 72,903,768 | 72,903,768 | 4 | true | 2022-07-07T14:34:04.307Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Laravel groupBy and pluck some values<p>I am using laravel 8.x and building rest API project.
I am stuck with a query.</p>
<p>I have a table</p>
<div class="... |
72,829,412 | Elm merge two different records into one large one<p>In Elm , is it possible to do something like this.</p>
<p>REPL</p>
<pre><code>> a = {d = 4 , y = 5}
{ d = 4, y = 5 }
: { d : number, y : number1 }
> b = {b = 4,n=1}
{ b = 4, n = 1 }
: { b : number, n : number1 }
> c = {a | b | g=5}
</code></pre>
<p... | <p>No, Elm does not support changing the shape of a record using the record update syntax (<a href="https://github.com/elm/compiler/blob/9f1bbb558095d81edba5796099fee9981eac255a/docs/upgrade-instructions/0.19.0.md#stricter-record-update-syntax" rel="nofollow noreferrer">though it was possible before Elm 0.19</a>), and ... | Elm merge two different records into one large one | merge|record|elm | 3 | 49 | 1 | 72,832,933 | 72,832,933 | 4 | true | 2022-07-01T12:40:11.877Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Elm merge two different records into one large one<p>In Elm , is it possible to do something like this.</p>
<p>REPL</p>
<pre><code>> a = {d = 4 , y = 5}
{... |
72,939,233 | Whats the use of values in enum in Python?<p>I'm working with <code>enum</code> lately and I dont really get the utility of them in some cases. I hope my question is not too trivial or too stupid, and I would really love to better understand the logic behind this python structure. One common use I found online or in so... | <p>The members (should) always be named in all uppercase (per the very first note on <a href="https://docs.python.org/3/library/enum.html#module-enum" rel="nofollow noreferrer">the <code>enum</code> docs</a>), so if you want them to have "names" that are in some other casing, you can assign strings with arbit... | Whats the use of values in enum in Python? | python|enums | 1 | 49 | 3 | 72,939,317 | 72,939,317 | 4 | true | 2022-07-11T13:19:11.167Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Whats the use of values in enum in Python?<p>I'm working with <code>enum</code> lately and I dont really get the utility of them in some cases. I hope my que... |
72,920,195 | Kotlin. Function does not exit recursion after return<p>I need to decompose the number l into prime factors. For this I use recursion. And when l = 1, the function must exit their recursion and return the string in which the prime factors are located, however, the function continues to work and already according to a p... | <p>Let's first mention some issues in your current code:</p>
<ol>
<li><p>You're mixing semantics, here. What is the contract of your function? Does it return a value, or does it modify a global variable? Pick one, don't do both.</p>
</li>
<li><p>You should not use a global variable because it's way harder to follow. In... | Kotlin. Function does not exit recursion after return | kotlin|recursion | 1 | 49 | 2 | 72,920,296 | 72,920,296 | 4 | true | 2022-07-09T09:12:09.383Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Kotlin. Function does not exit recursion after return<p>I need to decompose the number l into prime factors. For this I use recursion. And when l = 1, the fu... |
72,774,853 | find all paterns of a regex in a string<p>I have an overly complicated regex that as far as I know is correct</p>
<pre><code>route = r"""[\s+|\(][iI](\.)?[vV](\.)?(\W|\s|$)?
|\s intravenously|\s intravenous
|[\s|\(][pP](\.)?[oO](\.)?(\W|\s|$)
|\s perorally|\s?... | <p>For the excerpt you show:</p>
<pre><code>\b
(?: i
(?: ntra
(?: cerebroventricular (?:ly)?
| duodenally
| gastric (?:ly)?
| muscular
| peritoneal (?:ly)?
| venous (?:ly)?
) \b
| \.? (?: [gmpv] | c \.? v ) \b \.?
)
|
(?:per)? oral (... | find all paterns of a regex in a string | python-3.x|regex | 2 | 49 | 2 | 72,775,880 | 72,775,880 | 4 | true | 2022-06-27T15:44:25.077Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
find all paterns of a regex in a string<p>I have an overly complicated regex that as far as I know is correct</p>
<pre><code>route = r"""[\s+|... |
72,907,771 | Replacing empty/undefined values with nulls in JavaScript array<p>I have an array and I want to convert the empty/undefined values to null. I have tried the following:</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... | <p>What you have will work for an array that has <code>undefined</code> elements in it, but not for a sparse array with holes in it, because <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="nofollow noreferrer"><code>map</code></a> doesn't visit the holes in a sp... | Replacing empty/undefined values with nulls in JavaScript array | javascript | 2 | 49 | 2 | 72,907,819 | 72,907,819 | 5 | true | 2022-07-08T07:00:16.763Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replacing empty/undefined values with nulls in JavaScript array<p>I have an array and I want to convert the empty/undefined values to null. I have tried the ... |
72,795,951 | helpe to convert from java to php<p>I have written a java code and I need help writing it in PHP because I do not have enough experience with PHP</p>
<pre><code>public static String mo31385a(String str, String str2, String str3) {
int length = str.length();
char[] cArr = new char[length];
for (int i = 0; i ... | <p>Here:</p>
<pre><code>function mo31385a($str, $str2, $str3)
{
$cArr = array();
for ($i = 0; $i < strlen($str); $i++)
{
$charAt = $str[$i];
$indexOf = strpos($str2,$charAt);
if (!$indexOf)
{
$cArr[] = $charAt;
... | helpe to convert from java to php | java|php | -5 | 49 | 1 | 72,796,135 | 72,796,135 | -2 | true | 2022-06-29T04:55:32.017Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
helpe to convert from java to php<p>I have written a java code and I need help writing it in PHP because I do not have enough experience with PHP</p>
<pre><c... |
72,893,338 | Get duplicate rows only by certain fields from inner join query<p>How do I get duplicates rows only from below query?</p>
<pre><code> SELECT p.CustomerNumber
,pn.[Title]
,pn.[FirstName]
,pn.[LastName]
,a.[AgentID]
,a.[AgentName]
,a.[PersonID]
,pe.[EM... | <p>You can use this method to count records in place and exclude those with only one record</p>
<pre><code>SELECT * FROM
(
SELECT T1.*,
COUNT(*) OVER (PARTITION BY
T1.CustomerNumber,
T1.Title,
T1.FirstName,
T1.[LastName],
T1.[AgentID],
... | Get duplicate rows only by certain fields from inner join query | sql|sql-server|filter|duplicates|inner-join | -1 | 49 | 1 | 72,894,074 | 72,894,074 | -1 | true | 2022-07-07T06:43:35.020Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get duplicate rows only by certain fields from inner join query<p>How do I get duplicates rows only from below query?</p>
<pre><code> SELECT p.CustomerNumber... |
72,970,945 | What is the easiest and fastest way to add HTTPS to an AWS EC2 instance?<p>I created an EC2 instance. It has a default URL like this:</p>
<pre><code>http(s)://ec2-000-000-000-000.us-east-1.compute.amazonaws.com
</code></pre>
<p>I'm ok with this URL, the server is to be used for API calls, so I don't care about it - any... | <p>It turned out to be pretty easy - it can be done with API Gateway.</p>
<ol>
<li>Create HTTP (not REST) API Gateway.</li>
<li>Create a route: <code>ANY</code> <code>/{path+}</code></li>
<li>Attach an integration to the route with URI: <code>http://ec2-000-000-000-000.us-east-1.compute.amazonaws.com:3000/{path}</code>... | What is the easiest and fastest way to add HTTPS to an AWS EC2 instance? | amazon-web-services|amazon-ec2 | -1 | 49 | 2 | 73,140,300 | 73,140,300 | -1 | true | 2022-07-13T18:22:54.940Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the easiest and fastest way to add HTTPS to an AWS EC2 instance?<p>I created an EC2 instance. It has a default URL like this:</p>
<pre><code>http(s):... |
72,988,574 | UPDATE mysqli with SUM of unique row value + string value<p>Sorry by this simple question. I found many many many (almost infinite) topics of how update join values row + row and get total value but no one helped me yet.</p>
<p>Actually I have this SQL</p>
<pre><code> <? php
$idu = '135';
$tvt = '1';
$conn =... | <p>Example of an SQL script to create the summary</p>
<pre><code>$mysqli = mysqli_connect($servername, $username, $password, $database);
mysqli_query( $mysqli, "SET NAMES UTF8" );
$sql_select = "SELECT SUM(tvt) AS sum_tvt FROM user GROUP BY idu";
$sql_query = mysqli_query( $mysqli, $sql... | UPDATE mysqli with SUM of unique row value + string value | php|mysql|mysqli | -2 | 49 | 2 | 72,988,777 | 72,988,777 | -1 | true | 2022-07-15T02:51:21.640Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
UPDATE mysqli with SUM of unique row value + string value<p>Sorry by this simple question. I found many many many (almost infinite) topics of how update join... |
72,363,822 | Extract both certificates and response payload from URL with Clojure<p>I'm trying to extract both the certificate from an URL and its payload response in a single request.
My code right now looks like this:</p>
<pre><code>(s/defn get-server-leaf-certificate
[url :- s/Str]
(let [conn (.openConnection url)]
(with... | <p>This is the way I got this to work:</p>
<pre><code>(:import (java.net URI)
(java.io BufferedReader))
(s/defn retrieve-dynamic-response-from-psp!
[url :- s/Str]
(let [conn (.openConnection (io/as-url url))
_ (.setReadTimeout conn (config/read-timeout))
_ (.setRequestProperty conn "... | Extract both certificates and response payload from URL with Clojure | http|clojure|x509certificate | 0 | 50 | 1 | 72,687,532 | 72,687,532 | 0 | true | 2022-05-24T13:31:20.653Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Extract both certificates and response payload from URL with Clojure<p>I'm trying to extract both the certificate from an URL and its payload response in a s... |
72,768,156 | ReactJS - localstorage did not update after refresh the page<p>im new here, can somebody help me to solve this. why my localstorage on my redux did not update after i try to remove the state from cartItems? so everytime i remove the cart, and i refresh.. localstorage did not return the new value. can somebody help me a... | <p>Problem is in your thunk, in this part:</p>
<pre><code>thunkAPI.dispatch(removeCart(data._id));
return localStorage.setItem(
'cartItems',
JSON.stringify(thunkAPI.getState().cart.cartItems)
)
</code></pre>
<p>You are basically trying to update redux state and immediately after to access that new state, but ... | ReactJS - localstorage did not update after refresh the page | reactjs|redux|redux-toolkit | -1 | 50 | 1 | 72,768,475 | 72,768,475 | 0 | true | 2022-06-27T07:08:04.527Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ReactJS - localstorage did not update after refresh the page<p>im new here, can somebody help me to solve this. why my localstorage on my redux did not updat... |
72,768,670 | How to rank/order bars in barchart ggplot?<p>I have 2 numerical (sales; cost) and 2 categorical (model; level) variables:</p>
<pre><code> model level sale cost Colour
1 A HIGH 100 -110 black
2 B HIGH 120 -89 khaki1
3 C HIGH 500 -20 red
4 D HIGH 455 -300 green
5 E... | <p>One option to achieve your desired result would be to add a helper value column to your data where you assign a value of e.g. <code>-Inf</code> to <code>Z</code> and which is used to set the order of the categories. This way <code>Z</code> will be put at the last position.</p>
<p>Note: I removed <code>scale_color/fi... | How to rank/order bars in barchart ggplot? | r|ggplot2|plotly|data-visualization | 1 | 50 | 1 | 72,768,992 | 72,768,992 | 0 | true | 2022-06-27T07:52:57.107Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to rank/order bars in barchart ggplot?<p>I have 2 numerical (sales; cost) and 2 categorical (model; level) variables:</p>
<pre><code> model level sale ... |
72,770,644 | AES CMAC generating wrong signature<p>I'm trying to generate AES-CMAC using cryptography library. And with message and key it is generating different output then online calculator : <a href="https://artjomb.github.io/cryptojs-extension/" rel="nofollow noreferrer">AES-CMAC ONLINE CALCULATOR</a></p>
<p>Here is my code</p... | <p>To derive the key <code>aeskey_for_CMAC</code>, <code>key</code> must not be hex <strong>en</strong>coded, but hex <strong>de</strong>coded and from the result the last 16 bytes are to be used as CMAC key:</p>
<pre class="lang-py prettyprint-override"><code>aeskey_for_CMAC = binascii.unhexlify(key)[-16:]
</code></pr... | AES CMAC generating wrong signature | python|aes | 1 | 50 | 1 | 72,771,203 | 72,771,203 | 0 | true | 2022-06-27T10:33:46.603Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AES CMAC generating wrong signature<p>I'm trying to generate AES-CMAC using cryptography library. And with message and key it is generating different output ... |
72,771,822 | How to integrate a device with custom API calls?<p>We would like to add an IoT device which uses specific API calls / responses, and we would like to know the best way to do it. Can we do this integration using the FIWARE JSON IoT Agent? We have to develop a custom FIWARE IoT Agent?</p> | <p>If you have a JSON payload (or you can create one) then the JSON IoT Agent is a good baseline to start from. There are two basic approaches:</p>
<ol>
<li><p><a href="https://fiware-academy.readthedocs.io/en/latest/integrated-courses/webinars/index.html#48-iot-agent-gateways-using-the-iota-tangle-for-secure-data-tran... | How to integrate a device with custom API calls? | fiware | 0 | 50 | 2 | 72,772,234 | 72,772,234 | 0 | true | 2022-06-27T12:06:30.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to integrate a device with custom API calls?<p>We would like to add an IoT device which uses specific API calls / responses, and we would like to know th... |
72,776,362 | model code for spring boot crud with mongodb<p>model code for spring boot crud with MongoDB</p>
<ul>
<li>application properties samples</li>
<li>model classes samples</li>
<li>repositories samples</li>
<li>exception handling samples</li>
</ul> | <p>application.properties</p>
<pre><code>spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.database=testtwo
</code></pre>
<p>model samples</p>
<pre><code>import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collecti... | model code for spring boot crud with mongodb | mongodb|spring-boot | 1 | 50 | 2 | 72,776,461 | 72,776,461 | 0 | true | 2022-06-27T17:46:57.873Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
model code for spring boot crud with mongodb<p>model code for spring boot crud with MongoDB</p>
<ul>
<li>application properties samples</li>
<li>model classe... |
72,770,247 | Why does it keep loading forever?<p>there is a problem. I have SOMETIMES no download icon disappears. Or to put it another way, instead of "No more entries", I see a loading circle.</p>
<p>This happens depending on how much data I received. For example, for 5 records there will be an endless download, and for... | <p>you are not setting isLoading as false for HTTP request's response other than 200 and for error.</p>
<pre><code>Future fetch() async {
if(isLoading) return;
isLoading = true;
var token = LoginClass.resJson;
const limit = 9;
try {
final response = await http.post(
Uri.parse(Config.urlReport),
headers:... | Why does it keep loading forever? | flutter|dart | 0 | 50 | 1 | 72,781,153 | 72,781,153 | 0 | true | 2022-06-27T10:02:50.007Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does it keep loading forever?<p>there is a problem. I have SOMETIMES no download icon disappears. Or to put it another way, instead of "No more entr... |
72,783,372 | Hide div , when default option is chosen<p>I'm currently trying to do a selection with three options:
-The first, is the default one.
-the 2nd option displays inputs,
-and the 3rd other inputs</p>
<p>My problem is: that when I choose the second or the third option, my inputs change, so that's good.
But when I select th... | <p>You can use the same method as you used before and create a div around both options:</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>$(document).ready(function() {
$('#b... | Hide div , when default option is chosen | javascript|html|jquery|css|performance | 0 | 50 | 2 | 72,783,459 | 72,783,459 | 0 | true | 2022-06-28T08:46:25.413Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Hide div , when default option is chosen<p>I'm currently trying to do a selection with three options:
-The first, is the default one.
-the 2nd option display... |
72,774,943 | How to access an external MySQL database from within a PythonAnywhere Flask Webapp (via Pandas&sqlalchemy): Receiving sqlalchemy.exc.OperationalError<p>I am attempting to convert a Flask webapp to run on PythonAnywhere instead of my Raspberry Pi on which it is currently hosted and functions perfectly.</p>
<p>One of the... | <p>If you're using a free account, you will only be able to connect out of PythonAnywhere using http(s) to a list of approved sites. So external database connections will not work from a free account.</p> | How to access an external MySQL database from within a PythonAnywhere Flask Webapp (via Pandas&sqlalchemy): Receiving sqlalchemy.exc.OperationalError | python|flask|sqlalchemy|pythonanywhere | 0 | 50 | 1 | 72,783,664 | 72,783,664 | 0 | true | 2022-06-27T15:51:28.350Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to access an external MySQL database from within a PythonAnywhere Flask Webapp (via Pandas&sqlalchemy): Receiving sqlalchemy.exc.OperationalError<p>I am ... |
72,782,462 | Python Proxy Error when streaming XML files from Azure Event Hub using Databricks<p>I've got the below piece of code to retrieve XML files, extract some of the tags and save as CSV files. As tag values need to be saved as separate files I'm using <code>foreachbatch</code> method of <code>df.writeStream</code>; to extra... | <p>Changing write2csv function with below fixed the issue</p>
<pre><code>def write2csv(df, epoch_id):
df.persist()
df_tuples = df.select(extract_udf("data").alias("extracted_data"))
df_parsed = df_tuples.select("extracted_data.*")
df_parsed \
.write \
.format("csv") \
... | Python Proxy Error when streaming XML files from Azure Event Hub using Databricks | apache-spark|pyspark|spark-streaming|azure-databricks | 0 | 50 | 1 | 72,784,926 | 72,784,926 | 0 | true | 2022-06-28T07:39:44.733Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python Proxy Error when streaming XML files from Azure Event Hub using Databricks<p>I've got the below piece of code to retrieve XML files, extract some of t... |
72,781,206 | How to control or avoid the smoothing parameters in set dgrid3d cauchy in gnuplot?<p>I am trying to generate a heatmap(smooth) using the command "set
dgrid3d NX, NY cauchy dx,dy " with my actual data points that are
lying on or blending into this heatmap using Gnuplot. The data that I
want to plot in a heatma... | <p>The smoothened background has approximately the value of the average of your data points and is therefore elevated. For the data you provided the average is 47.9 which corresponds to the greenish-orangy colour you observe.</p>
<p>One possibility would be to add the keyword <code>kdensity</code> which gives you a val... | How to control or avoid the smoothing parameters in set dgrid3d cauchy in gnuplot? | gnuplot|surface | 1 | 50 | 1 | 72,785,276 | 72,785,276 | 0 | true | 2022-06-28T05:37:08.410Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to control or avoid the smoothing parameters in set dgrid3d cauchy in gnuplot?<p>I am trying to generate a heatmap(smooth) using the command "set
dg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.