qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
74,182,445
<p>I have a data frame and I want to create a new column of specific words that are in a particular column using pandas. In this example: I have a certain text and a list of words I would like to locate those specific words in a new column.</p> <p><a href="https://i.stack.imgur.com/hTx7P.png" rel="nofollow noreferrer">enter image description here</a></p> <pre><code>import re txt = df['text'] x = re.findall((&quot;apple|banana|orange&quot;), txt) print(x) </code></pre> <blockquote> <p>TypeError: expected string or bytes-like object</p> </blockquote> <p>It is important to note that there are empty cells in the text column</p>
[ { "answer_id": 74182499, "author": "BENY", "author_id": 7964527, "author_profile": "https://Stackoverflow.com/users/7964527", "pm_score": 0, "selected": false, "text": "df['text'].str.findall(\"apple|banana|orange\")\n" }, { "answer_id": 74182532, "author": "Daniel", "aut...
2022/10/24
[ "https://Stackoverflow.com/questions/74182445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20322346/" ]
74,182,486
<p>I need to push some data from Databricks on AWS to SAP Data Warehouse cloud, and have been encouraged to use the python hdbcli (<a href="https://pypi.org/project/hdbcli/" rel="nofollow noreferrer">https://pypi.org/project/hdbcli/</a>). The only documentation I have been able to find is the one in pypi, which is quite scarce. I can see an example of how to push individual rows to a sql table, but I have found no examples of how to save a pyspark dataframe to a table in SAP Data Warehouse cloud.</p> <p>Documentation examples:</p> <pre><code>sql = 'INSERT INTO T1 (ID, C2) VALUES (:id, :c2)' cursor = conn.cursor() id = 3 c2 = &quot;goodbye&quot; cursor.execute(sql, {&quot;id&quot;: id, &quot;c2&quot;: c2}) # returns True cursor.close() </code></pre> <p>I have tried the following in my data bricks notebook:</p> <pre><code>df.createOrReplaceTempView(&quot;final_result_local&quot;) sql = &quot;INSERT INTO final_result SELECT * FROM final_result_local&quot; cursor.execute(sql) cursor.close() </code></pre> <p>After this I got the following error:</p> <blockquote> <p>invalid table name: Could not find table/view FINAL_RESULT_LOCAL in schema DATABRICKS_SCHEMA</p> </blockquote> <p>It seems df.createOrReplaceTempView created the sql table in a different context to the one called by hdbcli, and I don't know how to push the local table to sap data warehouse cloud. Any help would be much appreciated.</p>
[ { "answer_id": 74182640, "author": "Robert Kossendey", "author_id": 12638118, "author_profile": "https://Stackoverflow.com/users/12638118", "pm_score": 0, "selected": false, "text": "hdbcli" }, { "answer_id": 74186162, "author": "Mathias Kemeter", "author_id": 16739843, ...
2022/10/24
[ "https://Stackoverflow.com/questions/74182486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7134235/" ]
74,182,501
<p>I'm trying to use apply to use the L1 norm on each column of a matrix in R. If we have a matrix</p> <pre><code>X=matrix(data=rnorm(100),nrow=10,ncol=10) </code></pre> <p>Then when I run</p> <pre><code>apply(X,2,function(x) norm(x,type=&quot;1&quot;)) </code></pre> <p>I get the error:</p> <pre><code>Error in base::norm(x, type, ...) : 'A' must be a numeric matrix </code></pre> <p>I've found that this is because when we index X, we lose the matrix type. For example, running</p> <pre><code>norm(X[,1],type=&quot;1&quot;) </code></pre> <p>we get the same error. Hence, I've run</p> <pre><code> old &lt;- `[` `[` &lt;- function(...) { old(..., drop=FALSE) } </code></pre> <p>To stop the matrix type being dropped when we subset X. Now, this works</p> <pre><code>norm(X[,1],type=&quot;1&quot;) </code></pre> <p>But I still get the same error for</p> <pre><code>apply(X,2,function(x) norm(x,type=&quot;1&quot;)) </code></pre>
[ { "answer_id": 74182640, "author": "Robert Kossendey", "author_id": 12638118, "author_profile": "https://Stackoverflow.com/users/12638118", "pm_score": 0, "selected": false, "text": "hdbcli" }, { "answer_id": 74186162, "author": "Mathias Kemeter", "author_id": 16739843, ...
2022/10/24
[ "https://Stackoverflow.com/questions/74182501", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7075138/" ]
74,182,521
<p>So there is this question</p> <pre><code>Question 3: What are examples of Multi-Channel-Publishing? a) Delivering content from a headless CMS to a digital kiosk via GrapQL APIs. b) Providing the right content to your audiences on multiple channels. c) Personalizing order management in the Pimcore backend. d) Automatically sending a product sheet PDF based on live PIM data to partners. </code></pre> <p>Since it asks for examples, <code>b</code> is not the case, since it's a feature description, it's not an example. In my reasoning the correct answer is <code>d</code> because it the feature implies some data filtering and output to different channels, but it doesn't seem to be correct.</p>
[ { "answer_id": 74182640, "author": "Robert Kossendey", "author_id": 12638118, "author_profile": "https://Stackoverflow.com/users/12638118", "pm_score": 0, "selected": false, "text": "hdbcli" }, { "answer_id": 74186162, "author": "Mathias Kemeter", "author_id": 16739843, ...
2022/10/24
[ "https://Stackoverflow.com/questions/74182521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5745006/" ]
74,182,525
<p>Desired step flow: <a href="https://i.stack.imgur.com/OgacC.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OgacC.jpg" alt="Desired step flow" /></a></p> <p>The expectation is that in the scope of a single XA transaction, the step will:</p> <ol> <li>Select the partitioned data</li> <li>Write the <strong>unaltered</strong> partitioned data to an audit table (redo log) using the JDBC BatchUpdate</li> <li>invoke the ItemProcessor on the <strong>unaltered</strong> data</li> <li>use a composite writer to batch write additonal operations to additional targets</li> </ol> <p>The puzzle I am trying to solve is that the process needs to read the partition once only, and operate strictly within the bounds of that selection.</p> <p>If there is no &quot;wiretap&quot; configuration to accomplish this, a solution I am considering is to implement the batch write to the redo log in the reader itself, but that just feels ugly, like it defeats the purpose of the framework. If there is already a spring batch pattern for this it would be much better.</p> <p>We are using the spring batch XML definitions because it gives a degree of control over bean scoping that the DSL does not permit.</p> <p>Since spring integration is already a part of this project for other functions, another option might be to refactor this as a spring integration flow.</p> <hr /> <p><strong>(Edit 3: Notes about answers)</strong></p> <p>Both Artem and Mahmoud's answers are correct. I have fleshed out designs for both scenarios, far beyond what is shown on this question. I wish I could flag them both as correct, so make sure to upvote Artem's answer and give him due credit.</p> <p>The advantage to Artem's answer is that, with a little refactoring of existing code I could eliminate the spring batch from the worker side of the architecture, and reduce our code to simplify some other operations that are not referenced in this question. The disadvantage is it would require a much more major refactoring and addressing a learning curve that is simply huge.</p> <p>The biggest advantage to Mahmoud's answer is specific to my case: I can implement it with code paradigms that are already familiar to my team and are already core to the existing product.</p> <p>Both should be nearly equally efficient. I would actually have to implement both to measure efficiency.</p> <p>In the context of my project, I have elected to follow Mahmoud's answer because it requires the least changes to the current design and code paradigm.</p> <hr /> <p><strong>(Edit: alternative flow build in Spring Integration)</strong></p> <p>Based on comments from @Artem Bilan, I have started a design to refactor to Spring Integration. Not visible:</p> <ul> <li>flows and flow elements are created dynamically at runtime by a rules engine, and destroyed when no longer in use</li> <li>each flow encompasses a chain of readers that may or may not be JDBC</li> </ul> <p><a href="https://i.stack.imgur.com/ZTfh0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZTfh0.jpg" alt="alternative flow build in Spring Integration" /></a></p> <p><strong>(Edit 2: Refinement of spring batch architecture)</strong></p> <p>Based on comments from Mahmoud Ben Hassine, there are Listener hooks we can leverage. The refined graphic shows the ItemProcessListener being used for both audit requirements, although this is not necessarily the final code we will use.</p> <p><a href="https://i.stack.imgur.com/O5cse.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O5cse.jpg" alt="Refined steps Spring Batch" /></a></p> <p>Any thoughts or advice is welcome.</p>
[ { "answer_id": 74183171, "author": "Artem Bilan", "author_id": 2756547, "author_profile": "https://Stackoverflow.com/users/2756547", "pm_score": 1, "selected": false, "text": "@MessagingGateway" }, { "answer_id": 74187360, "author": "httPants", "author_id": 740888, "a...
2022/10/24
[ "https://Stackoverflow.com/questions/74182525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4416941/" ]
74,182,550
<p>Extremely new to unity and c# after switching across from Python. Once all the balls are scored in my game I want all the 'blockers' (prefabs that I have instantiated) to be removed from the screen and a new set to be spawned randomly on screen in random positions. The blocker prefabs spawn randomly when all balls are scored, however, the old prefabs, besides the one which deletes each time, stay on screen rather than deleting. I have tried looping through the blockers in the code below to delete and I think this is where the issue is as only one game object deletes at this stage:</p> <pre><code> if (SpawnManager.tempclonecount == 0 ) { for (int i = 0; i &lt; SpawnManager.blockeramounts; i++) { Destroy(gameObject); } SpawnManager.tempclonecount = 1; } </code></pre> <p>SpawnManager is an empty object which I have used to spawn objects onto the screen, tempclonecount is a variable stating when the old game objects should be removed from the game. This part of the code works well. blockeramounts is the number of prefabs initially on screen and I hoped to loop through the number of prefabs would delete all of the prefabs. It only deletes one. How do I change this? Here is the code for creating the blockers in spawn manager also, if helpful:</p> <pre><code> void Update() { int blockeramount = Random.Range(2, 7); blockeramounts = blockeramount; for (int i = 0; i &lt; blockeramount; i++) { int blockerindex = Random.Range(0, blockerPrefabs.Length); Instantiate(blockerPrefabs[blockerindex], new Vector3(Random.Range(-30, 30), 0, Random.Range(-30, 30)), blockerPrefabs[blockerindex].transform.rotation); } } </code></pre>
[ { "answer_id": 74185121, "author": "Yung_Paun", "author_id": 19872738, "author_profile": "https://Stackoverflow.com/users/19872738", "pm_score": 1, "selected": false, "text": "...\npublic List<GameObject> blockers = new List<GameObject>();\n...\nvoid Start()\n{\n ...\n}\n\nvoid Update...
2022/10/24
[ "https://Stackoverflow.com/questions/74182550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20322391/" ]
74,182,571
<p>So based on 2 StackOverflow answers, what I have understood is:</p> <ol> <li><a href="https://stackoverflow.com/questions/47038765/an-xhr-call-is-it-a-macrotask-or-a-microtask/47041848#47041848">XHR callback is queued with Macrotasks</a></li> <li><a href="https://stackoverflow.com/questions/62566559/what-does-fetch-do-with-event-loop-in-browser/62566665#62566665">Fetch method is queued with Microtasks</a></li> </ol> <p>So my question is:</p> <ol> <li>Is this true?</li> <li>If yes, why is it this way? Shouldn't both of them be treated in the same way?</li> </ol>
[ { "answer_id": 74185121, "author": "Yung_Paun", "author_id": 19872738, "author_profile": "https://Stackoverflow.com/users/19872738", "pm_score": 1, "selected": false, "text": "...\npublic List<GameObject> blockers = new List<GameObject>();\n...\nvoid Start()\n{\n ...\n}\n\nvoid Update...
2022/10/24
[ "https://Stackoverflow.com/questions/74182571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13179113/" ]
74,182,575
<h2>Background</h2> <p>The Debian 11 <code>vim</code> package doesn't include <code>python3</code> support. See the section titled &quot;<em>No python support in Debian 11 vim - evidence</em>&quot; below</p> <p>I need <code>vim</code> with <code>python3</code> support for the <a href="https://github.com/ycm-core/YouCompleteMe" rel="nofollow noreferrer" title="YouCompleteMe vim plugin">YouCompleteMe vim plugin</a>. Syntax highlighting is also required. To build a new <code>vim</code>, I downloaded the vim 9.0 tarball into <code>/opt/</code> on my Debian 11 system and extracted it... explicitly:</p> <pre class="lang-bash prettyprint-override"><code>$ cd /opt $ sudo wget http://ftp.vim.org/pub/pub/vim/unix/vim-9.0.tar.bz2 $ sudo bunzip2 ./vim-9.0.tar.bz2 $ sudo chown -R mpenning:mpenning vim/ </code></pre> <p>I built it with...</p> <pre class="lang-bash prettyprint-override"><code>$ cd /opt/vim $ ./configure \ --enable-python3interp=yes \ --with-python3-command=python3.9 \ --with-features=huge \ --with-compiledby=&quot;mike@pennington.net&quot; $ make $ sudo cp src/vim /usr/bin/vim </code></pre> <p>However, now I see these errors when I start <code>vim</code>...</p> <pre class="lang-bash prettyprint-override"><code>$ vim foo.py 2022-10-24 09:08:31 [INFO] Editing 'foo.py'. failed to load colors/lists/default.vim failed to load colors/lists/default.vim Press ENTER or type command to continue </code></pre> <p>As one might expect, I get no <code>vim</code> syntax highlighting when I see the errors listed above. Just for kicks, I tried this in my <code>vim</code> session:</p> <ul> <li><code>:syntax enable</code></li> <li><code>:colorscheme default</code></li> <li><code>:filetype plugin on</code></li> </ul> <p>Predictably, that doesn't help.</p> <h2>Question</h2> <p>How can I build a Debian <code>vim</code> binary with <code>python3</code> and syntax highlighting support?</p> <h2>No python support in Debian 11 vim - evidence</h2> <pre class="lang-bash prettyprint-override"><code>$ vim --version VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct 01 2021 01:51:08) Included patches: 1-2434 Extra patches: 8.2.3402, 8.2.3403, 8.2.3409, 8.2.3428 Modified by team+vim@tracker.debian.org Compiled by team+vim@tracker.debian.org Huge version without GUI. Features included (+) or not (-): +acl -farsi +mouse_sgr +tag_binary +arabic +file_in_path -mouse_sysmouse -tag_old_static +autocmd +find_in_path +mouse_urxvt -tag_any_white +autochdir +float +mouse_xterm -tcl -autoservername +folding +multi_byte +termguicolors -balloon_eval -footer +multi_lang +terminal +balloon_eval_term +fork() -mzscheme +terminfo -browse +gettext +netbeans_intg +termresponse ++builtin_terms -hangul_input +num64 +textobjects +byte_offset +iconv +packages +textprop +channel +insert_expand +path_extra +timers +cindent +ipv6 -perl +title -clientserver +job +persistent_undo -toolbar -clipboard +jumplist +popupwin +user_commands +cmdline_compl +keymap +postscript +vartabs +cmdline_hist +lambda +printer +vertsplit +cmdline_info +langmap +profile +virtualedit +comments +libcall -python +visual +conceal +linebreak -python3 +visualextra +cryptv +lispindent +quickfix +viminfo +cscope +listcmds +reltime +vreplace +cursorbind +localmap +rightleft +wildignore +cursorshape -lua -ruby +wildmenu +dialog_con +menu +scrollbind +windows +diff +mksession +signs +writebackup +digraphs +modify_fname +smartindent -X11 -dnd +mouse -sound -xfontset -ebcdic -mouseshape +spell -xim +emacs_tags +mouse_dec +startuptime -xpm +eval +mouse_gpm +statusline -xsmp +ex_extra -mouse_jsbterm -sun_workshop -xterm_clipboard +extra_search +mouse_netterm +syntax -xterm_save system vimrc file: &quot;$VIM/vimrc&quot; user vimrc file: &quot;$HOME/.vimrc&quot; 2nd user vimrc file: &quot;~/.vim/vimrc&quot; user exrc file: &quot;$HOME/.exrc&quot; defaults file: &quot;$VIMRUNTIME/defaults.vim&quot; fall-back for $VIM: &quot;/usr/share/vim&quot; Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -ffile-prefix-map=/build/vim-DtwDbo/vim-8.2.2434=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lselinux -lacl -lattr -lgpm -ldl $ </code></pre>
[ { "answer_id": 74183802, "author": "romainl", "author_id": 546861, "author_profile": "https://Stackoverflow.com/users/546861", "pm_score": 2, "selected": true, "text": "-python" }, { "answer_id": 74184308, "author": "Mike Pennington", "author_id": 667301, "author_prof...
2022/10/24
[ "https://Stackoverflow.com/questions/74182575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/667301/" ]
74,182,581
<p>I am trying to figure out a way to solve this issue with Linq, does someone have any idea on how to do this? Trying to find this particular use case has proven to be quite challenging so I hope this question hasn't been asked before even though I suspect I just couldn't find it.</p> <pre><code>public class Test { public int a; public int b; } public Test[] testArray; public enum Choice { A,B, Both = A|B } public IEnumerable&lt;int&gt; GetEnumerable(Choice choice) { //need to use Linq methods to return an enumerable based on choice } //e.g testArray = { (1,2) (3,4) (5,6) //calling GetEnumerable(Choice.A) // 1,3,5 //calling GetEnumerable(Choice.Both) // 1,2,3,4,5,6 </code></pre> <p>Everyone focused on the wrong aspects of my question, yes the [Flags] attribute is missing, yes the enum items should be a power of 2 to be used as Flags. I already marked the correct answer which is to loop over the collection which is what I did before, I just didn't realize I could yield return a IEnumerable so Implemented an enumerator</p> <p>All the other solutions use Linq but rely too much on instantiating new objects, for a lazy quick approach that is fine but that's not what I wanted.</p>
[ { "answer_id": 74182673, "author": "Dmitry Bychenko", "author_id": 2319407, "author_profile": "https://Stackoverflow.com/users/2319407", "pm_score": 1, "selected": true, "text": "SelectMany" }, { "answer_id": 74182692, "author": "DavidG", "author_id": 1663001, "author...
2022/10/24
[ "https://Stackoverflow.com/questions/74182581", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20322349/" ]
74,182,582
<p>Dataframe:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>product1</th> <th>product2</th> <th>product3</th> <th>product4</th> <th>product5</th> </tr> </thead> <tbody> <tr> <td>straws</td> <td>orange</td> <td>melon</td> <td>chair</td> <td>bread</td> </tr> <tr> <td>melon</td> <td>milk</td> <td>book</td> <td>coffee</td> <td>cake</td> </tr> <tr> <td>bread</td> <td>melon</td> <td>coffe</td> <td>chair</td> <td>book</td> </tr> </tbody> </table> </div><div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>CountProduct1</th> <th>CountProduct2</th> <th>CountProduct3</th> <th>Countproduct4</th> <th>Countproduct5</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>1</td> <td>1</td> <td>1</td> <td>1</td> </tr> <tr> <td>2</td> <td>1</td> <td>1</td> <td>1</td> <td>1</td> </tr> <tr> <td>2</td> <td>3</td> <td>2</td> <td>2</td> <td>2</td> </tr> </tbody> </table> </div><div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>RatioProduct1</th> <th>RatioProduct2</th> <th>RatioProduct3</th> <th>Ratioproduct4</th> <th>Ratioproduct5</th> </tr> </thead> <tbody> <tr> <td>0.28</td> <td>0.54</td> <td>0.33</td> <td>0.35</td> <td>0.11</td> </tr> <tr> <td>0.67</td> <td>0.25</td> <td>0.13</td> <td>0.11</td> <td>0.59</td> </tr> <tr> <td>2.5</td> <td>1.69</td> <td>1.9</td> <td>2.5</td> <td>1.52</td> </tr> </tbody> </table> </div> <p>I want to create five others columns that keep my initial ratio of each item along the dataframe.</p> <p>Output:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>InitialRatio1</th> <th>InitialRatio2</th> <th>InitialRatio3</th> <th>InitialRatio4</th> <th>InitialRatio5</th> </tr> </thead> <tbody> <tr> <td>0.28</td> <td>0.54</td> <td>0.33</td> <td>0.35</td> <td>0.11</td> </tr> <tr> <td>0.33</td> <td>0.25</td> <td>0.13</td> <td>0.31</td> <td>0.59</td> </tr> <tr> <td>0.11</td> <td>0.33</td> <td>0.31</td> <td>0.35</td> <td>0.13</td> </tr> </tbody> </table> </div>
[ { "answer_id": 74205914, "author": "Riley", "author_id": 11472761, "author_profile": "https://Stackoverflow.com/users/11472761", "pm_score": 0, "selected": false, "text": "init_rateX" }, { "answer_id": 74212093, "author": "inquirer", "author_id": 11985088, "author_pro...
2022/10/24
[ "https://Stackoverflow.com/questions/74182582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16456907/" ]
74,182,588
<p>My titles may be one line or multiple lines.</p> <p>I'm trying to align the content under the title to the top without have to specify a height for the title.</p> <p>If I use margin-bottom on the title, the content aligns to the bottom.</p> <p>Adding min-height to the title gets the result I need but if the title breaks to more lines, the min-height breaks it.</p> <p>In the image below, I am trying to get the text to align to the top of the red line.</p> <p><a href="https://i.stack.imgur.com/OumfV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OumfV.jpg" alt="enter image description here" /></a></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>.flexbox-row { display: flex; } .columns .section-title { margin-bottom: auto; /* ADDED */ } .columns .item { display: flex; flex-direction: column; max-width: 33.333333%; flex-basis: 33.333333%; padding: 0px 45px; } .columns .item:first-child { padding-left: 0; } .columns .item:last-child { padding-right: 0; } #buy-sell .columns p { padding-right: 110px; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;section id="" class="columns"&gt; &lt;div class="outer-container"&gt; &lt;div class="flexbox-row item-wrapper"&gt; &lt;div class="item"&gt; &lt;h2 class="section-title"&gt; Title 1 &lt;/h2&gt; &lt;p&gt; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis elit nec magna placerat pharetra non vitae nibh. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis elit nec magna placerat pharetra non vitae nibh. &lt;/p&gt; &lt;/div&gt; &lt;div class="item"&gt; &lt;h2 class="section-title"&gt; Title 2 Title 2 Title 2 Title 2 &lt;/h2&gt; &lt;p&gt; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis elit nec magna placerat pharetra non vitae nibh. &lt;/p&gt; &lt;/div&gt; &lt;div class="item"&gt; &lt;h2 class="section-title"&gt; Title 3 Title 3 Title 3 Title 3 Title 3 &lt;/h2&gt; &lt;p&gt; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis elit nec magna placerat pharetra non vitae nibh. &lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/section&gt; </code></pre> </div> </div> </p>
[ { "answer_id": 74205914, "author": "Riley", "author_id": 11472761, "author_profile": "https://Stackoverflow.com/users/11472761", "pm_score": 0, "selected": false, "text": "init_rateX" }, { "answer_id": 74212093, "author": "inquirer", "author_id": 11985088, "author_pro...
2022/10/24
[ "https://Stackoverflow.com/questions/74182588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1984257/" ]
74,182,590
<p>Let's say we have some data;</p> <pre><code>id 1 2 3 price 5 5 7 old_price 5 5 8 </code></pre> <p>I want it like this;</p> <pre><code>id 1 3 price 5 7 old_price 5 8 </code></pre> <p>How its work in oracle?</p>
[ { "answer_id": 74205914, "author": "Riley", "author_id": 11472761, "author_profile": "https://Stackoverflow.com/users/11472761", "pm_score": 0, "selected": false, "text": "init_rateX" }, { "answer_id": 74212093, "author": "inquirer", "author_id": 11985088, "author_pro...
2022/10/24
[ "https://Stackoverflow.com/questions/74182590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19784706/" ]
74,182,594
<p>Let's say in Unity I'm using a web API to get a JSON response. I'm currently using a function similar to this</p> <pre><code>public IEnumerator GetCompletion(string prompt, System.Action&lt;string&gt; callback, float temperature = 0.8f) { UnityWebRequest www = UnityWebRequest.Post(&quot;https://api.openai.com/v1/completions&quot;, &quot;&quot;); // ... snip .... yield return www.SendWebRequest(); if (www.result == UnityWebRequest.Result.ConnectionError) { Debug.Log(www.error); www.Dispose(); yield return null; } else { www.Dispose(); callback?.Invoke(GetResultFromJson(www.downloadHandler.text)); } } </code></pre> <p>which I can then call via</p> <pre><code>const string prompt = &quot;Albert Einstein was&quot;; StartCoroutine( textAI.GetCompletion(prompt, (string result) =&gt; { Debug.Log(result); }, temperature: 0.5f )); </code></pre> <p>How would I refactor this Coroutines approach to be using C#'s Await and Async approach?</p> <p>I don't have any particular end goal, except perhaps to make things easier to read due to less nesting when calling (also when the coroutine would need another couroutine inside it, or when I need to await multiple simultaneously). Thanks!</p>
[ { "answer_id": 74190248, "author": "rbcode", "author_id": 17375274, "author_profile": "https://Stackoverflow.com/users/17375274", "pm_score": 1, "selected": false, "text": "IEnumerator Start() {\n yield return SceneManager.LoadSceneAsync(\"somescene\");\n var task = SomeTaskBasedAp...
2022/10/24
[ "https://Stackoverflow.com/questions/74182594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34170/" ]
74,182,595
<p>I have an error when I try to build my nodejs app with &quot;vue-cli-service&quot;.</p> <p>The error is :</p> <pre><code>20 error code ELIFECYCLE 21 error errno 1 22 error @ozu/ui@1.2.3 build: `vue-cli-service build` 22 error Exit status 1 23 error Failed at the @ozu/ui@1.2.3 build script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ] </code></pre> <p>I use lerna but I don't think it can be the cause of the problem.</p> <p>I tried to delete the node_modules file the npm install again, I tried to add &quot;error-stack-parser&quot; to my package.json but nothing works and I don't understand where the error come from.</p> <p>For more details : I'm deploying on Windows, I'm using Lerna to compile multiple packages, so I have 4 package.json, I got the error in the build in one of them, the package.json looks like that :</p> <pre><code>{ &quot;name&quot;: &quot;@ozu/ui&quot;, &quot;version&quot;: &quot;1.2.3&quot;, &quot;main&quot;: &quot;dist/main&quot;, &quot;types&quot;: &quot;dist/main&quot;, &quot;author&quot;: &quot;anonymous_author&quot;, &quot;files&quot;: [ &quot;dist&quot; ], &quot;scripts&quot;: { &quot;serve&quot;: &quot;vue-cli-service serve&quot;, &quot;build&quot;: &quot;vue-cli-service build&quot;, &quot;lint&quot;: &quot;vue-cli-service lint&quot; }, &quot;dependencies&quot;: { &quot;@ozu/common&quot;: &quot;^0.0.1&quot;, &quot;axios&quot;: &quot;^0.18.0&quot;, &quot;core-js&quot;: &quot;^2.6.5&quot;, &quot;croppie&quot;: &quot;^2.6.4&quot;, &quot;cypress&quot;: &quot;^8.3.1&quot;, &quot;date-fns&quot;: &quot;^2.4.1&quot;, &quot;file-list-plugin&quot;: &quot;^2.0.2&quot;, &quot;file-loader&quot;: &quot;^3.0.1&quot;, &quot;sass&quot;: &quot;^1.26.10&quot;, &quot;tiptap&quot;: &quot;^1.27.1&quot;, &quot;tiptap-extension-superscript&quot;: &quot;^0.1.0&quot;, &quot;tiptap-extensions&quot;: &quot;^1.29.1&quot;, &quot;tiptap-vuetify&quot;: &quot;^2.24.0&quot;, &quot;validatorjs&quot;: &quot;^3.17.1&quot;, &quot;vue&quot;: &quot;^2.6.10&quot;, &quot;vue-class-component&quot;: &quot;^7.0.2&quot;, &quot;vue-cropperjs&quot;: &quot;^4.1.0&quot;, &quot;vue-croppie&quot;: &quot;^2.0.1&quot;, &quot;vue-property-decorator&quot;: &quot;^8.1.0&quot;, &quot;vue-router&quot;: &quot;^3.0.3&quot;, &quot;vue-template-loader&quot;: &quot;^1.0.0&quot;, &quot;vuedraggable&quot;: &quot;^2.23.2&quot;, &quot;vuetify&quot;: &quot;^2.1.3&quot;, &quot;vuex&quot;: &quot;^3.0.1&quot;, &quot;vuex-module-decorators&quot;: &quot;^0.9.8&quot;, &quot;vuex-persist&quot;: &quot;^2.0.0&quot; }, &quot;devDependencies&quot;: { &quot;@fortawesome/fontawesome-free&quot;: &quot;^5.11.2&quot;, &quot;@types/axios&quot;: &quot;^0.14.0&quot;, &quot;@types/jest&quot;: &quot;^23.1.4&quot;, &quot;@vue/cli-plugin-babel&quot;: &quot;^3.0.5&quot;, &quot;@vue/cli-plugin-typescript&quot;: &quot;^3.0.5&quot;, &quot;@vue/cli-plugin-unit-jest&quot;: &quot;^3.0.5&quot;, &quot;@vue/cli-service&quot;: &quot;^3.12.1&quot;, &quot;@vue/test-utils&quot;: &quot;1.0.0-beta.29&quot;, &quot;babel-core&quot;: &quot;7.0.0-bridge.0&quot;, &quot;error-stack-parser&quot;: &quot;2.0.6&quot;, &quot;sass-loader&quot;: &quot;^7.1.0&quot;, &quot;stylus&quot;: &quot;^0.54.7&quot;, &quot;stylus-loader&quot;: &quot;^3.0.2&quot;, &quot;ts-jest&quot;: &quot;^23.0.0&quot;, &quot;typescript&quot;: &quot;^3.6.2&quot;, &quot;vue-cli-plugin-vuetify&quot;: &quot;^0.5.0&quot;, &quot;vue-template-compiler&quot;: &quot;^2.5.21&quot;, &quot;vuetify-loader&quot;: &quot;^1.0.5&quot; } } </code></pre> <p>The debug log show this :</p> <pre><code>0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli 'D:\\nodejs\\node.exe', 1 verbose cli 'D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'build' 1 verbose cli ] 2 info using npm@6.13.4 3 info using node@v12.15.0 4 verbose run-script [ 'prebuild', 'build', 'postbuild' ] 5 info lifecycle @ozu/ui@1.2.2~prebuild: @ozu/ui@1.2.2 6 info lifecycle @ozu/ui@1.2.2~build: @ozu/ui@1.2.2 7 verbose lifecycle @ozu/ui@1.2.2~build: unsafe-perm in lifecycle true 8 verbose lifecycle @ozu/ui@1.2.2~build: PATH: D:\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\ozu\packages\ui\node_modules\.bin;D:\ozu\packages\ui\node_modules\.bin;D:\ozu\packages\node_modules\.bin;D:\ozu\node_modules\.bin;D:\node_modules\.bin;D:\nodejs;D:\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\ozu\node_modules\.bin;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;D:\php;C:\ProgramData\ComposerSetup\bin;C:\oracle\instantclient_19_3;D:\nodejs\;C:\ProgramData\chocolatey\bin;D:\Git\cmd;C:\Users\adlj\AppData\Local\Microsoft\WindowsApps 9 verbose lifecycle @ozu/ui@1.2.2~build: CWD: D:\ozu\packages\ui 10 silly lifecycle @ozu/ui@1.2.2~build: Args: [ '/d /s /c', 'vue-cli-service build' ] 11 silly lifecycle @ozu/ui@1.2.2~build: Returned: code: 1 signal: null 12 info lifecycle @ozu/ui@1.2.2~build: Failed to exec build script 13 verbose stack Error: @ozu/ui@1.2.2 build: `vue-cli-service build` 13 verbose stack Exit status 1 13 verbose stack at EventEmitter.&lt;anonymous&gt; (D:\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:223:5) 13 verbose stack at ChildProcess.&lt;anonymous&gt; (D:\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:223:5) 13 verbose stack at maybeClose (internal/child_process.js:1021:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) 14 verbose pkgid @ozu/ui@1.2.2 15 verbose cwd D:\ozu\packages\ui 16 verbose Windows_NT 10.0.17763 17 verbose argv &quot;D:\\nodejs\\node.exe&quot; &quot;D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js&quot; &quot;run&quot; &quot;build&quot; 18 verbose node v12.15.0 19 verbose npm v6.13.4 20 error code ELIFECYCLE 21 error errno 1 22 error @ozu/ui@1.2.2 build: `vue-cli-service build` 22 error Exit status 1 23 error Failed at the @ozu/ui@1.2.2 build script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ] </code></pre>
[ { "answer_id": 74190248, "author": "rbcode", "author_id": 17375274, "author_profile": "https://Stackoverflow.com/users/17375274", "pm_score": 1, "selected": false, "text": "IEnumerator Start() {\n yield return SceneManager.LoadSceneAsync(\"somescene\");\n var task = SomeTaskBasedAp...
2022/10/24
[ "https://Stackoverflow.com/questions/74182595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14950032/" ]
74,182,600
<p>When I tried to reverse the Linked list, I noticed that the results varied depending on how I did the assignments.</p> <p>Why does it happen as bellow?</p> <pre><code>class ListNode: def __init__(self, val=0, next: Optional[&quot;ListNode&quot;] = None): self.val = val self.next = next # It works as expected with unpacking assignment. nodes = ListNode(1, ListNode(2, ListNode(3, ListNode(4, ListNode(5))))) rev = None while nodes is not None: rev, rev.next, nodes = nodes, rev, nodes.next # rev = [5, 4, 3, 2, 1] # But dose not work as expected when assigning one by one. cnt = 0 nodes = ListNode(1, ListNode(2, ListNode(3, ListNode(4, ListNode(5))))) rev = None while nodes is not None: if cnt &gt; 10: break rev = nodes rev.next = rev nodes = nodes.next cnt += 1 # rev = [1, 1, 1, 1, 1...] Infinite loop in circular reference! </code></pre> <p>My Environments:</p> <ul> <li>Python 3.10.7</li> </ul> <p>Thanks a lots.</p>
[ { "answer_id": 74190248, "author": "rbcode", "author_id": 17375274, "author_profile": "https://Stackoverflow.com/users/17375274", "pm_score": 1, "selected": false, "text": "IEnumerator Start() {\n yield return SceneManager.LoadSceneAsync(\"somescene\");\n var task = SomeTaskBasedAp...
2022/10/24
[ "https://Stackoverflow.com/questions/74182600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20321800/" ]
74,182,632
<p>I have a data frame with two columns</p> <pre><code>df = DataFrame.from_records([ {&quot;time&quot;: 10, &quot;amount&quot;: 200}, {&quot;time&quot;: 70, &quot;amount&quot;: 1000}, {&quot;time&quot;: 10, &quot;amount&quot;: 300}, {&quot;time&quot;: 10, &quot;amount&quot;: 100}, ]) </code></pre> <p>I want to, given a period of time <code>80</code>ms, calculate the max amount that is possible, in this case, the output should be 1300 because, in this period, the maximum amount possible is 1300.</p> <p>Is it possible with Pandas? I thought about using aggregate, but I do not know how to use it</p>
[ { "answer_id": 74182769, "author": "mozway", "author_id": 16343464, "author_profile": "https://Stackoverflow.com/users/16343464", "pm_score": 4, "selected": true, "text": "knapsack" }, { "answer_id": 74183370, "author": "Serge Ballesta", "author_id": 3545273, "author_...
2022/10/24
[ "https://Stackoverflow.com/questions/74182632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/832490/" ]
74,182,637
<p>I need help as I need to track changes on my file. I actually have 2 tabs. One is the Old data and the other one is for the new data.</p> <p>I have a total of 6 columns</p> <p>Column A B C D and E are for my references</p> <p>Column F is for Concatenate of Columns A to E</p> <p>Column G is for Remarks</p> <p>What I need is for the remarks column to have a remark of &quot;<strong>CHANGED</strong>&quot;if any of the columns in ABCDE changed New data versus the Old data</p> <p>&quot;<strong>No Changed</strong>&quot; if the data in Old data tab and New tab data matched</p> <p>&quot;<strong>New</strong>&quot; if the data in New data tab cannot be found in Old data tab</p> <p>Here's what I have done so far:</p> <p><em>CONCATENATE</em> is the column name in the New data tab</p> <pre><code>=IF(VLOOKUP([@CONCATENATE],'Old data'!F:F,1,0)=[@CONCATENATE], &quot;NO CHANGE&quot;, &quot;CHANGED&quot;) </code></pre> <p>Whenever I make changes, N/A is showing as the result</p> <p>The progress so far is now okay but just need the New remarks for the newly added data.</p> <p>If the data is neither changed or no changed, meaning not existing in either old tab or new tab, it should return a New value</p> <pre><code>=ifna(if(iserror(vlookup([@concatenate],'Old data'!G:G,1,0)),&quot;Changed&quot;,&quot;No Changed&quot;),&quot;NEW&quot;) </code></pre>
[ { "answer_id": 74182782, "author": "Scott Craner", "author_id": 4851590, "author_profile": "https://Stackoverflow.com/users/4851590", "pm_score": 3, "selected": true, "text": "=IF(ISERROR(VLOOKUP([@CONCATENATE],'Old data'!G:G,1,0)),\"CHANGED\",\"NO CHANGE\")\n" }, { "answer_id": ...
2022/10/24
[ "https://Stackoverflow.com/questions/74182637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20322481/" ]
74,182,653
<p>My debug statement is displaying the database correctly, by after something is going wrong and in getting the error: Unhandled Exception: NoSuchMethodError: Class 'int' has no instance method '[]'. I am getting null data when I'm trying to display is in my application, this is because the list i am using to store the values has length 0</p> <p>following is my class</p> <pre><code>class UserDetails extends ChangeNotifier { final String? userId; final String? mobileno; bool? userStatus; final String? adhar; final String? pan; final String? adharno; final String? panno; UserDetails( {this.userId, this.mobileno, this.userStatus = false, this.adhar, this.pan, this.adharno, this.panno}); } </code></pre> <p>following is my api where I am facing error</p> <pre><code>Future&lt;void&gt; getUsers(BuildContext context) async { final url = '${PurohitApi().baseUrl}${PurohitApi().users}'; final List&lt;UserDetails&gt; loadedUsers = []; try { final client = RetryClient( http.Client(), retries: 4, when: (response) { return response.statusCode == 401 ? true : false; }, onRetry: (req, res, retryCount) async { //print('retry started $token'); if (retryCount == 0 &amp;&amp; res?.statusCode == 401) { var accessToken = await Provider.of&lt;Auth&gt;(context, listen: false) .restoreAccessToken(); // Only this block can run (once) until done req.headers['Authorization'] = accessToken; } }, ); var response = await client.get( Uri.parse(url), headers: {'Authorization': authToken!}, ); final extractedData = json.decode(response.body) as Map&lt;String, dynamic&gt;; print(extractedData); if (extractedData['data'] == null) { return; } extractedData.forEach((userId, userData) { print(userId); loadedUsers.add( UserDetails( userId: userData['data']['id'], mobileno: userData['data']['mobileno'], userStatus: userData['data']['userstatus'], adhar: userData['data']['adhar'], pan: userData['data']['pan'], adharno: userData['data']['adharno'], panno: userData['data']['panno'], ), ); }); _users = loadedUsers.reversed.toList(); //print(users); notifyListeners(); } catch (e) { print(e); } } } </code></pre> <p>I am facing NoSuchMethodError: Class 'int' has no instance method '[]'Tried calling: from above api following is my response <a href="https://i.stack.imgur.com/amTUr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/amTUr.jpg" alt="this is my response" /></a></p>
[ { "answer_id": 74182782, "author": "Scott Craner", "author_id": 4851590, "author_profile": "https://Stackoverflow.com/users/4851590", "pm_score": 3, "selected": true, "text": "=IF(ISERROR(VLOOKUP([@CONCATENATE],'Old data'!G:G,1,0)),\"CHANGED\",\"NO CHANGE\")\n" }, { "answer_id": ...
2022/10/24
[ "https://Stackoverflow.com/questions/74182653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17033081/" ]
74,182,687
<pre><code> celsius = 45 fahrenheit = (celsius * 1.8) + 32 print(&quot;{:.2f}&quot;.format(fahrenheit),'F') </code></pre> <p>The output of this is --- 113.00 F</p> <p>How do I remove the space before F, so it will look like this 113.00F.</p>
[ { "answer_id": 74182782, "author": "Scott Craner", "author_id": 4851590, "author_profile": "https://Stackoverflow.com/users/4851590", "pm_score": 3, "selected": true, "text": "=IF(ISERROR(VLOOKUP([@CONCATENATE],'Old data'!G:G,1,0)),\"CHANGED\",\"NO CHANGE\")\n" }, { "answer_id": ...
2022/10/24
[ "https://Stackoverflow.com/questions/74182687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20174903/" ]
74,182,708
<p>I am using Hibernate @Filter with Spring Data to add specific &quot;where&quot; clause for every query in my project. The problem is that it works as long as I use @Transactional annotation for my 'findAll' method. Is there any way to avoid using @Transactional? Why is it important here?</p> <p>Here is the filter config:</p> <pre><code> @FilterDef(name = &quot;testFilter&quot;, parameters = @ParamDef(name = &quot;company_id&quot;, type = &quot;long&quot;), defaultCondition = &quot;company_id=:companyId&quot;) @Filter(name = &quot;testFilter&quot;) @EntityListeners(EmployeeListener.class) @NoArgsConstructor public class Employee {//basic fields} </code></pre> <p>Repository:</p> <pre><code>@Repository public interface EmployeeRepository extends PagingAndSortingRepository&lt;Employee, UUID&gt; { } </code></pre> <p>Aspect that enables the filter:</p> <pre><code>@Aspect @Component public class TestAspect { private final SecurityAspect securityAspect; private final Logger logger; @PersistenceContext private EntityManager entityManager; @Autowired public TestAspect(SecurityAspect securityAspect, Logger logger) { this.securityAspect = securityAspect; this.logger = logger; } @Around(&quot;execution(* org.springframework.data.repository.CrudRepository+.findAll(..))&quot;) public Object aroundFindAllTenantAware(ProceedingJoinPoint joinPoint) { Session session = this.entityManager.unwrap(Session.class); session.enableFilter(&quot;testFilter&quot;) .setParameter(&quot;companyId&quot;, this.securityAspect.getCompanyId()); Object retValue = null; try { retValue = joinPoint.proceed(); } catch (Throwable throwable) { logger.error(throwable.getMessage(), throwable); } finally { session.disableFilter(&quot;testFilter&quot;); } return retValue; } } </code></pre> <p>And, finally, my service:</p> <pre><code>@Service @Transactional public class EmployeeApiServiceImpl { private final EmployeeRepository repository; @Autowired public EmployeeApiServiceImpl(EmployeeRepository repository) { this.employeeRepository = employeeRepository; } @Override public Response listProfiles(SecurityContext securityContext) { List&lt;Employee&gt; employees = repository.findAll(); return Response.ok().entity(employees).build(); } </code></pre> <p>Without @Transactional annotation, it does not work. When I am debugging the aspect I can see that the filter was enabled but the query did not change. When I put the annotation, everything works fine. But I don't get why it is happening. This annotation is not supposed to be on read methods, plus in every tutorial everything works without it, but not in my case.</p>
[ { "answer_id": 74182782, "author": "Scott Craner", "author_id": 4851590, "author_profile": "https://Stackoverflow.com/users/4851590", "pm_score": 3, "selected": true, "text": "=IF(ISERROR(VLOOKUP([@CONCATENATE],'Old data'!G:G,1,0)),\"CHANGED\",\"NO CHANGE\")\n" }, { "answer_id": ...
2022/10/24
[ "https://Stackoverflow.com/questions/74182708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16544454/" ]
74,182,733
<p>I've got an array of multiple objects which have 4 key-value (could have more) pairs and an identifier. Is there a way to change order of the array - ascending/descending, based on what <code>Val1, Val2, Val3, Val4</code> add up?</p> <pre class="lang-js prettyprint-override"><code>const array = [ { 'Val1': 10, 'Val2': 20, 'Val3': 30, 'Val4': 40 , // Val1 + Val2 + Val3 + Val4 = 100 'identifier': 'Column1' }, { 'Val1': 20, 'Val2': 30, 'Val3': 40, 'Val4': 50, // Val1 + Val2 + Val3 + Val4 = 140 'identifier': 'Column2' } ] </code></pre> <p>In this example, let's say I want to change the array to descending order and expected result would be -</p> <pre class="lang-js prettyprint-override"><code>const array = [ { 'Val1': 20, 'Val2': 30, 'Val3': 40, 'Val4': 50, // Val1 + Val2 + Val3 + Val4 = 140 'identifier': 'Column2' } { 'Val1': 10, 'Val2': 20, 'Val3': 30, 'Val4': 40, // Val1 + Val2 + Val3 + Val4 = 100 'identifier': 'Column1' } ] </code></pre>
[ { "answer_id": 74182782, "author": "Scott Craner", "author_id": 4851590, "author_profile": "https://Stackoverflow.com/users/4851590", "pm_score": 3, "selected": true, "text": "=IF(ISERROR(VLOOKUP([@CONCATENATE],'Old data'!G:G,1,0)),\"CHANGED\",\"NO CHANGE\")\n" }, { "answer_id": ...
2022/10/24
[ "https://Stackoverflow.com/questions/74182733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12062163/" ]
74,182,748
<p>I wanted to redesign this Flexbox Accordion: <a href="https://codepen.io/arjancodes/pen/gbweYB" rel="nofollow noreferrer">https://codepen.io/arjancodes/pen/gbweYB</a></p> <pre><code> .section-content { flex: 1; display: flex; align-items: center; margin: 0; padding: 0; opacity: 0; transition: all .25s .1s ease-out; } } </code></pre> <p>It was displayed vertically, not horizontally as it is now. How can this be done?</p>
[ { "answer_id": 74182837, "author": "Gowtham V", "author_id": 13378117, "author_profile": "https://Stackoverflow.com/users/13378117", "pm_score": 2, "selected": false, "text": "flex-direction:column" }, { "answer_id": 74183604, "author": "Gowtham V", "author_id": 13378117,...
2022/10/24
[ "https://Stackoverflow.com/questions/74182748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10037166/" ]
74,182,807
<p>I'm using PyInstaller to compile a program and keep coming across the error &quot;No module named 'charset_normalizer.md__mypyc.'&quot; The Charset-Normalizer package is installed.</p> <p>As a test, I tried re-compiling a program that I had previously created in early September without issue, but now receive the same error. I thought that maybe there is an issue with the versions of either PyInstaller or Charset-Normalizer so I've experimented with different versions, but cannot get it to work.</p>
[ { "answer_id": 74258319, "author": "Dragon Kush", "author_id": 4118258, "author_profile": "https://Stackoverflow.com/users/4118258", "pm_score": 0, "selected": false, "text": "pip install chardet\n" }, { "answer_id": 74540217, "author": "BlaziWazi", "author_id": 20576777,...
2022/10/24
[ "https://Stackoverflow.com/questions/74182807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20322600/" ]
74,182,816
<p>Any idea how i could do the following in python &gt;3.7 ?</p> <pre><code>a = [&quot;a&quot;,&quot;b&quot;,&quot;c&quot;,&quot;c&quot;,&quot;a&quot;,&quot;a&quot;,&quot;a&quot;] b = F(a) =&gt; [[0],[1],[2,3],[4,5,6]] </code></pre> <p>The use case is a list with roughly 10e6 elements.<br /> Thx</p>
[ { "answer_id": 74182865, "author": "Dani Mesejo", "author_id": 4001592, "author_profile": "https://Stackoverflow.com/users/4001592", "pm_score": 4, "selected": true, "text": "from itertools import groupby, count\n\na = [\"a\",\"b\",\"c\",\"c\",\"a\",\"a\",\"a\"]\ncounter = count()\n\nres...
2022/10/24
[ "https://Stackoverflow.com/questions/74182816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
74,182,819
<p>I have an entity Message that has a <code>sender</code> (<code>User</code>) and a <code>receiver</code>, but the <code>receiver</code> can either be a <code>User</code> or a <code>Channel</code> (both entities have the <code>messagesIn</code> member), and I want to implement this using TypeORM relationships.</p> <p>Would It be possible to do something like this with TypeORM(postgres)/NestJS (Or is there any conventional other way to achieve the same goal) ?</p> <pre class="lang-js prettyprint-override"><code>// message.entity.ts @Entity() export class Message { @PrimaryGeneratedColumn('uuid') id: string; @Column() content: string; @ManyToOne(() =&gt; User, (snd) =&gt; snd.messagesOut) sender: User; // That line doesn't compile @ManyToOne(() =&gt; User | Channel, (rcv) =&gt; rcv.messagesIn) receiver: User | Channel; }; </code></pre>
[ { "answer_id": 74201364, "author": "Belayer", "author_id": 7623856, "author_profile": "https://Stackoverflow.com/users/7623856", "pm_score": 0, "selected": false, "text": "Create table Message( id uuid default gen_random_uuid()\n primary key\n ...
2022/10/24
[ "https://Stackoverflow.com/questions/74182819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13242312/" ]
74,182,863
<p>I'm tokenizing some document and I want to find out which tokens are shared between one or more tokenizations. To do this, for each tokenization, I am looping through the set of all tokens in all tokenizations, called <code>all_tokens</code> and checking if a given token exists in the current tokenization. If it does exist in the current tokenization, I add the index of the tokenization <code>i</code> to a set corresponding to the token in the <code>token_dict</code> dictionary. However, <code>set.add()</code> is somehow being called outside the conditional, resulting in every <code>i</code> being added to the token's entry in the <code>token_dict</code>. I've set up a small toy version here where I check the final token's entry in the <code>token_dict</code>.</p> <pre><code>import numpy as np np.random.seed(42) all_tokens = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] tokenizations = [[all_tokens[np.random.randint(0, len(all_tokens))] for i in range(4)] for i in range(10)] print(tokenizations) token_dict = dict.fromkeys(all_tokens, set()) for i, tokenization in enumerate(tokenizations): token_set = set(tokenization) for token in all_tokens: #for each token in the total vocabulary, check if the unique value exists in the tokenization if token in token_set: token_dict[token].add(i) if(token=='g'): print(token in token_set) print(token) print(token_dict[token]) </code></pre> <p>This results in the output:</p> <pre><code>[['g', 'd', 'e', 'g'], ['c', 'e', 'e', 'g'], ['b', 'c', 'g', 'c'], ['c', 'e', 'd', 'c'], ['f', 'e', 'b', 'd'], ['f', 'f', 'b', 'd'], ['e', 'a', 'd', 'b'], ['f', 'e', 'd', 'a'], ['a', 'c', 'c', 'g'], ['b', 'd', 'd', 'g']] True True True False False False False False True True g {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} </code></pre> <p>As you can see, <code>g</code> does not exist in the tokenizations at indices 3-7 and the conditional correctly identifies this as <code>False</code>, but the indices of those tokenizations are added to the entry of <code>g</code> in the <code>token_dict</code>.</p> <p>If I change the <code>token_dict</code> values to a <code>list</code>, and use <code>list.append()</code>, the output shows every index appended to the <code>list</code> 3 times. <code>[0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9]</code></p> <p>I don't show it here but this is true for all tokens in <code>all_tokens</code>. Why is this happening?</p>
[ { "answer_id": 74182933, "author": "Shoaib Baloch", "author_id": 14326644, "author_profile": "https://Stackoverflow.com/users/14326644", "pm_score": -1, "selected": false, "text": "import numpy as np\nnp.random.seed(42)\n\nall_tokens = ['a', 'b', 'c', 'd', 'e', 'f', 'g']\n\ntokenizations...
2022/10/24
[ "https://Stackoverflow.com/questions/74182863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15288893/" ]
74,182,880
<p>i have this error where i build my angular app [1]: <a href="https://i.stack.imgur.com/pVVFA.png" rel="nofollow noreferrer">https://i.stack.imgur.com/pVVFA.png</a></p>
[ { "answer_id": 74229052, "author": "Lucas Argate", "author_id": 1242635, "author_profile": "https://Stackoverflow.com/users/1242635", "pm_score": 0, "selected": false, "text": "Angular CLI: 14.1.0\nNode: 14.17.6\nPackage Manager: npm 6.14.15\nOS: win32 x64\n\nAngular: 14.1.0\n... animati...
2022/10/24
[ "https://Stackoverflow.com/questions/74182880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18891489/" ]
74,182,891
<p>I have the following dataframe (sample):</p> <pre><code>import pandas as pd data = [['A', '2022-09-01 10:00:00', False, 2], ['A', '2022-09-01 14:00:00', False, 3], ['B', '2022-09-01 13:00:00', False, 1], ['B', '2022-09-01 16:00:00', True, 4]] df = pd.DataFrame(data = data, columns = ['group', 'date', 'indicator', 'value']) group date indicator value 0 A 2022-09-01 10:00:00 False 2 1 A 2022-09-01 14:00:00 False 3 2 B 2022-09-01 13:00:00 False 1 3 B 2022-09-01 16:00:00 True 4 </code></pre> <p>I would like to fill in the missing dates between dates hourly. So each hour that is missing between dates should be filled and the values should be the same as the previous data. Here is the desired output:</p> <pre><code>data = [['A', '2022-09-01 10:00:00', False, 2], ['A', '2022-09-01 11:00:00', False, 2], ['A', '2022-09-01 12:00:00', False, 2], ['A', '2022-09-01 13:00:00', False, 2], ['A', '2022-09-01 14:00:00', False, 3], ['B', '2022-09-01 13:00:00', False, 1], ['B', '2022-09-01 14:00:00', False, 1], ['B', '2022-09-01 15:00:00', False, 1], ['B', '2022-09-01 16:00:00', True, 4]] df_desired = pd.DataFrame(data = data, columns = ['group', 'date', 'indicator', 'value']) group date indicator value 0 A 2022-09-01 10:00:00 False 2 1 A 2022-09-01 11:00:00 False 2 2 A 2022-09-01 12:00:00 False 2 3 A 2022-09-01 13:00:00 False 2 4 A 2022-09-01 14:00:00 False 3 5 B 2022-09-01 13:00:00 False 1 6 B 2022-09-01 14:00:00 False 1 7 B 2022-09-01 15:00:00 False 1 8 B 2022-09-01 16:00:00 True 4 </code></pre> <p>So I was wondering if it is possible to fill the missing dates hourly per group with the previous value in column value using <code>Pandas</code>?</p>
[ { "answer_id": 74182951, "author": "mozway", "author_id": 16343464, "author_profile": "https://Stackoverflow.com/users/16343464", "pm_score": 3, "selected": true, "text": "df['date'] = pd.to_datetime(df['date'])\n\nout = (df\n .groupby('group', as_index=False, group_keys=False)\n .ap...
2022/10/24
[ "https://Stackoverflow.com/questions/74182891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14282714/" ]
74,182,900
<p>I have a table that looks like this:</p> <pre><code>| id | email | name | | -----| -------------- |------| | 1 | a@example.com | joe | | 2 | b@example.com | john | | 3 | c@example.com | joe | | 4 | d@example.com | joe | | 5 | d@example.com | dee | | 6 | d@example.com | bri | </code></pre> <p>I need to query the table for all rows where the same name has an email in the list &quot;d@example.com&quot;, &quot;a@example.com&quot;. This expected result would return rows 1 and 4.</p>
[ { "answer_id": 74183224, "author": "Isolated", "author_id": 13118009, "author_profile": "https://Stackoverflow.com/users/13118009", "pm_score": 2, "selected": false, "text": "with cte1 as (\n select name from my_data where email = 'a@example.com'\n intersect\n select name from my_d...
2022/10/24
[ "https://Stackoverflow.com/questions/74182900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5155574/" ]
74,182,905
<p>I am trying to expand/collapse the content of the clicked property, but clicking expands all the properties. <br> I understand that I need to expand the item based on some <code>indentifier</code>, like if the idx of icon is the same as the idx of the item, then expand only that item, but can't implement in code.</p> <p>Here is <a href="https://codesandbox.io/s/happy-wozniak-ffjufp?file=/src/ArticleItem.js:0-197" rel="nofollow noreferrer">the codesandbox link</a> and code example below<br> App.js</p> <pre><code>import &quot;./styles.css&quot;; import ArticleItem from &quot;./ArticleItem&quot;; import { useState } from &quot;react&quot;; const ARTICLES = [ { title: &quot;What's SAP&quot;, upvotes: 1, date: &quot;2019-11-21&quot; }, { title: &quot;Simple text editor has 15k monthly users&quot;, upvotes: 7, date: &quot;2010-12-31&quot; } ]; export default function App() { const [isOpen, setIsOpen] = useState(false); const toggleView = (idx) =&gt; { return ARTICLES.map((_, index) =&gt; { if (idx === index) { setIsOpen(!isOpen); } }); }; return ( &lt;div className=&quot;App&quot;&gt; {ARTICLES.map((article, idx) =&gt; ( &lt;div&gt; {article.title} &lt;button onClick={() =&gt; toggleView(idx)}&gt; &lt;i className=&quot;fas fa-arrow-down&quot;&gt;&lt;/i&gt; &lt;/button&gt; {isOpen &amp;&amp; &lt;ArticleItem article={article} /&gt;} &lt;/div&gt; ))} &lt;/div&gt; ); } </code></pre> <p>ArticleItem.js</p> <pre><code>import React from &quot;react&quot;; const ArticleItem = ({ article }) =&gt; { return ( &lt;&gt; &lt;div&gt;{article.upvotes}&lt;/div&gt; &lt;div&gt;{article.date}&lt;/div&gt; &lt;/&gt; ); }; export default ArticleItem; </code></pre> <p>Any help will be appreciated</p>
[ { "answer_id": 74183014, "author": "David", "author_id": 328193, "author_profile": "https://Stackoverflow.com/users/328193", "pm_score": 2, "selected": true, "text": "const [isOpen, setIsOpen] = useState(false);\n" }, { "answer_id": 74183062, "author": "David", "author_id...
2022/10/24
[ "https://Stackoverflow.com/questions/74182905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12971921/" ]
74,182,969
<p>For each sublist in array <code>b</code>, return values from list <code>a</code> with same position as positive boolean in <code>b</code> sublist (i.e. where True).</p> <pre><code>import pandas as pd import numpy as np a = pd.Series([1, 3, 5, 7, 9]) # values to choose from b = np.array([[False, True, False, True, False], # based on bools [False, False, False, False, False]]) out = [] for i, v in enumerate(b): out.append([]) for j in range(len(e)): if v[j]: out[i].append(a[j]) out = np.array(out) # np.array([[3,7],[]]) # result # In first sublist, True is on index 1 and 3 which corresponds to values 3 and 7. # In second sublist, there is not True, hence empty. </code></pre> <p>The above seems too laborious and it is possibly not making use of numpy vectorization (it is slow on large data).</p>
[ { "answer_id": 74183077, "author": "mozway", "author_id": 16343464, "author_profile": "https://Stackoverflow.com/users/16343464", "pm_score": 1, "selected": false, "text": "a2 = a.to_numpy()\nout = [a2[x] for x in b]\n" }, { "answer_id": 74183353, "author": "user19077881", ...
2022/10/24
[ "https://Stackoverflow.com/questions/74182969", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19363912/" ]
74,183,090
<p>I am trying to use a dictionary (created by reading the content of a first file) to modify the content of an array(created by reading the content of a second file) in order to return as many modified arrays as their are keys in the dictionary with the modification corresponding the position and change in the original array indicated in the values for each key.</p> <p>From a minimal example, if my dictionary and my list are:</p> <pre><code>change={'change 1': [(1, 'B'), (3, 'B'), (5, 'B'), (7, 'B')], 'change 2': [(2, 'B'), (4, 'B'), (6, 'B')]} s=['A', 'A', 'A', 'A', 'A', 'A', 'A'] </code></pre> <p>Then, I would like my code to return two lists:</p> <pre><code>['B', 'A', 'B', 'A', 'B', 'A', 'B'] ['A', 'B', 'A', 'B', 'A', 'B', 'A'] </code></pre> <p>I tried to code this in python3:</p> <pre><code>change={'change 1': [(1, 'B'), (3, 'B'), (5, 'B'), (7, 'B')], 'change 2': [(2, 'B'), (4, 'B'), (6, 'B')]} s=['A', 'A', 'A', 'A', 'A', 'A', 'A'] for key in change: s1=s for n in change[key]: s1[n[0]-1] = n[1] print(key, s1) print(s) </code></pre> <p>However it seems that even if I am only modifying the list <code>s1</code> which is a copy of <code>s</code>, I am nontheless modifying <code>s</code> as well, as it returns:</p> <pre><code>change 1 ['B', 'A', 'B', 'A', 'B', 'A', 'B'] ['B', 'A', 'B', 'A', 'B', 'A', 'B'] change 2 ['B', 'B', 'B', 'B', 'B', 'B', 'B'] ['B', 'B', 'B', 'B', 'B', 'B', 'B'] </code></pre> <p>So although I get the first list right, the second isn't and I don't understand why.</p> <p>Could you help me see what is wrong in my code, and how to make it work? Many thanks!</p>
[ { "answer_id": 74183190, "author": "Fatemeh Sangin", "author_id": 14271145, "author_profile": "https://Stackoverflow.com/users/14271145", "pm_score": 0, "selected": false, "text": "deepcopy" }, { "answer_id": 74183196, "author": "Samwise", "author_id": 3799759, "autho...
2022/10/24
[ "https://Stackoverflow.com/questions/74183090", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4305183/" ]
74,183,112
<p><strong>Setup:</strong></p> <ul> <li>micronaut 3.7.2</li> <li>micronaut-data 3.8.1, micronaut-data-r2dbc, r2dbc-postgresql 0.9.2</li> <li>Flyway 8.5.13, micronaut-jdbc-hikari, micronaut-flyway 5.4.1, postgresql 42.5.0</li> <li>testcontainers (jdbc, r2dbc, postgresql) 1.17.5</li> <li>io.micronaut.test-resources 3.6.2</li> </ul> <p><strong>Test Configuration (conf4k):</strong></p> <pre><code>datasources { default { dialect=POSTGRES options { currentSchema=default } } } r2dbc { datasources { default { dialect=POSTGRES options { currentSchema=default } } } } flyway { datasources { default { enabled=true locations=&quot;classpath:databasemigrations&quot; schemas=[&quot;default&quot;] create-schemas=true } } } test-resources { containers { postgres { image-name=&quot;postgres:12.12&quot; hostnames=[&quot;localhost&quot;] } } } </code></pre> <p><strong>Preconditions:</strong></p> <p>To make Flyway and micronaut data use the same database and testcontainer, the datasource of both needs to be named alike.</p> <p><strong>Problem:</strong></p> <p>Because of JDBC and R2DBC beeing used at the same time, synchronous and reactive TransactionManagers beans are created and I get the following error, when I use @Transactional:</p> <pre><code>Multiple possible bean candidates found: [io.micronaut.transaction.jdbc.DataSourceTransactionManager, io.micronaut.transaction.sync.SynchronousFromReactiveTransactionManager] </code></pre> <p><strong>Thoughts:</strong></p> <p>I thought, I could solve that with @TransactionalAdvice, but since both datasources need to have the same name, this is not possible. I tried to name the datasources differently, but does not work at all.</p>
[ { "answer_id": 74183190, "author": "Fatemeh Sangin", "author_id": 14271145, "author_profile": "https://Stackoverflow.com/users/14271145", "pm_score": 0, "selected": false, "text": "deepcopy" }, { "answer_id": 74183196, "author": "Samwise", "author_id": 3799759, "autho...
2022/10/24
[ "https://Stackoverflow.com/questions/74183112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5471967/" ]
74,183,131
<p>I have several identical divs and each of them contains a button that is hidden. I want to make button visible when you hover on the parent div. I wrote this code:</p> <pre><code> const cardElements = document.querySelectorAll('.middle_section__president_section'); const learnButtons = document.querySelectorAll('.president_section__button'); cardElements.forEach((cardElement) =&gt; { cardElement.addEventListener('mouseover', () =&gt; { learnButtons.forEach((learnButton) =&gt; { learnButton.style.height = &quot;50px&quot;; learnButton.style.opacity = &quot;1&quot;; learnButton.style.border = &quot;3px solid rgb(129, 129, 129)&quot;; }); }); cardElement.addEventListener('mouseout', () =&gt; { learnButtons.forEach((learnButton) =&gt; { learnButton.style.height = &quot;0px&quot;; learnButton.style.opacity = &quot;0&quot;; learnButton.style.border = &quot;0px solid rgb(129, 129, 129)&quot;; }); }); }) </code></pre> <p>carElements is parent, learnButtons - child.</p> <p>but with this code when i hover on one div buttons appears in every similiar div. How can i make button appear only on hovered div?</p>
[ { "answer_id": 74183206, "author": "ControlAltDel", "author_id": 1291492, "author_profile": "https://Stackoverflow.com/users/1291492", "pm_score": 2, "selected": false, "text": "cardElement.addEventListener('mouseover', () => {\n learnButtons.forEach((learnButton) => {\n" }, { ...
2022/10/24
[ "https://Stackoverflow.com/questions/74183131", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14095271/" ]
74,183,137
<p>I'm new to selenium webdriver and the programming world.</p> <p>I'm creating several tests in visual studio, and most of them will have a few steps that will be the same functions, for example Login function.</p> <p>I put this function in a public void according to the code below</p> <pre><code>public void Login() { IWebElement inputUsuario = driver.FindElement(By.XPath(&quot;//input[@id='username']&quot;)); inputUsuario.SendKeys(&quot;pablo@qms&quot;); IWebElement inputSenha = driver.FindElement(By.XPath(&quot;//input[@id='password']&quot;)); inputSenha.SendKeys(&quot;5550123!&quot;); IWebElement botaoEntrar = driver.FindElement(By.XPath(&quot;//div[@class='full-container']&quot;)); botaoEntrar.Click(); Thread.Sleep(2000); IWebElement agenda = driver.FindElement(By.XPath(&quot;//h3[normalize-space()='Agenda']&quot;)); agenda.Equals(&quot;Agenda&quot;); Assert.Contains(&quot;Agenda&quot;, driver.PageSource); } </code></pre> <p>Now I would like to call this function in another test in the same project, without having to rewrite all the code Can you help me to do this?</p>
[ { "answer_id": 74183206, "author": "ControlAltDel", "author_id": 1291492, "author_profile": "https://Stackoverflow.com/users/1291492", "pm_score": 2, "selected": false, "text": "cardElement.addEventListener('mouseover', () => {\n learnButtons.forEach((learnButton) => {\n" }, { ...
2022/10/24
[ "https://Stackoverflow.com/questions/74183137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20322735/" ]
74,183,138
<p>I need to overload a function overloadedFunc() which takes 3 arguments. For the 1st argument of the function set the default value [1, 2, 3], for the 2nd - the value 2, for the 3rd - the function that returns the product of the first two arguments, and the function can multiply both arrays and numbers. The overloadedFunc() function returns the result of the default function. I have a code but it throws an error. How can I solve this problem?</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 overloadedFunc(arg1 = [1, 2, 3], arg2 = 2, arg3 = multiply()) { const res = multiply(arg1, arg2); return res; } function multiply(arg1, arg2) { arg1.forEach((item) =&gt; { item * arg2; }); } console.log(overloadedFunc()); // [2, 4, 6] console.log(overloadedFunc([2, 4, 6], 3)); // [6, 12, 18] console.log(overloadedFunc(10)); // 20</code></pre> </div> </div> </p>
[ { "answer_id": 74183213, "author": "Mustafa Reda", "author_id": 13395150, "author_profile": "https://Stackoverflow.com/users/13395150", "pm_score": 0, "selected": false, "text": "multiply()" }, { "answer_id": 74183298, "author": "Mr. Polywhirl", "author_id": 1762224, ...
2022/10/24
[ "https://Stackoverflow.com/questions/74183138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20291334/" ]
74,183,157
<p>I am trying to write a regex that:</p> <ol> <li>Allows only numbers, lowercase letters and also &quot;-&quot; and &quot;_&quot;.</li> <li>String can only start with: letter number or &quot;uuid:&quot;</li> <li>String must have at least one letter in it.</li> <li>It must consist of at least 2 characters.</li> </ol> <p>I managed to create such a regex: <code>\A(?:uuid:|[a-z0-9])(?=(.*[a-z])){1,}(?:\w|-)+\z</code> I just don't understand why if the first character is a letter, it is not taken into account, so it doesn't pass for example: a1. And also why it allows uppercase letters AA.</p> <p>Tests: <a href="https://rubular.com/r/Q5gEP15iaYkHYQ" rel="nofollow noreferrer">https://rubular.com/r/Q5gEP15iaYkHYQ</a></p> <p>Thank you in advance for your help</p>
[ { "answer_id": 74183234, "author": "Wiktor Stribiżew", "author_id": 3832970, "author_profile": "https://Stackoverflow.com/users/3832970", "pm_score": 1, "selected": false, "text": "AA" }, { "answer_id": 74184539, "author": "The fourth bird", "author_id": 5424988, "aut...
2022/10/24
[ "https://Stackoverflow.com/questions/74183157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16329096/" ]
74,183,241
<p>Is it possible to use vue, vue-i18n only with javascript (as an object), not in the template?</p> <p>in the src/boot/i18n.js</p> <pre><code>import { boot } from 'quasar/wrappers' import { createI18n } from 'vue-i18n' import messages from 'src/i18n' export default boot(({ app }) =&gt; { const i18n = createI18n({ locale: 'es-CO', fallbackLocale: 'en-US', globalInjection: true, messages }) // Set i18n instance on app app.use(i18n) }) </code></pre> <p>but I create a src/support/errors, and utils, and more extended files were I need insert messages but can access i18n.</p> <p><a href="https://i.stack.imgur.com/hYDvb.png" rel="nofollow noreferrer">enter image description here</a></p> <p>I spanish native, and junior in quasar vue, so please help me</p> <p>Thanks.</p>
[ { "answer_id": 74186630, "author": "Ricardo Gonzalez", "author_id": 12127149, "author_profile": "https://Stackoverflow.com/users/12127149", "pm_score": 0, "selected": false, "text": "import { boot } from 'quasar/wrappers'\nimport { createI18n } from 'vue-i18n'\nimport messages from 'src/...
2022/10/24
[ "https://Stackoverflow.com/questions/74183241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12127149/" ]
74,183,262
<p>I have a select in my section using selectize js , now I want when input is focused to be able to edit the input after selection of any option.</p> <p>Live demo: <a href="https://jsfiddle.net/Mwanitete/3bjwpyae/1/" rel="nofollow noreferrer">live demo</a></p> <p>HTML</p> <pre><code> &lt;label&gt;Single selection &lt;select id=&quot;box&quot;&gt; &lt;/select&gt; &lt;/label&gt; </code></pre> <p>Here is my js</p> <pre><code>$(function() { $('#box').selectize({ plugins: [&quot;remove_button&quot;], valueField: 'title', labelField: 'title', searchField: 'title', options: [ {id: 1, title: 'DIY', url: 'https://diy.org'}, {id: 2, title: 'Google', url: 'http://google.com'}, {id: 3, title: 'Yahoo', url: 'http://yahoo.com'}, ], render: { option: function(data, escape) { return '&lt;div class=&quot;option&quot;&gt;' + '&lt;span class=&quot;title&quot;&gt;' + escape(data.title) + '&lt;/span&gt;' + '&lt;span class=&quot;url&quot;&gt;' + escape(data.url) + '&lt;/span&gt;' + '&lt;/div&gt;'; }, }, }); //edit input on focus $('#box-selectized'). focus(function(){ console.log('focused'); $('.select-input').removeClass('full has-items'); $('#box-selectized').css({'width': 'auto', 'opacity': 1}) $('#box-selectized').attr('placeholder', 'How are you?'); $('.selectize-input').addClass('not-full dropdown-active input-active'); $('.item').css({'visibility' : 'hidden'}) }) </code></pre> <p>});</p> <p>Problem:</p> <p><a href="https://i.stack.imgur.com/0J5um.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0J5um.png" alt="enter image description here" /></a></p> <p>When the input is focused I am not able to type anything in my input, what is wrong here?</p>
[ { "answer_id": 74186630, "author": "Ricardo Gonzalez", "author_id": 12127149, "author_profile": "https://Stackoverflow.com/users/12127149", "pm_score": 0, "selected": false, "text": "import { boot } from 'quasar/wrappers'\nimport { createI18n } from 'vue-i18n'\nimport messages from 'src/...
2022/10/24
[ "https://Stackoverflow.com/questions/74183262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9964622/" ]
74,183,274
<p><a href="https://i.stack.imgur.com/tfvOW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tfvOW.png" alt="enter image description here" /></a></p> <p>I am facing an issue with strapi upload provider. Can somebody help here? Where is this issue comming from ?</p>
[ { "answer_id": 74186630, "author": "Ricardo Gonzalez", "author_id": 12127149, "author_profile": "https://Stackoverflow.com/users/12127149", "pm_score": 0, "selected": false, "text": "import { boot } from 'quasar/wrappers'\nimport { createI18n } from 'vue-i18n'\nimport messages from 'src/...
2022/10/24
[ "https://Stackoverflow.com/questions/74183274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17448886/" ]
74,183,276
<p>I am fairly new to design patterns and I came across <a href="https://www.patterns.dev/posts/observer-pattern/" rel="nofollow noreferrer">this</a> website that explains observer pattern</p> <pre><code>import { ToastContainer, toast } from &quot;react-toastify&quot;; function logger(data) { console.log(`${Date.now()} ${data}`); } function toastify(data) { toast(data); } observable.subscribe(logger); observable.subscribe(toastify); export default function App() { function handleClick() { observable.notify(&quot;User clicked button!&quot;); } function handleToggle() { observable.notify(&quot;User toggled switch!&quot;); } return ( &lt;div className=&quot;App&quot;&gt; &lt;Button&gt;Click me!&lt;/Button&gt; &lt;FormControlLabel control={&lt;Switch /&gt;} /&gt; &lt;ToastContainer /&gt; &lt;/div&gt; ); } </code></pre> <p><strong>My Question:-</strong> I don't understand why do we need to write this extra line <code>observable.notify(&quot;User clicked button!&quot;);</code> inside the <code>handleClick</code> function and <code>observable.notify(&quot;User toggled switch!&quot;);</code> inside the <code>handleToggle</code> function.</p> <p><strong>My Naive Approach:-</strong> We could have simply invoked <code>logger</code> function from within the <code>handleClick</code> function something like</p> <pre><code>function handleClick(){ return logger('User clicked button') } </code></pre> <p>I know that <code>observable.subscribe(logger);</code> and <code>observable.subscribe(toastify);</code> have been used so we need to use the <code>notify()</code> method but can't all these be handled using simpple function invokations what's the whole point of using it like this ?</p> <p><a href="https://codesandbox.io/s/observer-pattern-1-md8k5?from-embed=&amp;file=/src/App.js" rel="nofollow noreferrer">Sanbox Link from the website</a></p> <p>Any example references would much be appreciated.</p>
[ { "answer_id": 74186630, "author": "Ricardo Gonzalez", "author_id": 12127149, "author_profile": "https://Stackoverflow.com/users/12127149", "pm_score": 0, "selected": false, "text": "import { boot } from 'quasar/wrappers'\nimport { createI18n } from 'vue-i18n'\nimport messages from 'src/...
2022/10/24
[ "https://Stackoverflow.com/questions/74183276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17393772/" ]
74,183,287
<p>I am new to C# and I am currently trying the CRUD operations in it. I have done the Create, Get all details, Update, and Delete. But I am unable to get only and all the details by ID.</p> <p>I have a database called 'fuel' and in there I have added shedId. For each shed there can be multiple fuels. Now I want to get the fuel details by each shedID.</p> <p>In here you can see I have 2 data for <code>shedID:1</code> <a href="https://i.stack.imgur.com/J9JHl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J9JHl.png" alt="Multiple fuel for shed ID 1" /></a></p> <p>But when I try to filter the db by shedID, I am getting a response like this. As I am new to C# I don't know how to get it. I searched in the google and couldn't find a solution. <a href="https://i.stack.imgur.com/91uVG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/91uVG.png" alt="Get by ID" /></a></p> <p>Please help me with this.</p> <p>This is the code I have tried</p> <pre><code> //Get Fuel by each shed id [HttpGet(&quot;shed/{id}&quot;)] public JsonResult Get(int id) { MongoClient dbClient = new MongoClient(_configuration.GetConnectionString(&quot;FuelQueueAppConnection&quot;)); var filter = Builders&lt;Fuel&gt;.Filter.Eq(&quot;shedId&quot;, id); var dbList = dbClient.GetDatabase(&quot;FuelQueue&quot;).GetCollection&lt;Fuel&gt;(&quot;Fuel&quot;).Find(filter); return new JsonResult(dbList); } </code></pre> <p>Summary - I have a DB called fuels. In there I have many fuels. Each fuel have a shedID and a shedID can have multiple fuels. Now I need to find the fuel list of each shedID. (Like ShedID:1 =&gt; 2 fuel details)</p>
[ { "answer_id": 74183707, "author": "Deepika", "author_id": 13942764, "author_profile": "https://Stackoverflow.com/users/13942764", "pm_score": 0, "selected": false, "text": " //Get Fuel by each shed id\n [HttpGet(\"shed/{id}\")]\n public JsonResult Get(int id)\n {\n Mo...
2022/10/24
[ "https://Stackoverflow.com/questions/74183287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13942764/" ]
74,183,315
<p>I have a BigQuery scheduled query that is failing with the following error:</p> <pre><code>Not found: Dataset bunny25256:dataset1 was not found in location US at [5:15]; JobID: 431285762868:scheduled_query_635d3a29-0000-22f2-888e-14223bc47b46 </code></pre> <p>I scheduled the query via the SQL Workspace. When I run the query in the workspace, it works fine. The dataset and everything else that I have created is in the same region: us-central1.</p> <p>Any ideas on what the problem could be, and how I could fix it or work around it?</p> <p>There's nothing special about the query, it computes some statistics on a table in <code>dataset1</code> and puts it in <code>dataset2</code>.</p>
[ { "answer_id": 74184388, "author": "Adi_007", "author_id": 20323062, "author_profile": "https://Stackoverflow.com/users/20323062", "pm_score": 0, "selected": false, "text": "project.dataset.table" }, { "answer_id": 74188617, "author": "Kolban", "author_id": 1738915, "...
2022/10/24
[ "https://Stackoverflow.com/questions/74183315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/344199/" ]
74,183,328
<p>I am designing a DVD rental database. There are two types of Users, Members and Staff, who all have a membership card. The <code>MEMBERSHIP_CARD</code> could be my supertype and <code>MEMBERS</code> and <code>STAFF</code> would be my subtypes.</p> <p>I am trying to implement a limit for renting DVD's. Staff can rent 5 DVD's at a time while Members can only rent 3.</p> <pre class="lang-none prettyprint-override"><code>MEMBERSHIP_CARD: Card_id (PK), Fname, Lname, Email, Status DVD: DVD_id (PK), Title, Duration, Publisher (FK) RENTALS: Rental_id (PK), Issue_date, Return_date, DVD_id (FK), Card_id (FK) </code></pre> <p>Which option should I use?</p> <ol> <li><p>Each <code>MEMBERSHIP_CARD</code> has a maximum loans attribute. But that is redundant--many people have the same value.</p> </li> <li><p>When a rental is created a trigger checks if it's for a member or staff and checks how many rentals a member already has. But then I am hard coding these values, which is not flexible.</p> </li> <li><p>We add a <code>MEMBERSHIP_TYPE</code> entity with a name and maximum rentals. But I don't know whether this is overkill if there are only 2 membership types.</p> <pre class="lang-none prettyprint-override"><code>MEMBERSHIP_TYPE: Membership_type_id (PK), Membership_name, Rental_max </code></pre> <p>Example row: <code>1, STAFF, 5</code>.</p> <p><code>MEMBERSHIP_CARD</code> adds column <code>Membership_type_id</code> (FK).</p> </li> </ol>
[ { "answer_id": 74183733, "author": "nbk", "author_id": 5193536, "author_profile": "https://Stackoverflow.com/users/5193536", "pm_score": 0, "selected": false, "text": "CREATE TABLE member ( id int, member_type int, loan int \n,\n CONSTRAINT check_loan\n CHECK ((member_type = 1 AND loan...
2022/10/24
[ "https://Stackoverflow.com/questions/74183328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17396224/" ]
74,183,352
<p>How can I add item at the end of this array? I didn't find examples. Did I miss something. How can I remove an element?</p> <pre><code>var rawData = []; for (var i = 0; i &lt; 2; i++) { rawData[i] = &quot;Item &quot; + i; } var model = qx.data.marshal.Json.createModel(rawData); var list = new qx.ui.list.List(model); //var list = new qx.ui.list.List(new qx.data.Array(&quot;item 0&quot;)); //list.add( new qx.ui.list.List(&quot;itme 2&quot;)) //list.createItem(&quot;item 2&quot;) //list.insertAt(0, &quot;item2&quot;) this.getRoot().add(list); </code></pre>
[ { "answer_id": 74183733, "author": "nbk", "author_id": 5193536, "author_profile": "https://Stackoverflow.com/users/5193536", "pm_score": 0, "selected": false, "text": "CREATE TABLE member ( id int, member_type int, loan int \n,\n CONSTRAINT check_loan\n CHECK ((member_type = 1 AND loan...
2022/10/24
[ "https://Stackoverflow.com/questions/74183352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15434658/" ]
74,183,357
<p>I'm trying to understand how the syntax in the following class is valid in TypeScript:</p> <pre><code>class Deferred&lt;T&gt; { promise: Promise&lt;T&gt;; resolve!: (value: T) =&gt; void; reject!: (reason?: any) =&gt; void; constructor() { this.promise = new Promise&lt;T&gt;((resolve, reject) =&gt; { this.resolve = resolve; this.reject = reject; }); } } </code></pre> <p>Specifically, how the <code>resolve</code> parameter is assignable to <code>this.resolve</code>.... Since the signature of the Promise constructor is:</p> <p><code>new &lt;T&gt;(executor: (resolve: (value: T | PromiseLike&lt;T&gt;) =&gt; void, reject: (reason?: any) =&gt; void) =&gt; void) =&gt; Promise&lt;T&gt;</code></p> <p>but the <code>resolve</code> field on the class is only <code>(value: T) =&gt; void</code>. Since the constructor defines that with a union type of also including <code>PromiseLike&lt;T&gt;</code> it would seem that this assignment shouldn't be allowed but it seems to compile + work fine. Any explanation for why this is?</p>
[ { "answer_id": 74183434, "author": "Mike Lischke", "author_id": 1137174, "author_profile": "https://Stackoverflow.com/users/1137174", "pm_score": 0, "selected": false, "text": "(value: T) => void" }, { "answer_id": 74183554, "author": "ij7", "author_id": 20275210, "au...
2022/10/24
[ "https://Stackoverflow.com/questions/74183357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/656677/" ]
74,183,408
<p>I have an issue and I can't understand how to do it.</p> <p>Basically I have a bot that send a message if he detect a word. Now I wanted to add the possibility to modify that message based on who add a reaction (the bot add 3 reactions at each message he send).</p> <p>So far, it's working, my bot respond and add the 3 reactions, but now I don't understant how to make my bot edit his message (I don't even manage to make the bot say who click on a reaction) and also remove the reaction.</p> <p>I've read the docs, read a lot of forum and I can't find a way to make it work... Please help =)</p> <pre><code>blue = '&lt;:blue:1033370324135333898&gt;' red = '&lt;:red:1033370379663704148&gt;' yellow = '&lt;:yellow:1033370423078952970&gt;' @client.event async def on_message(message): if 'ping' in message.content.lower(): if message.channel.id == 1032275628470308895: channel = client.get_channel(1032275628470308895) react = await channel.send('pong!') await react.add_reaction(blue) await react.add_reaction(red) await react.add_reaction(yellow) @client.event async def on_raw_reaction_add(payload): # and then I don't know what to do, everything I've tried doesn't work # I wanted to modify the message to (for example &quot;{user} said blue pong!&quot; and remove the reaction the user just use, and just keep the 3 from the bot) # And then if another user use the yellow reaction, the bot modify his message to for example &quot;{user] said yellow pong!&quot; # That could be great if the message was edited but keeping what was said before (in that case &quot;pong! \n{user} said blue pong! \n{user} said yellow pong!&quot;) # And last thing, if possible I want the bot to remove all reactions including his after 30mins </code></pre>
[ { "answer_id": 74183434, "author": "Mike Lischke", "author_id": 1137174, "author_profile": "https://Stackoverflow.com/users/1137174", "pm_score": 0, "selected": false, "text": "(value: T) => void" }, { "answer_id": 74183554, "author": "ij7", "author_id": 20275210, "au...
2022/10/24
[ "https://Stackoverflow.com/questions/74183408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20322870/" ]
74,183,412
<p>As in the image below, how would I remove each of the 'year olds' from the second column?</p> <p><a href="https://i.stack.imgur.com/1gdRk.png" rel="nofollow noreferrer">Image of Dataset</a></p>
[ { "answer_id": 74183433, "author": "Jilber Urbina", "author_id": 1315767, "author_profile": "https://Stackoverflow.com/users/1315767", "pm_score": 2, "selected": true, "text": "df$age5txt <- gsub(\" year olds\", \"\", df$age5txt)\n" }, { "answer_id": 74183456, "author": "akru...
2022/10/24
[ "https://Stackoverflow.com/questions/74183412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9914419/" ]
74,183,415
<p>People arrive and depart a room at various times. Given their entry and exit times and their heights, what's an efficient way (in Python / Pandas) to find the maximum height of people in the room at all times?</p> <p>Input:</p> <pre><code>people = pd.DataFrame({ &quot;height&quot;: [175, 180, 160], &quot;arrive&quot;: pd.to_datetime([&quot;2017-04-05 14:20&quot;, &quot;2017-04-05 13:10&quot;, &quot;2017-04-05 10:30&quot;]), &quot;depart&quot;: pd.to_datetime([&quot;2017-04-05 17:54&quot;, &quot;2017-04-06 07:56&quot;, &quot;2017-04-05 11:04&quot;]) }) </code></pre> <p>Output:</p> <pre><code>[[&quot;2017-04-05 10:30&quot;, 160], [&quot;2017-04-05 11:04&quot;, None], ...] </code></pre> <p>Explanation: The first person arrives at 2017-04-05 10:30 and his height was 160, so max height in the room was 160 since that time. This person left the room at 11:04 so max height was None since that time.</p> <p>This problem is similar to <a href="https://stackoverflow.com/q/47054341">stackoverflow.com/q/47054341</a> but the solutions are not satisfactory because we should not round off timestamps to the nearest hour.</p>
[ { "answer_id": 74183982, "author": "Naveed", "author_id": 3494754, "author_profile": "https://Stackoverflow.com/users/3494754", "pm_score": 0, "selected": false, "text": "# melt to move columns as rows\ndf2=df.melt(id_vars='height', var_name='status', value_name='date')\n\n# set height a...
2022/10/24
[ "https://Stackoverflow.com/questions/74183415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9867326/" ]
74,183,421
<p>I have a Data Frame with 4 columns. I want to calculate the log form of three columns values and then make a new Data Frame. my problem is that after getting the log form of values, their type become as series. My question is that how I can create a new dataframe with these new series.</p> <p>Here is my dataset:</p> <pre><code> year gnp labor capital 0 1955 114043 8310 182113 1 1956 120410 8529 193745 2 1957 129187 8738 205192 3 1958 134705 8952 215130 </code></pre> <p>I got log forms of columns by this code:</p> <pre><code>ln_gnp = np.log(df.gnp) ln_labor = np.log(df.labor) ln_capital = np.log(df.capital) </code></pre> <p>Now, I want to create a new DataFrame with columns 'year', 'ln_gnp', 'ln_labor', and 'ln_capital'.</p> <p>I have tried <code>pd.DataFrame('year', 'ln_gnp', ' ln_labor', 'ln_capital')</code> but it didn't work. I think there is another way to make a new dataframe.</p>
[ { "answer_id": 74183527, "author": "learner", "author_id": 17658327, "author_profile": "https://Stackoverflow.com/users/17658327", "pm_score": 1, "selected": false, "text": "df = pd.DataFrame({'year':[1,2,3,4,5], \n 'gnp':[100, 200, 300, 400, 500], \n 'l...
2022/10/24
[ "https://Stackoverflow.com/questions/74183421", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15638149/" ]
74,183,443
<p>I have a header element that I want to be sticky and appear in front of my article. I have tried changing the z-index but I cannot seem to get it to work.</p> <p>Does z-index not work at all when I have certain elements floating? Or is there a way to make it work? Any help would be appreciated. Thanks</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>h1, h2, h3, h4 { margin: inherit; } .top { position: sticky; background-color: grey; margin: 0em; z-index: 1000; float: none; } .header { top: 0em; } .navigation { top: 2em; } .aside { width: 25%; height: 100%; float: right; background-color: darkgrey; clear: right; } .section { width: 75%; height: 100%; float: left; /*background-color: lightgrey;*/ } .hidden_link { color: inherit; text-decoration: none; } * { z-index: -1; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body&gt; &lt;main&gt; &lt;header class="header top"&gt; &lt;h1&gt; Toyota JZ Engine &lt;/h1&gt; &lt;/header&gt; &lt;nav class="navigation top"&gt; &lt;a&gt;link&lt;/a&gt; &lt;/nav&gt; &lt;article&gt; &lt;aside class="aside"&gt; &lt;p&gt;&lt;a class="hidden_link" title="Multi-valve" href="https://en.wikipedia.org/wiki/Multi-valve"&gt;24 Valves&lt;/a&gt; means that there are 4 valves per cylinder&lt;/p&gt; &lt;p&gt;&lt;a class="hidden_link" title="DOHC" href="https://en.wikipedia.org/wiki/Overhead_camshaft_engine#Double_overhead_camshaft_(DOHC)"&gt;DOHC&lt;/a&gt; means that there are 2 Camshafts per bank of the sylinder head, 1 for intake and 1 for exhaust&lt;/p&gt; &lt;p&gt;Rear Wheel Drive (RWD) is a type of drivetrain in which the gearbox sends all power to the rear wheels&lt;/p&gt; &lt;/aside&gt; &lt;section class="section"&gt; &lt;h2&gt;Introduction&lt;/h2&gt; &lt;hr&gt; &lt;p&gt;The Toyota JZ engine family is a series of inline-6 automobile engines, which are designed as a replacement for the M-series inline-6 engines. The family features 2.5- and 3.0-litre versions; all are 24-valve DOHC engines.&lt;/p&gt; &lt;/section&gt; &lt;section class="section"&gt; &lt;h3&gt;1JZ&lt;/h3&gt; &lt;hr&gt; &lt;p&gt;The 1JZ engine was produced from 1990-2007. It is 2,492 cc.&lt;/p&gt; &lt;h4&gt;1JZ-GE&lt;/h4&gt; &lt;p&gt;This is another common engine version which has a 10:1 compression ratio. The early 1JZ-GE, like all JZ engines, is desigined for longitudnal mounting and RWD. All such models offered only a 4-speed automatic transmission.&lt;/p&gt; &lt;h4&gt;1JZ-GTE&lt;/h4&gt; &lt;p&gt;The 1JZ also features a twin-turbocharged version, known as the 1JZ-GTE. It was produced from 1990-2007 as well and uses two CT12A turbochargers which sit parrallel and blow through a side or front mount intercooler. It has an 8:5:1 static compression ratio. Early generation 1JZ-GTEs combined the inherent smoothness of an inline 6 with the revving capacity of its short stroke and early power delivery of its turbochargers.&lt;/p&gt; &lt;figure&gt; &lt;img src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/de/1JZ-GTE_in_a_1991_Toyota_Mark_II_2.5GT_Twin_Turbo.jpg/250px-1JZ-GTE_in_a_1991_Toyota_Mark_II_2.5GT_Twin_Turbo.jpg" title="1JZ-GTE"&gt; &lt;figcaption&gt;1JZ-GTE in a 1991 Toyota Mark II 2.5GT Twin Turbo&lt;/figcaption&gt; &lt;/figure&gt; &lt;figure&gt; &lt;img src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/74/1JZ-GTE_VVT-i_engine_in_1989_Toyota_Cressida.jpg/250px-1JZ-GTE_VVT-i_engine_in_1989_Toyota_Cressida.jpg" title="1JZ-GTE"&gt; &lt;figcaption&gt;Third Generation 1JZ-GTE VVT-i transplanted into a 1989 MX83 Toyota Cressida&lt;/figcaption&gt; &lt;/figure&gt; &lt;h4&gt;1JZ-FSE&lt;/h4&gt; &lt;p&gt;1JZ-FSE is likely the least known engine of the JZ family. Their goal is to acheive minimal emissions and fuel consumption with no performance loss. It employs the same block as the conventional 1JZ-GE but the cylinder head has a relatively narrow angle with swirl conrol valves. Fuel consumpton is reduced by about 20%.&lt;/p&gt; &lt;h3&gt;2JZ&lt;/h3&gt; &lt;hr&gt; &lt;p&gt;The 2JZ engine was produced from 1991-2007. It is 2,997 cc. It is not merely a stroked version of the 1JZ, but it has longer connectiong rods and a taller block deck.&lt;/p&gt; &lt;h4&gt;2JZ-GE&lt;/h4&gt; &lt;p&gt;The 2JZ-GE is a common version with Sequential Electronic Fuel Injection, an auminium head, and 4 valves per cylinder, in addition to a cast-iron cylinder block.&lt;/p&gt; &lt;h4&gt;2JZ-GTE&lt;/h4&gt; &lt;/section&gt; &lt;/article&gt; &lt;footer&gt; &lt;/footer&gt; &lt;/main&gt; &lt;/body&gt;</code></pre> </div> </div> </p>
[ { "answer_id": 74183737, "author": "Mathias Aivasovsky", "author_id": 17289256, "author_profile": "https://Stackoverflow.com/users/17289256", "pm_score": 0, "selected": false, "text": " <body>\n <main>\n <!-- Included the header and navigation in one div -->\n <div class=...
2022/10/24
[ "https://Stackoverflow.com/questions/74183443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17362477/" ]
74,183,458
<p>So i am coding on a bot that kicks people out of the voice channel after a specific time but I am getting this error:<strong>'list' object has no attribute 'move_to'</strong></p> <pre class="lang-py prettyprint-override"><code>@client.command(pass_context = True) async def outro(ctx,): #Loads opus #if not discord.opus.is_loaded(): # discord.opus.load_opus('libopus.so') if (ctx.author.voice): channel = ctx.message.author.voice.channel voice = await channel.connect() #playing song source = FFmpegPCMAudio(source_song) player = voice.play(source) channel_voice = client.get_channel(1014932059279605770) #gets the channel you want to get the list from members = channel_voice.members #finds members connected to the channel memids = [] #(list) for member in members: memids.append(member.id) print(memids) await asyncio.sleep(58) await memids.move_to(None) </code></pre> <p>I hope anyone can help me out here</p>
[ { "answer_id": 74183737, "author": "Mathias Aivasovsky", "author_id": 17289256, "author_profile": "https://Stackoverflow.com/users/17289256", "pm_score": 0, "selected": false, "text": " <body>\n <main>\n <!-- Included the header and navigation in one div -->\n <div class=...
2022/10/24
[ "https://Stackoverflow.com/questions/74183458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19429944/" ]
74,183,464
<p>I have a iframe <code>&lt;div class=&quot;quiz-container&quot; style=&quot;text-align: center;&quot; data-quiz=&quot;#######&quot; data-preview=&quot;true&quot; data-offset=&quot;0&quot; data-autoscroll=&quot;yes&quot;&gt;&lt;/div&gt;</code></p> <p><code>&lt;script src=&quot;https://marketingfx.leadshook.io/s/js_embed&quot;&gt;&lt;/script&gt;</code></p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="quiz-container" style="text-align: center;" data-quiz="#######" data-preview="true" data-offset="0" data-autoscroll="yes"&gt;&lt;/div&gt; &lt;script src="https://marketingfx.leadshook.io/s/js_embed"&gt;&lt;/script&gt;</code></pre> </div> </div> </p> <p>and the output is a form i want to edit the form css. How can i edit the css?</p>
[ { "answer_id": 74183607, "author": "Quentin", "author_id": 19068, "author_profile": "https://Stackoverflow.com/users/19068", "pm_score": 1, "selected": false, "text": "https://marketingfx.leadshook.io" } ]
2022/10/24
[ "https://Stackoverflow.com/questions/74183464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15757714/" ]
74,183,478
<p>I have a state which initially is <code>undefined</code>. After certain actions have been done, I am updating that state and I need to run something as soon as that state is updated. But, since, that state changes quite often, I don't want to use <code>useEffect</code> cuz, I don't want the code to be executed everytime state changes. Just for the first update. How can I achieve that? Here is the code demonstartion</p> <pre><code>const [annotations,setAnnotations] =useState() // A bunch of changes and after some time, called setAnnotations(value) useEffect(()=&gt; { // here I need to do something. But, don't have the latest annotations. // I only need to do // something only for the first time },[]) </code></pre>
[ { "answer_id": 74183607, "author": "Quentin", "author_id": 19068, "author_profile": "https://Stackoverflow.com/users/19068", "pm_score": 1, "selected": false, "text": "https://marketingfx.leadshook.io" } ]
2022/10/24
[ "https://Stackoverflow.com/questions/74183478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15247669/" ]
74,183,488
<p>I see this warning in console. But where is my mistake? I have Warning: Each child in a list should have a unique &quot;key&quot; prop. but I put the KEY PROP in all components what I render with map function.</p> <p>One warning in this map function:</p> <pre><code>{data &amp;&amp; data.map(item =&gt; ( &lt;Card key={item.id}&gt; &lt;CardTitle&gt;{item.title}&lt;/CardTitle&gt; &lt;CardPrice&gt;{item.price}&lt;/CardPrice&gt; &lt;CardDescription&gt;{item.description}&lt;/CardDescription&gt; &lt;CardItems&gt; {item.benefits.map(benefitsItem =&gt; ( &lt;CardItem&gt; &lt;CheckCircleIcon /&gt; &lt;CardItemText&gt;{benefitsItem}&lt;/CardItemText&gt; &lt;/CardItem&gt; ))} &lt;/CardItems&gt; &lt;StyledPopup trigger={&lt;CardButton className=&quot;BlackButton&quot;&gt;Замовити сайт&lt;/CardButton&gt;} modal nested lockScroll &gt; {close =&gt; ( &lt;div className='modal'&gt; &lt;button className=&quot;closeModal&quot; onClick={close}&gt;&amp;times;&lt;/button&gt; &lt;Feedback isPlan={{ name: item.title, description: item.description, price: item.price }} /&gt; &lt;/div&gt; )} &lt;/StyledPopup&gt; &lt;/Card&gt; ))} </code></pre> <p><strong>And Other warning in this component:</strong></p> <pre><code>&lt;Navigation&gt; {cards &amp;&amp; cards.map(item =&gt; renderLinks(item))} &lt;/Navigation&gt; &lt;CardsWrapper&gt; {cards &amp;&amp; cards.map(item =&gt; renderCard(item))} &lt;/CardsWrapper&gt; </code></pre> <blockquote> <p>There is the render functions.</p> </blockquote> <pre><code>const renderCard = (cardData) =&gt; { if(cardData.cardId === activeCard){ return( &lt;Card key={cardData.cardId}&gt; &lt;ImageWrapper&gt; &lt;Image src={cardData.cardImage} /&gt; &lt;/ImageWrapper&gt; &lt;CardInfoWrapper&gt; &lt;CardTitle&gt;{cardData.cardTitle}&lt;/CardTitle&gt; &lt;CardDescription&gt; {cardData.cardDescription} &lt;/CardDescription&gt; &lt;Pluses&gt; {cardData.cardOpportunities &amp;&amp; cardData.cardOpportunities.map(opportunity =&gt; ( &lt;Plus&gt; &lt;Ok&gt;&lt;CheckCircleIcon /&gt;&lt;/Ok&gt; {opportunity} &lt;/Plus&gt; ))} &lt;/Pluses&gt; &lt;/CardInfoWrapper&gt; &lt;/Card&gt; ) } } </code></pre> <p><strong>And finnely</strong></p> <pre><code>const renderLinks = (cardData) =&gt; { if(cardData.cardId === activeCard) { return( &lt;div key={cardData.cardId}&gt; &lt;NavigationItem className=&quot;navigationLink&quot; width={cardData.cardLinkWidth} active &gt; {cardData.cardLink} &lt;/NavigationItem&gt; &lt;/div&gt; ) } else { return( &lt;div key={cardData.cardId}&gt; &lt;NavigationItem className=&quot;navigationLink&quot; width={cardData.cardLinkWidth} onClick={() =&gt; linkClickHandler(cardData.cardId)} &gt;{cardData.cardLink}&lt;/NavigationItem&gt; &lt;/div&gt; ) } } </code></pre>
[ { "answer_id": 74183607, "author": "Quentin", "author_id": 19068, "author_profile": "https://Stackoverflow.com/users/19068", "pm_score": 1, "selected": false, "text": "https://marketingfx.leadshook.io" } ]
2022/10/24
[ "https://Stackoverflow.com/questions/74183488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19753285/" ]
74,183,574
<p>I have a class which contains an integer among some other things:</p> <pre><code>class Foo { public: Foo() = default; Foo(int x) : x(x) {} int operator+(const Foo&amp; rhs) { return x + rhs.x; } private: int x; float whatever = 0.0f; }; </code></pre> <p>I also have a vector of these objects:</p> <pre><code>std::vector&lt;Foo&gt; foos{1, 2, 3, 4}; </code></pre> <p>now, what I wanted to do was to use <strong>std::accumulate</strong> with the <strong>std::plus</strong> functor (or maybe some other STL function) to sum the X values of all elements in the vector, here's what I tried:</p> <pre><code>int sum = std::accumulate(foos.begin(), foos.end(), 0, std::plus&lt;int&gt;{}); </code></pre> <p>But i'm getting a compiler error</p> <p><strong>Error C2440: &quot;'initializing' : cannot convert from 'type1' to 'type2' 'conversion' : cannot convert from 'type1' to 'type2'&quot;</strong></p> <p>what am i doing wrong, how do I go about fixing this?</p>
[ { "answer_id": 74183679, "author": "Caleth", "author_id": 2610810, "author_profile": "https://Stackoverflow.com/users/2610810", "pm_score": 3, "selected": true, "text": "int" }, { "answer_id": 74183762, "author": "apple apple", "author_id": 5980430, "author_profile": ...
2022/10/24
[ "https://Stackoverflow.com/questions/74183574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20276285/" ]
74,183,619
<p>Can someone give me a tip on how to fix a forward historian agent that is going to a <code>BAD</code> state installed on an edge device with an attempt to forward data to a Central instance?</p> <p>This is my forward agent config on the edge device where the destination server key I got from the Central instance:</p> <pre><code>{ &quot;destination-vip&quot;: &quot;tcp://192.168.0.168:22916&quot;, &quot;destination-serverkey&quot;: &quot;asdfasdfasdfasdfasdf&quot; } </code></pre> <p>On the edge device I did a <code>vctl auth serverkey</code> to get the edge device key and on the VOLTTRON central I did a <code>vctl auth add</code> to add this key of this edge device to the server.</p> <p>Full traceback in the log file. When I start the agent is goes <code>BAD</code> in about 30 seconds, and I think the error is coming from the edge to server authentication? AND not some internal edge device agent authentication....but not sure.</p> <pre><code>2022-10-24 15:23:20,622 (forwarderagent-5.1 2914) volttron.platform.vip.agent.core INFO: Destination serverkey not found in known hosts file, using config 2022-10-24 15:23:20,630 (forwarderagent-5.1 2914) volttron.platform.vip.agent.core INFO: CORE address:tcp://10.200.200.168:22916?publickey=WMdhM3co5g2keLwh5yMdFBgoxaq9g9RRFz__K6KctkI&amp;secretkey=U6UZ9bLnbvvcDm6V5uByBbc-1tA1bUd1ZYubWgKjdG4&amp;serverkey=GgJApMOBM8bg7HiKECP6KOwk_O8f_HslrbqPygDcoCY 2022-10-24 15:23:20,630 (forwarderagent-5.1 2914) volttron.platform.vip.agent.core ERROR: No response to hello message after 10 seconds. 2022-10-24 15:23:20,630 (forwarderagent-5.1 2914) volttron.platform.vip.agent.core ERROR: Type of message bus used zmq 2022-10-24 15:23:20,630 (forwarderagent-5.1 2914) volttron.platform.vip.agent.core ERROR: A common reason for this is a conflicting VIP IDENTITY. 2022-10-24 15:23:20,630 (forwarderagent-5.1 2914) volttron.platform.vip.agent.core ERROR: Another common reason is not having an auth entry onthe target instance. 2022-10-24 15:23:20,630 (forwarderagent-5.1 2914) volttron.platform.vip.agent.core ERROR: Shutting down agent. 2022-10-24 15:23:20,630 (forwarderagent-5.1 2914) volttron.platform.vip.agent.core ERROR: Possible conflicting identity is: volttron1.forwarderagent-5.1_1 2022-10-24 15:23:20,829 (listeneragent-3.3 1608) __main__ INFO: Peer: pubsub, Sender: listeneragent-3.3_1:, Bus: , Topic: heartbeat/listeneragent-3.3_1, Headers: {'TimeStamp': '2022-10-24T15:23:20.826211+00:00', 'min_compatible_version': '3.0', 'max_compatible_version': ''}, Message: 'GOOD' 2022-10-24 15:23:21,219 (listeneragent-3.3 1608) __main__ INFO: Peer: pubsub, Sender: forwarderagent-5.1_1:, Bus: , Topic: heartbeat/forwarderagent-5.1_1, Headers: {'TimeStamp': '2022-10-24T15:23:21.216704+00:00', 'min_compatible_version': '3.0', 'max_compatible_version': ''}, Message: 'BAD' 2022-10-24 15:23:21,613 () volttron.platform.auth.auth_protocols.auth_zmq INFO: AUTH: After authenticate user id: 'control.connection', b'4552b404-0290-41d5-b7a8-ba4653e98e3c' 2022-10-24 15:23:21,613 () volttron.platform.auth.auth_protocols.auth_zmq INFO: authentication success: userid=b'4552b404-0290-41d5-b7a8-ba4653e98e3c' domain='vip', address='localhost:1000:1000:2943', mechanism='CURVE', credentials=['sRZnNl3PPt-_NBiyXcCtqbwG7_5dYAALmDQzXtBEFFU'], user='control.connection' 2022-10-24 15:23:21,624 (listeneragent-3.3 1608) __main__ INFO: Peer: pubsub, Sender: control.connection:, Bus: , Topic: heartbeat/control.connection, Headers: {'TimeStamp': '2022-10-24T15:23:21.623967+00:00', 'min_compatible_version': '3.0', 'max_compatible_version': ''}, Message: 'GOOD' 2022-10-24 15:23:21,631 (forwarderagent-5.1 2914) volttron.platform.vip.agent.subsystems.auth INFO: Skipping updating rpc auth capabilities for agent volttron1.forwarderagent-5.1_1 connecting to remote address: tcp://10.200.200.168:22916?publickey=WMdhM3co5g2keLwh5yMdFBgoxaq9g9RRFz__K6KctkI&amp;secretkey=U6UZ9bLnbvvcDm6V5uByBbc-1tA1bUd1ZYubWgKjdG4&amp;serverkey=GgJApMOBM8bg7HiKECP6KOwk_O8f_HslrbqPygDcoCY 2022-10-24 15:23:21,631 (forwarderagent-5.1 2914) volttron.platform.vip.agent.subsystems.auth WARNING: Auth entry not found for volttron1.forwarderagent-5.1_1: rpc_method_authorizations not updated. If this agent does have an auth entry, verify that the 'identity' field has been included in the auth entry. This should be set to the identity of the agent 2022-10-24 15:23:30,627 (forwarderagent-5.1 2914) __main__ ERROR: Couldn't connect to address. gevent timeout: (tcp://10.200.200.168:22916) 2022-10-24 15:23:30,628 (forwarderagent-5.1 2914) __main__ ERROR: Could not connect to targeted historian dest_vip tcp://10.200.200.168:22916 dest_address None 2022-10-24 15:23:30,755 () volttron.platform.vip.agent.core INFO: CORE address:inproc://vip 2022-10-24 15:23:30,786 () volttron.platform.vip.agent.core INFO: Connected to platform: router: 4552b404-0290-41d5-b7a8-ba4653e98e3c version: 1.0 identity </code></pre> <ul> <li>One thing to note is I am trying to rectify a botched update from 8.0 to 8.2 on the edge device I ended up just recloning the repo and bootstrapping 8.2, so now I have this <code>volttron1</code> config someone.</li> </ul>
[ { "answer_id": 74183679, "author": "Caleth", "author_id": 2610810, "author_profile": "https://Stackoverflow.com/users/2610810", "pm_score": 3, "selected": true, "text": "int" }, { "answer_id": 74183762, "author": "apple apple", "author_id": 5980430, "author_profile": ...
2022/10/24
[ "https://Stackoverflow.com/questions/74183619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8372455/" ]
74,183,632
<p>I have two buttons. I can change its color by clicking on one button. And when you click on another button, change its color as well, and return the old color to the first button. Something like toggle. How can I implement such functionality in a react applicatio.</p> <pre><code>const [toggle, setToggle] = useState(false); const toggleIt = () =&gt; { setToggle(!toggle); }; return ( &lt;div&gt; &lt;button onClick={toggleIt}&gt;Button1&lt;/button&gt; &lt;button onClick={toggleIt}&gt;Button2&lt;/button&gt; ) </code></pre>
[ { "answer_id": 74183679, "author": "Caleth", "author_id": 2610810, "author_profile": "https://Stackoverflow.com/users/2610810", "pm_score": 3, "selected": true, "text": "int" }, { "answer_id": 74183762, "author": "apple apple", "author_id": 5980430, "author_profile": ...
2022/10/24
[ "https://Stackoverflow.com/questions/74183632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19584927/" ]
74,183,669
<p>I'm trying to get rid of a faint divider between the native navigation buttons on the bottom of the screen and the content of my app.</p> <p>This is what I have - you can see a very faint divider between the navigation buttons and the bottom navigation bar of my app. Is it elevation? Shadow?</p> <p><a href="https://i.stack.imgur.com/9IOLP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9IOLP.png" alt="enter image description here" /></a></p> <p>But this is what I want (this is the Android Slack app) - all same colour. <a href="https://i.stack.imgur.com/TzlCS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TzlCS.png" alt="enter image description here" /></a></p> <p>In my app, I'm explicitly setting the bottom navigation bar to white, as well as use the <code>accompanist</code> library to set the navigation bar to white, like so:</p> <pre class="lang-kotlin prettyprint-override"><code>BottomNavigation( modifier = Modifier .background(Color.White), backgroundColor = Color.White, elevation = 0.dp, ) ... val systemUiController = rememberSystemUiController() SideEffect { systemUiController.setSystemBarsColor( color = Color.White, ) } </code></pre> <p>What else can I do?</p>
[ { "answer_id": 74183679, "author": "Caleth", "author_id": 2610810, "author_profile": "https://Stackoverflow.com/users/2610810", "pm_score": 3, "selected": true, "text": "int" }, { "answer_id": 74183762, "author": "apple apple", "author_id": 5980430, "author_profile": ...
2022/10/24
[ "https://Stackoverflow.com/questions/74183669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7707818/" ]
74,183,690
<p>I'm making plus and minus changing in javascript The problem is the plus function just ran once but minus function is fine.</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-html lang-html prettyprint-override"><code>&lt;html lang="en"&gt; &lt;head&gt; &lt;link rel="stylesheet" href="https://athena3140.ml/style.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container" class="container"&gt; &lt;!--first--&gt; &lt;div class="inner" onclick="leftm()"&gt; &lt;div class="minus"&gt; &lt;div&gt;&amp;#8722;&lt;/div&gt; &lt;/div&gt; &lt;div onclick="left()"&gt; &lt;div class="mf" id="left"&gt;0&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;script&gt; let x = document.getElementById("left").innerHTML; function left() { document.getElementById("left").innerHTML = x++; } function leftm() { document.getElementById("left").innerHTML = x--; } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p>
[ { "answer_id": 74183679, "author": "Caleth", "author_id": 2610810, "author_profile": "https://Stackoverflow.com/users/2610810", "pm_score": 3, "selected": true, "text": "int" }, { "answer_id": 74183762, "author": "apple apple", "author_id": 5980430, "author_profile": ...
2022/10/24
[ "https://Stackoverflow.com/questions/74183690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19834046/" ]
74,183,691
<p>I have some production code that had to be rolled back, because testing that I was told was completed successfully was not done. It was put into production, committed to the master branch, and then was &quot;rolled back&quot; when users discovered the untested bugs.</p> <p>Note that I normally am the only one writing to this repo, but some changes were done to it while I was on vacation, and I'll admit I've gotten somewhat confused.</p> <p>In any case, I'm pretty sure I want to rebase my new code against the older, pre-bug, &quot;rolled-back&quot; version of the code, which I believe should be done using <code>git rebase --onto</code></p> <p>Several articles have helped me to learn at least something about this (clearly I still have much to learn). The diagramming format you see here is inspired by the more helpful articles I've read.</p> <p>So, I have the following commits:</p> <pre><code> A---B---C---D---E---F---G---H---I </code></pre> <p>The errors were introduced in the production code from B to E, and I wrote F through I based on this code. So:</p> <pre><code> Known good | Buggy and to discard | | Good and needs to be replayed onto A | | | &gt; -&gt; -&gt; A---B---C---D---E---F---G---H---I </code></pre> <p>So that I end up with:</p> <pre><code> A---F---G---H---I </code></pre> <p>Now from all the reading I've done, what I think I'm supposed to run is: <code>git rebase --onto A F I</code></p> <p>But when I do that the code I end up with still has all the bad code in it.</p> <p>So, I'm doing something wrong, but I cannot see what it is.</p> <p>I have read the following already (which were helpful, but didn't seem to describe my situation precisely) <a href="https://medium.com/@gabriellamedas/git-rebase-and-git-rebase-onto-a6a3f83f9cce" rel="nofollow noreferrer">https://medium.com/@gabriellamedas/git-rebase-and-git-rebase-onto-a6a3f83f9cce</a> <a href="https://stackoverflow.com/questions/12469855/git-rebasing-to-a-particular-tag">Git - rebasing to a particular tag</a> <a href="https://git-scm.com/book/en/v2/Git-Branching-Rebasing" rel="nofollow noreferrer">https://git-scm.com/book/en/v2/Git-Branching-Rebasing</a></p> <p>Maybe I'm doing this all wrong. I want to rewind to the state that production is currently in (the &quot;rolled back&quot; state), and then replay the development I've done onto that. Perhaps there's a better way.</p> <p>Any and all help, advice, tips, criticisms, places to read more about this, etc., would be very gratefully accepted.</p>
[ { "answer_id": 74190295, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 0, "selected": false, "text": "git rebase --onto A F~ I\n" }, { "answer_id": 74200145, "author": "JimVanM", "author_id": 5298659, "autho...
2022/10/24
[ "https://Stackoverflow.com/questions/74183691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5298659/" ]
74,183,695
<p>I am getting messages from Salesforce and the message payload has a property called Id, however CosmoDB is failed with the message &quot;required properties - 'id' is missing&quot;. Looks like it wants the property to be in lowercase.</p> <p>I believe in code I would use something like below. However in the logic app I do not know what the equivalent would be.</p> <p>[JsonProperty(&quot;id&quot;)] public string Id { get; init; }</p> <p><a href="https://i.stack.imgur.com/8Zyls.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8Zyls.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74190295, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 0, "selected": false, "text": "git rebase --onto A F~ I\n" }, { "answer_id": 74200145, "author": "JimVanM", "author_id": 5298659, "autho...
2022/10/24
[ "https://Stackoverflow.com/questions/74183695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7581658/" ]
74,183,743
<p>I have updated location services libraries in my App to the latest 21 version:<br /> <code>com.google.android.gms:play-services-location:21.0.0</code> <br /> and it breaks the logic for enabling location settings on the users phones.</p> <p>I found updated page with documentation about this process: <a href="https://developers.google.com/android/reference/com/google/android/gms/location/SettingsClient" rel="nofollow noreferrer">https://developers.google.com/android/reference/com/google/android/gms/location/SettingsClient</a>, <br /> and using code below for triggering popup which should ask user to allow enabling location access on the phone:</p> <pre><code>val locationRequest = LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 10000) .setMinUpdateIntervalMillis(5000).build() val builder = LocationSettingsRequest.Builder().addLocationRequest(locationRequest) val client: SettingsClient = LocationServices.getSettingsClient(activity) val task: Task&lt;LocationSettingsResponse&gt; = client.checkLocationSettings(builder.build()) task.addOnCompleteListener { try { task.getResult(ApiException::class.java) } catch (exception: ApiException) { when (exception.statusCode) { LocationSettingsStatusCodes.RESOLUTION_REQUIRED -&gt; { try { val resolvable = exception as ResolvableApiException resolvable.startResolutionForResult( activity, 1 ) } catch (e: Exception) { e.printStackTrace() } } LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE -&gt; { } } } } </code></pre> <p>but that code from documentation throw a ClassCastException on this line: <br /> <code>val resolvable = exception as ResolvableApiException</code>, <br /> can't figure out how to deal with a latest location updates, thanks in advance for any help.</p>
[ { "answer_id": 74226600, "author": "Gui_user", "author_id": 15536277, "author_profile": "https://Stackoverflow.com/users/15536277", "pm_score": 3, "selected": true, "text": "e.getClass();//returnsString ApiException instead of ResolveApiException\n" }, { "answer_id": 74301033, ...
2022/10/24
[ "https://Stackoverflow.com/questions/74183743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12518197/" ]
74,183,769
<p>I have the following table with dynamically generated rows of input boxes which may contain default value. When no default is available from the database an empty string is returned <code>''</code>. The problem is this causes the table to be collapsed on those inputs.</p> <pre><code> &lt;tr *ngFor=&quot;let d of displayData&quot;&gt; &lt;td class=&quot;.mytable&quot;&gt; {{d.specRow}} &lt;/td&gt; &lt;td *ngFor=&quot;let l of d.limitModel &quot;&gt; &lt;input type=&quot;text&quot; [ngModel]=&quot;l?.target&quot; (ngModelChange)=&quot;changeSelectedItem($event, l)&quot; [name]=&quot;l.target&quot; /&gt; &lt;/td&gt; </code></pre> <p>If I click in the input box next to <code>Comment 4</code> then more rows are added until the next input with an empty string is reached. The input is tied to a model - how can I force these rows to render with an empty string?</p> <p><a href="https://i.stack.imgur.com/kC3J4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kC3J4.png" alt="enter image description here" /></a></p> <p>EDIT: When not bound with ngModel the rows load as expected. The issue is binding to an empty string.</p>
[ { "answer_id": 74226600, "author": "Gui_user", "author_id": 15536277, "author_profile": "https://Stackoverflow.com/users/15536277", "pm_score": 3, "selected": true, "text": "e.getClass();//returnsString ApiException instead of ResolveApiException\n" }, { "answer_id": 74301033, ...
2022/10/24
[ "https://Stackoverflow.com/questions/74183769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4552288/" ]
74,183,798
<p>We're running on Windows Server 2016. We've been having some slowdown with a web application running in IIS. After the software team determined it was not an issue between IIS and MS-SQL, I'm trying to poke around a bit more.</p> <p>The actions that are incurred delay seem to be ones that send credentials to Active Directory each time they are invoked. I'm hoping to determine which domain controller the app is using.</p> <p>Looking through some config files, but the only thing I found related to authentication was:</p> <pre><code> &lt;authentication mode=&quot;Windows&quot; /&gt; </code></pre> <p>What determines which domain controller an IIS web app uses for authentication? Settings in the app itself? Settings in IIS itself? Global settings in Windows Server 2016?</p>
[ { "answer_id": 74226600, "author": "Gui_user", "author_id": 15536277, "author_profile": "https://Stackoverflow.com/users/15536277", "pm_score": 3, "selected": true, "text": "e.getClass();//returnsString ApiException instead of ResolveApiException\n" }, { "answer_id": 74301033, ...
2022/10/24
[ "https://Stackoverflow.com/questions/74183798", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20322497/" ]
74,183,830
<p>I have to load some scripts in my vue3 component, so this is what i'm doing:</p> <pre><code>&lt;script setup&gt; import { onMounted } from 'vue' function createEl (el, url, type) { const script = document.createElement(el) if (type) script.type = type script.src = url return script } onMounted(() =&gt; { const neshanScript = createEl('script', 'https://static.neshan.org/sdk/openlayers/5.3.0/ol.js', 'text/javascript') neshanScript.onload = () =&gt; { const map = new neshanScript.Map({ target: 'map', maptype: 'neshan', poi: true, traffic: false }) console.log(map) } neshanScript.onerror = () =&gt; console.log('error') }) &lt;/script&gt; </code></pre> <p>createEl function helps me to create any element I need, then I need to take an instance from my loaded script, but I onload block doesn't run!</p>
[ { "answer_id": 74226600, "author": "Gui_user", "author_id": 15536277, "author_profile": "https://Stackoverflow.com/users/15536277", "pm_score": 3, "selected": true, "text": "e.getClass();//returnsString ApiException instead of ResolveApiException\n" }, { "answer_id": 74301033, ...
2022/10/24
[ "https://Stackoverflow.com/questions/74183830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14321114/" ]
74,183,859
<p>Using PowerShell, I am trying to manipulate this string: <code>mbx74542cbb45d544c2bf269ae87a978be8:2</code> to end up looking like this string:<br /> <code>74542cbb-45d5-44c2-bf26-9ae87a978be8</code></p> <p>I am using the results of the <code>get-retentioncompliancepolicy</code> (<code>74542cbb-45d5-44c2-bf26-9ae87a978be8</code>) to try to match it with the <code>get-mailbox inplaceholds</code> (<code>mbx74542cbb45d544c2bf269ae87a978be8:2</code>) and will be using this to compare multiple mailboxes.</p>
[ { "answer_id": 74186198, "author": "PMental", "author_id": 11301839, "author_profile": "https://Stackoverflow.com/users/11301839", "pm_score": 0, "selected": false, "text": "$GetRetentionCompliancePolicyResult = '74542cbb-45d5-44c2-bf26-9ae87a978be8'\n$GetMailboxResult = 'mbx74542cbb45d5...
2022/10/24
[ "https://Stackoverflow.com/questions/74183859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8333362/" ]
74,183,871
<p>I'm working on the following problem:</p> <blockquote> <p>The number <strong>n</strong> is given as input</p> <p>Find out if it's <strong>monotonic</strong>?</p> <p>A <strong>monotonic</strong> number is called - that number of numbers in which monotonically decrease or increase monotonically. For example: <strong>110, 111, 122, 123, 455, 554</strong>. - are monotonic. <strong>101, 121, 231</strong> are non-monotonic.</p> <p><strong>Constraint:</strong> Arrays and strings cannot be used.</p> </blockquote> <p>I wrote a function to check for a monotonically increasing number:</p> <pre><code>public static boolean isMonotonic(int num) { int n = num; // Copy of num to be modified int b = (n/10)%10; // Step for a number if it is monotone n /= 10; if (num &lt; 100) return true; // all two-digit numbers are monotonic while (n &gt; 0 &amp;&amp; n &gt; b) { if ((n/10)%10 != b){ return false; } n /= 10; } return true; } </code></pre> <p>But I don't know how to make a function for a monotonically decreasing number.</p>
[ { "answer_id": 74186198, "author": "PMental", "author_id": 11301839, "author_profile": "https://Stackoverflow.com/users/11301839", "pm_score": 0, "selected": false, "text": "$GetRetentionCompliancePolicyResult = '74542cbb-45d5-44c2-bf26-9ae87a978be8'\n$GetMailboxResult = 'mbx74542cbb45d5...
2022/10/24
[ "https://Stackoverflow.com/questions/74183871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17274825/" ]
74,183,886
<p>I have an API. When I click on a button, I want to filter the hashtag data which are arrays and those arrays are in their objects. This is what I did. It doesn't return anything in this code. I need any help you can do.</p> <p><strong>This is my code :</strong></p> <pre><code>const hashtagsHandler = (event, title) =&gt; { const eventData = event.target.innerText; console.log(eventData); const filter = bookData.filter((items) =&gt; { items.hashtags.map((item) =&gt; item === eventData); }); console.log(filter); if (filter.length !== 0) { setHashtag(filter); setAllFilter((prevState) =&gt; [...prevState], hashtag); } }; </code></pre> <p><strong>My API is something like this:</strong></p> <pre><code>&quot;data&quot;: [ { &quot;id&quot;: 1, &quot;name&quot;: &quot;name&quot;, &quot;typename&quot;: &quot;book&quot;, &quot;hashtags&quot;: [ &quot;a&quot;, &quot;b&quot;, ], } ] </code></pre>
[ { "answer_id": 74186198, "author": "PMental", "author_id": 11301839, "author_profile": "https://Stackoverflow.com/users/11301839", "pm_score": 0, "selected": false, "text": "$GetRetentionCompliancePolicyResult = '74542cbb-45d5-44c2-bf26-9ae87a978be8'\n$GetMailboxResult = 'mbx74542cbb45d5...
2022/10/24
[ "https://Stackoverflow.com/questions/74183886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16630321/" ]
74,183,903
<p><strong>UPDATED</strong></p> <p>It is expected for the API to returned as in XML Format. After using console.log I can see and retrieve the response.data in XML structure. But when xml2json conversion, it returned me empty object.</p> <pre><code>const headers = { 'Content-Type': 'application/x-www-form-urlencoded', }; const response = await axios.post(postURL, urlSearchParams, { timeout: constant.axiosTimeout, headers: headers }); // logger.custom.info('responseXML:: ', response); //Show list of things // logger.custom.info('responseXML_DATA:: ', response.data); //Empty console.log('responseXML:: ', response.data); //SUCCESS const options = { compact: true, trim: true, ignoreDeclaration: true, ignoreInstruction: true, ignoreAttributes: true, ignoreComment: true, ignoreCdata: true, ignoreDoctype: true, textFn: utils.xml2jsonRemoveJsonTextAttribute }; // JSON.parse(convert.xml2json(response.data, options)); console.log('xml2json:: ', convert.xml2json(response.data, options)); console.log('JSONParse:: ', JSON.parse(convert.xml2json(response.data, options))); </code></pre> <p><a href="https://i.stack.imgur.com/nbAzc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nbAzc.png" alt="enter image description here" /></a> <a href="https://i.stack.imgur.com/WOGFj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WOGFj.png" alt="enter image description here" /></a></p> <p>Any helps are appreciated.</p>
[ { "answer_id": 74186198, "author": "PMental", "author_id": 11301839, "author_profile": "https://Stackoverflow.com/users/11301839", "pm_score": 0, "selected": false, "text": "$GetRetentionCompliancePolicyResult = '74542cbb-45d5-44c2-bf26-9ae87a978be8'\n$GetMailboxResult = 'mbx74542cbb45d5...
2022/10/24
[ "https://Stackoverflow.com/questions/74183903", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2455789/" ]
74,183,917
<p>I have a data set like this</p> <pre><code>ID departure_airport arrival_airport n 1 ZRH BUD 1 2 ZRH MSY 2 3 MSY IAD 2 4 VIE ZRH 1 </code></pre> <p>I would like to duplicate the rows with a value of 2 in column &quot;n&quot; and invert their airport codes in the departure and arrival columns. The output should look like this:</p> <pre><code>ID departure_airport arrival_airport n 1 ZRH BUD 1 2 ZRH MSY 2 3 MSY ZRH 2 4 MSY IAD 2 5 IAD MSY 2 6 VIE ZRH 1 </code></pre> <p>Any suggestions on how I can get the resulting table? Thanks in advance.</p>
[ { "answer_id": 74186198, "author": "PMental", "author_id": 11301839, "author_profile": "https://Stackoverflow.com/users/11301839", "pm_score": 0, "selected": false, "text": "$GetRetentionCompliancePolicyResult = '74542cbb-45d5-44c2-bf26-9ae87a978be8'\n$GetMailboxResult = 'mbx74542cbb45d5...
2022/10/24
[ "https://Stackoverflow.com/questions/74183917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18679050/" ]
74,183,936
<p>I want to calculate the cumulated / running product of an array.</p> <p>However, the solutions provided under these two questions are not quite what I want:</p> <ol> <li><a href="https://stackoverflow.com/questions/73746074/cumulated-products-multiplications-of-array-in-excel">Cumulated Products (Multiplications) of Array in Excel</a></li> <li><a href="https://stackoverflow.com/questions/68400019/excel-dynamic-array-formula-to-create-a-running-product-of-a-column">Excel Dynamic Array formula to create a running product of a column</a></li> </ol> <p>In both of the solutions provided under those questions, the solution uses either the <code>SCAN()</code> function which is currently not available to me, or it uses <code>OFFSET()</code> which only allows for a <em>range</em>-type input as array, not an array generated with a function such as <code>SEQUENCE()</code>.</p> <p>More explicitly: The array I want to calculate a running product of is <code>=SEQUENCE(D11,1,1-D23,D24)</code> where D11 is an integer, D23 and D24 are decimals.</p> <p>Does anyone have an in-formula solution for this or do I have to do the intermediary step to 'write' the sequence into a range first and then use the <code>OFFSET()</code> function?</p> <p><strong>Edit 1</strong>:</p> <p>An example for the <code>SEQUENCE()</code> function above would be <code>{0.97, 0.96, 0.95, ..., 0.75}</code></p> <p><strong>Edit 2</strong>:</p> <p>I would of course be happy with an <code>OFFSET()</code> solution if there is a way to use it without a <em>range</em>-type array as input.</p> <p><strong>Edit 3</strong>:</p> <p>Here is a numerical example of what I am trying to achieve without the itermediary steps.</p> <p><a href="https://i.stack.imgur.com/lWRje.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lWRje.png" alt="Example Screenshot" /></a></p>
[ { "answer_id": 74185728, "author": "Scott Craner", "author_id": 4851590, "author_profile": "https://Stackoverflow.com/users/4851590", "pm_score": 3, "selected": false, "text": "=LET( a, LN(A1#),\n v, SEQUENCE( ROWS(a) ), \n h, TRANSPOSE( v ),\n stagr, (v - h + 1) * (v >...
2022/10/24
[ "https://Stackoverflow.com/questions/74183936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17158703/" ]
74,183,953
<p>I have a string literal union type Animal:</p> <pre class="lang-js prettyprint-override"><code>type Animal = 'GOAT' | 'GIRAFFE' | 'SALMON' | 'TUNA' </code></pre> <p>I also have a type Fish which is a subset of Animal:</p> <pre class="lang-js prettyprint-override"><code>type Fish = Extract&lt;Animal, 'SALMON' | 'TUNA'&gt; // type Fish = &quot;SALMON&quot; | &quot;TUNA&quot; </code></pre> <p>Now I want to have an array of string containing the Fish, so that I can use that array in the logic (e.g. to use the <code>includes()</code> function). I could just define the array separately:</p> <pre class="lang-js prettyprint-override"><code>const FISH: ReadonlyArray&lt;Fish&gt; = ['SALMON', 'TUNA'] </code></pre> <p>but now I have to maintain the list of fish in two places.</p> <p>What I want to know is: <strong>is it possible to use the values in the array to define which string literals to extract for the Fish type while also only allowing the array to contain Animal strings</strong>?</p> <p>Something like:</p> <pre class="lang-js prettyprint-override"><code>const FISH: ReadonlyArray&lt;SubsetOfStringLiterals&lt;Animal&gt;&gt; = ['SALMON', 'TUNA'] // Would error if it contained a value not in Animal type Fish = typeof FISH[number] // type Fish = &quot;SALMON&quot; | &quot;TUNA&quot; </code></pre> <p>where <code>SubsetOfStringLiterals</code> would essentially be a utility like <code>Partial</code> but for string literal union types.</p>
[ { "answer_id": 74184098, "author": "Alex Wayne", "author_id": 62076, "author_profile": "https://Stackoverflow.com/users/62076", "pm_score": 4, "selected": true, "text": "satisfies" }, { "answer_id": 74184205, "author": "ij7", "author_id": 20275210, "author_profile": "...
2022/10/24
[ "https://Stackoverflow.com/questions/74183953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9333013/" ]
74,183,975
<p>I want to make tabs for a specific page, but with AppShell I can just do this for everypage. I just want tabs only in one page, and not the others.</p>
[ { "answer_id": 74184098, "author": "Alex Wayne", "author_id": 62076, "author_profile": "https://Stackoverflow.com/users/62076", "pm_score": 4, "selected": true, "text": "satisfies" }, { "answer_id": 74184205, "author": "ij7", "author_id": 20275210, "author_profile": "...
2022/10/24
[ "https://Stackoverflow.com/questions/74183975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9816443/" ]
74,183,997
<p>New to VS 2022 and programming in general. I am looking at the Debug toolbar while coding F#, and it seems to be missing 3 buttons: &quot;Step Back Into&quot;, &quot;Step Back Over&quot;, &quot;Step Back Out&quot;.</p> <p>They are selected under the 'Customize' menu as per screenshot:</p> <p><a href="https://i.stack.imgur.com/ILPDp.png" rel="nofollow noreferrer">Customize Debug Toolbar</a></p> <p>Here's the Debug Toolbar at the top:</p> <p><a href="https://i.stack.imgur.com/updEm.png" rel="nofollow noreferrer">Debug Toolbar</a></p>
[ { "answer_id": 74184098, "author": "Alex Wayne", "author_id": 62076, "author_profile": "https://Stackoverflow.com/users/62076", "pm_score": 4, "selected": true, "text": "satisfies" }, { "answer_id": 74184205, "author": "ij7", "author_id": 20275210, "author_profile": "...
2022/10/24
[ "https://Stackoverflow.com/questions/74183997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19200393/" ]
74,184,013
<p>the question is asking me to do this In a small highland village, everyone has the surname McIntosh, McGregor, McDonald or McKenzie. Everyone is called Angus, Hamish, Morag or Mhairi No two people have the same name. Create a program to compile a list of the inhabitants of the village.</p> <p>It makes use of lists and loops but I don't know how to do it, this is what i have so far</p> <pre><code>surnames = [&quot;Mcintosh&quot;, &quot;McGregor&quot;, &quot;McDonald&quot;, &quot;Mckenzie&quot;] forenames = [&quot;Angus&quot;, &quot;Hamish&quot;, &quot;Morag&quot;, &quot;Mhairi&quot;] for forenames in forenames: for surnames in surnames: print forenames </code></pre>
[ { "answer_id": 74184051, "author": "Samwise", "author_id": 3799759, "author_profile": "https://Stackoverflow.com/users/3799759", "pm_score": 2, "selected": true, "text": "for var in iterable" }, { "answer_id": 74184070, "author": "Dmitriy Neledva", "author_id": 16786350, ...
2022/10/24
[ "https://Stackoverflow.com/questions/74184013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20323354/" ]
74,184,049
<p>I implemented an algorithm that uses opencv kmeans to quantize the unique brightness values present in a greyscale image. Quantizing the unique values helped avoid biases towards image backgrounds which are typically all the same value.</p> <p>However, I struggled to find a way to utilize this data to quantize a given input image.</p> <p>I implemented a very naive solution, but it is unusably slow for the required input sizes (4000x4000):</p> <pre><code>for x in range(W): for y in range(H): center_id = np.argmin([(arr[y,x]-center)**2 for center in centers]) ret_labels2D[y,x] = sortorder.index(center_id) ret_qimg[y,x] = centers[center_id] </code></pre> <p>Basically, I am simply adjusting each pixel to the predefined level with the minimum squared error.</p> <p>Is there any way to do this faster? I was trying to process an image of size 4000x4000 and this implementation was completely unusable.</p> <p>Full code:</p> <pre><code>def unique_quantize(arr, K, eps = 0.05, max_iter = 100, max_tries = 20): &quot;&quot;&quot;@param arr: 2D numpy array of floats&quot;&quot;&quot; H, W = arr.shape unique_values = np.squeeze(np.unique(arr.copy())) unique_values = np.array(unique_values, float) if unique_values.ndim == 0: unique_values = np.array([unique_values],float) unique_values = np.ravel(unique_values) unique_values = np.expand_dims(unique_values,1) Z = unique_values.astype(np.float32) criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER,max_iter,eps) compactness, labels, centers = cv2.kmeans(Z,K,None,criteria,max_tries,cv2.KMEANS_RANDOM_CENTERS) labels = np.ravel(np.squeeze(labels)) centers = np.ravel(np.squeeze(centers)) sortorder = list(np.argsort(centers)) # old index --&gt; index to sortorder ret_center = centers[sortorder] ret_labels2D = np.zeros((H,W),int) ret_qimg = np.zeros((H,W),float) for x in range(W): for y in range(H): center_id = np.argmin([(arr[y,x]-center)**2 for center in centers]) ret_labels2D[y,x] = sortorder.index(center_id) ret_qimg[y,x] = centers[center_id] return ret_center, ret_labels2D, ret_qimg </code></pre> <p>EDIT: I looked at the input file again. The size was actually 12000x12000.</p>
[ { "answer_id": 74215590, "author": "Michael Sohnen", "author_id": 5166365, "author_profile": "https://Stackoverflow.com/users/5166365", "pm_score": 0, "selected": false, "text": "def unique_quantize(arr, K, eps = 0.05, max_iter = 100, max_tries = 20):\n\n \"\"\"@param arr: 2D numpy ar...
2022/10/24
[ "https://Stackoverflow.com/questions/74184049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5166365/" ]
74,184,068
<p>I'm surprised to find no one asked this question on Stackoverflow before. Maybe it's too stupid to ask?</p> <p>So I have a dataframe that contains 48 weather variables, each representing a weather value for a month. I have drawn a simplified table shown below:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>weather 1</th> <th>weather 2</th> <th>weather 3</th> <th>weather 4</th> <th>weather 5</th> <th>weather 6</th> <th>weather 7</th> <th>weather 8</th> <th>weather 9</th> <th>weather 10</th> <th>weather 11</th> <th>weather 12</th> </tr> </thead> <tbody> <tr> <td>12</td> <td>6</td> <td>34</td> <td>9</td> <td>100</td> <td>.01</td> <td>-4</td> <td>38</td> <td>64</td> <td>77</td> <td>21</td> <td>34</td> </tr> <tr> <td>99</td> <td>42</td> <td>-3</td> <td>34</td> <td>34</td> <td>.5</td> <td>27</td> <td>19</td> <td>7</td> <td>18</td> <td>NA</td> <td>20</td> </tr> </tbody> </table> </div> <p>My objective is to make the column names from &quot;weather 1, weather 2, ...&quot; to &quot;weather 01, weather 02, ....&quot; And I wrote a loop like this:</p> <pre><code>for (i in 1:9){ colnames(df) = gsub(i, 0+i, colnames(df)) } </code></pre> <p>However, instead of replacing the single-digit numbers with a leading zero, R replaced the actual letter &quot;i&quot; with &quot;0+i&quot;. Can anyone let me know what's going on here and how to fix it? Or is there a better way to add leading zeros to column names?</p> <p>Thank you very much!</p>
[ { "answer_id": 74184079, "author": "akrun", "author_id": 3732271, "author_profile": "https://Stackoverflow.com/users/3732271", "pm_score": 2, "selected": false, "text": "library(stringr)\ncolnames(df) <- str_replace(colnames(df), \"\\\\d+\", \n function(x) sprintf(\"%02d\", as.integ...
2022/10/24
[ "https://Stackoverflow.com/questions/74184068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11343736/" ]
74,184,077
<p>I am playing around with Kotlin Coroutines, and I ended up in a situation I do not understand. Let's say that I have two <code>suspend</code> functions:</p> <pre><code>suspend fun coroutine() { var num = 0 coroutineScope { for (i in 1..1000) { launch { delay(10) num += 1 } } } println(&quot;coroutine: $num&quot;) } </code></pre> <p>and:</p> <pre><code>suspend fun runBlocked() = runBlocking { var num = 0 for (i in 1..1000) { launch { delay(10) num += 1 } } println(&quot;Run blocking: $num&quot;) } </code></pre> <p>Then I call them from <code>main()</code> method:</p> <pre><code>suspend fun main() { coroutine() runBlocked() } </code></pre> <p>The <code>coroutine()</code> method prints (as expected) a number that is almost never 1000 (usually between 970 and 999). And I understand why.</p> <p>What I do not understand is why the <code>runBlocked()</code> function allways prints 0.</p> <blockquote> <p>coroutine: 998<br /> runBlocked: 0</p> </blockquote> <p>I tried one more time, this time making a similar function to <code>runBlocked()</code>, with the difference that this time the method is returning a value instead of printing:</p> <pre><code>suspend fun runBlockedWithReturn(): Int = runBlocking { var num = 0 for (i in 1..1000) { launch { delay(10) num += 1 } } return@runBlocking num } </code></pre> <p>And then I called it from the <code>main()</code> method:</p> <pre><code>suspend fun main() { val result = runBlockedWithReturn() println(&quot;Run blocking with return: $result&quot;) } </code></pre> <p>...but the method returned 0.</p> <p>Why is that? And how do I fix the <code>runBlocked()</code> method to print a number that is close to 1000 instead of 0? What am I missing?</p>
[ { "answer_id": 74184276, "author": "Louis Wasserman", "author_id": 869736, "author_profile": "https://Stackoverflow.com/users/869736", "pm_score": 2, "selected": false, "text": "runBlocking" }, { "answer_id": 74184277, "author": "Tenfour04", "author_id": 506796, "auth...
2022/10/24
[ "https://Stackoverflow.com/questions/74184077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4012392/" ]
74,184,093
<pre><code>import re def capital_indexes(string): cap=[] for i in string: if i.isupper()==True: cap.append(string.find(i)) return cap print(capital_indexes(&quot;TEsT&quot;)) </code></pre> <p>I want it to return the index of every single letter that is a capital letter.</p>
[ { "answer_id": 74184144, "author": "Dmitriy Neledva", "author_id": 16786350, "author_profile": "https://Stackoverflow.com/users/16786350", "pm_score": 2, "selected": false, "text": "def capital_indexes(s):\n return [e for e,i in enumerate(s) if i.isupper()]\n\nprint(capital_indexes(\"...
2022/10/24
[ "https://Stackoverflow.com/questions/74184093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20262336/" ]
74,184,114
<p>I'd like to make a frequency count individually for multiple columns with same possible values. The idea is to keep all columns from original data table, just adding a new one for levels and aggregating. Here is an example of input data:</p> <pre><code>foo &lt;- data.table(a = c(1,3,2,3,3), b = c(2,3,3,1,1), c = c(3,1,2,3,2)) # a b c #1: 1 2 3 #2: 3 3 1 #3: 2 3 2 #4: 3 1 3 #5: 3 1 2 </code></pre> <p>And desired output:</p> <pre><code>data.table(levels = 1:3, a = c(1,1,3), b = c(2,1,2), c = c(1,2,2)) # levels a b c #1: 1 1 2 1 #2: 2 1 1 2 #3: 3 3 2 2 </code></pre> <p>Thanks for helping !</p>
[ { "answer_id": 74184153, "author": "akrun", "author_id": 3732271, "author_profile": "https://Stackoverflow.com/users/3732271", "pm_score": 1, "selected": false, "text": "library(data.table)\ndcast(melt(foo)[, .N, .(variable, levels = value)],\n levels ~ variable, value.var = 'N')\n" ...
2022/10/24
[ "https://Stackoverflow.com/questions/74184114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20323337/" ]
74,184,130
<p>I'm trying to use @configurable in spring to use a @autowired service in a non bean class I create.<br /> It doesn't want to work anymore whatever I try.<br /> Can someone tell me what I'm doing wrong? (I did some research but I'm totally clueless now)<br /> Here is a very basic code example I made :</p> <p>pom.xml</p> <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;parent&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt; &lt;version&gt;2.7.5&lt;/version&gt; &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt; &lt;/parent&gt; &lt;groupId&gt;com.example&lt;/groupId&gt; &lt;artifactId&gt;demo2&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;name&gt;demo2&lt;/name&gt; &lt;description&gt;Demo project for Spring Boot&lt;/description&gt; &lt;properties&gt; &lt;java.version&gt;17&lt;/java.version&gt; &lt;/properties&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-starter-aop&lt;/artifactId&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt; &lt;scope&gt;runtime&lt;/scope&gt; &lt;optional&gt;true&lt;/optional&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p>Configuration ComponentScan class</p> <pre><code>package com.example.demo2; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.aspectj.EnableSpringConfigured; @Configuration @ComponentScan @EnableSpringConfigured public class AspectJConfig { } </code></pre> <p>@SpringBootApplication class</p> <pre><code>package com.example.demo2; import javax.annotation.PostConstruct; //import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) public class Demo2Application { //@Autowired //private HelloWorldService helloWorldService; public static void main(String[] args) { SpringApplication.run(Demo2Application.class, args); } @PostConstruct public void doSomethingIProbablyShouldNotBeDoing() { //helloWorldService.sayHello(); HelloWorldClient client = new HelloWorldClient(); client.sayHello(); } } </code></pre> <p>class with @Configurable and @Autowired service</p> <pre><code>package com.example.demo2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Configurable; @Configurable public class HelloWorldClient { @Autowired private HelloWorldService service; public void sayHello() { // Used injected instance of service service.sayHello(); } } </code></pre> <p>@Service class</p> <pre><code>package com.example.demo2; import org.springframework.stereotype.Service; @Service public class HelloWorldService { public void sayHello() { System.out.println(&quot;Hello world!&quot;); } } </code></pre> <p>Also here is a link to my previous post on that subject. I did received an answer to my question that was working. But for whatever reason it doesn't work anymore on my side.<br /> <a href="https://stackoverflow.com/questions/71613523/spring-configurable-nullpointerexception">Spring @configurable NullPointerException</a></p>
[ { "answer_id": 74194583, "author": "lukwas", "author_id": 12141701, "author_profile": "https://Stackoverflow.com/users/12141701", "pm_score": 0, "selected": false, "text": "new HelloWorldClient()" }, { "answer_id": 74350133, "author": "kriegaex", "author_id": 1082681, ...
2022/10/24
[ "https://Stackoverflow.com/questions/74184130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8159582/" ]
74,184,195
<p>I'm trying to gracefully exit the program if the username/password is incorrect or (ORA-01017) but the script hangs when getting an error. My proposed error is in the try section of the code then the entire script hangs. I thought the catch is suppose to throw the exception. Ideally I will create a for loop that will connect to each database and if there is an error just capture the error and go on to the next. But right now just testing the try/catching the error option. Also, I'm encrypting the password. Any ideas or suggestions</p> <pre><code>enter code here function Start-Something { $User = Read-Host -Prompt 'Input the Oracle database user name' $psswd = Read-Host -Prompt 'Input Oracle database Password:' -AsSecureString $cryptpasswd = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($psswd)) Write-Host &quot;###############################################&quot; Write-Host Connecting to Oracle Database: testdb -ForegroundColor Green sqlplus -s $User/$cryptpasswd@$line '@C:\Users\my\Documents\Scripts\oracledbinfo.sql' Write-Host &quot;###############################################&quot; Write-Host &quot; ###########################################&quot; } try { Start-Something } catch { Write-Output &quot;Something threw an exception&quot; Write-Output $_ } </code></pre> <p>try { Start-Something -ErrorAction Stop } catch { Write-Output &quot;Something threw an exception or used Write-Error&quot; Write-Output $_ }</p>
[ { "answer_id": 74194583, "author": "lukwas", "author_id": 12141701, "author_profile": "https://Stackoverflow.com/users/12141701", "pm_score": 0, "selected": false, "text": "new HelloWorldClient()" }, { "answer_id": 74350133, "author": "kriegaex", "author_id": 1082681, ...
2022/10/24
[ "https://Stackoverflow.com/questions/74184195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20322978/" ]
74,184,218
<p>I'm trying to create a function to &quot;clean&quot; a list: to free the elements and s_struct (-&gt;next) (done by the ft_lstdelone function). I've got an issue: the code at the top doesn't work whereas the second one works; any ideas?</p> <h3>Non-working code</h3> <pre><code>void ft_lstclear(t_list **lst, void (*del)(void*)) { t_list *temp; t_list *begin; if (!lst || !*lst || !del) return ; begin = *lst; while (begin) { temp = (begin)-&gt;next; ft_lstdelone((begin), del); (begin) = temp; } } </code></pre> <h3>Working code</h3> <pre><code>void ft_lstclear(t_list **lst, void (*del)(void*)) { t_list *begin; if (!lst || !*lst) return ; while (*lst != NULL) { begin = (*lst)-&gt;next; ft_lstdelone((*lst), del); (*lst) = begin; } } </code></pre>
[ { "answer_id": 74185010, "author": "Craig Estey", "author_id": 5382650, "author_profile": "https://Stackoverflow.com/users/5382650", "pm_score": 0, "selected": false, "text": "*lst = begin;\n" }, { "answer_id": 74185868, "author": "ikegami", "author_id": 589924, "auth...
2022/10/24
[ "https://Stackoverflow.com/questions/74184218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20323391/" ]
74,184,245
<p>I'm building a .NET WebAPI that receives Json through a Post operation. The Json that's being received could look like the following:</p> <pre><code>{ &quot;site&quot;: &quot;00131231201d010231&quot;, &quot;publishTime&quot;: 123123123123, &quot;domains&quot;: [ &quot;example.com&quot; ], &quot;publishedBy&quot;: { &quot;name&quot;: &quot;John Doe&quot;, &quot;id&quot;: &quot;00211231201d010231&quot; } } </code></pre> <p>I converted my Json response type to C# objects which look like the following:</p> <pre><code>public class Project { [Key] [JsonPropertyName(&quot;site&quot;)] public string Site { get; set; } [JsonPropertyName(&quot;publishTime&quot;)] public long PublishTime { get; set; } [JsonPropertyName(&quot;domains&quot;)] public List&lt;Domain&gt; Domains { get; set; } [JsonPropertyName(&quot;publishedBy&quot;)] public PublishedBy PublishedBy { get; set; } } public class PublishedBy { [JsonPropertyName(&quot;name&quot;)] public string Name { get; set; } [Key] [JsonPropertyName(&quot;id&quot;)] public string Id { get; set; } } public class Domain { [Key] public string Id { get; set; } public string Name { get; set; } } </code></pre> <p>As you can see, my goal is to add the contents to my database. Only when I use List Domains, it gives me an error saying I can't use strings in EFCore when I try to add a migration.</p> <p>So, I created an object called Domain. But now when I try to deserialize it gives me the following error:</p> <pre><code>System.Text.Json.JsonException: The JSON value could not be converted to spine_management.Models.Domain. </code></pre> <p>Does anyone happen to know what type I should make Domains and/or what the best way to deserialize this object is?</p> <p><strong>EDIT:</strong></p> <p>I want to keep the domains attribute, I don't want to ignore or delete them.</p>
[ { "answer_id": 74184436, "author": "David", "author_id": 328193, "author_profile": "https://Stackoverflow.com/users/328193", "pm_score": 1, "selected": true, "text": "Domains" } ]
2022/10/24
[ "https://Stackoverflow.com/questions/74184245", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20323461/" ]
74,184,258
<p>For some reason I'm having a rendering issue when it comes to implementing <code>content</code> in a <code>:before</code> or <code>:after</code> pseudo element. Given the stripped down component:</p> <pre><code>import React from 'react'; import PropTypes from 'prop-types'; import styled from 'styled-components'; const Container = styled.div` display: block; padding: 1rem; `; const Foo = styled.p` &amp;:before { content: '\201C'; display: block; font-size: 4rem; font-weight: bold; height: 4.25rem; } &amp;:after { content: '\201D'; display: block; font-size: 4rem; font-weight: bold; height: 2.625rem; } font-weight: bold; `; function Test({ txt }) { return ( &lt;Container&gt; &lt;Foo&gt;{txt}&lt;/Foo&gt; &lt;/Container&gt; ); } Test.propTypes = { txt: PropTypes.string.isRequired, }; export default Test; </code></pre> <p>Nothing gets rendered. Referencing <a href="https://stackoverflow.com/a/49671572/1952287">this answer</a> from <a href="https://stackoverflow.com/questions/46339034/how-to-render-pseudo-before-content-dynamically-in-styled-component">How to render pseudo before content dynamically in styled-component</a> I tried:</p> <pre><code>const Foo = styled.p` &amp;:before { content: '\201C'; display: block; font-size: 4rem; font-weight: bold; height: 4.25rem; } &amp;:after { content: '\201D'; display: block; font-size: 4rem; font-weight: bold; height: 2.625rem; } font-weight: bold; `; </code></pre> <p><a href="https://stackoverflow.com/a/66817535/1952287">This answer</a> recommends double colons from <a href="https://stackoverflow.com/questions/66817477/can-anyone-tell-me-why-before-not-working-on-styled-components">Can anyone tell me why before not working on styled components?</a>:</p> <pre><code>const Foo = styled.p` &amp;::before { content: '\201C'; display: block; font-size: 4rem; font-weight: 700; height: 4.25rem; } &amp;::after { content: '\201D'; display: block; font-size: 4rem; font-weight: bold; height: 2.625rem; } font-weight: bold; `; </code></pre> <p>but I'm unable to render a <code>before</code> or <code>after</code>. Further research I've seen where content might be an issue but I'm referencing them correctly per <a href="https://www.toptal.com/designers/htmlarrows/punctuation/left-double-quotation-mark/" rel="nofollow noreferrer">Double Quotation</a> and a height or width should be declared and I've made sure to pass a <code>height</code> in <code>rem</code>.</p> <p>Using Styled Components version <code>&quot;^5.3.5&quot;</code>, I've removed my cache, dumped the public directory and I've tested in Chrome and Firefox but I'm unable to render quotes.</p> <h2>Research</h2> <ul> <li><a href="https://stackoverflow.com/questions/45871439/before-and-after-pseudo-classes-used-with-styled-components">Before and After pseudo classes used with styled-components</a></li> <li><a href="https://stackoverflow.com/questions/70416587/using-styled-components-and-passing-props-to-psedo-element-before-not-working">Using Styled Components and passing props to psedo element before not working</a></li> <li><a href="https://stackoverflow.com/questions/66817477/can-anyone-tell-me-why-before-not-working-on-styled-components">Can anyone tell me why before not working on styled components?</a></li> <li><a href="https://stackoverflow.com/questions/7176267/why-is-before-pseudoelement-rendered-before-content-not-element">Why is :before pseudoelement rendered before content, not element?</a></li> <li><a href="https://stackoverflow.com/questions/52802262/styled-components-multiple-pseudo-elements">Styled-components multiple Pseudo Elements</a></li> </ul> <p>What am I doing wrong and how can I render pseudo elements?</p>
[ { "answer_id": 74184472, "author": "Zharkov Ruslan", "author_id": 8750482, "author_profile": "https://Stackoverflow.com/users/8750482", "pm_score": 1, "selected": false, "text": "content" }, { "answer_id": 74184983, "author": "jme11", "author_id": 3577849, "author_pro...
2022/10/24
[ "https://Stackoverflow.com/questions/74184258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1952287/" ]
74,184,285
<p>I'm a newbie. For a school project, I need a typewriter, and I came down to this idea that seems good to me. But when I launch it, it says this error:</p> <pre class="lang-none prettyprint-override"><code>terminate called after throwing an instance of 'std::out_of_range' error </code></pre> <p>I don't know why. I think the idea is good, because when I try without the variable <code>t</code>, so just putting numbers in <code>testo.erase()</code>, it works, but I need to create a loop.</p> <pre class="lang-cpp prettyprint-override"><code>void typewriter(string testo, int tempo) { int i = testo.length(); int t = 0; while (t&lt;=i) { system (&quot;CLS&quot;); t=t+1; testo.erase(t); cout&lt;&lt;testo; Sleep(tempo); } } </code></pre>
[ { "answer_id": 74184319, "author": "cs1349459", "author_id": 13592914, "author_profile": "https://Stackoverflow.com/users/13592914", "pm_score": 1, "selected": false, "text": "testo.erase(t)" }, { "answer_id": 74184845, "author": "Epic.", "author_id": 20323519, "autho...
2022/10/24
[ "https://Stackoverflow.com/questions/74184285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20323519/" ]
74,184,293
<p>I have a button which opens a calendar modal, I know calendars are bad for accessibility but my client insists on it. This is the code that opens that calendar modal.</p> <pre><code>&lt;div class=&quot;col-sm-6 hidden-xs text-right calendar-cta&quot;&gt; &lt;a type=&quot;button&quot; onclick=&quot;openNav()&quot; href=&quot;#&quot; class=&quot;btn-primary&quot;&gt;Calendar view&lt;/a&gt; &lt;/div&gt; </code></pre> <p>I then have a close button on the model, which is where the accessibility error is being produced. The x is showing up as 'Text not included in an ARIA landmark'. What am I doing wrong? What do I need to add in order for this to stop producing the accessibility error. Any help would be hugely appreciated.</p> <pre><code>&lt;div id=&quot;myNav&quot; class=&quot;overlay&quot; role=&quot;menu&quot;&gt; &lt;a class=&quot;closebtn&quot; tabindex=&quot;-1&quot; role=&quot;menuitem&quot; aria-label=&quot;close calendar view&quot;&gt;×&lt;/a&gt; &lt;div class=&quot;overlay-content&quot;&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
[ { "answer_id": 74184733, "author": "Josh", "author_id": 4274933, "author_profile": "https://Stackoverflow.com/users/4274933", "pm_score": 1, "selected": false, "text": "<main>" }, { "answer_id": 74310912, "author": "grifare", "author_id": 2989024, "author_profile": "h...
2022/10/24
[ "https://Stackoverflow.com/questions/74184293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20323434/" ]
74,184,304
<p>I want to use <code>textBox1.Text</code> in a different class not just in the main where the text boxes are defined so to say. Is there any way to make it global? Because it only allows me to use it in the main thing, not in the seperate class that I have to make in my task.</p> <p>I need to store the text from the <code>textBox</code> in a <code>List</code> that is in a different class so the user can't add the same name twice so I need to remember what was typed in in the first input.</p> <p>This is the class where I created a <code>List</code> and where I want to store those inputs:</p> <pre class="lang-cs prettyprint-override"><code>internal class Clanovi { public static List&lt;Clan&gt; Dodaj() { List&lt;Clan&gt; clanovi = new List&lt;Clan&gt;(); clanovi.Add(new Clan() { KorIme = textBox1.Text, Lozinka = textBox2.Text }); return clanovi; } } </code></pre> <pre class="lang-cs prettyprint-override"><code>class Clan { public string KorIme { get; set; } public string Lozinka { get; set; } } </code></pre> <p>This is <strong>WinForm</strong> btw.</p>
[ { "answer_id": 74186911, "author": "Faylasouf", "author_id": 20324478, "author_profile": "https://Stackoverflow.com/users/20324478", "pm_score": 1, "selected": true, "text": "Form_name/class_name myTextbox = new form_name/class_name(); \n" }, { "answer_id": ...
2022/10/24
[ "https://Stackoverflow.com/questions/74184304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17349296/" ]
74,184,312
<p>In one of my config files <code>config.js</code> file, I have:</p> <pre class="lang-js prettyprint-override"><code>module.exports = { locales: ['en', 'fr'] } </code></pre> <p>In my library, I try to import the <code>config.js</code> file and turn it into a typescript liberal type like so:</p> <pre class="lang-js prettyprint-override"><code>import config from &quot;config.js&quot; const tempDefaultLocales = [...config.locales] as const export type Language = typeof tempDefaultLocales[number] </code></pre> <p>But the type of <code>Language</code> is <code>string</code> and not <code>&quot;en&quot; | &quot;fr&quot;</code></p> <p>If I don't import and just hard type it, the <code>as const</code> works. Example:</p> <pre class="lang-js prettyprint-override"><code>const locales = [&quot;en&quot;,&quot;fr&quot;] as const type Language = typeof locales[number] </code></pre> <p>Gives me the correct type of <code>&quot;en&quot; | &quot;fr&quot;</code></p> <p>Any idea how I can make this work without changing my config file to <code>ts</code> or hardcoding it?</p> <p>Here is a sandbox: <a href="https://codesandbox.io/s/awesome-swirles-ij4qsg?file=/src/App.tsx" rel="nofollow noreferrer">https://codesandbox.io/s/awesome-swirles-ij4qsg?file=/src/App.tsx</a></p> <p>PS: I can't change the config to <code>ts</code> because the config file is actually <code>next.config.js</code> and they don't allow us to change it and I want to avoid having 2 config files to set my languages. Thanks</p>
[ { "answer_id": 74184339, "author": "adsy", "author_id": 1086398, "author_profile": "https://Stackoverflow.com/users/1086398", "pm_score": 0, "selected": false, "text": "module.exports = {\n locales: ['en', 'fr']\n} as const\n" }, { "answer_id": 74184511, "author": "adsy", ...
2022/10/24
[ "https://Stackoverflow.com/questions/74184312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/517477/" ]
74,184,329
<p>I have a Azure Cognitive Search set up with two DataSources, two Indexers indexing those DataSources and one Index.</p> <p>I'd like to be able to able to query/filter by DataSource. Is that possible?</p>
[ { "answer_id": 74184339, "author": "adsy", "author_id": 1086398, "author_profile": "https://Stackoverflow.com/users/1086398", "pm_score": 0, "selected": false, "text": "module.exports = {\n locales: ['en', 'fr']\n} as const\n" }, { "answer_id": 74184511, "author": "adsy", ...
2022/10/24
[ "https://Stackoverflow.com/questions/74184329", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2501497/" ]
74,184,330
<p>I would like to make a function that adds together the second element of every tuple in a list. So far I have:</p> <pre><code>pizza :: [(String, Int)] -&gt; Int pizza [] = 0 pizza (((a),b):xs) = b + pizza xs </code></pre> <p>This works great but I come into a problem when i want to add another int after the recursion is done.</p> <p>So what I get is:</p> <pre><code>&gt; pizza[(&quot;Cheese&quot;,10),(&quot;Dough&quot;,5)] 15 </code></pre> <p>I want to add another five after the recursion is done so I would get:</p> <pre><code>&gt; pizza[(&quot;Cheese&quot;,10),(&quot;Dough&quot;,5)] 20 </code></pre> <p>How would I go about doing this?</p>
[ { "answer_id": 74184992, "author": "Chris", "author_id": 15261315, "author_profile": "https://Stackoverflow.com/users/15261315", "pm_score": 2, "selected": false, "text": "5" }, { "answer_id": 74185404, "author": "Willem Van Onsem", "author_id": 67579, "author_profile...
2022/10/24
[ "https://Stackoverflow.com/questions/74184330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20152389/" ]
74,184,342
<p>I am trying to use Bing Map API to Update / Delete Entities in an existing Data source, though it is possible, it appears like I have to upload the whole dataset every time after making necessary updates to the relevant entities. Is there an alternative way to update or delete individual entities through API other than using the <a href="https://www.bingmapsportal.com/" rel="nofollow noreferrer">Bing Maps Dev Center</a>?</p>
[ { "answer_id": 74184992, "author": "Chris", "author_id": 15261315, "author_profile": "https://Stackoverflow.com/users/15261315", "pm_score": 2, "selected": false, "text": "5" }, { "answer_id": 74185404, "author": "Willem Van Onsem", "author_id": 67579, "author_profile...
2022/10/24
[ "https://Stackoverflow.com/questions/74184342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10422248/" ]
74,184,353
<p>There's an issue I am trying to solve in my app, I have a navigation drawer with 7 fragments when the app opens, and/or If I back from a details activity if I click on the back button, I see the fragment recreated again, and I had to press the back button several times again and again to close the app</p> <p>problem in GIF</p> <p><a href="https://imgur.com/JVZ0f0L" rel="nofollow noreferrer"><img src="https://i.imgur.com/JVZ0f0L.gif" title="source: imgur.com" /></a></p> <p><strong>MainActivity</strong></p> <pre><code>@AndroidEntryPoint class MainActivity : AppCompatActivity() { var APP_START_TIME: Long = 0 private lateinit var appBarConfiguration: AppBarConfiguration private var _binding: ActivityMainBinding? = null private val binding get() = _binding!! private lateinit var navController: NavController private lateinit var postViewModel: PostViewModel private var _navGraph: NavGraph? = null private val navGraph get() = _navGraph!! lateinit var adView: AdView private var adRequest: AdRequest? = null private val applicationScope = CoroutineScope(Dispatchers.Unconfined) override fun onDestroy() { super.onDestroy() adView.destroy() adRequest = null _binding = null } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) APP_START_TIME = System.currentTimeMillis() _binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) adView = AdView(this) delayedInit() postViewModel = ViewModelProvider(this)[PostViewModel:: class.java] setSupportActionBar(binding.toolbar) val drawerLayout: DrawerLayout = binding.drawerLayout val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment? if (navHostFragment != null) { navController = navHostFragment.navController } appBarConfiguration = AppBarConfiguration( setOf( R.id.nav_home, R.id.nav_accessory, R.id.nav_arcade, R.id.nav_fashion, R.id.nav_food, R.id.nav_heath, R.id.nav_lifestyle, R.id.nav_sports, R.id.nav_favorites, R.id.settingsFragment ), drawerLayout ) setupActionBarWithNavController(this, navController, appBarConfiguration) setupWithNavController(binding.navView, navController) _navGraph = navController.navInflater.inflate(R.navigation.mobile_navigation) onBackPressedDispatcher.addCallback(this /* lifecycle owner */, object : OnBackPressedCallback(true) { override fun handleOnBackPressed() { // Back is pressed... Finishing the activity finish() } }) } // override fun onStart() { // super.onStart() // } override fun onPause() { super.onPause() adView.pause() } override fun onResume() { super.onResume() adView.resume() postViewModel.currentDestination.observe(this) { currentDestination -&gt; Log.w(TAG, &quot;currentDestination: at first run is $currentDestination&quot;) navGraph.setStartDestination(currentDestination) navController.graph = navGraph } navController.addOnDestinationChangedListener { _, destination, _ -&gt; Log.d(TAG, &quot;addOnDestinationChangedListener: &quot; + destination.id) if (destination.id != R.id.settingsFragment &amp;&amp; destination.id != R.id.aboutFragment &amp;&amp; destination.id != R.id.privacyPolicyFragment ) { postViewModel.saveCurrentDestination(destination.id) } } } private fun requestHomeBanner() { adRequest = Constants.callAndBuildAdRequest() adView.adListener = object : AdListener() { override fun onAdFailedToLoad(adError: LoadAdError) { Log.e(TAG, &quot;onAdFailedToLoad: ${adError.cause.toString()}&quot;) Log.e(TAG, &quot;onAdFailedToLoad: ${adError.responseInfo.toString()}&quot;) } } adRequest?.let { adView.loadAd(it) } } private fun delayedInit() = applicationScope.launch { binding.adViewContainer.addView(adView) adView.adUnitId = &quot;ca-app-pub-3940256099942544/6300978111&quot; adView.setAdSize(Constants.GET_AD_SIZE(this@MainActivity)) val testDeviceIds = listOf(&quot;048DC5C3C06FBD17D9AD205151167F48&quot;) val configuration = RequestConfiguration.Builder().setTestDeviceIds(testDeviceIds).build() MobileAds.setRequestConfiguration(configuration) if (Utils.hasInternetConnection(this@MainActivity)) { requestTheLatestConsentInformation(this@MainActivity) MobileAds.initialize(this@MainActivity) { Log.d(TAG, &quot;onInitCompleted&quot;) } requestHomeBanner() } } override fun onSupportNavigateUp(): Boolean { return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() } } </code></pre> <h2>My tries to solve</h2> <ol> <li>I tried to add the following code inside <code>OnBackPressedCallback</code></li> </ol> <pre><code>navGraph.clear() binding.drawerLayout.removeAllViews() binding.navView.removeAllViews() </code></pre> <ol start="2"> <li>also I tried to add <code>onBackPressedDispatcher</code> callback inside <code>addOnDestinationChangedListener</code></li> </ol> <pre><code> onBackPressedDispatcher.addCallback(this /* lifecycle owner */, object : OnBackPressedCallback(true) { override fun handleOnBackPressed() { // Back is pressed... Finishing the activity navController.clearBackStack(destination.id) finish() } }) </code></pre> <ol start="3"> <li>I tried to handle back pressed from the fragment itself not from the activity like the following</li> </ol> <pre><code>requireActivity() .onBackPressedDispatcher .addCallback(viewLifecycleOwner, object : OnBackPressedCallback(true) { override fun handleOnBackPressed() { Log.d(TAG, &quot;Fragment back pressed invoked&quot;) // hideShimmerEffect() // Do custom work here requireActivity().finish() // if you want onBackPressed() to be called as normal afterwards if (isEnabled) { isEnabled = false requireActivity().onBackPressed() } } }) </code></pre> <ol start="4"> <li>I tried to pop the back stack or clear it by adding the following two lines to my above code</li> </ol> <pre><code>findNavController().popBackStack() findNavController().clearBackStack(R.id.nav_home) </code></pre> <ol start="5"> <li>and finally I tried to edit the <code>onSupportNavigateUp</code> like the following</li> </ol> <pre><code> override fun onSupportNavigateUp(): Boolean { return if(supportFragmentManager.backStackEntryCount &gt; 0){ navController.navigateUp(appBarConfiguration) }else { finish() super.onSupportNavigateUp() } } </code></pre> <p>and this is my last edited code, all this tries not solved the problem</p>
[ { "answer_id": 74184922, "author": "Gaya Touak", "author_id": 16564712, "author_profile": "https://Stackoverflow.com/users/16564712", "pm_score": 0, "selected": false, "text": " android:noHistory=\"true\" \n" }, { "answer_id": 74273853, "author": "Majed Al-Moqbeli", "auth...
2022/10/24
[ "https://Stackoverflow.com/questions/74184353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7639296/" ]
74,184,361
<p>I have map of values. I need to cast Any for some type and then invoke function <code>send()</code></p> <pre><code> fun mapToMessage(map: Map&lt;String, Any&gt;?): (Meesage.() -&gt; Unit)? { if (map.isNullOrEmpty()) { return null } map.forEach { (key, value) -&gt; when (value) { is String -&gt; return { send(key, value) } is Int -&gt; return { send(key, value)} } } } </code></pre> <p>Function <code>mapToMessage()</code> should return lambda like:</p> <pre><code>{ send(key1, value1) send(key2, value2) } </code></pre> <p>but right now return only one Unit. How I can create lambda which contains all units from map?</p>
[ { "answer_id": 74184607, "author": "gpunto", "author_id": 1292745, "author_profile": "https://Stackoverflow.com/users/1292745", "pm_score": 2, "selected": true, "text": "Map" }, { "answer_id": 74185859, "author": "cactustictacs", "author_id": 13598222, "author_profile...
2022/10/24
[ "https://Stackoverflow.com/questions/74184361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14484351/" ]
74,184,366
<p>I have created a sheet in Google Sheets that is basically a form users fill out. They fill in the blanks, then press a button to run a script based on the data. However, no matter how I warn them, they don't exit the last field before clicking the button, and the script perceives that the last field is empty. I have tried letting the script activate another field on the screen, but it doesn't seal in the value before doing that. Is there another command that can force the value to be written to the field?</p>
[ { "answer_id": 74184607, "author": "gpunto", "author_id": 1292745, "author_profile": "https://Stackoverflow.com/users/1292745", "pm_score": 2, "selected": true, "text": "Map" }, { "answer_id": 74185859, "author": "cactustictacs", "author_id": 13598222, "author_profile...
2022/10/24
[ "https://Stackoverflow.com/questions/74184366", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18023252/" ]
74,184,404
<p>I'm trying to send an Activity Feed notification that links to a custom Apps tab. I've seen related posts of people doing this with an &quot;attachment card&quot;. But I'd like to do it with a text nofitication.</p> <p>I've tried formatting the notification's preview text, setting the Content Type to HTML like so:</p> <pre><code>var previewText = new ItemBody { Content = &quot;&lt;HTML CONTENT&gt;&quot;, ContentType = BodyType.Html, }; </code></pre> <p>But got the following error:</p> <blockquote> <p>Microsoft.Graph.ServiceException: 'Code: BadRequest Message: Content Type 'Html' is not supported</p> </blockquote> <p>I'm sending the notification like this:</p> <pre><code>await GraphClient.Users[userId].Teamwork .SendActivityNotification(topic, activity-type, null, previewText, templateParameters) .Request() .PostAsync(); </code></pre> <p>Is there a different way to achieve this?</p>
[ { "answer_id": 74184607, "author": "gpunto", "author_id": 1292745, "author_profile": "https://Stackoverflow.com/users/1292745", "pm_score": 2, "selected": true, "text": "Map" }, { "answer_id": 74185859, "author": "cactustictacs", "author_id": 13598222, "author_profile...
2022/10/24
[ "https://Stackoverflow.com/questions/74184404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11420567/" ]
74,184,414
<p>I'm working on a project with mySQL(8.0.19) The task requires the creation of various tables, with appropriate referential constraints and then filling them with large amounts of data to perform queries and other functions.</p> <p>I've got 2 large CSV files with around 5000+ rows of data. Table B has a Foreign Key pointing to Table A, i.e. when creating Table B:</p> <pre><code>CREATE TABLE B( abc VARCHAR(20), sampleName VARCHAR(20), ... PRIMARY KEY(abc) FOREIGN KEY(sampleName) REFERENCES A(Name) ON DELETE CASCADE ON UPDATE RESTRICT ); </code></pre> <p>Now, the problem I'm encountering is that there are several values for attribute <code>sampleName</code> in the second CSV file, but many of them don't have a corresponding <code>Name</code> in the first CSV file. So I'm encountering a FK constraint error when I attempt to load the data into Table B.</p> <p>I've been searching endlessly for a method in excel to compare two different columns and remove any non-matching values but so far to no avail. One option I have considered is to turn off FK checks completely, load the data into Table 2 and then write up a <code>DELETE</code> query to remove any non-matching values. However, I'd much rather prefer if I could alter my <code>INSERT</code> query in some way so that a tuple is only added when <code>sampleName</code> from CSV2 has an equal value for <code>Name</code> in Table A.</p> <p>Edit: I'm using python to go through the CSVS and add data to my tables, the query is as follows:</p> <pre><code>Q = &quot;INSERT INTO TABLE(a, b, c, d, e) VALUES(%s, %s, %s, %s, %s)&quot; ... #CSV processing into X, MYSQL connection cursor1.execute(Q, X) </code></pre> <p>Any help would be greatly appreciated.</p>
[ { "answer_id": 74184607, "author": "gpunto", "author_id": 1292745, "author_profile": "https://Stackoverflow.com/users/1292745", "pm_score": 2, "selected": true, "text": "Map" }, { "answer_id": 74185859, "author": "cactustictacs", "author_id": 13598222, "author_profile...
2022/10/24
[ "https://Stackoverflow.com/questions/74184414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14453002/" ]
74,184,416
<p>I'm trying to add a button that opens search and keyboard when clicked.</p> <p>Something like this:</p> <p><a href="https://i.stack.imgur.com/vopuf.png" rel="nofollow noreferrer">firststate</a></p> <p><a href="https://i.stack.imgur.com/5Xe1a.png" rel="nofollow noreferrer">nextstate</a></p> <p>But i get an error</p> <pre><code> FocusRequester is not initialized. Here are some possible fixes: 1. Remember the FocusRequester: val focusRequester = remember { FocusRequester() } 2. Did you forget to add a Modifier.focusRequester() ? 3. Are you attempting to request focus during composition? Focus requests should be made in response to some event. Eg Modifier.clickable { focusRequester.requestFocus() } </code></pre> <p>I came to the conclusion that this is due to animatedvisibility because without it everything works. That is, when both the button and the search are initially visible, everything works.</p> <p>I suppose that the cursor has nowhere to stand because it is not immediately updated but I do not know how else to do it</p> <p>My Code:</p> <pre><code>topBar = { TopAppBar( actions = { // val keyboardController = LocalSoftwareKeyboardController.current //val focusRequester = remember { FocusRequester() } var visibleSearchBar by remember { mutableStateOf(false) } var visiblecurrentSearch by remember { mutableStateOf(true) } val state = remember { mutableStateOf(TextFieldValue(&quot;&quot;)) } AnimatedVisibility(visible = visiblecurrentSearch) { IconButton(onClick = { visibleSearchBar = true visiblecurrentSearch = false //focusRequester.requestFocus() //keyboardController?.show() }) { Icon(painter = painterResource(id = R.drawable.ic_baseline_search_24), contentDescription = &quot;search&quot;) } } AnimatedVisibility(visible = visibleSearchBar) { TextField( value = state.value, onValueChange = { value -&gt; state.value = value }, enabled = true, shape = RoundedCornerShape(25.dp), modifier = Modifier //.focusRequester(focusRequester) .fillMaxWidth() .padding(end = 10.dp) .scale(scaleX = 1F, scaleY = 0.9F), textStyle = TextStyle(color = Color.Black), placeholder = { Text( text = &quot;Search&quot;, fontSize = 14.sp, ) }, keyboardActions = KeyboardActions( onDone = { //movie = list } ), leadingIcon = { Icon( Icons.Default.Search, contentDescription = &quot;&quot;, modifier = Modifier .size(20.dp) ) }, trailingIcon = { IconButton( onClick = { state.value = TextFieldValue(&quot;&quot;) = visibleSearchBar = false visiblecurrentSearch = true } ) { Icon( Icons.Default.Close, contentDescription = &quot;&quot;, modifier = Modifier .size(20.dp) ) } }, singleLine = true, colors = TextFieldDefaults.textFieldColors( textColor = Color.Black, cursorColor = Color.Black, leadingIconColor = Color.Black, trailingIconColor = Color.Black, focusedIndicatorColor = Color.Transparent, unfocusedIndicatorColor = Color.Transparent, disabledIndicatorColor = Color.Black ) ) } }, title = { }, navigationIcon = { IconButton(onClick = {}) { Icon(painter = painterResource(id = R.drawable.ic_baseline_menu_24), contentDescription = &quot;menu&quot;) } }, backgroundColor = Color.White, contentColor = Color.Black, elevation = 3.dp ) } </code></pre>
[ { "answer_id": 74190005, "author": "Gabriele Mariotti", "author_id": 2016562, "author_profile": "https://Stackoverflow.com/users/2016562", "pm_score": 2, "selected": true, "text": " val focusRequester = remember { FocusRequester() }\n LaunchedEffect(visibleSearchBar){\n if (...
2022/10/24
[ "https://Stackoverflow.com/questions/74184416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19706999/" ]
74,184,431
<p>So I am curious to when you should return an array to destructure and when you should return an object to destructure with custom hooks in react because as in many cases, I believe they will give you the same results.</p> <pre><code>return [name,age] return {name,age} </code></pre>
[ { "answer_id": 74184596, "author": "Frédéric Perron", "author_id": 9867351, "author_profile": "https://Stackoverflow.com/users/9867351", "pm_score": 2, "selected": false, "text": "[]" }, { "answer_id": 74185299, "author": "adsy", "author_id": 1086398, "author_profile"...
2022/10/24
[ "https://Stackoverflow.com/questions/74184431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20009501/" ]