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,971,433 | Is there an R function that turns a frequency table into a prop table?<p>What is the simplest way of turning a frequency data table into a prop table in R?</p>
<p>This is the data:</p>
<pre><code> Time Total Blog News Social.Network Microblog Other Forums Pictures Video
1 15.KW 2022 1816 23 326 ... | <p>Your data frame <code>df</code> has a 2nd column called <em>Total</em>. It seems that you want to divide subsequent columns by this one.</p>
<pre><code>df[-1] <- df[-1] / df$Total
</code></pre>
<p>After this, the 1st column <em>Time</em> does not change. 2nd column <em>Total</em> becomes 1. Other columns become p... | Is there an R function that turns a frequency table into a prop table? | r | 1 | 43 | 1 | 72,971,544 | 72,971,544 | 2 | true | 2022-07-13T19:08:13.657Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there an R function that turns a frequency table into a prop table?<p>What is the simplest way of turning a frequency data table into a prop table in R?</... |
72,972,228 | How to load a listbox of states depending on the selected country in RemixRun?<p>I love Remix, but there are some things I wonder how it could be achieved.</p>
<p>Let say I have 2 listboxes, one for the country and a second for the state.</p>
<p>How would I achieve the loading of the states depending on the country sel... | <p>Here's a quick demo. I'm using <code>useFetcher</code> to load data when country changes. As you can see I also sent the initial data from the loader.</p>
<pre class="lang-js prettyprint-override"><code>export const loader: LoaderFunction = async ({ request }) => {
const url = new URL(request.url)
const count... | How to load a listbox of states depending on the selected country in RemixRun? | remix|remix.run | 1 | 43 | 1 | 72,972,964 | 72,972,964 | 2 | true | 2022-07-13T20:24:48.027Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to load a listbox of states depending on the selected country in RemixRun?<p>I love Remix, but there are some things I wonder how it could be achieved.</... |
72,981,561 | Solving project Euler 25 in a functional manner using Scala<p>I am currently using Project Euler to learn Scala. <br>
I am stuck on problem 25 with a <code>java.lang.OutOfMemoryError</code> exception.</p>
<p>Here is the question:</p>
<blockquote>
<p>What is the index of the first term in the Fibonacci sequence to conta... | <p>Let's run your program in parts.</p>
<pre><code>lazy val fibs: LazyList[Int] = 0 #:: fibs.scanLeft(1)(_ + _)
fibs.take(100).foreach(println)
</code></pre>
<p>It prints:</p>
<pre><code>0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
10946
17711
28657
46368
75025
121393
196418
317811
514229
832040... | Solving project Euler 25 in a functional manner using Scala | scala|functional-programming|out-of-memory | 2 | 43 | 1 | 72,981,805 | 72,981,805 | 2 | true | 2022-07-14T13:44:20.303Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Solving project Euler 25 in a functional manner using Scala<p>I am currently using Project Euler to learn Scala. <br>
I am stuck on problem 25 with a <code>j... |
72,998,223 | Sample values from a data.frame, run a function and use the results to create a third data.frame<p>I'm working with two data.frames, one contains parameter values ("params") and another contains covariate values ("data").</p>
<pre><code>> head(params)
# A tibble: 6 × 4
`a[1]` `a[2]` `b[1]` `... | <p>Here is a very simple approach, if I understand what you are trying to do!</p>
<p>First I combine the <code>a</code> parameters from <code>params$a[1]</code> and <code>params$a[2]</code>. Similarly for <code>b</code>. Then, I create a simple function, <code>f</code>, that samples from these params with replacement <... | Sample values from a data.frame, run a function and use the results to create a third data.frame | r|dataframe|data-wrangling | 0 | 43 | 1 | 72,998,396 | 72,998,396 | 2 | true | 2022-07-15T18:21:49.933Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sample values from a data.frame, run a function and use the results to create a third data.frame<p>I'm working with two data.frames, one contains parameter v... |
73,005,308 | MySQL Select Count of Duplicate Value In Relation Table<p>I have 3 tables: foods, order_detail, and orders</p>
<p>Here are the records for table <code>foods</code>:</p>
<pre><code>id | name | type
------------------------------
F01 | Omelette | Breakfast
F02 | Burger | Breakfast
F03 | Satay | ... | <p>Aggregation can work here, but you need to join across all three tables:</p>
<pre class="lang-sql prettyprint-override"><code>SELECT f.type, COUNT(o.order_id) AS total_order
FROM foods f
LEFT JOIN order_detail od ON od.food_id = f.id
LEFT JOIN orders o ON o.order_id = od.order_id
GROUP BY f.type
ORDER BY f.id;
</cod... | MySQL Select Count of Duplicate Value In Relation Table | mysql|sql|join | -2 | 43 | 3 | 73,005,350 | 73,005,350 | 2 | true | 2022-07-16T15:10:13.050Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MySQL Select Count of Duplicate Value In Relation Table<p>I have 3 tables: foods, order_detail, and orders</p>
<p>Here are the records for table <code>foods<... |
73,005,464 | Remove line and the one before that matches pattern using sed<p>I have a file containing the following text:</p>
<pre><code>>seq 1
GAA--ACGAA
>seq 2
CATCTCGGGA
>seq 3
GACG-CG-AG
>seq 4
ATTCCGTGCC
</code></pre>
<p>How can I delete the lines containing "-" and the ones before it using <code>sed</cod... | <p>Using <code>sed</code></p>
<pre><code>$ sed 'N;/-/d' input_file
>seq 2
CATCTCGGGA
>seq 4
ATTCCGTGCC
</code></pre> | Remove line and the one before that matches pattern using sed | sed | 0 | 43 | 2 | 73,005,660 | 73,005,660 | 2 | true | 2022-07-16T15:32:24.643Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove line and the one before that matches pattern using sed<p>I have a file containing the following text:</p>
<pre><code>>seq 1
GAA--ACGAA
>seq 2
CA... |
73,011,040 | Checkbox not working on checked to add values<p>I have created calculation system project with javascripts all things are good calculation done perfectly tax include perfectly but tax not included when I click on checkebox, it add when I type something in input field, I want values changes on when I clicked on checkbox... | <p>The problem is that the <code>keyup()</code> method will only act on an <code><input type="checkbox"></code> when the space key is pressed to activate it.</p>
<p>To avoid this kind of problem I'd suggest switching the code to react to <code>input</code> events (which covers any event in which the val... | Checkbox not working on checked to add values | javascript|html|jquery|innerhtml | 1 | 43 | 2 | 73,011,189 | 73,011,189 | 2 | true | 2022-07-17T10:33:58.127Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Checkbox not working on checked to add values<p>I have created calculation system project with javascripts all things are good calculation done perfectly tax... |
73,024,524 | Calling method in my store returns empty observer object<p>I am new with Vue.</p>
<p>I have a Vue component like below. The return value of my function <code>getBuildingsByOwnerRequest</code> is unexpected: It returns an empty observer object. Only if I run <code>getBuildingsByOwnerRequest</code> again I receive the ex... | <p>The object is empty at the time it's logged. All asynchronous actions should return a promise:</p>
<pre><code>getBuildingsByOwnerRequest({ dispatch }, owner_id) {
return axios
...
</code></pre>
<p>A promise needs to be awaited before accessing results that it promises:</p>
<pre><code> this.getBuildingsByOwnerReq... | Calling method in my store returns empty observer object | javascript|vue.js|vuejs2|vuex | 1 | 43 | 1 | 73,026,267 | 73,026,267 | 2 | true | 2022-07-18T15:05:26.233Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Calling method in my store returns empty observer object<p>I am new with Vue.</p>
<p>I have a Vue component like below. The return value of my function <code... |
73,029,054 | How to replace multine values to empty string in linux?<p><a href="https://i.stack.imgur.com/wqZJx.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wqZJx.jpg" alt="enter image description here" /></a></p>
<p>I wanted to change this value</p>
<pre><code>{
"data":"correctValue",
&q... | <p>Or, if instead of deleting the attributes you want to keep <code>.data</code>, you can do:</p>
<pre><code>jq '{data: .data}' input-file
</code></pre> | How to replace multine values to empty string in linux? | shell|unix|sed|vi | -2 | 43 | 2 | 73,029,187 | 73,029,187 | 2 | true | 2022-07-18T21:59:09.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to replace multine values to empty string in linux?<p><a href="https://i.stack.imgur.com/wqZJx.jpg" rel="nofollow noreferrer"><img src="https://i.stack.i... |
73,018,083 | Properly shutting down send-only NServiceBus Endpoint in a WCF Application<p>We are trying to host a send-only endpoint within a WCF service. Due to its fire-and-forget nature, the WCF hosting option <a href="https://docs.particular.net/nservicebus/wcf/" rel="nofollow noreferrer">here</a> isn't really what we are looki... | <p>You don't 'need' to shut down a send-only endpoint. It is more critical for processing endpoints to shutdown gracefully, as there may be messages in-flight being processed.</p> | Properly shutting down send-only NServiceBus Endpoint in a WCF Application | c#|wcf|nservicebus | 1 | 43 | 1 | 73,058,394 | 73,058,394 | 2 | true | 2022-07-18T06:26:45.630Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Properly shutting down send-only NServiceBus Endpoint in a WCF Application<p>We are trying to host a send-only endpoint within a WCF service. Due to its fire... |
72,907,661 | Creating a Multiple Dictionaries from a CSV File<p>I am currently importing a file as so:</p>
<pre><code>df= pd.read_csv(r"Test.csv")
</code></pre>
<p>And the output looks like</p>
<pre><code> Type Value
0 Food_Place_1 1
1 Food_Place_2 2
2 Car_Type_1 3
3 Car_Type_2 4
</code></pre>
<p... | <p>Create category for possible aggregate lists for nested dictionary:</p>
<pre><code>#If category is set by remove digits
cat = df['Type'].str.replace('\d','')
#If category is set by first letter
#cat = df['Type'].str[0]
d = df.rename(columns={'Type':'Component'}).groupby(cat).agg(list).to_dict('index')
print (d)
{'... | Creating a Multiple Dictionaries from a CSV File | python|pandas | 1 | 43 | 1 | 72,907,694 | 72,907,694 | 2 | true | 2022-07-08T06:49:33.673Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating a Multiple Dictionaries from a CSV File<p>I am currently importing a file as so:</p>
<pre><code>df= pd.read_csv(r"Test.csv")
</code></pre>... |
72,966,402 | How to cast a null value that is returned from a nested select to an empty array?<p>Suppose I have the following,</p>
<pre><code>CREATE TABLE IF NOT EXISTS my_schema.user (
id serial PRIMARY KEY,
user_name VARCHAR (50) UNIQUE NOT NULL
);
CREATE TABLE IF NOT EXISTS my_schema.project (
id serial PRIMARY KEY,... | <p>Use <code>COALESCE()</code>:</p>
<pre><code>COALESCE((
SELECT to_json(array_agg(c.*))
FROM "user" as c
WHERE c.id = ANY(s.collaborators)
), to_json(array[]::json[])) as collaborators
</code></pre>
<p>See the <a href="https://dbfiddle.uk/?rdbms=postgres_13&fiddle=53268f5283d534f9d74ca10c5a0e... | How to cast a null value that is returned from a nested select to an empty array? | arrays|json|postgresql|coalesce | 3 | 43 | 1 | 72,966,732 | 72,966,732 | 2 | true | 2022-07-13T12:35:09.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to cast a null value that is returned from a nested select to an empty array?<p>Suppose I have the following,</p>
<pre><code>CREATE TABLE IF NOT EXISTS m... |
72,928,499 | How to start the calculation again after it catches an exception java<p>I am new to java, I'm trying to calculate the net income, I want the user to return to calculation if I get the negative net value. I tried to use try catch statement but it failing to return to where it started. Please help.</p>
<p><strong>Here is... | <p>Hm, <code>try-catch</code> blocks don't work that way, instead you would want to wrap your program in a <code>while-loop</code>:</p>
<pre class="lang-java prettyprint-override"><code> public class Main {
public static void main(String[] args) {
double nett = -1;
try (... | How to start the calculation again after it catches an exception java | java|intellij-idea|return|try-catch | 0 | 43 | 2 | 72,928,626 | 72,928,626 | 2 | true | 2022-07-10T12:34:56.953Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to start the calculation again after it catches an exception java<p>I am new to java, I'm trying to calculate the net income, I want the user to return t... |
72,976,002 | boxcox transformation method compare.(R, python)<p>I have a simple question: I want to make a boxcox transformation on a series of data. I tried different method, then got different results. Why I don't have consistent result?</p>
<p>Data:(in R form)</p>
<pre><code>x <- c(112,118,132,129,121,135,148,148,136,119,104,... | <p>Your script optimizes correlation. Both <code>MASS::boxcox()</code> in R and
<code>scipy.stats.boxcox()</code> in Python use maximum likelihood estimation, instead.</p>
<p>The difference between R and Python comes from the fact that <code>MASS::boxcox()</code>
uses a fairly sparse grid search by default. By using
a ... | boxcox transformation method compare.(R, python) | python|r | 1 | 43 | 1 | 72,981,087 | 72,981,087 | 2 | true | 2022-07-14T06:16:59.747Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
boxcox transformation method compare.(R, python)<p>I have a simple question: I want to make a boxcox transformation on a series of data. I tried different me... |
72,904,963 | How can I get the current script name of a script running in parent script's shell?<p>How can I get the name of a child script that is running in the shell of it's parent?</p>
<p>consider script1.sh;</p>
<pre><code>#this is script 1
echo "$0"
. ./script2.sh
</code></pre>
<p>and script2.sh;</p>
<pre><code>#thi... | <p>You are <strong>sourcing</strong> a script, not running it. Therefore, you are looking for <code>BASH_SOURCE</code>.</p>
<pre><code>$ cat test.sh
echo $BASH_SOURCE
$ . ./test.sh
./test.sh
</code></pre>
<p><strong>Update:</strong></p>
<p>Some people posted that <code>BASH_SOURCE</code> is indeed an array and, whil... | How can I get the current script name of a script running in parent script's shell? | linux|bash|shell | 0 | 43 | 1 | 72,904,983 | 72,904,983 | 2 | true | 2022-07-07T22:43:49.393Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I get the current script name of a script running in parent script's shell?<p>How can I get the name of a child script that is running in the shell o... |
72,977,734 | Trying to refactor this to LinQ but getting a invalid cast<p>So I am wanting to refactor this to LinQ, and not having any luck with it and I am out of search options to guide me in the right direction.</p>
<p>Can someone explain this to me please, as the commented code works and the LinQ well I know I am doing it wrong... | <p>First of all, you want to return <code>T</code>, not <code>bool</code> that's why the final <code>Select</code> is <em>incorrect</em>:</p>
<pre><code>// Returns `bool`: if "x.InstanceClass" is of type "type"
Select(x => x.InstanceClass.GetType() == type)
</code></pre>
<p>Now let's state the pr... | Trying to refactor this to LinQ but getting a invalid cast | c#|linq | -1 | 43 | 2 | 72,977,901 | 72,977,901 | 2 | true | 2022-07-14T08:45:55.080Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Trying to refactor this to LinQ but getting a invalid cast<p>So I am wanting to refactor this to LinQ, and not having any luck with it and I am out of search... |
72,982,477 | Skip over element in .map without adding .filter etc<p>I'm looking for beautiful solution
I have array <em>items</em>. Item consists of <em>user_id</em> and some other information.
I need map all items and for each item find user with appropriate id. Then add to item some information from user</p>
<pre><code>items = it... | <p>It depends what you mean by "skip over element."</p>
<p>If you mean "don't include it in the output array," then you'll have to put <code>map</code> aside, because <code>map</code> will always produce an output element for an input element. Instead, you can just loop through pushing to a new arra... | Skip over element in .map without adding .filter etc | javascript | 1 | 43 | 2 | 72,982,527 | 72,982,527 | 2 | true | 2022-07-14T14:48:47.217Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Skip over element in .map without adding .filter etc<p>I'm looking for beautiful solution
I have array <em>items</em>. Item consists of <em>user_id</em> and ... |
72,894,424 | Where clause if true would not show at all<p>Have table where are two columns - <code>client_id, content</code></p>
<p>every client have +- 50 content rows.</p>
<p>In WHERE i have this clause - <code>where content NOT IN ('2','3','4')</code></p>
<p>In result shows same clients but without rows where are <strong>'2','3... | <p><code>NOT IN</code> only removes the rows with '2','3' or '4' in the content column.</p>
<p>Use <code>NOT EXISTS</code>:, the following query will return all client_id <strong>without</strong> '2' '3' or '4' in the content column</p>
<pre><code>SELECT DISTINCT client_id
FROM [your table] AS t
WHERE NOT EXISTS
(SEL... | Where clause if true would not show at all | sql|postgresql | -1 | 43 | 1 | 72,894,592 | 72,894,592 | 2 | true | 2022-07-07T08:14:30.780Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Where clause if true would not show at all<p>Have table where are two columns - <code>client_id, content</code></p>
<p>every client have +- 50 content rows.<... |
72,994,365 | Calculate availability with dates<p>I have a tibble and want to compute monthly availability (A), defined as</p>
<p>A = uptime / (uptime + downtime),</p>
<p>where (monthly) downtime is <code>end</code> - <code>start</code>, by month and uptime is total time (1 month) - downtime. What is the way to compute monthly avail... | <p>First, you have inconsistent <code>"tzone"</code> attributes, one is <code>"UTC"</code> and the other is <code>"GMT"</code>. It's minor (and slightly noisy), so I'll preempt the noise (though no change in the results):</p>
<pre class="lang-r prettyprint-override"><code>attr(dat$end, &qu... | Calculate availability with dates | r | 0 | 43 | 2 | 72,994,838 | 72,994,838 | 2 | true | 2022-07-15T12:57:27.083Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Calculate availability with dates<p>I have a tibble and want to compute monthly availability (A), defined as</p>
<p>A = uptime / (uptime + downtime),</p>
<p>... |
72,996,906 | Pivot wider with merging rows in R<p>I have the data like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>id</th>
<th>group</th>
<th>A</th>
<th>B</th>
<th>C</th>
<th>D</th>
</tr>
</thead>
<tbody>
<tr>
<td>id1</td>
<td>2</td>
<td>0</td>
<td>81</td>
<td>0.01</td>
<td>81</td>
</tr>
<tr>
... | <p>Two-step:</p>
<pre class="lang-r prettyprint-override"><code>tidyr::pivot_longer(dat, -c(id, group)) %>%
tidyr::pivot_wider(id, names_from=c("group", "name"),
names_glue="{name}_{group}", values_from="value")
# # A tibble: 4 x 9
# id A_2 B_2 ... | Pivot wider with merging rows in R | r|tidyr | 0 | 43 | 2 | 72,997,011 | 72,997,011 | 2 | true | 2022-07-15T16:16:35.543Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pivot wider with merging rows in R<p>I have the data like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>id</th>
<th>grou... |
73,026,198 | In the documentation says, we should use singleton for RoomDatabase instance. Is it per database or per application process?<p>In official <a href="https://developer.android.com/training/data-storage/room#:%7E:text=Note%3A%20If%20your%20app%20runs%20in%20a%20single%20process%2C%20you%20should%20follow%20the%20singleton... | <blockquote>
<p>Assuming we have multiple databases, with different tables, shall we considate all of them under one database and then create a single instance of the consolidated database?</p>
</blockquote>
<p>If the migration is from multiple databases to a single database, then the migration will very likely require... | In the documentation says, we should use singleton for RoomDatabase instance. Is it per database or per application process? | android|android-room|database-migration | 0 | 43 | 1 | 73,028,909 | 73,028,909 | 2 | true | 2022-07-18T17:19:32.067Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In the documentation says, we should use singleton for RoomDatabase instance. Is it per database or per application process?<p>In official <a href="https://d... |
73,005,002 | What does rails DSL configuration mean and what does a DSL configuration look like?<p>So i have the following bower file :-</p>
<pre><code>group :vendor, assets_path: 'assets/shop' do
asset 'jquery', '2.2.1'
asset 'lodash', '4.6.1'
...
end
</code></pre>
<p>Now i see the output in the folder <code>vendor/assets/sh... | <p>DSL is <a href="https://en.wikipedia.org/wiki/Domain-specific_language" rel="nofollow noreferrer">Domain Specific Language</a>. "Domain Specific" here meaning the language is for a very particular use, in this case it is only for configuring Bower. In contrast, a General Purpose Language like Ruby or JSON ... | What does rails DSL configuration mean and what does a DSL configuration look like? | ruby|bower|dsl|bower-rails | 0 | 43 | 1 | 73,006,668 | 73,006,668 | 2 | true | 2022-07-16T14:28:04.263Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What does rails DSL configuration mean and what does a DSL configuration look like?<p>So i have the following bower file :-</p>
<pre><code>group :vendor, ass... |
72,961,251 | Importing local modules into Snakemake files<p>How do you import local files (.py files) into Snakemake files (.smk files)? I have the following example structure:</p>
<pre><code>parent_dir
├── dir1
│ └── a.py
└── dir2
└── b.smk
</code></pre>
<p>I would like to import <code>a.py</code> into <code>b.smk</code>. I ... | <p>As you noticed, <code>__file__</code> gives the path to the snakemake module workflow.py. You can access the path to the snakefile with <code>workflow.basedir</code> (I think there is a better method though, check the documentation). Also, I think you need to convert the Path object to string. So something like:</p>... | Importing local modules into Snakemake files | python|snakemake | 0 | 43 | 1 | 72,970,638 | 72,970,638 | 2 | true | 2022-07-13T05:16:49.720Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Importing local modules into Snakemake files<p>How do you import local files (.py files) into Snakemake files (.smk files)? I have the following example stru... |
73,007,115 | pandas perform division between 2 tables (1 aggregated) with different size<p>I am a newbie to pandas and I am struggling to get the result that I want after doing research / experiencing some trial and errors...appreciate any guidance from here, thanks in advance!</p>
<p>Supposed I have a dataframe which holds some tr... | <p>IIUC</p>
<p>is that what you're looking for?</p>
<pre><code>df['mkt_vol'] = df.groupby(['market','time'])['volume'].transform('sum')
df['prod_vol'] = round(df['volume']/df['mkt_vol'] * 100, 2)
df
</code></pre>
<p>OR, just a single line</p>
<pre><code>df['prod_vol'] = round(df['volume']/df.groupby(['market','time'])[... | pandas perform division between 2 tables (1 aggregated) with different size | python|pandas|aggregation|division|calculation | 2 | 43 | 1 | 73,007,626 | 73,007,626 | 2 | true | 2022-07-16T19:32:42.963Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pandas perform division between 2 tables (1 aggregated) with different size<p>I am a newbie to pandas and I am struggling to get the result that I want after... |
73,008,968 | How to apply pandas groupby to a dataframe to use both rows and columns when calculating a mean<p>I have a dataframe df in the format:</p>
<pre><code> Grade Height Speed Value
0 A 13 0.1 500
1 B 25 0.3 100
2 C 54 0.6 200
</code></pre>
<p>And I am lo... | <ul>
<li>Use <code>pd.cut</code> to break your <code>Height</code> Column into bins.</li>
<li>Create a new column of <code>Speed * Value</code></li>
<li>Pivot your table, <code>mean</code> is the default pivot function.
<ul>
<li><code>dropna=False</code> is used so that even null bins are shown.</li>
</ul>
</li>
</ul>... | How to apply pandas groupby to a dataframe to use both rows and columns when calculating a mean | python|pandas|dataframe|group-by | 0 | 43 | 2 | 73,009,107 | 73,009,107 | 2 | true | 2022-07-17T02:53:44.270Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to apply pandas groupby to a dataframe to use both rows and columns when calculating a mean<p>I have a dataframe df in the format:</p>
<pre><code> Gr... |
72,817,724 | Sort by the reverse of the words<p>How can I sort a list of words</p>
<pre><code>apple
banana
orange
healthy
</code></pre>
<p>by the reverse of the words, the result should be</p>
<pre><code>banana
orange
apple
healthy
</code></pre> | <p>Use the <code>rev</code> utility to reverse lines characterwise. Then <code>rev</code> again.</p>
<pre><code>$ cat input.txt | rev | sort | rev
banana
orange
apple
healthy
</code></pre>
<h3>Edit 1</h3>
<p>As pointed out by <a href="https://stackoverflow.com/users/13919668/dan">@dan</a>, the better solution is to do ... | Sort by the reverse of the words | bash|unix|command-line|zsh | 0 | 43 | 2 | 72,817,768 | 72,817,768 | 2 | true | 2022-06-30T14:39:48.953Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sort by the reverse of the words<p>How can I sort a list of words</p>
<pre><code>apple
banana
orange
healthy
</code></pre>
<p>by the reverse of the words, th... |
72,942,595 | Meaning of 3D when used BEFORE a url not within one<p>I have this piece of html from wikipedia.</p>
<pre><code><a href=3D"https://en.wikipedia.org/wiki/Judith_Ehrlich" title=3D"Judith Ehrlich">Judith Ehrlich</a>
</code></pre>
<p>I understand "=3D" is Quoted-Printable encoding f... | <p>In quoted-printable, any non-standard octets are represented as an <code>=</code> sign followed by two hex digits representing the octet's value. To represent a plain <code>=</code>, it needs to be represented using quoted-printable encoding too: <code>3D</code> are the hex digits corresponding to <code>=</code>'s A... | Meaning of 3D when used BEFORE a url not within one | html|3d | 0 | 43 | 1 | 72,942,714 | 72,942,714 | 2 | true | 2022-07-11T17:40:17.133Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Meaning of 3D when used BEFORE a url not within one<p>I have this piece of html from wikipedia.</p>
<pre><code><a href=3D"https://en.wikipedia.org/wi... |
73,002,567 | Jquery inside observeEvents<p>I am trying to use Jquery inside observeevent but not able to execute it.
The moment I click on "Release" button , the side bar should open. I have a Jquery here but not working. But when I put the same jquery inside onclick method, it works. But not in this method</p>
<pre><code... | <h4>Using Shiny</h4>
<p>Shiny ships with some jQuery/Bootstrap functions built in for convenience, <code>toggleClass</code> being one of them. To use it, move <code>useShinyjs()</code> somewhere into or after the <code>dashboardBody</code> (don't forget the comma), and replace your jQuery code with a call to <code>togg... | Jquery inside observeEvents | jquery|r|shiny | 1 | 43 | 1 | 73,002,845 | 73,002,845 | 2 | true | 2022-07-16T08:02:19.753Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Jquery inside observeEvents<p>I am trying to use Jquery inside observeevent but not able to execute it.
The moment I click on "Release" button , th... |
72,878,820 | Merge nested Array with same key javascript<p>I have to organise the array, Getting a response array like this</p>
<pre><code>let data = [
{
date: "2022-07-01T07:26:22",
tips: [
{ id: 1 }
]
},
{
date: "2022-07-01T12:05:55",
tips: [
... | <p>Here is a solution using <code>reduce</code>. Grouping first using <code>reduce</code> and after that getting the values of the object using <code>Object.values</code></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-c... | Merge nested Array with same key javascript | javascript|arrays | -3 | 43 | 1 | 72,879,165 | 72,879,165 | 2 | true | 2022-07-06T06:30:11.593Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Merge nested Array with same key javascript<p>I have to organise the array, Getting a response array like this</p>
<pre><code>let data = [
{
date... |
72,981,330 | Creating your own "view" without auxiliary tags - ODOO<p>I have a question - is it possible to make my own view without using auxiliary tags?
For example, I want to make my own table (or multiple tables on the same page)
Is it possible to implement this without using the "tree" tag?</p> | <p>Yes you can, The Odoo team talked about it in one of their livestreams.</p>
<p>You basically inherit the ir.ui.view model<br />
and under /static/src/js you define the view like:</p>
<pre><code>odoo.define('hello_world_view.HelloWorldView', function (require) {
"use strict";
var HelloWorldRenderer = Abstr... | Creating your own "view" without auxiliary tags - ODOO | javascript|python|xml|odoo|erp | 0 | 43 | 1 | 72,981,925 | 72,981,925 | 2 | true | 2022-07-14T13:27:38.447Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating your own "view" without auxiliary tags - ODOO<p>I have a question - is it possible to make my own view without using auxiliary tags?
For example, I ... |
72,798,814 | How to append deleted from array elements by slice method?<p>How to delete elements from start of array and append them into end ?
<a href="https://i.stack.imgur.com/UBRyA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UBRyA.png" alt="enter image description here" /></a></p>
<pre><code> const Image... | <p>With x being the index clicked :</p>
<pre><code>const arr = [0,1,2,3,4];
const newArr = [...arr.slice(1), ...arr.slice(0, 1)]
</code></pre> | How to append deleted from array elements by slice method? | javascript|reactjs|typescript | 1 | 43 | 5 | 72,798,897 | 72,798,897 | 2 | true | 2022-06-29T09:14:16.153Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to append deleted from array elements by slice method?<p>How to delete elements from start of array and append them into end ?
<a href="https://i.stack.i... |
72,988,514 | extract until next "_" if contains<p>Is there a way to extract part of string, when there is a match (everything up to the next underscore) "_"?</p>
<p>From: <code>mycampaign_s22uhd4k_otherinfo</code> I need: <code>s22uhd4k</code>.<br />
From: <code>my_campaign_otherinfo_s22jumpto_otherinfo</code> , I would... | <p>Thanks Omar, based on your update/comment, this regex will solve your problem:</p>
<pre class="lang-r prettyprint-override"><code>df <- structure(list(a = c("mycampaign_s22uhd4k_otherinfo",
"my_campaign_otherinfo_s22jumpto_otherinfo",
"... | extract until next "_" if contains | r|gsub | 2 | 43 | 1 | 72,988,624 | 72,988,624 | 2 | true | 2022-07-15T02:38:51.133Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
extract until next "_" if contains<p>Is there a way to extract part of string, when there is a match (everything up to the next underscore) "_"?</p... |
72,923,904 | Regex for valid directory path<p>I'm trying to create regex to check against a valid directory prefix, where directory names must not be empty, and can contain any alphabet characters [a-zA-Z] and any numbers [0-9]. They can also contain dashes (-) and underscores (_) but no other special characters. A directory prefix... | <p>I propose <a href="https://regex101.com/r/dQ328B/1" rel="nofollow noreferrer"><code>^((/[a-zA-Z0-9-_]+)+|/)$</code></a>. Explanation:</p>
<ul>
<li><code>^</code> and <code>$</code>: Match the entire string/line</li>
<li><code>(/[a-zA-Z0-9-_]+)+</code>: One or more directories, starting with slash, separated by slash... | Regex for valid directory path | regex | 1 | 43 | 1 | 72,923,964 | 72,923,964 | 2 | true | 2022-07-09T18:55:43.923Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex for valid directory path<p>I'm trying to create regex to check against a valid directory prefix, where directory names must not be empty, and can conta... |
72,843,610 | How to looping XWPFTableRow .copy without duplicate<p>I have an algorithm structure like this. How do I prevent my loop data from being duplicated? I'm using <a href="/questions/tagged/apache-poi" class="post-tag" title="show questions tagged 'apache-poi'" rel="tag">apache-poi</a> 3.8.</p>
<pre><code>XWPFTable ... | <p>After <code>XWPFTableRow copiedRow = new XWPFTableRow((CTRow) getRow1.getCtRow().copy(), table);</code> your <code>copiedRow</code> will be a new row pointing to a copy of the underlying <code>CTRow</code> of the <code>getRow1</code>.</p>
<p>Then with <code>copiedRow.getCell(2).setText</code> you are changing XML co... | How to looping XWPFTableRow .copy without duplicate | java|foreach|apache-poi | 1 | 43 | 1 | 72,844,208 | 72,844,208 | 2 | true | 2022-07-03T02:37:54.923Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to looping XWPFTableRow .copy without duplicate<p>I have an algorithm structure like this. How do I prevent my loop data from being duplicated? I'm using... |
72,907,687 | Problems with understanding this use of lambda with max<p>I am currently trying to learn more about lambda functions and ran into the following string of code:</p>
<p><code>max_val = max(list_val, key = lambda i: (isinstance(i, int), i))</code></p>
<p>What does this part in the code actually mean/do:</p>
<p><code>(isin... | <p>The function returned by the following <code>lambda</code> expression:</p>
<pre><code>lambda i: (isinstance(i, int), i)
</code></pre>
<p>is the same as the function that is assigned to <code>f</code> by the following <code>def</code> statement:</p>
<pre><code>def f(i):
return (isinstance(i, int), i)
</code></pre... | Problems with understanding this use of lambda with max | python|lambda|max | 0 | 43 | 2 | 72,907,750 | 72,907,750 | 2 | true | 2022-07-08T06:52:10.823Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Problems with understanding this use of lambda with max<p>I am currently trying to learn more about lambda functions and ran into the following string of cod... |
73,016,978 | how to filter a dataframe column based on intersected values from another column in dataframe<p>I have two dataframe. I want to filter gene ID from expr_df dataframe based on the intersected values from another data frame gene_Annot.Basically i want to keep genes in expr_df that intersects with geneid from gene_Annot d... | <p>The code you provided should work. However, the use of <code>intersect()</code> is superfluous. You should just remove that. Also <code>dplyr::one_of()</code> has been superseded and instead you should use <code>dplyr::any_of()</code>.</p>
<pre class="lang-r prettyprint-override"><code>library(tidyverse)
d1 <- t... | how to filter a dataframe column based on intersected values from another column in dataframe | r|select|expression|intersect | -2 | 43 | 1 | 73,017,368 | 73,017,368 | 2 | true | 2022-07-18T03:18:08.057Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to filter a dataframe column based on intersected values from another column in dataframe<p>I have two dataframe. I want to filter gene ID from expr_df d... |
72,899,184 | R: Extracting After First Space<p>I am working with the R programming language. I found this question over here that extracts everything from the RIGHT of the first space:</p>
<pre><code>#https://stackoverflow.com/questions/15895050/using-gsub-to-extract-character-string-before-white-space-in-r
dob <- c("9/9/4... | <p>Do you mean the following?</p>
<pre class="lang-r prettyprint-override"><code>dob <- c("9/9/43 12:00 AM/PM", "9/17/88 12:00 AM/PM", "11/21/48 12:00 AM/PM", "red1 23 g")
gsub("^\\S+ ", "", dob)
#> [1] "12:00 AM/PM" "12:00 AM/PM" &... | R: Extracting After First Space | r|string | 0 | 43 | 2 | 72,899,298 | 72,899,298 | 2 | true | 2022-07-07T14:00:02.773Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R: Extracting After First Space<p>I am working with the R programming language. I found this question over here that extracts everything from the RIGHT of th... |
72,913,403 | Randomize and Sample using SQL in Excel VBA<p>I am using VBA for Excel and I have a workbook with a few tabs. I would like to randomize and pull a sample from each tab. An example of the code is below</p>
<pre><code> sql = "SELECT TOP " & myNum & " * " & _
"FROM [Annual$] ORDER... | <p>Apparently there must be some bug in the sql engine in use under the hood that adding that <code>ORDER BY</code> causes <code>TOP</code> to be ignored. Breaking the logic of the sql down to do the <code>ORDER BY</code> in a subquery and the <code>TOP</code> in the outside query appears to circumvent this bug:</p>
<p... | Randomize and Sample using SQL in Excel VBA | sql|excel|vba|sampling | 2 | 43 | 1 | 72,913,899 | 72,913,899 | 2 | true | 2022-07-08T15:05:10.067Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Randomize and Sample using SQL in Excel VBA<p>I am using VBA for Excel and I have a workbook with a few tabs. I would like to randomize and pull a sample fro... |
72,833,972 | PySpark string to timestamp conversion<p>How can I convert timestamp as string to timestamp in "yyyy-mm-ddThh:mm:ss.sssZ" format using PySpark?</p>
<p>Input timestamp (string), df:</p>
<pre class="lang-none prettyprint-override"><code>| col_string |
| :-------------------- |
| 5/15/2022 2:11:06 AM ... | <p><a href="https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.to_timestamp.html#pyspark.sql.functions.to_timestamp" rel="nofollow noreferrer"><code>to_timestamp</code></a> can be used providing the optional <code>format</code> parameter.</p>
<pre class="lang-py prettyprint-... | PySpark string to timestamp conversion | string|apache-spark|pyspark|timestamp|type-conversion | 0 | 43 | 1 | 72,834,096 | 72,834,096 | 2 | true | 2022-07-01T19:41:33.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PySpark string to timestamp conversion<p>How can I convert timestamp as string to timestamp in "yyyy-mm-ddThh:mm:ss.sssZ" format using PySpark?</p>... |
72,864,584 | change css of one div by hovering on another div<p>I have two containers with text. I want to increase the text size of one of the texts by hovering on the other by only using CSS. The method I saw on a different SO post is not working for me. What is the right way to do this? Thanks in advance.</p>
<p><div class="snip... | <p>I have a sample which changes the CSS of the other element.</p>
<p>Unfortunately, the CSS <code>:hover</code> pseudo class, as well as CSS selectors make remote controlling other elements tricky, so you will have to use JavaScript.</p>
<p>In this case, hovering over one <code>div</code> triggers the <code>mouseover<... | change css of one div by hovering on another div | css | 0 | 43 | 2 | 72,864,742 | 72,864,742 | 2 | true | 2022-07-05T05:57:10.603Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
change css of one div by hovering on another div<p>I have two containers with text. I want to increase the text size of one of the texts by hovering on the o... |
72,802,415 | Define a template function according to class member variable with typetraits<p>I'm having some difficulties understanding a piece of code that is using typetraits.</p>
<p>Suppose I want to define a template function that works on some classes that has a member variable <code>k</code> of type <code>uint32_t</code>. (Ot... | <blockquote>
<p>(Why) do we need the std::uint32_t as input argument of has_member_k? I guess it relates to the type of k but I am not sure how.</p>
</blockquote>
<p>Its a trick to be able to call either <code>has_member_k(std::uint32_t)</code> or <code>has_member_k(...)</code> (in case <code>enable_if</code> discards ... | Define a template function according to class member variable with typetraits | c++|typetraits | 0 | 43 | 1 | 72,802,534 | 72,802,534 | 2 | true | 2022-06-29T13:39:39.547Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Define a template function according to class member variable with typetraits<p>I'm having some difficulties understanding a piece of code that is using type... |
72,912,871 | Python - Filter and Lambda Beginner Question<p>I'm learning Python through Colt Steele Modern Python Bootcamp.
I'm now on filter section and I'm having trouble understanding this or I guess I have a trouble understanding lists and dictionaries.</p>
<p>In video it shows a list of dictionaries</p>
<pre><code>users = [
{&... | <p>The correct way would be:</p>
<pre><code>inaktiv = []
for u in users:
if len(u["tweets"]) == 0:
inaktiv.append(u)
</code></pre>
<p>If you come, for example, from a C background and you're very used to for cycles with indexes to access array elements, then you will probably find this solution a ... | Python - Filter and Lambda Beginner Question | python|dictionary|for-loop|lambda | 0 | 43 | 3 | 72,912,936 | 72,912,936 | 2 | true | 2022-07-08T14:24:11.943Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python - Filter and Lambda Beginner Question<p>I'm learning Python through Colt Steele Modern Python Bootcamp.
I'm now on filter section and I'm having troub... |
72,925,729 | Convert jQuery statement to javascript<p>How can I convert the following statement from jQuery to javascript?</p>
<pre><code>$("#tool_container .tool_wrap div").click(function () {
</code></pre>
<p>I tried:</p>
<pre><code>document.querySelector("#tool_container .tool_wrap div").addEventListener(&qu... | <p><code>querySelectorAll()</code> returns a list, you have to iterate over it.</p>
<pre><code>document.querySelectorAll("#tool_container .tool_wrap div").forEach(
div => div.addEventListener("click", function(evt) { ... })
);
</code></pre> | Convert jQuery statement to javascript | javascript|jquery | -3 | 43 | 1 | 72,925,743 | 72,925,743 | 2 | true | 2022-07-10T02:08:56.060Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert jQuery statement to javascript<p>How can I convert the following statement from jQuery to javascript?</p>
<pre><code>$("#tool_container .tool_wr... |
72,884,433 | Java Streams - How to preserve the initial Order of elements while using Collector groupingBy()<p>I'm trying to convert a <em>list</em> of objects into a <em>list of lists</em> of objects, i.e. <code>List<T></code> into <code>List<List<T>></code> and group them by a <em>list of strings</em> used as so... | <blockquote>
<p><code>groupingBy()</code>, the return value is a map and that map output a different order of values list</p>
</blockquote>
<p>You can use another flavor of <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/stream/Collectors.html#groupingBy(java.util.function.Function,java.... | Java Streams - How to preserve the initial Order of elements while using Collector groupingBy() | java|hashmap|java-stream|collectors | 1 | 43 | 1 | 72,884,504 | 72,884,504 | 2 | true | 2022-07-06T13:29:03.080Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java Streams - How to preserve the initial Order of elements while using Collector groupingBy()<p>I'm trying to convert a <em>list</em> of objects into a <em... |
72,772,822 | Use JsonProperty if it exists otherwise use camelcase<p>I have the following class:</p>
<pre><code>public sealed class CRMUser
{
/// The display name.
/// </value>
[JsonProperty("name")]
public string DisplayName { get; set; }
[JsonProperty("email")]
public string Emai... | <p>To tell Json.Net to use camel casing by default, you have to provide that option when creating the <code>DefaultContractResolver</code>:</p>
<pre><code>DefaultContractResolver contractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy()
};
</code></pre>
<p>The <a href="https://... | Use JsonProperty if it exists otherwise use camelcase | c#|json|json-serialization | 2 | 43 | 1 | 72,774,067 | 72,774,067 | 3 | true | 2022-06-27T13:20:14.413Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use JsonProperty if it exists otherwise use camelcase<p>I have the following class:</p>
<pre><code>public sealed class CRMUser
{
/// The display name.
... |
72,778,259 | How can I check if all panels of a playing board were visited by the player?<p>I am working on an exercise from Mooc.fi's java part 2, week 10. It is called Dungeon.
Basically you have a playing board(created with a String[][] array) and a player that moves on it. The size of the board(lenght and height) can be set whe... | <p>You can either create a custom class or create another array to capture the information, like</p>
<pre><code>public class BoardTile {
String info;
boolean visited;
}
</code></pre>
<p>And then use a <code>BoardTile[][]</code> instead of a <code>String[][]</code></p>
<p>Alternatively, you could create a separate 2... | How can I check if all panels of a playing board were visited by the player? | java | 0 | 43 | 2 | 72,778,322 | 72,778,322 | 3 | true | 2022-06-27T21:01:14.743Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I check if all panels of a playing board were visited by the player?<p>I am working on an exercise from Mooc.fi's java part 2, week 10. It is called ... |
72,811,408 | Replace part of string between two spaces<p>I have some string in this format XX XXXX XX XXX. How I can, using javascript, replace the part of string which is between first and second space to get this kind of output string XX YYYY XX XXX?</p> | <p>You could try doing a regex replacement with <code>replace()</code>, in non global mode, which would therefore target just the first match in the input string.</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 l... | Replace part of string between two spaces | javascript | -1 | 43 | 4 | 72,811,435 | 72,811,435 | 3 | true | 2022-06-30T06:51:32.543Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replace part of string between two spaces<p>I have some string in this format XX XXXX XX XXX. How I can, using javascript, replace the part of string which i... |
72,824,867 | Is pushing an object to an array async operation?<p>I was doing one problem-solving program where I had to find all the pairs from an array that adds up to a target (classic two-sum program just with a little addition). This was my first approach:</p>
<pre><code>let findPair = (arr, target) => {
let res = [];
... | <p>In your first version, you just have <em>one</em> <code>obj</code>:</p>
<pre><code>let obj = {
first: 0,
second: 0
}
</code></pre>
<p>The loop then <em>mutates</em> that <em>same</em> object, and pushes it unto the array. This means the array gets multiple references to the <em>same</em> object. Even when th... | Is pushing an object to an array async operation? | javascript|node.js|arrays|object|javascript-objects | 0 | 43 | 2 | 72,824,892 | 72,824,892 | 3 | true | 2022-07-01T05:44:24.873Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is pushing an object to an array async operation?<p>I was doing one problem-solving program where I had to find all the pairs from an array that adds up to a... |
72,826,946 | How to create a parent directory with multiple subdirectories which has nested subdirectories within the respective subdirectories<p>I'm new to shell scripting. I'm trying to create a main folder called Analysis. In the <strong>Analysis</strong> folder I would like four sub-folders named, <strong>PhenV1</strong>, <stro... | <pre><code>mkdir -p Analysis/{PhenV1,Phenv2,HypV1,HypV2}/{Genes,Variants}/{CNV,SNV}
</code></pre>
<p>Creates:</p>
<pre><code>$ tree
.
└── Analysis
├── HypV1
│ ├── Genes
│ │ ├── CNV
│ │ └── SNV
│ └── Variants
│ ├── CNV
│ └── SNV
├── HypV2
│ ├── Genes
│ ... | How to create a parent directory with multiple subdirectories which has nested subdirectories within the respective subdirectories | linux|bash|directory|subdirectory|mkdir | -1 | 43 | 2 | 72,827,138 | 72,827,138 | 3 | true | 2022-07-01T09:09:59.293Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create a parent directory with multiple subdirectories which has nested subdirectories within the respective subdirectories<p>I'm new to shell scripti... |
72,837,147 | Sequentially Replacing Factor Variables with Numerical Values<p>I have this dataset:</p>
<pre><code>col_1 = as.factor(c("a", "a", "b", "c", "b", "a"))
col_2 = c(15, 346, 3564, 99, 10, 2)
col_3 = as.factor(c("bb", "a", "g", "f... | <p>in Base R</p>
<pre><code>indx <- vapply(sample_data, is.factor, logical(1))
vec <- interaction(stack(type.convert(sample_data[,indx], as.is = TRUE)))
sample_data[indx] <- match(vec, unique(vec))
sample_data
index col_1 col_2 col_3
1 1 1 15 4
2 2 1 346 5
3 3 2 3564 ... | Sequentially Replacing Factor Variables with Numerical Values | r|data-manipulation | 1 | 43 | 1 | 72,837,346 | 72,837,346 | 3 | true | 2022-07-02T07:07:06.677Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sequentially Replacing Factor Variables with Numerical Values<p>I have this dataset:</p>
<pre><code>col_1 = as.factor(c("a", "a", "b... |
72,845,147 | How to run tox without internet connection?<p>When I try to run tox without an internet connection it prints the following error message:</p>
<pre><code>py3 inst-nodeps: mypackage/.tox/.tmp/package/1/mypackage-0.1.1.dev0.tar.gz
ERROR: invocation failed (exit code 1), logfile: mypackage/.tox/py3/log/py3-12.log
=========... | <p>You need to <a href="https://stackoverflow.com/a/14447068/7976758">pre-download dependencies</a> and install them offline. In tox.ini use <a href="https://tox.wiki/en/latest/config.html#conf-install_command" rel="nofollow noreferrer"><code>install_command</code></a>. Something like</p>
<pre><code>[testenv]
install_c... | How to run tox without internet connection? | python|tox | 2 | 43 | 1 | 72,845,990 | 72,845,990 | 3 | true | 2022-07-03T08:53:25.057Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to run tox without internet connection?<p>When I try to run tox without an internet connection it prints the following error message:</p>
<pre><code>py3 ... |
72,847,951 | Why do i add #4 to a regsiter to have the next iteration?<p>in school we are learning assembly. I tried to study this code</p>
<pre><code>RES: .word 0
N: .word 5
NUM1: .word 3, -17, 27, -12, 322
LDR r1, N
ADR r2, NUM1
MOV r0, #0
LOOP: LDR r3, [r2]
ADD r0, r0, r3
ADD r2, r... | <p>ARM systems, like most today, are byte addressable. A 32-bit integer stored in memory occupies 4 bytes. Each of those 4 bytes has its own byte address. Thus, in an array of integers, the first integer is at <code>NUM1</code> and the second is at <code>NUM1</code>+4. We refer to multi-byte items by just one addre... | Why do i add #4 to a regsiter to have the next iteration? | assembly|arm | -1 | 43 | 1 | 72,848,025 | 72,848,025 | 3 | true | 2022-07-03T15:54:30.857Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why do i add #4 to a regsiter to have the next iteration?<p>in school we are learning assembly. I tried to study this code</p>
<pre><code>RES: .word 0
... |
72,848,095 | WPF - GridRows Spacing Confusion<p>I have an <code>Expander</code> control, and the grid inside will have a <code>ListBox</code> with a <code>Label</code> on top of it saying 'Video Sources'. I am attempting to use Grid Row Definitions to achieve this. My issue however is that the grid rows separate everything evenly. ... | <p>You have to set the rows height ; to <code>auto</code> (ie: minimal value) and <code>*</code> (ie: remaining space).<br />
Also only two rows definition are needed.</p>
<pre class="lang-xml prettyprint-override"><code><Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" ... | WPF - GridRows Spacing Confusion | c#|wpf | 1 | 43 | 1 | 72,848,186 | 72,848,186 | 3 | true | 2022-07-03T16:13:30.410Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
WPF - GridRows Spacing Confusion<p>I have an <code>Expander</code> control, and the grid inside will have a <code>ListBox</code> with a <code>Label</code> on... |
72,876,425 | How to Pass Variables to Javascript from C# using Invoke?<pre><code>private void WebBrowser_Clicked(object sender, RoutedEventArgs e)
{
wb.Navigate("C:/Users/intern3/source/repos/MarketingProject/Samples/WPF/RESTToolkitTestApp/index.htm");
wb.InvokeScript("SetCoords", new object[] { coord1, co... | <p>It takes some time until the <code>WebBrowser</code> control has loaded the page so that it knows the Javascript function. Instead of calling the function directly after the load, use a handler for the <code>LoadCompleted</code> event to run the function, e.g.:</p>
<pre><code>public MyForm() // This is the construct... | How to Pass Variables to Javascript from C# using Invoke? | javascript|c#|parameter-passing|webbrowser-control | 1 | 43 | 1 | 72,879,424 | 72,879,424 | 3 | true | 2022-07-05T23:16:07.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to Pass Variables to Javascript from C# using Invoke?<pre><code>private void WebBrowser_Clicked(object sender, RoutedEventArgs e)
{
wb.Navigate("C... |
72,890,921 | SwiftUI: Generic parameter 'Value' could not be inferred<p>Following codes gives an error of "Generic parameter 'Value' could not be inferred".</p>
<p>Appreciate anyone could point out the root cause and let me know how to fix it.</p>
<p>Thanks</p>
<pre class="lang-swift prettyprint-override"><code>
import Sw... | <p>Your <code>bottomMenu</code> function has an extra generic in its signature. Change it to:</p>
<pre><code>fileprivate func bottomMenu<Content>(
</code></pre>
<p>(Note that <code>Value</code> from your original, which is unused, is removed)</p> | SwiftUI: Generic parameter 'Value' could not be inferred | swiftui|viewbuilder | 0 | 43 | 1 | 72,890,957 | 72,890,957 | 3 | true | 2022-07-06T23:46:01.557Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SwiftUI: Generic parameter 'Value' could not be inferred<p>Following codes gives an error of "Generic parameter 'Value' could not be inferred".</p>... |
72,914,994 | Count number of users that purchased in certain stores at certain dates<p>I have two tables:</p>
<ul>
<li><p>"<code>purchases</code>" table has 3 columns: "<code>user_id</code>", "<code>store_id</code>", "<code>purchase_date</code>"
(so I can know that <code>client_id=XXX</code> ... | <p>Use 2 levels of aggregation:</p>
<pre><code>SELECT COUNT(*) count
FROM (
SELECT p.user_id
FROM purchases p INNER JOIN stores s
ON s.store_id = p.store_id
GROUP BY p.user_id
HAVING SUM(s.latitude BETWEEN 23 AND 50 AND s.longitude BETWEEN -127 AND -66 AND p.purchase_date BETWEEN '2022-05-01' AND '2022-05-31'... | Count number of users that purchased in certain stores at certain dates | mysql|sql|where-clause | 0 | 43 | 2 | 72,915,179 | 72,915,179 | 3 | true | 2022-07-08T17:30:53.730Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Count number of users that purchased in certain stores at certain dates<p>I have two tables:</p>
<ul>
<li><p>"<code>purchases</code>" table has 3 c... |
72,922,415 | sqlalchemy join on subquery with new API<p>I am not able to convert SQL statement into sqlalchemy orm. Issue is <strong>I cant join resulting <code>x</code> subquery with <code>FileTag</code> table</strong></p>
<p>I would like to use new API, that is, not using <code>query</code></p>
<p>SQL statement</p>
<pre><code> ... | <p>Declare <code>x</code> as a <code>.subquery()</code> and then give your <code>join</code> something to join onto:</p>
<pre class="lang-py prettyprint-override"><code>from sqlalchemy import Column, func, Integer, select, String
from sqlalchemy.orm import declarative_base
Base = declarative_base()
class FileTag(Bas... | sqlalchemy join on subquery with new API | python|sql|join|sqlalchemy|orm | 1 | 43 | 1 | 72,922,562 | 72,922,562 | 3 | true | 2022-07-09T14:59:31.147Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
sqlalchemy join on subquery with new API<p>I am not able to convert SQL statement into sqlalchemy orm. Issue is <strong>I cant join resulting <code>x</code> ... |
72,929,810 | Manipulate string values in pandas<p>I have a pandas dataframe with different formats for one column like this</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Name</th>
<th>Values</th>
</tr>
</thead>
<tbody>
<tr>
<td>First</td>
<td>5-9</td>
</tr>
<tr>
<td>Second</td>
<td>7</td>
</tr>
<tr>
<... | <p>Let us <code>split</code> and <code>expand</code> the column then cast values to <code>float</code> and calculate <code>mean</code> along column axis:</p>
<pre><code>s = df['Values'].str.split('-', expand=True)
df['Values'] = s[s != ''].astype(float).mean(1).fillna(0)
</code></pre>
<hr />
<pre><code> Name Value... | Manipulate string values in pandas | python|pandas | 2 | 43 | 2 | 72,929,867 | 72,929,867 | 3 | true | 2022-07-10T15:49:01.413Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Manipulate string values in pandas<p>I have a pandas dataframe with different formats for one column like this</p>
<div class="s-table-container">
<table cla... |
72,923,543 | Deploying Python Script as Cloud Function with access to Cloud Firestore<p>I'm trying to deploy a Python project as a Google Cloud Function.</p>
<p>I found this <a href="https://www.youtube.com/watch?v=SHrR2fFVDO4&list=WL&index=183&t=363s" rel="nofollow noreferrer">Tutorial</a>.</p>
<p>Where basically you j... | <p>Check the <a href="https://firebase.google.com/docs/admin/setup#initialize-sdk" rel="nofollow noreferrer">docs</a>. The SDK can also be initialized with no parameters. In this case, the SDK uses Google Application Default Credentials. Because default credentials lookup is fully automated in Google environments, with... | Deploying Python Script as Cloud Function with access to Cloud Firestore | python|firebase|google-cloud-firestore|google-cloud-functions | 1 | 43 | 1 | 72,935,270 | 72,935,270 | 3 | true | 2022-07-09T17:51:40.630Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Deploying Python Script as Cloud Function with access to Cloud Firestore<p>I'm trying to deploy a Python project as a Google Cloud Function.</p>
<p>I found t... |
72,947,930 | How can I color one specific regression line among many in ggplot to match annotation?<p>I'm pretty aware of how to color a bunch of regression lines at once as well as faceting the color by groups. My main issue is coloring a specific regression among many faceted regression lines, akin to something like below:</p>
<p... | <p>There is of course the <code>gghighlight</code> package. But using "just" <code>ggplot2</code> you could map a condition on the <code>color</code> aes, e.g. <code>Month_Name == "January"</code> and set your desired colors via <code>scale_color_manual</code>. Additionally you have to explicitly ma... | How can I color one specific regression line among many in ggplot to match annotation? | r|ggplot2|regression|geom-point | 1 | 43 | 2 | 72,948,053 | 72,948,053 | 3 | true | 2022-07-12T06:31:43.323Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I color one specific regression line among many in ggplot to match annotation?<p>I'm pretty aware of how to color a bunch of regression lines at once... |
72,952,595 | Plotting Automata Grid Iterations in R<p>I am an experienced R programmer, but beginner with programming automata scripts (in fact I just learned about them recently). I've produced a script that calculates (based on some minimal rules from the wikipedia page on Conway's game of life) the grid-like position for any giv... | <p>An obvious choice would be to use gganimate to animate a geom_tile of your grid. The easiest way to do this is to store each iteration of <code>grid</code> in a list.</p>
<p>For example, if you create an empty list called <code>result_list</code> before your line <code>for(cycle in 1:5)</code>, then make the final l... | Plotting Automata Grid Iterations in R | r|plot|automata | 1 | 43 | 1 | 72,952,965 | 72,952,965 | 3 | true | 2022-07-12T12:48:04.080Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Plotting Automata Grid Iterations in R<p>I am an experienced R programmer, but beginner with programming automata scripts (in fact I just learned about them ... |
73,017,953 | Log in for Google sheets for every member<p>Is it possible that we can create a log in panel on google sheets which can be access by only shared person once they log in and after that they get the only tab which is shared with them instead of whole google spreadsheet
I heard it is possible but haven't seen somewhere ..... | <p>You could create a log sheet <em>"which can be access by only shared person once..."</em> and could <strong>then</strong> share by user.</p>
<p>Still.<br />
It would not really serve your purpose since <strong>anyone with editor privileges</strong> will always have access to the history of the whole sheet ... | Log in for Google sheets for every member | google-sheets | 1 | 43 | 1 | 73,018,174 | 73,018,174 | 3 | true | 2022-07-18T06:10:52.700Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Log in for Google sheets for every member<p>Is it possible that we can create a log in panel on google sheets which can be access by only shared person once ... |
73,031,265 | Why can't I access tkinter objects after importing tkinter as something?<p>I'm following a simple tutorial, learning about the tkinter library. In the tutorial, they do this:</p>
<pre><code> from tkinter import *
from tkinter import ttk
</code></pre>
<p>I was told the above is not good practice so instead I did:</p>
<... | <p><code>ttk</code> is not a part of the <code>tkinter</code> module, it is a different file in the tkinter.</p>
<p>In order to import <code>ttk</code> you have to do this</p>
<pre class="lang-py prettyprint-override"><code>import tkinter.ttk as tkk
</code></pre> | Why can't I access tkinter objects after importing tkinter as something? | python|object|tkinter|python-import | 0 | 43 | 1 | 73,031,330 | 73,031,330 | 3 | true | 2022-07-19T04:49:22.480Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why can't I access tkinter objects after importing tkinter as something?<p>I'm following a simple tutorial, learning about the tkinter library. In the tutori... |
72,794,269 | How to create a variable with the last date available<p>Here is a representation of my dataset</p>
<pre><code>ID<-1:5
Date1<-c(NA,NA,"2022-06-10",NA,NA)
Date2<-c(NA,NA,NA,NA,NA)
Date3<-c("2022-02-08",NA,NA,NA,NA)
Date4<-c(NA,NA,"2022-06-24",NA,"2022-05-13")
mydata... | <p>We may use <code>coalesce</code></p>
<pre><code>library(dplyr)
mydata %>%
mutate(last_date = coalesce(Date4, Date3, Date2, Date1))
</code></pre>
<p>-output</p>
<pre><code>ID Date1 Date2 Date3 Date4 last_date
1 1 <NA> NA 2022-02-08 <NA> 2022-02-08
2 2 <NA&... | How to create a variable with the last date available | r | 2 | 43 | 2 | 72,794,277 | 72,794,277 | 3 | true | 2022-06-28T23:41:10.717Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create a variable with the last date available<p>Here is a representation of my dataset</p>
<pre><code>ID<-1:5
Date1<-c(NA,NA,"2022-06-10&q... |
72,872,209 | Creating a row that aggregates the data for that day<p>I've got a dataframe of the following pattern:</p>
<pre><code>Date Item Purchased
01/01/08 Fruit 48
01/01/08 Confectionary 42
01/01/08 Appliance 11
01/06/08 Confectionary 16
01/06/08 Fruit 19
01/06/08 Appl... | <p>We can use <code>adorn_totals</code> from <code>janitor</code> after grouping by 'Date' which add a new row with the sum from the numeric column</p>
<pre><code>library(dplyr)
library(janitor)
df1 %>%
group_by(Date) %>%
group_modify(~ adorn_totals(.x, name = "Overall")) %>%
ungroup
</co... | Creating a row that aggregates the data for that day | r|dataframe | 3 | 43 | 4 | 72,872,233 | 72,872,233 | 3 | true | 2022-07-05T15:45:27.127Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating a row that aggregates the data for that day<p>I've got a dataframe of the following pattern:</p>
<pre><code>Date Item Purchased
01/01... |
72,896,689 | Combine two graphs from two datasets in one ggplot<p>I want two combine a boxplot and a barplot in one graph with two y-axes. They should match on the name of the x-axis. In the code I provide the code and the data for each plot.</p>
<p>Plot 1:</p>
<pre><code>ggplot(F3a, aes(x= name, fill = name, y = value))+
geom_bo... | <p><strong>Edit</strong>: the first answer (using <code>patchwork</code>) is preserved below.</p>
<hr />
<p>First, you have a <code>name</code> that is different between them.</p>
<pre class="lang-r prettyprint-override"><code>setdiff(F3a$name, F1a$name)
# [1] "Rückmeldungen zu \nfachlichen Anfragen beim\n DRK-Gen... | Combine two graphs from two datasets in one ggplot | r|ggplot2 | 2 | 43 | 1 | 72,896,807 | 72,896,807 | 3 | true | 2022-07-07T11:03:45.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Combine two graphs from two datasets in one ggplot<p>I want two combine a boxplot and a barplot in one graph with two y-axes. They should match on the name o... |
72,821,205 | How to hide secrete keys in apis<p>I wanna ask you how I gonna hide the secrete keys in API like database connection username, password or services API keys</p>
<p>When I deploy the application on virtual machine instance should I move them outside code like environment variables or I need to move them outside virtual ... | <p>There are already a number of discussions regarding storing secrets in environment variables (good to avoid committing them to version control - bad for a number of <a href="https://diogomonica.com/2017/03/27/why-you-shouldnt-use-env-variables-for-secret-data/" rel="nofollow noreferrer">reasons</a>). I'm not going t... | How to hide secrete keys in apis | api|rest|google-cloud-platform|cloud|backend | 0 | 43 | 1 | 72,821,464 | 72,821,464 | 3 | true | 2022-06-30T19:39:41.120Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to hide secrete keys in apis<p>I wanna ask you how I gonna hide the secrete keys in API like database connection username, password or services API keys<... |
72,912,106 | Bash script does not catch error status with `set -e`<p>Could someone explain please why the following simple script <strong>does not</strong> terminate on error status?</p>
<p>I would expect that <strong>false</strong> would return with error status and cause the script to stop as I use <code>set -e</code></p>
<pre cl... | <p>Your expectation is incorrect, and a big reason why <a href="http://mywiki.wooledge.org/BashFAQ/105" rel="nofollow noreferrer"><code>set -e</code> isn't really recommended</a>. There is a <em>long</em> list of exceptions (including <code>&&</code>) to the rule that <code>set -e</code> exits on a non-zero exi... | Bash script does not catch error status with `set -e` | linux|bash|shell | 0 | 43 | 1 | 72,912,372 | 72,912,372 | 3 | true | 2022-07-08T13:25:28.307Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bash script does not catch error status with `set -e`<p>Could someone explain please why the following simple script <strong>does not</strong> terminate on e... |
72,793,595 | Converting all nan values to zero in tensforflow<p>I am trying to convert all <code>nan</code> values to zero in my final results. I am not able to execute it properly!</p>
<p>The following is the code: also availvable on colab : <a href="https://colab.research.google.com/drive/194wjDGeaqnkpPnTtH8Sx_NyBtth5rUkX?usp=sha... | <p>Change:</p>
<pre><code>out.numpy()[(tf.math.is_nan(out).numpy())] = 0
</code></pre>
<p>To:</p>
<pre><code>out = tf.where(tf.math.is_nan(out), 0., out)
</code></pre> | Converting all nan values to zero in tensforflow | python|tensorflow | 0 | 43 | 1 | 72,793,804 | 72,793,804 | 4 | true | 2022-06-28T22:01:21.873Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Converting all nan values to zero in tensforflow<p>I am trying to convert all <code>nan</code> values to zero in my final results. I am not able to execute i... |
72,855,714 | pass memory stream to another class how to close it<p>I have a separate class to create CSV file and add it to memory stream and a separate class to send the file(upload it to the cloud storage)
I did this separation because these are two different jobs, here is the class im creating memory stream:</p>
<pre><code>publi... | <p>Using in the class that uses it</p>
<pre><code>using(var memoryStream = this.convertToCsv.ExecuteUseCase(file)){
await blobClient.UploadAsync(memoryStream, true);
}
</code></pre> | pass memory stream to another class how to close it | c# | 1 | 43 | 1 | 72,855,785 | 72,855,785 | 4 | true | 2022-07-04T11:03:52.327Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pass memory stream to another class how to close it<p>I have a separate class to create CSV file and add it to memory stream and a separate class to send the... |
72,911,150 | How to update a file using a CURSOR in SQLRPGLE<p>Can someone tell me how to update a data using the CURSOR in sqlrpgle.Is there a way updating data just by using CURSOR rather than using the Update statement in SQLRPGLE?</p> | <p>What update statement do you refer to ? UPDATE rpg order or UPDATE SQL ?</p>
<p>With UPDATE SQL :</p>
<pre><code> Exec SQL declare c1 cursor for
SELECT *
FROM xxxx ..
for update ;
</code></pre>
<p>fetch the records as usual , and before each fetch :</p>
<pre><code> exec sql
update xxxxx ... | How to update a file using a CURSOR in SQLRPGLE | ibm-midrange|rpgle|rpg | -2 | 43 | 1 | 72,911,876 | 72,911,876 | 4 | true | 2022-07-08T12:06:46.510Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to update a file using a CURSOR in SQLRPGLE<p>Can someone tell me how to update a data using the CURSOR in sqlrpgle.Is there a way updating data just by ... |
72,917,172 | What is terraform's init.tf for?<p>I'm relatively new to Terraform My current $employer uses Terraform and we have <code>init.tf</code> files in each project.</p>
<p>It has:</p>
<ul>
<li>a <code>terraform</code> block,</li>
<li><code>provider</code> blocks,</li>
<li><code>data terraform_remote_state</code> blocks</li>
... | <p>It is more likely that the person who named it as <code>init.tf</code> wants to convey a message that it is required to initialize terraform.</p>
<p>you can continue to work by run the commands - <code>terraform init, terraform plan</code> etc.</p>
<p>The norm is to name the file as <code>provider.tf</code>, althoug... | What is terraform's init.tf for? | terraform | -3 | 43 | 1 | 72,917,564 | 72,917,564 | 4 | true | 2022-07-08T21:29:08.930Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is terraform's init.tf for?<p>I'm relatively new to Terraform My current $employer uses Terraform and we have <code>init.tf</code> files in each project... |
72,921,773 | Dropping temporary table in SQL Server 2012<p>I am using SQL Server 2012. When I want to create a temporary table named <code>#TBL1</code>, or rerun my code, I get this error:</p>
<blockquote>
<p>There is already an object named '#TBL1' in the database</p>
</blockquote>
<p>So I added this code to my query:</p>
<pre><co... | <p>You need to make sure OBJECT_ID looks in the right place. Temporary tables live in tempdb:</p>
<pre><code> IF OBJECT_ID('tempdb.dbo.#TBL1', 'U') IS NOT NULL
BEGIN
DROP TABLE dbo.#TBL;
END
</code></pre>
<p>Also seems there is a typo (#TBL1 vs. #TBL).</p>
<p>And while I am normally am a big fan of schema prefixe... | Dropping temporary table in SQL Server 2012 | sql-server | 0 | 43 | 1 | 72,921,874 | 72,921,874 | 4 | true | 2022-07-09T13:31:57.010Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dropping temporary table in SQL Server 2012<p>I am using SQL Server 2012. When I want to create a temporary table named <code>#TBL1</code>, or rerun my code,... |
72,933,971 | How to test a void method and assert its side affect in the file system<p>I have a void method that checks if a given path exists and if not creates it, it is contained in a FileServices class with an IFileServices corresponding interface</p>
<pre><code>public interface IFileServices{
void CreateFolder(string path);... | <p>Instead of creating the folder using <code>Directory</code> (and depending on it), you can validate if mock methods of <code>IDirectory</code> were invoked or not. If those are invoked then you would be covering the <code>CreateFolder</code> of <code>FileServices</code>. Use <code>Verify</code> of moq to validate th... | How to test a void method and assert its side affect in the file system | c#|nunit|moq | 0 | 43 | 1 | 72,934,118 | 72,934,118 | 4 | true | 2022-07-11T05:12:45.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to test a void method and assert its side affect in the file system<p>I have a void method that checks if a given path exists and if not creates it, it i... |
72,963,795 | How to return the input time as always 09:00:00 in Python<pre><code> def dailyChecksInputDates():
current_date = datetime.now()
weekday = current_date.strftime("%A")
if weekday.upper() == 'MONDAY':
return datetime.now() - timedelta(days=3)
else:
retur... | <p>Use <a href="https://docs.python.org/3/library/datetime.html#datetime.datetime.replace" rel="noreferrer">replace</a> of <code>datetime</code> module.</p>
<pre><code>current_date = datetime.now().replace(hour=9, minute=0, second=0)
</code></pre> | How to return the input time as always 09:00:00 in Python | python | -1 | 43 | 2 | 72,963,849 | 72,963,849 | 4 | true | 2022-07-13T09:18:43.937Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to return the input time as always 09:00:00 in Python<pre><code> def dailyChecksInputDates():
current_date = datetime.now()
weekday = ... |
72,972,641 | how to define value from within the function call<p>I have this function call:</p>
<pre><code><a href="javascript;;" onclick="helloWorld(value="planet")">
</code></pre>
<p>and then this function</p>
<pre><code>function helloWorld(value) {
return value
}
</code></pre>
<p>Obv, it doe... | <p>The value that you are passing is known as <code>arguments</code> and the placeholder that is receiving the value is known as <code>parameter</code>.</p>
<p>So whatever you pass arguments gets assigned to a placeholder (i.e to parameter) in this case it is <code>value</code></p>
<p>So you have defined a function who... | how to define value from within the function call | javascript|script | 0 | 43 | 2 | 72,972,681 | 72,972,681 | 4 | true | 2022-07-13T21:05:41.010Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to define value from within the function call<p>I have this function call:</p>
<pre><code><a href="javascript;;" onclick="helloWorld(va... |
72,975,869 | How to get values based on each last valid occurrence in Pandas dataframe<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;">Status</th>
<th style="text-align: left;">Energy</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">1</td>
<td style="text-align: left;"... | <p>Let us use <code>shift</code> to compare the current row and next row then update the values in result column based on the outcome of comparison</p>
<pre><code>df.loc[df['Status'] != df['Status'].shift(-1), 'result'] = df['Energy']
</code></pre>
<hr />
<pre><code> Status Energy result
0 1 2 NaN
1... | How to get values based on each last valid occurrence in Pandas dataframe | python|pandas|dataframe|numpy | 1 | 43 | 1 | 72,975,921 | 72,975,921 | 4 | true | 2022-07-14T06:00:48.507Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get values based on each last valid occurrence in Pandas dataframe<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text... |
72,900,864 | Deleting nodes recursively<p>I have created this function to recursively delete nodes from a doubly linked list. The issue here is that based on the call stack, it starts from the second so it does not delete the entire list. I can delete the remaining node from the method where I'm calling this but there should be a w... | <p>First: Don't use a leading <code>_</code>.</p>
<p>You modify <code>_curr</code> in the function so by the time you end up at the <code>delete</code> the original pointer is gone. So don't do that, just call the function wiht the next value without modifying the local vbariable:</p>
<pre><code>RecursiveClear(_curr-&g... | Deleting nodes recursively | c++|linked-list|doubly-linked-list | -1 | 43 | 1 | 72,901,165 | 72,901,165 | 4 | true | 2022-07-07T15:53:40.540Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Deleting nodes recursively<p>I have created this function to recursively delete nodes from a doubly linked list. The issue here is that based on the call sta... |
72,793,483 | Retain column names after split in r<p>I have a data structure as below. As can be seen there are some columns that have numbers separated by a colon. For these, I'd like to retain only the maximum value. Example, for record 1 the expected output is 15 and for record 5 it should be 142.
I considered using <strong>split... | <p>You may use</p>
<pre><code>sapply(dat, function (x) max(unlist(x)))
# X1 X2 X3 X4 X5
# 15 106 134 139 142
</code></pre>
<p><code>sapply</code> returns a named vector in this case. If you want a data frame, we can do</p>
<pre><code>data.frame(lapply(dat, function (x) max(unlist(x))))
# X1 X2 X3 X4 X5
#1 15 ... | Retain column names after split in r | r | 1 | 43 | 2 | 72,793,512 | 72,793,512 | 4 | true | 2022-06-28T21:46:25.590Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Retain column names after split in r<p>I have a data structure as below. As can be seen there are some columns that have numbers separated by a colon. For th... |
72,861,433 | How to do complex pattern matching of enums mixed with structs<p>Currently, given an <code>A</code>, if I want to return <code>true</code> if it contains a <code>D</code> with true, I have to do the following:</p>
<pre><code>pub enum A{
B(B),
C(C)
}
pub struct B{
b1: D,
b2: bool
}
pub struct C{}
pub... | <p>You can nest patterns:</p>
<pre class="lang-rust prettyprint-override"><code>let e1_result = if let A::B(B {
b1: D { d1: E { e1: true } },
..
}) = something
{
true
} else {
false
};
</code></pre>
<p>At this point you can just use <a href="https://doc.rust-lang.org/stable/std/macro.matches.html" rel="... | How to do complex pattern matching of enums mixed with structs | rust | 0 | 43 | 1 | 72,861,552 | 72,861,552 | 5 | true | 2022-07-04T19:51:31.617Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to do complex pattern matching of enums mixed with structs<p>Currently, given an <code>A</code>, if I want to return <code>true</code> if it contains a <... |
72,896,832 | change type of every element in array in julia<p>i want an array that contains a range of numbers but store them as strings.
this is a sample output i need:</p>
<pre><code>['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
</code></pre>
<p>I tried this, but it produces a string with an array as its value.</p>
<pre><cod... | <p>First of all, note that Julia has separate types for <code>Char</code> (single characters) and <code>String</code> types. In Julia, <code>['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']</code> would be a character array, and can be created as:</p>
<pre><code>julia> '0':'9'
'0':1:'9'
</code></pre>
<p>You can ve... | change type of every element in array in julia | arrays|string|julia | 2 | 43 | 1 | 72,896,897 | 72,896,897 | 5 | true | 2022-07-07T11:14:14.563Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
change type of every element in array in julia<p>i want an array that contains a range of numbers but store them as strings.
this is a sample output i need:<... |
72,917,692 | What is the best way to convert a list of user data into objects?<p>Say I have a list of users where each element represents another list of user data like so:</p>
<pre><code>users = [
["name1", 24, "address1"],
["name2", 54, "address2"],
["name3", 32, "... | <p>You are seeking the <code>namedtuple</code> type in Python.</p>
<p><a href="https://docs.python.org/3/library/collections.html" rel="noreferrer">https://docs.python.org/3/library/collections.html</a></p>
<pre><code>from collections import namedtuple
User = namedtuple('User', ['name','age','address'] )
users = [
... | What is the best way to convert a list of user data into objects? | python | 2 | 43 | 2 | 72,917,707 | 72,917,707 | 6 | true | 2022-07-08T22:49:43.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the best way to convert a list of user data into objects?<p>Say I have a list of users where each element represents another list of user data like s... |
72,939,102 | How to match from beginning in css nth-of-child selector?<p>I want to select the first <code>div</code> until <code>div</code> number three.</p>
<p>So I use this selector:</p>
<pre><code>div:nth-of-type(1) ~ div:nth-of-type(3) {
border:1px solid red;
}
</code></pre>
<p>But it only match the 3 div. why? how to match f... | <p>You can use <code>:nth-child</code> selector with <code>-n+X</code> pattern, where <code>X</code> is first <code>X</code> number of elements you need to target.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css... | How to match from beginning in css nth-of-child selector? | css | 0 | 43 | 1 | 72,939,235 | 72,939,235 | 6 | true | 2022-07-11T13:07:55.020Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to match from beginning in css nth-of-child selector?<p>I want to select the first <code>div</code> until <code>div</code> number three.</p>
<p>So I use ... |
72,857,889 | different behaviour for filesystem::path(filePath).filename() between gcc7.3 and gcc9.3<p>I see different outputs when running this piece of code in gcc7.3 (using C++14) and gcc9.3 (using C++17):</p>
<pre><code>#include <iostream>
#if (__cplusplus >= 201703L)
#include <filesystem>
namespace fs = ... | <p><code><experimental/filesystem></code> implements the filesystem library according to the Filesystem TS (basically an experimental extension of C++14), while <code><filesystem></code> is the filesystem library part of C++17 (and later).</p>
<p>The two are not identical specifications. The latter is based... | different behaviour for filesystem::path(filePath).filename() between gcc7.3 and gcc9.3 | c++|c++17|c++14 | 3 | 43 | 1 | 72,858,254 | 72,858,254 | 6 | true | 2022-07-04T13:54:14.713Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
different behaviour for filesystem::path(filePath).filename() between gcc7.3 and gcc9.3<p>I see different outputs when running this piece of code in gcc7.3 (... |
72,811,101 | When i use a sql command in a for loop for uploading multiple rows in an excel file it doesnt work...it just uploads the first row<p>When i use a sql command in a for loop for uploading multiple rows in an excel file it doesnt work...it just uploads the first row
This is my Code to save the entries into sql database...... | <p>You can use "LOAD DATA Statement" bellow</p>
<pre><code>LOAD DATA LOCAL INFILE '$tmp_file_path' IGNORE
INTO TABLE tmp_table
FIELDS TERMINATED BY ','
ENCLOSED BY '\"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS
</code></pre>
<p>... | When i use a sql command in a for loop for uploading multiple rows in an excel file it doesnt work...it just uploads the first row | php|mysql|mysqli|phpexcel | -2 | 43 | 1 | 72,811,524 | 72,811,524 | -1 | true | 2022-06-30T06:19:34.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When i use a sql command in a for loop for uploading multiple rows in an excel file it doesnt work...it just uploads the first row<p>When i use a sql command... |
72,853,919 | How to run through columns and rows of a table in excel with vba<p>I am currently working on writing a data verification makro. Currently, it runs through one column and throws an error if the wrong data type is entered. The columns are dynamic because there will be new entries.</p>
<p>How do I run this code through se... | <p>You can try below sub-</p>
<pre><code>Sub CheckColumns()
Dim rng As Range
Dim lCol As Long, lRow As Long
lCol = Range("D4").End(xlToRight).Column
lRow = Range("D4").End(xlDown).Row
For Each rng In Range("D4", Cells(lRow, lCol))
If IsNumeric(rng) = False Then
... | How to run through columns and rows of a table in excel with vba | excel|vba | 0 | 43 | 1 | 72,854,162 | 72,854,162 | -1 | true | 2022-07-04T08:41:54.397Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to run through columns and rows of a table in excel with vba<p>I am currently working on writing a data verification makro. Currently, it runs through on... |
72,927,718 | NumPy stack, vstack and sdtack usage<p>I am trying to better understand hstack, vstack, and dstack in NumPy.</p>
<pre><code>a = np.arange(96).reshape(2,4,4,3)
print(a)
print(f"dimensions of a:", np.ndim(a))
print(f"Shape of a:", a.shape)
b = np.arange(201,225).reshape(2,4,3)
print(f"Shape of b:... | <p>You can <code>concatenate</code> to a <code>(2,4,4,3)</code> a</p>
<pre><code>(1,4,4,3) axis 0
(2,1,4,3) with axis=1
(2,4,1,3) axis 2
(2,4,4,1) axis 3
</code></pre>
<p>Read and reread as needed, the <code>np.concatenate</code> docs.</p>
<h2>edit</h2>
<p>In previous post(s) I've summarized the code of <code>hstac... | NumPy stack, vstack and sdtack usage | numpy|vstack|hstack | -1 | 43 | 1 | 72,927,821 | 72,927,821 | -1 | true | 2022-07-10T10:16:17.367Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
NumPy stack, vstack and sdtack usage<p>I am trying to better understand hstack, vstack, and dstack in NumPy.</p>
<pre><code>a = np.arange(96).reshape(2,4,4,3... |
72,833,776 | How can i disable mobile scrolling? Javascript<p>I have this website that displays 'The Game of Life', showing a canvas with the cells. On mobile, you can touch the canvas and it draws some cells, but it also scrolls the screen a little bit, even if the content of the web doesn't occupy more than 80% of the screen.
I'v... | <p>EDITED!!
I finally solved it. In my CSS i put this:</p>
<pre><code>html, body {
touch-action: none;
}
</code></pre>
<p>Maybe it doesn't work for everyone, but solved my problem.
Buttons still work properly :)</p>
<p>EDIT:
I needed to activate the touch action in the rest of the website, so i replaced the code abov... | How can i disable mobile scrolling? Javascript | javascript|html|css | -2 | 43 | 2 | 72,833,932 | 72,833,932 | -1 | true | 2022-07-01T19:20:12.300Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can i disable mobile scrolling? Javascript<p>I have this website that displays 'The Game of Life', showing a canvas with the cells. On mobile, you can to... |
72,769,175 | How to keep a multi layer b-collapse menu open on re-fresh in VUE.js?<p>I'm struggling to find the best way to keep my multi-layer menu open on re-fresh.</p>
<p>Basically if someone drills down to the third layer in my menu and clicks re-fresh, then I want the menu to open back up to where they navigated to in the thir... | <p>A detailled answer is hard, because I don't know your setup and am not familliar with vue-bootstrap.</p>
<p>It could look something like this in your components setup function:</p>
<pre><code>onBeforeMount(() => {
const thirdMenu = sessionStorage.getItem("thirdMenu");
if (thirdMenu) {
yourVariab... | How to keep a multi layer b-collapse menu open on re-fresh in VUE.js? | vue.js|vuejs2|bootstrap-vue | 2 | 44 | 2 | 72,777,119 | 72,777,119 | 0 | true | 2022-06-27T08:34:48.143Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to keep a multi layer b-collapse menu open on re-fresh in VUE.js?<p>I'm struggling to find the best way to keep my multi-layer menu open on re-fresh.</p>... |
72,778,956 | Returning a promise from JQuery "on ready" function<p>According to the <a href="https://api.jquery.com/ready/" rel="nofollow noreferrer">JQuery docs</a>, the "recommended" syntax for executing code when the DOM objects become safe to manipulate (a.k.a. "on ready") is this syntax:</p>
<pre><code>$(fu... | <p>It doesn't really do anything with the value returned, even if it's a Promise - and, for that reason, is a problem, because if the Promise rejects, you'll get an unhandled rejection:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre c... | Returning a promise from JQuery "on ready" function | javascript|jquery|promise | 1 | 44 | 1 | 72,778,993 | 72,778,993 | 0 | true | 2022-06-27T22:37:50.220Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Returning a promise from JQuery "on ready" function<p>According to the <a href="https://api.jquery.com/ready/" rel="nofollow noreferrer">JQuery docs</a>, the... |
72,773,884 | How can I write an SQL query as a template in PySpark?<p>I want to write a function that takes a column, a dataframe containing that column and a query template as arguments that outputs the result of the query when run on the column.</p>
<p>Something like:
<strong>func_sql(df_tbl,'age','select count(distinct {col}) fr... | <p>A bit confusing part is weather you want to parameterize query or table or not but assuming you want to pass query dataframe and column as parameter and just want first result as return of function</p>
<pre><code>
def func_sql(df_tbl,col,query): #function definition
print(eval(f"f'{query}'")) # printing ... | How can I write an SQL query as a template in PySpark? | sql|pyspark | 0 | 44 | 1 | 72,782,194 | 72,782,194 | 0 | true | 2022-06-27T14:36:13.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I write an SQL query as a template in PySpark?<p>I want to write a function that takes a column, a dataframe containing that column and a query templ... |
72,783,055 | WordPress get value from postmeta by post id<p>I have WordPress website and I want to get meta_value (7) from ej_postmeta table where post_id = 200
Also table postmeta has prefix ej_ and I want to show result in header.php.</p>
<p>Database structure</p>
<p>meta_id | post_id | meta_key | meta_value</p>
<p>100 ... | <p>The second parameter should be the meta key name.
<a href="https://developer.wordpress.org/reference/functions/get_post_meta/" rel="nofollow noreferrer">https://developer.wordpress.org/reference/functions/get_post_meta/</a></p>
<p>This line</p>
<pre><code>$values = get_post_meta( 200, 'meta_value' );
</code></pre>
<... | WordPress get value from postmeta by post id | php|wordpress | 0 | 44 | 1 | 72,783,453 | 72,783,453 | 0 | true | 2022-06-28T08:22:13.637Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
WordPress get value from postmeta by post id<p>I have WordPress website and I want to get meta_value (7) from ej_postmeta table where post_id = 200
Also tabl... |
72,783,913 | Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'Map<String, double>'<p>I have an object I am wanting to save to local storage, but whenever I write that object to storage I get the error shown in the title.</p>
<p>Here's the full stack trace</p>
<pre><code>[VERBOSE-2:ui_dar... | <p>In Dart, type parameters are preserved at runtime and are considered during type checks. So a <code>Map<String, dynamic></code> is not a subtype of <code>Map<String, double></code> and cannot be cast to it, which is the error that you're seeing here.</p>
<p>Since the JSON parser in Dart can't know the ri... | Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'Map<String, double>' | flutter|dart | 0 | 44 | 1 | 72,784,696 | 72,784,696 | 0 | true | 2022-06-28T09:26:17.730Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'Map<String, double>'<p>I have an object I am wanting to save to... |
72,786,393 | How can I not show the undefined values from map() return<p>I have an import from a json file with a random text and I have to get all the words in which the first letters are vowels.</p>
<pre><code>let texts = MyData.map(text => {
return text.tags.map(word => {
return word.split(' ').map( char => {
if(char... | <p>I think you need to use <kbd><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter" rel="nofollow noreferrer">filter</a></kbd> in inner most map function</p>
<pre><code>let texts = MyData.map(text => {
return text.tags.map(word => {
return word.split... | How can I not show the undefined values from map() return | javascript | 1 | 44 | 4 | 72,786,478 | 72,786,478 | 0 | true | 2022-06-28T12:25:15.313Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I not show the undefined values from map() return<p>I have an import from a json file with a random text and I have to get all the words in which the... |
72,788,602 | React State Rendering one step behind<p>I have a function that handles dragging an element on a page and swapping that element with the target element (using onDragStart & onDrop). The function takes in exactly where the user is at on a page and updates the page layout accordingly (not super important for my questi... | <p>Figured it out, I needed to use the spread operator in the setHook call</p>
<pre><code> setPDFStructure([...newElementOrder])
</code></pre>
<p>The reason for this is because react will not re-render if only part of an array is changed</p> | React State Rendering one step behind | reactjs|use-state | 1 | 44 | 1 | 72,789,505 | 72,789,505 | 0 | true | 2022-06-28T14:45:45.277Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React State Rendering one step behind<p>I have a function that handles dragging an element on a page and swapping that element with the target element (using... |
72,791,353 | How to use this JavaScript for multiple IDs in HTML?<p>I found this script in the web: <a href="https://sebhastian.com/javascript-multiply-string/" rel="nofollow noreferrer">https://sebhastian.com/javascript-multiply-string/</a></p>
<pre><code>let multi = 2;
let str = "Little lamb";
let multiStr = ""... | <p>You cannot reuse an id as it is invalid HTML, and JavaScript will only ever recognize the first element with a particular id. For selecting multiple elements you should assign them all a common class name, then use <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll" rel="nofollow nor... | How to use this JavaScript for multiple IDs in HTML? | javascript|html|for-loop | -1 | 44 | 2 | 72,791,890 | 72,791,890 | 0 | true | 2022-06-28T18:16:28.820Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use this JavaScript for multiple IDs in HTML?<p>I found this script in the web: <a href="https://sebhastian.com/javascript-multiply-string/" rel="nofo... |
72,792,227 | NetSuite Loop thru inventorydetail Subrecord Suitescript 1.0<p>I'm trying to pull all the listed bin numbers inside the inventorydetail subrecord thru SS1.0. I'm using UE script but I am having trouble looping thru each inventory detail on multiple items:</p>
<p>Scenario:
Item 1 = Inventory Details (Bin1 and Bin2)
Item... | <p>There are a few reasons that your line may not have an inventory detail record so you need to check if it is empty before accessing it. So something like:</p>
<pre class="lang-js prettyprint-override"><code>var recordid = nlapiGetNewRecord().getId();
var record = nlapiLoadRecord('itemfulfillment', recordid);
var lin... | NetSuite Loop thru inventorydetail Subrecord Suitescript 1.0 | netsuite|suitescript1.0 | 0 | 44 | 1 | 72,794,116 | 72,794,116 | 0 | true | 2022-06-28T19:35:42.983Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
NetSuite Loop thru inventorydetail Subrecord Suitescript 1.0<p>I'm trying to pull all the listed bin numbers inside the inventorydetail subrecord thru SS1.0.... |
72,787,663 | One Jenkinsfile for multiples repositories<p>I want to have 1 main repository with some common configurations to be used:</p>
<pre><code>Common
---> jenkinsfile
---> x.json
---> config.json
</code></pre>
<p>I would like to have different teams to be able to use that common repo and just create their o... | <p>That's the exact capabilities Jenkins <a href="https://www.jenkins.io/blog/2017/10/02/pipeline-templates-with-shared-libraries/" rel="nofollow noreferrer">Shared Libraries</a> gives you.</p>
<p><a href="https://www.jenkins.io/blog/2020/10/21/a-sustainable-pattern-with-shared-library/" rel="nofollow noreferrer">Blog<... | One Jenkinsfile for multiples repositories | git|github|jenkins|jenkins-pipeline | 0 | 44 | 1 | 72,797,010 | 72,797,010 | 0 | true | 2022-06-28T13:50:04.347Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
One Jenkinsfile for multiples repositories<p>I want to have 1 main repository with some common configurations to be used:</p>
<pre><code>Common
---> je... |
72,797,128 | Convert .tsv file to .csv file with tab_delims using batch file<p>i have some trouble about convert file tsv to file csv with .bat.
Problem is i can't convert when i change data with tab and spaces</p>
<p>My current source</p>
<pre><code>setlocal disableDelayedExpansion
set OUT_DIR1=%1
set input=%OUT_DIR1%\%2
set outp... | <pre><code>@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
rem The following settings for the source directory, destination directory,
rem filename, output filename are names
rem that I use for testing and deliberately include names which include spaces to make sure
rem that the process works using such names. These will nee... | Convert .tsv file to .csv file with tab_delims using batch file | csv|batch-file | 1 | 44 | 1 | 72,797,694 | 72,797,694 | 0 | true | 2022-06-29T07:05:56.173Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert .tsv file to .csv file with tab_delims using batch file<p>i have some trouble about convert file tsv to file csv with .bat.
Problem is i can't conver... |
72,789,959 | Power Bi dealing with repeated instruments from Redcap<p>I have data like this:</p>
<p><a href="https://i.stack.imgur.com/2gxOA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2gxOA.png" alt="enter image description here" /></a></p>
<p>It comes from Redcap, and as you may be able to tell, the data in... | <p>You might want to rework you data structure. At first glance, your flat source table could be parsed into two tables :</p>
<ul>
<li>Protocol</li>
<li>Survey</li>
</ul>
<p>This can be done in PowerQuery.</p>
<p>For <code>Protocol</code> :</p>
<ol>
<li>Select columns A to R.</li>
<li>Filter on <code>redcap_event</code... | Power Bi dealing with repeated instruments from Redcap | powerbi|redcap | 1 | 44 | 1 | 72,799,226 | 72,799,226 | 0 | true | 2022-06-28T16:15:53.263Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Power Bi dealing with repeated instruments from Redcap<p>I have data like this:</p>
<p><a href="https://i.stack.imgur.com/2gxOA.png" rel="nofollow noreferrer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.