qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
74,127,206
<p>I have a column aggregation scenario where the result could be longer than 4000 characters, so I am trying to switch from <code>listagg</code> to <code>xmlagg</code>.</p> <p>Here's what I have right now that works as expected:</p> <pre><code>func.listagg(aggregator, separator).within_group(*order_by) </code></pre> <p>However, I couldn't find any examples of <code>xmlagg</code> in <a href="https://docs.sqlalchemy.org/en/14/core/functions.html" rel="nofollow noreferrer">SQLAlchemy documentation</a>. The following snippet</p> <pre><code>func.rtrim(func.xmlagg(func.xmlelement(e, column, separator)).extract('//text()').getclobval(), separator) </code></pre> <p>results in this error, which is understandable:</p> <blockquote> <p>Uncaught error: Neither 'Function' object nor 'Comparator' object has an attribute 'extract'</p> </blockquote> <p>Is the <code>xmlagg</code> supported at all in SQLAlchemy? The version I'm using is 1.4.29.</p>
[ { "answer_id": 74186671, "author": "Jason Seek Well", "author_id": 20324967, "author_profile": "https://Stackoverflow.com/users/20324967", "pm_score": 0, "selected": false, "text": "func.rtrim(func.xmltype(func.extract(func.xmlagg(func.xmlelement(e, column, separator)), '//text()')).getc...
2022/10/19
[ "https://Stackoverflow.com/questions/74127206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/934307/" ]
74,127,212
<p>As stated above, I'm trying to convert data in my dataframe from integer/dbl to numeric but I end up with dbl for both columns.</p> <p><a href="https://i.stack.imgur.com/4mmnW.png" rel="nofollow noreferrer">Original dataset</a></p> <p>Code I'm using to convert to numeric;</p> <pre class="lang-html prettyprint-override"><code>data$price &lt;- as.numeric(data$price) data$lot_size &lt;- as.numeric(data$lot_size) </code></pre> <p>The dataframe I end up with: <a href="https://i.stack.imgur.com/ps8s0.png" rel="nofollow noreferrer">The dataframe I end up with</a></p> <p>Dataset I have been working with: <a href="https://dasl.datadescription.com/datafile/housing-prices-ge19" rel="nofollow noreferrer">https://dasl.datadescription.com/datafile/housing-prices-ge19</a></p>
[ { "answer_id": 74186671, "author": "Jason Seek Well", "author_id": 20324967, "author_profile": "https://Stackoverflow.com/users/20324967", "pm_score": 0, "selected": false, "text": "func.rtrim(func.xmltype(func.extract(func.xmlagg(func.xmlelement(e, column, separator)), '//text()')).getc...
2022/10/19
[ "https://Stackoverflow.com/questions/74127212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17118403/" ]
74,127,217
<p>I have a <code>RichText()</code> widget with a TextSpan containing a String of symbols such as <code>€€€€€€€</code></p> <p>this group of symbol is not considered as one word even thought there is no spacing</p> <p>-&gt; I'd like to avoid a line break to happen between those symbols have to stay together</p> <p>I can't set <code>softWrap: false</code> on <code>RichText</code> as I need a line break somewhere to avoid overflow</p> <pre class="lang-dart prettyprint-override"><code>RichText( text: TextSpan( text: 'Random text hello there Random long text', children: &lt;TextSpan&gt; [ const TextSpan(text: ' · '), TextSpan(text: '€€€€€€€'), ], ), ), </code></pre> <p>can't I set <code>softWrap: false</code> directly on TextSpan or something similar ?</p>
[ { "answer_id": 74163373, "author": "Lalit Fauzdar", "author_id": 8244632, "author_profile": "https://Stackoverflow.com/users/8244632", "pm_score": 1, "selected": false, "text": "TextOverflow.visible" }, { "answer_id": 74166543, "author": "Aifos Si Prahs", "author_id": 191...
2022/10/19
[ "https://Stackoverflow.com/questions/74127217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16516595/" ]
74,127,222
<p>I have to print only error message and remove code number</p> <pre><code>BEGIN IF :MY_TEXT is null THEN raise_application_error(-20001,'Text field cannot be empty') END IF; Exception when others then :MSG := replace(SQLERRM,'^ORA-+:',''); END; </code></pre> <p><strong>Expected output :</strong></p> <pre><code>Text filed cannot be empty </code></pre>
[ { "answer_id": 74127584, "author": "Mahamoutou", "author_id": 13619116, "author_profile": "https://Stackoverflow.com/users/13619116", "pm_score": 2, "selected": true, "text": "DECLARE\nMY_TEXT VARCHAR2(100);\nMSG VARCHAR2(100);\n\nBEGIN\n\nIF MY_TEXT is null THEN \n raise_application_e...
2022/10/19
[ "https://Stackoverflow.com/questions/74127222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19868464/" ]
74,127,232
<p>I am using a code I found in another thread to convert a column from text to number:</p> <pre><code>[E:E].Select With Selection .NumberFormat = &quot;General&quot; .Value = .Value End With </code></pre> <p>This runs in the current tab/sheet I am currently in but my workbook has several tabs and I only want it to run in one sheet. What would I need to add to the code to only run in one specified sheet?</p>
[ { "answer_id": 74127275, "author": "Ike", "author_id": 16578424, "author_profile": "https://Stackoverflow.com/users/16578424", "pm_score": 2, "selected": true, "text": "Dim ws As Worksheet\nSet ws = ThisWorkbook.Worksheets(\"XXXX\") '--> insert your sheets name\n\nDim rg As Range\nSet...
2022/10/19
[ "https://Stackoverflow.com/questions/74127232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14947890/" ]
74,127,247
<p>As the title says, I'm having some issues properly displaying data from a google spreadsheet onto a table in HTML. For context, what my program is supposed to do is: when the button 'New Alert' is pressed, a form pops up that allows for user input. After inputting all the information that the user wants to add, they then press save. The alert is then saved to a google sheet, and the data from that google sheet is displayed on the HTML table.</p> <p>The point I got to before I was stumped was when a user presses save, the alert they created is then saved to the google sheet. I added two additional methods (which I will highlight below), however I believe one of those two is what is stopping the program from executing properly. When I press 'F12' and view the console to check and see what errors are occurring, the two I get are: 1) Uncaught SyntaxError: Unexpected token '{' and 2) Uncaught ReferenceError: init is not defined at onload (userCodeAppPanel:1:18618). I've looked over the program a couple times, and I don't think there is a floating open-bracket, so I believe there is something else wrong with it currently. Shown below is the code:</p> <h2>Web-Portal.gs</h2> <pre><code>//TODO: Adding comments explaining method function doGet(e){ let template = HtmlService.createTemplateFromFile('Index') template.data = getData() return template.evaluate() } //TODO: Adding comments explaining method function include(filename) { return HtmlService.createHtmlOutputFromFile(filename).getContent(); } //TODO: Adding comments explaining method function getData(){ let codeData = locations.getDataRange().getDisplayValues(); codeData.toObject(); let portLoc = Array.from(new Set(codeData.map(el =&gt; el.PORT_LCC))); let railLoc = Array.from(new Set(codeData.map(el =&gt; el.RAIL_LCC))); let weatherLoc = Array.from(new Set(codeData.map(el =&gt; el.WEATHER_LCC))) let out = { portOpLoc: portLoc, railOpLoc: railLoc, weatherLoc: weatherLoc } return JSON.stringify(out); } //TODO: Add comments explaining method function saveAlerts(data){ let sheetData = alerts.getDataRange().getDisplayValues() let keys = sheetData[0] data.forEach(el =&gt; { let temp = [] keys.forEach(key =&gt; { temp.push(el[key]) }) alerts.appendRow(temp) }) } //TODO: Add comments explaining method function getAlerts(){ let data = alerts.getDataRange().getDisplayValues() data.toObject() return data } //TODO: Adding comments explaining method Array.prototype.toObject = function(){ var keys = this.shift(); for(var i = 0; i &lt; this.length; i++){ var temp = {}; for(var j = 0; j &lt; keys.length; j++){ temp[keys[j]] = this[i][j]; } this[i] = temp; } } </code></pre> <h2>JS.html</h2> <pre><code>&lt;script&gt; function init(){ updateAlertLocation() getAlerts() } //TODO: Add comments explaining method function updateAlertLocation(){ let select = document.getElementById('alertSelect') let list = document.getElementById('codeList') let codes = null while(list.firstChild){ list.removeChild(list.firstChild) } if(select.value === 'Port/Vessel Operations'){ codes = data.portOpLoc }else if(select.value === 'Rail Operations' || select.value === 'Rail Disruption'){ codes = data.railOpLoc }else if(select.value === 'Weather'){ codes = data.weatherLoc }else{ return } codes.forEach(code =&gt; { let option = document.createElement('option') option.value = code list.appendChild(option) }) return } //TODO: Add comments explaining method function saveAlert(){ let out = [] //need commas between key/value pairs let controls = { alertSelect: document.getElementById(&quot;alertSelect&quot;), alertLocation: document.getElementById('alertLocation'), alertSubject: document.getElementById('alertSubject'), alertBody: document.getElementById('alertBody'), alertDate: document.getElementById('alertDate'), } if(validateInput(controls)){ let modalSpinner = document.getElementById('modalSpinner') modalSpinner.hidden = false let alertDateFinal = controls.alertDate.value.replace('-','/') alertDate.value === '' ? new Date(alertDateFinal).toLocaleDateString() : new Date(alertDateFinal) //multi word keys need to be enclosed in quotes let record = { 'Alert Type': controls.alertSelect.value, 'Alert Location': controls.alertLocation.value, Subject: controls.alertSubject.value, Details: controls.alertBody.value, Date: alertDateFinal } out.push(record) google.script.run.withSuccessHandler(clearForm).saveAlerts(out) } else{ window.alert('Please Check Input') } } /* TODO: Add comments explaining method Confusion here */ getAlerts(){ let activeAlertSpinner = document.getElementById('activeAlertSpinner') activeAlertSpinner.hidden = false google.script.run.withSuccessHandler(updateAlertList).getAlerts() } //TODO: Add comments explaining method function updateAlertList(data){ let activeAlertSpinner = document.getElementById('activeAlertSpinner') activeAlertSpinner.hidden = true let cols = ['Alert Type', 'Alert Location', 'Alert Subject', 'Alert Details', 'Alert Date'] let table = document.getElementById('alertDateTable') while(table.firstChild){ table.removeChild(table.firstChild) } data.forEach(row =&gt; { let tr = document.createElement('tr') for(let col of cols){ let td = document.createElement('td') td.textContent = row[col] tr.appendChild(td) } table.appendChild(tr) }) } //TODO: Add comments explaining method function clearForm(){ let modal = bootstrap.Modal.getOrCreateInstance(document.getElementById('newDateModal')) let modalSpinner = document.getElementById('modalSpinner') modalSpinner.hidden = true let controls = { alertSelect: document.getElementById(&quot;alertSelect&quot;), alertLocation: document.getElementById('alertLocation'), alertSubject: document.getElementById('alertSubject'), alertBody: document.getElementById('alertBody'), alertDate: document.getElementById('alertDate'), } controls.alertSelect.value = '' controls.alertLocation.value = '' controls.alertSubject.value = '' controls.alertBody.value = '' controls.alertDate.value = '' modal.hide() getAlerts() } //TODO: Add comments explaining method function validateInput(controls){ return ( controls.alertSelect.value != '' &amp;&amp; controls.alertLocation.value != '' &amp;&amp; controls.alertSubject.value != '' &amp;&amp; controls.alertDate.value != '' ) } &lt;/script&gt; </code></pre> <h2>Index.html</h2> <p>The Methods getAlerts() and updateAlertList(data) are the methods I believe to be causing the error</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;base target=&quot;_top&quot;&gt; &lt;!--Inserting bootstraps--&gt; &lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot; integrity=&quot;sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC&quot; crossorigin=&quot;anonymous&quot;&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.0/font/bootstrap-icons.css&quot;&gt; &lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js&quot; integrity=&quot;sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM&quot; crossorigin=&quot;anonymous&quot;&gt; &lt;/script&gt; &lt;!--Inserting styling and javascript code from 'CSS' and 'JS' class --&gt; &lt;script&gt; let data = JSON.parse(&lt;?= data ?&gt;) &lt;/script&gt; &lt;?!= include('CSS') ?&gt; &lt;?!= include('JS') ?&gt; &lt;/head&gt; &lt;!--Inserts 'ONE' logo in top right corner --&gt; &lt;div style=&quot;margin-top: 10px;&quot;&gt; &lt;a class=&quot;navbar-brand&quot;&gt; &lt;img src=&quot;https://drive.google.com/uc?export=download&amp;id=14Fx0en1-Hkmt7STi-asxPXrn7np-egfp&quot; height=&quot;35&quot; width=&quot;70&quot; alt=&quot;&quot;&gt; &lt;/a&gt; &lt;/div&gt; &lt;!--Inserts nav bar that is used for styling purposes--&gt; &lt;nav class=&quot;navbar navbar-expand-lg navbar-dark&quot;&gt; &lt;ul class=&quot;navbar-nav&quot;&gt; &lt;li class=&quot;nav-item&quot;&gt; &lt;a class=&quot;nav-link active&quot; id=&quot;yardText&quot;&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; &lt;body onload=&quot;init()&quot;&gt; &lt;div class=&quot;container-fluid&quot;&gt; &lt;!--Creates the button that opens the form that allows user input--&gt; &lt;div class=&quot;row mb-3 mt-3&quot;&gt; &lt;button type=&quot;button&quot; class=&quot;btn save-btn btn-dark&quot; data-bs-toggle=&quot;modal&quot; data-bs-target=&quot;#newDateModal&quot;&gt;New Alert&lt;/button&gt; &lt;/div&gt; &lt;div class=&quot;modal fade&quot; id=&quot;newDateModal&quot; data-bs-backdrop=&quot;static&quot; tabindex=&quot;-1&quot;&gt; &lt;div class=&quot;modal-dialog modal-dialog-scrollable&quot;&gt; &lt;div class=&quot;modal-content&quot;&gt; &lt;!--Header for the pop up that appears--&gt; &lt;div class=&quot;modal-header&quot;&gt; &lt;h5 class=&quot;modal-title&quot; id=&quot;modalLabel&quot;&gt;Create New Alert&lt;/h5&gt; &lt;button type=&quot;button&quot; class=&quot;btn-close&quot; data-bs-dismiss=&quot;modal&quot;&gt;&lt;/button&gt; &lt;/div&gt; &lt;!--Body of the pop-up menu--&gt; &lt;div class=&quot;modal-body&quot;&gt; &lt;!--First option that allows user input (only allows for three options to be selected)--&gt; &lt;div class=&quot;modalDiv mb-3&quot;&gt; &lt;h5&gt;Alert Type&lt;/h5&gt; &lt;select class=&quot;form-select&quot; id=&quot;alertSelect&quot; onchange=&quot;updateAlertLocation()&quot;&gt; &lt;option value=&quot;Port/Vessel Operations&quot;&gt;Port/Vessel Operations&lt;/option&gt; &lt;option value=&quot;Rail Operations&quot;&gt;Rail Operations&lt;/option&gt; &lt;option value=&quot;Rail Disruption&quot;&gt;Rail Disruption&lt;/option&gt; &lt;option value=&quot;Weather&quot;&gt;Weather&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;!--Depending on user input on the alert type, users selects the address of the location being selected--&gt; &lt;div class=&quot;modalDive mb-3&quot;&gt; &lt;h5&gt;Alert Location&lt;/h5&gt; &lt;div&gt; &lt;input type=&quot;text&quot; list=&quot;codeList&quot; class=&quot;form-control&quot; id=&quot;alertLocation&quot;&gt; &lt;datalist id=&quot;codeList&quot;&gt;&lt;/datalist&gt; &lt;/div&gt; &lt;/div&gt; &lt;!--Subject for the alert--&gt; &lt;div class=&quot;modalDiv mb-3&quot;&gt; &lt;h5&gt;Alert Subject&lt;/h5&gt; &lt;div&gt; &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;alertSubject&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!--Details for data about the alert--&gt; &lt;div class=&quot;modalDiv mb-3&quot;&gt; &lt;h5&gt;Alert Details&lt;/h5&gt; &lt;div&gt; &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;alertBody&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!--User selects date of the alert--&gt; &lt;div class=&quot;modalDiv mb-3&quot;&gt; &lt;h5&gt;Alert Date&lt;/h5&gt; &lt;div&gt; &lt;input type=&quot;date&quot; class=&quot;form-control&quot; id=&quot;alertDate&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;!--Footer for the pop up that appears. Contains save button that saves the alert to the spreadsheet when pressed.--&gt; &lt;div class=&quot;modal-footer&quot;&gt; &lt;div class=&quot;spinner border spinner-border-sm float-start spinColor&quot; id=&quot;modalSpinner&quot; hidden=&quot;true&quot;&gt;&lt;/div&gt; &lt;button type=&quot;button&quot; class=&quot;btn btn-color-grey&quot; data-bs-dismiss=&quot;modal&quot;&gt;Cancel&lt;/button&gt; &lt;button type=&quot;button&quot; class=&quot;btn btn-dark btn-color-magenta&quot; onclick=&quot;saveAlert()&quot;&gt;Save&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;!--Creates table on web app that allows user to see what alerts have been added--&gt; &lt;div class=&quot;row justify-content-left mb-3mt-3&quot;&gt; &lt;div class=&quot;col-6&quot;&gt; &lt;div class=&quot;card&quot;&gt; &lt;div class=&quot;card-header cont-card-header&quot;&gt; All Active Alerts &lt;div class=&quot;spinner-border spinner-border-sm float-end spinColol&quot; id=&quot;activeAlertSpinner&quot; hidden=&quot;true&quot;&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;tableDiv&quot;&gt; &lt;table class=&quot;table table-sm&quot;&gt; &lt;thead style=&quot;position: sticky; top: 0; z-index: 1, background:#FFFFFF&quot;&gt; &lt;tr&gt; &lt;th scope=&quot;col&quot;&gt;Alert Type&lt;/th&gt; &lt;th scope=&quot;col&quot;&gt;Alert Location&lt;/th&gt; &lt;th scope=&quot;col&quot;&gt;Alert Subject&lt;/th&gt; &lt;th scope=&quot;col&quot;&gt;Alert Details&lt;/th&gt; &lt;th scope=&quot;col&quot;&gt;Alert Date&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody id=&quot;alertDateTable&quot;&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <h2>Constants.gs</h2> <pre><code>//Spreadsheet ID for const locations = SpreadsheetApp.openById('1_0zMVU8JHpasH8WbLsSB-w--3HvFNUVwHws33O2b0cs').getSheetByName('Locations'); const alerts = SpreadsheetApp.openById('1_0zMVU8JHpasH8WbLsSB-w--3HvFNUVwHws33O2b0cs').getSheetByName('Alerts'); const keys = ['Alert Type', 'Alert Location', 'Alert Subject', 'Alert Body', 'Alert Details']; </code></pre> <p>I can provide further context as necessary, and can remove or add portions of code as deemed necessary. I've never asked a question regarding a web app before, so I was unsure of what I should and should not be including. Thank you in advance.</p>
[ { "answer_id": 74127596, "author": "Filip Zieliński", "author_id": 11347715, "author_profile": "https://Stackoverflow.com/users/11347715", "pm_score": 0, "selected": false, "text": "getAlerts() {\n let activeAlertSpinner = document.getElementById('activeAlertSpinner')\n activeAlertSpin...
2022/10/19
[ "https://Stackoverflow.com/questions/74127247", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7881518/" ]
74,127,252
<p>Given <code>['RENE','ADRIANA','ANDRES']</code>, I should find all possible pairs.</p> <p>The test gives me the correct output as <code>['ADRIANA-RENE', 'ADRIANA-ANDRES', 'RENE-ANDRES']</code>.</p> <p>I already wrote a code using backtrack recursion, but most of the examples I've seen start from the beginning of the array (as obvious), and so does my solution. <code>['RENE-ADRIANA','RENE-ANDRES','ADRIANA-ANDRES']</code></p> <p>I know they are the same, however, I am afraid my solution would not pass automated tests because it is not exact.</p> <p>I believe they are using some sort of <em>&quot;binary search&quot;</em> starting from the middle and then continuing left before going right, although, I've been unable to write this code myself. I am not aware if there is an algorithm to find the possible combinations from a given array starting from the middle.</p>
[ { "answer_id": 74127596, "author": "Filip Zieliński", "author_id": 11347715, "author_profile": "https://Stackoverflow.com/users/11347715", "pm_score": 0, "selected": false, "text": "getAlerts() {\n let activeAlertSpinner = document.getElementById('activeAlertSpinner')\n activeAlertSpin...
2022/10/19
[ "https://Stackoverflow.com/questions/74127252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15396045/" ]
74,127,256
<p>My git repo is not getting checked out, I am new to python and I don't know why</p> <p>My input arguments are in json and I need to read them and to checkout my git repo</p> <p>Can someone help get what I am doing wrong?</p> <pre><code>class GitCheckout: def parse_json(self, text): self.json_dict = json.loads(text) self.extract_data() def extract_data(self): des = self.json_dict[&quot;dest&quot;] src = self.json_dict[&quot;src&quot;] ver = self.json_dict[&quot;ver&quot;] self.generate_git_cmd(str(des), str(src), str(ver)) def generate_git_cmd(self, des, src, ver): if os.path.isdir(des): stdout = self.run_cmd(['rm', '-rf', des]) print(stdout) else: self.run_cmd(['mkdir', '-p', des]) stdout = self.run_cmd(['git', 'clone', '--no-checkout', src, des]) stdout = self.run_cmd(['--wd', des, 'git', 'checkout', '--detach', ver]) def run_cmd(self, cmd): p = subprocess.run(cmd, shell=True, capture_output=True) p.stdout = p.stdout.decode(&quot;utf-8&quot;) return p.stdout def main(self): obj = GitCheckout() args = sys.argv obj.parse_json(self, args) if __name__ == '__main__': main </code></pre>
[ { "answer_id": 74127596, "author": "Filip Zieliński", "author_id": 11347715, "author_profile": "https://Stackoverflow.com/users/11347715", "pm_score": 0, "selected": false, "text": "getAlerts() {\n let activeAlertSpinner = document.getElementById('activeAlertSpinner')\n activeAlertSpin...
2022/10/19
[ "https://Stackoverflow.com/questions/74127256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15369752/" ]
74,127,263
<p>I am new to .Net and I want to know how I can update the progress bar when I click on the Download Button in a particular row on the DataGrid. Since there's limited sources that address this I don't understand how to achieve this.</p> <pre><code> &lt;DataGrid AutoGenerateColumns=&quot;False&quot; x:Name=&quot;servers&quot; HorizontalAlignment=&quot;Center&quot; Height=&quot;148&quot; Margin=&quot;0,78,0,0&quot; VerticalAlignment=&quot;Top&quot; Width=&quot;772&quot; PreviewMouseDoubleClick=&quot;clientPreview&quot; &gt; &lt;DataGrid.Columns&gt; &lt;DataGridTextColumn Header=&quot;ID&quot; IsReadOnly=&quot;True&quot; Binding=&quot;{Binding Id}&quot; Width=&quot;50&quot;&gt;&lt;/DataGridTextColumn&gt; &lt;DataGridTemplateColumn Header=&quot;Progress&quot; Width=&quot;100&quot;&gt; &lt;DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;ProgressBar Value=&quot;{Binding Progress}&quot; Minimum=&quot;0&quot; Maximum=&quot;100&quot; /&gt; &lt;/DataTemplate&gt; &lt;/DataGridTemplateColumn.CellTemplate&gt; &lt;/DataGridTemplateColumn&gt; &lt;DataGridTemplateColumn Header=&quot;Action&quot; Width=&quot;100&quot;&gt; &lt;DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate &gt; &lt;Button Background=&quot;#FF00FF35&quot; Click=&quot;beginDownload&quot;&gt;Download&lt;/Button&gt; &lt;/DataTemplate&gt; &lt;/DataGridTemplateColumn.CellTemplate&gt; &lt;/DataGridTemplateColumn&gt; &lt;/DataGrid.Columns&gt; &lt;/DataGrid&gt; </code></pre> <p><strong>The Generated DataGrid Looks like this :</strong></p> <p><a href="https://i.stack.imgur.com/vrNOU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vrNOU.png" alt="enter image description here" /></a></p> <p><strong>The BeginDownload Method Looks like this :</strong></p> <pre><code>private void beginDownload(object sender, RoutedEventArgs e) { Clients selected = servers.SelectedItem as Clients; if (selected != null) { if (selected.Id == 0) { MessageBox.Show(&quot;Selected Feild is Empty&quot;, Title = &quot;Empty Feild Selected&quot;); } else { //Update Progess Bar and Other Methods } } else { MessageBox.Show(&quot;Selected Field is Empty&quot;, Title = &quot;Empty Field Selected&quot;); } } </code></pre> <p>I only want to know how I can update the progess bar in a particular row. For example if I put a for loop and update the progress from 0 to 100. How to bind the integer value to the progress bar?</p> <p>Found a Similar problem with no answers -<a href="https://stackoverflow.com/questions/33443527/wpf-datagrid-change-element-in-the-same-row-on-click">Wpf Datagrid change element in the same row on click</a></p>
[ { "answer_id": 74133314, "author": "techshot nextgen", "author_id": 16867730, "author_profile": "https://Stackoverflow.com/users/16867730", "pm_score": 0, "selected": false, "text": "Visual vis;\nprivate void beginDownload(object sender, RoutedEventArgs e)\n{\n Clients selected = serv...
2022/10/19
[ "https://Stackoverflow.com/questions/74127263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16867730/" ]
74,127,320
<p>I have a list of XY coordinates for fixed positions with given Z values that I want to efficiently fill into an XY grid.</p> <p>Example code:</p> <pre><code>x = c(1,1,1,2,2,3,4,5) y = c(1,2,3,2,4,3,5,5) z = rep(10,8) grid = matrix(NA, nrow = max(x), ncol = max(y)) #fill the grid for given combinations of X and Y with Z values for(i in 1:length(x)){ grid[x[i],y[i]] = z[i] } [,1] [,2] [,3] [,4] [,5] [1,] 10 10 10 NA NA [2,] NA 10 NA 10 NA [3,] NA NA 10 NA NA [4,] NA NA NA NA 10 [5,] NA NA NA NA 10 </code></pre> <p>Is there a more efficient way to fill the grid instead of using for-loops?</p> <p>I tried <code>grid[x,y] = z</code> but that didn't work.</p>
[ { "answer_id": 74127422, "author": "Quinten", "author_id": 14282714, "author_profile": "https://Stackoverflow.com/users/14282714", "pm_score": 3, "selected": true, "text": "x = c(1,1,1,2,2,3,4,5)\ny = c(1,2,3,2,2,3,5,5)\nz = rep(10,8)\n\n# Create dataframe of coordinates\ndf <- data.fram...
2022/10/19
[ "https://Stackoverflow.com/questions/74127320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11738400/" ]
74,127,321
<p>In Postman, I am using the <code>pm.test</code> function for writing the assertions.</p> <pre><code>pm.test(&quot;Status code is 200&quot;, function () { pm.response.to.have.status(200); }); </code></pre> <p>I am providing the Test name as <code>Status code is 200</code>. I can write multiple test names but How replicate the same behaviour in Cypress.</p> <p>I tried writing multiple it blocks but <code>Cy.request</code> must be inside of <code>it()</code> block because of this I am unable to write multiple it blocks.</p>
[ { "answer_id": 74127422, "author": "Quinten", "author_id": 14282714, "author_profile": "https://Stackoverflow.com/users/14282714", "pm_score": 3, "selected": true, "text": "x = c(1,1,1,2,2,3,4,5)\ny = c(1,2,3,2,2,3,5,5)\nz = rep(10,8)\n\n# Create dataframe of coordinates\ndf <- data.fram...
2022/10/19
[ "https://Stackoverflow.com/questions/74127321", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20283603/" ]
74,127,325
<p>I am trying to get a new series by calculating 10 to the power of an existing series. I have tried <code>pandas.Series.rpow</code> and <code>numpy.power</code>, but they all show strange results. Here is my code:</p> <pre><code>data = pd.read_csv('Book1.csv', sep=',', header=None, encoding='utf-8') iexp = data.iloc[:, 9] s = pd.Series(10, index=iexp.index) print(s ** iexp) </code></pre> <p><img src="https://i.stack.imgur.com/YbVpy.png" alt="Result of my code" /></p>
[ { "answer_id": 74127417, "author": "WindCheck", "author_id": 9588645, "author_profile": "https://Stackoverflow.com/users/9588645", "pm_score": 0, "selected": false, "text": "data = pd.read_csv('Book1.csv', sep=',', header=None, encoding='utf-8')\niexp = data.iloc[:, 9]\n\ndef power_10(x)...
2022/10/19
[ "https://Stackoverflow.com/questions/74127325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20283607/" ]
74,127,327
<p>In C#, I have a base class <code>Hex</code> where I'm overloading its equality operators like so:</p> <pre><code>public class Hex { #region Equality public static bool operator ==(Hex a, Hex b) { if (a is null) { return b is null; } if (b is null) { return false; } // Two hex instances are equal if their coordinates match return a.Q == b.Q &amp;&amp; a.R == b.R &amp;&amp; a.S == b.S; } public static bool operator !=(Hex a, Hex b) { return !(a == b); } public override bool Equals(object obj) =&gt; obj is Hex x &amp;&amp; this == x; #endregion } </code></pre> <p>I extend the class to hold some extra info:</p> <pre><code>public class HexWithMeta : Hex { public int OwnerId { get; set; } } </code></pre> <p>I then expected the following method to return false, yet it returns true:</p> <pre><code>public bool DoTest() { var h1 = new HexWithMeta(1, 1, -2); var h2 = new HexWithMeta(1, 1, -2); return h1 == h2; } </code></pre> <p>This seems to be because <code>h1 == h2</code> is calling the overloaded <code>==</code> operator on the <code>Hex</code> class. However, I'm comparing <code>HexWithMeta</code> objects, not <code>Hex</code> objects. How can I get <code>==</code> to compare referential equality for classes like <code>HexWithMeta</code> that extend <code>Hex</code>, but use the custom operator code for comparing the base <code>Hex</code> class instances?</p>
[ { "answer_id": 74127503, "author": "MySkullCaveIsADarkPlace", "author_id": 19858830, "author_profile": "https://Stackoverflow.com/users/19858830", "pm_score": 0, "selected": false, "text": "Hex" }, { "answer_id": 74127633, "author": "JonasH", "author_id": 12342238, "a...
2022/10/19
[ "https://Stackoverflow.com/questions/74127327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/178757/" ]
74,127,347
<pre><code> tt&lt;-c(3,2,3,5,3,5,5,4,3,1,5,2,1,5,4,1,3,5,3,3) ff&lt;-matrix(tt,nrow=5) print(ff) print(t(apply(ff,1,sort))) </code></pre> <p>I want to order the second row only by ascending order not all rows, but it always show me all rows.</p>
[ { "answer_id": 74127503, "author": "MySkullCaveIsADarkPlace", "author_id": 19858830, "author_profile": "https://Stackoverflow.com/users/19858830", "pm_score": 0, "selected": false, "text": "Hex" }, { "answer_id": 74127633, "author": "JonasH", "author_id": 12342238, "a...
2022/10/19
[ "https://Stackoverflow.com/questions/74127347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19091727/" ]
74,127,365
<p>How would you create a Python function that takes a string and returns a new string that contains the characters of the given string once each (without repetitions), in the same order, and with their number of repetitions. For example, if the given string is <code>&quot;aaaabbbbccddde&quot;</code>, the result would be <code>&quot;a4b4c2d3e1&quot;</code>.</p>
[ { "answer_id": 74127499, "author": "Rahul K P", "author_id": 4407666, "author_profile": "https://Stackoverflow.com/users/4407666", "pm_score": 0, "selected": false, "text": "set" }, { "answer_id": 74127521, "author": "PlanexDev", "author_id": 19148673, "author_profile...
2022/10/19
[ "https://Stackoverflow.com/questions/74127365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19310613/" ]
74,127,373
<p>I have such code:</p> <pre><code>from sys import getsizeof as sizer test_list = [i for i in range(10)] test_list2 = list([i for i in range(10)]) test_list3 = [] for i in range(10): test_list3.append(i) print(f&quot;&quot;&quot;{sizer(test_list)} bytes: {test_list} {sizer(test_list2)} bytes: {test_list2} {sizer(test_list3)} bytes: {test_list3}&quot;&quot;&quot;) </code></pre> <p>With the next result:</p> <pre><code>184 bytes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 136 bytes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 184 bytes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] </code></pre> <p>The question is: <strong>Why does a list created with <code>list([])</code> weigh less than a list created with just <code>[]</code> or <code>for _ in condition</code>?</strong></p>
[ { "answer_id": 74127495, "author": "matszwecja", "author_id": 9296093, "author_profile": "https://Stackoverflow.com/users/9296093", "pm_score": 2, "selected": false, "text": "for i in range(1):\n test_list.append(i)\n test_list2.append(i)\n test_list3.append(i)\n\n\nprint(f\"\"\...
2022/10/19
[ "https://Stackoverflow.com/questions/74127373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19736205/" ]
74,127,410
<p>although the polygon data conforms to the standard structure, I get an error when I want to add it to the fiware side.</p> <p><a href="https://i.stack.imgur.com/JIT0M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JIT0M.png" alt="enter image description here" /></a></p> <p>The polygons data we use is below;</p> <p>I)</p> <p>{&quot;type&quot;:&quot;Polygon&quot;,&quot;coordinates&quot;:[[[36.2461465,37.0648871],[36.2460744,37.0648355],[36.2459429,37.0647120],[36.2459742,37.0646980],[36.2457908,37.0645057],[36.2459484,37.0644000],[36.2460785,37.0643124],[36.2461040,37.0642925],[36.2462077,37.0642114],[36.2463421,37.0640831],[36.2464975,37.0642173],[36.2463498,37.0640466],[36.2466107,37.0642657],[36.2469810,37.0644730],[36.2474060,37.0642997],[36.2469520,37.0645424],[36.2469766,37.0645626],[36.2479976,37.0640023],[36.2480284,37.0640110],[36.2482431,37.0642928],[36.2482517,37.0642868],[36.2483085,37.0642595],[36.2480964,37.0639710],[36.2481014,37.0639406],[36.2483925,37.0637744],[36.2486570,37.0636293],[36.2487646,37.0638604],[36.2487989,37.0639320],[36.2488132,37.0639655],[36.2488716,37.0640896],[36.2486873,37.0642026],[36.2486031,37.0642577],[36.2485100,37.0643203],[36.2484413,37.0644238],[36.2483143,37.0645177],[36.2481813,37.0646141],[36.2480689,37.0646989],[36.2479859,37.0647609],[36.2477950,37.0648680],[36.2476609,37.0649424],[36.2476550,37.0649478],[36.2477896,37.0651105],[36.2478810,37.0652241],[36.2479723,37.0653378],[36.2481314,37.0655357],[36.2479478,37.0656056],[36.2479601,37.0656207],[36.2478733,37.0656585],[36.2477440,37.0657095],[36.2476484,37.0655959],[36.2476649,37.0655859],[36.2475542,37.0654415],[36.2474549,37.0653053],[36.2473347,37.0651292],[36.2472768,37.0650530],[36.2472231,37.0650896],[36.2465866,37.0654223],[36.2461465,37.0648871]],[[36.2478183,37.0636569],[36.2478183,37.0636569],[36.2478365,37.0636470],[36.2478183,37.0636569]]]}</p> <p>II)</p> <p><a href="https://i.stack.imgur.com/5BMUO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5BMUO.png" alt="enter image description here" /></a></p> <p>{&quot;type&quot;:&quot;Polygon&quot;,&quot;coordinates&quot;:[[[36.2453447,37.0638166],[36.2456068,37.0636280],[36.2457406,37.0635516],[36.2457631,37.0635874],[36.2461758,37.0633492],[36.2461813,37.0633044],[36.2462984,37.0632325],[36.2464379,37.0631695],[36.2467336,37.0630211],[36.2467560,37.0630524],[36.2470796,37.0628950],[36.2473921,37.0627600],[36.2477268,37.0625936],[36.2477325,37.0626071],[36.2478608,37.0625530],[36.2479334,37.0625395],[36.2479896,37.0626289],[36.2481179,37.0625749],[36.2481066,37.0625212],[36.2481569,37.0625211],[36.2482128,37.0625389],[36.2482465,37.0625836],[36.2482578,37.0626328],[36.2482750,37.0627671],[36.2483202,37.0629193],[36.2480245,37.0630498],[36.2475949,37.0632746],[36.2474387,37.0633376],[36.2472769,37.0634230],[36.2471207,37.0634995],[36.2468808,37.0636164],[36.2465963,37.0637827],[36.2463175,37.0639534],[36.2462952,37.0639848],[36.2461662,37.0638239],[36.2459464,37.0640333],[36.2459597,37.0639049],[36.2461662,37.0638239],[36.2462952,37.0639848],[36.2461728,37.0641329],[36.2459387,37.0643170],[36.2457045,37.0644607],[36.2456315,37.0643713],[36.2455532,37.0642045],[36.2454234,37.0639508],[36.2453447,37.0638166]]]}</p> <p>Error;</p> <p><a href="https://i.stack.imgur.com/eKNSf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eKNSf.png" alt="enter image description here" /></a></p> <p>Edit:</p> <p><strong>I solved the problem but I couldn't update here for a while. If there are overlapping lines or drawings such as dots in the Polygon data, it does not allow to add fiware.</strong></p>
[ { "answer_id": 74127495, "author": "matszwecja", "author_id": 9296093, "author_profile": "https://Stackoverflow.com/users/9296093", "pm_score": 2, "selected": false, "text": "for i in range(1):\n test_list.append(i)\n test_list2.append(i)\n test_list3.append(i)\n\n\nprint(f\"\"\...
2022/10/19
[ "https://Stackoverflow.com/questions/74127410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19444539/" ]
74,127,432
<p>I want to select columns and rename them based on the names of the columns which I keep in a separate dataframe.</p> <p>This is the original dataset:</p> <pre><code>df &lt;- tribble( ~year, ~country, ~series1, ~series2, 2003, &quot;USA&quot;, 8, 5, 2004, &quot;USA&quot;, 9, 6, 2005, &quot;USA&quot;, 11, 7, 2006, &quot;USA&quot;, 10, 8 ) </code></pre> <p>I want to select and rename two columns and I want to specify that like this:</p> <pre><code>specs &lt;- tribble( ~old_name, ~new_name, &quot;country&quot;, &quot;region&quot;, &quot;series1&quot;, &quot;gdp_growth&quot; ) </code></pre> <p>I want this result:</p> <pre><code>expected_df &lt;- tribble( ~region, ~gdp_growth, &quot;USA&quot;, 8, &quot;USA&quot;, 9, &quot;USA&quot;, 11, &quot;USA&quot;, 10 ) </code></pre> <p>This does not work:</p> <pre><code>df %&gt;% select(specs$new_name = specs$old_name) </code></pre> <blockquote> <p><code>Error: unexpected '=' in: &quot;df %&gt;% select(specs$new_name =&quot;</code></p> </blockquote>
[ { "answer_id": 74127556, "author": "AndS.", "author_id": 9778513, "author_profile": "https://Stackoverflow.com/users/9778513", "pm_score": 2, "selected": false, "text": "library(tidyverse)\n\n\ndf |>\n rename_with(.cols = specs$old_name, .fn = \\(x) specs$new_name) |>\n select(!!!syms(...
2022/10/19
[ "https://Stackoverflow.com/questions/74127432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4462566/" ]
74,127,451
<p>I am actually working in the &quot;Legal Mentions page&quot; of client site. He would like to display it under a full image (not text) hostend in a external site, but encoded in base64 (not a simple link https://...).</p> <p><code>&lt;img src=&quot;data:image/png;base64,aHR0cHM6Ly9jZG4uc3N0YXRpYy5uZXQvSW1nL3RlYW1zL3RlYW1zLWlsbG8tZnJlZS1zaWRlYmFyLXByb21vLnN2Zz92PTQ3ZmFhNjU5YTA1ZQ==&quot;&gt;</code></p> <p>This is not working...</p> <p><code>&lt;a href=&quot;#&quot; onload='this.href=atob(&quot;aHR0cHM6Ly9jZG4uc3N0YXRpYy5uZXQvSW1nL3RlYW1zL3RlYW1zLWlsbG8tZnJlZS1zaWRlYmFyLXByb21vLnN2Zz92PTQ3ZmFhNjU5YTA1ZQ==&quot;)'&gt;&lt;/a&gt; --&gt;</code></p> <p>This works but it's a link, I don't want this but a loading.</p> <p>I try many things and nothing works for me.</p> <p>Could someone just put me on a track.</p> <p>Thank you !</p>
[ { "answer_id": 74127667, "author": "jps", "author_id": 7329832, "author_profile": "https://Stackoverflow.com/users/7329832", "pm_score": 2, "selected": true, "text": "data:image/png;base64,aHR0cHM6Ly9jZG4uc3N0YXRpYy5uZXQvSW1nL3RlYW1zL3RlYW1zLWlsbG8tZnJlZS1zaWRlYmFyLXByb21vLnN2Zz92PTQ3ZmF...
2022/10/19
[ "https://Stackoverflow.com/questions/74127451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8758625/" ]
74,127,474
<p>Consider some 2d lists:</p> <pre><code>a = [[1,2,3,4], [5,6,7,None]] b = [[1,2,3,4], [5,6,7,8]] </code></pre> <p>How to check if there is at least one <strong>None</strong> in a 2d list?</p> <p>Outputs: deal with a should output a bool value <strong>False</strong>, and b should output <strong>True</strong>.</p> <p>I have no ideas when the list be a 2d list.</p>
[ { "answer_id": 74127529, "author": "Aymen", "author_id": 5165980, "author_profile": "https://Stackoverflow.com/users/5165980", "pm_score": 1, "selected": false, "text": "True" }, { "answer_id": 74127554, "author": "R. Baraiya", "author_id": 13888486, "author_profile":...
2022/10/19
[ "https://Stackoverflow.com/questions/74127474", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19725974/" ]
74,127,477
<p>I'm new to Python and want to perform a rather simple task. I've got a two-dimensional point set, which is stored as binary data (i.e. <code>(x, y)</code>-coordinates) in a file, which I want to visualize. The output should look as in the picture below.</p> <p>However, I'm somehow overwhelmed by the amount of google results on this topic. And many of them seem to be for three-dimensional point cloud visualization and/or a massive amount of data points. So, if anyone could point me to a suitable solution for my problem, I would be really thankful.</p> <p><a href="https://i.stack.imgur.com/Yutt3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Yutt3.png" alt="pointset" /></a></p> <p><strong>EDIT</strong>: The point set is contained in a file which is formatted as follows:</p> <pre><code>0.000000000000000 0.000000000000000 1.000000000000000 1.000000000000000 1 0.020375738732779 0.026169010160356 0.050815740313746 0.023209931647163 0.072530406907906 0.023975230642589 </code></pre> <p>The first data vector is the one in the line below the single &quot;1&quot;; i.e. <code>(0.020375738732779, 0.026169010160356)</code>. How do I read this into a vector in python? I can open the file using <code>f = open(&quot;pointset file&quot;)</code></p>
[ { "answer_id": 74245348, "author": "Omri", "author_id": 11814273, "author_profile": "https://Stackoverflow.com/users/11814273", "pm_score": 3, "selected": false, "text": "import matplotlib.pyplot as plt\n" }, { "answer_id": 74249220, "author": "amirhm", "author_id": 45295...
2022/10/19
[ "https://Stackoverflow.com/questions/74127477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/547231/" ]
74,127,509
<p>How can I make a function that takes in a string, and returns every fourth character in that string? So if the string was, &quot;I Was Told There'd Be cake,&quot; the return would be: &quot;Islh'ek&quot;. Here you can see the &quot;I&quot; is the first letter, then at the fourth index it is &quot;s&quot;. I am not able to make the code for this.</p> <p>This is how I tried to do it:</p> <pre><code>def character(string): for x in range(len(string)): print(character[3:4]) return string = &quot;I Was Told There'd Be Cake&quot; character(string) </code></pre> <p>And closely related to this, I am also wondering how to make a function which takes in a list of strings, looks through it, and then returns the last two character of each word. So if the list was: [&quot;Apple&quot;, &quot;Microsoft&quot;, &quot;Amazon&quot;], the outcome would be: &quot;lefton&quot;</p>
[ { "answer_id": 74127664, "author": "Schnitte", "author_id": 18103012, "author_profile": "https://Stackoverflow.com/users/18103012", "pm_score": 0, "selected": false, "text": "my_string = \"I Was Told There'd Be Cake\"\n\ndef my_function(string):\n result_string = \"\"\n i = 0\n ...
2022/10/19
[ "https://Stackoverflow.com/questions/74127509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20241890/" ]
74,127,516
<p>I'd like to concatenate several values from selects and input fields on a final input field that contain all the values.</p> <p>What I have until now is this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$('#chosen_a').change(function() { $('#ddlNames').val($('#chosen_a option:selected').data('id')); console.log($('#chosen_a option:selected').data('id')); })</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt; &lt;select name="criteria_title" id="chosen_a" data-placeholder="Select Category" class="chzn_z span3 dropDownId chzn-done" style="display: block;"&gt; &lt;option value="" disabled="" selected=""&gt;- First select -&lt;/option&gt; &lt;option value="AAA" data-id="AAA"&gt;AAA&lt;/option&gt; &lt;option value="BBB" data-id="BBB"&gt;BBB&lt;/option&gt; &lt;option value="CCC" data-id="CCC"&gt;CCC&lt;/option&gt; &lt;option value="DDD" data-id="DDD"&gt;DDD&lt;/option&gt; &lt;option value="EEE" data-id="EEE"&gt;EEE&lt;/option&gt; &lt;/select&gt; &lt;input id="Something1" placeholder="Write something"&gt;&lt;/input&gt;&lt;br/&gt; &lt;select name="criteria_title" id="chosen_b" data-placeholder="Select Category" class="chzn_z span3 dropDownId chzn-done" style="display: block;"&gt; &lt;option value="" disabled="" selected=""&gt;- Second select -&lt;/option&gt; &lt;option value="FFF" data-id="FFF"&gt;FFF&lt;/option&gt; &lt;option value="GGG" data-id="GGG"&gt;GGG&lt;/option&gt; &lt;option value="HHH" data-id="HHH"&gt;HHH&lt;/option&gt; &lt;option value="III" data-id="III"&gt;III&lt;/option&gt; &lt;option value="JJJ" data-id="JJJ"&gt;JJJ&lt;/option&gt; &lt;/select&gt; &lt;input id="Something2" placeholder="Write something else"&gt;&lt;/input&gt;&lt;br/&gt; &lt;br&gt;&lt;br&gt; &lt;input maxlength="2600" name="ddlNames" id="ddlNames" onKeyUp="countChar(this)" placeholder="Blocco Note"&gt;&lt;/input&gt;&lt;br/&gt;</code></pre> </div> </div> </p> <p>In effect, I can get the first select option to the input field, but I do not know how to add the rest.</p>
[ { "answer_id": 74127688, "author": "Endrit Haxhaj", "author_id": 1608622, "author_profile": "https://Stackoverflow.com/users/1608622", "pm_score": 1, "selected": false, "text": "$('.getValues').change(function() {\n var values = [];\n $('.getValues').each(function() {\n valu...
2022/10/19
[ "https://Stackoverflow.com/questions/74127516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18009438/" ]
74,127,537
<p>I'm trying to clean up some logic and remove duplicate values in some code and am looking for a way to introduce some very simple lazy-loading to handle settings variables. Something that would work like this:</p> <pre><code>FOO = {'foo': 1} BAR = {'test': FOO['foo'] } # ...complex logic here which ultimately updates the value of Foo['foo']... FOO['foo'] = 2 print(BAR['test']) # Outputs 1 but would like to get 2 </code></pre> <p>Update:</p> <p>My question may not have been clear based on the initial responses. I'm looking to replace the value being set for <code>test</code> in <code>BAR</code> with a lazy-loaded substitute. I know a way I can do this but it seems unnecessarily complex for what it is, I'm wondering if there's a simpler approach.</p> <p>Update #2:</p> <p>Okay, here's a solution that works. Is there any built-in type that can do this out of the box:</p> <pre><code>FOO = {'foo': 1} import types class LazyDict(dict): def __getitem__(self, item): value = super().__getitem__(item) return value if not isinstance(value, types.LambdaType) else value() BAR = LazyDict({ 'test': lambda: FOO['foo'] }) # ...complex logic here which ultimately updates the value of Foo['foo']... FOO['foo'] = 2 print(BAR['test']) # Outputs 2 </code></pre>
[ { "answer_id": 74127698, "author": "jprebys", "author_id": 3268228, "author_profile": "https://Stackoverflow.com/users/3268228", "pm_score": 1, "selected": false, "text": "FOO = {'foo': 1}\nBAR = {'test': lambda: FOO['foo'] }\n\nFOO['foo'] = 2\n\nprint(BAR['test']()) # Outputs 2\n" }, ...
2022/10/19
[ "https://Stackoverflow.com/questions/74127537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38258/" ]
74,127,549
<pre><code>export class ServerComponent implements OnInit { show = false; setTimeout(() =&gt; { this.show = true; }, 2000); constructor(){ } ngOnInit(){ } } </code></pre>
[ { "answer_id": 74127698, "author": "jprebys", "author_id": 3268228, "author_profile": "https://Stackoverflow.com/users/3268228", "pm_score": 1, "selected": false, "text": "FOO = {'foo': 1}\nBAR = {'test': lambda: FOO['foo'] }\n\nFOO['foo'] = 2\n\nprint(BAR['test']()) # Outputs 2\n" }, ...
2022/10/19
[ "https://Stackoverflow.com/questions/74127549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19519475/" ]
74,127,572
<p>I have a table of 200k rows that have 27k distinct person_identifier values in it. On each row there is a 'value' column and a 'complete' column. I am trying to update the 'complete' column to a yes if every single row for a person_identifier has a NOT NULL value.</p> <p>Take this example:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>person id</th> <th>value</th> <th>complete</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>23</td> <td></td> </tr> <tr> <td>1</td> <td>22</td> <td></td> </tr> <tr> <td>1</td> <td>NULL</td> <td></td> </tr> <tr> <td>2</td> <td>88</td> <td></td> </tr> <tr> <td>2</td> <td>22</td> <td></td> </tr> <tr> <td>3</td> <td>46</td> <td></td> </tr> <tr> <td>3</td> <td>78</td> <td></td> </tr> <tr> <td>4</td> <td>NULL</td> <td></td> </tr> <tr> <td>4</td> <td>NULL</td> <td></td> </tr> </tbody> </table> </div> <p>In this example I would want complete to be 'yes' for person 2 and 3, but not for 1 and 4 since they have at least 1 NULL value</p>
[ { "answer_id": 74127698, "author": "jprebys", "author_id": 3268228, "author_profile": "https://Stackoverflow.com/users/3268228", "pm_score": 1, "selected": false, "text": "FOO = {'foo': 1}\nBAR = {'test': lambda: FOO['foo'] }\n\nFOO['foo'] = 2\n\nprint(BAR['test']()) # Outputs 2\n" }, ...
2022/10/19
[ "https://Stackoverflow.com/questions/74127572", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19353552/" ]
74,127,611
<p>I am unsure if this is one of those problems that is impossible or not, in my mind it seems like it should be possible. <em><strong>Edit</strong> - We more or less agree it is impossible</em></p> <p>Given a range specified by two integers (i.e. <code>n1 ... n2</code>), is it possible to create a python generator that yields a random integer from the range WITHOUT repetitions and WITHOUT loading the list of options into memory (i.e. <code>list(range(n1, n2))</code>).</p> <p>Expected usage would be something like this:</p> <pre><code>def random_range_generator(n1, n2): ... gen = random_range_generator(1, 6) for n in gen: print(n) </code></pre> <p>Output:</p> <pre><code>4 1 5 3 2 </code></pre>
[ { "answer_id": 74127698, "author": "jprebys", "author_id": 3268228, "author_profile": "https://Stackoverflow.com/users/3268228", "pm_score": 1, "selected": false, "text": "FOO = {'foo': 1}\nBAR = {'test': lambda: FOO['foo'] }\n\nFOO['foo'] = 2\n\nprint(BAR['test']()) # Outputs 2\n" }, ...
2022/10/19
[ "https://Stackoverflow.com/questions/74127611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8627756/" ]
74,127,636
<p>I have a bash script that does stuff with files that are outputted by a GUI. I have it sleep for some time and if it finds files then it goes back through the loop. However, I want the script to exit if it doesn't find any files after the sleep period but if files are generated during the sleep period then to go back through the loop. But the script gets stuck in the loop to keep sleeping if it doesn't detect any files. My script looks like this:</p> <pre><code>#!/bin/bash current_directory=$(pwd) folder=1 while [ $folder -le 100 ]; do fast5files=$(ls $current_directory/fast5/ | grep &quot;.fast5&quot; | wc -l) if [ $fast5files -ge 1 ] then mkdir $current_directory/fast5/$folder mv $current_directory/fast5/*.fast5 $current_directory/fast5/$folder/ program does something to fast5files here another program does something to fast5files here sleep $1 #variable set by user ((folder++)) elif [ $fast5files -eq 0 ] then echo &quot;Couldn't find enough fast5 files. Waiting for 15 seconds&quot; sleep 15 elif [ $fast5files -eq 0 ] then echo &quot;Exiting script due to not enough fast5 files&quot; exit 1 fi done </code></pre>
[ { "answer_id": 74128008, "author": "Paul Hodges", "author_id": 8656552, "author_profile": "https://Stackoverflow.com/users/8656552", "pm_score": 1, "selected": false, "text": "folder" }, { "answer_id": 74128217, "author": "balder", "author_id": 3075306, "author_profil...
2022/10/19
[ "https://Stackoverflow.com/questions/74127636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20283451/" ]
74,127,649
<p>If you open a link to a YouTube video or channel on a fresh browser you'll get this pop up:</p> <p><a href="https://i.stack.imgur.com/tU8lT.png" rel="nofollow noreferrer">https://i.stack.imgur.com/tU8lT.png</a></p> <p>Is there something you can add to the end (or middle!) of that URL that will automatically skip that page?</p> <p>Use case: I'm automatically displaying a user supplied YouTube like in the built in Unreal 4 web browser and it breaks because this screen now comes up.</p>
[ { "answer_id": 74132453, "author": "Benjamin Loison", "author_id": 7123660, "author_profile": "https://Stackoverflow.com/users/7123660", "pm_score": 1, "selected": false, "text": "REJECT ALL" }, { "answer_id": 74224412, "author": "Elhem Enohpi", "author_id": 10243832, ...
2022/10/19
[ "https://Stackoverflow.com/questions/74127649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20283865/" ]
74,127,660
<p>I am working with Angular 8 for a web app. So I have a backend in which I have implemented some get http call. They all should return an array of objects.</p> <p>My array of object has an interface of this type:</p> <pre><code>export interface MssInterface { operatingroom: number; sessionid: number; specialty: number; day: number; } </code></pre> <p>I have created a mssService.ts to put all the GET together (in the environment.backendURL variable there is the first part of the address: http://localhost4200)</p> <pre><code>export class MssService { mssURL = environment.backendURL + &quot;/api/mss&quot;; constructor(private http: HttpClient) { } getS1(): Observable&lt;MssInterface&gt; { return this.http.get&lt;MssInterface&gt;(this.mssURL + '/uno'); } </code></pre> <p>Then I have a component class in which I am subscribing to the mssService to fetch the data. So i have written my home.component.ts like this:</p> <pre><code>export class HomeComponent implements OnInit { mssData: MssInterface; constructor(public mssService: MssService) mssToDisplayOne() { this.mssService.getS1().subscribe((MSS) =&gt; { this.mssData = MSS; console.log(this.mssData); }); } ... } </code></pre> <p><a href="https://i.stack.imgur.com/kopQk.png" rel="nofollow noreferrer">Here the console.log</a></p> <p>Everything seems to work properly except that when I go to make a *ngFor inside the array of objects in the html code, it doesn’t return anything.</p> <p>home.component.html :</p> <pre><code>&lt;tr *ngFor=&quot;let item of mssData&quot;&gt; &lt;td *ngIf=&quot;item.sessionid %2==1&quot;&gt; {{item.operatingroom}} &lt;/td&gt; &lt;td *ngIf=&quot;item.sessionid %2==0&quot;&gt; {{item.operatingroom}} &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>I have tried to understand why nothing happend doing this thing :</p> <pre><code>&lt;tr *ngFor=&quot;let item of mssData&quot;&gt; &lt;td&gt;{{ item | json}}&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>And with this it displays my entire array of Objects. <a href="https://i.stack.imgur.com/VMHgn.png" rel="nofollow noreferrer">here the displayed object</a></p> <p>So, what Am I doing wrong? Why it can't read inside my array of objects?</p>
[ { "answer_id": 74127704, "author": "Diogo Castelo", "author_id": 15719350, "author_profile": "https://Stackoverflow.com/users/15719350", "pm_score": 0, "selected": false, "text": "mssData: MssInterface[];\n\nconstructor(public mssService: MssService) { }\n\nngOnInit() {\n this.mssServ...
2022/10/19
[ "https://Stackoverflow.com/questions/74127660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15831808/" ]
74,127,729
<p>I have different projects, in some of them it is fairly simple to access configuration items, in others it's not - and I have difficulties finding out why. All are .NET 6 projects.</p> <p>Note I have checked out <a href="https://stackoverflow.com/questions/39231951/how-do-i-access-configuration-in-any-class-in-asp-net-core">some questions</a> that looked similar as well as <a href="https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-6.0" rel="nofollow noreferrer">MS documentation</a> but neither seems to work. Kindly read through my question before flagging it as duplicate.</p> <p><strong>How it works in a Function App:</strong></p> <p>In my <code>Startup.cs</code> file I have this:</p> <pre><code> public override void Configure(IFunctionsHostBuilder builder) { [...] // This is not really relevant but you see how I access configuration settings builder.Services.AddHttpClient(&quot;MyClient&quot;, client =&gt; { client.BaseAddress = new Uri(C.Configuration.GetValue&lt;string&gt;(&quot;BaseAddress&quot;)); client.DefaultRequestHeaders.Add(&quot;Accept&quot;, &quot;application/json&quot;); client.DefaultRequestHeaders.Add(&quot;Authorization&quot;, $&quot;Bearer {C.Configuration.GetValue&lt;string&gt;(&quot;ApiToken&quot;)}&quot;); }); [...] } public override void ConfigureAppConfiguration(IFunctionsConfigurationBuilder builder) { builder.ConfigurationBuilder .SetBasePath(Environment.CurrentDirectory) .AddJsonFile(&quot;local.settings.json&quot;, true) .AddUserSecrets(Assembly.GetExecutingAssembly(), true) .AddEnvironmentVariables() .Build(); } </code></pre> <p>Also, I have a static class <code>C</code> that holds all kinds of constants - as well as the configuration. I post the relevant part as a screenshot on purpose, you'll understand why. <a href="https://i.stack.imgur.com/OKBUD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OKBUD.png" alt="Function app C.cs" /></a></p> <p>So far, so good - in any place of the whole Function App project I can access any configuration setting by using <code>C.Configuration.GetValue&lt;Type&gt;(&quot;setting&quot;)</code>.</p> <p><strong>How it does not work in an App Service</strong></p> <p>Now I have an App Service - and all I want is the exactly same functionality. However, it does not work, <code>Configuration</code> is null. The relevant part of <code>C.cs</code> looks exactly the same: <a href="https://i.stack.imgur.com/hELpN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hELpN.png" alt="App service C.cs" /></a> You'll notice, however, that in one case the line <code>using Microsoft.Extensions.Configuration;</code> is greyed out by VS which means it is considered obsolete, while this is not the case in the Function App <code>C.cs</code>.</p> <p>I assumed this must have something to do with the startup configuration or dependency injection, so I tried to configure it the same way as in the Function App. This is what I added to my <code>Program.cs</code> which obviously is the equivalent to <code>Startup.cs</code> in a Function App:</p> <pre><code>builder.Configuration .SetBasePath(Environment.CurrentDirectory) .AddJsonFile(&quot;appsettings.json&quot;, true) .AddUserSecrets(Assembly.GetExecutingAssembly(), true) .AddEnvironmentVariables() .Build(); ConfigurationManager configuration = builder.Configuration; </code></pre> <p>The configuration is even added as a DI Singleton:</p> <pre><code>builder.Services.AddSingleton&lt;IConfiguration&gt;(configuration); </code></pre> <p>Now you probably ask why I want to have the configuration in that C class when it's there as an injectable singleton. From what I understand the singleton is injected in my Controller classes - but I have lots of other classes that need to get values from the configuration. I am perfectly aware that I could pass down the configuration object to all dependent classes as a parameter in the constructor. This concept of DI is absolutely legit, but I consider it a bit over the top when it comes to configuration items. Just calling</p> <pre><code>`C.Configuration.GetValue&lt;Type&gt;(&quot;setting&quot;)` </code></pre> <p>anywhere in the code seems more convenient and logical to me. Note that C is not a singleton class but rather a static class - and since this works in the Function App, I had hoped it would work in the App service project as well.</p> <p>Anyone can point me in the right direction? Happy to share more code snippets if required.</p>
[ { "answer_id": 74129202, "author": "Isanka Thalagala", "author_id": 9810921, "author_profile": "https://Stackoverflow.com/users/9810921", "pm_score": -1, "selected": false, "text": " public async Task<string> SynchEntitiesOAuthGET(SynchParameterModel model)\n {\n string...
2022/10/19
[ "https://Stackoverflow.com/questions/74127729", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9271486/" ]
74,127,741
<p>I've upgraded my application from Angular 11 to 13. Upgrading from 11 from 12 worked fine, but now I have some problems going from 12 to 13.<br /> If I try to run <code>ng serve</code> or <code>ng build</code> I get the following error:</p> <pre><code>An unhandled exception occurred: NOT SUPPORTED: keyword &quot;id&quot;, use &quot;$id&quot; for schema ID </code></pre> <p>I've upgraded my libraries but I keep getting this error.<br /> This is the error log:</p> <pre><code>[error] Error: NOT SUPPORTED: keyword &quot;id&quot;, use &quot;$id&quot; for schema ID at Object.code ([...]\node_modules\@angular\cli\node_modules\ajv\dist\vocabularies\core\id.js:6:15) at keywordCode ([...]\node_modules\@angular\cli\node_modules\ajv\dist\compile\validate\index.js:454:13) at [...]\node_modules\@angular\cli\node_modules\ajv\dist\compile\validate\index.js:222:17 at CodeGen.code ([...]\node_modules\@angular\cli\node_modules\ajv\dist\compile\codegen\index.js:439:13) at CodeGen.block ([...]\node_modules\@angular\cli\node_modules\ajv\dist\compile\codegen\index.js:568:18) at iterateKeywords ([...]\node_modules\@angular\cli\node_modules\ajv\dist\compile\validate\index.js:219:9) at groupKeywords ([...]\node_modules\@angular\cli\node_modules\ajv\dist\compile\validate\index.js:208:13) at [...]\node_modules\@angular\cli\node_modules\ajv\dist\compile\validate\index.js:192:13 at CodeGen.code ([...]\node_modules\@angular\cli\node_modules\ajv\dist\compile\codegen\index.js:439:13) at CodeGen.block ([...]\node_modules\@angular\cli\node_modules\ajv\dist\compile\codegen\index.js:568:18) </code></pre> <p>and this is my package.json:</p> <pre><code>&quot;dependencies&quot;: { &quot;@angular/animations&quot;: &quot;~13.3.11&quot;, &quot;@angular/cdk&quot;: &quot;^13.3.9&quot;, &quot;@angular/common&quot;: &quot;~13.3.11&quot;, &quot;@angular/compiler&quot;: &quot;~13.3.11&quot;, &quot;@angular/core&quot;: &quot;~13.3.11&quot;, &quot;@angular/flex-layout&quot;: &quot;^12.0.0-beta.34&quot;, &quot;@angular/forms&quot;: &quot;~13.3.11&quot;, &quot;@angular/material&quot;: &quot;^13.3.9&quot;, &quot;@angular/platform-browser&quot;: &quot;~13.3.11&quot;, &quot;@angular/platform-browser-dynamic&quot;: &quot;~13.3.11&quot;, &quot;@angular/router&quot;: &quot;~13.3.11&quot;, &quot;@ngx-translate/core&quot;: &quot;13.0.0&quot;, &quot;@ngx-translate/http-loader&quot;: &quot;^6.0.0&quot;, &quot;mat-currency-format&quot;: &quot;0.0.7&quot;, &quot;ng-inline-svg&quot;: &quot;13.0.0&quot;, &quot;rxjs&quot;: &quot;~6.6.0&quot;, &quot;tslib&quot;: &quot;^2.0.0&quot;, &quot;xml-beautify&quot;: &quot;^1.2.3&quot;, &quot;xml-formatter&quot;: &quot;^2.6.1&quot;, &quot;zone.js&quot;: &quot;~0.11.4&quot; }, &quot;devDependencies&quot;: { &quot;@angular-builders/custom-webpack&quot;: &quot;^11.1.1&quot;, &quot;@angular-devkit/build-angular&quot;: &quot;~13.3.9&quot;, &quot;@angular-eslint/builder&quot;: &quot;~13.5.0&quot;, &quot;@angular-eslint/eslint-plugin&quot;: &quot;~13.5.0&quot;, &quot;@angular-eslint/eslint-plugin-template&quot;: &quot;~13.5.0&quot;, &quot;@angular-eslint/schematics&quot;: &quot;~13.5.0&quot;, &quot;@angular-eslint/template-parser&quot;: &quot;~13.5.0&quot;, &quot;@angular/cli&quot;: &quot;~13.3.9&quot;, &quot;@angular/compiler-cli&quot;: &quot;~13.3.11&quot;, &quot;@types/jasmine&quot;: &quot;~3.6.0&quot;, &quot;@types/node&quot;: &quot;^12.20.55&quot;, &quot;@types/underscore&quot;: &quot;^1.11.3&quot;, &quot;@typescript-eslint/eslint-plugin&quot;: &quot;5.29.0&quot;, &quot;@typescript-eslint/parser&quot;: &quot;5.29.0&quot;, &quot;change-case&quot;: &quot;^4.1.2&quot;, &quot;codelyzer&quot;: &quot;^6.0.0&quot;, &quot;eslint&quot;: &quot;^8.18.0&quot;, &quot;globby&quot;: &quot;^11.0.3&quot;, &quot;initials&quot;: &quot;^3.1.1&quot;, &quot;inquirer&quot;: &quot;^8.0.0&quot;, &quot;jasmine-core&quot;: &quot;~3.6.0&quot;, &quot;jasmine-spec-reporter&quot;: &quot;~5.0.0&quot;, &quot;karma&quot;: &quot;~6.4.1&quot;, &quot;karma-chrome-launcher&quot;: &quot;~3.1.0&quot;, &quot;karma-coverage&quot;: &quot;~2.0.3&quot;, &quot;karma-jasmine&quot;: &quot;~4.0.0&quot;, &quot;karma-jasmine-html-reporter&quot;: &quot;^1.5.0&quot;, &quot;karma-sonarqube-unit-reporter&quot;: &quot;0.0.23&quot;, &quot;protractor&quot;: &quot;~7.0.0&quot;, &quot;sonar-scanner&quot;: &quot;^3.1.0&quot;, &quot;ts-node&quot;: &quot;~8.3.0&quot;, &quot;tslint&quot;: &quot;~6.1.0&quot;, &quot;typescript&quot;: &quot;~4.6.4&quot;, &quot;underscore&quot;: &quot;^1.9.1&quot;, &quot;xml-beautifier&quot;: &quot;^0.4.3&quot; } </code></pre>
[ { "answer_id": 74127819, "author": "Sachila Ranawaka", "author_id": 6428638, "author_profile": "https://Stackoverflow.com/users/6428638", "pm_score": 1, "selected": false, "text": "ng add @angular-eslint/schematics@next\n" } ]
2022/10/19
[ "https://Stackoverflow.com/questions/74127741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11273373/" ]
74,127,744
<p>I used a sample of a csv program to do some tables on Jupiter notebook, I now need to download that sample csv file so I can look at it in excel, is there a way I can download the sample</p> <p>I need to download lf if possible.</p> <p>Here is my code:</p> <pre><code>warnings.filterwarnings(&quot;ignore&quot;) import numpy as np import pandas as pd import io import requests df = pd.read_csv(&quot;diamonds.csv&quot;) lf = df.sample(5000, random_state=999) import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline %config InlineBackend.figure_format = 'retina' plt.style.use(&quot;seaborn&quot;) lf.sample(5000, random_state=999)''' </code></pre>
[ { "answer_id": 74127809, "author": "Shōgun8", "author_id": 9270227, "author_profile": "https://Stackoverflow.com/users/9270227", "pm_score": 1, "selected": false, "text": "import urllib.request\nurllib.request.urlretrieve(\"http://jupyter.com/diamond.csv\", \"diamond.csv\")\n" }, { ...
2022/10/19
[ "https://Stackoverflow.com/questions/74127744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20283917/" ]
74,127,765
<p>First I create a root (A) dataset. Then I created 2 dataset branches derived from root dataset.</p> <p>How do I &quot;merge&quot; these 2 branches to form another dataset ?</p> <p>Basically, the graph looks like an inverted diamond shape.</p>
[ { "answer_id": 74127809, "author": "Shōgun8", "author_id": 9270227, "author_profile": "https://Stackoverflow.com/users/9270227", "pm_score": 1, "selected": false, "text": "import urllib.request\nurllib.request.urlretrieve(\"http://jupyter.com/diamond.csv\", \"diamond.csv\")\n" }, { ...
2022/10/19
[ "https://Stackoverflow.com/questions/74127765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/996659/" ]
74,127,783
<p>I'm trying to calculate pi with the precision of 10 decimal places. And the efficiency has to be the best(speed and memory allocation). The programming language is C in CodeBlocks.</p> <p>I don't want to change the formula I'm using: <a href="https://i.stack.imgur.com/VEf2b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VEf2b.png" alt="enter image description here" /></a></p> <p><strong>Problem</strong>: after a while, the resulting number stops incrementing but the iteration doesn't stop.</p> <p>I'm not sure if this is a math problem or some kind of variable overflow.</p> <p>The resulting number is <strong>3.1415926431</strong> and the number I want to achieve is 3.1415926535. Every time the incrementation stops at this specific number and the iteration continues. Is there a possibility of an overflow or something?</p> <p>Now I'm printing out every thousandth iteration (just the see the process) This will be deleted in the end.</p> <p>notice the <code> a = n; a *= 4 * a;</code> is for memory efficiency, there are more similar cuts I did.</p> <p>code I'm using</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;math.h&gt; #include &lt;time.h&gt; int main(){ double time_spent = 0.0; clock_t begin = clock(); int n=1; double resultNumber= 1; double pi = 3.1415926535; double pi2 = pi / 2; double a; while(1){ a = n; a *= 4 * a; resultNumber *= a / (a - 1); n++; if (fabs(resultNumber - pi2) &lt; pow(10,-10)) break; if (n%1000==0) { printf(&quot;%.10f %d\n&quot;, resultNumber*2, n); } } clock_t end = clock(); time_spent += (double)(end - begin) / CLOCKS_PER_SEC; printf(&quot;The elapsed time is %f seconds&quot;, time_spent); return 0; } </code></pre> <p>You can try it out here: <a href="https://onlinegdb.com/q2Gil1DHdy" rel="nofollow noreferrer">https://onlinegdb.com/q2Gil1DHdy</a></p>
[ { "answer_id": 74127809, "author": "Shōgun8", "author_id": 9270227, "author_profile": "https://Stackoverflow.com/users/9270227", "pm_score": 1, "selected": false, "text": "import urllib.request\nurllib.request.urlretrieve(\"http://jupyter.com/diamond.csv\", \"diamond.csv\")\n" }, { ...
2022/10/19
[ "https://Stackoverflow.com/questions/74127783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20033803/" ]
74,127,794
<p>So I have a irregular dataframe with unnamed columns which looks something like this:</p> <pre><code>Unnamed:0 Unnamed:1 Unnamed:2 Unnamed:3 Unnamed:4 nan nan nan 2022-01-01 nan nan nan nan nan nan nan nan String Name Currency nan nan nan nan nan nan nan nan nan nan nan nan String nan nan nan nan xx A CAD nan nan yy B USD nan nan nan nan nan </code></pre> <p>Basically what I want to do is to find in which column and row the 'String' name is and start the dataframe from there, creating:</p> <pre><code>String Name Currency String nan nan xx A CAD yy B USD nan nan nan </code></pre> <p>My initial thought has been to use <code> locate_row = df.apply(lambda row: row.astype(str).str.contains('String').any(), axis=1)</code> combined with <code> locate_col = df.apply(lambda column: column.astype(str).str.contains('String').any(), axis=0)</code> This gives me series with the rows with the string and column with the string. My main problem is solving this without hardcoding using for eg. <code> iloc[6:, 2:]</code>. Any help to get to the desired dataframe without hardcoding is of great help.</p>
[ { "answer_id": 74127968, "author": "Chris", "author_id": 4718350, "author_profile": "https://Stackoverflow.com/users/4718350", "pm_score": 1, "selected": false, "text": "df = df.dropna(axis=1,how='all').dropna().reset_index(drop=True)\ndf = df.rename(columns=df.iloc[0]).drop(df.index[0])...
2022/10/19
[ "https://Stackoverflow.com/questions/74127794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15478201/" ]
74,127,836
<p>I'm getting an error when trying to submit my app to the Play Store.</p> <p>Your declaration on Play Console says that your app uses advertising ID. Your manifest file doesn't include the com.google.android.gms.permission.AD_ID permission.</p> <p>I've already declared the app permission in my manifest xml file.</p> <pre><code> &lt;uses-permission android:name=&quot;com.google.android.gms.permission.AD_ID&quot;/&gt; </code></pre> <p>The SDK target version is 33, and the admob ads I included is 21.3.0</p> <pre><code> implementation 'com.google.android.gms:play-services-ads:21.3.0' </code></pre> <p>I've follow every step in this link, and it doesn't seem to work. <a href="https://developers.google.com/admob/android/quick-start" rel="nofollow noreferrer">https://developers.google.com/admob/android/quick-start</a></p>
[ { "answer_id": 74231611, "author": "just_user", "author_id": 964887, "author_profile": "https://Stackoverflow.com/users/964887", "pm_score": 1, "selected": false, "text": "<uses-permission android:name=\"com.google.android.gms.permission.AD_ID\"/>" }, { "answer_id": 74348462, ...
2022/10/19
[ "https://Stackoverflow.com/questions/74127836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1391580/" ]
74,127,867
<p>I want to get the &quot;inner offset&quot;, or rather the inner coordinates of a clicked element via the Javascript Click-Event. As you can see in the image, I need the Offset X and Offset Y. Is there any property which gives me this information?</p> <p>Using plain Javascript and the &quot;mousedown&quot; and &quot;mousemove&quot; event.</p> <p><a href="https://i.stack.imgur.com/XTdCH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XTdCH.png" alt="" /></a></p>
[ { "answer_id": 74231611, "author": "just_user", "author_id": 964887, "author_profile": "https://Stackoverflow.com/users/964887", "pm_score": 1, "selected": false, "text": "<uses-permission android:name=\"com.google.android.gms.permission.AD_ID\"/>" }, { "answer_id": 74348462, ...
2022/10/19
[ "https://Stackoverflow.com/questions/74127867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15586879/" ]
74,127,870
<p>I would like to replace a portion of the headers in a fasta file (surrounded by _) using a text file with a key.</p> <pre><code>#fasta file: &gt;mir-2_scf7180000350313_41896 CCATCAGAGTGGTTGTGATGTGGTGCTATTGATTCATATCACAGCCAGCTTTGATGAG &gt;mir-92a-2_scf7180000349939_17298 AGGTGGGGATGGGGGCAATATTTGTGAATGATTAAATTCAAATTGCACTTGTCCCGGCCTGC &gt;mir-279a_scf7180000350374_48557 AATGAGTGGCGGTCTAGTGCACGGTCGATAAAGTTGTGACTAGATCCACACTCATTAAG #key_file.txt scf7180000350313 NW_011929472.1 scf7180000349939 NW_011929473.1 scf7180000350374 NW_011929474.1 #expected result &gt;mir-2_NW_011929472.1_41896 CCATCAGAGTGGTTGTGATGTGGTGCTATTGATTCATATCACAGCCAGCTTTGATGAG &gt;mir-92a-2_NW_011929473.1_17298 AGGTGGGGATGGGGGCAATATTTGTGAATGATTAAATTCAAATTGCACTTGTCCCGGCCTGC &gt;mir-279a_NW_011929474.1_48557 AATGAGTGGCGGTCTAGTGCACGGTCGATAAAGTTGTGACTAGATCCACACTCATTAAG </code></pre>
[ { "answer_id": 74231611, "author": "just_user", "author_id": 964887, "author_profile": "https://Stackoverflow.com/users/964887", "pm_score": 1, "selected": false, "text": "<uses-permission android:name=\"com.google.android.gms.permission.AD_ID\"/>" }, { "answer_id": 74348462, ...
2022/10/19
[ "https://Stackoverflow.com/questions/74127870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9114576/" ]
74,127,877
<p>using this code here:</p> <pre><code>import {useState} from 'react'; const App = () =&gt; { const [isHovering, setIsHovering] = useState(false); const handleMouseOver = () =&gt; { setIsHovering(true); }; const handleMouseOut = () =&gt; { setIsHovering(false); }; return ( &lt;div&gt; &lt;div&gt; &lt;div id=&quot;target&quot; onMouseOver={handleMouseOver} onMouseOut={handleMouseOut}&gt; Hover over me &lt;/div&gt; {isHovering &amp;&amp; ( &lt;div&gt; &lt;h2&gt;Only visible when hovering div&lt;/h2&gt; &lt;/div&gt; )} &lt;/div&gt; &lt;/div&gt; ); }; export default App; </code></pre> <p>I can easily show and hide a div when the mouse is over/out the target div. But, what I need, is that when the mouse is over the target, the target itself disappears, and appears the second div and when the mouse is out of the second div, the target appears again.</p> <p>Here's a codesandbox <a href="https://codesandbox.io/s/thirsty-babycat-e2c1hh?file=/src/App.js" rel="nofollow noreferrer">https://codesandbox.io/s/thirsty-babycat-e2c1hh?file=/src/App.js</a></p> <p>thank you very much</p>
[ { "answer_id": 74127915, "author": "Sachila Ranawaka", "author_id": 6428638, "author_profile": "https://Stackoverflow.com/users/6428638", "pm_score": 2, "selected": true, "text": " {!isHovering && (\n <div\n id=\"target\"\n onMouseOver={handleMouseOver}\n onMou...
2022/10/19
[ "https://Stackoverflow.com/questions/74127877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540456/" ]
74,127,901
<p>My console application needs to access a user's emails, download all the attachements, and process them in some way. The application is running in a scheduled task, and set to run-as the user.</p> <p>I was planning on using Microsoft.Graph, but first I need an access-token, using MSAL.net, but I just don't understand how it works.</p> <pre><code>var tenantId = &quot;xxx-xxx-xxx&quot;; var clientId = &quot;yyy-yyy-yyy&quot;; var clientSecret = &quot;zzz-zzz-zzz&quot;; var scopes = new List&lt;string&gt; { &quot;https://outlook.office365.com/.default&quot; }; var client = PublicClientApplicationBuilder.Create(clientId) //.WithClientSecret(clientSecret) .WithAuthority(new Uri($&quot;https://login.microsoftonline.com/{tenantId}&quot;)) .Build(); var request = client.AcquireTokenByIntegratedWindowsAuth(scopes); var token = request.ExecuteAsync().Result.AccessToken; </code></pre> <p>Using this code gives me the following exception:</p> <blockquote> <p>The request body must contain the following parameter: 'client_assertion' or 'client_secret'.</p> </blockquote> <p>However, the <code>PublicClientApplicationBuilder</code> class does not provide the <code>.WithClientSecret(clientSecret)</code> method. It is available with the <code>ConfidentialClientApplicationBuilder</code> class, but then there is no <code>AcquireTokenByIntegratedWindowsAuth(scopes)</code> method. I could use the <code>.AcquireTokenSilent(scopes, account)</code> method, but how do I get the <code>IAccount</code> required?</p> <p>How do I acquire an access-token without user interaction for the logged-in user?</p> <hr /> <p>(edit)More info:</p> <p>That user/email only exists to receive emails containing new orders that I need to create in our ERP. So every hour, the scheduler launches the application, looks at all the new emails received, download the attachement, and creates the new orders in the ERP.</p> <p>I was using MailKit with username/password, and it worked fine, but now that we need to use modern authentication, it won't log in anymore. That is why I am transition the app to use <code>Microsoft.Graph</code>.</p> <p>I have created the App Registration in Azure, that is where I get the TenantID, ClientID, and ClientSecret.</p>
[ { "answer_id": 74132692, "author": "Glen Scales", "author_id": 1080923, "author_profile": "https://Stackoverflow.com/users/1080923", "pm_score": 1, "selected": false, "text": "var scopes = new List<string> { \"https://outlook.office365.com/.default\" };\n" }, { "answer_id": 74133...
2022/10/19
[ "https://Stackoverflow.com/questions/74127901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/438286/" ]
74,127,910
<p>From this <a href="https://stackoverflow.com/questions/74126381/regex-exercise-word-delimited-by-marker">post</a>, I am able recognize the pattern <code>object.*</code> by use or regex string <code>m/(?&lt;=object\.)\w*</code>. However, since I am unfamiliar with Linux, I cannot use the commands <code>sed</code> or <code>perl</code> properly to extract desired tokens. Thus, I need your help. My best guess is <code>grep -E -n object file.txt | perl -nle 'm/(?&lt;=object\.)\w*/; print $1'</code>.</p>
[ { "answer_id": 74132692, "author": "Glen Scales", "author_id": 1080923, "author_profile": "https://Stackoverflow.com/users/1080923", "pm_score": 1, "selected": false, "text": "var scopes = new List<string> { \"https://outlook.office365.com/.default\" };\n" }, { "answer_id": 74133...
2022/10/19
[ "https://Stackoverflow.com/questions/74127910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19299349/" ]
74,127,935
<p>I need your help to rewrite this so that I wont get memory error.</p> <p>I have two dataframes containing laptops/pc's with their config.</p> <p>DataFrame one called df_original:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>processorName</th> <th>GraphicsCardname</th> <th>ProcessorBrand</th> </tr> </thead> <tbody> <tr> <td>5950x</td> <td>Rtx 3060 ti</td> <td>i7</td> </tr> <tr> <td>3600</td> <td>Rtx 3090</td> <td>i7</td> </tr> <tr> <td>1165g7</td> <td>Rtx 3050</td> <td>i5</td> </tr> </tbody> </table> </div> <p>DataFrame two df_compare:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>processorName</th> <th>GraphicsCardname</th> <th>ProcessorBrand</th> </tr> </thead> <tbody> <tr> <td>5950x</td> <td>Rtx 3090</td> <td>i7</td> </tr> <tr> <td>1165g7</td> <td>Rtx 3060 ti</td> <td>i7</td> </tr> <tr> <td>1165g7</td> <td>Rtx 3050</td> <td>i5</td> </tr> </tbody> </table> </div> <p>What I would like to do is calculate if they are similar. By similar meaning, check each value in the column and compare it to the same column value. For example comparing <strong>5950x</strong> to <strong>1165g7</strong> (processorName). These features has values (weights) for example processorName has a weight of 2.</p> <p>So for each row of df1 I want to check if they have the same config in df2 If yes do nothing, if not add their value to a variable called weight. For example if two rows are the same, only the processorName is differs, then the weight is going to be 2 because processorName has a value of 2.</p> <p>This is what I am doing:</p> <pre><code>values=[] for i, df_orig in enumerate(df_original): values.append([]) for df_comp in df_compare: values[i].append(calculate_values(df_orig, df_comp, columns)) def calculate_values(df_orig, df_comp, columns): weight = 0 for i, c in enumerate(df_orig): if df_comp[i] != c: weight += get_weight(columns[i]) #just gets their so called weight like 2 if they don’t have the same processorName return weight </code></pre> <p><strong>The output for values would be like <code>values = [[2,2,6],[2,4,6] ... ]</code></strong></p> <p>the output <code>values =[ [2,2,6],[2,4,6]...]</code> it means that <code>values[0]</code> is the first row in the df_original <code>values[0][0]</code> is the weight compared first row from df_original and first row from df_compare <code>values[0][1]</code> is the weight from the first row from df_original and the second row from the df_compare and thats how it goes on</p> <p>This 3x for loop is <strong>very slow</strong> and giving me <strong>MemoryError</strong>. I am working with around 200k rows each.</p> <p>Would you mind helping me rewrite this into a faster way?</p> <p>Thanks</p>
[ { "answer_id": 74132692, "author": "Glen Scales", "author_id": 1080923, "author_profile": "https://Stackoverflow.com/users/1080923", "pm_score": 1, "selected": false, "text": "var scopes = new List<string> { \"https://outlook.office365.com/.default\" };\n" }, { "answer_id": 74133...
2022/10/19
[ "https://Stackoverflow.com/questions/74127935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14092472/" ]
74,127,950
<h4>⛰️ Hi comunity,</h4> <p>I'm using a normal MySQL query to join 2 tables.</p> <p>My query in a simpler way looks like these (for these example i just put *, otherwise i have targeted elements)</p> <pre><code>SELECT table1.*, table2.* FROM table1 INNER JOIN table2 ON table1.table1_id = table2.id WHERE table1.user_id = 5 ORDER BY date DESC </code></pre> <p>These code is working fine for me.. but speaking with my CTO he explained me that JOIN is actually joining 2 tables with all the data of all users_ids and then is selecting my asked data in &quot;<em>WHERE table1.user_id = 5</em>&quot;.</p> <p>He asked me to improve the code because when our app reach 50.000 users the database will get bigger so these query will get a long time to load.</p> <p>I tried to move &quot;<em>WHERE table1.user_id = 5</em>&quot; above the INNER JOIN to select first the info i need and then to join it. but didn't work.</p> <p>on these article explaining WHERE <a href="https://www.mysqltutorial.org/mysql-where/" rel="nofollow noreferrer">mysqltutorial.org/mysql-where/</a> they show a query structure different to mine (never saw for me).. I tried out but didn't neither.</p> <p><a href="https://i.stack.imgur.com/uLznY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uLznY.png" alt="enter image description here" /></a></p> <ul> <li>Do you have any sugestions to improve my query?</li> <li>Do you have any articles to read ?</li> </ul> <p>I'm really new to MySQL language </p> <p>Thanks</p>
[ { "answer_id": 74128293, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 2, "selected": false, "text": "FROM" }, { "answer_id": 74129654, "author": "Rick James", "author_id": 1766831, "author_profile"...
2022/10/19
[ "https://Stackoverflow.com/questions/74127950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18019790/" ]
74,127,988
<p>I am having an issue lately with the latest version of geopandas (0.11) that was not present when I run this code some months ago (around April 2022). I am wondering if this is due to a new update on this package.</p> <p>I have a GeoDataframe called <code>shapefile_HD</code> with the following data: heat demand (&quot;HD&quot;), geometry (squares of 1ha each), centroid coordinates (x,y), land area (1ha), gross floor area, and cluster number. I used to use the function &quot;dissolve&quot; to aggregate the cells into polygons with the same cluster number:</p> <p><a href="https://i.stack.imgur.com/fbnMg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fbnMg.png" alt="shapefile_HD" /></a></p> <pre class="lang-py prettyprint-override"><code>dissolve = shapefile_HD.dissolve(by='cluster', as_index=False) </code></pre> <p>In the past, this easily worked, but now I am getting this error:</p> <pre><code>--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) &lt;ipython-input-67-59672e9e6d3a&gt; in &lt;module&gt; ----&gt; 1 dissolve = shapefile_HD.dissolve(by='cluster', as_index=False) 2 dissolve ~/opt/anaconda3/envs/data-visualization-course/lib/python3.8/site-packages/geopandas/geodataframe.py in dissolve(self, by, aggfunc, as_index, level, sort, observed, dropna) 1702 1703 # Process non-spatial component -&gt; 1704 data = self.drop(labels=self.geometry.name, axis=1) 1705 aggregated_data = data.groupby(**groupby_kwargs).agg(aggfunc) 1706 aggregated_data.columns = aggregated_data.columns.to_flat_index() ~/opt/anaconda3/envs/data-visualization-course/lib/python3.8/site-packages/pandas/core/frame.py in drop(self, labels, axis, index, columns, level, inplace, errors) 3988 weight 1.0 0.8 3989 &quot;&quot;&quot; -&gt; 3990 return super().drop( 3991 labels=labels, 3992 axis=axis, ~/opt/anaconda3/envs/data-visualization-course/lib/python3.8/site-packages/pandas/core/generic.py in drop(self, labels, axis, index, columns, level, inplace, errors) 3934 for axis, labels in axes.items(): 3935 if labels is not None: -&gt; 3936 obj = obj._drop_axis(labels, axis, level=level, errors=errors) 3937 3938 if inplace: ~/opt/anaconda3/envs/data-visualization-course/lib/python3.8/site-packages/pandas/core/generic.py in _drop_axis(self, labels, axis, level, errors) 3969 else: 3970 new_axis = axis.drop(labels, errors=errors) -&gt; 3971 result = self.reindex(**{axis_name: new_axis}) 3972 3973 # Case for non-unique axis ~/opt/anaconda3/envs/data-visualization-course/lib/python3.8/site-packages/pandas/util/_decorators.py in wrapper(*args, **kwargs) 225 @wraps(func) 226 def wrapper(*args, **kwargs) -&gt; Callable[..., Any]: --&gt; 227 return func(*args, **kwargs) 228 229 kind = inspect.Parameter.POSITIONAL_OR_KEYWORD ~/opt/anaconda3/envs/data-visualization-course/lib/python3.8/site-packages/pandas/core/frame.py in reindex(self, *args, **kwargs) 3854 kwargs.pop(&quot;axis&quot;, None) 3855 kwargs.pop(&quot;labels&quot;, None) -&gt; 3856 return self._ensure_type(super().reindex(**kwargs)) 3857 3858 def drop( ~/opt/anaconda3/envs/data-visualization-course/lib/python3.8/site-packages/pandas/core/base.py in _ensure_type(self, obj) 91 Used by type checkers. 92 &quot;&quot;&quot; ---&gt; 93 assert isinstance(obj, type(self)), type(obj) 94 return obj 95 AssertionError: &lt;class 'pandas.core.frame.DataFrame'&gt; </code></pre> <p>I tried to install a previous version of geopandas (v10, v9, and v8) and I got this error:</p> <pre><code>The environment is inconsistent, please check the package plan carefully The following packages are causing the inconsistency: - defaults/noarch::sphinx==2.4.0=py_0 - anaconda/osx-64::_anaconda_depends==2020.02=py38_0 - anaconda/osx-64::anaconda==custom=py38_1 - defaults/noarch::anaconda-project==0.8.4=py_0 - defaults/osx-64::anaconda-client==1.7.2=py38_0 - defaults/osx-64::matplotlib==3.1.3=py38_0 - defaults/osx-64::scikit-image==0.16.2=py38h6c726b0_0 - defaults/osx-64::spyder==4.0.1=py38_0 - anaconda/osx-64::scikit-learn==0.22.1=py38h27c97d8_0 - defaults/noarch::numpydoc==0.9.2=py_0 - defaults/osx-64::requests==2.22.0=py38_1 - defaults/noarch::seaborn==0.10.0=py_0 </code></pre>
[ { "answer_id": 74128293, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 2, "selected": false, "text": "FROM" }, { "answer_id": 74129654, "author": "Rick James", "author_id": 1766831, "author_profile"...
2022/10/19
[ "https://Stackoverflow.com/questions/74127988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20283785/" ]
74,127,993
<p>I've created a variable with set_fact which is a dictionary that contains two values of arrays. How do I push new elements to either array?</p> <pre><code>- set_fact: results: &quot;{{ results | default({ 'corrections': [], 'errors': [] }) }}&quot; - name: update errors set_fact: results: &quot;{{ results.errors }} + [some error found]&quot; </code></pre> <p>also tried this and received error <code>unhashable type: 'list'&quot;</code></p> <pre><code>set_fact: results: &quot;{{ results | combine({results.errors : results.errors + ['some error'] }) }}&quot; </code></pre>
[ { "answer_id": 74128230, "author": "Mint", "author_id": 5600930, "author_profile": "https://Stackoverflow.com/users/5600930", "pm_score": 0, "selected": false, "text": "set_fact:\n results: \"{{ results | combine({'errors' : results.errors + ['some error'] }) }}\"\n" }, { "answ...
2022/10/19
[ "https://Stackoverflow.com/questions/74127993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5600930/" ]
74,128,002
<p>I'm trying to get generate a list of users that has the same manager in the Azure AD using the Graph API.</p> <p>Using <code>https://graph.microsoft.com/v1.0/users?$expand=manager($select=id)&amp;$select=userPrincipalName,manager</code> will give be the necessary id for the managers set for the users.</p> <p>I would now like to get all users with a certain manager id. I can't figure out how I use the id from manager field. This query doesn't work, it returns all users.</p> <pre><code>https://graph.microsoft.com/v1.0/users?$expand=manager($select=id;$filter=manager/id eq '&lt;manager id&gt;')&amp;$select=userPrincipalName </code></pre> <p>If I instead have the filter after the select I get the manager object itself since it seems to take <code>manager/id</code> as the <code>id</code> for the manager.</p> <pre><code>https://graph.microsoft.com/v1.0/users?$expand=manager($select=id)&amp;$select=userPrincipalName,manager&amp;$filter=manager/id eq '&lt;manager id&gt;' </code></pre> <p>Any clues?</p>
[ { "answer_id": 74128230, "author": "Mint", "author_id": 5600930, "author_profile": "https://Stackoverflow.com/users/5600930", "pm_score": 0, "selected": false, "text": "set_fact:\n results: \"{{ results | combine({'errors' : results.errors + ['some error'] }) }}\"\n" }, { "answ...
2022/10/19
[ "https://Stackoverflow.com/questions/74128002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11657321/" ]
74,128,004
<p>My problem is I am having this output when I run/refresh my system</p> <p><strong>{user: Array(0)}</strong></p> <p>I use props to send my user info on my other components</p> <p>Here is my <strong>App.js</strong> code</p> <pre><code>function App() { const [user, setUser] = useState([]) const token = localStorage.getItem('mytoken') let navigate = useNavigate() useEffect(() =&gt; { ... .then(result =&gt; setUser(result)) },[token]) return ( &lt;div&gt; &lt;Header user = {user}/&gt; &lt;Routes&gt; &lt;Route&gt; &lt;Route path='/homepage' element = {&lt;UserHomePage user = {user}/&gt;} &gt;&lt;/Route&gt; &lt;/Route&gt; &lt;/Routes&gt; &lt;/div&gt; ); </code></pre> <p>And here is my other <strong>UserHomePage.js</strong></p> <pre><code>function UserHomePage(props) { console.log(props) return ( &lt;div&gt; &lt;/div&gt; ); } </code></pre>
[ { "answer_id": 74128230, "author": "Mint", "author_id": 5600930, "author_profile": "https://Stackoverflow.com/users/5600930", "pm_score": 0, "selected": false, "text": "set_fact:\n results: \"{{ results | combine({'errors' : results.errors + ['some error'] }) }}\"\n" }, { "answ...
2022/10/19
[ "https://Stackoverflow.com/questions/74128004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7597579/" ]
74,128,009
<p>my app is based on tutorial of React-admin and loopback 4 as a backend</p> <p>I'm trying to get the id of the logged in user, the login mechanisms works well but when i try to access the id of the logged in user it remains undefined.</p> <p>in my authProvider, my login function is</p> <pre><code>login: ({ username, password }) =&gt; { const request = new Request( process.env.REACT_APP_API_URL + '/users/login', { method: 'POST', body: JSON.stringify({ email: username, password }), headers: new Headers({ 'Content-Type': 'application/json' }), }, ); return fetch(request) .then((response) =&gt; { if (response.status &lt; 200 || response.status &gt;= 300) { throw new Error(response.statusText); } return response.json(); }) .then((auth) =&gt; { localStorage.setItem( 'auth', JSON.stringify({ ...auth, fullName: username }), ); }) .catch(() =&gt; { throw new Error('Network error'); }); }, </code></pre> <p>and I use this in one component:</p> <pre><code>const CurrentUserId = ({ id }) =&gt; { const { identity, isLoading: identityLoading } = useGetIdentity(); console.log(identity); if (identityLoading) { return &lt;span&gt;Loading...&lt;/span&gt;; } else { // find the user_id from the identity const user_email = identity.fullName; const user_id = identity.id; return &lt;span&gt;id: {user_id}&lt;/span&gt;; } }; </code></pre> <p>but the I console.log returns</p> <pre><code>{id: undefined, fullName: 'xxx@xxxxx.com', avatar: undefined} </code></pre> <p>I followed the instructions presented here <a href="https://marmelab.com/react-admin/AuthProviderWriting.html" rel="nofollow noreferrer">https://marmelab.com/react-admin/AuthProviderWriting.html</a> <a href="https://marmelab.com/react-admin/useGetIdentity.html" rel="nofollow noreferrer">https://marmelab.com/react-admin/useGetIdentity.html</a></p> <p>any ideas how to retrieve the id?</p> <p>thanks a lot</p>
[ { "answer_id": 74139010, "author": "MaxAlex", "author_id": 4850431, "author_profile": "https://Stackoverflow.com/users/4850431", "pm_score": 2, "selected": true, "text": "import jwtDecode from 'jwt-decode' \n...\nfunction saveLBToken({ token } : { token: string }) {\n const decoded = jw...
2022/10/19
[ "https://Stackoverflow.com/questions/74128009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11673293/" ]
74,128,024
<p>Hello I have a button in WooCoommerce. I would like to translate the button. But I can't do that via LocoTranslate or anything else. Is there any PHP function to replace button texts without ID?</p> <p>Here you can see the <a href="https://i.stack.imgur.com/JNfgL.png" rel="nofollow noreferrer">Code</a><br></p> <p>Here you can see the <a href="https://i.stack.imgur.com/Vduqa.png" rel="nofollow noreferrer">button</a> in the frontend</p> <p>Best regards!</p>
[ { "answer_id": 74139010, "author": "MaxAlex", "author_id": 4850431, "author_profile": "https://Stackoverflow.com/users/4850431", "pm_score": 2, "selected": true, "text": "import jwtDecode from 'jwt-decode' \n...\nfunction saveLBToken({ token } : { token: string }) {\n const decoded = jw...
2022/10/19
[ "https://Stackoverflow.com/questions/74128024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20178406/" ]
74,128,033
<p>I have the following dataframe (df) with a column 'date' and 'values'. I am looking for a solution how to create a new dataframe from the variables start_MM_DD and end_MM_DD (month and day). For each year a column with the corresponding values should be created. the data frame &quot;df&quot; can start earlier or data can be missing, depending on how the variables start.</p> <pre><code>import pandas as pd import numpy as np df = pd.DataFrame({'date':pd.date_range(start='2020-01-03', end='2022-01-10')}) df['randNumCol'] = np.random.randint(1, 6, df.shape[0]) start_MM_DD = '01-01' end_MM_DD = '01-15' </code></pre> <p>the new dataframe should look like:</p> <p><a href="https://i.stack.imgur.com/9FDAp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9FDAp.jpg" alt="enter image description here" /></a></p>
[ { "answer_id": 74139010, "author": "MaxAlex", "author_id": 4850431, "author_profile": "https://Stackoverflow.com/users/4850431", "pm_score": 2, "selected": true, "text": "import jwtDecode from 'jwt-decode' \n...\nfunction saveLBToken({ token } : { token: string }) {\n const decoded = jw...
2022/10/19
[ "https://Stackoverflow.com/questions/74128033", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10963057/" ]
74,128,041
<p>I want to get data from IMF.However the API data is limited Therefor I get the data by continent.</p> <p>How to loop the dateframe? (The data can get from &quot;Before loop part&quot;,load data from api) The reference cannot work.https://stackoverflow.com/questions/25284539/loop-over-a-string-variable-in-r</p> <p>Before the loop</p> <pre><code>library(imfr) library(countrycode) data(codelist) country_set &lt;- codelist country_set&lt;- country_set %&gt;% select(country.name.en , iso2c, iso3c, imf, continent, region) %&gt;% filter(!is.na(imf) &amp; !is.na(iso2c)) africa_iso2&lt;- country_set$iso2c[country_set$continent==&quot;Africa&quot;] asia_iso2&lt;- country_set$iso2c[country_set$continent==&quot;Asia&quot;] americas_iso2&lt;- country_set$iso2c[country_set$continent==&quot;Americas&quot;] europe_iso2&lt;- country_set$iso2c[country_set$continent==&quot;Europe&quot;] oceania_iso2&lt;- country_set$iso2c[country_set$continent==&quot;Oceania&quot;] </code></pre> <p>loop part</p> <pre><code>continent &lt;- c(&quot;africa&quot;, &quot;asia&quot;, &quot;americas&quot;,&quot;europe&quot;,&quot;oceania&quot;) for(i in 1:length(continent)){ var &lt;- paste0(&quot;gdp_nsa_xdc_&quot;, continent[i]) var1 &lt;- paste0(continent[i],&quot;_iso2&quot;) [[var]]&lt;- imf_data(database_id = &quot;IFS&quot; , indicator = c(&quot;NGDP_NSA_XDC&quot;),country =[[var1]],start = 2010, end = 2022,return_raw = TRUE) [[var]]&lt;- [[var]]$CompactData$DataSet$Series } </code></pre> <p>data sample is</p> <pre><code>list(CompactData = list(`@xmlns:xsi` = &quot;http://www.w3.org/2001/XMLSchema-instance&quot;, `@xmlns:xsd` = &quot;http://www.w3.org/2001/XMLSchema&quot;, `@xsi:schemaLocation` = &quot;http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message https://registry.sdmx.org/schemas/v2_0/SDMXMessage.xsd http://dataservices.imf.org/compact/IFS http://dataservices.imf.org/compact/IFS.xsd&quot;, `@xmlns` = &quot;http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message&quot;, Header = list(ID = &quot;18e0aeae-09ec-4dfe-ab72-60aa16aaea84&quot;, Test = &quot;false&quot;, Prepared = &quot;2022-10-19T12:02:28&quot;, Sender = list( `@id` = &quot;1C0&quot;, Name = list(`@xml:lang` = &quot;en&quot;, `#text` = &quot;IMF&quot;), Contact = list(URI = &quot;http://www.imf.org&quot;, Telephone = &quot;+ 1 (202) 623-6220&quot;)), Receiver = list(`@id` = &quot;ZZZ&quot;), DataSetID = &quot;IFS&quot;), DataSet = list( `@xmlns` = &quot;http://dataservices.imf.org/compact/IFS&quot;, Series = list(`@FREQ` = &quot;Q&quot;, `@REF_AREA` = &quot;US&quot;, `@INDICATOR` = &quot;NGDP_NSA_XDC&quot;, `@UNIT_MULT` = &quot;6&quot;, `@TIME_FORMAT` = &quot;P3M&quot;, Obs = structure(list( `@TIME_PERIOD` = c(&quot;2020-Q1&quot;, &quot;2020-Q2&quot;, &quot;2020-Q3&quot;, &quot;2020-Q4&quot;, &quot;2021-Q1&quot;, &quot;2021-Q2&quot;, &quot;2021-Q3&quot;, &quot;2021-Q4&quot;, &quot;2022-Q1&quot;, &quot;2022-Q2&quot;), `@OBS_VALUE` = c(&quot;5254152&quot;, &quot;4930197&quot;, &quot;5349433&quot;, &quot;5539370&quot;, &quot;5444406&quot;, &quot;5784816&quot;, &quot;5883177&quot;, &quot;6203369&quot;, &quot;6010733&quot;, &quot;6352982&quot;)), class = &quot;data.frame&quot;, row.names = c(NA, 10L)))))) </code></pre>
[ { "answer_id": 74139010, "author": "MaxAlex", "author_id": 4850431, "author_profile": "https://Stackoverflow.com/users/4850431", "pm_score": 2, "selected": true, "text": "import jwtDecode from 'jwt-decode' \n...\nfunction saveLBToken({ token } : { token: string }) {\n const decoded = jw...
2022/10/19
[ "https://Stackoverflow.com/questions/74128041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14807977/" ]
74,128,069
<p>I have a page with a dynamic table that periodically updates with new data. What I am trying to do is to click on a button and reload the page let's say every 3 seconds until the element from that table appears. I know the xpath of the element I want to appear, but I just can't make it work using the FluentWait. I tried configuring as seen in the code below, but when I'm calling the method it keeps clicking on the button extremly fast disregarding the pollingEvery configuration and without giving the page enough time to fully reload itself. Code can be checked out below.</p> <p>What I am not sure about is the return statement. I don't fully grasp what should it be if I only need to click on a button until that element appears.</p> <p>What am I missing?</p> <pre><code>public void clickButtonUntilElementIsDisplayed(WebElement elementToBeClicked, String xPathOfElementToBeDisplayed){ FluentWait&lt;WebDriver&gt; wait = new FluentWait&lt;&gt;(getDriver()); wait.pollingEvery(Duration.ofSeconds(5)); wait.withTimeout(Duration.ofSeconds(200)); wait.ignoring(NoSuchElementException.class); Function&lt;WebDriver,WebElement&gt; clickUntilAppearance = webDriver -&gt; { while(webDriver.findElements(By.xpath(xPathOfElementToBeDisplayed)).isEmpty()) click(elementToBeClicked); return webDriver.findElement(By.xpath(xPathOfElementToBeDisplayed)); }; wait.until(clickUntilAppearance); } </code></pre> <p>The class in which this method can be found extends Page</p>
[ { "answer_id": 74156714, "author": "Ahamed Abdul Rahman", "author_id": 1681917, "author_profile": "https://Stackoverflow.com/users/1681917", "pm_score": 1, "selected": false, "text": "Function<WebDriver,WebElement> clickUntilAppearance = webDriver -> {\n List<WebElement> tableElements...
2022/10/19
[ "https://Stackoverflow.com/questions/74128069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5205189/" ]
74,128,088
<p>Result view after check [x ]Car 1: checked both</p> <p>[ x]Car 1 [x ]Car 2</p> <p>Code:</p> <p>Component: public $plan_requirement2 = [];</p> <p>View:</p> <pre><code> &lt;label for=&quot;requirement2&quot;&gt; &lt;input type=&quot;checkbox&quot; id = &quot;requirement2&quot; value=&quot;Red car&quot; wire:model=&quot;plan_requirement2&quot;&gt; Car 1 &lt;/label&gt; &lt;label for=&quot;requirement2&quot;&gt; &lt;input type=&quot;checkbox&quot; id = &quot;requirement2&quot; value=&quot;Blue car&quot; wire:model=&quot;plan_requirement2&quot;&gt; Car 2 &lt;/label&gt; </code></pre>
[ { "answer_id": 74134401, "author": "raimondsL", "author_id": 4354065, "author_profile": "https://Stackoverflow.com/users/4354065", "pm_score": 0, "selected": false, "text": "public $plan_requirement2 = [];\n" }, { "answer_id": 74186622, "author": "Abdulmajeed", "author_id...
2022/10/19
[ "https://Stackoverflow.com/questions/74128088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18361951/" ]
74,128,123
<p>How can I in mui/DataGrid custoim filter set value which will be seen in <code>onFilterModelChange</code>?</p> <p>I have code:</p> <pre><code>function MyFilterPanel() { const apiRef = useGridApiContext(); const handleDateChange = () =&gt; { const { state, setState, forceUpdate } = apiRef.current; setState({ filterModel: { items: [{ columnField: 'quantity', operatorValue: '&gt;', value: 10000 }], }, }); }; return ( &lt;DateRangePicker onChange={handleDateChange} /&gt; ); } // and &lt;DataGrid ... filterMode=&quot;server&quot; onFilterModelChange={(newValue) =&gt; { console.log(newValue); }} components={{ FilterPanel: MyFilterPanel, }} /&gt; </code></pre> <p>I have got error:</p> <p><code>TypeError: Cannot read properties of undefined (reading 'columnVisibilityModel') </code></p> <p>EDIT. I added my code to show how I want to use it. <a href="https://codesandbox.io/s/datagrid-forked-2ulvnu" rel="nofollow noreferrer">https://codesandbox.io/s/datagrid-forked-2ulvnu</a></p> <p>How to use that:</p> <ol> <li>Click on <code>...</code></li> <li>Pick Filter</li> <li>Pick date range</li> </ol> <pre><code>import * as React from &quot;react&quot;; import DateRangePicker from &quot;rsuite/DateRangePicker&quot;; import { DataGrid, useGridApiContext } from &quot;@mui/x-data-grid&quot;; import &quot;./ui.css&quot;; // @import &quot;rsuite/dist/rsuite.css&quot;; function DateRangePickerFilterPanel() { const apiRef = useGridApiContext(); const handleDateChange = (value) =&gt; { // I want set here values for previous and next date }; return &lt;DateRangePicker onChange={handleDateChange} /&gt;; } const rows = [ { id: &quot;2020-01-02&quot;, col1: &quot;Hello&quot; }, { id: &quot;2020-01-03&quot;, col1: &quot;MUI X&quot; }, { id: &quot;2020-01-04&quot;, col1: &quot;Material UI&quot; }, { id: &quot;2020-01-05&quot;, col1: &quot;MUI&quot; }, { id: &quot;2020-01-06&quot;, col1: &quot;Joy UI&quot; }, { id: &quot;2020-01-07&quot;, col1: &quot;MUI Base&quot; } ]; const columns = [ { field: &quot;id&quot;, headerName: &quot;DateTime&quot;, type: &quot;dateTime&quot;, width: 150 }, { field: &quot;col1&quot;, headerName: &quot;Column 1&quot;, width: 150 } ]; export default function App() { const [dates, setDates] = React.useState({}); /* const getAllNames = () =&gt; { axiosInstance.get(`${API_PATH}/api/names?startDate=${dates.startDate}&amp;endDate=${dates.endDate}`) .then((response) =&gt; { ... }) .catch((error) =&gt; console.error(`Error: ${error}`)); }; */ return ( &lt;div style={{ height: 300, width: &quot;100%&quot; }}&gt; &lt;DataGrid rows={rows} pagination columns={columns} paginationMode=&quot;server&quot; rowsPerPageOptions={[10]} filterMode=&quot;server&quot; onFilterModelChange={(newValue) =&gt; { // And here I want to get that data to be able // to pas it to backend request or somehow have acces // to it in fucntion App() console.log(newValue); // setDates({ // startDate: newValue[0], // endDate: newValue[1].toISOString() // }); }} components={{ FilterPanel: DateRangePickerFilterPanel }} /&gt; &lt;/div&gt; ); } </code></pre>
[ { "answer_id": 74160206, "author": "Ezra", "author_id": 3877441, "author_profile": "https://Stackoverflow.com/users/3877441", "pm_score": 2, "selected": true, "text": "function DateRangePickerFilterPanel(props) {\n // Instead of handling a date change here, pass the handler in as a prop...
2022/10/19
[ "https://Stackoverflow.com/questions/74128123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6811048/" ]
74,128,133
<p>I need to serve a folder of static files containing HTML and js which I achieve by</p> <pre><code>app.use('/', express.static('./public')); </code></pre> <p>I also need to run a piece of code whenever user enters the site, which I try to accomplish by</p> <p><code>app.get('/', function (req, res) { // Piece of code });</code></p> <p>But the piece of code doesn't executed</p> <p>how to achieve them both</p>
[ { "answer_id": 74160206, "author": "Ezra", "author_id": 3877441, "author_profile": "https://Stackoverflow.com/users/3877441", "pm_score": 2, "selected": true, "text": "function DateRangePickerFilterPanel(props) {\n // Instead of handling a date change here, pass the handler in as a prop...
2022/10/19
[ "https://Stackoverflow.com/questions/74128133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8940457/" ]
74,128,144
<p>I have an activity with 12 Image views in a 3x4 matrix. I want to replace the image and other properties of each ImageView with different resources programmatically. I can't seem to find any way to iterate through the views with a loop so am having to hard code each change. I managed to get the ImageViews into an array which helps but I am hoping there is a better way. I looked at KotlinX.Synthetic and data/view binding but they don't seem to help. E.g to create the ImageView array I have had to do this:</p> <pre><code> var imgArray = arrayOf(findViewById&lt;ImageView&gt;(R.id.img01)) imgArray += findViewById&lt;ImageView&gt;(R.id.img02) imgArray += findViewById&lt;ImageView&gt;(R.id.img03) imgArray += findViewById&lt;ImageView&gt;(R.id.img04) imgArray += findViewById&lt;ImageView&gt;(R.id.img05) imgArray += findViewById&lt;ImageView&gt;(R.id.img06) imgArray += findViewById&lt;ImageView&gt;(R.id.img07) imgArray += findViewById&lt;ImageView&gt;(R.id.img08) imgArray += findViewById&lt;ImageView&gt;(R.id.img09) imgArray += findViewById&lt;ImageView&gt;(R.id.img10) imgArray += findViewById&lt;ImageView&gt;(R.id.img11) imgArray += findViewById&lt;ImageView&gt;(R.id.img12) </code></pre> <p>I was hoping to do something like:</p> <pre><code>var i = 1 for (listView in listViews) { imgArray += findViewById&lt;ImageView&gt;(&quot;R.id.img&quot; + i.tostring()) i++ } </code></pre> <p>But that oviously wont work. Any help would be much appreciated. I have some experience with other languages but new to kotlin/java/android.</p>
[ { "answer_id": 74128285, "author": "Gabe Sechan", "author_id": 1631193, "author_profile": "https://Stackoverflow.com/users/1631193", "pm_score": 1, "selected": false, "text": "val imageViews = listOf(R.id.img1, R.id.img2, R.id.img3).map(findViewById(it)) \n" }, { "answer_id": 741...
2022/10/19
[ "https://Stackoverflow.com/questions/74128144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20284043/" ]
74,128,161
<p>i'm working with MYSQL, and have a problem with group by column that data has to be trimed first. here is my table:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>src</th> <th>dst</th> </tr> </thead> <tbody> <tr> <td>source one</td> <td>some_character1/dst_one-random_value1</td> </tr> <tr> <td>source one</td> <td>some_character1/dst_one-random_value2</td> </tr> <tr> <td>source one</td> <td>some_character2/dst_two-random_value3</td> </tr> <tr> <td>source two</td> <td>some_character4/dst_two-random_value1</td> </tr> <tr> <td>source two</td> <td>some_character4/dst_three-random_value2</td> </tr> <tr> <td>source two</td> <td>some_character2/dst_three-random_value7</td> </tr> </tbody> </table> </div> <p>i want to group by this table into like this :</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>dst_group_by</th> </tr> </thead> <tbody> <tr> <td>dst_one</td> </tr> <tr> <td>dst_two</td> </tr> <tr> <td>dst_three</td> </tr> </tbody> </table> </div> <p>the dst value has 3 section.</p> <p>The first section is seperated by '/', and the last section is seperated by '-'.</p> <p>First section and last section character length is random, and i can determined it. I only want to group by the middle section.</p> <p>Is there any effective query to do that ?</p> <p>Thanks before.</p>
[ { "answer_id": 74128272, "author": "Infos_coope", "author_id": 16446996, "author_profile": "https://Stackoverflow.com/users/16446996", "pm_score": 0, "selected": false, "text": "select src,substring(dst,start_position,substring_length) \ngroup by substring(dst,start_position,substring_le...
2022/10/19
[ "https://Stackoverflow.com/questions/74128161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15240259/" ]
74,128,173
<p>I want to output a range of numbers, and break them out into separate rows:</p> <pre><code>1: ABC-1 - ABC-100 2: ABC-101 - ABC-200 3: ABC-201 - ABC-300 4: ABC-301 - ABC-400 5: ABC-401 - ABC-500 6: ABC-501 - ABC-600 7: ABC-601 - ABC-700 8: ABC-701 - ABC-800 9: ABC-801 - ABC-900 10: ABC-901 - ABC-1000 </code></pre> <p>I did that with this:</p> <pre><code>using System; class Program { static void Main() { int order = 1000; int increment = 100; int rows = order / increment; string prefix = &quot;ABC-&quot;; int startNumber = 1; int startRows = 1; for (int i = 1; i &lt; rows + 1; i++) { int rowIdx = startRows + (i - 1); int startIdx = startNumber + (increment * (i - 1)); int endIdx = increment * i; System.Console.WriteLine($&quot;{rowIdx}: {prefix}{startIdx} - {prefix}{endIdx}&quot;, i); } } } </code></pre> <p>I want to iterate every other row number however, like this:</p> <pre><code>1A: ABC-1 - ABC-100 1B: ABC-101 - ABC-200 2A: ABC-201 - ABC-300 2B: ABC-301 - ABC-400 3A: ABC-401 - ABC-500 3B: ABC-501 - ABC-600 4A: ABC-601 - ABC-700 4B: ABC-701 - ABC-800 5A: ABC-801 - ABC-900 5B: ABC-901 - ABC-1000 </code></pre> <p>It took me a few hours (trying not to look at tutorials/docs) to get the range to iterate, but getting the rows to &quot;skip&quot; stumped me completely.</p> <p>Am I missing something obvious?</p>
[ { "answer_id": 74128272, "author": "Infos_coope", "author_id": 16446996, "author_profile": "https://Stackoverflow.com/users/16446996", "pm_score": 0, "selected": false, "text": "select src,substring(dst,start_position,substring_length) \ngroup by substring(dst,start_position,substring_le...
2022/10/19
[ "https://Stackoverflow.com/questions/74128173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20007308/" ]
74,128,196
<p>Say I have data like this</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th></th> <th>Account</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Kevin (1234567)</td> </tr> <tr> <td>2</td> <td>Buzz (7896345)</td> </tr> <tr> <td>3</td> <td>Snakes (5438761)</td> </tr> <tr> <td>4</td> <td>Marv</td> </tr> <tr> <td>5</td> <td>Harry (9083213)</td> </tr> </tbody> </table> </div> <p>I want to use an if condition to search to see if the account number exists at the end of the name in the account column, if it does split the account number off and put it in a new column, if not pass and go on to the next Account.</p> <p>Something like this although it does not work</p> <pre><code>dataset.loc[dataset.Account.str.contains(r'\(d+')], 'new'=dataset.Account.str.split('',n=1, expand=True) dataset[&quot;Account_Number&quot;] = new[1] </code></pre>
[ { "answer_id": 74128272, "author": "Infos_coope", "author_id": 16446996, "author_profile": "https://Stackoverflow.com/users/16446996", "pm_score": 0, "selected": false, "text": "select src,substring(dst,start_position,substring_length) \ngroup by substring(dst,start_position,substring_le...
2022/10/19
[ "https://Stackoverflow.com/questions/74128196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19899065/" ]
74,128,279
<p>I'd like to display a line graph using R shiny, with data from web-scrapping. I kind of succeed in scrapping with one day, but fail with a date range.</p> <p>The following is my code for one day. I select the date by hard-coding the digits in R console (i.e. 20221018) since I fail to do so in ui:</p> <pre><code>library(dplyr) library(tidyverse) library(purrr) library(shiny) rows &lt;- read_html(&quot;https://www.immd.gov.hk/eng/stat_20221018.html&quot;) %&gt;% html_elements(&quot;.table-passengerTrafficStat tbody tr&quot;) prefixes &lt;- c(&quot;arr&quot;, &quot;dep&quot;) cols &lt;- c(&quot;Hong Kong Residents&quot;, &quot;Mainland Visitors&quot;, &quot;Other Visitors&quot;, &quot;Total&quot;) headers &lt;- c( &quot;Control_Point&quot;, crossing(prefixes, cols) %&gt;% unite(&quot;headers&quot;, 1:2, remove = T) %&gt;% unlist() %&gt;% unname() ) df &lt;- map_dfr(rows, function(x) { x %&gt;% html_elements(&quot;td[headers]&quot;) %&gt;% set_names(headers) %&gt;% html_text() }) %&gt;% filter(Control_Point %in% c(&quot;Airport&quot;)) %&gt;% mutate(across(c(-1), ~ str_replace(.x, &quot;,&quot;, &quot;&quot;) %&gt;% as.integer())) %&gt;% mutate(date = &quot;2022-10-18&quot;) ui &lt;- fluidPage(dataTableOutput(&quot;T&quot;)) server &lt;- function(input, output) { output$T &lt;- renderDataTable({ df }) } shinyApp(ui = ui, server = server) </code></pre> <p><a href="https://i.stack.imgur.com/qwjjK.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qwjjK.jpg" alt="enter image description here" /></a></p> <p>The following is my attempt to expand to a date range. I expect the result will be a data frame:</p> <pre><code>library(rvest) library(dplyr) library(tidyverse) library(purrr) library(shiny) ui &lt;- fluidPage( textInput(&quot;choice_company&quot;, &quot;Enter name of a company&quot;), dateRangeInput( &quot;daterange&quot;, &quot;Date range:&quot;, start = &quot;2022-10-01&quot;, end = Sys.Date() - 1, min = &quot;2022-10-01&quot;, max = Sys.Date() - 1, format = &quot;yyyymmdd&quot;, separator = &quot;/&quot; ), textOutput(&quot;ShowUrl&quot;), hr(), textOutput(&quot;ShowHtml&quot;), dataTableOutput(&quot;T&quot;) ) server &lt;- function(input, output) { prefixes &lt;- c(&quot;arr&quot;, &quot;dep&quot;) cols &lt;- c(&quot;Hong Kong Residents&quot;, &quot;Mainland Visitors&quot;, &quot;Other Visitors&quot;, &quot;Total&quot;) headers &lt;- c( &quot;Control_Point&quot;, crossing(prefixes, cols) %&gt;% unite(&quot;headers&quot;, 1:2, remove = T) %&gt;% unlist() %&gt;% unname() ) theDate &lt;- input$daterange[1] answer &lt;- list() #empty list while (input$theDate &lt;= end) { URL &lt;- reactive({ paste0(&quot;https://www.immd.gov.hk/eng/stat_&quot;, input$theDate, &quot;.html&quot;) }) rows &lt;- read_html(url_data) %&gt;% html_elements(&quot;.table-passengerTrafficStat tbody tr&quot;) df &lt;- map_dfr(rows, function(x) { x %&gt;% html_elements(&quot;td[headers]&quot;) %&gt;% set_names(headers) %&gt;% html_text() }) %&gt;% filter(Control_Point %in% c(&quot;Airport&quot;)) %&gt;% mutate(across(c(-1), ~ str_replace(.x, &quot;,&quot;, &quot;&quot;) %&gt;% as.integer())) %&gt;% mutate(date = input$daterange[1]) answer[[input$daterange[1]]] &lt;- df input$daterange[1] &lt;- input$daterange[1] + 1 Sys.sleep(1) output$T &lt;- renderDataTable({ URL }) } } shinyApp(ui = ui, server = server) </code></pre> <p>This is the complaint message:</p> <blockquote> <p>Warning: Error in $: Can't access reactive value 'daterange' outside of reactive consumer. i Do you need to wrap inside reactive() or observer()? 53: Error in input$daterange : Can't access reactive value 'daterange' outside of reactive consumer. i Do you need to wrap inside reactive() or observer()?</p> </blockquote> <p><strong>1. May I know what the complaint means?</strong></p> <p><strong>2. How to fix the error?</strong></p> <p><strong>3. If possible, how to translate the data to a line graph ?</strong></p> <p>Thank you so much in advance.</p>
[ { "answer_id": 74128272, "author": "Infos_coope", "author_id": 16446996, "author_profile": "https://Stackoverflow.com/users/16446996", "pm_score": 0, "selected": false, "text": "select src,substring(dst,start_position,substring_length) \ngroup by substring(dst,start_position,substring_le...
2022/10/19
[ "https://Stackoverflow.com/questions/74128279", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4225430/" ]
74,128,283
<p>component where I am using the state data</p> <pre><code> const { contentTitles: ContentTitles } = useSelector((state) =&gt; state); const dispatch = useDispatch(); useEffect(() =&gt; { const fetchData = async () =&gt; { const response = await dispatch(getContentTitles()).unwrap(); }; fetchData(); }, [ContentTitles]); </code></pre> <p>slice</p> <pre><code>const contentTitles = JSON.parse(localStorage.getItem(&quot;contentTitles&quot;)); export const getContentTitles = createAsyncThunk(&quot;contenttitles/getContenttitles&quot;, async (thunkAPI) =&gt; { try{ const response = await contentitleService.getContenttitles(); return { contentTitles: response }; } catch (error) { const message = (error.response &amp;&amp; error.response.responsedata &amp;&amp; error.response.responsedata.message) || error.message || error.toString(); thunkAPI.dispatch(setMessage(message)); return thunkAPI.rejectWithValue(); } }); const initialState = contentTitles ? contentTitles : null const contenttitleSlice = createSlice({ name: &quot;contenttitles&quot;, initialState, reducers: (state, action) =&gt; { state.contentTitles = action.payload.contentTitles; } }); const { reducer } = contenttitleSlice; export default reducer; </code></pre> <p>Can anyone tell me that why my data is not getting set to the redux? I am new to the redux and asyncthunk. I can't find the reason of not getting my redux state updated.</p>
[ { "answer_id": 74128470, "author": "Dulaj Ariyaratne", "author_id": 13368318, "author_profile": "https://Stackoverflow.com/users/13368318", "pm_score": 1, "selected": false, "text": "extraReducers" }, { "answer_id": 74137155, "author": "Sharjeel shahid", "author_id": 8765...
2022/10/19
[ "https://Stackoverflow.com/questions/74128283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8765102/" ]
74,128,307
<p>Lets say I selected Funded in drop down list located in C2 than I would like the value of B2 copied to A2</p> <p>There are numbers in the column UPCOMING INCOME and drop down list in the next column. When we choose in drop down Payed (PENDING, PAYED, PAUSED) it should copy the number from the Upcoming income column and paste to column FUNDED. <a href="https://i.stack.imgur.com/fDz9Q.png" rel="nofollow noreferrer">enter image description here</a></p> <p><a href="https://i.stack.imgur.com/fDz9Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fDz9Q.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74129139, "author": "Lofton Gentry", "author_id": 7881518, "author_profile": "https://Stackoverflow.com/users/7881518", "pm_score": 1, "selected": true, "text": "function someFunction(){\n //Gets the spreadsheet with the name you specified\n var ss = SpreadsheetApp.getAc...
2022/10/19
[ "https://Stackoverflow.com/questions/74128307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20284206/" ]
74,128,315
<h5>What I just want to achieve is to be able to get a list with elemnts that aren't repeating</h5> <pre><code>&lt;current state&gt; results = [&quot;Anna&quot;,&quot;Michael&quot;,&quot;Anna&quot;,&quot;Juliet&quot;,&quot;Juliet&quot;, &quot;Anna&quot;] &lt;expectation&gt; results=[&quot;Anna&quot;,&quot;Michael&quot;, &quot;Juliet&quot;] </code></pre>
[ { "answer_id": 74128448, "author": "Shawn Wilcox", "author_id": 12379203, "author_profile": "https://Stackoverflow.com/users/12379203", "pm_score": 1, "selected": false, "text": "results = [\"Anna\",\"Michael\",\"Anna\",\"Juliet\",\"Juliet\", \"Anna\"]\nresults = list(dict.fromkeys(resul...
2022/10/19
[ "https://Stackoverflow.com/questions/74128315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16565535/" ]
74,128,326
<p>We are loading our SVGs from a symbol sheet hosted in our <code>assets/</code> folder and have been rendering them into the application with <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/use" rel="nofollow noreferrer"><code>&lt;use&gt;</code></a>. This works great for SVGs that only define <code>&lt;path&gt;</code>s but we have noticed that any SVGs that have additional <code>&lt;defs&gt;</code> (e.g. clip-path, filters, etc) fail to load in Firefox and Safari. If we instead use the SVG element inline it renders as expected in all browsers. Not knowing much about SVG I am trying to understand what is happening so I can implement the best solution for the team.</p> <p>SVG symbol sheet:</p> <pre><code>&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot;&gt; &lt;defs&gt; &lt;symbol id=&quot;close&quot; fill=&quot;black&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 30 30&quot; width=&quot;30px&quot; height=&quot;30px&quot;&gt; &lt;path d=&quot;M 7 4 C 6.744125 4 6.4879687 4.0974687 6.2929688 4.2929688 L 4.2929688 6.2929688 C 3.9019687 6.6839688 3.9019687 7.3170313 4.2929688 7.7070312 L 11.585938 15 L 4.2929688 22.292969 C 3.9019687 22.683969 3.9019687 23.317031 4.2929688 23.707031 L 6.2929688 25.707031 C 6.6839688 26.098031 7.3170313 26.098031 7.7070312 25.707031 L 15 18.414062 L 22.292969 25.707031 C 22.682969 26.098031 23.317031 26.098031 23.707031 25.707031 L 25.707031 23.707031 C 26.098031 23.316031 26.098031 22.682969 25.707031 22.292969 L 18.414062 15 L 25.707031 7.7070312 C 26.098031 7.3170312 26.098031 6.6829688 25.707031 6.2929688 L 23.707031 4.2929688 C 23.316031 3.9019687 22.682969 3.9019687 22.292969 4.2929688 L 15 11.585938 L 7.7070312 4.2929688 C 7.5115312 4.0974687 7.255875 4 7 4 z&quot; /&gt; &lt;/symbol&gt; &lt;symbol id=&quot;selectingFile&quot; viewBox=&quot;0 0 163 157&quot; fill=&quot;none&quot;&gt;&lt;defs&gt;&lt;filter id=&quot;filter0_d_3067_12751&quot; x=&quot;46.3838&quot; y=&quot;21.7812&quot; width=&quot;107.724&quot; height=&quot;129.292&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;1&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;2&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;filter id=&quot;filter1_d_3067_12751&quot; x=&quot;110.765&quot; y=&quot;28.9346&quot; width=&quot;59.2979&quot; height=&quot;61.8789&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;4&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;10&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;filter id=&quot;filter2_d_3067_12751&quot; x=&quot;37.3975&quot; y=&quot;24.4741&quot; width=&quot;93.4717&quot; height=&quot;117.553&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;1&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;2&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;filter id=&quot;filter3_d_3067_12751&quot; x=&quot;86.252&quot; y=&quot;19.3281&quot; width=&quot;60.5449&quot; height=&quot;58.479&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;4&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;10&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;filter id=&quot;filter4_d_3067_12751&quot; x=&quot;27.4434&quot; y=&quot;6&quot; width=&quot;86.5293&quot; height=&quot;111.329&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;1&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;2&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;filter id=&quot;filter5_d_3067_12751&quot; x=&quot;69.0947&quot; y=&quot;-4.25391&quot; width=&quot;60.7969&quot; height=&quot;56.8706&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;4&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;10&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;filter id=&quot;filter6_d_3067_12751&quot; x=&quot;2.2666&quot; y=&quot;25.5039&quot; width=&quot;100.029&quot; height=&quot;118.25&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;1&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;2&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;filter id=&quot;filter7_d_3067_12751&quot; x=&quot;43.7129&quot; y=&quot;14.8882&quot; width=&quot;62.7393&quot; height=&quot;56.7388&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;4&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;10&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;clipPath id=&quot;clip0_3067_12751&quot;&gt;&lt;rect width=&quot;163&quot; height=&quot;157&quot; fill=&quot;white&quot;/&gt;&lt;/clipPath&gt;&lt;/defs&gt;&lt;g clip-path=&quot;url(#clip0_3067_12751)&quot;&gt;&lt;g filter=&quot;url(#filter0_d_3067_12751)&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; clip-rule=&quot;evenodd&quot; d=&quot;M136.062 41.7522L83.2021 24.8763C82.1499 24.5404 81.0245 25.1211 80.6886 26.1733L50.4794 120.797C50.1435 121.849 50.7241 122.974 51.7764 123.31L122.776 145.977C123.828 146.313 124.953 145.732 125.289 144.68L150.107 66.9437L136.062 41.7522Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;g filter=&quot;url(#filter1_d_3067_12751)&quot;&gt;&lt;path d=&quot;M150.062 66.8135L138.424 45.96C137.571 44.4314 135.305 44.6588 134.773 46.3264L130.859 58.5833C130.524 59.6356 131.104 60.7609 132.156 61.0969L150.062 66.8135Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;g filter=&quot;url(#filter2_d_3067_12751)&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; clip-rule=&quot;evenodd&quot; d=&quot;M107.662 32.408L52.3925 27.4822C51.2923 27.3842 50.3209 28.1966 50.2228 29.2968L41.4053 128.233C41.3073 129.333 42.1197 130.305 43.2199 130.403L117.455 137.019C118.556 137.117 119.527 136.305 119.625 135.204L126.869 53.9244L107.662 32.408Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;g filter=&quot;url(#filter3_d_3067_12751)&quot;&gt;&lt;path d=&quot;M126.797 53.8071L110.885 35.9982C109.719 34.6929 107.557 35.4096 107.402 37.1532L106.26 49.9688C106.162 51.069 106.974 52.0404 108.074 52.1385L126.797 53.8071Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;g filter=&quot;url(#filter4_d_3067_12751)&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; clip-rule=&quot;evenodd&quot; d=&quot;M88.9315 9H33.4434C32.3388 9 31.4434 9.89543 31.4434 11V110.329C31.4434 111.433 32.3388 112.329 33.4434 112.329H107.973C109.078 112.329 109.973 111.433 109.973 110.329V28.7265L88.9315 9Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;g filter=&quot;url(#filter5_d_3067_12751)&quot;&gt;&lt;path d=&quot;M109.891 28.6165L92.462 12.2904C91.1845 11.0937 89.0947 11.9996 89.0947 13.75V26.6165C89.0947 27.721 89.9902 28.6165 91.0947 28.6165H109.891Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;g filter=&quot;url(#filter6_d_3067_12751)&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; clip-rule=&quot;evenodd&quot; d=&quot;M62.8912 28.5039L7.97924 36.4773C6.88614 36.636 6.12867 37.6508 6.28739 38.7439L20.5604 137.042C20.7191 138.135 21.7339 138.892 22.8271 138.734L96.5833 128.024C97.6764 127.865 98.4339 126.85 98.2752 125.757L86.5494 45.0024L62.8912 28.5039Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;g filter=&quot;url(#filter7_d_3067_12751)&quot;&gt;&lt;path d=&quot;M86.4521 44.9049L66.8578 31.2528C65.4216 30.2521 63.4837 31.4488 63.7352 33.1812L65.5841 45.9141C65.7428 47.0072 66.7576 47.7646 67.8507 47.6059L86.4521 44.9049Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/symbol&gt; &lt;/defs&gt; &lt;/svg&gt; </code></pre> <p>index.html:</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;p&gt;External SVG w/ defs&lt;/p&gt; &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt; &lt;use xlink:href=&quot;assets/icons.svg#selectingFile&quot;&gt;&lt;/use&gt; &lt;/svg&gt; &lt;p&gt;External SVG no defs&lt;/p&gt; &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt; &lt;use xlink:href=&quot;assets/icons.svg#close&quot;&gt;&lt;/use&gt; &lt;/svg&gt; &lt;p&gt;Inline SVG w/ defs&lt;/p&gt; &lt;svg id=&quot;selectingFile&quot; viewBox=&quot;0 0 163 157&quot; fill=&quot;none&quot;&gt;&lt;defs&gt;&lt;filter id=&quot;filter0_d_3067_12751&quot; x=&quot;46.3838&quot; y=&quot;21.7812&quot; width=&quot;107.724&quot; height=&quot;129.292&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;1&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;2&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;filter id=&quot;filter1_d_3067_12751&quot; x=&quot;110.765&quot; y=&quot;28.9346&quot; width=&quot;59.2979&quot; height=&quot;61.8789&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;4&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;10&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;filter id=&quot;filter2_d_3067_12751&quot; x=&quot;37.3975&quot; y=&quot;24.4741&quot; width=&quot;93.4717&quot; height=&quot;117.553&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;1&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;2&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;filter id=&quot;filter3_d_3067_12751&quot; x=&quot;86.252&quot; y=&quot;19.3281&quot; width=&quot;60.5449&quot; height=&quot;58.479&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;4&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;10&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;filter id=&quot;filter4_d_3067_12751&quot; x=&quot;27.4434&quot; y=&quot;6&quot; width=&quot;86.5293&quot; height=&quot;111.329&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;1&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;2&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;filter id=&quot;filter5_d_3067_12751&quot; x=&quot;69.0947&quot; y=&quot;-4.25391&quot; width=&quot;60.7969&quot; height=&quot;56.8706&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;4&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;10&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;filter id=&quot;filter6_d_3067_12751&quot; x=&quot;2.2666&quot; y=&quot;25.5039&quot; width=&quot;100.029&quot; height=&quot;118.25&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;1&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;2&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;filter id=&quot;filter7_d_3067_12751&quot; x=&quot;43.7129&quot; y=&quot;14.8882&quot; width=&quot;62.7393&quot; height=&quot;56.7388&quot; filterUnits=&quot;userSpaceOnUse&quot; color-interpolation-filters=&quot;sRGB&quot;&gt;&lt;feFlood flood-opacity=&quot;0&quot; result=&quot;BackgroundImageFix&quot;/&gt;&lt;feColorMatrix in=&quot;SourceAlpha&quot; type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0&quot; result=&quot;hardAlpha&quot;/&gt;&lt;feOffset dy=&quot;4&quot;/&gt;&lt;feGaussianBlur stdDeviation=&quot;10&quot;/&gt;&lt;feComposite in2=&quot;hardAlpha&quot; operator=&quot;out&quot;/&gt;&lt;feColorMatrix type=&quot;matrix&quot; values=&quot;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in2=&quot;BackgroundImageFix&quot; result=&quot;effect1_dropShadow_3067_12751&quot;/&gt;&lt;feBlend mode=&quot;normal&quot; in=&quot;SourceGraphic&quot; in2=&quot;effect1_dropShadow_3067_12751&quot; result=&quot;shape&quot;/&gt;&lt;/filter&gt;&lt;clipPath id=&quot;clip0_3067_12751&quot;&gt;&lt;rect width=&quot;163&quot; height=&quot;157&quot; fill=&quot;white&quot;/&gt;&lt;/clipPath&gt;&lt;/defs&gt;&lt;g clip-path=&quot;url(#clip0_3067_12751)&quot;&gt;&lt;g filter=&quot;url(#filter0_d_3067_12751)&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; clip-rule=&quot;evenodd&quot; d=&quot;M136.062 41.7522L83.2021 24.8763C82.1499 24.5404 81.0245 25.1211 80.6886 26.1733L50.4794 120.797C50.1435 121.849 50.7241 122.974 51.7764 123.31L122.776 145.977C123.828 146.313 124.953 145.732 125.289 144.68L150.107 66.9437L136.062 41.7522Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;g filter=&quot;url(#filter1_d_3067_12751)&quot;&gt;&lt;path d=&quot;M150.062 66.8135L138.424 45.96C137.571 44.4314 135.305 44.6588 134.773 46.3264L130.859 58.5833C130.524 59.6356 131.104 60.7609 132.156 61.0969L150.062 66.8135Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;g filter=&quot;url(#filter2_d_3067_12751)&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; clip-rule=&quot;evenodd&quot; d=&quot;M107.662 32.408L52.3925 27.4822C51.2923 27.3842 50.3209 28.1966 50.2228 29.2968L41.4053 128.233C41.3073 129.333 42.1197 130.305 43.2199 130.403L117.455 137.019C118.556 137.117 119.527 136.305 119.625 135.204L126.869 53.9244L107.662 32.408Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;g filter=&quot;url(#filter3_d_3067_12751)&quot;&gt;&lt;path d=&quot;M126.797 53.8071L110.885 35.9982C109.719 34.6929 107.557 35.4096 107.402 37.1532L106.26 49.9688C106.162 51.069 106.974 52.0404 108.074 52.1385L126.797 53.8071Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;g filter=&quot;url(#filter4_d_3067_12751)&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; clip-rule=&quot;evenodd&quot; d=&quot;M88.9315 9H33.4434C32.3388 9 31.4434 9.89543 31.4434 11V110.329C31.4434 111.433 32.3388 112.329 33.4434 112.329H107.973C109.078 112.329 109.973 111.433 109.973 110.329V28.7265L88.9315 9Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;g filter=&quot;url(#filter5_d_3067_12751)&quot;&gt;&lt;path d=&quot;M109.891 28.6165L92.462 12.2904C91.1845 11.0937 89.0947 11.9996 89.0947 13.75V26.6165C89.0947 27.721 89.9902 28.6165 91.0947 28.6165H109.891Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;g filter=&quot;url(#filter6_d_3067_12751)&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; clip-rule=&quot;evenodd&quot; d=&quot;M62.8912 28.5039L7.97924 36.4773C6.88614 36.636 6.12867 37.6508 6.28739 38.7439L20.5604 137.042C20.7191 138.135 21.7339 138.892 22.8271 138.734L96.5833 128.024C97.6764 127.865 98.4339 126.85 98.2752 125.757L86.5494 45.0024L62.8912 28.5039Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;g filter=&quot;url(#filter7_d_3067_12751)&quot;&gt;&lt;path d=&quot;M86.4521 44.9049L66.8578 31.2528C65.4216 30.2521 63.4837 31.4488 63.7352 33.1812L65.5841 45.9141C65.7428 47.0072 66.7576 47.7646 67.8507 47.6059L86.4521 44.9049Z&quot; fill=&quot;white&quot;/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Unfortunately, I can't post a snippet due to the external file requirement, but downloading these two files locally and serving from a web server reproduces the issue. Any advice/recommendations would be helpful.</p>
[ { "answer_id": 74165503, "author": "morganney", "author_id": 258174, "author_profile": "https://Stackoverflow.com/users/258174", "pm_score": 2, "selected": false, "text": "symbol" }, { "answer_id": 74173265, "author": "herrstrietzel", "author_id": 15015675, "author_pr...
2022/10/19
[ "https://Stackoverflow.com/questions/74128326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/702638/" ]
74,128,344
<p>I have a branch protection to my test branch, but i need to execute every pull request merged a action to update the version of the software and commit in the test branch.</p> <p>Even with the tag <em>--force</em> the error appear:</p> <pre class="lang-bash prettyprint-override"><code>INPUT_TAGGING_MESSAGE: No tagging message supplied. No tag will be added. INPUT_PUSH_OPTIONS: --force remote: error: GH006: Protected branch update failed for refs/heads/test. remote: error: Changes must be made through a pull request. ! [remote rejected] HEAD -&gt; test (protected branch hook declined) error: failed to push some refs to 'https://github.com/***/***' Error: Invalid status code: 1 at ChildProcess.&lt;anonymous&gt; (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/index.js:17:19) at ChildProcess.emit (node:events:390:28) at maybeClose (node:internal/child_process:1064:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) { code: 1 } Error: Invalid status code: 1 at ChildProcess.&lt;anonymous&gt; (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/index.js:17:19) at ChildProcess.emit (node:events:390:28) at maybeClose (node:internal/child_process:1064:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) </code></pre> <p>I allowed everyone to push with force in this branch: <a href="https://i.stack.imgur.com/FaBT9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FaBT9.png" alt="enter image description here" /></a></p> <p>My workflow action:</p> <pre class="lang-yaml prettyprint-override"><code>name: Version Update on: pull_request: branches: - master - test types: [closed] jobs: version_update: runs-on: ubuntu-latest if: github.event.pull_request.merged == true steps: - uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e with: php-version: '8.1' - name: Get branch name id: branch-name uses: tj-actions/branch-names@v6 - uses: actions/checkout@v3 with: ref: ${{ steps.branch-name.outputs.base_ref_branch }} - name: Copy .env run: php -r &quot;file_exists('.env') || copy('.env.example', '.env');&quot; - name: Install Dependencies run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - name: Generate key run: php artisan key:generate - name: Update Patch Version if: steps.branch-name.outputs.current_branch != 'test' run: php artisan version:patch - name: Update Minor Version if: steps.branch-name.outputs.current_branch == 'test' run: php artisan version:minor - name: Update Timestamp run: php artisan version:timestamp - name: Update Commit run: php artisan version:absorb - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: &quot;version: update patch&quot; branch: ${{ steps.branch-name.outputs.base_ref_branch }} push_options: '--force' </code></pre>
[ { "answer_id": 74165503, "author": "morganney", "author_id": 258174, "author_profile": "https://Stackoverflow.com/users/258174", "pm_score": 2, "selected": false, "text": "symbol" }, { "answer_id": 74173265, "author": "herrstrietzel", "author_id": 15015675, "author_pr...
2022/10/19
[ "https://Stackoverflow.com/questions/74128344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16626364/" ]
74,128,368
<p>I have run into a strange behavior if a function has an argument and the ellipse and the two start with the same letter. A toy example is this</p> <pre><code>&gt; testfun=function(aa=0, ...) {print(aa); list(...)} &gt; testfun(b=1) [1] 0 $b [1] 1 &gt; testfun(a=1) [1] 1 list() </code></pre> <p>So when I call <code>testfun(b=1)</code> everything works fine, <code>aa</code> is printed as 0 and a list with element b=1 is returned. However, if I call <code>testfun(a=1)</code>, aa is now 1 and an empty list is returned. Apparently if there is an argument that starts with the same letter as the one passed to ..., this argument gets changed and the <code>...</code> is lost.</p> <p>Any idea why this is? Any way to avoid this? In my real problem the ... is supplied by users, who might use any name for the argument (except the ones that are already arguments for the function like aa here)</p>
[ { "answer_id": 74128655, "author": "Denny Chen", "author_id": 11212921, "author_profile": "https://Stackoverflow.com/users/11212921", "pm_score": 1, "selected": false, "text": "aa" }, { "answer_id": 74131108, "author": "user2554330", "author_id": 2554330, "author_prof...
2022/10/19
[ "https://Stackoverflow.com/questions/74128368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4279915/" ]
74,128,389
<p>I faced with a problem while I was coding about Google sign-in line. I wrote these lines:</p> <pre><code>const Login = () =&gt; { const navigate = useNavigate(); const responseGoogle = (response) =&gt; { localStorage.setItem('user', JSON.stringify(response.profileObj)) const { name, googleId, imageUrl } = response.profileObj; const doc = { _id: response.profileObj.googleId, _type: 'user', userName: response.profileObj.name, image: response.profileObj.imageUrl, } client.createIfNotExists(doc) .then(() =&gt; { navigate('/', { replace: true }) }); } </code></pre> <p>But when I am looking through console log, I see there is appearing</p> <blockquote> <p>Uncaught TypeError: Cannot destructure property 'name' of 'response.profileObj' as it is undefined.</p> </blockquote> <p>So what kind of solutions do you offer for me? Btw also these code should direct me to the main page after log in with my email but it also doesn't work.</p>
[ { "answer_id": 74128655, "author": "Denny Chen", "author_id": 11212921, "author_profile": "https://Stackoverflow.com/users/11212921", "pm_score": 1, "selected": false, "text": "aa" }, { "answer_id": 74131108, "author": "user2554330", "author_id": 2554330, "author_prof...
2022/10/19
[ "https://Stackoverflow.com/questions/74128389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20120580/" ]
74,128,399
<p>I have a DataFrame that is the result of a large SQL query. I am trying to sort the DataFrame into 2 separate DataFrames. NVI and Main. They are both a list of repairs to trucks. I need to sort it based on if there is a specific profile id which is 7055. Which will go into the NVI DataFrame</p> <p>If that job is encountered I need to grab the values from the &quot;RO&quot; &quot;Unit Number&quot; and Repair Date column. I then need to take those values and search the DataFrame again and grab any rows that have a matching RO and Unit number or a matching Unit number and a Repair date that is equal to or earlier than the date value in the the row that the 7055 was found. Those rows then need to go into the NVI df. Any remaining rows that do not match will go into the Main df.</p> <p>The only static value is the profile id of 7055. The RO Unit Number and Repair date will all be different.</p> <pre><code>class nvi_dict(dict): def __setitem__(self, key, value): key = key.profile() super().__setitem__(key, value) nvisort = pd.DataFrame() def sort_nvi_dict(row, component): if row ['PROFILE_ID'] in cfg[component]['nvi']: nvi_ro = nvi_dict() nvi_ro ['RO'] = row ['RO'] nvi_ro ['UnitNum'] = row ['VFUNIT'] nvi_ro ['date']= row['REPAIR_DATE'] nvisort = nvidf.apply(lambda x: sort_nvi_dict(x, 'nvi_ro'), axis=1, result_type='expand') </code></pre> <p>I thought about trying to use a class to create a temp dict object to store the values from RO, UnitNum and Date. Which I can then call on to iterate over the df again looking for matching values.</p> <p>I am using a .yml file to store dictionaries. That I am using to further sort each of the NVI and Main df's after they have been sorted out. Because they will then need to each be sorted by truck manufacturer</p>
[ { "answer_id": 74128655, "author": "Denny Chen", "author_id": 11212921, "author_profile": "https://Stackoverflow.com/users/11212921", "pm_score": 1, "selected": false, "text": "aa" }, { "answer_id": 74131108, "author": "user2554330", "author_id": 2554330, "author_prof...
2022/10/19
[ "https://Stackoverflow.com/questions/74128399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3646486/" ]
74,128,411
<p><strong>this is the error:</strong></p> <pre><code>git push origin master git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. </code></pre> <p>The repo definitely exists as I pushed to it yesterday.</p> <p><strong>Things I tried:</strong></p> <ul> <li>copied my SSH public key to github settings several times</li> <li>delete $HOME/.ssh and regenerated the SSH keys (ssh-keygen -t rsa -b 4096). I then copied the new public key to github.</li> </ul> <p><strong>some info</strong></p> <pre><code>git remote -v origin git@github.com:myusername/myrepo.git (fetch) origin git@github.com:myusername/myrepo.git (push) </code></pre> <p>Any ideas why it could be failing? Thanks</p>
[ { "answer_id": 74133254, "author": "torek", "author_id": 1256452, "author_profile": "https://Stackoverflow.com/users/1256452", "pm_score": 1, "selected": false, "text": "frodo-baggins" }, { "answer_id": 74134782, "author": "VonC", "author_id": 6309, "author_profile": ...
2022/10/19
[ "https://Stackoverflow.com/questions/74128411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1790598/" ]
74,128,459
<p>I would like to merge two datasets by ID. The date in dataset1 should match only the nearest date in dataset2. I want all dates from dataset1 to be included in the merge.</p> <pre><code> dataset1 &lt;- read.table(text=&quot;ID Date A 2021-03-18 A 2021-04-27 A 2021-04-05 A 2021-05-02 A 2021-02-08 A 2021-06-02 A 2021-05-29 &quot;, header=TRUE) dataset2 &lt;- read.table(text=&quot;ID Date A 2021-01-01 A 2021-01-01 A 2021-05-02 A 2021-05-09 A 2021-05-09 A 2021-05-09 A 2021-05-09 A 2021-06-16 A 2021-06-27 &quot;, header=TRUE) </code></pre>
[ { "answer_id": 74133254, "author": "torek", "author_id": 1256452, "author_profile": "https://Stackoverflow.com/users/1256452", "pm_score": 1, "selected": false, "text": "frodo-baggins" }, { "answer_id": 74134782, "author": "VonC", "author_id": 6309, "author_profile": ...
2022/10/19
[ "https://Stackoverflow.com/questions/74128459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19965337/" ]
74,128,477
<p>I have all my items in my original array called <code>items</code> and have a state that holds all of the filtered data:</p> <pre class="lang-js prettyprint-override"><code>const [filteredItems, setFilteredItems] = useState(items); </code></pre> <p>I have states for my filters as such:</p> <pre class="lang-js prettyprint-override"><code>const [filteredUser, setFilteredUser] = useState(&quot;&quot;); const [filteredType, setFilteredType] = useState(&quot;&quot;); const [filteredVariety, setFilteredVariety] = useState(&quot;&quot;); </code></pre> <p>This states are updated from <code>&lt;HTMLSelect /&gt;</code> components as such:</p> <pre class="lang-js prettyprint-override"><code>const handleUserSelect = (e) =&gt; { setFilteredUser(e.currentTarget.value); } // and so on... &lt;HTMLSelect onChange={handleUserSelect} /&gt; &lt;HTMLSelect onChange={handleTypeSelect} /&gt; &lt;HTMLSelect onChange={handleVarietySelect} /&gt; </code></pre> <p>Then I have a button that apply the filters to my data <code>items</code>:</p> <pre class="lang-js prettyprint-override"><code>const handleApplyFilters = () =&gt; { setFilteredItems( items.filter(obj =&gt; ( obj.user === filteredUser; obj.type === filteredType; obj.variety === filteredVariety; )) ) } &lt;Button onClick={handleApplyFilters}&gt;Apply Filters&lt;/Button&gt; </code></pre> <p>However, the problem is that, if I want to filter ONLY the <code>user</code> for example. So I want the filter to only filter out a certain user. How can I modify my <code>handleApplyFilters()</code> function so that if only the <code>filteredUser</code> is selected, then it won't filter <code>obj.type === &quot;&quot;</code> (as <code>filteredType</code> in this case would be <code>&quot;&quot;</code> as nothing is being selected.</p>
[ { "answer_id": 74128578, "author": "Nick Vu", "author_id": 9201587, "author_profile": "https://Stackoverflow.com/users/9201587", "pm_score": 0, "selected": false, "text": "filteredType" }, { "answer_id": 74128899, "author": "Ori Drori", "author_id": 5157454, "author_p...
2022/10/19
[ "https://Stackoverflow.com/questions/74128477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16170683/" ]
74,128,483
<p>I have a list that contains a bunch of different list. ex. list = [['Hello world', '123', 'TGG'&quot;], [&quot;'Apple'&quot;, '321', 'EDF']]. When I print list[0], it prints out ['Hello world', '123', 'TGG'&quot;], but I just want it to print out Hello world. How can I access this data?</p> <pre><code>import sys, csv new_book = list() result = [] new_result = [] with open (&quot;book_data.txt&quot;, &quot;r&quot;) as fin: r_file = fin.readlines() r_file.sort(key=lambda x:x[1]) for lines in r_file: temp = (lines.strip().split('|')) result.append(temp) print(new_result[0]) </code></pre>
[ { "answer_id": 74128528, "author": "Anthony DiGiovanna", "author_id": 20206254, "author_profile": "https://Stackoverflow.com/users/20206254", "pm_score": 2, "selected": false, "text": "print(new_result[0][0])\n" }, { "answer_id": 74129494, "author": "Naveen Venkat", "auth...
2022/10/19
[ "https://Stackoverflow.com/questions/74128483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19218160/" ]
74,128,524
<p>I am trying to pull together a report with dates test was completed for individuals persons.</p> <p>Right now my query is,</p> <pre><code>Select PI.Lastname, PI.firstname, PI.personid, case PT.title when 'Test1' then CONVERT(varchar(max), cast(PT.Datecompleted as Date),0) End As test, case PF.title when 'Test2' then CONVERT(varchar(max), cast(PT.Datecompleted as Date),0) End As test2, case PF.title when 'Test3' then CONVERT(varchar(max), cast(PT.Datecompleted as Date),0) End As test3, case PF.title when 'Test4' then CONVERT(varchar(max), cast(PT.Datecompleted as Date),0) End As test4, case PF.title when 'Test5' then CONVERT(varchar(max), cast(PT.Datecompleted as Date),0) End As test5, case PF.title when 'Test6' then CONVERT(varchar(max), cast(PT.Datecompleted as Date),0) End As test6, case PF.title when 'Test7' then CONVERT(varchar(max), cast(PT.Datecompleted as Date),0) End As test7, case PF.title when 'Test8' then CONVERT(varchar(max), cast(PT.Datecompleted as Date),0) End As test8 from Person_Info PI inner join person_Test PT on PT.personid=PI.personId </code></pre> <p>My query results currently look like this:</p> <pre><code>Lastname firstname PersonId test test2 test3 test4 test5 test6 test7 test8 Ronald Jim 1000000 Aug 18 2022 NULL NULL NULL NULL NULL NULL NULL Ronald Jim 1000000 NULL NULL NULL NULL Aug 18 2022 NULL NULL NULL Ronald Jim 1000000 NULL NULL NULL NULL NULL Aug 18 2022 NULL NULL Ronald Jim 1000000 NULL NULL NULL NULL NULL NULL Aug 18 2022 NULL Ronald Jim 1000000 NULL NULL NULL NULL NULL NULL NULL Aug 18 2022 Ronald Jim 1000000 NULL Aug 18 2022 NULL NULL NULL NULL NULL NULL Ronald Jim 1000000 NULL NULL Aug 18 2022 NULL NULL NULL NULL NULL Ronald Jim 1000000 NULL NULL NULL Aug 18 2022 NULL NULL NULL NULL </code></pre> <p><a href="https://i.stack.imgur.com/DgiYf.png" rel="nofollow noreferrer">Screenshot</a></p> <p>But What I am looking to get is the following:</p> <pre><code>Lastname firstname PersonId test test2 test3 test4 test5 test6 test7 test8 Ronald Jim 1000000 Aug 18 2022 Aug 18 2022 Aug 18 2022 Aug 18 2023 Aug 18 2024 Aug 18 2025 Aug 18 2026 Aug 18 2027 </code></pre> <p><a href="https://i.stack.imgur.com/Vnnbj.png" rel="nofollow noreferrer">What I am looking to get</a></p>
[ { "answer_id": 74128528, "author": "Anthony DiGiovanna", "author_id": 20206254, "author_profile": "https://Stackoverflow.com/users/20206254", "pm_score": 2, "selected": false, "text": "print(new_result[0][0])\n" }, { "answer_id": 74129494, "author": "Naveen Venkat", "auth...
2022/10/19
[ "https://Stackoverflow.com/questions/74128524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20284405/" ]
74,128,606
<p>I have been given an <code>n</code> length string and I need to find its rank in the alphabetical ordering of all the <code>n</code> length strings. Like for example, let's say I have been given, <code>&quot;ABC&quot;</code> then as <code>n=4</code> then ordering will be as <code>{ABCD, ABCE, ABCF ....}</code> thus the rank of <code>&quot;ABCD&quot;</code> is <code>0</code> (considering we start from 0). Similarly, for <code>&quot;ABCE&quot;</code> it will be 1. Now, how do I find the rank of <code>&quot;YTZ&quot;</code>?</p>
[ { "answer_id": 74128528, "author": "Anthony DiGiovanna", "author_id": 20206254, "author_profile": "https://Stackoverflow.com/users/20206254", "pm_score": 2, "selected": false, "text": "print(new_result[0][0])\n" }, { "answer_id": 74129494, "author": "Naveen Venkat", "auth...
2022/10/19
[ "https://Stackoverflow.com/questions/74128606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
74,128,621
<p>I'm trying to debug an emergency alert script. It should be checking to see if the XML item is less than '40000000000' seconds old and echo 'Its been less than 24 hours'. I set it to a crazy high number and it's still returning &quot;else&quot;.</p> <pre><code>&lt;?php $xml=simplexml_load_file(&quot;https://content.getrave.com/rss/harpercollege/channel1&quot;); foreach($xml-&gt;channel-&gt;item as $child) { unset($titleVal, $descriptionVal, $pubdate, $dateString); $titleVal = (string)$child-&gt;title; $descriptionVal = (string)$child-&gt;description; $pubDate = (string)$child-&gt;pubDate; $pubDate= date(&quot;D, d M Y H:i:s T&quot;, strtotime($pubDate)); echo $titleVal . &quot;&lt;br&gt;&quot; . $descriptionVal . &quot;&lt;br&gt;&quot; . $pubDate . &quot;&lt;br&gt;&quot;; if($pubDate &gt; time() + 40000000000) { echo 'Its been less than 24 hours'; } else { echo '24 Hours have passed'; } } ?&gt; </code></pre>
[ { "answer_id": 74129282, "author": "RiggsFolly", "author_id": 2310830, "author_profile": "https://Stackoverflow.com/users/2310830", "pm_score": 2, "selected": true, "text": "<pubDate>Fri, 29 Oct 2021 13:25:47 GMT</pubDate>" }, { "answer_id": 74129302, "author": "Ahmed Raza", ...
2022/10/19
[ "https://Stackoverflow.com/questions/74128621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8641435/" ]
74,128,632
<p>I have the following JSON field with the following format:</p> <pre><code>&quot;Classifications&quot;: [&quot;Returning&quot;, &quot;Important&quot;] </code></pre> <p>My desired output would be the following string: <code>Returning, Important</code></p> <p>I am using the following syntax:</p> <pre><code>&lt;string key=&quot;value&quot;&gt; &lt;xsl:value-of select=&quot;normalize-space(*[@key='Classifications'])&quot;&gt;&lt;/xsl:value-of&gt; &lt;/string&gt; </code></pre> <p>However, the output I get from this is: <code>ReturningImportant</code></p> <p>Appreciate your help in advance to use the right syntax to achieve my preferred output.</p>
[ { "answer_id": 74128802, "author": "Heiko Theißen", "author_id": 16462950, "author_profile": "https://Stackoverflow.com/users/16462950", "pm_score": -1, "selected": true, "text": "normalize-space" }, { "answer_id": 74128809, "author": "Martin Honnen", "author_id": 252228,...
2022/10/19
[ "https://Stackoverflow.com/questions/74128632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412548/" ]
74,128,685
<p>I have an array of objects that have specific IDs and another second array of objects that also have specified IDs. I want to delete objects from the first array that have the same ID as objects in the second array. How can I do it?</p>
[ { "answer_id": 74128802, "author": "Heiko Theißen", "author_id": 16462950, "author_profile": "https://Stackoverflow.com/users/16462950", "pm_score": -1, "selected": true, "text": "normalize-space" }, { "answer_id": 74128809, "author": "Martin Honnen", "author_id": 252228,...
2022/10/19
[ "https://Stackoverflow.com/questions/74128685", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20024399/" ]
74,128,708
<p>I have an <a href="https://releases.ubuntu.com/focal/" rel="nofollow noreferrer">Ubuntu 20.04.5</a> install which has a Cassandra database which I want to connect to with <a href="https://www.dbvis.com/download/" rel="nofollow noreferrer">DbVisualizer v14.0.1</a> using the <a href="https://www.micromux.com/development-projects/cassandra-twig-jdbc/" rel="nofollow noreferrer">Cassandra Twig driver</a> (for reasons best known to my organisation).</p> <p>I have <a href="https://confluence.dbvis.com/display/UG100/Installing#Installing-InstallationNotesforDEBarchives(Linux)" rel="nofollow noreferrer">installed DbVis</a> and downloaded the <a href="https://github.com/esarjeant/twig/releases/download/3.0.1-2/cassandra-twig-jdbc-3.0.1.jar" rel="nofollow noreferrer">cassandra-twig-jdbc-3.0.1.jar</a> driver, <a href="https://confluence.dbvis.com/display/UG100/Starting+DbVisualizer" rel="nofollow noreferrer">started DbVis</a> with the free version.</p> <p>I have installed the driver successfully, providing the URL format as <code>jdbc:cassandra://&lt;server&gt;:&lt;port&gt;/&lt;database&gt;</code> <a href="https://www.micromux.com/development-projects/cassandra-twig-jdbc/" rel="nofollow noreferrer">specified by the Cassandra docs</a>, and named it 'Cassandra': <a href="https://i.stack.imgur.com/y0I8s.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y0I8s.png" alt="driver manager screenhot" /></a></p> <p>I am now trying to create a database connection, for which the <a href="https://confluence.dbvis.com/display/UG100/Creating+a+Connection+-+basics#CreatingaConnection-basics-UsingtheConnectionWizard" rel="nofollow noreferrer">documentation states there is a wizard</a>, however I cannot find that.</p> <p>Going with a <a href="https://confluence.dbvis.com/display/UG100/Creating+a+Connection+-+basics#CreatingaConnection-basics-SettingUpaConnectionManually" rel="nofollow noreferrer">manual connection</a>, I do not see the Database Connection panel described by the documentation, I just get a driver selection: <a href="https://i.stack.imgur.com/NQwFj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NQwFj.png" alt="enter image description here" /></a></p> <p>If I select the 'Cassandra' driver I don't get a 'Database URL' field: <a href="https://i.stack.imgur.com/UdN6g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UdN6g.png" alt="database connection" /></a></p> <p>Clicking 'Connect' fails - how can I define the connection URL for my local database?</p>
[ { "answer_id": 74178621, "author": "Erick Ramirez", "author_id": 4269535, "author_profile": "https://Stackoverflow.com/users/4269535", "pm_score": 0, "selected": false, "text": "jdbc:cassandra://<server>:<port>/<database>\n" } ]
2022/10/19
[ "https://Stackoverflow.com/questions/74128708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/71376/" ]
74,128,737
<p>I have a function that takes a dataframe column and returns a boolean mask based on certain conditions:</p> <pre><code>def is_downtrending(close): out = np.full(close.shape, False) for i in range(close.shape[0]): # if we've had two consecutive red days if (close[i] &lt; close[i - 1]) and (close[i - 1] &lt; close[i - 2]): out[i] = True else: out[i] = False return out </code></pre> <p>Normally I call it by passing in a column:</p> <pre><code>ohlc['is_downtrending'] = is_downtrending(ohlc['close']) </code></pre> <p><strong>But how can I make this work using <code>groupby</code>?</strong> When I try:</p> <pre><code>df['is_downtrending'] = df.groupby(&quot;stock_id&quot;).apply(is_downtrending) </code></pre> <p>I get the following error:</p> <pre><code>Traceback (most recent call last): File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/indexes/base.py&quot;, line 3629, in get_loc return self._engine.get_loc(casted_key) File &quot;pandas/_libs/index.pyx&quot;, line 136, in pandas._libs.index.IndexEngine.get_loc File &quot;pandas/_libs/index.pyx&quot;, line 163, in pandas._libs.index.IndexEngine.get_loc File &quot;pandas/_libs/hashtable_class_helper.pxi&quot;, line 5198, in pandas._libs.hashtable.PyObjectHashTable.get_item File &quot;pandas/_libs/hashtable_class_helper.pxi&quot;, line 5206, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 0 The above exception was the direct cause of the following exception: Traceback (most recent call last): File &quot;/home/dan/Documents/code/wolfhound/add_indicators_daily.py&quot;, line 29, in &lt;module&gt; df['is_downtrending'] = df.groupby(&quot;stock_id&quot;).apply(is_downtrending) File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/groupby/groupby.py&quot;, line 1423, in apply result = self._python_apply_general(f, self._selected_obj) File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/groupby/groupby.py&quot;, line 1464, in _python_apply_general values, mutated = self.grouper.apply(f, data, self.axis) File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/groupby/ops.py&quot;, line 761, in apply res = f(group) File &quot;/home/dan/Documents/code/wolfhound/add_indicators_daily.py&quot;, line 11, in is_downtrending if (close[i] &lt; close[i - 1]) and (close[i - 1] &lt; close[i - 2]): File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/frame.py&quot;, line 3505, in __getitem__ indexer = self.columns.get_loc(key) File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/indexes/base.py&quot;, line 3631, in get_loc raise KeyError(key) from err KeyError: 0 </code></pre> <p>When I try passing in the column:</p> <pre><code>df['is_downtrending'] = df.groupby(&quot;stock_id&quot;).apply(is_downtrending('close')) </code></pre> <p>The error changes to:</p> <pre><code>Traceback (most recent call last): File &quot;/home/dan/Documents/code/wolfhound/add_indicators_daily.py&quot;, line 29, in &lt;module&gt; df['is_downtrending'] = df.groupby(&quot;stock_id&quot;).apply(is_downtrending('close')) File &quot;/home/dan/Documents/code/wolfhound/add_indicators_daily.py&quot;, line 7, in is_downtrending out = np.full(close.shape, False) AttributeError: 'str' object has no attribute 'shape' </code></pre> <p>Here's what the df looks like:</p> <pre><code> index date symbol stock_id open high low close volume vwap 0 0 2021-10-11 BVN 13 7.69 7.98 7.5600 7.61 879710 7.782174 1 1 2021-10-12 BVN 13 7.67 8.08 7.5803 8.02 794436 7.967061 2 2 2021-10-13 BVN 13 8.12 8.36 8.0900 8.16 716012 8.231286 3 3 2021-10-14 BVN 13 8.26 8.29 8.0500 8.28 586091 8.185899 4 4 2021-10-15 BVN 13 8.18 8.44 8.0600 8.44 1278409 8.284539 ... ... ... ... ... ... ... ... ... ... ... 227774 227774 2022-10-04 ERIC 11000 6.27 6.32 6.2400 6.29 14655189 6.280157 227775 227775 2022-10-05 ERIC 11000 6.17 6.31 6.1500 6.29 10569193 6.219965 227776 227776 2022-10-06 ERIC 11000 6.20 6.25 6.1800 6.22 7918812 6.217198 227777 227777 2022-10-07 ERIC 11000 6.17 6.19 6.0800 6.10 9671252 6.135976 227778 227778 2022-10-10 ERIC 11000 6.13 6.15 6.0200 6.04 6310661 6.066256 [227779 rows x 10 columns] </code></pre> <p>I've tried Code Different's suggestion:</p> <pre><code>import pandas as pd from IPython.display import display import sqlite3 as sql import numpy as np conn = sql.connect('allStockData.db') # get everything inside daily_ohlc and add to a dataframe df = pd.read_sql_query(&quot;SELECT * from daily_ohlc_init&quot;, conn) df[&quot;is_downtrending&quot;] = ( df[&quot;close&quot;] .groupby(['stock_id']).diff() # diff between current close and previous close .groupby(['stock_id']).rolling(2) # consider the diff of the last n days .apply(lambda diff: (diff &lt; 0).all()) # true if they are all &lt; 0 ).fillna(0) df.to_sql('daily_ohlc_init_with_indicators', if_exists='replace', con=conn, index=True) </code></pre> <p>Which gives the error:</p> <pre><code>Traceback (most recent call last): File &quot;/home/dan/Documents/code/wolfhound/add_indicators_daily.py&quot;, line 13, in &lt;module&gt; .groupby(['stock_id']).diff() # diff between current close and previous close File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/series.py&quot;, line 1922, in groupby return SeriesGroupBy( File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/groupby/groupby.py&quot;, line 882, in __init__ grouper, exclusions, obj = get_grouper( File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/groupby/grouper.py&quot;, line 882, in get_grouper raise KeyError(gpr) KeyError: 'stock_id' </code></pre> <p>And trying Ynjxsjmh suggestion threw the error:</p> <pre><code>raise KeyError(key) from err KeyError: -1 </code></pre> <p>So I changed the code to:</p> <pre><code> def is_downtrending(close): out = np.full(close.shape, False) for i in close.index: # &lt;--- changes here # if we've had two consecutive red days if i &gt; 3: if (close[i] &lt; close[i - 1]) and (close[i - 1] &lt; close[i - 2]): out[i] = True else: out[i] = False return out df['is_downtrending'] = df.groupby(&quot;stock_id&quot;, as_index=False)[&quot;close&quot;].transform(is_downtrending) </code></pre> <p>Which gives the error:</p> <pre><code> Traceback (most recent call last): File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/indexes/base.py&quot;, line 3629, in get_loc return self._engine.get_loc(casted_key) File &quot;pandas/_libs/index.pyx&quot;, line 136, in pandas._libs.index.IndexEngine.get_loc File &quot;pandas/_libs/index.pyx&quot;, line 163, in pandas._libs.index.IndexEngine.get_loc File &quot;pandas/_libs/hashtable_class_helper.pxi&quot;, line 2131, in pandas._libs.hashtable.Int64HashTable.get_item File &quot;pandas/_libs/hashtable_class_helper.pxi&quot;, line 2140, in pandas._libs.hashtable.Int64HashTable.get_item KeyError: -1 The above exception was the direct cause of the following exception: Traceback (most recent call last): File &quot;/home/dan/Documents/code/wolfhound/add_indicators_daily.py&quot;, line 25, in &lt;module&gt; df['is_downtrending'] = df.groupby(&quot;stock_id&quot;, as_index=False)[&quot;close&quot;].transform(is_downtrending) File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/groupby/generic.py&quot;, line 1184, in transform return self._transform( File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/groupby/groupby.py&quot;, line 1642, in _transform return self._transform_general(func, *args, **kwargs) File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/groupby/generic.py&quot;, line 1156, in _transform_general path, res = self._choose_path(fast_path, slow_path, group) File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/groupby/generic.py&quot;, line 1208, in _choose_path res = slow_path(group) File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/groupby/generic.py&quot;, line 1201, in &lt;lambda&gt; slow_path = lambda group: group.apply( File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/frame.py&quot;, line 8848, in apply return op.apply().__finalize__(self, method=&quot;apply&quot;) File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/apply.py&quot;, line 733, in apply return self.apply_standard() File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/apply.py&quot;, line 857, in apply_standard results, res_index = self.apply_series_generator() File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/apply.py&quot;, line 873, in apply_series_generator results[i] = self.f(v) File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/groupby/generic.py&quot;, line 1202, in &lt;lambda&gt; lambda x: func(x, *args, **kwargs), axis=self.axis File &quot;/home/dan/Documents/code/wolfhound/add_indicators_daily.py&quot;, line 17, in is_downtrending if (close[i] &lt; close[i - 1]) and (close[i - 1] &lt; close[i - 2]): File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/series.py&quot;, line 958, in __getitem__ return self._get_value(key) File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/series.py&quot;, line 1069, in _get_value loc = self.index.get_loc(label) File &quot;/home/dan/.local/lib/python3.10/site-packages/pandas/core/indexes/base.py&quot;, line 3631, in get_loc raise KeyError(key) from err KeyError: -1 </code></pre>
[ { "answer_id": 74178621, "author": "Erick Ramirez", "author_id": 4269535, "author_profile": "https://Stackoverflow.com/users/4269535", "pm_score": 0, "selected": false, "text": "jdbc:cassandra://<server>:<port>/<database>\n" } ]
2022/10/19
[ "https://Stackoverflow.com/questions/74128737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7317408/" ]
74,128,760
<p>I am stuck with this situation where I have a custom <code>JSONDecoder</code> struct which contains a private function to decode data, and another function which is exposed, and should return a specific, Decodable type. I would like these functions to throw successively so I only have to write my <code>do/catch</code> block inside the calling component, but I'm stuck with this error on the <code>exposedFunc()</code> function:</p> <blockquote> <p>Invalid conversion from throwing function of type '(Completion) throws -&gt; ()' (aka '(Result&lt;Data, any Error&gt;) throws -&gt; ()') to non-throwing function type '(Completion) -&gt; ()' (aka '(Result&lt;Data, any Error&gt;) -&gt; ()')</p> </blockquote> <p>Here is the code:</p> <pre><code>import Foundation import UIKit typealias Completion = Result&lt;Data, Error&gt; let apiProvider = ApiProvider() struct DecodableTest: Decodable { } struct CustomJSONDecoder { private static func decodingFunc&lt;T: Decodable&gt;( _ response: Completion, _ completion: @escaping (T) -&gt; Void ) throws { switch response { case .success(let success): try completion( JSONDecoder().decode( T.self, from: success ) ) case .failure(let error): throw error } } static func exposedFunc( value: String, _ completion: @escaping (DecodableTest) -&gt; Void ) throws { apiProvider.request { try decodingFunc($0, completion) } } } class CustomViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() do { try CustomJSONDecoder.exposedFunc(value: &quot;test_value&quot;) { result in // Do something with result } } catch { print(error) } } } class ApiProvider: NSObject { func request(_ completion: @escaping (Completion) -&gt; ()) { } } </code></pre> <p>Thank you for your help</p>
[ { "answer_id": 74129546, "author": "Jessy", "author_id": 652038, "author_profile": "https://Stackoverflow.com/users/652038", "pm_score": 1, "selected": false, "text": "final class CustomViewController: UIViewController {\n override func viewDidLoad() {\n super.viewDidLoad()\n Task...
2022/10/19
[ "https://Stackoverflow.com/questions/74128760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19579501/" ]
74,128,763
<p>I have a set of time series data where I am trying to find at what point they reach a specific value. I tried this, that gets me the answer but produces the whole column as opposed to the specific value in the time column and I am unsure how to iterate over several columns.</p> <pre><code>num = df['Time column'].where(df['Data Column'] &gt;Value of interest) print (num) </code></pre> <p>Any help is greatly appreciated.</p>
[ { "answer_id": 74129546, "author": "Jessy", "author_id": 652038, "author_profile": "https://Stackoverflow.com/users/652038", "pm_score": 1, "selected": false, "text": "final class CustomViewController: UIViewController {\n override func viewDidLoad() {\n super.viewDidLoad()\n Task...
2022/10/19
[ "https://Stackoverflow.com/questions/74128763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20139339/" ]
74,128,774
<p>I am trying to combing the dividend history of 2 different stocks and I have the below code:</p> <pre><code>library(quantmod) library(tidyr) AAPL&lt;-round(getDividends(&quot;AAPL&quot;),4) MSFT&lt;-round(getDividends(&quot;MSFT&quot;),4) dividend&lt;-(cbind(AAPL,MSFT)) </code></pre> <p>As the 2 stocks pay out dividend on different dates so there will be NAs after combining and so I try to use drop_na function from tidyr like below:</p> <blockquote> <p>drop_na(dividend)</p> </blockquote> <p>#Error in UseMethod(&quot;drop_na&quot;) : no applicable method for 'drop_na' applied to an object of class &quot;c('xts', 'zoo')&quot;</p> <p>May I know what did I do wrong here? Many thanks for your help.</p> <p>Update 1:</p> <p>Tried na.omit, which returns with the following:</p> <pre><code>&gt; dividend&lt;-(cbind(AAPL,MSFT))%&gt;% &gt; na.omit(dividend)%&gt;% &gt; print(dividend) [,1] [,2] </code></pre>
[ { "answer_id": 74129546, "author": "Jessy", "author_id": 652038, "author_profile": "https://Stackoverflow.com/users/652038", "pm_score": 1, "selected": false, "text": "final class CustomViewController: UIViewController {\n override func viewDidLoad() {\n super.viewDidLoad()\n Task...
2022/10/19
[ "https://Stackoverflow.com/questions/74128774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16601198/" ]
74,128,787
<p>I'm building a pyhon price tracker which allows me to enter some urls. The program then fetches their prices once each day and adds it to the csv file below.</p> <p>I'm now looking for a way to show the price evolution of each product with a line chart but cannot find a way to get something like this below where i have prices from a product from a specific store.</p> <pre><code>Samsung Galaxy Tab S6 lite - coolblue = [123.00, 156.00, 186.00] </code></pre> <p><a href="https://i.stack.imgur.com/YBbrF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YBbrF.png" alt="csv dataset" /></a></p>
[ { "answer_id": 74129005, "author": "assume_irrational_is_rational", "author_id": 11622508, "author_profile": "https://Stackoverflow.com/users/11622508", "pm_score": 2, "selected": true, "text": "itertools.groupby" }, { "answer_id": 74129050, "author": "DanglerMangler", "a...
2022/10/19
[ "https://Stackoverflow.com/questions/74128787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9839095/" ]
74,128,790
<p>I try to populate null-rows in a table with data from the same table. Here is my code:</p> <pre><code>create table public.testdata( id INTEGER, person INTEGER, name varchar(10)); insert into testdata (id, person,name) VALUES ( 1,1,'Jane' ), ( 2,1,'Jane' ), ( 3,1,NULL ), ( 4,2,'Tom' ), ( 5,2,NULL ); select * from testdata; </code></pre> <p><a href="https://i.stack.imgur.com/xvlHo.png" rel="nofollow noreferrer">enter image description here</a></p> <p>Basically i would like to have name 'Jane' in the 3rd row and name 'Tom' in the 5th.</p> <p>Here is the asnswer which i have found online to a simmilar problem:</p> <pre><code>Update testdata SET name = COALESCE(a1.name, b1.name) FROM testdata a1 JOIN testdata b1 on a1.person = b1.person and a1.id &lt;&gt; b1.id where a1.name is NULL; </code></pre> <p>But if i run this code, i get name 'Jane' in every column, which is not what i want. I appreciate any help and suggestions.</p>
[ { "answer_id": 74129005, "author": "assume_irrational_is_rational", "author_id": 11622508, "author_profile": "https://Stackoverflow.com/users/11622508", "pm_score": 2, "selected": true, "text": "itertools.groupby" }, { "answer_id": 74129050, "author": "DanglerMangler", "a...
2022/10/19
[ "https://Stackoverflow.com/questions/74128790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20284585/" ]
74,128,803
<p>I want SQL query equivalent in EF Core Lambda, to get an extra column as either true or false, based on some substring(in this case <em><strong>DEALER</strong></em>) if present in other column's data of the same table.</p> <pre><code>myTable Id col1 1 I have substring - DEALER 2 I do not have any substring </code></pre> <p>I need the output as</p> <pre><code>Id, IsDealer 1, true 2, false </code></pre> <p>I tried the following SQL query,</p> <pre><code>SELECT [Id] , CASE WHEN [col1] LIKE '%DEALER%' THEN 'true' ELSE 'false' END as IsDealer FROM [dbo].[myTable] </code></pre> <p>I get proper output, But what is the above <strong>SQL</strong> query <strong>EF CORE equivalent</strong> ?</p> <p>I tried</p> <pre><code>_Context.myTable.Where(et =&gt; et) .Select(s =&gt; new myTableEFCoreModel { Id = s.Id, **&lt;what goes here for IsDealer&gt;** }); </code></pre>
[ { "answer_id": 74129082, "author": "ProdigalTechie", "author_id": 20120544, "author_profile": "https://Stackoverflow.com/users/20120544", "pm_score": 3, "selected": true, "text": "_Context.myTable.Where(et => et)\n .Select(s => new myTableEFCoreModel\n {\n /* same as select ...
2022/10/19
[ "https://Stackoverflow.com/questions/74128803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865910/" ]
74,128,835
<p>I am creating a grid of images which has a &quot;floating&quot; border when one item is active. This &quot;floating&quot; border needs to occupy the space that would otherwise be padding.</p> <p>I have this set up pretty well, however I notice that the active item is missing it's right hand border. I suspect the item to the right is covering this border.</p> <p>I added a different z-index to the active item but this hasn't made the border visible.</p> <p>Why is this happening?</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>.container { display: inline-block; font-size: 0; } li { list-style-type: none; display: inline-block; border: 2px solid white; padding: 2px; margin-left: -2px; z-index: 9; } li.active { border-color: black; z-index: 10; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class=container&gt; &lt;li&gt; &lt;img src="https://via.placeholder.com/90" /&gt; &lt;/li&gt; &lt;li&gt; &lt;img src="https://via.placeholder.com/90" /&gt; &lt;/li&gt; &lt;li class=active&gt; &lt;img src="https://via.placeholder.com/90" /&gt; &lt;/li&gt; &lt;li&gt; &lt;img src="https://via.placeholder.com/90" /&gt; &lt;/li&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
[ { "answer_id": 74129082, "author": "ProdigalTechie", "author_id": 20120544, "author_profile": "https://Stackoverflow.com/users/20120544", "pm_score": 3, "selected": true, "text": "_Context.myTable.Where(et => et)\n .Select(s => new myTableEFCoreModel\n {\n /* same as select ...
2022/10/19
[ "https://Stackoverflow.com/questions/74128835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1486133/" ]
74,128,880
<p>I have a variable <code>weight</code> and a state value <code>deliveryFee</code>.</p> <p>As the value of <code>weight</code> increases I need to increment the value of <code>deliveryFee</code> according to this pattern:</p> <pre><code>Up to 2 kg =&gt; $3.40 Up to 5 kg =&gt; $3.80 Up to 10 kg =&gt; $4.20 </code></pre> <p>And then for every additional 10kg I need to increment <code>deliveryfee</code> by a further $3.50</p> <p>I can do the first part easily using a ternary operator:</p> <pre><code>weight &lt;= 2 ? setDeliveryFee(3.4) : weight &lt;= 5 ? setDeliveryFee(3.8) : weight &lt;= 10 &amp;&amp; setDeliveryFee(4.2) </code></pre> <p>But I can't work out how to increment the <code>deliveryFee</code> by 3.5 every time <code>weight</code> increases by an additional 10.</p> <p>I know I could simply continue this pattern to achieve the result:</p> <pre><code>weight + 1 &lt;= 2 ? setDeliveryFee(3.4) : weight + 1 &lt;= 5 ? setDeliveryFee(3.8) : weight + 1 &lt;= 10 ? setDeliveryFee(4.2) : weight + 1 &lt;= 20 ? setDeliveryFee(7.7) : weight + 1 &lt;= 30 ? setDeliveryFee(11.2) : weight + 1 &lt;= 40 ? setDeliveryFee(14.7) &amp;&amp; weight + 1 &lt;= 50 &amp;&amp; setDeliveryFee(18.2); </code></pre> <p>But since <code>weight</code> could theoretically be any figure this is not fool proof so I really need a formula to accomplish this.</p> <p>Is anyone able to help?</p>
[ { "answer_id": 74129013, "author": "Mina", "author_id": 11887902, "author_profile": "https://Stackoverflow.com/users/11887902", "pm_score": 2, "selected": true, "text": "4.2 + (Math.ceil((weight / 10) - 1) * 3.5)" }, { "answer_id": 74129025, "author": "rantao", "author_id...
2022/10/19
[ "https://Stackoverflow.com/questions/74128880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13146212/" ]
74,128,890
<p>TL;DR: What's the accepted way to <code>impl</code> a trait for all types implementing another trait in Rust?</p> <p>I'm working through trying to understand Rust's type system and coming to a bit of a hangup. I've boiled the problem down, and realized that I'm basically just trying to translate the following thing I can write in Haskell to Rust:</p> <pre class="lang-hs prettyprint-override"><code>class Wrapper s where unwrap :: s t -&gt; t data Burrito t = Burrito t instance Wrapper Burrito where unwrap (Burrito inner) = inner instance (Wrapper w, Show t) =&gt; Show (w t) where show w = &quot;(wrapped &quot; ++ show (unwrap w) ++ &quot;)&quot; main :: IO () main = print . Burrito $ 1 </code></pre> <p>I was able to generally translate this as follows:</p> <pre class="lang-rust prettyprint-override"><code>trait Wrapper&lt;T&gt; { fn unwrap(&amp;self) -&gt; T; } struct Burrito&lt;T&gt; { filling: T } impl&lt;T: Copy&gt; Wrapper&lt;T&gt; for Burrito&lt;T&gt; { fn unwrap(&amp;self) -&gt; T { self.filling } } impl&lt;T: Display, W: Wrapper&lt;T&gt;&gt; Display for W { fn fmt(&amp;self, f: &amp;mut std::fmt::Formatter&lt;'_&gt;) -&gt; std::fmt::Result { write!(f, &quot;(wrapped {})&quot;, self.unwrap()) } } fn main() { let burrito = Burrito { filling: 1 }; println!(&quot;{}&quot;, burrito); } </code></pre> <p>But this errors on the <code>T</code> type parameter in the Display <code>impl</code> with error:</p> <blockquote> <p>the type parameter <code>T</code> is not constrained by the impl trait, self type, or predicates unconstrained type parameter</p> </blockquote> <p>The other alternative I tried was doing (as suggested by my IDE):</p> <pre class="lang-rust prettyprint-override"><code>impl&lt;T: Display&gt; Display for dyn Wrapper&lt;T&gt; { fn fmt(&amp;self, f: &amp;mut std::fmt::Formatter&lt;'_&gt;) -&gt; std::fmt::Result { write!(f, &quot;(wrapped {})&quot;, self.unwrap()) } } </code></pre> <p>but this now raises an error on the actual println in main (when done as <code>println!(&quot;{}&quot;, burrito as Wrapper&lt;i32&gt;)</code>), that there is a cast to an unsized type.</p> <p>Is there a canonical way to create an <code>impl</code> for a trait (<code>Display</code> here) for all types <code>impl</code>ementing another trait (<code>Wrapper&lt;T&gt;</code> here)?</p>
[ { "answer_id": 74129160, "author": "jthulhu", "author_id": 5956261, "author_profile": "https://Stackoverflow.com/users/5956261", "pm_score": -1, "selected": false, "text": "T" }, { "answer_id": 74130007, "author": "isaactfa", "author_id": 11423104, "author_profile": "...
2022/10/19
[ "https://Stackoverflow.com/questions/74128890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4780330/" ]
74,128,892
<p>Consider:</p> <pre><code>typedef struct { int a[1]; } S; const S foo(void) { return (S) {{3}}; } void bar(void) { int *p = foo().a; } </code></pre> <p>Per C 2018 6.2.4 8, the expression <code>foo()</code> refers to an object with temporary lifetime:</p> <blockquote> <p>A non-lvalue expression with structure or union type, where the structure or union contains a member with array type (including, recursively, members of all contained structures and unions) refers to an object with automatic storage duration and <em>temporary lifetime</em>. Its lifetime begins when the expression is evaluated and its initial value is the value of the expression. Its lifetime ends when the evaluation of the containing full expression ends. Any attempt to modify an object with temporary lifetime results in undefined behavior. An object with temporary lifetime behaves as if it were declared with the type of its value for the purposes of effective type. Such an object need not have a unique address.</p> </blockquote> <p>Note that the code does not attempt to modify the object, but it does initialize an <code>int *</code> with the address of the first element of <code>foo().a</code>, which we would expect to be <code>const</code>-qualified. This violates the constraints in 6.5.16.1 1 that require the pointed-to destination type to have all the qualifiers of the pointed-to source type. (That paragraph is for assignment but is incorporated by 6.7.9 11, which covers initialization.)</p> <p>However, neither GCC nor Clang complain about this initialization. Indeed, with <code>-Wextra</code>, Clang complains about the return type of <code>foo</code>, saying “'const' type qualifier on return type has no effect”.</p> <p>Are GCC and Clang wrong to treat <code>foo()</code> as not <code>const</code>-qualified? Or is there something in the C standard that says qualifiers on return types are disregarded?</p> <p>(Lest one complain there is no use for this, consider one could have <code>baz(foo().a)</code>, in which the array is passed to a function which makes considerable use of it while it is a temporary object. However, if <code>baz</code> modified any part of the array, the behavior would not be defined by the C standard. A programmer might wish to forestall this error by declaring <code>foo</code>’s return type to be <code>const</code>, thus expecting to get a compiler error message if they accidentally pass an address in the temporary object to a function without a corresponding <code>const</code> in its parameter declaration.)</p>
[ { "answer_id": 74129741, "author": "Artyer", "author_id": 5754656, "author_profile": "https://Stackoverflow.com/users/5754656", "pm_score": 3, "selected": true, "text": "foo" } ]
2022/10/19
[ "https://Stackoverflow.com/questions/74128892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298225/" ]
74,128,913
<pre><code>function isPrime(num) { let result = true; if (num &lt; 2) { result = false; return result; } for (let i = 2; i &lt; num; i++) { if (num % i === 0) { result = false; break; } } return result; } </code></pre> <p>I am trying to find whether a given number is prime or not, why is my code not executing in a limited amount of time?</p>
[ { "answer_id": 74129741, "author": "Artyer", "author_id": 5754656, "author_profile": "https://Stackoverflow.com/users/5754656", "pm_score": 3, "selected": true, "text": "foo" } ]
2022/10/19
[ "https://Stackoverflow.com/questions/74128913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12730690/" ]
74,128,925
<p>I have the following array</p> <pre><code> let tableA=[{id:'1', name:'name1',age:'31',gender:'male',class='B'}, {id:'2', name:'name2',age:'38',gender:'male',class='A'}, {id:'3', name:'name3',age:'35',gender:'male',class='C'}, {id:'4', name:'name4',age:'20',gender:'female',class='B'}, {id:'5', name:'name5',age:'19',gender:'female',class='A'}, {id:'6', name:'name6',age:'31',gender:'male',class='A'} ]; </code></pre> <p>and this array for filters</p> <pre><code> let filters = [{type:'gender',value:&quot;male&quot;}, {type:'age',value:&quot;31&quot;}]; </code></pre> <p>I'm trying to filter tableA with the values of table filters, all filters must match. Filters are not static, it means that filters can include json files for all table keys.</p> <p>So far I'm trying to filter table_A with the code above.</p> <pre><code> let filtered_table=[]; tableA.forEach(row =&gt; { filters.map((item) =&gt; { if(row[item.type]==item.value){ filtered_table.push(row); } }); }); console.log(filtered_table); </code></pre> <p>the result of the code above is:</p> <pre><code> [ { id: '1', name: 'name1', age: '31', gender: 'male', class: 'B' }, { id: '1', name: 'name1', age: '31', gender: 'male', class: 'B' }, { id: '2', name: 'name2', age: '38', gender: 'male', class: 'A' }, { id: '3', name: 'name3', age: '35', gender: 'male', class: 'C' }, { id: '6', name: 'name6', age: '31', gender: 'male', class: 'A' }, { id: '6', name: 'name6', age: '31', gender: 'male', class: 'A' } ] </code></pre> <p>How I can get back only the row that match for all of the filters_table items combined? For this example I'm expecting this:</p> <pre><code>[ { id: '1', name: 'name1', age: '31', gender: 'male', class: 'B' }, { id: '6', name: 'name6', age: '31', gender: 'male', class: 'A' } ] </code></pre>
[ { "answer_id": 74129059, "author": "Ivan124", "author_id": 20246826, "author_profile": "https://Stackoverflow.com/users/20246826", "pm_score": 3, "selected": true, "text": "\nlet filtered_table=[];\n tableA.forEach(row => {\n const flag = filters.map((item) => {\n if(row[item.t...
2022/10/19
[ "https://Stackoverflow.com/questions/74128925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7673761/" ]
74,128,931
<p>to add certain symbol after every three got splited lines Something like that?? -</p> <pre><code>print('@'.join(st_text[i:i + 3] for i in range(0, len(st_tex), 3))) </code></pre>
[ { "answer_id": 74129059, "author": "Ivan124", "author_id": 20246826, "author_profile": "https://Stackoverflow.com/users/20246826", "pm_score": 3, "selected": true, "text": "\nlet filtered_table=[];\n tableA.forEach(row => {\n const flag = filters.map((item) => {\n if(row[item.t...
2022/10/19
[ "https://Stackoverflow.com/questions/74128931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20280838/" ]
74,128,948
<p>I am migrating my WCF to API using .net6.0.</p> <p>The WCF result is different from API result like the order of the result and the character casing of the result for the same sql query which is shown in the below example.</p> <p>WCF Result</p> <pre><code>[ { &quot;Active&quot; : true, &quot;CountryKey&quot; : &quot;IN&quot;, &quot;Id&quot; : 1, &quot;Name&quot; : &quot;India&quot; }, { &quot;Active&quot; : true, &quot;CountryKey&quot; : &quot;BN&quot;, &quot;Id&quot; : 2, &quot;Name&quot; : &quot;Bangladesh&quot; } ] </code></pre> <p>API Result</p> <pre><code>[ { &quot;id&quot; : 1, &quot;name&quot; : &quot;India&quot;, &quot;active&quot; : true, &quot;countrykey&quot; : &quot;IN&quot; }, { &quot;id&quot; : 2, &quot;name&quot; : &quot;Bangladesh&quot;, &quot;active&quot; : true, &quot;countrykey&quot; : &quot;BN&quot; } ] </code></pre> <p>Here how can I retrieve the result same as WCF from the Web API .net6.0, both the order of the result and the character casing of the properties.</p>
[ { "answer_id": 74129059, "author": "Ivan124", "author_id": 20246826, "author_profile": "https://Stackoverflow.com/users/20246826", "pm_score": 3, "selected": true, "text": "\nlet filtered_table=[];\n tableA.forEach(row => {\n const flag = filters.map((item) => {\n if(row[item.t...
2022/10/19
[ "https://Stackoverflow.com/questions/74128948", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9290736/" ]
74,128,977
<p>I have two models. one is Author and the other is Book. an author can have multiple books. so the id of the author is the foreign key. and I have the following data.</p> <p>Author Table</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>id</th> <th>Author Name</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Tom</td> </tr> </tbody> </table> </div> <p>Books Table</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>id</th> <th>Author</th> <th>Book Name</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>1</td> <td>rescue a person</td> </tr> <tr> <td>2</td> <td>1</td> <td>be a doctor</td> </tr> </tbody> </table> </div> <p>I want to create a function to get the following result when I query the author record.</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>id</th> <th>author name</th> <th>books name</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Tom</td> <td><strong>rescue a person, be a doctor</strong></td> </tr> </tbody> </table> </div>
[ { "answer_id": 74129702, "author": "Amin Mir", "author_id": 8109849, "author_profile": "https://Stackoverflow.com/users/8109849", "pm_score": 2, "selected": false, "text": "prefetch_related" } ]
2022/10/19
[ "https://Stackoverflow.com/questions/74128977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/571102/" ]
74,128,991
<p>I have a class that contains information:</p> <pre><code>class Artists { int id; String description; int year; void insert(int i, String d, int y) { id = i; description = d; year = y; } void display() { System.out.println(id + description + year); } } public class ArtistsRunner { public static void main(String[] args) { Artists a1 = new Artists(); Artists a2 = new Artists(); Artists a3 = new Artists(); a1.insert(23, &quot;An&quot;, 2015); a2.insert(13, &quot;Mon&quot;, 2089); a3.insert(11, &quot;Gla&quot;, 2013); a1.display(); a1.display(); a3.display(); } } </code></pre> <p><strong>I want to make another java class with a collection class of the list of artists. How would I retrieve info from the artists class , make that into a list in my new java class?</strong></p> <p>I think I have to:</p> <ol> <li>declare a static collection field in my class with the main method</li> <li>create a new artist, add it to that collection</li> </ol> <p>Is this correct? How would I do this? (still very new to Java)</p>
[ { "answer_id": 74129122, "author": "Roddy of the Frozen Peas", "author_id": 419705, "author_profile": "https://Stackoverflow.com/users/419705", "pm_score": 1, "selected": false, "text": "List<Artists> myArtists = new ArrayList<>();\nmyArtists.add(a1);\nmyArtists.add(a2);\nmyArtists.add(a...
2022/10/19
[ "https://Stackoverflow.com/questions/74128991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20283951/" ]
74,129,002
<p>I have the following bash script:</p> <pre><code>#!/bin/bash # login x times and calculate avg login time, take note of slowest time and # of logins &gt; 1s function login() { startTime=$(date +%s) curl --location --request GET 'http://www.example.com' endTime=$(date +%s) local callDuration=$(expr $endTime - $startTime) echo &quot;$callDuration&quot; } numLogins=5 allCallDurations=() echo &quot;starting logins&quot; for i in $(seq $numLogins) do modu=$(expr $i % 20) if [ $modu -eq &quot;0&quot; ]; then echo &quot;20 more calls were made&quot; fi duration=$(login) allCallDurations+=($duration) done avgDuration=$(expr $allCallDuration / $numLogins) slowest=${allCallDurations[0]} numSlowLogins=0 for i in $(seq $numLogins) do if (( slowest &gt; ${allCallDurations[$i]} )); then slowest=${allCallDurations[$i]} fi if (( ${allCallDurations[$i]} &gt; 1 )); then numSlowLogins=$(expr $numSlowLogins + 1) fi done echo &quot;finished:&quot; echo &quot;average call duration (s): $avgDuration&quot; echo &quot;slowest call (s): $slowest&quot; echo &quot;# calls &gt; 1 second: $numSlowLogins&quot; </code></pre> <p>The idea is it uses <code>curl</code> to make <code>n</code> number of HTTP calls to a website (here I use example.com but in reality I'm making RESTful calls to my web service's login URL). It calculates the average call duration, the slowest call and the number of calls that took more than a second to return.</p> <p>When I run this script through <a href="https://www.shellcheck.net/" rel="nofollow noreferrer">Shell Check</a> it says everything is fine.</p> <p>But when I run <code>bash myscript.sh</code> (that's the name of this script on my Mac OS file system), I get:</p> <pre><code>bash myscript.sh starting logins % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 772 100 704 100 68 3171 306 --:--:-- --:--:-- --:--:-- 3477 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 772 100 704 100 68 3142 303 --:--:-- --:--:-- --:--:-- 3446 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 772 100 704 100 68 3214 310 --:--:-- --:--:-- --:--:-- 3509 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 772 100 704 100 68 3142 303 --:--:-- --:--:-- --:--:-- 3446 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 772 100 704 100 68 3320 320 --:--:-- --:--:-- --:--:-- 3641 expr: syntax error myscript.sh: line 45: {&quot;json&quot;:&quot;coming-back-from-server&quot;}0&quot;) myscript.sh: line 49: {&quot;json&quot;:&quot;coming-back-from-server&quot;}0 &gt; 1 &quot;) myscript.sh: line 45: {&quot;json&quot;:&quot;coming-back-from-server&quot;}0&quot;) myscript.sh: line 49: {&quot;json&quot;:&quot;coming-back-from-server&quot;}1 &gt; 1 : syntax error: operand expected (error token is &quot;{&quot;json&quot;:&quot;coming-back-from-server&quot;}1 &gt; 1 &quot;) myscript.sh: line 45: {&quot;json&quot;:&quot;coming-back-from-server&quot;}0&quot;) myscript.sh: line 49: {&quot;json&quot;:&quot;coming-back-from-server&quot;}0 &gt; 1 &quot;) myscript.sh: line 45: {&quot;json&quot;:&quot;coming-back-from-server&quot;}0&quot;) myscript.sh: line 49: {&quot;json&quot;:&quot;coming-back-from-server&quot;}0 &gt; 1 &quot;) myscript.sh: line 45: {&quot;json&quot;:&quot;coming-back-from-server&quot;}0&quot;) myscript.sh: line 49: &gt; 1 : syntax error: operand expected (error token is &quot;&gt; 1 &quot;) finished: average call duration (s): slowest call (s): {&quot;json&quot;:&quot;coming-back-from-server&quot;}0 # calls &gt; 1 second: 0 </code></pre> <p>Where <code>{&quot;json&quot;:&quot;coming-back-from-server&quot;}</code> is just a placeholder for the <em>actual</em> json coming back from each curl execution, however its important to note that it is in fact printing JSON values for all of these.</p> <p>Can anyone spot where I'm going awry, and why its failing whereas Shell Check says its good (I mean SC has a few <em>warnings</em> but no <strong>errors</strong>)?</p>
[ { "answer_id": 74129067, "author": "Charles Duffy", "author_id": 14122, "author_profile": "https://Stackoverflow.com/users/14122", "pm_score": 1, "selected": false, "text": " if (( slowest > ${allCallDurations[$i]} )); then\n" }, { "answer_id": 74129310, "author": "markp-fus...
2022/10/19
[ "https://Stackoverflow.com/questions/74129002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5235665/" ]
74,129,016
<p>Here is my data in csv file</p> <pre><code>&quot;Day&quot;,&quot;Person&quot;,&quot;Start&quot;,&quot;End&quot;,&quot;Elapsed&quot; &quot;2022-10-01&quot;,&quot;108 &quot;,&quot;22:34&quot;,&quot;22:35&quot;,&quot;00h, 01m, 25s&quot; &quot;2022-10-04&quot;,&quot;108 &quot;,&quot;08:44&quot;,&quot;08:46&quot;,&quot;00h, 02m, 01s&quot; &quot;2022-10-10&quot;,&quot;108 &quot;,&quot;14:13&quot;,&quot;18:19&quot;,&quot;04h, 06m, 52s&quot; &quot;2022-10-11&quot;,&quot;108 &quot;,&quot;09:38&quot;,&quot;09:42&quot;,&quot;00h, 03m, 58s&quot; &quot;2022-10-12&quot;,&quot;108 &quot;,&quot;08:27&quot;,&quot;17:27&quot;,&quot;09h, 00m, 57s&quot; &quot;2022-10-14&quot;,&quot;108 &quot;,&quot;09:02&quot;,&quot;23:20&quot;,&quot;14h, 18m, 30s&quot; &quot;2022-10-15&quot;,&quot;108 &quot;,&quot;10:02&quot;,&quot;10:12&quot;,&quot;00h, 10m, 25s&quot; &quot;2022-10-18&quot;,&quot;108 &quot;,&quot;07:48&quot;,&quot;07:50&quot;,&quot;00h, 02m, 26s&quot; &quot;2022-10-19&quot;,&quot;108 &quot;,&quot;08:14&quot;,&quot;14:51&quot;,&quot;06h, 36m, 18s&quot; &quot;2022-10-03&quot;,&quot;109 &quot;,&quot;08:36&quot;,&quot;19:23&quot;,&quot;10h, 47m, 19s&quot; &quot;2022-10-04&quot;,&quot;109 &quot;,&quot;08:23&quot;,&quot;17:25&quot;,&quot;09h, 02m, 17s&quot; &quot;2022-10-05&quot;,&quot;109 &quot;,&quot;08:37&quot;,&quot;19:52&quot;,&quot;11h, 14m, 45s&quot; &quot;2022-10-06&quot;,&quot;109 &quot;,&quot;08:30&quot;,&quot;20:54&quot;,&quot;12h, 23m, 42s&quot; &quot;2022-10-07&quot;,&quot;109 &quot;,&quot;08:32&quot;,&quot;19:08&quot;,&quot;10h, 35m, 35s&quot; &quot;2022-10-10&quot;,&quot;109 &quot;,&quot;08:27&quot;,&quot;17:23&quot;,&quot;08h, 56m, 57s&quot; &quot;2022-10-11&quot;,&quot;109 &quot;,&quot;08:29&quot;,&quot;16:12&quot;,&quot;07h, 43m, 12s&quot; &quot;2022-10-12&quot;,&quot;109 &quot;,&quot;08:32&quot;,&quot;20:08&quot;,&quot;11h, 35m, 31s&quot; &quot;2022-10-13&quot;,&quot;109 &quot;,&quot;08:32&quot;,&quot;17:33&quot;,&quot;09h, 01m, 31s&quot; &quot;2022-10-14&quot;,&quot;109 &quot;,&quot;08:49&quot;,&quot;19:01&quot;,&quot;10h, 11m, 49s&quot; &quot;2022-10-17&quot;,&quot;109 &quot;,&quot;08:33&quot;,&quot;18:34&quot;,&quot;10h, 01m, 13s&quot; &quot;2022-10-18&quot;,&quot;109 &quot;,&quot;08:34&quot;,&quot;17:54&quot;,&quot;09h, 20m, 01s&quot; &quot;2022-10-19&quot;,&quot;109 &quot;,&quot;08:27&quot;,&quot;08:29&quot;,&quot;00h, 02m, 08s&quot; &quot;2022-10-03&quot;,&quot;112 &quot;,&quot;08:04&quot;,&quot;17:40&quot;,&quot;09h, 35m, 49s&quot; &quot;2022-10-04&quot;,&quot;112 &quot;,&quot;09:06&quot;,&quot;16:26&quot;,&quot;07h, 19m, 34s&quot; &quot;2022-10-05&quot;,&quot;112 &quot;,&quot;08:09&quot;,&quot;17:24&quot;,&quot;09h, 15m, 06s&quot; &quot;2022-10-06&quot;,&quot;112 &quot;,&quot;08:02&quot;,&quot;18:32&quot;,&quot;10h, 30m, 01s&quot; &quot;2022-10-07&quot;,&quot;112 &quot;,&quot;08:07&quot;,&quot;18:40&quot;,&quot;10h, 32m, 47s&quot; &quot;2022-10-10&quot;,&quot;112 &quot;,&quot;08:02&quot;,&quot;18:05&quot;,&quot;10h, 03m, 03s&quot; &quot;2022-10-11&quot;,&quot;112 &quot;,&quot;08:05&quot;,&quot;18:05&quot;,&quot;10h, 00m, 03s&quot; &quot;2022-10-12&quot;,&quot;112 &quot;,&quot;08:03&quot;,&quot;18:04&quot;,&quot;10h, 01m, 13s&quot; &quot;2022-10-13&quot;,&quot;112 &quot;,&quot;08:06&quot;,&quot;18:27&quot;,&quot;10h, 21m, 10s&quot; &quot;2022-10-14&quot;,&quot;112 &quot;,&quot;08:23&quot;,&quot;18:19&quot;,&quot;09h, 56m, 07s&quot; </code></pre> <p>I want output is like this:</p> <pre><code>&quot;Day&quot;,&quot;Person&quot;,&quot;Start&quot;,&quot;End&quot;,&quot;Elapsed&quot; &quot;2022-10-01&quot;,&quot;108 &quot;,&quot;22:34&quot;,&quot;22:35&quot;,&quot;00h, 01m, 25s&quot; &quot;2022-10-04&quot;,&quot;108 &quot;,&quot;08:44&quot;,&quot;08:46&quot;,&quot;00h, 02m, 01s&quot; &quot;2022-10-10&quot;,&quot;108 &quot;,&quot;14:13&quot;,&quot;18:19&quot;,&quot;04h, 06m, 52s&quot; &quot;2022-10-11&quot;,&quot;108 &quot;,&quot;09:38&quot;,&quot;09:42&quot;,&quot;00h, 03m, 58s&quot; &quot;2022-10-12&quot;,&quot;108 &quot;,&quot;08:27&quot;,&quot;17:27&quot;,&quot;09h, 00m, 57s&quot; &quot;2022-10-14&quot;,&quot;108 &quot;,&quot;09:02&quot;,&quot;23:20&quot;,&quot;14h, 18m, 30s&quot; &quot;2022-10-15&quot;,&quot;108 &quot;,&quot;10:02&quot;,&quot;10:12&quot;,&quot;00h, 10m, 25s&quot; &quot;2022-10-18&quot;,&quot;108 &quot;,&quot;07:48&quot;,&quot;07:50&quot;,&quot;00h, 02m, 26s&quot; &quot;2022-10-19&quot;,&quot;108 &quot;,&quot;08:14&quot;,&quot;14:51&quot;,&quot;06h, 36m, 18s&quot; Employee total working hrs with minutes in all days = ? &quot;2022-10-03&quot;,&quot;109 &quot;,&quot;08:36&quot;,&quot;19:23&quot;,&quot;10h, 47m, 19s&quot; &quot;2022-10-04&quot;,&quot;109 &quot;,&quot;08:23&quot;,&quot;17:25&quot;,&quot;09h, 02m, 17s&quot; &quot;2022-10-05&quot;,&quot;109 &quot;,&quot;08:37&quot;,&quot;19:52&quot;,&quot;11h, 14m, 45s&quot; &quot;2022-10-06&quot;,&quot;109 &quot;,&quot;08:30&quot;,&quot;20:54&quot;,&quot;12h, 23m, 42s&quot; &quot;2022-10-07&quot;,&quot;109 &quot;,&quot;08:32&quot;,&quot;19:08&quot;,&quot;10h, 35m, 35s&quot; &quot;2022-10-10&quot;,&quot;109 &quot;,&quot;08:27&quot;,&quot;17:23&quot;,&quot;08h, 56m, 57s&quot; &quot;2022-10-11&quot;,&quot;109 &quot;,&quot;08:29&quot;,&quot;16:12&quot;,&quot;07h, 43m, 12s&quot; &quot;2022-10-12&quot;,&quot;109 &quot;,&quot;08:32&quot;,&quot;20:08&quot;,&quot;11h, 35m, 31s&quot; &quot;2022-10-13&quot;,&quot;109 &quot;,&quot;08:32&quot;,&quot;17:33&quot;,&quot;09h, 01m, 31s&quot; &quot;2022-10-14&quot;,&quot;109 &quot;,&quot;08:49&quot;,&quot;19:01&quot;,&quot;10h, 11m, 49s&quot; &quot;2022-10-17&quot;,&quot;109 &quot;,&quot;08:33&quot;,&quot;18:34&quot;,&quot;10h, 01m, 13s&quot; &quot;2022-10-18&quot;,&quot;109 &quot;,&quot;08:34&quot;,&quot;17:54&quot;,&quot;09h, 20m, 01s&quot; &quot;2022-10-19&quot;,&quot;109 &quot;,&quot;08:27&quot;,&quot;08:29&quot;,&quot;00h, 02m, 08s&quot; Employee total working hrs with minutes in all days = ? &quot;2022-10-03&quot;,&quot;112 &quot;,&quot;08:04&quot;,&quot;17:40&quot;,&quot;09h, 35m, 49s&quot; &quot;2022-10-04&quot;,&quot;112 &quot;,&quot;09:06&quot;,&quot;16:26&quot;,&quot;07h, 19m, 34s&quot; &quot;2022-10-05&quot;,&quot;112 &quot;,&quot;08:09&quot;,&quot;17:24&quot;,&quot;09h, 15m, 06s&quot; &quot;2022-10-06&quot;,&quot;112 &quot;,&quot;08:02&quot;,&quot;18:32&quot;,&quot;10h, 30m, 01s&quot; &quot;2022-10-07&quot;,&quot;112 &quot;,&quot;08:07&quot;,&quot;18:40&quot;,&quot;10h, 32m, 47s&quot; &quot;2022-10-10&quot;,&quot;112 &quot;,&quot;08:02&quot;,&quot;18:05&quot;,&quot;10h, 03m, 03s&quot; &quot;2022-10-11&quot;,&quot;112 &quot;,&quot;08:05&quot;,&quot;18:05&quot;,&quot;10h, 00m, 03s&quot; &quot;2022-10-12&quot;,&quot;112 &quot;,&quot;08:03&quot;,&quot;18:04&quot;,&quot;10h, 01m, 13s&quot; &quot;2022-10-13&quot;,&quot;112 &quot;,&quot;08:06&quot;,&quot;18:27&quot;,&quot;10h, 21m, 10s&quot; &quot;2022-10-14&quot;,&quot;112 &quot;,&quot;08:23&quot;,&quot;18:19&quot;,&quot;09h, 56m, 07s&quot; Employee total working hrs with minutes in all days = ? </code></pre> <p>i am using this powershell code to sort in ascending order</p> <p>` import-csv &quot;c:\temp\export.csv&quot; -Delimiter &quot;,&quot;| Sort-Object -Property @{Expression = &quot;person&quot;}, @{Expression = &quot;Date&quot;} | export-csv &quot;c:\temp\export2.csv&quot; -NoTypeInformation -Delimiter &quot;,&quot; -Force</p> <p>`</p>
[ { "answer_id": 74142061, "author": "Olaf", "author_id": 9196560, "author_profile": "https://Stackoverflow.com/users/9196560", "pm_score": 1, "selected": false, "text": "$InputData = @'\n\"Day\",\"Person\",\"Start\",\"End\",\"Elapsed\"\n\"2022-10-01\",\"108 \",\"22:34\",\"22:35\",\"00h,...
2022/10/19
[ "https://Stackoverflow.com/questions/74129016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20273242/" ]
74,129,020
<p>I need to find the sum of digits of the numbers in a vector and I wrote this:</p> <pre><code>once1&lt;- 10:19 sum&lt;-0 for (i in 1:10){ while(once1[i] &gt; 0) { resto &lt;- once1[i] %% 10 sum[i] &lt;- sum[i] + resto once1[i] &lt;- once1[i] %/% 10 } i&lt;-i+1 } sum </code></pre> <p>But it only works for the first iteration and cannot see why. Thank you very much in advance!</p>
[ { "answer_id": 74129058, "author": "Jilber Urbina", "author_id": 1315767, "author_profile": "https://Stackoverflow.com/users/1315767", "pm_score": 2, "selected": false, "text": "> sapply(strsplit(as.character(once1), \"\"), function(x){sum(as.numeric(x))})\n [1] 1 2 3 4 5 6 7 8 ...
2022/10/19
[ "https://Stackoverflow.com/questions/74129020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20273795/" ]
74,129,022
<p>I am trying to extract the following address from the 10-Q on this webpage and need help getting it to work: <a href="https://www.sec.gov/ix?doc=/Archives/edgar/data/1318605/000095017022012936/tsla-20220630.htm" rel="nofollow noreferrer">https://www.sec.gov/ix?doc=/Archives/edgar/data/1318605/000095017022012936/tsla-20220630.htm</a></p> <p>1 Tesla Road Austin, Texas</p> <pre><code>URL = f'https://www.sec.gov/ix?doc=/Archives/edgar/data/{cik}/{accessionNumber}/{primaryDocument}' response = requests.get(URL, headers = headers) soup = BeautifulSoup(response.content, &quot;html.parser&quot;) soup.find_all('dei:EntityAddressAddressLine1') </code></pre> <p>Where:</p> <ul> <li>cik = 0001318605</li> <li>accessionNumber = 000095017022012936</li> <li>primaryDocument = tsla-20220630.htm</li> </ul>
[ { "answer_id": 74129058, "author": "Jilber Urbina", "author_id": 1315767, "author_profile": "https://Stackoverflow.com/users/1315767", "pm_score": 2, "selected": false, "text": "> sapply(strsplit(as.character(once1), \"\"), function(x){sum(as.numeric(x))})\n [1] 1 2 3 4 5 6 7 8 ...
2022/10/19
[ "https://Stackoverflow.com/questions/74129022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13084623/" ]