qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
74,158,244
<p>I have a stored procedure A on server 1 that takes 2 parameters from the user, and then using a linked server (ew), pulls in the results (a table) from server 2.</p> <pre><code>ALTER PROCEDURE [DW].[StoredProcA] @InvFromDate date OUTPUT, @InvToDate date OUTPUT AS WITH CTE_Labor AS ( SELECT blabla FROM LinkedServer.Database.schema.table &lt;lots more ctes, etc.&gt; </code></pre> <p>For performance, I'd like to instead have a stored procedure A still accept the 2 parameters, but then pass them on to stored procedure B that sits on Server 2, and return those results back to the user.</p> <p>Say - I can put the stored procedure on server 2, and call it from Server 1</p> <pre><code>DECLARE @return_value int EXEC @return_value = [LinkedServer].[DB].[Schema].[StoredProcB] @InvFromDate = '2022-10-01', @InvToDate = '2022-10-31' </code></pre> <p>That works.</p> <p>But I'm not clear on the syntax to do the above, but have those 2 parameters be entered by the user in stored procedure 1.</p> <p>Clearly this attempt is wrong:</p> <pre><code>ALTER PROCEDURE dbo.StoredProc1 @InvFromDate DATE, @InvToDate DATE AS BEGIN DECLARE @return_value int; EXEC @return_value = [LinkedServer].[DB].[Schema].[StoredProcB] @InvFromDate = @InvFromDate, @InvToDate = @InvToDate; RETURN @return_value; END </code></pre> <p>Edit: Maybe this attempt isn't wrong.</p> <p>It works when I right click and run the stored procedure, returning both the desired table and Return Value = 0. It just doesn't work when I point our front-end GUI at it. But that might not be a question for here.</p>
[ { "answer_id": 74158313, "author": "Cyrus", "author_id": 3776858, "author_profile": "https://Stackoverflow.com/users/3776858", "pm_score": 2, "selected": false, "text": "sed -e 's/ hPa//g')" }, { "answer_id": 74158970, "author": "Socowi", "author_id": 6770384, "author...
2022/10/21
[ "https://Stackoverflow.com/questions/74158244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8570140/" ]
74,158,252
<p>Is there a way to join 2 dataset without explode rows? I need only a flag if at least one row of dataset &quot;df2&quot; satisfies the join condition with the dataset of &quot;df1&quot;.</p> <p>Is there any way to avoid the join? I would like to avoid joining and then just keep the first row with a window function.</p> <p>Condition left join is = <code>[(df2.id == df1.id) &amp; (df2.date &gt;= df1.date)]</code></p> <p>Example:</p> <p><code>Input df1</code></p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>id</th> <th>city</th> <th>sport_event</th> <th>date</th> </tr> </thead> <tbody> <tr> <td>abc</td> <td>London</td> <td>football</td> <td>2022-02-11</td> </tr> <tr> <td>def</td> <td>Paris</td> <td>volley</td> <td>2022-02-10</td> </tr> <tr> <td>ghi</td> <td>Manchester</td> <td>basketball</td> <td>2022-02-09</td> </tr> </tbody> </table> </div> <p><code>Input df2</code></p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>id</th> <th>num_spect</th> <th>date</th> </tr> </thead> <tbody> <tr> <td>abc</td> <td>100.000</td> <td>2022-01-10</td> </tr> <tr> <td>abc</td> <td>200.000</td> <td>2022-04-15</td> </tr> <tr> <td>abc</td> <td>150.000</td> <td>2022-02-11</td> </tr> </tbody> </table> </div> <p><code>Output NOT DESIDERED</code> <strong>&lt;- NOT DESIDERED</strong></p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>id</th> <th>city</th> <th>sport_event</th> <th>date</th> <th>num_spect</th> </tr> </thead> <tbody> <tr> <td>abc</td> <td>London</td> <td>football</td> <td>2022-02-11</td> <td>100.000</td> </tr> <tr> <td>abc</td> <td>London</td> <td>football</td> <td>2022-02-11</td> <td>200.000</td> </tr> <tr> <td>abc</td> <td>London</td> <td>football</td> <td>2022-02-11</td> <td>150.000</td> </tr> <tr> <td>def</td> <td>Paris</td> <td>volley</td> <td>2022-02-10</td> <td></td> </tr> <tr> <td>ghi</td> <td>Manchester</td> <td>basketball</td> <td>2022-02-09</td> <td></td> </tr> </tbody> </table> </div> <p><code>Output DESIDERED</code> <strong>&lt;- DESIDERED</strong></p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>id</th> <th>city</th> <th>sport_event</th> <th>date</th> <th>num_spect</th> <th>flag</th> </tr> </thead> <tbody> <tr> <td>abc</td> <td>London</td> <td>football</td> <td>2022-02-11</td> <td>100.000</td> <td>1</td> </tr> <tr> <td>def</td> <td>Paris</td> <td>volley</td> <td>2022-02-10</td> <td></td> <td></td> </tr> <tr> <td>ghi</td> <td>Manchester</td> <td>basketball</td> <td>2022-02-09</td> <td></td> <td></td> </tr> </tbody> </table> </div>
[ { "answer_id": 74159574, "author": "iambdot", "author_id": 1415826, "author_profile": "https://Stackoverflow.com/users/1415826", "pm_score": 2, "selected": true, "text": "from pyspark.sql import functions as F\nfrom pyspark.sql.types import *\nfrom pyspark.sql import Window\n\ndf1 = spar...
2022/10/21
[ "https://Stackoverflow.com/questions/74158252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14820295/" ]
74,158,256
<p>In short, I had an assignment problem where my final output should be a list of numbers, However in some cases, I have the good numbers in my list but just in the wrong order. I don't want to change my entire code since it is quite long. Thus, I was wondering if there is a trick, function or something that I can use where I can sort the list in a ascending manner however it doesn't put the negative numbers first.<br /> For example, turn [0, -2, 1, -3, 2, -4, 3, -5, 4, -6] into [0, 1, -2, 2, -3, 3, -4, 4, -5, -6]<br /> Another example, turn [0, 1, 5, 9, -2, 2, -5, -9, -1] into [0, -1, 1, -2, 2, -5, 5, -9, 9]<br /> Another example, turn [12,-12] into [-12,12]<br /> Here you can see that its sorted in an ascending manner but its start from 0 and not from a negative number.</p>
[ { "answer_id": 74159574, "author": "iambdot", "author_id": 1415826, "author_profile": "https://Stackoverflow.com/users/1415826", "pm_score": 2, "selected": true, "text": "from pyspark.sql import functions as F\nfrom pyspark.sql.types import *\nfrom pyspark.sql import Window\n\ndf1 = spar...
2022/10/21
[ "https://Stackoverflow.com/questions/74158256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20277880/" ]
74,158,287
<p>First of all, my coding/scripting skills are 30 years old... So total newbie here. But being forced to deal with some XML. Everything I have done so far I have found on here, but its not quite 100% yet.</p> <p>(The below is made up, of course, I hope there arent any typos...)</p> <p>Here is the situation. I have multiple files:</p> <ul> <li>library1.xml</li> <li>library2.xml</li> <li>etc</li> </ul> <p>Each file has inventory of each library and looks like this:</p> <p>library1.xml</p> <pre><code>&lt;books&gt; &lt;book&gt; &lt;title&gt;Tale of Two Cities&lt;/title&gt; &lt;author&gt;Charles Dickens&lt;/author&gt; &lt;/book&gt; &lt;book&gt; &lt;title&gt;Lord of the Flies&lt;/title&gt; &lt;author&gt;William Golding&lt;/author&gt; &lt;/book&gt; &lt;/books&gt; </code></pre> <p>library2.xml</p> <pre><code>&lt;books&gt; &lt;book&gt; &lt;title&gt;The Red Badge of Courage&lt;/title&gt; &lt;author&gt;Stephen Crane&lt;/author&gt; &lt;/book&gt; &lt;book&gt; &lt;title&gt;The Grapes of Wrath&lt;/title&gt; &lt;author&gt;John Steinbeck&lt;/author&gt; &lt;/book&gt; &lt;/books&gt; </code></pre> <p>I have already found and tweaked scripts that will merge these into 1 file and keep the XML structure correct.</p> <p>But before I merge them, I want it to add which library it was found at. Library 1, 2, etc. I found a script that does that by parsing the filename.</p> <pre><code>$files = ls *.xml foreach ($file in $files) { [xml]$contents = gc $file.fullname $xmlelement_file = $contents.CreateElement('library') $xmlelement_file.InnerText = $file.basename $contents.books.book.AppendChild($xmlelement_file) $contents.Save($file.fullname) } </code></pre> <p>The output I am looking to get, after processing the library1.xml file, is:</p> <pre><code>&lt;books&gt; &lt;book&gt; &lt;title&gt;Tale of Two Cities&lt;/title&gt; &lt;author&gt;Charles Dickens&lt;/author&gt; &lt;library&gt;library1&lt;/library&gt; &lt;/book&gt; &lt;book&gt; &lt;title&gt;Lord of the Flies&lt;/title&gt; &lt;author&gt;William Golding&lt;/author&gt; &lt;library&gt;library1&lt;/library&gt; &lt;/book&gt; &lt;/books&gt; </code></pre> <p>And then something similar for the other files.</p> <p>However, when I run this, the resulting files add library1 and library2 to the appropriate files, but ONLY to the last book in each file:</p> <pre><code>&lt;books&gt; &lt;book&gt; &lt;title&gt;Tale of Two Cities&lt;/title&gt; &lt;author&gt;Charles Dickens&lt;/author&gt; &lt;/book&gt; &lt;book&gt; &lt;title&gt;Lord of the Flies&lt;/title&gt; &lt;author&gt;William Golding&lt;/author&gt; &lt;library&gt;library1&lt;/library&gt; &lt;/book&gt; &lt;/books&gt; </code></pre> <p>I am thinking that I need another loop to run through each book, but cant figure it out.</p> <p>Any help would be appreciated!</p> <p>(I would actually prefer to do all of this in Bash vs. Powershell, as I am acquiring the XML files via API calls on a Linux system in the first place. But the only hits I found via Google were in Powershell (which I had never used before today), so I went in that direction...)</p>
[ { "answer_id": 74158795, "author": "Start-Automating", "author_id": 221631, "author_profile": "https://Stackoverflow.com/users/221631", "pm_score": 0, "selected": false, "text": "[XmlElement]" }, { "answer_id": 74163217, "author": "Theo", "author_id": 9898643, "author...
2022/10/21
[ "https://Stackoverflow.com/questions/74158287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8454910/" ]
74,158,288
<p>I have a dataset that looks like this</p> <pre><code>ID|Filter| 1 Y 1 N 1 Y 1 Y 2 N 2 N 2 N 2 Y 2 Y 3 N 3 Y 3 Y </code></pre> <p>I would like the final result to look like this. A summary count of total count and also when filter is &quot;Y&quot;</p> <pre><code>ID|All Count|Filter Yes 1 4 3 2 5 2 3 3 2 </code></pre> <p>If i do like this i only get the full count but I also want the folder as the next column</p> <pre><code> df&lt;- df %&gt;% group_by(ID)%&gt;% summarise(`All Count`=n()) </code></pre>
[ { "answer_id": 74158795, "author": "Start-Automating", "author_id": 221631, "author_profile": "https://Stackoverflow.com/users/221631", "pm_score": 0, "selected": false, "text": "[XmlElement]" }, { "answer_id": 74163217, "author": "Theo", "author_id": 9898643, "author...
2022/10/21
[ "https://Stackoverflow.com/questions/74158288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8107489/" ]
74,158,299
<p>I have the following data.</p> <pre><code> x_plus &lt;- c(1.3660254, 1.1123724, 1.0000000, 0.9330127, 0.8872983, 0.8535534, 0.8273268, 0.8061862, 0.7886751, 0.7738613, 0.6936492, 0.6581139, 0.6369306, 0.6224745, 0.6118034, 0.5968246, 0.5866025, 0.5707107, 0.5612372, 0.5500000, 0.5433013, 0.5387298, 0.5353553, 0.5306186, 0.5273861, 0.5193649, 0.5158114, 0.5122474, 0.5103510, 0.5086603, 0.5050000, 0.5027386, 0.5008660) x_minus &lt;- c(-0.3660254, -0.1123724, 0.0000000, 0.0669873, 0.1127017, 0.1464466, 0.1726732, 0.1938138, 0.2113249, 0.2261387, 0.3063508, 0.3418861, 0.3630694, 0.3775255, 0.3881966, 0.4031754, 0.4133975, 0.4292893, 0.4387628, 0.4500000, 0.4566987, 0.4612702, 0.4646447, 0.4693814, 0.4726139, 0.4806351, 0.4841886, 0.4877526, 0.4896490, 0.4913397, 0.4950000, 0.4972614, 0.4991340) y &lt;- c(1.50, 3.00, 4.50, 6.00, 7.50, 9.00, 1.05e+01, 1.20e+01, 1.35e+01, 1.50e+01, 3.00e+01, 4.50e+01, 6.00e+01, 7.50e+01, 9.00e+01, 1.20e+02, 1.50e+02, 2.25e+02, 3.00e+02, 4.50e+02, 6.00e+02, 7.50e+02, 9.00e+02, 1.20e+03, 1.50e+03, 3.00e+03, 4.50e+03, 7.50e+03, 1.05e+04, 1.50e+04, 4.50e+04, 1.50e+05, 1.50e+06) df &lt;- data.frame(cbind(x_plus, x_minus, y)) x_points &lt;- c(.5, .6, .43, .1, 1, .52, .6) y_points &lt;- c(50, 100, 5000, 300, 500, 700, 10) </code></pre> <p>which I use to produce the following plot.</p> <pre><code>library(ggplot2) ggplot()+ geom_point(aes(x = x_points, y = y_points))+ geom_path(data = df, aes(x = x_plus, y = y))+ geom_path(aes(x = x_minus, y = y))+ scale_y_log10()+ coord_cartesian(ylim = c(10, 1e4)) </code></pre> <p><a href="https://i.stack.imgur.com/EHEKD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EHEKD.png" alt="Plot" /></a></p> <p>How would one go about mathematically determining how many points fall between the two geom_path() lines? For my actual application there may be thousands of points on this plot. Any advice is greatly appreciated!</p>
[ { "answer_id": 74158559, "author": "Robert Hacken", "author_id": 2094893, "author_profile": "https://Stackoverflow.com/users/2094893", "pm_score": 4, "selected": true, "text": "approxfun()" }, { "answer_id": 74183782, "author": "Dan Adams", "author_id": 13210554, "aut...
2022/10/21
[ "https://Stackoverflow.com/questions/74158299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16940523/" ]
74,158,314
<p>I am trying to implement a function in C that will find the smallest int that is greater than or equal to a given int in an AVL. For example:</p> <ul> <li><p>if I have an AVL tree consisting of <code>1,2,3,4,5,6,7</code> and I put in <code>6</code>, it should return <code>6</code>.</p> </li> <li><p>if I have an AVL tree consisting of <code>1,2,3,4,6,7</code> and I put in <code>5</code>, it should return 6.</p> </li> <li><p>if none are found, return -1.</p> </li> </ul> <p>I have found a case (there could be more) where this implementation fails. If I have an AVL tree of <code>1,2,3,4,5,6,7</code> and I input <code>3</code> it incorrectly returns <code>4</code>. This case occurs when the ROOT is bigger than the input. I am not sure how to fix this though. There could also be other cases — if you could let me know that would be great.</p> <p>Here is my attempt:</p> <pre><code>int findLeastGreatest(Node *root, int input) { // Never found if (root-&gt;left == NULL &amp;&amp; root-&gt;right == NULL &amp;&amp; root-&gt;data &lt; input) return -1; // Found if ((root-&gt;data &gt;= input &amp;&amp; root-&gt;left == NULL) || (root-&gt;data &gt;= input &amp;&amp; root-&gt;left-&gt;data &lt; input)) return root-&gt;data; if (root-&gt;data &lt;= input) return findLeastGreatest(root-&gt;right, input); else return findLeastGreatest(root-&gt;left, input); } </code></pre>
[ { "answer_id": 74158449, "author": "MattArmstrong", "author_id": 2442218, "author_profile": "https://Stackoverflow.com/users/2442218", "pm_score": 2, "selected": false, "text": "bound" }, { "answer_id": 74158450, "author": "chqrlie", "author_id": 4593267, "author_prof...
2022/10/21
[ "https://Stackoverflow.com/questions/74158314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20303945/" ]
74,158,383
<p>I would like to use <code>na.pass</code> for <code>na.action</code> when working with <code>lmer</code>. There are <code>NA</code> values in some observations of the data set in some columns. I just want to control for this variables that contains the <code>NA</code>'s. It is very important that the size of the data set will be the same after the control of the fixed effects. I think I have to work with <code>na.action</code> in <code>lmer()</code>. I am using the following model:</p> <pre class="lang-r prettyprint-override"><code>baseline_model_0 &lt;- lmer(formula=log_life_time_income_child ~ nationality_dummy + sex_dummy + region_dummy + political_position_dummy +(1|Family), data = baseline_df </code></pre> <blockquote> <p>Error in qr.default(X, tol = tol, LAPACK = FALSE) : NA/NaN/Inf in foreign function call (arg 1)</p> </blockquote> <p>My data: as you see below, there are quite a lot of NA's in all the control variables. So &quot;throwing&quot; away all of these observations is no option!</p> <p>One example:</p> <pre><code>nat_dummy 1 : 335 2 : 19 NA's: 252 </code></pre> <p>My questions:</p> <p>1.) How can I include all of my control variables (expressed in multiple columns) to the model without kicking out observations (expressed in rows)?</p> <p>2.) How does <code>lmer</code> handle the missing variables in all the columns?</p>
[ { "answer_id": 74175854, "author": "Ben Bolker", "author_id": 190277, "author_profile": "https://Stackoverflow.com/users/190277", "pm_score": 2, "selected": false, "text": "na.pass" }, { "answer_id": 74175872, "author": "Shawn Hemelstrand", "author_id": 16631565, "aut...
2022/10/21
[ "https://Stackoverflow.com/questions/74158383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20018384/" ]
74,158,384
<p>i am not sure how to resolve this math problem. what should i recall and where did i miss something. i have tried different opportunities. i think i just call not existing index or something like that..</p> <pre><code>#include &lt;iostream&gt; using namespace std; double recur(int n, int x); double x; int number; int main() { cout &lt;&lt; &quot;enter n: &quot; ; cin &gt;&gt; number; cout &lt;&lt; endl; do { cout &lt;&lt; &quot;enter float x!=0: &quot;; cin &gt;&gt; x; cout &lt;&lt; endl; } while (x==0); cout &lt;&lt; &quot;recur(&quot; &lt;&lt; number &lt;&lt; &quot;,&quot; &lt;&lt; x &lt;&lt; &quot;)=&quot; &lt;&lt; recur(number, x) &lt;&lt; endl; system(&quot;pause&quot;); } double recur(int n, int x) { if (n &gt; 1) return (x * recur(n, x - n) * recur(n - 1, x)); else if( n == 1) return x * recur(n,x) - x; else return 1; } </code></pre> <p>Formula:</p> <p><a href="https://i.stack.imgur.com/avd6X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/avd6X.png" alt="The formula" /></a></p>
[ { "answer_id": 74175854, "author": "Ben Bolker", "author_id": 190277, "author_profile": "https://Stackoverflow.com/users/190277", "pm_score": 2, "selected": false, "text": "na.pass" }, { "answer_id": 74175872, "author": "Shawn Hemelstrand", "author_id": 16631565, "aut...
2022/10/21
[ "https://Stackoverflow.com/questions/74158384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14310629/" ]
74,158,412
<p>In my program there is some frequently used data type with trivial fields</p> <pre class="lang-cpp prettyprint-override"><code>struct Element { Element() noexcept : x( 0 ), y( 0 ), z( 0 ) {} float x, y, z; }; </code></pre> <p>and also there are many pieces of code taking vectors of <code>Element</code>s, e.g.</p> <pre class="lang-cpp prettyprint-override"><code>void foo( std::vector&lt;Element&gt; &amp; es ); </code></pre> <p>So it would be very complicated to introduce radical changes in <code>Element</code> (like changing its default constructor) or rewriting all these pieces to replace <code>std::vector</code> with something else.</p> <p>And I have some performance-critical place where a vector of <code>Element</code>s must be created, filled and passed to <code>foo</code>:</p> <pre class="lang-cpp prettyprint-override"><code>std::vector&lt;Element&gt; es; // resize is necessary only to allocate the storage, all values will be rewritten in the parallel region later es.resize( N ); // perform computation of all values in the vector in parallel for best performance tbb::parallel_for( tbb::blocked_range&lt;size_t&gt;( 0, es.size() ), [&amp;]( const tbb::blocked_range&lt;size_t&gt; &amp; range ) { for ( size_t i = range.begin(); i &lt; range.end(); ++i ) { ... es[i] = ... } } … foo( es ); </code></pre> <p>What I observe is that <code>es.resize</code> takes considerable time for huge <code>N</code> because it not only allocates the memory, but also default initializes every element, which is not necessary in my case.</p> <p>Is there a way to increase the size of the vector without initializing its elements, which will be all initialized later? Something like <code>std::make_unique_for_overwrite</code> available for unique_ptrs.</p>
[ { "answer_id": 74175854, "author": "Ben Bolker", "author_id": 190277, "author_profile": "https://Stackoverflow.com/users/190277", "pm_score": 2, "selected": false, "text": "na.pass" }, { "answer_id": 74175872, "author": "Shawn Hemelstrand", "author_id": 16631565, "aut...
2022/10/21
[ "https://Stackoverflow.com/questions/74158412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7325599/" ]
74,158,435
<p>I have been working as a data analyst for about 4 months now and the above is a very real question for me. The most recent way I've been taught to join is with the left join with the following example.</p> <pre><code>left join table1 on table2.id = table1.id left join table2 on table3.table_id = table2.table_id left join table4 on table1.tablekey_id = table4.tablekey_id </code></pre> <p>Looking for the most efficient way to connect multiple tables to save time, if possible.</p> <p>Thanks in Advance!</p>
[ { "answer_id": 74175854, "author": "Ben Bolker", "author_id": 190277, "author_profile": "https://Stackoverflow.com/users/190277", "pm_score": 2, "selected": false, "text": "na.pass" }, { "answer_id": 74175872, "author": "Shawn Hemelstrand", "author_id": 16631565, "aut...
2022/10/21
[ "https://Stackoverflow.com/questions/74158435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20303933/" ]
74,158,451
<p>Getting error when trying to unload or count data from AWS Keyspace using dsbulk.</p> <p>Error:</p> <pre><code>Operation COUNT_20221021-192729-813222 failed: Token metadata not present. </code></pre> <p>Command line:</p> <pre><code>$ dsbulk count/unload -k my_best_storage -t book_awards -f ./dsbulk_keyspaces.conf </code></pre> <p>Config:</p> <pre><code>datastax-java-driver { basic.contact-points = [ &quot;cassandra.us-east-2.amazonaws.com:9142&quot;] advanced.auth-provider { class = PlainTextAuthProvider username = &quot;aw.keyspaces-at-XXX&quot; password = &quot;XXXX&quot; } basic.load-balancing-policy { local-datacenter = &quot;us-east-2&quot; } basic.request { consistency = LOCAL_QUORUM default-idempotence = true } advanced { request{ log-warnings = true } ssl-engine-factory { class = DefaultSslEngineFactory truststore-path = &quot;./cassandra_truststore.jks&quot; truststore-password = &quot;XXX&quot; hostname-validation = false } metadata { token-map.enabled = false } } } </code></pre> <p>dsbulk load - loading operator works fine...</p>
[ { "answer_id": 74163262, "author": "Erick Ramirez", "author_id": 4269535, "author_profile": "https://Stackoverflow.com/users/4269535", "pm_score": 2, "selected": false, "text": "com.amazonaws.cassandra.DefaultPartitioner" }, { "answer_id": 74608635, "author": "MikeJPR", "...
2022/10/21
[ "https://Stackoverflow.com/questions/74158451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/972610/" ]
74,158,514
<p>I am new at this and I'm trying to save multiple inputs to localStorage with one save button. Its saved second one but not the first one and I can't quite get it to work. Can you please tell me what is the reason? Why doesn't it save the first one?</p> <p>My inputs and save button:</p> <pre><code>&lt;body onload=&quot;init()&quot;&gt; &lt;input type=&quot;text&quot; id=&quot;myTxt1&quot; placeholder=&quot;Type here ...&quot; &gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt; &lt;input type=&quot;text&quot; id=&quot;myTxt2&quot; placeholder=&quot;Type here ...&quot;&gt;&lt;/br&gt;&lt;/br&gt; &lt;button onclick=&quot;onSavePressed()&quot;&gt;Save&lt;/button&gt; &lt;/body&gt; </code></pre> <p>My script:</p> <pre><code>function init(){ if (localStorage.first1Box){ document.getElementById(&quot;myTxt1&quot;).value = localStorage.first1Box; } } function onSavePressed(){ localStorage.first1Box = document.getElementById(&quot;myTxt1&quot;).value; alert(&quot;Saved Successfully!!!&quot;); } function init(){ if (localStorage.second2Box){ document.getElementById(&quot;myTxt2&quot;).value = localStorage.second2Box; } } function onSavePressed(){ localStorage.second2Box = document.getElementById(&quot;myTxt2&quot;).value; alert(&quot;Saved Successfully!!!&quot;); } </code></pre>
[ { "answer_id": 74163262, "author": "Erick Ramirez", "author_id": 4269535, "author_profile": "https://Stackoverflow.com/users/4269535", "pm_score": 2, "selected": false, "text": "com.amazonaws.cassandra.DefaultPartitioner" }, { "answer_id": 74608635, "author": "MikeJPR", "...
2022/10/21
[ "https://Stackoverflow.com/questions/74158514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20276833/" ]
74,158,560
<p>I am going through JavaScript course on freecodecamp and I came across this <a href="https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller" rel="nofollow noreferrer">'Steamroller' challenge</a>. Coming from python I really like one-liner solutions so I managed to write one for this challenge:</p> <pre><code>function steamrollArray(arr) { return Array.isArray(arr) ? [].concat(...arr.map(steamrollArray)) : arr; } steamrollArray([1, [2], [3, [[4]]]]) // returns [1, 2, 3, 4] </code></pre> <p>The goal is basically to flatten an array of arbitrary depth. What puzzles me though (still new to JavaScript) is why seemingly similar code behaves very differently. Something I wrote at the beginning doesn't work, but code I arrived at through trial and (mostly) error works:</p> <pre><code>[...arr.map(steamrollArray)] // this doesn't work, returns an unchanged array [].concat(...arr.map(steamrollArray)) // this works, returns a flat array </code></pre> <p>This seems strange to me because 'unfolding' the recursion would suggest it should be the other way around</p> <pre><code>[...arr.map(steamrollArray)] [1, ...[2], ...[3, ...[...[4]]]] // this should work [].concat(...arr.map(steamrollArray)) [].concat(...[1, [].concat(...[2]), [].concat(...[3, [].concat(...[].concat(...[4]))])]) // what 'is going on' </code></pre> <p>Can anyone please explain this behaviour?</p>
[ { "answer_id": 74158606, "author": "caTS", "author_id": 18244921, "author_profile": "https://Stackoverflow.com/users/18244921", "pm_score": 1, "selected": false, "text": "[1, 2, 3, 4, 5, 6]" }, { "answer_id": 74158626, "author": "CertainPerformance", "author_id": 9515207,...
2022/10/21
[ "https://Stackoverflow.com/questions/74158560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14625103/" ]
74,158,603
<p>ive got a layout which i use svg since i need 3 triangles that cover the full screen like the image below<a href="https://i.stack.imgur.com/zCqVo.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zCqVo.jpg" alt="enter image description here" /></a></p> <p>when i hover on one of these triangles i want them to change their image, im able to do that, but i want to add a transition effect. the transition works when i only use colors, but when i fill the path with an image the transition effect becomes all flickey basically not working. is there a way to add transitions? or is there a better to way to achieve the same output?</p> <p>this the code im using now</p> <p>these are my home triangles</p> <pre><code>const HomeTriangles=(props)=&gt;{ return ( &lt;div &gt; &lt;svg width={props.width} height={props.height} className='top-svg'&gt; &lt;TopTriangle width={props.width} height={props.height}/&gt; &lt;LeftTriangle width={props.width} height={props.height}&gt;&lt;/LeftTriangle&gt; &lt;RightTriangle width={props.width} height={props.height}&gt;&lt;/RightTriangle&gt; &lt;/svg&gt; &lt;/div&gt; ); </code></pre> <p>}</p> <p>and each of these triangles are basically the same, only the paths have different values</p> <pre><code>const TopTriangle=(props)=&gt;{ const [hover, setHovered] = useState(false) const [textColor, setTextColor] = useState(&quot;black&quot;) const [opacity, setOpacity] = useState(0.5) const [stroke, setStroke] = useState(&quot;&quot;) const [strokeWidth, setStrokeWidth] = useState(0) const [strokeColor, setStrokeColor] = useState(&quot;white&quot;) return( &lt;&gt; &lt;defs&gt; &lt;pattern id=&quot;img1&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;1&quot; height=&quot;1&quot;&gt; &lt;image href={hover?Fishmarket:Test} width={props.width} height={props.height} preserveAspectRatio=&quot;xMidYMid slice&quot; /&gt; &lt;/pattern&gt; &lt;/defs&gt; &lt;path onMouseEnter={() =&gt; { setOpacity(1) setStrokeWidth(2) setTextColor(&quot;black&quot;) setStrokeColor(&quot;white&quot;) setHovered(true) }} onMouseLeave={() =&gt; { setOpacity(0.5) setStrokeWidth(0) setTextColor(&quot;white&quot;) setStrokeColor(&quot;white&quot;) setHovered(false) }} stroke={strokeColor} stroke-width={strokeWidth} onClick={()=&gt;console.log(&quot;clicked&quot;)} opacity={opacity} id=&quot;top-triangle&quot; fill=&quot;url(#img1)&quot; d={`M 20 0 L ${props.width/2} ${props.height/2} L ${props.width-20} 0 L 0 0`} &gt; &lt;/path&gt; &lt;/&gt; ) } </code></pre> <p>tried looking for other sources help but most were transitions on colors. please help thank you</p>
[ { "answer_id": 74166548, "author": "chrwahl", "author_id": 322084, "author_profile": "https://Stackoverflow.com/users/322084", "pm_score": 1, "selected": false, "text": "svg {\n background-color: black;\n}\n\n.over1 > image:nth-child(2) {\n opacity: 1;\n transition-property: opacity;\...
2022/10/21
[ "https://Stackoverflow.com/questions/74158603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14427074/" ]
74,158,645
<p>I'm trying to find the members of two arrays where they appear in one but not the other. I've read <a href="https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.except?view=net-6.0" rel="nofollow noreferrer">this article</a> and I think while I understand it I'm doing something incorrectly.</p> <p>Assume the following simple code:</p> <pre><code>using System; using System.Linq; using System.Collections.Generic; public class Program { public static void Main() { int[][] currentLocation = new int[][] { new int[] { 11, 10 }, new int[] { 11, 11 }, new int[] { 11, 12 }, new int[] { 11, 13 }, }; int[][] proposedLocation = new int[][] { new int[] { 11, 12 }, new int[] { 11, 13 }, new int[] { 11, 14 }, new int[] { 11, 15 }, }; IEnumerable&lt;int[]&gt; onlyInFirstSet = proposedLocation.Except(currentLocation); foreach (int[] number in onlyInFirstSet) Console.WriteLine(number[0].ToString() + &quot;,&quot;+number[1].ToString()); } } </code></pre> <p>Now what I'd hope/think/expect to see would be:</p> <pre><code>11,14 11,15 </code></pre> <p>...because in the <code>proposedLocation</code> these are the only ones that don't appear in <code>currentLocation</code> However I'm actually getting:</p> <pre><code>11,12 11,13 11,14 11,15 </code></pre> <p>(i.e. the whole of <code>proposedLocation</code>)</p> <p><strong>Question:</strong> how do I extract values that only appear in <code>proposedLocation</code>? I'd be beneficial if I could somehow retain the <code>int[][]</code> rather than an odd bit of <code>string</code> while at it but that's a bonus.</p>
[ { "answer_id": 74159795, "author": "Dulanjan Madusanka", "author_id": 19127142, "author_profile": "https://Stackoverflow.com/users/19127142", "pm_score": 0, "selected": false, "text": "var currentLocation = new object[]\n {\n new { a = 11, b...
2022/10/21
[ "https://Stackoverflow.com/questions/74158645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3968494/" ]
74,158,649
<p>I'm trying to figure out the best / most efficient way to get the 'progress' of a <code>Summary</code> object. A <code>Summary</code> object has X <code>Grade</code> objects - a <code>Grade</code> object <code>is_complete</code> when it has a <code>Level</code> chosen and has 1 or more related <code>Evidence</code> objects.</p> <p>I am trying to tie that <code>Summary</code> 'progress' to a <code>Person</code>.</p> <p>The <code>models.py</code> look like this:</p> <pre><code>class Summary(models.Model): id = models.BigAutoField(primary_key=True) person = models.ForeignKey( Person, on_delete=models.PROTECT, related_name=&quot;summaries&quot; ) finalized = models.BooleanField(default=False) class Meta: verbose_name = &quot;Summary&quot; verbose_name_plural = &quot;Summaries&quot; def progress(self): &quot;&quot;&quot;Return the progress of the summary.&quot;&quot;&quot; grades = self.grades.all() finished_grades = ( Grade.complete.all().filter(summary=self).count() ) try: progress = (finished_grades / grades.count()) * 100 class Grade(models.Model): id = models.BigAutoField(primary_key=True) summary = models.ForeignKey( Summary, on_delete=models.PROTECT, related_name=&quot;%(class)ss&quot; ) level = models.ForeignKey( Level, on_delete=models.PROTECT, null=True, blank=True, related_name=&quot;%(class)ss&quot;, ) class Meta: verbose_name = &quot;Grade&quot; verbose_name_plural = &quot;Grades&quot; @property def is_complete(self): if 0 &lt; self.evidences.count() and self.level: return True return False class Evidence(models.Model): id = models.BigAutoField(primary_key=True) grade = models.ForeignKey( Grade, on_delete=models.PROTECT, related_name=&quot;%(class)ss&quot; ) comment = models.TextField() </code></pre> <p>My <code>views.py</code> looks like this:</p> <pre><code>class PersonListView(ListView): model = Person template_name = &quot;app/person_list.html&quot; context_object_name = &quot;person_list&quot; def get_queryset(self): people = Person.objects.all().prefetch_related(&quot;summaries&quot;, &quot;summaries__grades&quot;, &quot;summaries__grades__evidences&quot;) # There should only be one non-finalized summary # or there will be None first_summary = Summary.objects.filter( person__id=OuterRef(&quot;id&quot;), finalized=False ) return people.annotate( summary_progress=Subquery(first_summary[:1].progress()), ) </code></pre> <p>I'm trying to do this in as few queries as possible (I think with prefetch maybe 3-4 queries would be possible in total?)</p> <p>In my template I'm trying to make it simple to get that so I can do something simple as I'm looping through the list of people:</p> <pre><code>&lt;div class=&quot;progress&quot;&gt; {{ student.summary_progress }} &lt;/div&gt; </code></pre> <p>The code above doesn't work because I'm trying to annotate that <code>.progress()</code> method onto the <code>People</code> queryset. I can't seem to figure out the best way to accomplish it.</p>
[ { "answer_id": 74159795, "author": "Dulanjan Madusanka", "author_id": 19127142, "author_profile": "https://Stackoverflow.com/users/19127142", "pm_score": 0, "selected": false, "text": "var currentLocation = new object[]\n {\n new { a = 11, b...
2022/10/21
[ "https://Stackoverflow.com/questions/74158649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20304038/" ]
74,158,662
<p>Basically, what I want to achieve is the following <strong>binary</strong> transformation with the following conditions:</p> <ol> <li><p>If all the values in C2 associated with a variable in C1 has never been greater than 0, keep <strong>only 1 record</strong> of it (C &amp; G) with its associated value to be 0 even if it appears multiple times.</p> </li> <li><p>If some of the values in C2 associated with a variable in C1 has a value greater than 0, keep all those records of it with its associated value to be 1 and eliminate the ones with zero (A, B, D, E &amp; F).</p> </li> </ol> <pre><code>+-----------------+ | C1 | C2 | +--------|--------+ | A | 6 | | B | 5 | | C | 0 | | A | 0 | | D | 1 | | E | 4 | | F | 9 | | B | 0 | | C | 0 | | G | 0 | | D | 0 | | D | 7 | | G | 0 | | G | 0 | +-----------------+ </code></pre> <p>to</p> <pre><code>+-----------------+ | C1 | C2 | +--------|--------+ | A | 1 | | B | 1 | | C | 0 | | D | 1 | | D | 1 | | E | 1 | | F | 1 | | G | 0 | +-----------------+ </code></pre> <p>How does one attain this in PySpark?</p>
[ { "answer_id": 74159795, "author": "Dulanjan Madusanka", "author_id": 19127142, "author_profile": "https://Stackoverflow.com/users/19127142", "pm_score": 0, "selected": false, "text": "var currentLocation = new object[]\n {\n new { a = 11, b...
2022/10/21
[ "https://Stackoverflow.com/questions/74158662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2941501/" ]
74,158,707
<p>so I have a string that possesses data I need to extract for my main program.<br /> It looks something like this:</p> <pre><code>string = &quot;[email:first.last@gmail.com][days:90]&quot; </code></pre> <p>From this string I want to extract the data within the brackets and be able to split email and the email address by the colon so that I can store the word email and the email address separately to get something like this:</p> <pre><code>string = &quot;[email:first.last@gmail.com]&quot; ... some regex here ... param_type = &quot;email&quot; param_value = &quot;first.last@gmail.com&quot; if param_type == 'email': ... my code to send an email to param_value ... </code></pre> <p>The string could ultimately have at most 2 pairs of brackets for different parameter types so that I can specify what functions to handle:</p> <pre><code>string = &quot;[email:first.last@gmail.com] [days:90]&quot; ...regex to split by bracket group .... param_type1 = &quot;email&quot; param1 = &quot;first.last@gmail.com&quot; param_type2 = &quot;days&quot; param2 = &quot;90&quot; if param_type1 != &quot;&quot;: ... email code ... if param_type2 != &quot;&quot;: ... run other code for the specified number of days ... </code></pre> <p>The main program already has default values for these 2 param_types, but I want there to be the option to specify the email address, days, both, or neither. If anything, I mainly need to know how to retrieve the email address as the online examples don't work for my situation. Thanks!</p>
[ { "answer_id": 74159795, "author": "Dulanjan Madusanka", "author_id": 19127142, "author_profile": "https://Stackoverflow.com/users/19127142", "pm_score": 0, "selected": false, "text": "var currentLocation = new object[]\n {\n new { a = 11, b...
2022/10/21
[ "https://Stackoverflow.com/questions/74158707", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19628700/" ]
74,158,743
<p>In Python, I can run</p> <pre><code>import requests url = &quot;https://www.cij.gov.ar/d/sentencia-SGU-afb60c47-0de3-4e3f-869f-ff0d4abcb1a8.pdf&quot; requests.get(url, verify = False) </code></pre> <p>in order to bypass the missing certificate exception.</p> <p>However, running <code>Downloads.download(&quot;https://www.cij.gov.ar/d/sentencia-SGU-afb60c47-0de3-4e3f-869f-ff0d4abcb1a8.pdf&quot;)</code> raises <code>ERROR: Cert verify failed: BADCERT_NOT_TRUSTED while requesting</code>.</p> <p>Is there a way to disable the check in Julia as well?</p> <p>(If the answer involves toggling some environmental variables, I'm looking to doing this within the VSCODE Julia extension, which doesn't always look at the same variables as the regular REPL...)</p>
[ { "answer_id": 74160503, "author": "Przemyslaw Szufel", "author_id": 9957710, "author_profile": "https://Stackoverflow.com/users/9957710", "pm_score": 3, "selected": true, "text": "val = HTTP.get(\"https://self-signed.badssl.com/\", require_ssl_verification=false)\n" } ]
2022/10/21
[ "https://Stackoverflow.com/questions/74158743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12104222/" ]
74,158,757
<p>I need help my friends, it's my first project with Api, and I'm not able to pull the data from the Api, it returns the following error.</p> <p>Script:</p> <pre><code>response = data.json() for number in response['mobile_phones']: dd = resposta['ddd'] num = resposta['number'] whatsapp = resposta['whatsapp_datetime'] print(dd+num+whatsapp) </code></pre> <p>Erro:</p> <pre><code>Erro: KeyError: 'mobile_phones' </code></pre> <p>Response Api</p> <pre><code>{ &quot;cpf&quot;: 52289257591, &quot;mobile_phones&quot;: [ { &quot;ddd&quot;: 27, &quot;number&quot;: &quot;999111151&quot;, &quot;priority&quot;: 1, &quot;cdr_datetime&quot;: null, &quot;hot_datetime&quot;: null, &quot;whatsapp_datetime&quot;: &quot;2022-03-05 00:00:00&quot;, &quot;cpc_datetime&quot;: null }, { &quot;ddd&quot;: 27, &quot;number&quot;: &quot;998608229&quot;, &quot;priority&quot;: 2, &quot;cdr_datetime&quot;: null, &quot;hot_datetime&quot;: null, &quot;whatsapp_datetime&quot;: &quot;2022-03-07 00:00:00&quot;, &quot;cpc_datetime&quot;: null }, { &quot;ddd&quot;: 27, &quot;number&quot;: &quot;992250660&quot;, &quot;priority&quot;: 3, &quot;cdr_datetime&quot;: null, &quot;hot_datetime&quot;: null, &quot;whatsapp_datetime&quot;: &quot;2022-03-12 00:00:00&quot;, &quot;cpc_datetime&quot;: null } ], &quot;ip&quot;: &quot;135.199.5.98&quot;, &quot;plan&quot;: &quot;Consulta simples&quot; } ] </code></pre>
[ { "answer_id": 74158789, "author": "Rahul K P", "author_id": 4407666, "author_profile": "https://Stackoverflow.com/users/4407666", "pm_score": 2, "selected": true, "text": "for number in response[0]['mobile_phones']:\n dd = number['ddd']\n num = number['number']\n whatsapp = num...
2022/10/21
[ "https://Stackoverflow.com/questions/74158757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20287778/" ]
74,158,781
<p>I am working on Django and I need to filter records eg:</p> <p>table: Person</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>name</th> <th>age</th> </tr> </thead> <tbody> <tr> <td>David Abraham Benj</td> <td>18</td> </tr> </tbody> </table> </div> <p>so, if I run this, <code>Person.objects.filter(name__icontains=&quot;David Abraham&quot;)</code> it is working</p> <p>but if I run this, <code>Person.objects.filter(name__icontains=&quot;David Benj&quot;)</code> it is not working</p> <p>any idea how it works?</p> <p>framework: Django and SQL: Postgres</p>
[ { "answer_id": 74158889, "author": "Rahul K P", "author_id": 4407666, "author_profile": "https://Stackoverflow.com/users/4407666", "pm_score": 1, "selected": false, "text": "Person.objects.filter(name__icontains=\"David Benj\")\n" }, { "answer_id": 74158918, "author": "Dzeri9...
2022/10/21
[ "https://Stackoverflow.com/questions/74158781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20304185/" ]
74,158,829
<p>i am trying to find the intersection of the elements using nested for loop. I made several mistakes doing so.</p> <ol> <li>I dont know why arrOfArrs[i+1] is not applicable</li> <li>I dont understand how will i compare the resulting array to the third array after the first iteration</li> </ol> <p>Hypothetically, if the code had worked, wouldnt it just compare array1 to array2 push the result into resultArray, and same thing for array2 to array3 and finally push the result.</p> <p>Please share your insight on this. Much obliged!</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function intersection(arrOfArrs){ let resultArray = []; let nextArray = 0; for(let i = 0 ; i &lt; arrOfArrs.length; i++ ){ for(let j = 0; j &lt; arrOfArrs[i].length; j++){ const currEl = arrOfArrs[i][j]; if(arrOfArrs[(i+1)].length){ if(arrOfArrs[(i+1)].includes(currEl)){ resultArray.push(currEl); } } } } return resultArray; } const arr1 = [5, 10, 15, 20]; const arr2 = [15, 88, 1, 5, 7]; const arr3 = [1, 10, 15, 5, 20]; console.log(intersection([arr1, arr2, arr3])); // should log: [5, 15]</code></pre> </div> </div> </p>
[ { "answer_id": 74158889, "author": "Rahul K P", "author_id": 4407666, "author_profile": "https://Stackoverflow.com/users/4407666", "pm_score": 1, "selected": false, "text": "Person.objects.filter(name__icontains=\"David Benj\")\n" }, { "answer_id": 74158918, "author": "Dzeri9...
2022/10/21
[ "https://Stackoverflow.com/questions/74158829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15956155/" ]
74,158,865
<p>As the subject suggests, I am trying to determine if an Outlook item is a meeting request, while creating a new .ItemSend event handler. I have looked at ways of doing this with inspector and explorer.</p> <p>I have reviewed this:</p> <p><a href="https://learn.microsoft.com/en-us/visualstudio/vsto/how-to-programmatically-determine-the-current-outlook-item?view=vs-2022&amp;tabs=csharp" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/visualstudio/vsto/how-to-programmatically-determine-the-current-outlook-item?view=vs-2022&amp;tabs=csharp</a></p> <p>and this:</p> <p><a href="https://stackoverflow.com/questions/57415144/activeexplorer-selection-returns-previously-selected-mail-in-outlook-c-sharp">ActiveExplorer().Selection returns previously selected mail in Outlook C#</a></p> <p>as well as a few of the 'similar questions'.</p> <p>I have been successful with establishing a new inspector event handler as well as defining the event handler for Application.ItemSend and those are working great. But only when I send meeting requests. Regular emails respond to the event triggers, but restart Outlook, saving an email as a draft, without sending.</p> <p>I am not sure of combining the use of inspector and explorer to prevent crashing Outlook? I am not sure if I can do this by only using inspector? By only using explorer?</p> <p>I believe that if I can wrap all of this code with identification of an outlook item as a MailItem or a Meeting Request, I can get around this problem I am having with emails and the new event handler.</p> <p>A point in the right direction is appreciated. Thanks - - chris</p> <pre><code> public partial class ThisAddIn { private Outlook.Inspectors inspectors = null; private Outlook.UserProperty objUserPropertyEventId = null; private void ThisAddIn_Startup(object sender, System.EventArgs e) { inspectors = this.Application.Inspectors; inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector); // define event handler for ItemSend Application.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend); } private void ThisAddIn_Shutdown(object sender, System.EventArgs e) { // Note: Outlook no longer raises this event. If you have code that // must run when Outlook shuts down, see https://go.microsoft.com/fwlink/?LinkId=506785 } void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector) { // &lt;testing this&gt; Outlook.Selection sel = Application.ActiveExplorer().Selection; if (sel.Count == 1) MessageBox.Show(&quot;One selected&quot;); //Outlook.MailItem mail = sel[1] as Outlook.MailItem; Object selObject = this.Application.ActiveExplorer().Selection[1]; //if (mail != null) if (selObject is Outlook.MailItem) MessageBox.Show(&quot;This is a mail item.&quot;/*\n\n&quot; + mail.Subject*/); else MessageBox.Show(&quot;This is NOT a mail item.&quot;/*\n\n&quot; + mail.Subject*/); // &lt;/testing this&gt; // &lt;this works, but not for email. Only meeting requests.&gt; #pragma warning disable IDE0019 // Use pattern matching Outlook.AppointmentItem appt = Inspector.CurrentItem as Outlook.AppointmentItem; #pragma warning restore IDE0019 // Use pattern matching // is it an AppointmentItem if (appt != null) { MessageBox.Show(&quot;appt != null&quot;); // is it a meeting request if (appt.MeetingStatus == Outlook.OlMeetingStatus.olMeeting) { // force time of initial meeting dialog to be 11:29pm // to avoid immediate reminder of upcoming meeting DateTime datDateTime = DateTime.Now; string strYear = datDateTime.ToString().Substring(6, 4); int intYear; intYear = Int32.Parse(strYear); string strMonth = datDateTime.ToString(&quot;MM/dd/yyyy&quot;).Substring(0, 2); int intMonth; intMonth = Int32.Parse(strMonth); string strDay = datDateTime.ToString(&quot;MM/dd/yyyy&quot;).Substring(3, 2); int intDay; intDay = Int32.Parse(strDay); string strReqAtt = appt.RequiredAttendees; if (string.IsNullOrEmpty(strReqAtt)) appt.Start = new DateTime(intYear, intMonth, intDay, 23, 29, 00); // save to generate EntryId for future reference appt.Save(); // save EntryId as UserProperty Outlook.AppointmentItem mtg; mtg = (Outlook.AppointmentItem)Inspector.CurrentItem; if (mtg != null) { if (mtg is Outlook.AppointmentItem) { mtg.MeetingStatus = Outlook.OlMeetingStatus.olMeeting; string strEntryId = mtg.EntryID; Outlook.UserProperties objUserProperties = mtg.UserProperties; objUserPropertyEventId = objUserProperties.Add(&quot;MeetingEntryId&quot;, Outlook.OlUserPropertyType.olText, true, 1); objUserPropertyEventId.Value = strEntryId; } } if (mtg != null) Marshal.ReleaseComObject(mtg); } if (appt != null) Marshal.ReleaseComObject(appt); } } public void Application_ItemSend(object Item, ref bool Cancel) { // use EventId to identify current meeting request var app = new Microsoft.Office.Interop.Outlook.Application(); var ns = app.Session; Outlook.AppointmentItem meeting = ns.GetItemFromID(objUserPropertyEventId.Value); MessageBox.Show(meeting.Subject); //if (meeting.MeetingStatus != Outlook.OlMeetingStatus.olNonMeeting) if (meeting.MeetingStatus == Outlook.OlMeetingStatus.olMeeting) { // is ItemSend a request or a cancel if (meeting.MeetingStatus != Outlook.OlMeetingStatus.olMeetingCanceled) { MessageBox.Show(&quot;MeetingStatus != olMeetingCanceled&quot;); Outlook.Recipient recipConf = null; try { // ItemSend is a request if (meeting is Outlook.AppointmentItem) { //if (meeting.MeetingStatus == Outlook.OlMeetingStatus.olMeeting) { Outlook.Recipient recipRoomUser; // if a location was provided if (meeting.Location != null) { string strLocation = meeting.Location; bool blnTorF = false; string strConference = &quot;|&quot;; // Clears lazy room number typing // Location resource: // places meeting on 'JHP Conference ###' calendar // and // sends email to conference room user with link for Teams meeting // conference room user is added to 'Location' by including email in 'Required' if (!strLocation.Contains(&quot;Room - Conference&quot;)) meeting.Location = &quot;&quot;; // Add calendar users (based on room location) to email // sends email to conference room user with link for Teams meeting // conference room user is added to previously cleared 'Location' // by including email in 'Required' if (strLocation.Contains(&quot;142&quot;)) { recipRoomUser = meeting.Recipients.Add(&quot;xxx@xxx.com&quot;); recipRoomUser = meeting.Recipients.Add(&quot;xxx@xxx.com&quot;); recipRoomUser.Type = (int)Outlook.OlMeetingRecipientType.olRequired; if(meeting.Location == &quot;&quot;) meeting.Location = &quot;xxx@xxx.com&quot;; } if (strLocation.Contains(&quot;150&quot;)) { recipRoomUser = meeting.Recipients.Add(&quot;xxx@xxx.com&quot;); recipRoomUser = meeting.Recipients.Add(&quot;xxx@xxx.com&quot;); recipRoomUser.Type = (int)Outlook.OlMeetingRecipientType.olRequired; if (meeting.Location == &quot;&quot;) meeting.Location = &quot;xxx@xxx.com&quot;; } if (strLocation.Contains(&quot;242&quot;)) { recipRoomUser = meeting.Recipients.Add(&quot;xxx@xxx.com&quot;); recipRoomUser = meeting.Recipients.Add(&quot;xxx@xxx.com&quot;); recipRoomUser.Type = (int)Outlook.OlMeetingRecipientType.olRequired; if (meeting.Location == &quot;&quot;) meeting.Location = &quot;xxx@xxx.com&quot;; } if (strLocation.Contains(&quot;248&quot;)) { recipRoomUser = meeting.Recipients.Add(&quot;xxx@xxx.com&quot;); recipRoomUser = meeting.Recipients.Add(&quot;xxx@xxx.com&quot;); recipRoomUser.Type = (int)Outlook.OlMeetingRecipientType.olRequired; if (meeting.Location == &quot;&quot;) meeting.Location = &quot;xxx@xxx.com&quot;; } MessageBox.Show(&quot;Location assigned&quot;); // build string of recipients for .Split('|') to array foreach (Outlook.Recipient objUser in meeting.Recipients) { // remove previous location prior to room change if (!objUser.Name.Contains(&quot;JHP Conference&quot;) &amp;&amp; !objUser.Name.Contains(&quot;Room - Conference&quot;)) if (!strConference.Contains(objUser.Name)) // no duplicates strConference = strConference + objUser.Name + &quot;|&quot;; } if (strConference != &quot;|&quot;) { // create array from string without duplicates //MessageBox.Show(&quot;strConference != |\n\n&quot; + strConference); string[] arrConference = null; strConference = strConference.TrimStart('|'); arrConference = strConference.Split('|'); // verify array contents string strCheck = &quot;&quot;; string strReqdAtts = &quot;&quot;; for (int i = 0; i &lt; arrConference.Length - 1; i++) { strCheck = strCheck + arrConference[i] + &quot;\n&quot;; strReqdAtts = strReqdAtts + &quot;;&quot; + arrConference[i]; } //MessageBox.Show(&quot;Array contents\n\n&quot; + strCheck); strReqdAtts = strReqdAtts.TrimStart(';'); //MessageBox.Show(&quot;RequiredAttendees contents\n\n&quot; + strReqdAtts); meeting.RequiredAttendees = strReqdAtts; //MessageBox.Show(&quot;.Add&quot;); } MessageBox.Show(&quot;Attendees assigned&quot;); Cancel = true; // has the user included &quot;JHP - Room Reservations&quot; for placement // on the shared calendar for all conference room availability foreach (Outlook.Recipient objUser in meeting.Recipients) { if (objUser.Name == &quot;JHP - Room Reservations&quot;) blnTorF = true; } // add &quot;JHP - Room Reservations&quot; if not already included if (blnTorF == false) { recipConf = meeting.Recipients.Add(&quot;JHP - Room Reservations&quot;); recipConf.Type = (int)Outlook.OlMeetingRecipientType.olRequired; } // resolve recipients meeting.Recipients.ResolveAll(); meeting.Send(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, &quot;Calendar recipients were not added.&quot;); } finally { if (recipConf != null) Marshal.ReleaseComObject(recipConf); } } else //{ // ItemSend is a cancel MessageBox.Show(&quot;Meeting is cancelled.&quot;); //} } else { MessageBox.Show(&quot;Not a meeting&quot;); } } #region VSTO generated code /// &lt;summary&gt; /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// &lt;/summary&gt; private void InternalStartup() { this.Startup += new System.EventHandler(ThisAddIn_Startup); this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown); } #endregion } </code></pre>
[ { "answer_id": 74158889, "author": "Rahul K P", "author_id": 4407666, "author_profile": "https://Stackoverflow.com/users/4407666", "pm_score": 1, "selected": false, "text": "Person.objects.filter(name__icontains=\"David Benj\")\n" }, { "answer_id": 74158918, "author": "Dzeri9...
2022/10/21
[ "https://Stackoverflow.com/questions/74158865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19111101/" ]
74,158,873
<p>Can anyone advise on how to approach this problem?</p> <p>i have a form with various state. When the user changes any of the forms inputs and clicks save, a function sends the data to the backend. The problem is that I send the whole object to the backend when I only want to send the changed value / the state that has changed. How would I do that?</p> <p>Here is an example:</p> <pre><code> const [streetName, setStreetName] = useState&lt;string&gt;(''); const [zipCode, setZipCode] = useState&lt;string&gt;(''); const [city, setCity] = useState&lt;string&gt;(''); const [email, setEmail] = useState&lt;string&gt;(''); const [phone, setPhone] = useState&lt;string&gt;(''); const userData = { streetName, zipCode, city, email, phone }; const saveDataOnClickHandler = (userData) =&gt; { updateUserMutation(userData); }; </code></pre>
[ { "answer_id": 74158889, "author": "Rahul K P", "author_id": 4407666, "author_profile": "https://Stackoverflow.com/users/4407666", "pm_score": 1, "selected": false, "text": "Person.objects.filter(name__icontains=\"David Benj\")\n" }, { "answer_id": 74158918, "author": "Dzeri9...
2022/10/21
[ "https://Stackoverflow.com/questions/74158873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19932692/" ]
74,158,891
<p>I have an Oracle PL/SQL procedure monitoring_5_min and as far as I know it must be envoked every 5 minutes by some external interface (possibly a web service) or some scheduled job. Are there any Oracle system methods to find out what invokes the procedure? Maybe some system views? I tried to select from v$sql but it seems that it only include SQL calls but not PL/SQL.</p>
[ { "answer_id": 74158945, "author": "OldProgrammer", "author_id": 1745544, "author_profile": "https://Stackoverflow.com/users/1745544", "pm_score": 1, "selected": false, "text": "select * from v$session where sid = sys_context('userenv','sid')\n" } ]
2022/10/21
[ "https://Stackoverflow.com/questions/74158891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20304193/" ]
74,158,904
<p>I am just learning how to do a basic web page. So this is the main code</p> <pre><code>&lt;navbar class=&quot;navbar navbar-light pip-footer&quot;&gt; &lt;div class=&quot;row&quot;&gt; &lt;div class=&quot;col-3&quot;&gt; HP 90/90 &lt;/div&gt; &lt;div class=&quot;col-6&quot;&gt; LEVEL 1 &lt;div class=&quot;level-progress&quot;&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;col-3&quot;&gt; AP 50/50 &lt;/div&gt; &lt;/div&gt; &lt;/navbar&gt; </code></pre> <p>then I want to apply these measures so that the words are spaced, but as you can see in the image they don't move</p> <pre><code>.pip-footer{ position: fixed; bottom: 0; width: calc(100% - 20px); margin: 10px;} </code></pre> <p><a href="https://i.stack.imgur.com/7YzcJ.png" rel="nofollow noreferrer">here you can see</a></p> <p><a href="https://i.stack.imgur.com/i6Afs.png" rel="nofollow noreferrer">should be look like this</a></p>
[ { "answer_id": 74158945, "author": "OldProgrammer", "author_id": 1745544, "author_profile": "https://Stackoverflow.com/users/1745544", "pm_score": 1, "selected": false, "text": "select * from v$session where sid = sys_context('userenv','sid')\n" } ]
2022/10/21
[ "https://Stackoverflow.com/questions/74158904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20255520/" ]
74,158,919
<p>I am new to Python. I have dataframe obtained from SQL query result</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>UserId</th> <th>UserName</th> <th>Reason_details</th> </tr> </thead> <tbody> <tr> <td>851</td> <td>Bob</td> <td>[ {&quot;reasonId&quot;:264, &quot;reasonDescription&quot;:&quot;prohibited&quot;, &quot;reasonCodes&quot;:[1 , 2]} , {&quot;reasonId&quot;:267, &quot;reasonDescription&quot;:&quot;Expired&quot;, &quot;reasonCodes&quot;:[25]} ]</td> </tr> <tr> <td>852</td> <td>Jack</td> <td>[{&quot;reasonId&quot;:273, &quot;reasonDescription&quot;:&quot;Restricted&quot;, &quot;reasonCodes&quot;:[29]}]</td> </tr> </tbody> </table> </div> <p>I want to modify this dataframe by flattening Reason_details column. Each reason in new row.</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>UserId</th> <th>UserName</th> <th>Reason_id</th> <th>Reson_description</th> <th>Reason_codes</th> </tr> </thead> <tbody> <tr> <td>851</td> <td>Bob</td> <td>264</td> <td>Prohibited</td> <td>1</td> </tr> <tr> <td>851</td> <td>Bob</td> <td>264</td> <td>Prohibited</td> <td>2</td> </tr> <tr> <td>851</td> <td>Bob</td> <td>267</td> <td>Expired</td> <td>25</td> </tr> <tr> <td>852</td> <td>Jack</td> <td>273</td> <td>Restricted</td> <td>29</td> </tr> </tbody> </table> </div> <p>I flattened this data using good old for loops iterating over each row of source dataframe, reading value of each key in <code>Reason_details</code> column by using <code>json_loads</code>. And then creating final dataframe.</p> <p>But I feel there has to be better way of doing this using dataframe and JSON functions in python.</p> <p>PS: In my actual dataset there are 63 columns and 8 million rows out of which only Reason_details column has JSON value. Thus my existing approach is very inefficient iteration over all rows, all columns converting them in 2D list first and making final dataframe from it.</p>
[ { "answer_id": 74158946, "author": "Bushmaster", "author_id": 15415267, "author_profile": "https://Stackoverflow.com/users/15415267", "pm_score": 2, "selected": false, "text": "df=df.explode('Reason_details')\ndf = df.join(df['Reason_details'].apply(pd.Series)).drop('Reason_details',axis...
2022/10/21
[ "https://Stackoverflow.com/questions/74158919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9399889/" ]
74,158,931
<p>first end second if statments working (combobox and textbox &lt;10 ) but third is not(null value). Why?</p> <pre><code>Private Sub CommandButton1_Click() If ComboBox1.ListIndex = -1 Then MsgBox &quot;bla&quot; Exit Sub End If If CDbl(TextBox1.Text) &lt; 10 Then MsgBox &quot;bla!&quot; Exit Sub End If If (TextBox1.Value = Null) Then MsgBox &quot;bla!&quot; End If Exit Sub </code></pre>
[ { "answer_id": 74158946, "author": "Bushmaster", "author_id": 15415267, "author_profile": "https://Stackoverflow.com/users/15415267", "pm_score": 2, "selected": false, "text": "df=df.explode('Reason_details')\ndf = df.join(df['Reason_details'].apply(pd.Series)).drop('Reason_details',axis...
2022/10/21
[ "https://Stackoverflow.com/questions/74158931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16704510/" ]
74,158,933
<p>I have seen multiple websites telling me to use <code>message.content</code>, but it seems like that doesn't exist. When I use <code>print(message)</code>, content doesn't seem to exist. I also tried besides that with this code.</p> <pre><code>async def on_message(message: discord.Message): print(message.content) print(message.author.name) print(message.channel.name) </code></pre> <p><a href="https://i.stack.imgur.com/kKHrP.png" rel="nofollow noreferrer">It prints &quot;&quot;, &quot;Com&quot; and &quot;test&quot;</a></p>
[ { "answer_id": 74158946, "author": "Bushmaster", "author_id": 15415267, "author_profile": "https://Stackoverflow.com/users/15415267", "pm_score": 2, "selected": false, "text": "df=df.explode('Reason_details')\ndf = df.join(df['Reason_details'].apply(pd.Series)).drop('Reason_details',axis...
2022/10/21
[ "https://Stackoverflow.com/questions/74158933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19049092/" ]
74,158,960
<p>I am very new to React and am trying to create a page where clicking on the color square will show the hex code for that color. I've tried a bunch of different things and I can't figure out if my problem is in the event handling, in the state handling, both, or in something else altogether. I can get the hex code to either be there or not, but not have it change when I click.</p> <p>Here is my main:</p> <pre><code> &lt;main&gt; &lt;h1&gt;Dynamic Hex Code Display&lt;/h1&gt; &lt;div id=&quot;container&quot;&gt;&lt;/div&gt; &lt;script type=&quot;text/babel&quot;&gt; class ColorSquare extends React.Component { render() { var blockStyle = { height: 150, backgroundColor: this.props.color, }; return &lt;div style={blockStyle} onClick = {this.props.onClick}&gt;&lt;/div&gt;; } } class HexDisplay extends React.Component { render() { var hexText = { fontFamily: &quot;arial&quot;, fontWeight: &quot;bold&quot;, padding: 15, margin: 0, textAlign: &quot;center&quot;, }; var hexTextVis = { ...hexText, visibility: &quot;visible&quot; } var hexTextInvis = { ...hexText, visibility: &quot;hidden&quot; } var isVisible = this.props.isVisible; if (isVisible) { return &lt;p style={hexTextVis}&gt;{this.props.color}&lt;/p&gt;; } else { return &lt;p style={hexTextInvis}&gt;{this.props.color}&lt;/p&gt;; } } } class HexParent extends React.Component { constructor(props) { super(props); this.state = { isVisible: false }; this.handleClick = this.handleClick.bind(this); } handleClick(e) { this.setState(currentVis =&gt; ({isVisible: !currentVis.isVisible})); console.log(this.state); console.log('clicking'); } render() { var fullBoxStyle = { padding: 0, margin: 10, backgroundColor: &quot;#fff&quot;, boxShadow: &quot;3px 3px 5px #808080&quot;, boxRadius: &quot;5px 5px&quot;, height: 200, width: 150, }; var buttonStyle = { width:150, backgroundColor: this.props.color } return ( &lt;div style={fullBoxStyle}&gt; &lt;span onClick={(e) =&gt; this.handleClick()}&gt; &lt;ColorSquare color={this.props.color} /&gt; &lt;span style={{ isVisible: this.state.isVisible ? &quot;true&quot; : &quot;false&quot;, }}&gt; &lt;HexDisplay color={this.props.color} /&gt; &lt;/span&gt; &lt;/span&gt; &lt;/div&gt; ); } } ReactDOM.render( &lt;div class=&quot;colorRow&quot;&gt; &lt;HexParent color=&quot;#ba2c9d&quot; /&gt; &lt;HexParent color=&quot;#2cba90&quot; /&gt; &lt;HexParent color=&quot;#2c9dba&quot; /&gt; &lt;/div&gt;, document.querySelector(&quot;#container&quot;) ); &lt;/script&gt; </code></pre>
[ { "answer_id": 74159017, "author": "Nicholas Tower", "author_id": 3794812, "author_profile": "https://Stackoverflow.com/users/3794812", "pm_score": 0, "selected": false, "text": "style={{\n isVisible: this.state.isVisible ? \"true\" : \"false\",\n}}\n" }, { "answer_id": 74159030...
2022/10/21
[ "https://Stackoverflow.com/questions/74158960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15385868/" ]
74,158,965
<p>I want to implement boolean logic and dependent variables into a Mixed-Integer Linear Program with <a href="https://scipy.github.io/devdocs/reference/generated/scipy.optimize.milp.html" rel="nofollow noreferrer">scipy.optimize.milp</a> using a highs solver.</p> <p>How do I set the actual matrices and vectors c, A_ub, b_ub, A_eq, b_eq to fit these exemplary Boolean operations of the exemplary MILP:</p> <p>Boolean variables: a, b, c, d, e, f, g, h, i, j, k, l</p> <p>Minimize 1a+1b+...+1l</p> <p>such that:</p> <p>a OR b</p> <p>c AND d</p> <p>e XOR f</p> <p>g NAND h</p> <p>i != j</p> <p>k == l</p> <p>a,b,...,l are set to integers via the integrality parameter:</p> <p><code>integrality=np.repeat(3, 12+amount_of_helper_variables</code>)</p> <p>And the lower and upper bounds are set to match boolean values 1 or 0 only:</p> <p>Forall x in {a,b,...,l}: 0 &lt;= x &lt;= 1</p> <p>I figured <a href="https://cs.stackexchange.com/questions/12102/express-boolean-logic-operations-in-zero-one-integer-linear-programming-ilp">this CS post</a> might help a lot as a general building guide, especially for solvers taking arbitrary formula input formats, but didn't get far myself with the conversion to standard matrix form until now.</p> <p>I'm asking for a generalizable approach for conversion that basically can be used as a helper method for array creation and doesn't just apply to the stated problem but all boolean formula conversions for standard matrix form MILP using <code>np.array</code>s to juggle the variables and helpers around.</p>
[ { "answer_id": 74159017, "author": "Nicholas Tower", "author_id": 3794812, "author_profile": "https://Stackoverflow.com/users/3794812", "pm_score": 0, "selected": false, "text": "style={{\n isVisible: this.state.isVisible ? \"true\" : \"false\",\n}}\n" }, { "answer_id": 74159030...
2022/10/21
[ "https://Stackoverflow.com/questions/74158965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11156631/" ]
74,158,985
<p>Converting a numeric feature into a categorical binned feature is pretty simple when using pandas.cut(). However, say you want to do the opposite by converting a binned object feature into a numeric categorical feature (1, 2, 3, 4... etc.), what would be the easiest way to do so?</p> <p>Distinct binned categories: <code>[&quot;0-9%&quot;, &quot;10-19%&quot;, &quot;20-29%&quot;, &quot;30-39%&quot;, &quot;40-49%&quot;, &quot;50-59%&quot;, etc...]</code></p> <p>There are many methods <em>naïve</em> methods that springs to mind to solve this problem. E.g, running a for-loop with if-statements:</p> <pre><code>temp = [] for i in list1: if i == &quot;0-9%&quot;: temp.append(1) elif i == &quot;10-19%&quot;: temp.append(2) elif i == &quot;20-29%&quot;: temp.append(3) etc...... </code></pre> <p>Or by creating a dictionary with each distinct binned category as keys and using their index values as values:</p> <pre><code>temp = {} for v, k in enumerate(pd.unique(list1)): temp[k] = v+1 # +1 just to skip first value 0 list1 = [temp[bin] for bin in list1] </code></pre> <p>These two methods feel, however, a bit naïve and I'm curious to whether there are simpler solutions to this issue?</p>
[ { "answer_id": 74159017, "author": "Nicholas Tower", "author_id": 3794812, "author_profile": "https://Stackoverflow.com/users/3794812", "pm_score": 0, "selected": false, "text": "style={{\n isVisible: this.state.isVisible ? \"true\" : \"false\",\n}}\n" }, { "answer_id": 74159030...
2022/10/21
[ "https://Stackoverflow.com/questions/74158985", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19277819/" ]
74,158,999
<p>I have a test LINQ list below</p> <pre><code>List&lt;test&gt; test=new List&lt;test&gt;(); test.Add(new test(&quot;Bakery&quot;,&quot;bakery@store.com&quot;,&quot;Donut&quot;)); test.Add(new test(&quot;Bakery&quot;,&quot;bakery@store.com&quot;,&quot;Bagel&quot;)); test.Add(new test(&quot;Bakery&quot;,&quot;bakery@store.com&quot;,&quot;Cake&quot;)); test.Add(new test(&quot;Produce&quot;,&quot;produce@store.com&quot;,&quot;Apple&quot;)); test.Add(new test(&quot;Dairy&quot;,&quot;dairy@store.com&quot;,&quot;Milk&quot;)); test.Add(new test(&quot;Dairy&quot;,&quot;dairy@store.com&quot;,&quot;Yogurt&quot;)); </code></pre> <p>Some departments have more than 1 item. How can loop through the list and send 1 email to each department/email address with the item(s). Send 1 email to bakery@store.com with Donut, Bagel, Cake in the body. Send 1 email to produce@store.com with Apple in the body. Send 1 email to dairy@store.com with Milk, Yogurt in the body</p> <p>I don't need help with the email part, just need help to loop through the list and get items per department. Thank you very much!!!</p>
[ { "answer_id": 74159017, "author": "Nicholas Tower", "author_id": 3794812, "author_profile": "https://Stackoverflow.com/users/3794812", "pm_score": 0, "selected": false, "text": "style={{\n isVisible: this.state.isVisible ? \"true\" : \"false\",\n}}\n" }, { "answer_id": 74159030...
2022/10/21
[ "https://Stackoverflow.com/questions/74158999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20302782/" ]
74,159,000
<p>I have three files</p> <ol> <li>My python file running in an unimportant different folder: C:\DD\CC\BB\AA\code.py</li> <li>A playlist file &quot;C:\ZZ\XX\Playlist.pls&quot; which points to ....\mp3\song.mp3</li> <li>The C:\mp3\song.mp3 file.</li> </ol> <p>What I want is to get the location of the mp3 as an absolute path. But every attemp I try I get everything related to whenever the code.py file is.</p> <pre><code>import pathlib plMaster = pathlib.Path(r&quot;C:\ZZ\XX\Playlist.pls&quot;) plSlave = pathlib.Path(r&quot;..\..\mp3\song.mp3&quot;) </code></pre> <p>I have tried plSlave.absolute() and gives me &quot;C:\DD\CC\BB\AA....\mp3\song.mp3&quot; Using relative_to doesn't work. I feel like I am doing such an easy task but I must be missing something because I can't find any function that lets me set <strong>the reference</strong> to compute the relative path.</p> <p>Note: I already have parsed the pls file, and have the string r&quot;....\mp3\song.mp3&quot; extracted. I just need to get the path &quot;C:\mp3\song.mp3&quot; knowing that they are relative to the pls. (Not relative to the code.py)</p>
[ { "answer_id": 74159394, "author": "sj95126", "author_id": 13843268, "author_profile": "https://Stackoverflow.com/users/13843268", "pm_score": 3, "selected": true, "text": "plMaster" }, { "answer_id": 74159397, "author": "scotscotmcc", "author_id": 15804190, "author_p...
2022/10/21
[ "https://Stackoverflow.com/questions/74159000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6602396/" ]
74,159,003
<p>I am working on setting iframe and stuck with local testing. I have my app running on localhost:3000</p> <p>I have setup Iframe in my app with src url set to localhost:1234 for local testing. I was hoping accessing via local host would resolve the cross origin error but looks like since port numbers are different, this doesn't seem to work</p> <p>SecurityError: Blocked a frame with origin &quot;http://localhost:3000&quot; from accessing a cross-origin frame.</p> <p>I have looked into various stack overflow posts and tried disabling chrome web security, even then this doesn't seem to let me do some local testing.</p> <p>Any suggestions on how to prevent the cross origin error in this case?</p> <p>Thanks!</p>
[ { "answer_id": 74185801, "author": "Gabor Lengyel", "author_id": 6570042, "author_profile": "https://Stackoverflow.com/users/6570042", "pm_score": 2, "selected": false, "text": "localhost:3000" } ]
2022/10/21
[ "https://Stackoverflow.com/questions/74159003", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4812174/" ]
74,159,019
<p>I have a carousel slider on my HTML page and I'd like to make it so each slide is a div containing multiple images, something like this:</p> <p><a href="https://i.stack.imgur.com/j8psF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j8psF.png" alt="enter image description here" /></a></p> <p>I've already tried adding this to each <code>carousel-item</code> div inside the carousel:</p> <pre><code>&lt;div class=&quot;carousel-item active&quot;&gt; &lt;div class=&quot;d-block h-100&quot;&gt; &lt;img src=&quot;images/mario_strikers.jpg&quot;&gt; &lt;img src=&quot;images/mario_strikers.jpg&quot;&gt; &lt;img src=&quot;images/mario_strikers.jpg&quot;&gt; &lt;img src=&quot;images/mario_strikers.jpg&quot;&gt; &lt;img src=&quot;images/mario_strikers.jpg&quot;&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>but it didn't quite work and I'm not sure that's the right way either. Is it even possible? How could I do that?</p>
[ { "answer_id": 74159151, "author": "Paul P.", "author_id": 19293489, "author_profile": "https://Stackoverflow.com/users/19293489", "pm_score": 1, "selected": false, "text": "<html lang=\"en\">\n\n<head>\n <meta charset=\"UTF-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge...
2022/10/21
[ "https://Stackoverflow.com/questions/74159019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6763451/" ]
74,159,033
<p>I want display the data of the items listed in the <em><strong>show_list</strong></em> array. Obviously this code won't work. Any easy way to make it work?</p> <pre><code>import panda as pd show_list=['Apple', 'Orange'] data = { &quot;Apple&quot;: [1,2,3], &quot;Banana&quot;: [4,5,6], &quot;Orange&quot;: [7,8,9] } df=pd.DataFrame(data) for item in show_list: print(df.item) </code></pre>
[ { "answer_id": 74159151, "author": "Paul P.", "author_id": 19293489, "author_profile": "https://Stackoverflow.com/users/19293489", "pm_score": 1, "selected": false, "text": "<html lang=\"en\">\n\n<head>\n <meta charset=\"UTF-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge...
2022/10/21
[ "https://Stackoverflow.com/questions/74159033", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20304336/" ]
74,159,049
<p>Keep only the last record if the values occurs continuously.</p> <p>Input_df:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Date</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>2022/01/01</td> <td>5</td> </tr> <tr> <td>2022/01/03</td> <td>4</td> </tr> <tr> <td>2022/01/05</td> <td>3</td> </tr> <tr> <td>2022/01/06</td> <td>3</td> </tr> <tr> <td>2022/01/07</td> <td>3</td> </tr> <tr> <td>2022/01/08</td> <td>4</td> </tr> <tr> <td>2022/01/09</td> <td>3</td> </tr> </tbody> </table> </div> <p>Output_df:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Date</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>2022/01/01</td> <td>5</td> </tr> <tr> <td>2022/01/03</td> <td>4</td> </tr> <tr> <td>2022/01/07</td> <td>3</td> </tr> <tr> <td>2022/01/08</td> <td>4</td> </tr> <tr> <td>2022/01/09</td> <td>3</td> </tr> </tbody> </table> </div> <p>-- The value 3 repeats continuously for 3 dates, so we only keep the latest record out of the three continuous dates and if there is a different value transmitted in between the continuity breaks, so do not delete the record.</p>
[ { "answer_id": 74159147, "author": "Adrien Riaux", "author_id": 20212187, "author_profile": "https://Stackoverflow.com/users/20212187", "pm_score": 2, "selected": true, "text": "pandas.Series.diff" }, { "answer_id": 74160423, "author": "Himanshu", "author_id": 10497483, ...
2022/10/21
[ "https://Stackoverflow.com/questions/74159049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10931314/" ]
74,159,062
<p><strong>So my question is:</strong> how to validate/verify the layout for an offline situation <strong>while</strong> ensuring that no network connection will be necessary in the offline installation scenario (i.e. <em>at least</em> <code>--noweb</code>)?</p> <p>NB: to be certain I also like to turn off network anyway while validating (from within a VM), but the idea behind <code>--noweb</code> appears to be <em>that</em>.</p> <h3>Background</h3> <p>I prefer to create an offline installation for Visual Studio, which combines the different editions in one .iso (UDF) file. It works generally nicely thanks to the duplication across editions which <code>mkisofs</code> can deduplicate via <code>-duplicates-once</code>; and packers will be able to achieve the same if they know how to handle hardlinks, after a treatment with <code>hardlink</code> or <code>dfhl</code> or similar tools. The resulting .iso for VS 2022 (17.3.6) for example is a mere 36 GiB in size, including the editions: Build Tools (&quot;28 GiB&quot;), Community (&quot;35 GiB&quot;), Professional (&quot;35 GiB&quot;) and Enterprise (&quot;35 GiB&quot;). The hardlinking process saves a little over 100 GiB altogether.</p> <p>Since I typically get at least a handful of of download errors <a href="https://learn.microsoft.com/visualstudio/install/create-an-offline-installation-of-visual-studio" rel="nofollow noreferrer">during a single run</a>, I tend to run the initial <code>vs_&lt;Edition&gt;.exe --layout %CD%\vs2022\&lt;Edition&gt; --lang en-us</code> command at least twice until I see the final success message. Twice is usually sufficient to get to see that.</p> <p>However, now I would like to make sure that each individual layout is truly valid for offline installation. Alas, <a href="https://learn.microsoft.com/visualstudio/install/use-command-line-parameters-to-install-visual-studio#layout-command-and-command-line-parameters" rel="nofollow noreferrer">the help page</a> isn't exactly helpful for the scenario and the command I came up with doesn't seem to do anything.</p> <p>Executed from <code>cmd.exe</code> (no matter if elevated or not) and from within the directory specified in <code>--layout</code> during preparation:</p> <pre><code>.\vs_setup.exe --layout %CD% --verify --noweb --passive --lang en-us </code></pre> <p>NB: I also tried <em>with</em> <code>--nocache</code>, <em>without</em> <code>--passive</code> and <em>without</em> <code>--lang en-us</code> (the original layout was generated only for that language, so I assumed it has to be given).</p> <p>In all cases I briefly see a dialog come up with a progress bar indicating that stuff gets loaded and unpacked into <code>%LOCALAPPDATA%\Temp</code> (makes sense given the read-only media), but then there is silence and the respective process appears to quit without doing anything. So I don't even get an indication of what I may have invoked incorrectly. I also checked the event log but returned empty-handed.</p> <p>I am asking the question specifically for VS 2019 and 2022, but the bootstrappers seem to be largely unified anyway. So pick one of those versions to answer.</p> <p>PS: Alternatively it would also help if you showed me how to turn up verbosity so that I can diagnose why the invoked program quietly quits.</p> <hr /> <p>Tried the following both while the network was connected and not; where <code>X:</code> was the mounted <code>.iso</code> file. All ended up failing silently without any indication of what's wrong as per the above description. No UAC elevation prompt appeared either.</p> <ul> <li><code>X:\Professional\vs_setup.exe --layout X:\Professional --verify --noweb --lang en-us</code></li> <li><code>X:\Enterprise\vs_setup.exe --layout X:\Enterprise --verify --noweb --lang en-us</code></li> <li><code>X:\BuildTools\vs_setup.exe --layout X:\BuildTools --verify --noweb --lang en-us</code></li> <li><code>X:\Community\vs_setup.exe --layout X:\Community --verify --noweb --lang en-us</code></li> </ul> <p>I tried this on two different VMs, and also with an already elevated prompt as well as a normal prompt. The results were the same as described in the initial question for all combinations (i.e. editions, offline/online, elevated/not).</p>
[ { "answer_id": 74178467, "author": "Jingmiao Xu-MSFT", "author_id": 17296043, "author_profile": "https://Stackoverflow.com/users/17296043", "pm_score": 0, "selected": false, "text": ".\\vs_setup.exe --layout C:\\Demo --verify --noweb --lang en-us\n" }, { "answer_id": 74181032, ...
2022/10/21
[ "https://Stackoverflow.com/questions/74159062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/476371/" ]
74,159,063
<p>For removing everything between parentheses, currently i use:</p> <pre><code>SELECT REGEXP_REPLACE('(aaa) bbb (ccc (ddd) / eee)', &quot;\\([^()]*\\)&quot;, &quot;&quot;); </code></pre> <p>Which is incorrect, because it gives <code>bbb (ccc / eee)</code>, as that removes inner parentheses only.</p> <p>How to remove everynting between nested parentheses? so expected result from this example is <code>bbb</code></p>
[ { "answer_id": 74159263, "author": "holem", "author_id": 8312809, "author_profile": "https://Stackoverflow.com/users/8312809", "pm_score": 1, "selected": false, "text": "let r = /\\((?:(?:\\((?:[^()])*\\))|(?:[^()]))*\\)/g\nlet s = \"(aaa) bbb (ccc (ddd) / eee)\"\nconsole.log(s.replace(r...
2022/10/21
[ "https://Stackoverflow.com/questions/74159063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1609729/" ]
74,159,075
<p>I am trying to remove the YouTube embed Title and Watch Later things, Basically the <code>header</code> element. After lots of research I did not find any solution to remove it. It's depreciated in 2018. Anyways I made some logic to remove it, But I did not know how can I do that, I've used so many methods but did not works so I decided to post here.</p> <p>The logic is- iFrame has a class called <code>.ytp-chrome-top</code> If you right click on the title you will see something like shown in Image 1. After that if you have added jQuery in your page you can simply remove the <code>div</code> from the console with this code - <code>$('.ytp-chrome-top').remove()</code></p> <p>The another way to remove it with css, See the Image 2, I have added <code>display: none</code> to it and it's removed. But the main problem is, You can't define the code from your page, It'll not work. You have to run it after loading the page (Client Side). Is there any way to load a script in console after loading the page?? Or inject a CSS to the page after loading the page. I just wanted to put two lines of code, It'll solve the problem.</p> <p>Note: Please don't suggest <code>plyr.io</code> or <code>video.js</code> They provide good players but the don't have the quality changing option.</p> <p>Please help me out from this issue, It'll very helpful for me! Thank you in advance!</p> <p>Current HTML</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt; &lt;head&gt; &lt;meta charset=&quot;UTF-8&quot;&gt; &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt; &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt; &lt;title&gt;Document&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;iframe width=&quot;100%&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/M5QY2_8704o&quot; title=&quot;YouTube video player&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen&gt;&lt;/iframe&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><a href="https://i.stack.imgur.com/1r9qO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1r9qO.png" alt="Image 1" /></a></p> <p><a href="https://i.stack.imgur.com/TWt6D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TWt6D.png" alt="Image 2" /></a></p>
[ { "answer_id": 74159263, "author": "holem", "author_id": 8312809, "author_profile": "https://Stackoverflow.com/users/8312809", "pm_score": 1, "selected": false, "text": "let r = /\\((?:(?:\\((?:[^()])*\\))|(?:[^()]))*\\)/g\nlet s = \"(aaa) bbb (ccc (ddd) / eee)\"\nconsole.log(s.replace(r...
2022/10/21
[ "https://Stackoverflow.com/questions/74159075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8496348/" ]
74,159,082
<p>can someone please explain to me what is the setAttribute arguments here? I know only that .png is the extension of the image that I will include later in my code.</p> <pre><code>function setImg(dieImg) { var value = Math.floor( 1 + Math.random()*6); dieImg.setAttribute( &quot;src&quot; , &quot;die&quot; + value + dieImg.setAttribute( &quot;alt&quot; , &quot;die Image with &quot; + value + &quot;spot(s)&quot;); } </code></pre>
[ { "answer_id": 74159263, "author": "holem", "author_id": 8312809, "author_profile": "https://Stackoverflow.com/users/8312809", "pm_score": 1, "selected": false, "text": "let r = /\\((?:(?:\\((?:[^()])*\\))|(?:[^()]))*\\)/g\nlet s = \"(aaa) bbb (ccc (ddd) / eee)\"\nconsole.log(s.replace(r...
2022/10/21
[ "https://Stackoverflow.com/questions/74159082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19934886/" ]
74,159,092
<p>I have a problem to deploy TED in a specific database. I put them in the <em>schemas/tde</em> subdirectory of the database associated with my content database.</p> <p>All is OK with the ml-gradle version 4.3.4, but when I update to use the 4.3.5 version, I have an error :</p> <blockquote> <p>Unable to load and validate TDE templates via tde.templateBatchInsert; cause: Local message: failed to apply resource at eval: Internal Server Error. Server Message: Server (not a REST instance?) did not respond with an expected REST Error message</p> </blockquote> <p>I think it's because this new version uses templateBatchInsert.</p> <p>The problem seems to appear only when I deploy on an AWS server. Does anyone have this problem?</p>
[ { "answer_id": 74163483, "author": "rjrudin", "author_id": 3306099, "author_profile": "https://Stackoverflow.com/users/3306099", "pm_score": 1, "selected": false, "text": "tde.templateBatchInsert" } ]
2022/10/21
[ "https://Stackoverflow.com/questions/74159092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17769810/" ]
74,159,093
<p>I have a bit of an issue. I am trying to develop some code that will allow me to do the following: 1) run a logistic regression analysis, 2) extract the estimates from the logistic regression analysis, and 3) use those estimates to create another logistic regression formula that I can use in a subsequent simulation of the original model. As I am, relatively new to R, I understand I can extract these coefficients 1-by-1 through indexing, but it is difficult to &quot;scale&quot; this to models with different numbers of coefficients. I am wondering if there is a better way to extract the coefficients and setup the formula. Then, I would have to develop the actual variables, but the development of these variables would have to be flexible enough for any number of variables and distributions. This appears to be easily done in Mplus (example 12.7 in the Mplus manual), but I haven't figured this out in R. Here is the code for as far as I have gotten:</p> <pre><code>#generating the data set.seed(1) gender &lt;- sample(c(0,1), size = 100, replace = TRUE) age &lt;- round(runif(100, 18, 80)) xb &lt;- -9 + 3.5*gender + 0.2*age p &lt;- 1/(1 + exp(-xb)) y &lt;- rbinom(n = 100, size = 1, prob = p) #grabbing the coefficients from the logistic regression model matrix_coef &lt;- summary(glm(y ~ gender + age, family = &quot;binomial&quot;))$coefficients the_estimates &lt;- matrix_coef[,1] the_estimates the_estimates[1] the_estimates[2] the_estimates[3] </code></pre> <p>I just cannot seem to figure out how to have R create the formula with the variables (x's) and the coefficients from the original model in a flexible manner to accommodate any number of variables and different distributions. This is <strong>not</strong> class assignment, but a necessary piece for the research that I am producing. Any help will be greatly appreciated, and please, treat this as a teaching moment. I really want to learn this.</p>
[ { "answer_id": 74159304, "author": "Ben Bolker", "author_id": 190277, "author_profile": "https://Stackoverflow.com/users/190277", "pm_score": 2, "selected": true, "text": "simulate()" }, { "answer_id": 74159580, "author": "twelve.watercress", "author_id": 20284476, "a...
2022/10/21
[ "https://Stackoverflow.com/questions/74159093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20020153/" ]
74,159,098
<p>I have the following data (I purposely created a DateTime column from the string column of dates because that's how I am receiving the data):</p> <pre><code> import numpy as np import pandas as pd data = pd.DataFrame({&quot;String_Date&quot; : ['10/12/2021', '9/21/2021', '2/12/2010', '3/25/2009']}) #Create DateTime columns data['Date'] = pd.to_datetime(data[&quot;String_Date&quot;]) data String_Date Date 0 10/12/2021 2021-10-12 1 9/21/2021 2021-09-21 2 2/12/2010 2010-02-12 3 3/25/2009 2009-03-25 </code></pre> <p>I want to add the following &quot;Month &amp; Year Date&quot; column with entries that are comparable (i.e. can determine whether Oct-12 &lt; Sept-21):</p> <pre><code> String_Date Date Month &amp; Year Date 0 10/12/2021 2021-10-12 Oct-12 1 9/21/2021 2021-09-21 Sept-21 2 2/12/2010 2010-02-12 Feb-12 3 3/25/2009 2009-03-25 Mar-25 </code></pre> <p>The &quot;Month &amp; Year Date&quot; column doesn't have to be in the exact format I show above (although bonus points if it does), just as long as it shows both the month (abbreviated name, full name, or month number) and the year in the same column. Most importantly, I want to be able to groupby the entries in the &quot;Month &amp; Year Date&quot; column so that I can aggregate data in my original data set across every month.</p>
[ { "answer_id": 74159304, "author": "Ben Bolker", "author_id": 190277, "author_profile": "https://Stackoverflow.com/users/190277", "pm_score": 2, "selected": true, "text": "simulate()" }, { "answer_id": 74159580, "author": "twelve.watercress", "author_id": 20284476, "a...
2022/10/21
[ "https://Stackoverflow.com/questions/74159098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20188834/" ]
74,159,104
<p>I created a simple grid with grid-items. Some grid-items (divs) should be clickable, therefore I added an anchor tag inside the grid-items.</p> <p>The anchor should be as large as the parent div, so I set <em>height</em> and <em>width</em> properties of the anchor to <em>100%</em>.</p> <p>It works perfectly fine and as expected on Desktop browsers (see code snippet). But on mobile browsers <a href="https://i.stack.imgur.com/B8olc.jpg" rel="nofollow noreferrer">it looks like this</a>.</p> <p>On mobile the below code snippet also shows this effect, so <a href="https://i.stack.imgur.com/iHJR3.png" rel="nofollow noreferrer">here's a picture</a> of how it looks on desktop.</p> <p>Why is the anchor larger than the parent div? How can I avoid this?</p> <p>Strangely enough it only affects <em>height</em>, but not <em>width</em>.</p> <p>Thank you :)</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.grid { display: grid; grid-template-columns: repeat(3, 1fr); height: 250px; width: 250px; margin: 50px; border: 3px solid black; } .grid-item { display: flex; justify-content: center; align-items: center; border: 2px solid black; aspect-ratio: 1; } .grid-item &gt; a { display: flex; flex-direction: column; justify-content: center; text-align: center; background: lightsalmon; color: black; height: 100%; width: 100%; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt; &lt;link rel="stylesheet" href="/style.css"&gt; &lt;title&gt;Random Website Title&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="grid"&gt; &lt;div class="grid-item"&gt;&lt;/div&gt; &lt;div class="grid-item"&gt;&lt;a href=#&gt;LINK&lt;/a&gt;&lt;/div&gt; &lt;div class="grid-item"&gt;&lt;/div&gt; &lt;div class="grid-item"&gt;&lt;/div&gt; &lt;div class="grid-item"&gt;&lt;/div&gt; &lt;div class="grid-item"&gt;&lt;/div&gt; &lt;div class="grid-item"&gt;&lt;/div&gt; &lt;div class="grid-item"&gt;&lt;/div&gt; &lt;div class="grid-item"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p>
[ { "answer_id": 74160122, "author": "Vladimir", "author_id": 19636184, "author_profile": "https://Stackoverflow.com/users/19636184", "pm_score": 0, "selected": false, "text": ".grid-item > a" }, { "answer_id": 74166932, "author": "blinkydude", "author_id": 20304371, "a...
2022/10/21
[ "https://Stackoverflow.com/questions/74159104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20304371/" ]
74,159,127
<p>I am trying to deserialize the following json into a C# object? I need to read density and the coordinates. Can someone please check if the json is correct and the best way to get the data into C# object?</p> <pre><code>{{ &quot;geometry&quot;: { &quot;type&quot;: &quot;Point&quot;, &quot;coordinates&quot;: [ 51.5570726284386, 25.39156280708102 ] }, &quot;density&quot;: 1 }} </code></pre> <p>Thanks.</p>
[ { "answer_id": 74160122, "author": "Vladimir", "author_id": 19636184, "author_profile": "https://Stackoverflow.com/users/19636184", "pm_score": 0, "selected": false, "text": ".grid-item > a" }, { "answer_id": 74166932, "author": "blinkydude", "author_id": 20304371, "a...
2022/10/21
[ "https://Stackoverflow.com/questions/74159127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13586481/" ]
74,159,133
<p><strong>The Problem</strong></p> <p>I need to update a table so that any duplicate rows are updated to have unique values.</p> <p><strong>The Catch</strong></p> <p>I need to dynamically ensure that the value I am updating the duplicate row to is also unique.</p> <p><strong>My Solution So Far</strong> (with test case)</p> <pre><code>CREATE TABLE #temp (name nvarchar(100), ID uniqueidentifier) INSERT INTO #temp (Name, ID) VALUES ('Duplicate', '32208C09-C0C3-408C-AB60-273811722194') INSERT INTO #temp (Name, ID) VALUES ('Duplicate', '32208C09-C0C3-408C-AB60-273811722194') INSERT INTO #temp (Name, ID) VALUES ('Duplicate (2)', '32208C09-C0C3-408C-AB60-273811722194') ;WITH cte AS ( SELECT Name , ROW_NUMBER() OVER (PARTITION BY Name, ID ORDER BY Name) RowNum FROM #temp ) UPDATE cte SET Name = CONCAT(Name, ' (', RowNum, ')') WHERE RowNum &gt; 1 SELECT * FROM #temp DROP TABLE #temp </code></pre> <p>As you can tell, this will update the table so there is only one row with the name 'Duplicate' but two rows with the name 'Duplicate (2)'. How can I check and account for duplicates in the value I am updating to?</p>
[ { "answer_id": 74159439, "author": "Dale K", "author_id": 1127428, "author_profile": "https://Stackoverflow.com/users/1127428", "pm_score": 1, "selected": false, "text": "'Duplicate (2)'" }, { "answer_id": 74159526, "author": "Hogan", "author_id": 215752, "author_prof...
2022/10/21
[ "https://Stackoverflow.com/questions/74159133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16167175/" ]
74,159,180
<p>The goal is to convert the date format <code>%Y-%m-%s %H:%M:%S %z</code> to seconds since EPOCH with POSIX tools.</p> <p>I currently have a problem with the formula from the POSIX's <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16" rel="nofollow noreferrer">Seconds Since the Epoch</a>: I get a different result than GNU/BSD <code>date</code>.</p> <p>Here's my code, simplified for testing purposes:</p> <pre class="lang-bash prettyprint-override"><code>#!/bin/bash TZ=UTC date $'+ date: %Y-%m-%d %T %z \nexpect: %s \n %Y %j %H %M %S %z' | awk ' NR &lt;= 2 { print; next } { # $0: &quot;YYYY jjj HH MM SS zzzzz&quot; $1 -= 1900 epoch = $5 + $4*60 + $3*3600 + int($2 + ($1-70)*365 + ($1-69)/4 - ($1-1)/100 + ($1+299)/400)*86400 print &quot;result:&quot;, epoch } ' </code></pre> <pre><code> date: 2022-10-21 22:02:56 +0000 expect: 1666389776 result: 1666476176 </code></pre> <p>What am I doing wrong?</p>
[ { "answer_id": 74159439, "author": "Dale K", "author_id": 1127428, "author_profile": "https://Stackoverflow.com/users/1127428", "pm_score": 1, "selected": false, "text": "'Duplicate (2)'" }, { "answer_id": 74159526, "author": "Hogan", "author_id": 215752, "author_prof...
2022/10/21
[ "https://Stackoverflow.com/questions/74159180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3387716/" ]
74,159,214
<p>I am trying to write a code to calculate the average of the height of the student that is my code</p> <pre><code> height = input(&quot;what is your higth\n&quot;).split() for n in range(0, len(height)): height[n] = int(height[n]) print(height) t = 0 for i in height: t += height print(height) </code></pre> <p>and I have error</p> <pre><code> t += higths TypeError: unsupported operand type(s) for +=: 'int' and 'list' </code></pre>
[ { "answer_id": 74159439, "author": "Dale K", "author_id": 1127428, "author_profile": "https://Stackoverflow.com/users/1127428", "pm_score": 1, "selected": false, "text": "'Duplicate (2)'" }, { "answer_id": 74159526, "author": "Hogan", "author_id": 215752, "author_prof...
2022/10/21
[ "https://Stackoverflow.com/questions/74159214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20304483/" ]
74,159,223
<p>The goal is to have my text boxes be grey when there is no content in them, and white when the user starts typing in them.</p> <p>There is also another issue, when my text box is active the cursor and icon go to the default Flutter blue color. I need them to go to a custom color.</p> <p>main.dart</p> <pre><code> Widget build(BuildContext context) { SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, ]); return ChangeNotifierProvider( create: (_) =&gt; AppData(), child: MaterialApp( title: 'Pearmonie', theme: ThemeData( // This is the theme of your application. // // Try running your application with &quot;flutter run&quot;. You'll see the // application has a blue toolbar. Then, without quitting the app, try // changing the primarySwatch below to Colors.green and then invoke // &quot;hot reload&quot; (press &quot;r&quot; in the console where you ran &quot;flutter run&quot;, // or simply save your changes to &quot;hot reload&quot; in a Flutter IDE). // Notice that the counter didn't reset back to zero; the application // is not restarted. primaryColor: Color(0xFF623CEA), fontFamily: 'Manrope', inputDecorationTheme: InputDecorationTheme( ), ), home: const Splash(), )); } </code></pre> <p>a textformfield</p> <pre><code>Container( width: inputWidth, padding: EdgeInsets.symmetric(horizontal: 5), decoration: BoxDecoration(color: Colors.grey.shade200, borderRadius: BorderRadius.circular(15)), child: TextFormField( focusNode: firstNameNode, autofocus: false, controller: firstNameController, obscureText: false, textAlignVertical: TextAlignVertical.center, decoration: InputDecoration( prefixIcon: Icon(Icons.person_outline), border: InputBorder.none, hintText: &quot;Full Name&quot;, ), onFieldSubmitted: (value) { phoneNode.requestFocus(); }, ), ), </code></pre> <p>Things I have tried:</p> <ol> <li>Adding focusColor directly to the TextFormField</li> <li>Adding focusColor to ThemeData and InputDecorationTheme</li> </ol>
[ { "answer_id": 74159439, "author": "Dale K", "author_id": 1127428, "author_profile": "https://Stackoverflow.com/users/1127428", "pm_score": 1, "selected": false, "text": "'Duplicate (2)'" }, { "answer_id": 74159526, "author": "Hogan", "author_id": 215752, "author_prof...
2022/10/21
[ "https://Stackoverflow.com/questions/74159223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18246750/" ]
74,159,244
<p>I want to select the same 3 variables from dflist 1-4. dflist is the list containing 4 datasets I have already loaded. i wrote a code to achieve it. My code like this:</p> <pre><code>dfmul&lt;-rbind(dflist[[1]][,c(&quot;siteid_public&quot;,&quot;childid_public&quot;,&quot;round&quot;)], dflist[[2]][,c(&quot;siteid_public&quot;,&quot;childid_public&quot;,&quot;round&quot;)], dflist[[3]][,c(&quot;siteid_public&quot;,&quot;childid_public&quot;,&quot;round&quot;)], dflist[[4]][,c(&quot;siteid_public&quot;,&quot;childid_public&quot;,&quot;round&quot;)]) </code></pre> <p>But this looks very chunky and not efficient. Can someone help to figure out how to I simplify it? Thanks a lot~~!</p>
[ { "answer_id": 74159439, "author": "Dale K", "author_id": 1127428, "author_profile": "https://Stackoverflow.com/users/1127428", "pm_score": 1, "selected": false, "text": "'Duplicate (2)'" }, { "answer_id": 74159526, "author": "Hogan", "author_id": 215752, "author_prof...
2022/10/21
[ "https://Stackoverflow.com/questions/74159244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16808528/" ]
74,159,246
<p>I've read so many posts about pytest and ModuleNotFoundError and tried all the advices I've found so far. Now I feel totally lost. So I hope someone can help me out getting the correct answer.</p> <p>This is my project structure trying to follow <a href="https://docs.pytest.org/en/7.1.x/explanation/goodpractices.html" rel="nofollow noreferrer">good practice</a>:</p> <pre class="lang-none prettyprint-override"><code>myproject/ pyproject.toml #(with [tool.pytest.ini_options] / pythonpath = [&quot;src&quot;]) setup.py setup.cfg #(with [options] / include_package_data = True / package_dir=src / packages=find:) src/ conftest.py #(tried with and without this empty file) myproject/ __init__.py myproject.py ui/ __init__.py ui_main.py ui_div.py scripts/ __init__.py calculations.py # with: from config import constants config/ __init__.py constants.py tests/ __init__.py test_calculation.py # trying to: from scripts import calculations </code></pre> <p>The application is running and imports are working. Then when trying to test with pytest the methods in <code>calculations.py</code> I struggle with the imports.</p> <pre class="lang-py prettyprint-override"><code># test_calculation.py from scripts import calculations </code></pre> <p>and it fails on <code>ModuleNotFoundError</code> of <code>scripts</code>. I have also tried to set</p> <pre class="lang-py prettyprint-override"><code>from src.myproject.scripts import calculations </code></pre> <p>This remove the <code>ModulNotFoundError</code> of 'scripts' (if running <code>python -m pytest</code>), but just stops at another <code>ModuleNotFoundError</code> of <code>config</code> when trying to import <code>config.constants</code> in <code>calculations.py</code>. Then I'm stuck again.</p> <p>I have a virtual environment and am at the project top-level folder. I am using Anaconda with CMD prompt using <code>python -m pytest</code>. pytest is uninstalled in (base) and installed in (venv).</p> <p>I have run <code>pip install -e .</code></p> <p>I have deactivated/activated (venv) after installing pytest.</p> <p>I have tried with and without this in <code>tests/__init__.py</code>.</p> <pre class="lang-py prettyprint-override"><code>import sys, os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../src/myproject'))) </code></pre> <p>and without /myproject.</p> <p>I have tried the different settings indicated as comments in the folder structure above.</p> <p>Maybe some combination of all this would work, but now I'm so fed up from hours of testing and failing realizing that I really do not understand this. Also the the posts I'm reading with 'just do this' and 'just do that' and it works for some and not for others... Any help on where I've got lost?</p> <p>I guess I could move the tests folder at the same level as the other modules to make it work, but I'd like to use the recommended project layout to leave the tests out when distributing my real project.</p>
[ { "answer_id": 74160386, "author": "larsks", "author_id": 147356, "author_profile": "https://Stackoverflow.com/users/147356", "pm_score": 1, "selected": false, "text": "myproject/\n├── pyproject.toml\n├── src\n│   └── myproject\n│   ├── __init__.py\n│   └── scripts\n│   └...
2022/10/21
[ "https://Stackoverflow.com/questions/74159246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16647870/" ]
74,159,252
<p>I have a lot of strings (thousands) that I want to make them elements of a list, such as my_list = as.list() so I can call them by index such as my_list<a href="https://i.stack.imgur.com/Ty7GU.jpg" rel="nofollow noreferrer">1</a> etc. I have tried</p> <pre><code>my_string = &quot;MTX3, ZNF623, VEPH1, GCLM, ALS2, MAP3K3, CRIP3, GNL2, RAPGEFL1, RAD54B, GCDH, WASF1, PLEKHA2, TNFRSF21, CNNM3, GTF2E2, SNHG5, NTNG1, CHL1-AS2, PALM2-AKAP2, FGFBP3, DHRSX, LNPEP, ISY1, MTERF3, ZNF780A, CCDC24, MCHR1, GTF2H1, AURKA, TYRO3, SLC31A1, RARA, NKD2, SLC25A24, AC087477.2, EID2B, NCALD, TYW3, LUZP1, VXN, RECQL4, AC027307.2, TAF1, ZFP91, TCOF1, GCLC, PPP1R12A, SLC22A18, ZNF28, AC078846.1, TMEM109, MAIP1, TRPC5OS, AEBP2, PGAM2, PPARD, TENT4A, RGS20, ANKRD35, RGS3, VPS53, MMP2, UBE2O, NUMB, AC092069.1, ARHGEF10, AURKB, TSEN54, MLPH, GPATCH8, SMURF1, TBC1D1, SNX7, AC118549.1, PRPS1, HIST2H2BE, KATNAL1, MCL1, BCL7A, SOCS4, ADPGK, ZNF667, CSNK1G3, FBXO45, APEX2, ADRA2B, SNAPC3, MIPEP, DISC1, SCAF11, AC010198.2, ZSCAN16, HPS1, ST7-AS1, SHKBP1, AC012615.1, ACKR3, FER, OSBPL7, SEC11C, SLC1A5, ZBTB44, RPUSD2, ME1, RIN2, STRN3, VIPAS39, KIF20A, PPM1M, ELMOD3, CTR9, TTC30A, TAF4, ASCC1, TOMM40L, ZNF853, SBF2, ABCF1, CXorf38, KDM3B, PLTP, SNX29, VLDLR, MEOX2, PPM1J, CLN3, UBQLN1, NIP7, ANKLE2, ZNF761, GTF3C3, VANGL2, POLR3F, ZCCHC9, NPAS2, HAS2, HS3ST3A1, METTL2B, USP40, AL139289.2, GDF15, MCMBP, UBOX5, C2orf81, LINC01551, TOE1, CA8, SRXN1, RNF207, KIAA0556, IL1R1, GID4, MAMLD1, ZNF319, ZBTB8A, CCDC58, STK32B, IL31RA, PM20D2, TEX2, RFX7, CAMK2N2, JPT1, PGGHG, PCDHB10, MRS2, KAT14, ZNF426, TCAF1, ZBTB45, DPH3, VPS37A, DLX1, YAF2, PACRGL, MED12L, NBPF11, AC026979.2, HSPA14.1, NR2E1, CACNA1E, RIPPLY1, TBX15, AC079922.2, PRPSAP2, ALAS1, TRIM32, MAP11, RTF1, NAP1L3, PPHLN1, GFOD2, AK4, DNAJB5, IMMP2L, NOP2, CRB2, SNHG18, ZNHIT6, CKAP2, SMAD4, ZNF140, BDH1, RFWD3, DYRK1A, ALDH4A1, IFI27, CCNO, DIPK1A, ZNHIT2, LARGE1, ALDH1L1-AS2, DCP1A, HMMR, DHRS7B, GALNT5, INPP5E, FRG1, FGFR3, CLK4, LONRF1, SHF, RFX2, ZNF385D, ZSCAN32, P4HA1, ZCCHC17, MIR34AHG, NSMCE4A, HJURP, BMPR1A, SAMD11, PSMB10, UBE2W, AC092119.3, SEC24D, LINC00662, CASP7, MBTD1, TMEM163, TPM3, TMEM126B, AKT3-IT1, FAM50B, TRAIP, SOX1-OT, PIK3CA, AP3M2, RNF111, RERGL, AZIN1-AS1, PTPN14, CRYBG3, RNF123, IGSF9B, EBF2, GTPBP2, SETD4, PFKP, MED22, IL11, METTL23, ZFPM1, C16orf95, SF3B5, ARHGEF4, HTRA3, TTC28, NTRK3, POLR3E, KLC2, STRBP, NLE1, AC234582.1, ARHGEF11, CFAP44, MAPK7, SLC35A3, RIT2, NKAIN3-IT1, MROH6, MBD1, CUL2, HABP4, USPL1, LIG1, SMARCA2, ITPRIPL1, AC104964.4, KLHL8, LHFPL2, CDC42SE1, NUF2, SLC35E3, INSIG2, ZNF20, RBSN, TEPSIN, UNC119, THSD1, RORB, MCTP1, ZNF668, RFC1, IFI6, MRPL45, KLHL29, TTC39B, SEC22A, IKZF4, CHAF1A, NCKAP5L, OGFRL1, NET1, C17orf75, SLC7A1, PROX1, GEMIN5, ST7, IRF2BP1, MEGF10, NUP37, TYSND1, DYRK4, POLA2, AIM2, JMJD4, PHLDB3, KLF12, KCTD6, ERMAP, NPR2, LRRC42, NFIC, PRKAR1B, MFSD14C, NR2F1-AS1, SRGAP2, THOC2, HYMAI, FBXO46, TBC1D15, FZD2, CYP7B1, HOXA6, CDK7, FBXO25, ATP10B, BTD, ATIC, TMEM245, FAM229A, INF2, FAM207A, GINS1, SOCS6, ILRUN, STXBP4, GAREM2, XKR8, APOLD1, CDH10, TMEM265, ZSCAN5A, ICK, E2F1, NR1H4, CTPS2, NELL2, CEP41, NIF3L1, HAUS1, AC018521.5, AVL9, AC010649.1, BAIAP2L1, ST7L, AVEN, HSPA12A, SGIP1, C12orf49, ARMC9, MRPS30, PYGO1, C19orf54, TSTD3, ZNF544, HAUS6, RAB32, TSPAN10, GALE, PRUNE1, LRRC37A3, SOCS7, TRUB1, TRIM13, SEC23A, MED4, C1orf53, RBMS2, QSOX2, ORC3, CEND1, PLVAP, RSRP1, STXBP3, RAD54L2, PHLPP2, BX255925.3, RNF135, RNF41, SCAMP2, ATL2, DHX29, RFX3, SMYD2, PARP16, RAB4B, ADAMTS13, SMYD3, DHRS12, PIAS4, DIP2C, CCN4, ZCCHC8, TEAD3, RC3H2, OAS3, GPR173, FGGY, ISCA1, TSPO, GAPVD1, NDUFAF7, ZNF691, CDC7, ADCY9, UBAP1L, MRRF, PHAX, CNIH2, RPS6KB1, SMC6, NOP9, SP3, LMO7, JUP, TMEM8B, CEP131, PCGF1, TYW1, TMOD1, RNASE4, LRRC28, RFK, HSPB11, ALKBH4, HNMT, MYLK, GLIPR1L2, BNIP2, PPME1, NPAS1, MPPE1, SOX9-AS1, TRIM44, ZNF106, CARMIL1, CISD2, SLC41A2, ASL, THNSL2, METAP2, LINC00323, ZNF217, FBXW4, YAE1, EXD3, SESN1, GAL3ST1, TMEM80, GNL3L, TBC1D13, INTS8, SLITRK5, WDR20, THBD, TLR4, CNTNAP3B, KLK10, NEK2, NDUFAF6, LPCAT4, ZNF398, TMEM104, PPP4R3B, FARS2, PDGFRL, C17orf80, EBLN3P, CCNY, TRIM25, CALHM2, NR1H3, LIMD1, HOMER3, LRRC8D, BTBD10, CHST11, ZNF136, ZADH2, ERCC6L2, ZNF74, CAPS, TRIM37, ACBD3, PIGP, POLR3K, PIGB, CCDC138, ZNF582-AS1, AGER, TIMELESS, VPS36, HAX1, GPRASP2, KIF14, ABCB7, HOXC4, RBM47, TXNL1, TP53INP2, AHNAK2, SFRP1, AGBL3, UBXN11, CEP76, PKDCC, IRS1, EHD4, ZBTB9, AGL, ABITRAM, FBXW9, TMCO4, BAG2, PTPRD-AS1, MAP1A, STARD4, POLR3G, UTP20, CTBP1-DT, GMDS, MED27, TGFBRAP1, ZNF671, DDX55, HNRNPF, IDH1, PRKAA2, MBNL1, NUDCD1, BET1, TMEM167B, HOXC9, BBS10, SNX10, DCAF4, COMMD7, WASF3, TERF1, DCAF6, CCDC159, SNX8, BAK1, RBBP9, SFT2D1, TPRG1L, PAQR7, MMACHC, PAFAH2, LTO1, VPS37B, FPGS, FZD6, ASPHD1, STX2, MALL, FGFR1OP, CPLANE1, CENPJ, DTX2, LRBA, RPAP3, MKRN2, RTL8B, YIPF1, CMBL, RBFA, SHQ1, BTBD6, TMEM99, TMOD2, NDEL1, AC147067.1, LRRC23, MGAT3, MED20, DCAF12, ABCA1, GJC1, RABL2B, UXT, ANGPTL2, ZSCAN9, CREBL2, MDM1, NBPF26, MOB1B, AP4S1, LINC01278, DPH7, USP54, ZNF439, FNDC1, PCCA-DT, SLC2A11, RAB2B, LMNB1, SHROOM1, LARP1B, FUT11, RFC4, AC004158.1, RALGAPA2, TBC1D19, ITGAX, GRIPAP1, CAPN10, CASK, MEG9, MTG2, TMEM250, SLC46A1, GINS4, INTS2, STRN, NIPA1, SELPLG, CCDC88A, SLAIN2, AC005306.1, AC005899.8, TOB2, TDRD3, ITGA1, ARPIN, ENG, CCDC82, FXYD7, ZNF672, CIB2, AC003991.2, F12, ABHD16A, ZNF117, TRAF2, PYGO2, DNAJC18, SATB2-AS1, ENTPD5, SENP7, TUT4, KCTD12, LMCD1-AS1, GMFB, MTTP, TMPRSS2, NUDT15, ZNF777, ARNTL, TMEM240, GPATCH4, JAKMIP2-AS1, KALRN, SHROOM3, GPD2, CBX4, SCAF8, ZNF300, ATG2A, ESM1, H6PD, DDX18, ACTN2, GTSE1, BRAP, NUDT12, ARMC8, GLRX2, TOP3A, CNKSR3, LINC00511, RAMAC, AC080038.1, RTN2, SBSPON, ACTR10, PIEZO2, HOMER1, AC009549.1, CNKSR2, PCDHB7, UTP11, LSM6, GEN1, TMEM177, TMEM108, C12orf73, GRIK3, ACSF2, RFXAP, ADA2, PEX11G, COG6, ZNF431, ALDH2, PNPT1, ARHGAP12, ZNF629, MYH11, RASAL2, CPS1, DTD2, RYK, ASTN2, EFNB1, FCGBP, ULK2, SYPL2, HLA-C, EIF2S2, TFAM, CTNNA2, FAM162B, NSUN4, RXYLT1, POT1, MAPRE3, CDAN1, RNASEH1-AS1, MICALL1, KLHDC10, CAV2, DMAC2, ZBTB38, CTU2, YWHAB, CD200, ECE2, SNX12, SPA17, CCDC93, PRPF4B, ANO10, AC084198.2, ATG7, TATDN1, B4GALNT1, ZFAND2B, NOL6, HIBCH, ZNF883, PYM1, DIMT1, BX664615.2, SEC24A, PRKD1, SNTB2, SLC39A4, TMEM97, WDR74, VAV2, COG3, LSM14B, STIMATE, ST3GAL5, VTI1B, SNHG20, SLC10A3, TMEM254, SHISA6, FAN1, FYCO1, NEO1, BCL2L2, PCNX1, EEF1AKMT2, SOD2, MRPS2, SLC9A5, TSEN2, AC040169.1, KDR, TGFB2, TMEM138, KANK1, MYH7, POM121C, ZNF865, ITGA11, MSH6, SLC6A1, BICD2, TRA2A, ABCA6, FAM222B, IQGAP2, ZNF347, NKIRAS1, TRIM38, MTA2, SLC26A10, TDG, BICRA, NPM1, ZCCHC14, PVR, IBTK, LINC00623, WDFY1, FBLN5, ZNF585B, VPS33B, AC009133.1, C2orf27A, MIGA2, WDR75, FAM174A, PIP4K2C, WASHC2C, ZNF267, ZBTB42, LEMD1, EPM2AIP1, RP2, S1PR5, SOX12, CENPH, MTHFS, WDR5, C2orf72, TNIK, TMEM120B, ANKMY2, GLRA2, GEMIN4, VPS50, CHML, VASH1-AS1, CCDC102A, SLC66A1L, KLHL7, SMIM15, SAP130, BYSL, TOX, ZNF277, C7orf26, XPNPEP3, PRKAA1, UBXN2B, BUB1, CHST15, BRINP1, GLRB, DDX46, EID2, AC007098.1, FBLN7, UMPS, IFNAR2, TTC27, EED, COX15, CPVL, NPIPB2, DNAH1, OSBPL10, DKC1, NOC4L, PGP, OSER1-DT, NDRG3, LMLN, FAM169A, HAT1, ELFN1, LDLRAD3, SUMO1, REPS1, OLFML2A, SGO1, ZNF483, REEP4, MIER2, NME7, ZNF263, RAB4A, AC067852.2, SLC35B3, ZNF436-AS1, STX17, CASTOR1, SEMA6C, PELI1, TOX4, TMEM168, ACYP1, GRIK2, ITM2C, LPGAT1, DUBR, RRNAD1, RBM45, HEBP2, MED17, ASF1A, LIPH, RALB, SLC25A40, HIF1AN, CBX8, FKBP14, CDPF1, UFL1, NUP205, MINDY1, ECD, ARHGAP5, CNST, ZDHHC21, FAM181A, AL355974.2, TMEM47, DDHD2, KRT7, NSDHL, DPH5, ALAD, AC011451.3, SDAD1, TTYH2, CNDP2, CASP6, NKIRAS2, NHLRC2, LTB4R, MDFI, ZNF451, GABPB1-AS1, UCHL3, ACSF3, TTC21A, RNF216, CDC42, LTBP1, FBXL7, POLR3C, SERHL2, MITD1, FAM160A2, PLGLB1, APC, RAD18, AC074212.1, SP6, RAB8A, ABCD1, FBXO38, KIF7, COLEC11, URB1-AS1, C15orf39, DGKQ, A4GALT, ZNF506, ARHGAP11A, ALKBH6, NDUFAF2, SFI1, RPIA, CEP89, CLN6, DPH2, SETD6, CRIPAK, ZNF213-AS1, SOCS2, SLC7A11, JOSD1, PODXL2, ZFYVE26, SYAP1, TWIST2, SNX2, GUCY1A2, TDO2, ZNF224, ZNF549, CLPX, NCAPD3, EFCAB2, KIF3C, TOP3B, TAPT1, FRMD6, AATF, UTP18, DBR1, ENTPD4, GCFC2, RABGEF1, GRHPR, STX18, SEC23IP, CYP2J2, GLIS2, MAPKAPK3, MGRN1, RIC8B, GOLGA6L9, ERAP1, PLEKHG4B, MTMR1, CNOT6, CD58, PROSER1, BMP7, AACS, SH2B2, MICU2, SIRT6, CARD16, REXO1, CBLN4, PDHX, ANKRA2, TTC13, PTPN21, RB1CC1, GORAB, ZNF502, THAP11, KAT7, TARS2, NCOA4, C1orf50, PJA1, PABPC4, MAML1, CPXM1, AP5S1, TEF, WDR48, KLHL21, FOPNL, HMCES, AQP4, C1orf35, URI1, DDX25, PEX16, MAP1LC3B, MIIP, RUFY1, TMOD3, FAM106A, CELSR1, NEMP1, ZKSCAN5, LINC01060, C2CD5, UBE3B, KTN1, DOK4, PDS5B, LINC01197, CCDC97, ENO3, SNX33, ATG12, UEVLD, RFX5, LINC00339, RUBCNL, AC008906.2, STAT6, PDP1, DYRK3, RAB23, FMR1, CUL3, SDF2L1, NUP98, KCTD13, INPP5K, ZNF414, G3BP2, SLC25A28, PNKP, ANGEL2, SIN3A, SMIM13, SPATA2, RSRC1, SMARCAL1, IFI44, UBR3, CARD8, BEAN1, DHX33, CEBPD, OCLN, ATP11A, STEAP2, ASF1B, LDAH, WDR91, AGPAT5, KIF3A, CXADR, DTX1, HOXA-AS2, TMEM164, FUZ, USP13, AAAS, MARCH9, FAM219B, SPAG7, SC5D, COA3, SLC35A1, NDUFS6, FAM131A, STK36, TRAM2, CHKB, BUD23, PORCN, TMED1, VPS4A, ANKRD11, LRP5, ELK4, SEPTIN2, CCDC92, TTLL12, FBXO11, ITGB8, PIGH, USP22, UBE2Q1, ARHGEF1, SLC16A1, GHITM, USP5, SND1, PTRHD1, POLDIP2, NRDC, SLC27A1, DNAJB2, B3GALT6, ATPAF1, HLA-DOA, MRPL36, RMND5B, APEH, REEP6, QSER1, PPP2R5C, CARS2, FOXD1, USB1, TWF1, ZKSCAN1, GSAP, WDR90, BROX, RP9, EME2, WNK1, SLC30A5, TTLL1, LDB3, YIPF4, MFN2, PRPS2, IGF1R, THUMPD3, TBC1D9B, ZCRB1, IWS1, MIEF1, ATP6V1H, FCGRT, ISCU, MMADHC, EI24, BTBD1, SYVN1, DICER1, CNR1, ARSD, LINC01426, SMG5, MDM4, CTBP1, SLC4A3, AIMP2, ELK1, MEN1, ZDHHC20, SACM1L, ACSS3, DCTD, UBL4A, MDGA1, OAF, TBCA, ARMC7, IMMT, FNTB, ORAI2, STARD7, RARA-AS1, MRPS33, HFE, SOX8, CENPU, ACOT13, ARPC1A, WDR45, DCLK1, TM9SF4, COPG1, SLC39A14, HDAC3, COG4, LYPLA2, PRDX2, FZR1, GALC, OSBP, FAM199X, GLYR1, CKAP5, BAALC-AS2, PSMD4, RNF13, RAB11FIP3, MTOR, ZNF528, GLT8D1, TJP1, DNAJC14, ZNF384, E2F4, PDRG1, GIPC1, XPC, MAGED2, CENPT, SMIM29, G6PD, SLC35E2A, IP6K2, YIF1B, SNX19, OIP5-AS1, BOLA3, CBY1, HSD17B4, LINC01608, AC024075.2, TIMM17A, IKBKG, TM7SF2, ALG14, CAT, LIPE-AS1, BBS1, ARF3, SNF8, TXNDC12, LNPK, SLC25A16, RPTOR, FAM135A, GATD3B, SMU1, AC021242.3, IMPAD1, SRRT, ZYG11B, CPNE5, DDX1, PAQR4, NEK4, NEURL4, LEF1-AS1, POGK, SUCLA2, SYNJ2BP, POGLUT3, TCEA1, CYP2R1, MDN1, SLC12A7, FBXO9, USP11, C2orf74, RAB5C, RNF170, NDUFA2, DIS3L, SEC16A, BRPF3, PEX11B, TOMM40, CDCA4, TM9SF1, MRM2, FKBP1B, UROD, DGKZ, EPHA2, ASPSCR1, TMEM106B, POLG, ASPH, TFG, RARG, ATP13A2, PCGF3, EHBP1L1, GPX7, BTN2A1, WDR55, OLFM2, CPSF3, MPP5, ATRN, ACP6, NARS, USE1, ERAP2, RETREG3, GUCD1, DHX38, DHX32, ARL6IP4, RBM14, CDC16, ST3GAL2, PRPSAP1, ANKRD17, C11orf24, XPO5, MXRA7, INTS3, CUL5, MCM3, MFSD14B, SEC31A, PRADC1, CERK, RRP7A, RBM23, RPS26, TGFBR2, CDC42BPB, SLC39A3, SYNM, CDS2, BACE1, ATF6, EDEM2, DNAAF5, UPF1, PLEKHG1, CLCN6, KLHDC3, CMTR1, AC092957.1, PPA2, HEATR5A, DARS, ATP6V1G1, DLAT, RTCA, MCRS1, RARS2, ANK3, TMEM167A, SPACA9, ASXL1, CAMKK2, MED14, OLA1, NLGN2, RNASEH2C, EXOSC6, RDH11, RPS10, TMEM39B, SPIDR, RPL3, LARS, UNC5CL, SUOX, EVI5L, IFT52, ESS2, RIC8A, AP2A1, DPY19L4, ABCA8, ENTR1, ZNF503-AS2, FUNDC1, UNKL, SIX1, MRPL3, VIRMA, DUT, C8orf82, WASHC3, PTPRE, LIN7C, CLNS1A, SLC35F5, C8orf76, MSI2, ESCO2, MSTO1, IK, ELP4, FAM200B, YLPM1, DHRS11, TMEM87A, AKT3, SRCAP, PABPC1, NUCKS1, CCNB1IP1, MRPL4, EBAG9, SMIM10L1, CCDC25, SH3GLB1, DYNC2H1, SLC35A4, PTGR2, PEX13, MIEN1, CTTN, PSPC1, VPS45, RRN3, SNRPA1, SLC9A3-AS1, RAB43, SPRED3, SLC66A1, ADAM17, C1orf131, DERL2, ASB6, TFE3, GTF2F1, OGFR, LGR4, ABHD6, FNBP4, KNOP1, NUP62, B4GALT6, C7orf25, NUDT9, PRKD2, FUCA2, CDK5, SLC25A22, ANAPC13, SUCO, ERO1B, C11orf71, PEX12, MPDZ, ALDH16A1, SLC30A6, TMBIM1, HAUS7, BCL2L1, SPG7, UFD1,&quot; my_list = as.list(strsplit(my_string, &quot;,&quot;)) my_list length(my_list) </code></pre> <p>It will result in a list with length 1 <a href="https://i.stack.imgur.com/t49Cg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t49Cg.png" alt="output" /></a> meaning a list with one element. However, I want that the list will have length(the number of strings) so that it should be my_list = as.list(&quot;SNHG12&quot;, &quot;SYT1&quot;, &quot;PTPRO&quot;, ...). How I can do that?</p> <p><strong>Update</strong></p> <p>Following the suggestion of the commentator below, I have tried using it to apply to my string as follows:</p> <pre><code>my_string = &quot;MTX3, ZNF623, VEPH1, GCLM, ALS2, MAP3K3, CRIP3, GNL2, RAPGEFL1, RAD54B, GCDH, WASF1, PLEKHA2, TNFRSF21, CNNM3, GTF2E2, SNHG5, NTNG1, CHL1-AS2, PALM2-AKAP2, FGFBP3, DHRSX, LNPEP, ISY1, MTERF3, ZNF780A, CCDC24, MCHR1, GTF2H1, AURKA, TYRO3, SLC31A1, RARA, NKD2, SLC25A24, AC087477.2, EID2B, NCALD, TYW3, LUZP1, VXN, RECQL4, AC027307.2, TAF1, ZFP91, TCOF1, GCLC, PPP1R12A, SLC22A18, ZNF28, AC078846.1, TMEM109, MAIP1, TRPC5OS, AEBP2, PGAM2, PPARD, TENT4A, RGS20, ANKRD35, RGS3, VPS53, MMP2, UBE2O, NUMB, AC092069.1, ARHGEF10, AURKB, TSEN54, MLPH, GPATCH8, SMURF1, TBC1D1, SNX7, AC118549.1, PRPS1, HIST2H2BE, KATNAL1, MCL1, BCL7A, SOCS4, ADPGK, ZNF667, CSNK1G3, FBXO45, APEX2, ADRA2B, SNAPC3, MIPEP, DISC1, SCAF11, AC010198.2, ZSCAN16, HPS1, ST7-AS1, SHKBP1, AC012615.1, ACKR3, FER, OSBPL7, SEC11C, SLC1A5, ZBTB44, RPUSD2, ME1, RIN2, STRN3, VIPAS39, KIF20A, PPM1M, ELMOD3, CTR9, TTC30A, TAF4, ASCC1, TOMM40L, ZNF853, SBF2, ABCF1, CXorf38, KDM3B, PLTP, SNX29, VLDLR, MEOX2, PPM1J, CLN3, UBQLN1, NIP7, ANKLE2, ZNF761, GTF3C3, VANGL2, POLR3F, ZCCHC9, NPAS2, HAS2, HS3ST3A1, METTL2B, USP40, AL139289.2, GDF15, MCMBP, UBOX5, C2orf81, LINC01551, TOE1, CA8, SRXN1, RNF207, KIAA0556, IL1R1, GID4, MAMLD1, ZNF319, ZBTB8A, CCDC58, STK32B, IL31RA, PM20D2, TEX2, RFX7, CAMK2N2, JPT1, PGGHG, PCDHB10, MRS2, KAT14, ZNF426, TCAF1, ZBTB45, DPH3, VPS37A, DLX1, YAF2, PACRGL, MED12L, NBPF11, AC026979.2, HSPA14.1, NR2E1, CACNA1E, RIPPLY1, TBX15, AC079922.2, PRPSAP2, ALAS1, TRIM32, MAP11, RTF1, NAP1L3, PPHLN1, GFOD2, AK4, DNAJB5, IMMP2L, NOP2, CRB2, SNHG18, ZNHIT6, CKAP2, SMAD4, ZNF140, BDH1, RFWD3, DYRK1A, ALDH4A1, IFI27, CCNO, DIPK1A, ZNHIT2, LARGE1, ALDH1L1-AS2, DCP1A, HMMR, DHRS7B, GALNT5, INPP5E, FRG1, FGFR3, CLK4, LONRF1, SHF, RFX2, ZNF385D, ZSCAN32, P4HA1, ZCCHC17, MIR34AHG, NSMCE4A, HJURP, BMPR1A, SAMD11, PSMB10, UBE2W, AC092119.3, SEC24D, LINC00662, CASP7, MBTD1, TMEM163, TPM3, TMEM126B, AKT3-IT1, FAM50B, TRAIP, SOX1-OT, PIK3CA, AP3M2, RNF111, RERGL, AZIN1-AS1, PTPN14, CRYBG3, RNF123, IGSF9B, EBF2, GTPBP2, SETD4, PFKP, MED22, IL11, METTL23, ZFPM1, C16orf95, SF3B5, ARHGEF4, HTRA3, TTC28, NTRK3, POLR3E, KLC2, STRBP, NLE1, AC234582.1, ARHGEF11, CFAP44, MAPK7, SLC35A3, RIT2, NKAIN3-IT1, MROH6, MBD1, CUL2, HABP4, USPL1, LIG1, SMARCA2, ITPRIPL1, AC104964.4, KLHL8, LHFPL2, CDC42SE1, NUF2, SLC35E3, INSIG2, ZNF20, RBSN, TEPSIN, UNC119, THSD1, RORB, MCTP1, ZNF668, RFC1, IFI6, MRPL45, KLHL29, TTC39B, SEC22A, IKZF4, CHAF1A, NCKAP5L, OGFRL1, NET1, C17orf75, SLC7A1, PROX1, GEMIN5, ST7, IRF2BP1, MEGF10, NUP37, TYSND1, DYRK4, POLA2, AIM2, JMJD4, PHLDB3, KLF12, KCTD6, ERMAP, NPR2, LRRC42, NFIC, PRKAR1B, MFSD14C, NR2F1-AS1, SRGAP2, THOC2, HYMAI, FBXO46, TBC1D15, FZD2, CYP7B1, HOXA6, CDK7, FBXO25, ATP10B, BTD, ATIC, TMEM245, FAM229A, INF2, FAM207A, GINS1, SOCS6, ILRUN, STXBP4, GAREM2, XKR8, APOLD1, CDH10, TMEM265, ZSCAN5A, ICK, E2F1, NR1H4, CTPS2, NELL2, CEP41, NIF3L1, HAUS1, AC018521.5, AVL9, AC010649.1, BAIAP2L1, ST7L, AVEN, HSPA12A, SGIP1, C12orf49, ARMC9, MRPS30, PYGO1, C19orf54, TSTD3, ZNF544, HAUS6, RAB32, TSPAN10, GALE, PRUNE1, LRRC37A3, SOCS7, TRUB1, TRIM13, SEC23A, MED4, C1orf53, RBMS2, QSOX2, ORC3, CEND1, PLVAP, RSRP1, STXBP3, RAD54L2, PHLPP2, BX255925.3, RNF135, RNF41, SCAMP2, ATL2, DHX29, RFX3, SMYD2, PARP16, RAB4B, ADAMTS13, SMYD3, DHRS12, PIAS4, DIP2C, CCN4, ZCCHC8, TEAD3, RC3H2, OAS3, GPR173, FGGY, ISCA1, TSPO, GAPVD1, NDUFAF7, ZNF691, CDC7, ADCY9, UBAP1L, MRRF, PHAX, CNIH2, RPS6KB1, SMC6, NOP9, SP3, LMO7, JUP, TMEM8B, CEP131, PCGF1, TYW1, TMOD1, RNASE4, LRRC28, RFK, HSPB11, ALKBH4, HNMT, MYLK, GLIPR1L2, BNIP2, PPME1, NPAS1, MPPE1, SOX9-AS1, TRIM44, ZNF106, CARMIL1, CISD2, SLC41A2, ASL, THNSL2, METAP2, LINC00323, ZNF217, FBXW4, YAE1, EXD3, SESN1, GAL3ST1, TMEM80, GNL3L, TBC1D13, INTS8, SLITRK5, WDR20, THBD, TLR4, CNTNAP3B, KLK10, NEK2, NDUFAF6, LPCAT4, ZNF398, TMEM104, PPP4R3B, FARS2, PDGFRL, C17orf80, EBLN3P, CCNY, TRIM25, CALHM2, NR1H3, LIMD1, HOMER3, LRRC8D, BTBD10, CHST11, ZNF136, ZADH2, ERCC6L2, ZNF74, CAPS, TRIM37, ACBD3, PIGP, POLR3K, PIGB, CCDC138, ZNF582-AS1, AGER, TIMELESS, VPS36, HAX1, GPRASP2, KIF14, ABCB7, HOXC4, RBM47, TXNL1, TP53INP2, AHNAK2, SFRP1, AGBL3, UBXN11, CEP76, PKDCC, IRS1, EHD4, ZBTB9, AGL, ABITRAM, FBXW9, TMCO4, BAG2, PTPRD-AS1, MAP1A, STARD4, POLR3G, UTP20, CTBP1-DT, GMDS, MED27, TGFBRAP1, ZNF671, DDX55, HNRNPF, IDH1, PRKAA2, MBNL1, NUDCD1, BET1, TMEM167B, HOXC9, BBS10, SNX10, DCAF4, COMMD7, WASF3, TERF1, DCAF6, CCDC159, SNX8, BAK1, RBBP9, SFT2D1, TPRG1L, PAQR7, MMACHC, PAFAH2, LTO1, VPS37B, FPGS, FZD6, ASPHD1, STX2, MALL, FGFR1OP, CPLANE1, CENPJ, DTX2, LRBA, RPAP3, MKRN2, RTL8B, YIPF1, CMBL, RBFA, SHQ1, BTBD6, TMEM99, TMOD2, NDEL1, AC147067.1, LRRC23, MGAT3, MED20, DCAF12, ABCA1, GJC1, RABL2B, UXT, ANGPTL2, ZSCAN9, CREBL2, MDM1, NBPF26, MOB1B, AP4S1, LINC01278, DPH7, USP54, ZNF439, FNDC1, PCCA-DT, SLC2A11, RAB2B, LMNB1, SHROOM1, LARP1B, FUT11, RFC4, AC004158.1, RALGAPA2, TBC1D19, ITGAX, GRIPAP1, CAPN10, CASK, MEG9, MTG2, TMEM250, SLC46A1, GINS4, INTS2, STRN, NIPA1, SELPLG, CCDC88A, SLAIN2, AC005306.1, AC005899.8, TOB2, TDRD3, ITGA1, ARPIN, ENG, CCDC82, FXYD7, ZNF672, CIB2, AC003991.2, F12, ABHD16A, ZNF117, TRAF2, PYGO2, DNAJC18, SATB2-AS1, ENTPD5, SENP7, TUT4, KCTD12, LMCD1-AS1, GMFB, MTTP, TMPRSS2, NUDT15, ZNF777, ARNTL, TMEM240, GPATCH4, JAKMIP2-AS1, KALRN, SHROOM3, GPD2, CBX4, SCAF8, ZNF300, ATG2A, ESM1, H6PD, DDX18, ACTN2, GTSE1, BRAP, NUDT12, ARMC8, GLRX2, TOP3A, CNKSR3, LINC00511, RAMAC, AC080038.1, RTN2, SBSPON, ACTR10, PIEZO2, HOMER1, AC009549.1, CNKSR2, PCDHB7, UTP11, LSM6, GEN1, TMEM177, TMEM108, C12orf73, GRIK3, ACSF2, RFXAP, ADA2, PEX11G, COG6, ZNF431, ALDH2, PNPT1, ARHGAP12, ZNF629, MYH11, RASAL2, CPS1, DTD2, RYK, ASTN2, EFNB1, FCGBP, ULK2, SYPL2, HLA-C, EIF2S2, TFAM, CTNNA2, FAM162B, NSUN4, RXYLT1, POT1, MAPRE3, CDAN1, RNASEH1-AS1, MICALL1, KLHDC10, CAV2, DMAC2, ZBTB38, CTU2, YWHAB, CD200, ECE2, SNX12, SPA17, CCDC93, PRPF4B, ANO10, AC084198.2, ATG7, TATDN1, B4GALNT1, ZFAND2B, NOL6, HIBCH, ZNF883, PYM1, DIMT1, BX664615.2, SEC24A, PRKD1, SNTB2, SLC39A4, TMEM97, WDR74, VAV2, COG3, LSM14B, STIMATE, ST3GAL5, VTI1B, SNHG20, SLC10A3, TMEM254, SHISA6, FAN1, FYCO1, NEO1, BCL2L2, PCNX1, EEF1AKMT2, SOD2, MRPS2, SLC9A5, TSEN2, AC040169.1, KDR, TGFB2, TMEM138, KANK1, MYH7, POM121C, ZNF865, ITGA11, MSH6, SLC6A1, BICD2, TRA2A, ABCA6, FAM222B, IQGAP2, ZNF347, NKIRAS1, TRIM38, MTA2, SLC26A10, TDG, BICRA, NPM1, ZCCHC14, PVR, IBTK, LINC00623, WDFY1, FBLN5, ZNF585B, VPS33B, AC009133.1, C2orf27A, MIGA2, WDR75, FAM174A, PIP4K2C, WASHC2C, ZNF267, ZBTB42, LEMD1, EPM2AIP1, RP2, S1PR5, SOX12, CENPH, MTHFS, WDR5, C2orf72, TNIK, TMEM120B, ANKMY2, GLRA2, GEMIN4, VPS50, CHML, VASH1-AS1, CCDC102A, SLC66A1L, KLHL7, SMIM15, SAP130, BYSL, TOX, ZNF277, C7orf26, XPNPEP3, PRKAA1, UBXN2B, BUB1, CHST15, BRINP1, GLRB, DDX46, EID2, AC007098.1, FBLN7, UMPS, IFNAR2, TTC27, EED, COX15, CPVL, NPIPB2, DNAH1, OSBPL10, DKC1, NOC4L, PGP, OSER1-DT, NDRG3, LMLN, FAM169A, HAT1, ELFN1, LDLRAD3, SUMO1, REPS1, OLFML2A, SGO1, ZNF483, REEP4, MIER2, NME7, ZNF263, RAB4A, AC067852.2, SLC35B3, ZNF436-AS1, STX17, CASTOR1, SEMA6C, PELI1, TOX4, TMEM168, ACYP1, GRIK2, ITM2C, LPGAT1, DUBR, RRNAD1, RBM45, HEBP2, MED17, ASF1A, LIPH, RALB, SLC25A40, HIF1AN, CBX8, FKBP14, CDPF1, UFL1, NUP205, MINDY1, ECD, ARHGAP5, CNST, ZDHHC21, FAM181A, AL355974.2, TMEM47, DDHD2, KRT7, NSDHL, DPH5, ALAD, AC011451.3, SDAD1, TTYH2, CNDP2, CASP6, NKIRAS2, NHLRC2, LTB4R, MDFI, ZNF451, GABPB1-AS1, UCHL3, ACSF3, TTC21A, RNF216, CDC42, LTBP1, FBXL7, POLR3C, SERHL2, MITD1, FAM160A2, PLGLB1, APC, RAD18, AC074212.1, SP6, RAB8A, ABCD1, FBXO38, KIF7, COLEC11, URB1-AS1, C15orf39, DGKQ, A4GALT, ZNF506, ARHGAP11A, ALKBH6, NDUFAF2, SFI1, RPIA, CEP89, CLN6, DPH2, SETD6, CRIPAK, ZNF213-AS1, SOCS2, SLC7A11, JOSD1, PODXL2, ZFYVE26, SYAP1, TWIST2, SNX2, GUCY1A2, TDO2, ZNF224, ZNF549, CLPX, NCAPD3, EFCAB2, KIF3C, TOP3B, TAPT1, FRMD6, AATF, UTP18, DBR1, ENTPD4, GCFC2, RABGEF1, GRHPR, STX18, SEC23IP, CYP2J2, GLIS2, MAPKAPK3, MGRN1, RIC8B, GOLGA6L9, ERAP1, PLEKHG4B, MTMR1, CNOT6, CD58, PROSER1, BMP7, AACS, SH2B2, MICU2, SIRT6, CARD16, REXO1, CBLN4, PDHX, ANKRA2, TTC13, PTPN21, RB1CC1, GORAB, ZNF502, THAP11, KAT7, TARS2, NCOA4, C1orf50, PJA1, PABPC4, MAML1, CPXM1, AP5S1, TEF, WDR48, KLHL21, FOPNL, HMCES, AQP4, C1orf35, URI1, DDX25, PEX16, MAP1LC3B, MIIP, RUFY1, TMOD3, FAM106A, CELSR1, NEMP1, ZKSCAN5, LINC01060, C2CD5, UBE3B, KTN1, DOK4, PDS5B, LINC01197, CCDC97, ENO3, SNX33, ATG12, UEVLD, RFX5, LINC00339, RUBCNL, AC008906.2, STAT6, PDP1, DYRK3, RAB23, FMR1, CUL3, SDF2L1, NUP98, KCTD13, INPP5K, ZNF414, G3BP2, SLC25A28, PNKP, ANGEL2, SIN3A, SMIM13, SPATA2, RSRC1, SMARCAL1, IFI44, UBR3, CARD8, BEAN1, DHX33, CEBPD, OCLN, ATP11A, STEAP2, ASF1B, LDAH, WDR91, AGPAT5, KIF3A, CXADR, DTX1, HOXA-AS2, TMEM164, FUZ, USP13, AAAS, MARCH9, FAM219B, SPAG7, SC5D, COA3, SLC35A1, NDUFS6, FAM131A, STK36, TRAM2, CHKB, BUD23, PORCN, TMED1, VPS4A, ANKRD11, LRP5, ELK4, SEPTIN2, CCDC92, TTLL12, FBXO11, ITGB8, PIGH, USP22, UBE2Q1, ARHGEF1, SLC16A1, GHITM, USP5, SND1, PTRHD1, POLDIP2, NRDC, SLC27A1, DNAJB2, B3GALT6, ATPAF1, HLA-DOA, MRPL36, RMND5B, APEH, REEP6, QSER1, PPP2R5C, CARS2, FOXD1, USB1, TWF1, ZKSCAN1, GSAP, WDR90, BROX, RP9, EME2, WNK1, SLC30A5, TTLL1, LDB3, YIPF4, MFN2, PRPS2, IGF1R, THUMPD3, TBC1D9B, ZCRB1, IWS1, MIEF1, ATP6V1H, FCGRT, ISCU, MMADHC, EI24, BTBD1, SYVN1, DICER1, CNR1, ARSD, LINC01426, SMG5, MDM4, CTBP1, SLC4A3, AIMP2, ELK1, MEN1, ZDHHC20, SACM1L, ACSS3, DCTD, UBL4A, MDGA1, OAF, TBCA, ARMC7, IMMT, FNTB, ORAI2, STARD7, RARA-AS1, MRPS33, HFE, SOX8, CENPU, ACOT13, ARPC1A, WDR45, DCLK1, TM9SF4, COPG1, SLC39A14, HDAC3, COG4, LYPLA2, PRDX2, FZR1, GALC, OSBP, FAM199X, GLYR1, CKAP5, BAALC-AS2, PSMD4, RNF13, RAB11FIP3, MTOR, ZNF528, GLT8D1, TJP1, DNAJC14, ZNF384, E2F4, PDRG1, GIPC1, XPC, MAGED2, CENPT, SMIM29, G6PD, SLC35E2A, IP6K2, YIF1B, SNX19, OIP5-AS1, BOLA3, CBY1, HSD17B4, LINC01608, AC024075.2, TIMM17A, IKBKG, TM7SF2, ALG14, CAT, LIPE-AS1, BBS1, ARF3, SNF8, TXNDC12, LNPK, SLC25A16, RPTOR, FAM135A, GATD3B, SMU1, AC021242.3, IMPAD1, SRRT, ZYG11B, CPNE5, DDX1, PAQR4, NEK4, NEURL4, LEF1-AS1, POGK, SUCLA2, SYNJ2BP, POGLUT3, TCEA1, CYP2R1, MDN1, SLC12A7, FBXO9, USP11, C2orf74, RAB5C, RNF170, NDUFA2, DIS3L, SEC16A, BRPF3, PEX11B, TOMM40, CDCA4, TM9SF1, MRM2, FKBP1B, UROD, DGKZ, EPHA2, ASPSCR1, TMEM106B, POLG, ASPH, TFG, RARG, ATP13A2, PCGF3, EHBP1L1, GPX7, BTN2A1, WDR55, OLFM2, CPSF3, MPP5, ATRN, ACP6, NARS, USE1, ERAP2, RETREG3, GUCD1, DHX38, DHX32, ARL6IP4, RBM14, CDC16, ST3GAL2, PRPSAP1, ANKRD17, C11orf24, XPO5, MXRA7, INTS3, CUL5, MCM3, MFSD14B, SEC31A, PRADC1, CERK, RRP7A, RBM23, RPS26, TGFBR2, CDC42BPB, SLC39A3, SYNM, CDS2, BACE1, ATF6, EDEM2, DNAAF5, UPF1, PLEKHG1, CLCN6, KLHDC3, CMTR1, AC092957.1, PPA2, HEATR5A, DARS, ATP6V1G1, DLAT, RTCA, MCRS1, RARS2, ANK3, TMEM167A, SPACA9, ASXL1, CAMKK2, MED14, OLA1, NLGN2, RNASEH2C, EXOSC6, RDH11, RPS10, TMEM39B, SPIDR, RPL3, LARS, UNC5CL, SUOX, EVI5L, IFT52, ESS2, RIC8A, AP2A1, DPY19L4, ABCA8, ENTR1, ZNF503-AS2, FUNDC1, UNKL, SIX1, MRPL3, VIRMA, DUT, C8orf82, WASHC3, PTPRE, LIN7C, CLNS1A, SLC35F5, C8orf76, MSI2, ESCO2, MSTO1, IK, ELP4, FAM200B, YLPM1, DHRS11, TMEM87A, AKT3, SRCAP, PABPC1, NUCKS1, CCNB1IP1, MRPL4, EBAG9, SMIM10L1, CCDC25, SH3GLB1, DYNC2H1, SLC35A4, PTGR2, PEX13, MIEN1, CTTN, PSPC1, VPS45, RRN3, SNRPA1, SLC9A3-AS1, RAB43, SPRED3, SLC66A1, ADAM17, C1orf131, DERL2, ASB6, TFE3, GTF2F1, OGFR, LGR4, ABHD6, FNBP4, KNOP1, NUP62, B4GALT6, C7orf25, NUDT9, PRKD2, FUCA2, CDK5, SLC25A22, ANAPC13, SUCO, ERO1B, C11orf71, PEX12, MPDZ, ALDH16A1, SLC30A6, TMBIM1, HAUS7, BCL2L1, SPG7, UFD1&quot; str_as_list &lt;- as.list(unlist(strsplit(my_string, &quot;,&quot;), use.names = F)) length(str_as_list) </code></pre> <p>However, I still got the issue as follows:</p> <pre><code>Error: unexpected ',' in: &quot;ER3, LRRC8D, BTBD10, CHST11, ZNF136, ZADH2, ERCC6L2, ZNF74, CAPS, TRIM37, ACBD3, PIGP, POLR3K, PIGB, CCDC138, ZNF582-AS1, AGER, TIMELESS, VPS36, HAX1, GPRASP2, KIF14, ABCB7, HOXC4, RBM47, TXNL str_as_list &lt;- as.list(unlist(strsplit(my_string, &quot;,&quot; </code></pre> <p><a href="https://i.stack.imgur.com/Ty7GU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ty7GU.jpg" alt="Error message" /></a> <a href="https://i.stack.imgur.com/DM6y6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DM6y6.jpg" alt="error dput()" /></a></p>
[ { "answer_id": 74159338, "author": "Jilber Urbina", "author_id": 1315767, "author_profile": "https://Stackoverflow.com/users/1315767", "pm_score": 2, "selected": false, "text": "string <- strsplit(my_string, split=\",\")[[1]]\nlapply(seq_along(string), function(i) string[i])\n" }, { ...
2022/10/21
[ "https://Stackoverflow.com/questions/74159252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13282670/" ]
74,159,276
<p>I tried to represent species presence into containers breeding site. I used a bar plot and a color code to represent my different species. I first tried to specify a color for each value of my <code>sp</code> variable, but it appeared to be to much colored as I have combination of multiple species in a breeding site. In order to simplify the visual of the plot, I tried to represent the presence of two species in the same container by adding a colored pattern of a species above the color of another, but did not succeed.</p> <p>Here's my code below I used. I tried but did not understand the use of <code>scale_pattern_manual</code></p> <p>Any suggestions ?</p> <pre><code>x11(); ggppt&lt;-Tabagg %&gt;% filter(!(type_gîtes %in% &quot;na&quot;)) %&gt;% filter(pres_larve %in% &quot;Oui&quot;) %&gt;% filter(!(sp %in% &quot;na&quot;)) %&gt;% ggplot() + aes(x = type_gîtes, fill = sp) + geom_bar() + labs(x = &quot;Type gîte&quot;, y = &quot;N&quot;, fill = &quot;Espèces&quot;) + coord_flip() + theme_minimal() + theme(legend.text.align = 0, legend.position = &quot;bottom&quot;)+ scale_fill_manual(name = &quot;Espèces&quot; , values = c(&quot;Ae. aegypti&quot; = &quot;#DA4943&quot;, &quot;Ae. aegypti + Ae. polynesiensis&quot; = &quot;#D058EC&quot;, &quot;Ae. aegypti + Ae. polynesiensis + Cx. spp.&quot; = &quot;#FF27D5&quot;, &quot;Ae. aegypti + Cx. spp.&quot; = &quot;#EC8158&quot;, &quot;Ae. aegypti + Toxo. amboinensis&quot; = &quot;#CC804D&quot;, &quot;Ae. polynesiensis&quot; = &quot;#5284D9&quot;, &quot;Ae. polynesiensis + W. mitchellii&quot; = &quot;#CB447C&quot;, &quot;Cx. spp.&quot; = &quot;#E5AD3F&quot;, &quot;Toxo. amboinensis&quot; = &quot;#67E5C8&quot;, &quot;W. mitchellii&quot; = &quot;#A259DB&quot;, &quot;na&quot; = &quot;#757575&quot; ), labels = c(expression(italic(&quot;Ae. aegypti&quot;), italic(&quot;Ae. aegypti + Ae. polynesiensis&quot;), italic(&quot;Ae. aegypti + Ae. polynesiensis + Cx. spp.&quot;), italic(&quot;Ae. aegypti + Cx. spp.&quot;), italic(&quot;Ae. aegypti + Toxo. amboinensis&quot;), italic(&quot;Ae. polynesiensis&quot;), italic(&quot;Ae. polynesiensis + W. mitchellii&quot;), italic(&quot;Cx. spp.&quot;), italic(&quot;Toxo. amboinensis&quot;), italic(&quot;W. mitchellii&quot;), &quot;na&quot;))) + geom_bar_pattern()+ scale_pattern_manual(values=c(&quot;Ae. aegypti + Ae. polynesiensis&quot; =&quot;Stripe&quot;)); ggppt </code></pre> <p>Here's the plot generated</p> <p><a href="https://i.stack.imgur.com/Qx0SU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qx0SU.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74160142, "author": "Kat", "author_id": 5329073, "author_profile": "https://Stackoverflow.com/users/5329073", "pm_score": 0, "selected": false, "text": "dput()" }, { "answer_id": 74160691, "author": "Zhiqiang Wang", "author_id": 11741943, "author_profil...
2022/10/21
[ "https://Stackoverflow.com/questions/74159276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19738147/" ]
74,159,295
<pre><code>lst = [(2),('hello',3),(4),('world',5)] </code></pre> <p>I want extract only the tuples that have the value 3 and above</p> <p>how can i do that ?</p>
[ { "answer_id": 74159348, "author": "magnus", "author_id": 16587222, "author_profile": "https://Stackoverflow.com/users/16587222", "pm_score": 3, "selected": true, "text": "[n for n in lst if type(n) is tuple and n[1] >= 3]\n\n\n[n for n in lst if isinstance(n, tuple) and n[1] >= 3 or isi...
2022/10/21
[ "https://Stackoverflow.com/questions/74159295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
74,159,342
<p>I have an android app that's intended for both google play and app gallery , it's one project with 2 <strong>flavours</strong> , for the google play i generated a <strong>keystore</strong> , my questions are that</p> <p>1- Should I use the google play <strong>keystore</strong> for app gallery or it needs to be a new one ?</p> <p>2- <strong>Bundle id</strong> for appgallery can be same as google play or not ? Any pros and cons for same/different id ?</p> <p>3- Does app gallery accepts aab or only apk as for google there is no choice (only aab)?</p>
[ { "answer_id": 74160223, "author": "Martin Zeitler", "author_id": 549372, "author_profile": "https://Stackoverflow.com/users/549372", "pm_score": 2, "selected": true, "text": "versionNameSuffix" } ]
2022/10/21
[ "https://Stackoverflow.com/questions/74159342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8669531/" ]
74,159,352
<p>Here is my 2d array:</p> <pre><code>[['P1', 27], ['P2', 44], ['P3', 65], ['P4', 51], ['P5', 31], ['P6', 18], ['P7', 33]] </code></pre> <p>I have created a loop to attach each appropriate label to its corresponding value within this 2d array. At the end of the loop I would like to subtract every value by a different number.</p> <p>For example: if I wanted to subtract the values by 5</p> <pre><code>[['P1', 22], ['P2', 39], ['P3', 60], ['P4', 46], ['P5', 26], ['P6', 13], ['P7', 28]] </code></pre> <p>How do I do this while the array has both a str type and int?</p>
[ { "answer_id": 74159402, "author": "wim", "author_id": 674039, "author_profile": "https://Stackoverflow.com/users/674039", "pm_score": 4, "selected": true, "text": ">>> L = [['P1', 27], ['P2', 44], ['P3', 65], ['P4', 51], ['P5', 31], ['P6', 18], ['P7', 33]]\n>>> [[s, n - 5] for s, n in L...
2022/10/21
[ "https://Stackoverflow.com/questions/74159352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20304630/" ]
74,159,387
<p>Lot of answers on merging and full col, but can't figure out a more effective method. for my situation.</p> <p>current version of python, pandas, numpy, and file format is parquet</p> <p>Simply put if col1 ==x the col 10 = 1, col11 = 2, col... etc.</p> <pre><code>look1 = 'EMPLOYEE' look2 = 'CHESTER' look3 = &quot;TONY'S&quot; look4 = &quot;VICTOR'S&quot; tgt1 = 'inv_group' tgt2 = 'acc_num' for x in range(len(df['ph_name'])): df[tgt1][x] = 'MEMORIAL' df[tgt2][x] = 12345 elif df['ph_name'][x] == look2: df[tgt1][x] = 'WALMART' df[tgt2][x] = 45678 elif df['ph_name'][x] == look3: df[tgt1][x] = 'TONYS' df[tgt2][x] = 27359 elif df['ph_name'][x] == look4: df[tgt1][x] = 'VICTOR' df[tgt2][x] = 45378 basic sample: unit_name tgt1 tgt2 0 EMPLOYEE Nan Nan 1 EMPLOYEE Nan Nan 2 TONY'S Nan Nan 3 CHESTER Nan Nan 4 VICTOR'S Nan Nan 5 EMPLOYEE Nan Nan GOAL: unit_name tgt1 tgt2 0 EMPLOYEE MEMORIAL 12345 1 EMPLOYEE MEMORIAL 12345 2 TONY'S TONYS 27359 3 CHESTER WALMART 45678 4 VICTOR'S VICTOR 45378 5 EMPLOYEE MEMORIAL 12345 </code></pre> <p>So this works... I get the custom columns values added, It's not the fastest under the sun, but it works.</p> <p>It takes 6.2429744 on 28896 rows. I'm concerned when I put it to the grind, It's going to start dragging me down.</p> <p>The other downside is I get this annoyance... Yes I can silence, but I feel like this might be due to a bad practice that I should know how to curtail.</p> <pre><code>SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame </code></pre> <p>Basically...</p> <ol> <li>Is there a way to optimize this?</li> <li>Is this warning due to a bad habit, my ignorance, or do I just need to silence it?</li> </ol>
[ { "answer_id": 74159402, "author": "wim", "author_id": 674039, "author_profile": "https://Stackoverflow.com/users/674039", "pm_score": 4, "selected": true, "text": ">>> L = [['P1', 27], ['P2', 44], ['P3', 65], ['P4', 51], ['P5', 31], ['P6', 18], ['P7', 33]]\n>>> [[s, n - 5] for s, n in L...
2022/10/21
[ "https://Stackoverflow.com/questions/74159387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10097577/" ]
74,159,391
<p>I wonder how <code>for loop</code> can be used at once without <code>non-numeric error</code>. I would like to make multiple character values in a vector <code>Nums</code>, using <code>for loop</code>.</p> <p>But after the third line, the vector becomes <code>chr</code> so cannot continue the rest. This comes out to be same even when I use <code>if loop</code> or <code>while loop</code>... Can someone give a hint about this?</p> <pre><code> for(n in 1:30){ Nums&lt;-1:n Nums[Nums%%2==0 &amp; Nums%%3==0]&lt;-&quot;OK1&quot; Nums[Nums%%2==0 &amp; Nums%%3!=0]&lt;-&quot;OK2&quot; Nums[Nums%%2!=0 &amp; Nums%%3==0]&lt;-&quot;OK3&quot; Nums[Nums%%2!=0 &amp; Nums%%3!=0]&lt;-n } </code></pre> <pre><code>Error in Nums%%2 : non-numeric argument to binary operator </code></pre>
[ { "answer_id": 74159437, "author": "AndS.", "author_id": 9778513, "author_profile": "https://Stackoverflow.com/users/9778513", "pm_score": 2, "selected": false, "text": "Nums" }, { "answer_id": 74159519, "author": "Ben Bolker", "author_id": 190277, "author_profile": "...
2022/10/21
[ "https://Stackoverflow.com/questions/74159391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20275071/" ]
74,159,401
<p>I am working on a simulation, which contains:</p> <ul> <li>a bolt, welded uprightly to the <code>world</code></li> <li>a nut, connected to the bolt via <code>ScrewJoint</code>. The mass of a nut set to <code>0.02</code> kg, the inertia is a diagonal <code>1.1e-9 *I</code>. This is configured via a <code>.sdf</code> file.</li> <li>an iiwa manipulator, which is beside a point for now.</li> </ul> <p>The problem is that the nut is very hard to manipulate and I cannot find a parameter to adjust, which could've made it more lifelike. To be more specific:</p> <ul> <li>I measure the ability of force, applied tangentially in a horizontal plane to the nut, to cause the screwing motion of a joint, that joins the nut with a bolt</li> <li>I'd like to have greater amount of motion at lower forces, and so far I am failing to achieve that</li> <li>My interest in doing this is not idle; I am interested in more complicated simulations, which are also failing when <code>iiwa</code> is coming in a contact with this same joint; I've asked about those <a href="https://%20https://stackoverflow.com/questions/69595841/position-controller-is-able-to-translate-the-joint-but-not-to-rotate" rel="nofollow noreferrer">here</a> and <a href="https://stackoverflow.com/questions/70229166/screw-joint-doesnt-rotate">here.</a> (Both answered partially). To sum up those here: when manipulator grips the nut, the nut fights the screwing in such a manner, that the <code>schunk</code> gripper is forced to unclasp and <code>iiwa</code> is thrown off-track, but the nut remains stationary.</li> <li>I attach below two simpler experiments to better illustrate the issue:</li> </ul> <p><strong>1.</strong> Applying tangentially in a horizontal plane <code>200N</code> force using <code>ExternallyAppliedSpatialForce</code>. <a href="https://i.stack.imgur.com/64jiK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/64jiK.png" alt="enter image description here" /></a></p> <p><strong>Graph notation:</strong> (here as well as below) The left graph contains linear quantities (<code>m</code>, <code>m/s</code>, etc) along world's Z axis, the right graph contains angular quantities (in degrees, <code>deg</code>, <code>deg/s</code>, etc) around world's Z axis. The legend entries with a trailing apostrophe use the secondary Y-axis scale; other legend entries use the primary Y-axis scale.</p> <p><strong>Experiment summary:</strong></p> <p>This works as expected, <code>200 N</code> is enough to make the nut spin on a bolt, resulting in the nut traveling vertically along the bolt for just under 1 centimeter, and spinning for over 90 degrees. Note: the externally applied force <em>does not</em> show up on my graph.</p> <p><strong>2.</strong> Applying tangentially in a horizontal plane force using <code>iiwa</code> and a simple position controller. <a href="https://i.stack.imgur.com/eTPSx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eTPSx.png" alt="enter image description here" /></a></p> <p><strong>Experiment summary:</strong> The force here is approximately the same as before: <code>70N</code> along <code>tz</code>, but higher (<code>170N</code>) in <code>tx</code> and <code>ty</code>, though it is applied now only for a brief moment. The nut travels just a few degrees or hundredth fractions of centimeter. The video of this unsuccessful interaction is below, the contact forces are visualized using <code>ContactVisualizer</code>.</p> <p><a href="https://i.stack.imgur.com/mY8dq.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mY8dq.gif" alt="enter image description here" /></a></p> <p>Please advise me on how to make this <code>screw_joint</code> more compliant?</p> <p>I've tried varying <code>mass</code> and <code>inertia</code> of the nut (different up to the orders of magnitude) in these experiments, this seems to scale the contact forces, but does not affect acceleration or velocity of the nut after contact.</p>
[ { "answer_id": 74338992, "author": "Dmitri K", "author_id": 1912514, "author_profile": "https://Stackoverflow.com/users/1912514", "pm_score": 1, "selected": false, "text": "ExternallyAppliedSpatialForce" } ]
2022/10/21
[ "https://Stackoverflow.com/questions/74159401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1912514/" ]
74,159,418
<p>I have this controller method that am using to search users in a given user group using email and name. I have two groups <strong>customer</strong> and <strong>staff</strong>, when I search staff it returns customers too.</p> <p>Here is the controller code</p> <pre class="lang-php prettyprint-override"><code> public function index(Request $request, UserGroup $group) { //group=staff $users = $group-&gt;users(); if ($request-&gt;has('search') &amp;&amp; $request-&gt;search) { $users-&gt;where('name', 'LIKE', '%' . $request-&gt;search . '%') -&gt;orWhere(function ($builder) use ($request) { $builder-&gt;where('email', 'LIKE', '%' . $request-&gt;search . '%'); }); } return response()-&gt;json($users-&gt;get()); } </code></pre> <p>Inside the UserGroup model here is the implementation of the code</p> <pre class="lang-php prettyprint-override"><code>class UserGroup extends Model{ //... public function users(): BelongsToMany | User | Collection { return $this-&gt;belongsToMany(User::class, 'user_user_group'); } //... } </code></pre> <p>All I want is users with UserGroup <code>staff</code> and has name or email as typed in the search key. Instead, the system is returning even users who do not have the staff user group.</p> <p>What am I doing wrong?</p>
[ { "answer_id": 74159905, "author": "Shailesh Matariya", "author_id": 6196907, "author_profile": "https://Stackoverflow.com/users/6196907", "pm_score": 2, "selected": true, "text": "orWhere" }, { "answer_id": 74161366, "author": "xenooooo", "author_id": 20283630, "auth...
2022/10/21
[ "https://Stackoverflow.com/questions/74159418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9582853/" ]
74,159,436
<p>I created a dataframe with some previous operations but when I query a column name with an index (for example, df['order_number][0] ), multiple rows/records come as output. The screenshot shows the unique and total indexes of the dataframe. <a href="https://i.stack.imgur.com/Wnrs0.png" rel="nofollow noreferrer">image shows the difference in lengths of uniques indexes and all indexes</a></p>
[ { "answer_id": 74159475, "author": "Hanna", "author_id": 16645466, "author_profile": "https://Stackoverflow.com/users/16645466", "pm_score": 3, "selected": true, "text": "df.reset_index()\n" } ]
2022/10/21
[ "https://Stackoverflow.com/questions/74159436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20304685/" ]
74,159,459
<p>I don't want to replace ALL dashes in a string, but rather replace only those dashes that are part of a GUID/UUID.</p> <p><strong>Before the replace:</strong></p> <blockquote> <p>Mary-Anne Smith is a physics professor at the University of Illinois. Her dissertation was focused on the Higgs-Boson particle. Her professor ID is 01140384-5189-11ed-beb7-fa163e98fdf8. You can reach her at mary-annes@ui.edu.</p> </blockquote> <p><strong>After the replace:</strong></p> <blockquote> <p>Mary-Anne Smith is a physics professor at the University of Illinois. Her dissertation was focused on the Higgs-Boson particle. Her professor ID is 01140384518911edbeb7fa163e98fdf8. You can reach her at mary-annes@ui.edu.</p> </blockquote>
[ { "answer_id": 74159512, "author": "Barmar", "author_id": 1491895, "author_profile": "https://Stackoverflow.com/users/1491895", "pm_score": 1, "selected": false, "text": "REGEXP_SUBSTR()" }, { "answer_id": 74160352, "author": "Himanshu", "author_id": 10497483, "author...
2022/10/21
[ "https://Stackoverflow.com/questions/74159459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20304678/" ]
74,159,499
<p>I have PyMOL already installed on my Linux machine. I know it is installed because when I write <code>pymol -cp pymol_api_test.py</code> the script executes.</p> <p>I want to run the following python script using <code>python3</code>:</p> <pre><code>import pymol from pymol import cmd print(cmd.align(&quot;/home/bbq_spatial/bbq_input_pdb/pdb1a6j.pdb&quot;, &quot;/home/bbq_spatial/bbq_output_pdb/pdb1a6j.pdb&quot;, cycles=0, transform=0)) </code></pre> <p>However, it doesn't run when I call it using <code>python3</code>:</p> <pre><code>user_name@server_name:~$ nano pymol_api_test.py user_name@server_name:~$ python3 pymol_api_test.py Traceback (most recent call last): File &quot;pymol_api_test.py&quot;, line 1, in &lt;module&gt; import pymol ModuleNotFoundError: No module named 'pymol' user_name@server_name:~$ </code></pre> <p>How can I resolve this?</p>
[ { "answer_id": 74159512, "author": "Barmar", "author_id": 1491895, "author_profile": "https://Stackoverflow.com/users/1491895", "pm_score": 1, "selected": false, "text": "REGEXP_SUBSTR()" }, { "answer_id": 74160352, "author": "Himanshu", "author_id": 10497483, "author...
2022/10/21
[ "https://Stackoverflow.com/questions/74159499", "https://Stackoverflow.com", "https://Stackoverflow.com/users/159072/" ]
74,159,532
<p>I have a Makefile:</p> <pre><code>.PHONY: target0 target1 target0: &lt;command&gt; target1: target0 &lt;command&gt; </code></pre> <p>How can I run <code>make target1</code> and force it to skip <code>target0</code>?</p>
[ { "answer_id": 74159675, "author": "John Bollinger", "author_id": 2402272, "author_profile": "https://Stackoverflow.com/users/2402272", "pm_score": 2, "selected": true, "text": "make" }, { "answer_id": 74169600, "author": "urcodebetterznow", "author_id": 14403369, "au...
2022/10/21
[ "https://Stackoverflow.com/questions/74159532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1334858/" ]
74,159,557
<p>controller.cs put function</p> <pre><code>[HttpPut(&quot;{id}&quot;)] public async Task&lt;LookupTable&gt; Put(int id, [FromBody] LookupTable lookuptable) { var item = await lookupRepository.UpdateLookup(id,lookuptable); return item; } </code></pre> <p>I have the following function in the repository layer:</p> <pre><code> public async Task&lt;LookupTable&gt; UpdateLookup(int id, LookupTable entity) { LookupTable item = await riskDBContext.LookupTables.Where(c=&gt; c.LookupId==id).FirstOrDefaultAsync(); item=entity; var result = await riskDBContext.SaveChangesAsync(); return item; } </code></pre> <p>This doesnot update. however if i change the code to:</p> <pre><code> public async Task&lt;LookupTable&gt; UpdateLookup(int id, LookupTable entity) { LookupTable item = await riskDBContext.LookupTables.Where(c=&gt; c.LookupId==id).FirstOrDefaultAsync(); item.LookupAttribute = entity.LookupAttribute; var result = await riskDBContext.SaveChangesAsync(); return item; } </code></pre> <p>it does update in the database. Why is it so? I have many properties in the Lookuptable. so I thought if I put item=entity all the old values will be replaced.</p> <p>is there a way to update all the properties instead of assigning one by one?</p>
[ { "answer_id": 74159675, "author": "John Bollinger", "author_id": 2402272, "author_profile": "https://Stackoverflow.com/users/2402272", "pm_score": 2, "selected": true, "text": "make" }, { "answer_id": 74169600, "author": "urcodebetterznow", "author_id": 14403369, "au...
2022/10/21
[ "https://Stackoverflow.com/questions/74159557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4679505/" ]
74,159,585
<p>I want to send messages once a day to Kafka via Azure Databricks. I want the messages received as a batch job.</p> <p>I need to send them to a kafka server, but we don't want to have a cluster on all day running for this job.</p> <p>I saw the databricks writeStream method (i can't make it work yet, but that is not the purpose of my question). It looks like i need to be streaming day and night to make it run.</p> <p>Is there a way to use it as a batch job? Can i send the messages to Kafka server, and close my cluster once they are received?</p> <pre><code>df = spark \ .readStream \ .format(&quot;delta&quot;) \ .option(&quot;numPartitions&quot;, 5) \ .option(&quot;rowsPerSecond&quot;, 5) \ .load('/mnt/sales/marketing/numbers/DELTA/') (df.select(&quot;Sales&quot;, &quot;value&quot;) .writeStream .format(&quot;kafka&quot;) .option(&quot;kafka.bootstrap.servers&quot;, &quot;rferferfeez.eu-west-1.aws.confluent.cloud:9092&quot;) .option(&quot;topic&quot;, &quot;bingofr&quot;) .option(&quot;kafka.sasl.username&quot;, &quot;jakich&quot;) .option(&quot;kafka.sasl.password&quot;, 'ozifjoijfziaihufzihufazhufhzuhfzuoehza') .option(&quot;checkpointLocation&quot;, &quot;/mnt/sales/marketing/numbers/temp/&quot;) .option(&quot;spark.kafka.clusters.cluster.sasl.token.mechanism&quot;, &quot;cluster-buyit&quot;) .option(&quot;request.timeout.ms&quot;,30) \ .option(&quot;includeHeaders&quot;, &quot;true&quot;) \ .start() ) </code></pre> <blockquote> <p>kafkashaded.org.apache.kafka.common.errors.TimeoutException: Topic bingofr not present in metadata after 60000 ms.</p> </blockquote> <p><a href="https://i.stack.imgur.com/Mbxq3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mbxq3.png" alt="enter image description here" /></a></p> <p>It is worth noting we also have event hub. Would i be better off sending messages to our event hub, and implement a triggered function that writes to kafka ?</p>
[ { "answer_id": 74159675, "author": "John Bollinger", "author_id": 2402272, "author_profile": "https://Stackoverflow.com/users/2402272", "pm_score": 2, "selected": true, "text": "make" }, { "answer_id": 74169600, "author": "urcodebetterznow", "author_id": 14403369, "au...
2022/10/21
[ "https://Stackoverflow.com/questions/74159585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9885786/" ]
74,159,596
<p>The amount of recursive calls to the following function need to be counted:</p> <pre><code>def fb(n, d): if n in d: return d[n] else: ans = fb(n-1, d) + fb(n-2, d) d[n] = ans return ans d = {1:1, 2:2} print(fb(8, d)) print(d) </code></pre> <p>Now i understand the function, and what essentially happens, i just cant wrap my brain around counting the amount of recursions manually(by hand). I can count the recursions with code or jsut by looking at 'd' but im unable to understand why there are only 13 recursive calls in the end.</p> <p>The following happens in my mind: ans makes 2 recursive calls (n = 7 and n = 6) each of these two make two more calls etc etc till all these calls end with an n of 2 or 1.</p> <p>But if i look at the code, and just print the n on every time the function is run i get the following output:</p> <pre><code>def fb(n, d): if n in d: return d[n] else: print(n) ans = fb(n-1, d) + fb(n-2, d) d[n] = ans return ans d = {1:1, 2:2} print(fb(8, d)) </code></pre> <p>Output:</p> <pre><code>8 7 6 5 4 3 32 </code></pre> <p>Now i know the answer is 13, 2 calls to the function (2 * 6) on each number + the last call which returns the ans. But my question is, how is this internally working, and how can i replicate this thought process in my head.</p> <p>Thank you for your time.</p>
[ { "answer_id": 74159666, "author": "Code-Apprentice", "author_id": 1440565, "author_profile": "https://Stackoverflow.com/users/1440565", "pm_score": 1, "selected": false, "text": "ans" }, { "answer_id": 74159685, "author": "Tom Karzes", "author_id": 5460719, "author_p...
2022/10/21
[ "https://Stackoverflow.com/questions/74159596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19027605/" ]
74,159,604
<p>In the following code I would like to get the 2nd string in a vector <code>args</code> and then parse it into an <code>i32</code>. This code will not complie, however, because i can not call <code>parse()</code> on the Option value returned by <code>nth()</code>.</p> <pre><code>use std::env; fn main() { let args: Vec&lt;String&gt; = env::args().collect(); let a = args.iter().nth(1).parse::&lt;i32&gt;(); } </code></pre> <p>I know i could just use <code>expect()</code> to unwrap the value, before trying to parse it, however I do not want my code to panic. I want <code>a</code> to be a Result value that is an Err if either <code>nth()</code> or <code>parse()</code> fails, and otherwise is a Ok(Int). Is there a way to accomplish this in rust? Thanks.</p>
[ { "answer_id": 74159706, "author": "Aleksander Krauze", "author_id": 13078067, "author_profile": "https://Stackoverflow.com/users/13078067", "pm_score": 0, "selected": false, "text": "use std::{env, num::ParseIntError};\n\nenum Error {\n ParseIntError(ParseIntError),\n Empty,\n}\n\...
2022/10/21
[ "https://Stackoverflow.com/questions/74159604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16337382/" ]
74,159,623
<p>I am trying to exclude the data before and after the vertical line <code>|</code> and keep only the data between them. Since I need to keep only the data between the first vertical line <code>|</code> and second vertical line <code>|</code>, if I use <code>*|</code> in the find column and click on the replace all, it removing the data in the middle (doing opposite of what I need). Any help would be appreciated on how to approach this.</p> <p>Each line is a row in the excel.</p> <p><strong>Sample data in excel:</strong></p> <pre><code>san-diego-22 | AWS clusters1 | P-12313123 america.ls.office | kafka version is not matched | P-34522 sso@email.com | VM is not responding | P-123123 projects/pos@gmail.com/accounts/iap-232434.com/vault/3f4s234234234wd2342342 </code></pre> <p><strong>Output</strong></p> <pre><code>AWS clusters1 kafka version is not matched VM is not responding projects/pos@gmail.com/accounts/iap-232434.com/vault/3f4s234234234wd2342342 </code></pre> <p>Thank you</p>
[ { "answer_id": 74159898, "author": "P.b", "author_id": 12634230, "author_profile": "https://Stackoverflow.com/users/12634230", "pm_score": 3, "selected": true, "text": "=IFERROR(\n SUBSTITUTE(\n SUBSTITUTE(\n A1,\n LEFT(A1,FIND(\"|\",A1)+1),\n \...
2022/10/21
[ "https://Stackoverflow.com/questions/74159623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20304777/" ]
74,159,637
<p>I need to add a Cropping2D layer where the left and right crop arguments are determined dynamically by the output of previous layers. I.E., the left_crop and right_crop arguments are not known at code-time. However, I seem unable to access the value of a previous tensor in the model. Here is my code:</p> <pre><code>input1 = Input(name='dirty', shape=(IMG_HEIGHT, None, 1), dtype='float32') input2 = Input(name='x0', shape=(), dtype='int32') input3 = Input(name='x1', shape=(), dtype='int32') # Encoder conv1 = Conv2D(48, kernel_size=(3, 3), activation='relu', padding='same', name='conv1')(input1) pool1 = MaxPooling2D(pool_size=(2, 2), strides=(2, 2), name='pool1')(conv1) conv2 = Conv2D(64, kernel_size=(3, 3), activation='relu', padding='same', name='conv2')(pool1) # Decoder deconv2 = Conv2DTranspose(48, kernel_size=(3, 3), activation='relu', padding='same', name='deconv2')(conv2) depool1 = UpSampling2D(size=(2, 2), name='depool1')(deconv2) output1 = Conv2DTranspose(1, kernel_size=(3, 3), activation='relu', padding='same', name='clean')(depool1) _, _, width, _ = K.int_shape(output1) left = K.eval(input2) right = width - K.eval(input3) output2 = Cropping2D(name='clean_snippet', cropping=((0, 0), (left, right)))(output1) </code></pre> <p>That produces the following error:</p> <pre><code>Traceback (most recent call last): File &quot;test.py&quot;, line 81, in &lt;module&gt; left = K.eval(input2) File &quot;/Users/garnet/Library/Python/3.8/lib/python/site-packages/keras/backend.py&quot;, line 1632, in eval return get_value(to_dense(x)) File &quot;/Users/garnet/Library/Python/3.8/lib/python/site-packages/keras/backend.py&quot;, line 4208, in get_value return x.numpy() AttributeError: 'KerasTensor' object has no attribute 'numpy' </code></pre> <p>I'm using TF 2.10.0 with Keras 2.10.0. I've tried both with and without eager mode enabled. My question is specifically about the four lines after the &quot;HERE'S THE AREA IN QUESTION...&quot; comment in my code above. How can I access previous layer values to use them as an <em>argument</em> (not the input layer) to Cropping2D(). Any ideas?</p> <p>For context, here's my entire code:</p> <pre><code>import tensorflow as tf import cv2 import random import os import numpy as np from tensorflow.keras import backend as K from tensorflow.keras.models import Model from tensorflow.keras.optimizers import SGD from tensorflow.keras.layers import Conv2D, Conv2DTranspose, MaxPooling2D, Cropping2D, UpSampling2D, Input from tensorflow.keras import losses SNIPPET_WIDTH = 40 IMG_HEIGHT = 60 def get_data(paths): for path in paths: clean = cv2.imread(path.decode('utf-8'), cv2.IMREAD_GRAYSCALE) h, w = clean.shape dirty = cv2.blur(clean, (random.randint(1, 5), random.randint(1, 5))) x0 = random.randint(0, w - SNIPPET_WIDTH) x1 = x0 + SNIPPET_WIDTH y0 = 0 y1 = h - 1 clean_snippet = clean[y0:y1, x0:x1] dirty[y0:y1, x0:x1] = 0 # masked out region dirty = (256. - dirty.astype(np.float32)) / 255. dirty = tf.convert_to_tensor(np.expand_dims(dirty, axis=2)) x0 = tf.convert_to_tensor(x0) x1 = tf.convert_to_tensor(x1) clean = (256. - clean.astype(np.float32)) / 255. clean = tf.convert_to_tensor(np.expand_dims(clean, axis=2)) clean_snippet = (256. - clean_snippet.astype(np.float32)) / 255. clean_snippet = tf.convert_to_tensor(np.expand_dims(clean_snippet, axis=2)) yield {'dirty': dirty, 'x0': x0, 'x1': x1}, {'clean': clean, 'clean_snippet': clean_snippet} train_directory = 'data/training/' files = os.listdir(train_directory) paths = [] for f in files: filename = os.fsdecode(f) paths.append(train_directory + filename) train_ds = tf.data.Dataset.from_generator(get_data, args=[paths], output_signature=( { 'dirty': tf.TensorSpec(shape=(IMG_HEIGHT, None, 1), dtype=tf.float32), 'x0': tf.TensorSpec(shape=(), dtype=tf.int32), 'x1': tf.TensorSpec(shape=(), dtype=tf.int32) }, { 'clean': tf.TensorSpec(shape=(IMG_HEIGHT, None, 1), dtype=tf.float32), 'clean_snippet': tf.TensorSpec(shape=(IMG_HEIGHT, None, 1), dtype=tf.float32) } )) bucket_sizes = [400, 500, 600, 700, 800] bucket_batch_sizes = [16, 16, 16, 16, 16, 16] train_ds = train_ds.bucket_by_sequence_length(element_length_func=lambda x, y: tf.shape(y['clean'])[1], bucket_boundaries=bucket_sizes, bucket_batch_sizes=bucket_batch_sizes) input1 = Input(name='dirty', shape=(IMG_HEIGHT, None, 1), dtype='float32') input2 = Input(name='x0', shape=(), dtype='int32') input3 = Input(name='x1', shape=(), dtype='int32') # Encoder conv1 = Conv2D(48, kernel_size=(3, 3), activation='relu', padding='same', name='conv1')(input1) pool1 = MaxPooling2D(pool_size=(2, 2), strides=(2, 2), name='pool1')(conv1) conv2 = Conv2D(64, kernel_size=(3, 3), activation='relu', padding='same', name='conv2')(pool1) # Decoder deconv2 = Conv2DTranspose(48, kernel_size=(3, 3), activation='relu', padding='same', name='deconv2')(conv2) depool1 = UpSampling2D(size=(2, 2), name='depool1')(deconv2) output1 = Conv2DTranspose(1, kernel_size=(3, 3), activation='relu', padding='same', name='clean')(depool1) # HERE'S THE AREA IN QUESTION... _, _, width, _ = K.int_shape(output1) left = K.eval(input2) right = width - K.eval(input3) output2 = Cropping2D(name='clean_snippet', cropping=((0, 0), (left, right)))(output1) # ...END AREA IN QUESTION model = Model(inputs=[input1, input2, input3], outputs=[output1, output2]) optimizer = SGD(lr=0.02, decay=1e-6, momentum=0.9, nesterov=True, clipnorm=5) loss_fcns = {'clean': losses.MeanAbsoluteError(), 'clean_snippet': losses.MeanAbsoluteError()} model.compile(loss=losses.MeanAbsoluteError(), optimizer=optimizer, metrics=['acc']) model.fit(x=train_ds, y=None, epochs=1000, shuffle=True, verbose=1) </code></pre>
[ { "answer_id": 74160263, "author": "Yaoshiang", "author_id": 10648765, "author_profile": "https://Stackoverflow.com/users/10648765", "pm_score": 0, "selected": false, "text": "tf.sequence_mask" }, { "answer_id": 74200636, "author": "jonmorrey76", "author_id": 7331513, ...
2022/10/21
[ "https://Stackoverflow.com/questions/74159637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7331513/" ]
74,159,664
<p>I have 3 different password input as:</p> <pre><code> --Current Password Input &lt;input asp-for=&quot;ChangePassword.OldPassword&quot; class=&quot;form-control&quot; id=&quot;currentPassword&quot; required autofocus /&gt; &lt;button class=&quot;btn btn-light shadow-none ms-0&quot; type=&quot;button&quot; id=&quot;toggleCurrentPassword&quot; tabindex=&quot;99&quot;&gt;&lt;i class=&quot;mdi mdi-eye-outline&quot;&gt;&lt;/i&gt;&lt;/button&gt; --New password input &lt;input asp-for=&quot;ChangePassword.NewPassword&quot; class=&quot;form-control&quot; id=&quot;newPassword&quot; required autofocus /&gt; &lt;button class=&quot;btn btn-light shadow-none ms-0&quot; type=&quot;button&quot; id=&quot;toggleNewPassword&quot; tabindex=&quot;99&quot;&gt;&lt;i class=&quot;mdi mdi-eye-outline&quot;&gt;&lt;/i&gt;&lt;/button&gt; --Confirm password input &lt;input asp-for=&quot;ChangePassword.ConfirmPassword&quot; id=&quot;confirmPassword&quot; class=&quot;form-control&quot; required autofocus /&gt; &lt;button class=&quot;btn btn-light shadow-none ms-0&quot; type=&quot;button&quot; id=&quot;toggleConfirmPassword&quot; tabindex=&quot;99&quot;&gt;&lt;i class=&quot;mdi mdi-eye-outline&quot;&gt;&lt;/i&gt;&lt;/button&gt; </code></pre> <p>As you can see each one have a button, when user click I remove the type password, and if the user click again I add it again.</p> <p>My script to do that:</p> <pre><code> $('#toggleCurrentPassword').click(function() { if ($('#currentPassword').attr('type') === &quot;password&quot;) { $('#currentPassword').attr('type', 'text'); } else { $('#currentPassword').attr('type', 'password'); } }) $('#toggleNewPassword').click(function() { if ($('#newPassword').attr('type') === &quot;password&quot;) { $('#newPassword').attr('type', 'text'); } else { $('#newPassword').attr('type', 'password'); } }) $('#toggleConfirmPassword').click(function() { if ($('#confirmPassword').attr('type') === &quot;password&quot;) { $('#confirmPassword').attr('type', 'text'); } else { $('#confirmPassword').attr('type', 'password'); } }) </code></pre> <p>It is working, but I think it should be a better way to do this, there is a lot of repeated code in function. How can I do a better work here? Regards</p>
[ { "answer_id": 74159754, "author": "Bqardi", "author_id": 14647816, "author_profile": "https://Stackoverflow.com/users/14647816", "pm_score": 2, "selected": true, "text": "function passwordToggle(button, input) {\n $(button).click(function() {\n if ($(input).attr('type') === \"passwo...
2022/10/21
[ "https://Stackoverflow.com/questions/74159664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20286048/" ]
74,159,679
<p>I'm trying to make it so that my text alternates between upper and lower case like the question ask. It seems to skip 3 in the indexing and I can't figure out why.</p> <pre><code>sentence = input(&quot;Write a sentence&quot;) newList = [] for i in range(len(sentence)): if sentence[i] != &quot; &quot;: newList.append(sentence[i]) listJoint = &quot;&quot;.join(newList) newList2 = [] for i in range(len(listJoint)): if (listJoint.index(listJoint[i]) % 2) == 0: print(listJoint.index(listJoint[i])) newList2.append(listJoint[i].upper()) elif (listJoint.index(listJoint[i]) % 2) != 0: print(listJoint.index(listJoint[i])) newList2.append(listJoint[i].lower()) print(newList2) #newListJoint = &quot;&quot;.join(newList2) #print(newListJoint[::-1]) </code></pre> <p>Thanks in advance <a href="https://i.stack.imgur.com/tJ1Vx.png" rel="nofollow noreferrer">List index doesn't go 0 1 2 3 4</a></p>
[ { "answer_id": 74159896, "author": "cards", "author_id": 16462878, "author_profile": "https://Stackoverflow.com/users/16462878", "pm_score": 0, "selected": false, "text": "sentence = \"Hello\"\n\nalternated_sentence = ''\nfor i, char in enumerate(sentence):\n if i % 2:\n altern...
2022/10/21
[ "https://Stackoverflow.com/questions/74159679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20304850/" ]
74,159,688
<p>I am trying to create Unit test for below two methods using MsTest. I am fairly new to this, and so far have referred to different posts on the Topic.</p> <p><strong>Code Requirement</strong></p> <ol> <li>Create a Timer Based Function (Azure)</li> <li>Execute Method 1 and Method 2 in the order to get the Output.</li> </ol> <p><strong>Test Requirement</strong></p> <ol start="3"> <li>Ability to be able to create Unit test cases for each Class/Method with no external dependency (Fake/Mock)</li> <li>To Fit this Code under Test can be update as code is not yet Live.</li> <li>Open to other tools/Nugets beyond Moq to support the Test requirement.</li> </ol> <p>When I try to run the Unit test, it does not mock Method 2 instead executes it. I need help in debugging the code.</p> <pre><code> public class Job: IJob { //Method 1 public List&lt;TableEntity&gt; GetJob() { var a = Get&lt;T&gt;(&quot;static value&quot;); //Mock this to Test Method GetJob return a.Result; } //Method 2 public async Task&lt;List&lt;T&gt;&gt; Get&lt;T&gt;(string tableName) where T : ITableEntity, new() { var t = new List&lt;T&gt;(); //add data to T return t; } } </code></pre> <p><strong>Interface</strong></p> <pre><code>public interface IJob { List&lt;TableEntity&gt; GetJob(); Task&lt;List&lt;T&gt;&gt; Get&lt;T&gt;(string tableName) where T : ITableEntity, new(); } </code></pre> <p><strong>Test Code</strong></p> <pre><code> private readonly Mock&lt;IJob&gt; _mockIJob = new Mock&lt;IJob&gt;(); readonly Job _job = new Job(); public void NotThrow_Error_When_JobFound() { //Arrange var jobs = new J.TableEntity() { FolderName = &quot;FolderName&quot;, Timestamp = DateTimeOffset.Now }; var jobList = Task.FromResult(new List&lt;TableEntity&gt;() { jobs }); _mockIJob.Setup(c =&gt; c.Get&lt;TableEntity&gt;(&quot;&quot;)) .Returns(jobList); //Act var actualResult = _job.GetJob(); //Assert Assert.AreEqual(jobList, actualResult); } </code></pre>
[ { "answer_id": 74159896, "author": "cards", "author_id": 16462878, "author_profile": "https://Stackoverflow.com/users/16462878", "pm_score": 0, "selected": false, "text": "sentence = \"Hello\"\n\nalternated_sentence = ''\nfor i, char in enumerate(sentence):\n if i % 2:\n altern...
2022/10/21
[ "https://Stackoverflow.com/questions/74159688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18618869/" ]
74,159,698
<p>I have a problem with doing a subquery in PostgreSQL to get a calculated column value, it reports:</p> <blockquote> <p>[21000] ERROR: more than one row returned by a subquery used as an expression</p> </blockquote> <h2>Situation</h2> <p>I have two tables:</p> <ol> <li>accounts</li> <li>postal_code_to_state</li> </ol> <p>Accounts table (subset of columns)</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>name</th> <th>postal_code</th> <th>state</th> </tr> </thead> <tbody> <tr> <td>Cust One</td> <td>00020</td> <td>NULL</td> </tr> <tr> <td>Cust Two</td> <td>63076</td> <td>CD</td> </tr> </tbody> </table> </div> <p>Postal Code to State</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>pc_from</th> <th>pc_to</th> <th>state</th> </tr> </thead> <tbody> <tr> <td>10</td> <td>30</td> <td>AB</td> </tr> <tr> <td>63000</td> <td>63100</td> <td>CD</td> </tr> </tbody> </table> </div> <p>The <code>accounts</code> table has rows where the state value <em>may</em> be unknown, but there is a postal code value. The postal code field is char (but that is incidental).</p> <p>The <code>postal_code_to_state</code> table has rows with postcode (integer) from &amp; to columns. That is the low/high numbers of the postal code range for a state.</p> <p>There is no common field to do joins. To get the state from the <code>postal_code_to_state</code> table the char field is cast to INT and the <code>between</code> operator used, e.g.</p> <pre><code>SELECT state FROM postal_code_to_state WHERE CAST('00020' AS INT) BETWEEN pc_from AND pc_to </code></pre> <p>this works OK, there is also a unique index on <code>pc_from</code> and <code>pc_to</code>.</p> <p>But I need to run a query selecting from the accounts table and populating the state column from the state column <em><strong>in the postal_code_to_state table</strong></em> using the postal_code from the accounts table to select the appropriate row.</p> <p>I can't figure out why PostgreSQL is complaining about the subquery returning multiple rows. This is the query I am currently using:</p> <pre><code>SELECT id, name, postal_code, state, (SELECT state FROM postal_code_to_state WHERE CAST(accounts.postal_code AS INT) BETWEEN pc_from AND pc_to) AS new_state FROM accounts WHERE postal_code IS NOT NULL ; </code></pre> <p>If I use <code>LIMIT 1</code> in the subquery it is OK, and it returns the correct state value from postal_code_to_state, but would like to have it working without need to do that.</p> <h2>UPDATE 2022-10-22</h2> <p>@Adrian - thanks for query to find duplicates, I had to change your query a little, the <code>!= 'empty'</code> to <code>!= FALSE</code>.</p> <p>When I run it on data I get this, groups of two rows (1 &amp; 2, 3 &amp; 4, etc.) shows the overlapping ranges.</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>state</th> <th>pc_from</th> <th>pc_to</th> </tr> </thead> <tbody> <tr> <td>CA</td> <td>9010</td> <td>9134</td> </tr> <tr> <td>OR</td> <td>9070</td> <td>9170</td> </tr> <tr> <td>UD</td> <td>33010</td> <td>33100</td> </tr> <tr> <td>PN</td> <td>33070</td> <td>33170</td> </tr> <tr> <td>TS</td> <td>34010</td> <td>34149</td> </tr> <tr> <td>GO</td> <td>34070</td> <td>34170</td> </tr> <tr> <td>CB</td> <td>86010</td> <td>86100</td> </tr> <tr> <td>IS</td> <td>86070</td> <td>86170</td> </tr> </tbody> </table> </div> <p>So if I run...</p> <pre><code>SELECT pc_from, pc_to, state FROM postal_code_to_state WHERE int4range(pc_from, pc_to) @&gt; 9070; </code></pre> <p>I get...</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>pc_from</th> <th>pc_to</th> <th>state</th> </tr> </thead> <tbody> <tr> <td>9010</td> <td>9134</td> <td>CA</td> </tr> <tr> <td>9070</td> <td>9170</td> <td>OR</td> </tr> </tbody> </table> </div> <p>So, from the PostgreSQL side, the problem is clear - obviously it is the data. On the point of the data, what is shown on a site that has Italian ZIP code information is interesting:</p> <p><a href="https://zip-codes.nonsolocap.it/cap?k=12071&amp;b=&amp;c=" rel="nofollow noreferrer">https://zip-codes.nonsolocap.it/cap?k=12071&amp;b=&amp;c=</a></p> <p>This was one of the dupes I had already removed.</p> <p>The exact same ZIP code is used in two completely different provinces (states) - go figure! Given that the ZIP code is meant to resolve down to the street level, I can't see how one code can be valid for two localities.</p>
[ { "answer_id": 74159896, "author": "cards", "author_id": 16462878, "author_profile": "https://Stackoverflow.com/users/16462878", "pm_score": 0, "selected": false, "text": "sentence = \"Hello\"\n\nalternated_sentence = ''\nfor i, char in enumerate(sentence):\n if i % 2:\n altern...
2022/10/21
[ "https://Stackoverflow.com/questions/74159698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17160053/" ]
74,159,752
<p>please, I have a problem with easy application and passing parameter from child to parent. I've tried id and its work. But child component doesn't render <code>onClick</code> event in my child component.</p> <p>Here is the whole parent (file <code>App.js</code>):</p> <pre class="lang-js prettyprint-override"><code>import { useState } from 'react'; import Task from './components/task'; function App() { const [newTask, setNewTask] = useState(''); const [tasks, setTasks] = useState([]); const handleChange = (e) =&gt; { if (e.target.value.length === 1) { e.target.value = e.target.value.toUpperCase(); } setNewTask(e.target.value); }; const handleSubmit = (e) =&gt; { e.preventDefault(); setTasks([ ...tasks, { id: [...tasks].length === 0 ? 0 : Math.max(...tasks.map((task) =&gt; task.id)) + 1, name: newTask, }, ]); setNewTask(''); }; const handleEdit = (buttonValues) =&gt; { console.log(buttonValues.type + ': ' + buttonValues.id); }; return ( &lt;div className=&quot;container&quot;&gt; &lt;h1&gt;Task Manager&lt;/h1&gt; &lt;form onSubmit={handleSubmit}&gt; &lt;label htmlFor=&quot;newTaskInput&quot; className=&quot;sr-only&quot;&gt; Input for new task &lt;/label&gt; &lt;input id=&quot;newTaskInput&quot; type=&quot;text&quot; onChange={handleChange} value={newTask} placeholder=&quot;Add new task here...&quot; autoFocus /&gt; &lt;/form&gt; &lt;ul&gt; {tasks.map((task, index) =&gt; { return &lt;Task id={task.id} name={task.name} key={index} onActionButtonClick={handleEdit} /&gt;; })} &lt;/ul&gt; &lt;/div&gt; ); } export default App; </code></pre> <p>and my child component (file <code>task.jsx</code>) looks like:</p> <pre class="lang-js prettyprint-override"><code>import React from 'react'; const Task = (props) =&gt; { const { id, name } = props; const handleActionButton = (buttonValues) =&gt; { props.onActionButtonClick(buttonValues); }; return ( &lt;li id={`task-${id}`} data-id={id}&gt; &lt;span&gt;{name}&lt;/span&gt; &lt;button data-id={id} type=&quot;button&quot; className=&quot;btn-done&quot; title=&quot;Mark task as done&quot; onClick={alert('Done')}&gt; Done &lt;/button&gt; &lt;button data-id={id} type=&quot;button&quot; className=&quot;btn-edit&quot; title=&quot;Edit this task&quot; onClick={alert('Edit')}&gt; Edit &lt;/button&gt; &lt;button data-id={id} type=&quot;button&quot; className=&quot;btn-delete&quot; title=&quot;Delete this task&quot; onClick={alert('Delete')}&gt; Delete &lt;/button&gt; &lt;/li&gt; ); }; export default Task; </code></pre> <p>If you run it, console log with type and id will show after every type in input field if some task already exists. But if I click on any button, no onClick event is called.</p> <p>The first problem is, that event from child to parent with button type and id from list should be called only after onClick.</p> <p>The second problem is that event handleEdit is called after every change in <code>newTask</code> state.</p> <p>The original code has instead of <code>console.log</code> in <code>onClick</code> event has</p> <pre class="lang-js prettyprint-override"><code>... const handleActionButton = (buttonValues) =&gt; { props.onActionButtonClick(buttonValues); }; .... return ( ... &lt;button data-id={id} type=&quot;button&quot; className=&quot;btn-delete&quot; title=&quot;Delete this task&quot; onClick={handleActionButton({ type: 'delete', id: id })} ... ) </code></pre> <p>But it doesn't react onClick as well. And if I inspect <code>li</code> element it looks like:</p> <pre class="lang-html prettyprint-override"><code>&lt;li id=&quot;task-0&quot; data-id=&quot;0&quot;&gt;&lt;span&gt;Milk&lt;/span&gt;&lt;button data-id=&quot;0&quot; type=&quot;button&quot; class=&quot;btn-done&quot; title=&quot;Mark task as done&quot;&gt;Done&lt;/button&gt;&lt;button data-id=&quot;0&quot; type=&quot;button&quot; class=&quot;btn-edit&quot; title=&quot;Edit this task&quot;&gt;Edit&lt;/button&gt;&lt;button data-id=&quot;0&quot; type=&quot;button&quot; class=&quot;btn-delete&quot; title=&quot;Delete this task&quot;&gt;Delete&lt;/button&gt;&lt;/li&gt; </code></pre> <p>As you can see, there are no onClick event.</p> <p>Thank for help</p>
[ { "answer_id": 74159988, "author": "Bambi Bunny", "author_id": 1169081, "author_profile": "https://Stackoverflow.com/users/1169081", "pm_score": 0, "selected": false, "text": "\nconst handleActionButton = (buttonValues) => {\n props.onActionButtonClick(buttonValues);\n};\n...\n<button\n...
2022/10/21
[ "https://Stackoverflow.com/questions/74159752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1169081/" ]
74,159,760
<p>I am using the resample funtion to go from minute data to hour data. The issue is my original DF has only from 10:30 to 15:59 data and the new resampled data is creating new hour data. How to I get rid of this data or have it resample only the time stamps on the index and not create new ones.</p> <p>This is how the original DF looked: <a href="https://i.stack.imgur.com/Z4H0P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z4H0P.png" alt="original DF" /></a></p> <p>This is how the resampled DF looks: <a href="https://i.stack.imgur.com/C5Ea7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C5Ea7.png" alt="enter image description here" /></a></p> <p>My question is: how to I get ride of the other hour data from the resample and just include the previous hour data from the original DF?</p> <p>Below is the code that I used to created the resampledDF</p> <pre><code>ROD['time'] = pd.to_datetime(ROD['timestamp']) ROD.set_index('time', inplace = True, drop = True) resampled = ROD.resample('60Min',origin='start').agg({'open':'first', 'high':'max', 'low': 'min', 'close': 'last', 'volume':'sum'}) </code></pre> <p>Below is the output from printing resampled:</p> <pre><code> open high low close volume time 2020-09-28 10:31:00 333.984985 334.470001 332.779999 333.750000 6482408 2020-09-28 11:31:00 333.760010 334.260010 333.109985 333.469910 4456465 2020-09-28 12:31:00 333.475006 334.500000 333.190002 334.239990 3711147 2020-09-28 13:31:00 334.239990 334.820007 334.174988 334.501099 4181924 2020-09-28 14:31:00 334.500000 334.959992 334.079987 334.600006 5698198 ... ... ... ... ... 2022-09-23 11:31:00 367.779999 368.170013 365.070007 365.119995 9603892 2022-09-23 12:31:00 365.109985 367.190002 364.825012 365.778412 9306106 2022-09-23 13:31:00 365.769989 366.649994 364.089996 364.829895 9172447 2022-09-23 14:31:00 364.820007 366.480011 363.290008 366.221405 14831712 2022-09-23 15:31:00 366.220001 368.040008 366.000000 367.440002 14253081 </code></pre>
[ { "answer_id": 74159988, "author": "Bambi Bunny", "author_id": 1169081, "author_profile": "https://Stackoverflow.com/users/1169081", "pm_score": 0, "selected": false, "text": "\nconst handleActionButton = (buttonValues) => {\n props.onActionButtonClick(buttonValues);\n};\n...\n<button\n...
2022/10/21
[ "https://Stackoverflow.com/questions/74159760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14995520/" ]
74,159,766
<p>How can I add a value inside a string when a condition is met.</p> <p>For example, take the following data:</p> <pre><code>my_data &lt;- c(&quot;ab 93 1455 1863 2713 sb 673 771 1601 1969&quot;, &quot;ab 93 1098 1455 2423 2427 sb 168 673 1256&quot;, &quot;ab 93 1098; sb 1256&quot;) </code></pre> <p>I want to add a &quot;;&quot; when a number proceeds a character.</p> <p>Therefore, I would like the output to be:</p> <pre><code>output&lt;- c(&quot;ab 93 1455 1863 2713; sb 673 771 1601 1969&quot;, &quot;ab 93 1098 1455 2423 2427; sb 168 673 1256&quot;, &quot;ab 93 1098; sb 1256&quot;) </code></pre> <p>If this solution could be completed in the context of a data frame that would be great.</p> <p>So far, I have been able to detect the condition I'm interested in using the following code:</p> <pre><code>str_detect(my_data, &quot;[0-9] [a-z]&quot;) [1] TRUE TRUE FALSE </code></pre> <p>But I am having trouble moving beyond this point.</p> <p>Thank you for the help!</p>
[ { "answer_id": 74159806, "author": "Ric Villalba", "author_id": 6912817, "author_profile": "https://Stackoverflow.com/users/6912817", "pm_score": 3, "selected": true, "text": "output <- gsub(\"(\\\\d)( +[a-zA-Z])\", \"\\\\1;\\\\2\", my_data)\n\nprint(output)\n\n# [1] \"ab 93 1455 1863 27...
2022/10/21
[ "https://Stackoverflow.com/questions/74159766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7994685/" ]
74,159,797
<p>I have a dataframe <code>df</code> with columns <code>df.time</code> which outlines the month and time, and <code>df.names</code> so that it looks like this</p> <pre><code> time names 0 2020-01 Martha 1 2020-01 Jeff 2 2020-01 Geronimo 3 2020-02 Mike 4 2020-02 Michelle ... </code></pre> <p>I want to get the total number of names per unique value and plot it in a bar chart with months over x and value counts by month on y. I've tried</p> <pre><code>x=df.time.unique() y=df.groupby('time').size().sort_values(ascending=True) </code></pre> <p>For <code>y</code> I'm looking for the total number of names for each unique date in <code>time</code>. But while y does count the total for each time value, it's not in order and I don't know how to link them.</p>
[ { "answer_id": 74159877, "author": "Pierre D", "author_id": 758174, "author_profile": "https://Stackoverflow.com/users/758174", "pm_score": 0, "selected": false, "text": ">>> df.groupby('time')['names'].value_counts(normalize=True).unstack().plot(kind='bar')\n" }, { "answer_id": ...
2022/10/21
[ "https://Stackoverflow.com/questions/74159797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12462131/" ]
74,159,816
<p>Could you please help me to write the right syntax? I am stuck with the following code:</p> <pre class="lang-cs prettyprint-override"><code>GameObject cube = (GameObject)Instantiate(cube_prefab, new Vector3(x, y, 0), Quaternion.identity, transform); cube.GetComponentInChildren&lt;TextMeshPro&gt;.text = &quot;test&quot; **// WORKS FINE** </code></pre> <p>Take into account that inside my prefab i have more <strong>TextMeshPro</strong>, so my question is: how can I get to the second object if i can't access trought an array ? sounds weird for me</p> <pre class="lang-cs prettyprint-override"><code> cube.transform.GetChild(0).GetComponent&lt;TextMeshPro&gt;().text = &quot;AAA&quot; // DOESN'T WORK </code></pre> <p>Thanks in advance</p>
[ { "answer_id": 74159877, "author": "Pierre D", "author_id": 758174, "author_profile": "https://Stackoverflow.com/users/758174", "pm_score": 0, "selected": false, "text": ">>> df.groupby('time')['names'].value_counts(normalize=True).unstack().plot(kind='bar')\n" }, { "answer_id": ...
2022/10/21
[ "https://Stackoverflow.com/questions/74159816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9599284/" ]
74,159,930
<p>I have a dataframe and I wish to remove 2 columns from it using the names, following another post on here it suggests the following code should work (or be close to working), would anyone be able to point me in the right direction here.</p> <p>My df column dames</p> <p>head(economics_df)</p> <pre><code> `Series Name` `Series Code` Country `Country Code` `1997` `1998` `1999` `2000` `2001` `2002` `2003` `2004` `2005` `2006` `2007` `2008` `2009` `2010` `2011` `2012` 1 GDP (current … NY.GDP.MKTP.… Spain ESP 5.900… 6.192… 6.349… 5.983… 6.278… 7.087… 9.074… 1.069… 1.153… 1.260… </code></pre> <p>code to remove unwanted columns</p> <pre><code>economics_df = economics_df %&gt;% select(-c(`Series Code`, `Country Code`)) </code></pre> <p>other ways tried</p> <pre><code>economics_df = economics_df[-c(&quot;`Series Code`&quot;, &quot;`Country Code`&quot;)] </code></pre>
[ { "answer_id": 74159964, "author": "AndrewGB", "author_id": 15293191, "author_profile": "https://Stackoverflow.com/users/15293191", "pm_score": 3, "selected": true, "text": "library(dplyr)\n\neconomics_df = economics_df %>% \n dplyr::select(-c(\"`Series Code`\", \"`Country Code`\"))\n" ...
2022/10/21
[ "https://Stackoverflow.com/questions/74159930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18338223/" ]
74,159,954
<p>I am working on setting up an application using Spring Boot and Auth0. We are refactoring from a legacy codebase to use Spring Boot. In the legacy code, the Auth0 URL is created manually by appending the URL parameters:</p> <pre><code>https://[removed].auth0.com/authorize? response_type=code &amp;client_id=[removed] &amp;scope=openid email profile &amp;connection=[removed] &amp;state=[removed] &amp;redirect_uri=http://localhost:8081/login/oauth2/code/auth0 </code></pre> <p>With the Spring Boot configuration (guide here: <a href="https://auth0.com/docs/quickstart/webapp/java-spring-boot/01-login" rel="nofollow noreferrer">https://auth0.com/docs/quickstart/webapp/java-spring-boot/01-login</a>), this is the URL that generates:</p> <pre><code>https://[removed].auth0.com/authorize? response_type=code &amp;client_id=[removed] &amp;scope=openid email profile &amp;state=[removed] &amp;redirect_uri=http://localhost:8081/login/oauth2/code/auth0 </code></pre> <p>The Spring Boot URL is giving me an error &quot;[invalid_request] no connections enabled for the client&quot;.</p> <p>I am missing the &quot;connection&quot; parameter with the Spring Boot setup. I have tested by manually copying the URL and adding the &quot;connection&quot; parameter and I get the login page. Without it, I get the error.</p> <p>On Spring's configuration page (<a href="https://docs.spring.io/spring-security/reference/servlet/oauth2/login/core.html#oauth2login-boot-property-mappings" rel="nofollow noreferrer">https://docs.spring.io/spring-security/reference/servlet/oauth2/login/core.html#oauth2login-boot-property-mappings</a>), I don't see an option for Connection. I didn't see anything on the SecurityFilterChain that would allow me to change this either.</p> <p>I see that Auth0.js has a function that allows a &quot;connection&quot; parameter (<a href="https://auth0.com/docs/libraries/auth0js" rel="nofollow noreferrer">https://auth0.com/docs/libraries/auth0js</a>). How do I add this using Spring Boot/Java?</p> <p><strong>EDIT</strong></p> <p>application.properties:</p> <pre><code>spring.security.oauth2.client.registration.auth0.client-id=[removed] spring.security.oauth2.client.registration.auth0.client-secret=[removed] spring.security.oauth2.client.registration.auth0.scope[0]=openid spring.security.oauth2.client.registration.auth0.scope[1]=email spring.security.oauth2.client.registration.auth0.scope[2]=profile spring.security.oauth2.client.provider.auth0.issuer-uri=[removed] </code></pre> <p><strong>EDIT 2</strong></p> <p>We were working in conjunction with Auth0 Support - they provided us the following information:</p> <blockquote> <p>In case an Enterprise connection is the only enabled connection for an application and the &quot;connection&quot; parameter is not specified on the /authorize request, you need to enable the &quot;show as a button&quot; setting on that enterprise connection, otherwise you will get &quot;no connections enabled for the client&quot; error.</p> <p>The &quot;Display connection as a button&quot; checkbox is on the &quot;Login Experience&quot; tab of the connection setting page.</p> </blockquote> <p>Weird configuration requirement - you can't go directly to the login page. You have to have a button to take you there. This did resolve the original issue; however, I marked @Codo answer below as accepted, as it did answer this question and appears it would work from initial testing.</p>
[ { "answer_id": 74160433, "author": "ILya Cyclone", "author_id": 345130, "author_profile": "https://Stackoverflow.com/users/345130", "pm_score": 0, "selected": false, "text": "# src/main/resources/application.yml\nspring:\n security:\n oauth2:\n client:\n registration:\n ...
2022/10/21
[ "https://Stackoverflow.com/questions/74159954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1318162/" ]
74,159,975
<p>Given we can determine the first day of the week by soft-coding with <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Locale.html" rel="nofollow noreferrer"><code>Locale</code></a>:</p> <pre><code>DayOfWeek firstDayOfWeek = WeekFields.of( Locale.US ).getFirstDayOfWeek() ; // Sunday-Saturday. </code></pre> <p>… and given that Java comes with a built-in enum defining days of the week, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/DayOfWeek.html" rel="nofollow noreferrer">DayOfWeek</a>:</p> <pre><code>DayOfWeek[] dows = DayOfWeek.values() ; // Monday-Sunday </code></pre> <p>How can we create another array or a list of whose elements are the <code>DayOfWeek</code> enum objects rearranged in order defined by our specified locale?</p> <p>The goal is to represent all seven days of the week in the order defined by cultural norms as represented by a particular <code>Locale</code>.</p>
[ { "answer_id": 74159976, "author": "Basil Bourque", "author_id": 642706, "author_profile": "https://Stackoverflow.com/users/642706", "pm_score": 1, "selected": false, "text": "Collections.rotate( \n new ArrayList<> ( List.of( DayOfWeek.values() ) ) , // Actually, you would instantia...
2022/10/21
[ "https://Stackoverflow.com/questions/74159975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/642706/" ]
74,159,979
<p>I have a React Native project that we've recently been attempting to move over to AzureB2C. We have been leveraging the now archived package <code>react-native-msal</code>. Our project also employs <code>react-native-web</code>. The web functionality is working without issue, however, when working in the app natively, I am getting an issue when attempting to call the <code>acquireTokenSilent</code> method, which fails with the error message:</p> <blockquote> <p>No cached accounts found for the supplied homeAccountId and clientId</p> </blockquote> <p>I've found <a href="https://stackoverflow.com/questions/70197511/msalclientexception-no-cached-accounts-found-for-the-supplied-homeaccountid-and">this post</a> which mentions an issue with the signing key, but, re-running that does not result in a different Signature, and so I don't believe it's that. I also found <a href="https://github.com/AzureAD/microsoft-authentication-library-for-android/issues/1033" rel="nofollow noreferrer">this thread</a> which suggests <em>an</em> answer but doesn't provide it.</p> <p>Our configuration is quite simple as well.</p> <pre><code>{ &quot;auth&quot;: { &quot;clientId&quot;: &quot;&lt;CLIENT_ID&gt;&quot;, &quot;redirectUri&quot;: &quot;msauth://&lt;PACKAGE&gt;/&lt;SIGNATURE_HASH&gt;&quot;, &quot;authority&quot;: &quot;https://&lt;TENANT&gt;.b2clogin.com/tfp/&lt;TENANT&gt;.onmicrosoft.com/B2C_1A_SIGNUP_SIGNIN&quot;, &quot;navigateToLoginRequestUrl&quot;: false, &quot;knownAuthorities&quot;: [ &quot;https://&lt;TENANT&gt;.b2clogin.com/tfp/&lt;TENANT&gt;.onmicrosoft.com/B2C_1A_SIGNUP_SIGNIN&quot;, &quot;https://&lt;TENANT&gt;.b2clogin.com/tfp/&lt;TENANT&gt;.onmicrosoft.com/B2C_1A_PASSWORDRESET&quot; ] }, &quot;cache&quot;: { &quot;cacheLocation&quot;: &quot;sessionStorage&quot;, &quot;storeAuthStateInCookie&quot;: false } } </code></pre> <p>The Sign in, out, getting accounts all work fine in both Web and the Native App. It's just that acquireTokenSilent doesn't work correctly in the Native App.</p> <p>Does anyone have any other suggestions?</p>
[ { "answer_id": 74159976, "author": "Basil Bourque", "author_id": 642706, "author_profile": "https://Stackoverflow.com/users/642706", "pm_score": 1, "selected": false, "text": "Collections.rotate( \n new ArrayList<> ( List.of( DayOfWeek.values() ) ) , // Actually, you would instantia...
2022/10/21
[ "https://Stackoverflow.com/questions/74159979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6775061/" ]
74,160,012
<p>My code is:</p> <pre class="lang-cs prettyprint-override"><code>CREATE TABLE `table_a` ( `id` INT NOT NULL AUTO_INCREMENT, `value` varchar(255), PRIMARY KEY (`id`) ) ENGINE=InnoDB; CREATE TABLE `table_b` LIKE `table_a`; INSERT INTO table_a VALUES (1, 'A'), (2, 'B'), (3, 'B'); INSERT INTO table_b VALUES (1, 'B'); SELECT value FROM table_a INNER JOIN table_b USING (value); </code></pre>
[ { "answer_id": 74160070, "author": "NinjaScareCrow", "author_id": 3749934, "author_profile": "https://Stackoverflow.com/users/3749934", "pm_score": 0, "selected": false, "text": "SELECT\n DISTINCT(c1.Customer_ID)\nFROM\n Customer c1\nJOIN Transactions t ON t.Customer_ID = c1.Custom...
2022/10/21
[ "https://Stackoverflow.com/questions/74160012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
74,160,018
<p>Using NestJS, Axios returns an <code>Observable&lt;AxiosResponse&gt;</code>.</p> <p>How can I get the headers of a GET- or HEAD-Request?</p> <p>Lets say I make a HEAD-request:</p> <pre><code>import { HttpService } from '@nestjs/axios'; const observable = this.httpService.head(uri); </code></pre> <p>How can I get the headers from the result?</p> <hr /> <p><strong>Update:</strong></p> <p>I found a nice workaround that just works with a single line of code.</p> <p>There is another library called <code>https</code> with is more powerful:</p> <pre><code>import http from &quot;https&quot;; await http.request(uri, { method: 'HEAD' }, (res) =&gt; { console.log(res.headers); }).on('error', (err) =&gt; { console.error(err); }).end(); </code></pre>
[ { "answer_id": 74160391, "author": "Tobias S.", "author_id": 8613630, "author_profile": "https://Stackoverflow.com/users/8613630", "pm_score": 2, "selected": true, "text": "subscribe" }, { "answer_id": 74161266, "author": "Andrey Bessonov", "author_id": 4546382, "auth...
2022/10/21
[ "https://Stackoverflow.com/questions/74160018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16433801/" ]
74,160,061
<p>Hi and thanks for reading me. Im trying to convert a character string in to a datetime format in r, but I cannot discover the way to do that, because the year is only taken the last 2 digits (&quot;22&quot; instead of &quot;2022&quot;), im not sure of how to fix It.</p> <p>The character string is &quot;23/8/22 12:45&quot; and I tried with:</p> <pre><code>as.Date(&quot;23/8/22 12:45&quot;, format =&quot;%m/%d/%Y&quot; ) </code></pre> <p>and</p> <pre><code>as_datetime(ymd_hm(&quot;23/8/22 12:45&quot;), format =&quot;%m/%d/%Y&quot;) </code></pre> <p>But it doest work. Anyone knows how I can fix it? thanks for the help</p>
[ { "answer_id": 74160391, "author": "Tobias S.", "author_id": 8613630, "author_profile": "https://Stackoverflow.com/users/8613630", "pm_score": 2, "selected": true, "text": "subscribe" }, { "answer_id": 74161266, "author": "Andrey Bessonov", "author_id": 4546382, "auth...
2022/10/21
[ "https://Stackoverflow.com/questions/74160061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14141475/" ]
74,160,069
<p>This is my first time of using docker and I am trying to 'dockerize' my <code>nodejs</code> application which relies on redis data base as well as mongo atlas database. I have created both containers for nodejs and redis but I can't seem to get them connected. When I start the redis container and start my nodejs application locally outside docker, it runs fine. My nodejs and my redis container are able to communicate. However, making the nodejs a container, I can't seem to connect to the redis database. I am using redis npm version <code>^4.0.2</code> and I am using windows 11. Here are my codes so far:</p> <p>my redis connection:</p> <pre><code>const redis = require('redis'); let redis_client = redis.createClient() redis_client.connect() redis_client.on('connect', function(){ console.log('redis client connected') }); </code></pre> <p>Dockerfile</p> <pre><code> FROM node:lts-alpine WORKDIR /app COPY package*.json ./ COPY client/package*.json client/ RUN npm run install-client --only=production COPY api/package*.json api/ RUN npm run install-api --only=production COPY client/ client/ RUN npm run client-build --prefix client COPY api/ api/ USER node CMD [ &quot;npm&quot;, &quot;start&quot;, &quot;--prefix&quot;, &quot;api&quot; ] EXPOSE 5000 </code></pre> <p>docker-compose file</p> <pre><code>version: &quot;3&quot; services: redisDB: container_name: redisDB hostname: redis image: redis ports: - &quot;6379:6379&quot; fullstack-cms: build: . ports: - &quot;5000:5000&quot; env_file: - ./api/.env depends_on: - redisDB links: - redisDB </code></pre> <p>I used this command to build the images: <code>docker-compose up -d --build</code></p> <p>However, I get error:</p> <pre><code>Error: connect ECONNREFUSED 127.0.0.1:6379 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 6379} </code></pre> <p>How do I fix this error?</p>
[ { "answer_id": 74160391, "author": "Tobias S.", "author_id": 8613630, "author_profile": "https://Stackoverflow.com/users/8613630", "pm_score": 2, "selected": true, "text": "subscribe" }, { "answer_id": 74161266, "author": "Andrey Bessonov", "author_id": 4546382, "auth...
2022/10/21
[ "https://Stackoverflow.com/questions/74160069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19263124/" ]
74,160,106
<p>As an exercise I am trying to create a small quiz app and a part of it are the question cards. On these cards I have a question and then a button to show the answer. When the button is clicked, then the answer (which doesn't exist in the HTML DOM yet, therefore not visible) will show up and with the next click, the answer should be hidden again. Basically it will look something like this:</p> <p><a href="https://i.stack.imgur.com/GH65V.png" rel="nofollow noreferrer">Before Show Answer is clicked</a></p> <p><a href="https://i.stack.imgur.com/lblds.png" rel="nofollow noreferrer">After Show Answer is clicked</a></p> <p>Here is the HTML code:</p> <pre><code>&lt;section class=&quot;question-card&quot;&gt; &lt;p&gt; Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsam vitae labore repudiandae tenetur. Qui maiores animi quibusdam voluptatum nobis. Nam aperiam voluptatum dolorem quia minima assumenda velit libero saepe repellat. Tempore delectus deleniti libero aliquid rem velit illum expedita nostrum quam optio maiores officiis consequatur ea, sint enim cum repudiandae inventore ab nemo? &lt;/p&gt; &lt;div class=&quot;bookmark&quot;&gt; &lt;i class=&quot;fa-regular fa-bookmark fa-lg&quot;&gt;&lt;/i&gt; &lt;/div&gt; &lt;button class=&quot;answer-button&quot; data-js=&quot;answer-button&quot;&gt;Show Answer&lt;/button&gt; &lt;ul class=&quot;answer-container&quot; data-js=&quot;answer-container&quot;&gt; &lt;/ul&gt; &lt;div class=&quot;container-categories&quot;&gt; &lt;button class=&quot;category-button category-html&quot;&gt;#html&lt;/button&gt; &lt;button class=&quot;category-button category-flexbox&quot;&gt;#flexbox&lt;/button&gt; &lt;button class=&quot;category-button category-css&quot;&gt;#css&lt;/button&gt; &lt;button class=&quot;category-button category-js&quot;&gt;#js&lt;/button&gt; &lt;/div&gt; &lt;/section&gt; </code></pre> <p>I have added an EventListener for the Show Answer button that adds a list item in the already existing ul when it is clicked. I have done this with innerHTML:</p> <pre><code>const answerButton = document.querySelector(&quot;.answer-button&quot;); const answerContainer = document.querySelector(&quot;.answer-container&quot;); const answer1 = &quot;Lorem ipsum dolor sit amet consectetur adipisicing elit.&quot;; answerButton.addEventListener(&quot;click&quot;, () =&gt; { answerContainer.innerHTML = `&lt;li class=&quot;show-answer&quot;&gt;${answer1}&lt;/li&gt;`; }); </code></pre> <p>Now what I can't seem to manage is to hide the answer when the button is clicked again (the next challenge will be that the button will change the text to &quot;Hide Answer&quot; after the first click, but I have no idea how to approach that yet). The closest I got was this:</p> <pre><code>answerButton.addEventListener(&quot;click&quot;, () =&gt; { answerContainer.innerHTML = `&lt;li class=&quot;show-answer&quot;&gt;${answer1}&lt;/li&gt;`; answerContainer.classList.toggle(&quot;hide-answer&quot;); }); </code></pre> <p>However, this method displays the .hide-answer class first, after which the 2 classes are toggled and everything is as it should be. So after the first click, the answer is still hidden and only after the 2nd click the button behaves the way I want it to.</p> <p>I have tried this as well:</p> <pre><code>answerButton.addEventListener(&quot;click&quot;, () =&gt; { answerContainer.innerHTML = `&lt;li class=&quot;hide-answer&quot;&gt;${answer1}&lt;/li&gt;`; answerContainer.classList.toggle(&quot;show-answer&quot;); }); </code></pre> <p>But for some reason this shows the container with all the CSS properties, but there is no text:</p> <p><a href="https://i.stack.imgur.com/B6nlR.png" rel="nofollow noreferrer">Answer Container is there, but no text</a></p> <p>This is the CSS for the 2 classes (show-answer and hide-answer):</p> <pre><code>.show-answer { background-color: hotpink; border-radius: 7px; border: none; list-style: none; width: 50%; display: flex; justify-content: center; align-items: center; padding: 1rem; box-shadow: rgba(0, 0, 0, 0.3) 0px 19px 38px; } .hide-answer { display: none; } </code></pre> <p>If anybody has any idea how I could get the result I need, I would be extremely grateful...</p>
[ { "answer_id": 74160247, "author": "Nealium", "author_id": 10229768, "author_profile": "https://Stackoverflow.com/users/10229768", "pm_score": 0, "selected": false, "text": "show-answer" }, { "answer_id": 74160250, "author": "ccchoy", "author_id": 12418176, "author_pr...
2022/10/21
[ "https://Stackoverflow.com/questions/74160106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20304996/" ]
74,160,144
<p>I have the following data frame:</p> <pre><code>structure(list(g = c(&quot;1&quot;, &quot;2&quot;, &quot;3&quot;), x = c(&quot;This is text.&quot;, &quot;This is text too.&quot;, &quot;This is no text&quot;), y = c(&quot;What is text?&quot;, &quot;Can it eat text?&quot;, &quot;Maybe I will try.&quot;)), class = &quot;data.frame&quot;, row.names = c(NA, -3L)) </code></pre> <p>I would like to count the number of words across the columns <code>x</code> and <code>y</code> and sum up the value to get one column with the total number of words used per column. It is important that I am able to subset the data. The result shoud look like this:</p> <pre><code>structure(list(g = c(&quot;1&quot;, &quot;2&quot;, &quot;3&quot;), x = c(&quot;This is text.&quot;, &quot;This is text too.&quot;, &quot;This is no text&quot;), y = c(&quot;What is text?&quot;, &quot;Can it eat text?&quot;, &quot;Maybe I will try.&quot;), z = c(&quot;6&quot;, &quot;8&quot;, &quot;8&quot;)), class = &quot;data.frame&quot;, row.names = c(NA, -3L)) </code></pre> <p>I have tried using <code>str_count(&quot; &quot;)</code> with different regex expressions in combination with <code>across</code> or <code>apply</code> but I do not seem to get the solution.</p> <p>I did not anticipate in my original question that columns with <code>NA</code> cells in them would be problematic, but I do. So any solution needs to be able to handle <code>NA</code> cells as well.</p>
[ { "answer_id": 74160184, "author": "Ric Villalba", "author_id": 6912817, "author_profile": "https://Stackoverflow.com/users/6912817", "pm_score": 2, "selected": false, "text": "tokenizers" }, { "answer_id": 74160271, "author": "B. Christian Kamgang", "author_id": 10848898...
2022/10/21
[ "https://Stackoverflow.com/questions/74160144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11045110/" ]
74,160,148
<p>Can anyone help me to find the error? My main target is when we enter an array to give the result same as the below I showed, Input</p> <pre><code>{-5, -4, 10, 12, 13, 4, 5, -8, -6} </code></pre> <p>output</p> <pre><code>{10, 12, 13, 4, 5, -5, -4, -8, -6} </code></pre> <p>Here I attached my full code. I don't get outputs.</p> <p><img src="https://i.stack.imgur.com/vhaT2.png" alt="enter image description here" /></p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function foo() { var arrch = document.getElementById("text").value.spilt(" ").map(Number); var dlina = arrch.length; var new_arr = []; var new_arr2 = []; var k = 0; var summa = 0; var n = 0; for (var i = 0; i &lt; dlina; i++) { if (arrch[i] &gt; 0) { summa += arrch[i]; new_arr[n] = arrch[i]; n++; } else if (arrch[i] &lt; 0) { new_arr2[k] = arrch[i]; k++; } } new_arr = new_arr.join(" "); new_arr2 = new_arr2.join(" "); document.getElementById("text2").innerHTML = new_arr + " " + new_arr2; document.getElementById("text3").innerHTML = summa; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;H3&gt;RK1&lt;/H3&gt; &lt;form&gt; &lt;p&gt;Enter Array&lt;/p&gt; &lt;input type="text" id="text" placeholder="Enter Text"&gt;&lt;br&gt; &lt;p&gt;Changed array&lt;/p&gt; &lt;p id="text2"&gt;&lt;/p&gt; &lt;p&gt;plus Array&lt;/p&gt; &lt;p id="text3"&gt;&lt;/p&gt; &lt;button onclick="foo()"&gt;Give Answer&lt;/button&gt; &lt;/form&gt;</code></pre> </div> </div> </p>
[ { "answer_id": 74160184, "author": "Ric Villalba", "author_id": 6912817, "author_profile": "https://Stackoverflow.com/users/6912817", "pm_score": 2, "selected": false, "text": "tokenizers" }, { "answer_id": 74160271, "author": "B. Christian Kamgang", "author_id": 10848898...
2022/10/21
[ "https://Stackoverflow.com/questions/74160148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17835801/" ]
74,160,151
<p>I have the following time series and I want to convert to datetime in DataFrame using &quot;pd.to_datetime&quot;. I am getting the following error: &quot;hour must be in 0..23: 2017/ 01/01 24:00:00&quot;. How can I go around this error?</p> <pre><code>DateTime 0 2017/ 01/01 01:00:00 1 2017/ 01/01 02:00:00 2 2017/ 01/01 03:00:00 3 2017/ 01/01 04:00:00 ... 22 2017/ 01/01 23:00:00 23 2017/ 01/01 24:00:00 </code></pre>
[ { "answer_id": 74160184, "author": "Ric Villalba", "author_id": 6912817, "author_profile": "https://Stackoverflow.com/users/6912817", "pm_score": 2, "selected": false, "text": "tokenizers" }, { "answer_id": 74160271, "author": "B. Christian Kamgang", "author_id": 10848898...
2022/10/21
[ "https://Stackoverflow.com/questions/74160151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20251167/" ]
74,160,159
<p>I am looking for a python equivalent of <a href="https://www.npmjs.com/package/bit-sequence" rel="nofollow noreferrer">https://www.npmjs.com/package/bit-sequence</a>.</p> <p>That is to say, I need a function which takes some 'bytes', some 'start' value corresponding to an integer bit index to start extraction (not byte index), and some 'length' value to correspond to the amount of bits to extract from the bytes array</p>
[ { "answer_id": 74160184, "author": "Ric Villalba", "author_id": 6912817, "author_profile": "https://Stackoverflow.com/users/6912817", "pm_score": 2, "selected": false, "text": "tokenizers" }, { "answer_id": 74160271, "author": "B. Christian Kamgang", "author_id": 10848898...
2022/10/22
[ "https://Stackoverflow.com/questions/74160159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20305203/" ]
74,160,170
<p>So i’m getting the obvious error of undefined name</p> <pre><code>CloudNote.fromSnapshot(QueryDocumentSnapshot&lt;Map&lt;String, dynamic&gt;&gt; snapshot) firstName = snapshot.data()[firstNameFieldName] as String; lastName = snapshot.data()[lastNameFieldName] as String; </code></pre> <p>I know the painful option of manually adding the field but…..last resort.</p> <p>Strange that the Firestore Database doesn’t allow you to select all documents in your collection and add fields to all of them.</p>
[ { "answer_id": 74160184, "author": "Ric Villalba", "author_id": 6912817, "author_profile": "https://Stackoverflow.com/users/6912817", "pm_score": 2, "selected": false, "text": "tokenizers" }, { "answer_id": 74160271, "author": "B. Christian Kamgang", "author_id": 10848898...
2022/10/22
[ "https://Stackoverflow.com/questions/74160170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11880684/" ]
74,160,173
<p>I am trying to run two chunks of code in parallel, but fail to do so. Both functions are for loops that might take around 30 minutes to run in total, these functions in the end return a list of dictionaries as results. Running them separately works fine, but I can't get them to run in parallel...</p> <pre><code>#When I run these functions separately, it sort of looks like this: import time def functionA(A, B): dictA=[] for i in list(range(A, B)): print(i, &quot;from A&quot;) time.sleep(1) for p in list(range(0, 10)): dictA.append({i:p}) return(dictA) def functionB(C, D): dictB=[] for i in list(range(C, D)): print(i, &quot;from B&quot;) time.sleep(1) for p in list(range(0, 10)): dictB.append({i:p}) return(dictB) DictA = functionA(0, 10) DictB = functionB(10, 20) #I have tried to run them in parallel, but they still run separately, and in the end the variable I would like to write to is just a thread: import threading e = threading.Event() DictA = threading.Thread(target=functionA(0, 10)) DictA.start() DictB = threading.Thread(target= functionB(10, 20)) DictB.start() #Further pieces of code to be executed after threading completed </code></pre> <p>This does not make the process run in parallel but rather in logical sequence as can be seen from the print statements:</p> <pre><code>0 from A 1 from A 2 from A 3 from A 4 from A 5 from A 6 from A 7 from A 8 from A 9 from A Exception in thread Thread-12: Traceback (most recent call last): File &quot;/home/maestro/.pyenv/versions/3.9.13/lib/python3.9/threading.py&quot;, line 980, in _bootstrap_inner self.run() File &quot;/home/maestro/.pyenv/versions/3.9.13/lib/python3.9/threading.py&quot;, line 917, in run self._target(*self._args, **self._kwargs) TypeError: 'list' object is not callable 10 from B 11 from B 12 from B 13 from B 14 from B 15 from B 16 from B 17 from B 18 from B 19 from B Exception in thread Thread-13: Traceback (most recent call last): File &quot;/home/maestro/.pyenv/versions/3.9.13/lib/python3.9/threading.py&quot;, line 980, in _bootstrap_inner self.run() File &quot;/home/maestro/.pyenv/versions/3.9.13/lib/python3.9/threading.py&quot;, line 917, in run self._target(*self._args, **self._kwargs) TypeError: 'list' object is not callable </code></pre> <p>How can these functions be run in parallel?</p>
[ { "answer_id": 74160184, "author": "Ric Villalba", "author_id": 6912817, "author_profile": "https://Stackoverflow.com/users/6912817", "pm_score": 2, "selected": false, "text": "tokenizers" }, { "answer_id": 74160271, "author": "B. Christian Kamgang", "author_id": 10848898...
2022/10/22
[ "https://Stackoverflow.com/questions/74160173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9536233/" ]
74,160,182
<p>I am trying to deploy Traffic manager profile using ARM template but when deploying I am getting the following error . I am referring the resourceid to &quot;<strong>resourceTargetId</strong>&quot;. Also when I create the traffic manager profile from the portal it just seems to work with both deployed apps and no shows no errors.</p> <p><strong>ERROR</strong></p> <pre><code>The 'resourceTargetId' property of endpoint 'Primarysite' is invalid or missing. The property must be specified only for the following endpoint types: AzureEndpoints, NestedEndpoints. You must have read access to the resource to which it refers. </code></pre> <p><strong>ARM template</strong></p> <pre><code> { &quot;$schema&quot;:&quot;https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#&quot;, &quot;contentVersion&quot;:&quot;1.0.0.0&quot;, &quot;parameters&quot;:{ &quot;DnsName&quot;:{ &quot;type&quot;:&quot;string&quot; }, &quot;Name&quot;:{ &quot;type&quot;:&quot;String&quot; }, &quot;RoutingMethod&quot;:{ &quot;type&quot;:&quot;String&quot; }, &quot;Location&quot;:{ &quot;type&quot;:&quot;String&quot; } }, &quot;resources&quot;:[ { &quot;type&quot;:&quot;Microsoft.Network/trafficmanagerprofiles&quot;, &quot;apiVersion&quot;:&quot;2018-08-01&quot;, &quot;name&quot;:&quot;[parameters('Name')]&quot;, &quot;location&quot;:&quot;[parameters('Location')]&quot;, &quot;properties&quot;:{ &quot;profileStatus&quot;:&quot;Enabled&quot;, &quot;trafficRoutingMethod&quot;:&quot;[parameters('RoutingMethod')]&quot;, &quot;dnsConfig&quot;:{ &quot;relativeName&quot;:&quot;[parameters('DnsName')]&quot;, &quot;ttl&quot;:30 }, &quot;monitorConfig&quot;:{ &quot;protocol&quot;:&quot;HTTPS&quot;, &quot;port&quot;:443, &quot;path&quot;:&quot;/&quot;, &quot;expectedStatusCodeRanges&quot;:[ { &quot;min&quot;:200, &quot;max&quot;:202 }, { &quot;min&quot;:301, &quot;max&quot;:302 } ] }, &quot;endpoints&quot;:[ { &quot;type&quot;:&quot;Microsoft.Network/TrafficManagerProfiles/AzureEndpoints&quot;, &quot;name&quot;:&quot;Primarysite&quot;, &quot;properties&quot;:{ &quot;target&quot;:&quot;https://website1.azurewebsites.net&quot;, &quot;resourceTargetId&quot;:&quot;/subscriptions/xxxxxxxxx-xxxxx-xxxxx-xxxx-xxxxxxxxxxxxxxxx/resourceGroups/RGTest/providers/Microsoft.Web/sites/website1&quot;, &quot;endpointStatus&quot;:&quot;Enabled&quot;, &quot;endpointLocation&quot;:&quot;eastus&quot; } }, { &quot;type&quot;:&quot;Microsoft.Network/TrafficManagerProfiles/AzureEndpoints&quot;, &quot;name&quot;:&quot;Secondarysite&quot;, &quot;properties&quot;:{ &quot;target&quot;:&quot;https://website2.azurewebsites.net&quot;, &quot;resourceTargetId&quot;:&quot;/subscriptions/xxxxxxxxx-xxxxx-xxxxx-xxxx-xxxxxxxxxxxxxxxxx/resourceGroups/RGTest/providers/Microsoft.Web/sites/website2&quot;, &quot;endpointStatus&quot;:&quot;Enabled&quot;, &quot;endpointLocation&quot;:&quot;westus&quot; } } ] } } ] } </code></pre>
[ { "answer_id": 74216934, "author": "Tarun Krishna", "author_id": 19931028, "author_profile": "https://Stackoverflow.com/users/19931028", "pm_score": 2, "selected": false, "text": ".json" } ]
2022/10/22
[ "https://Stackoverflow.com/questions/74160182", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2217784/" ]
74,160,235
<p>I'm trying to create a nested list that starts with a bullet point then lists items with roman numerals and then back to bullet points. Also in my browser my list is very spaced out. Not sure way its not displaying that way here.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code> ul li { list-style-type: upper-roman; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;ul&gt; &lt;li&gt;Bottles, cans and jars:&lt;/li&gt; &lt;ul&gt; &lt;li&gt;All bottles, cans and jars must be empty&lt;/li&gt; &lt;li&gt;Take the lids off of all bottle, cans and jars an rinse them&lt;/li&gt; &lt;li&gt;Throw all metals lids into the recycling box&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; Leaf and yard waste can be placed in paper bags. You can also use yard waste to make compost for your garden. HOW TO MAKE COMPOST. &lt;/li&gt; &lt;li&gt;Green bins can be used for kitchen waste&lt;/li&gt; &lt;/ul&gt;</code></pre> </div> </div> </p>
[ { "answer_id": 74216934, "author": "Tarun Krishna", "author_id": 19931028, "author_profile": "https://Stackoverflow.com/users/19931028", "pm_score": 2, "selected": false, "text": ".json" } ]
2022/10/22
[ "https://Stackoverflow.com/questions/74160235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20197542/" ]
74,160,267
<p>I am using a docker container to run postgres for testing purposes, it should NOT persist data between different runs.</p> <p>This is the dockerfile:</p> <pre><code>FROM postgres:alpine ENV POSTGRES_PASSWORD=1234 EXPOSE 5432 </code></pre> <p>And this is my compose file:</p> <pre><code>version: &quot;3.9&quot; services: web: build: context: ../../. dockerfile: ./services/web/Dockerfile ports: - &quot;3000:3000&quot; db: build: ../db ports: - &quot;5438:5432&quot; graphql: build: context: ../../. dockerfile: ./services/graphql/Dockerfile ports: - &quot;4000:4000&quot; indexer: build: context: ../../. dockerfile: ./services/indexer-ts/Dockerfile volumes: - ~/.aws/:/root/.aws:ro </code></pre> <p>However, I find that between sessions all data is being persisted and I have no clue why. This is totally messing my tests and is not expected to happen.</p> <p>Even after running docker system prune, all data still persists, meaning that the container is probably using a volume somehow</p> <p>Does anyone know why this is happening and how to not persist the data?</p>
[ { "answer_id": 74160309, "author": "davetapley", "author_id": 21115, "author_profile": "https://Stackoverflow.com/users/21115", "pm_score": 0, "selected": false, "text": "-v" }, { "answer_id": 74160320, "author": "larsks", "author_id": 147356, "author_profile": "https...
2022/10/22
[ "https://Stackoverflow.com/questions/74160267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11584839/" ]