qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
74,130,801 | <p>I have a the following code for setting up availability per region -</p>
<pre><code>enum Region {
UK,
US,
EU;
private final double availability;
Region() {
this.availability = 1; //constructor 1
}
Region(double availability) { //constructor 2
this.availability = availability;
}
public double getAvailability() { //getter
return this.availability;
}
}
</code></pre>
<p>I'm writing test cases for the above code to test the constructors as below -</p>
<pre><code>@Test
void testConstructor1() {
assertEquals(1, Region.UK.getAvailability())
}
</code></pre>
<p>I'm confused how to write the test case for second constructor as enums cannot have objects created like classes.</p>
<pre><code>@Test
void testConstructor2(){
HERE WE CANNOT CREATE AN OBJECT TO PASS THE VALUE THE TEST CONSTRUCTOR 2 RIGHT?
</code></pre>
<p>How can I solve this?</p>
<p>If it's a class we can simply create object and pass in the value and test it.</p>
<p>Please take time in answering the questions below -</p>
<ol>
<li>Can enums have objects created like classes?
2.Is there any alternative way that can be achieved similar to objects?</li>
</ol>
| [
{
"answer_id": 74130932,
"author": "Sweeper",
"author_id": 5133585,
"author_profile": "https://Stackoverflow.com/users/5133585",
"pm_score": 1,
"selected": false,
"text": "UK"
}
] | 2022/10/19 | [
"https://Stackoverflow.com/questions/74130801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19759349/"
] |
74,130,811 | <p>I have the following select statements below that each have their own inner join to another table based on the same client_id. How can I combine these into a single query? The fact that each already relies on a inner join to a different table is what is giving me trouble.
The desired results are to have all the columns from each SELECT statement output from a single query based on the one client_id.</p>
<pre><code>DECLARE client_id INT
SET client_id = {placeholder}
SELECT
N.first_name,
N.middle_name,
N.last_name
FROM Name N WITH(NOLOCK)
LEFT OUTER JOIN NameLink C WITH(NOLOCK)
ON N.name_id = C.name_id
WHERE C.client_id = @client_id
SELECT
A.street_name,
A.house_num,
A.city,
A.state_id,
A.zip,
S.state
FROM Address A
INNER JOIN AddressLink C
ON A.address_id = C.address_id
INNER JOIN State S
ON A.state_id = S.state_id
WHERE C.client_id = @client_id
SELECT
E.email
FROM Email E
INNER JOIN EmailLink C
ON E.email_id = C.email_id
WHERE C.client_id = @client_id
SELECT
P.phone_num
FROM Phone P
INNER JOIN PhoneLink C
ON P.phone_id = C.phone_id
WHERE C.client_id = @client_id
</code></pre>
| [
{
"answer_id": 74130932,
"author": "Sweeper",
"author_id": 5133585,
"author_profile": "https://Stackoverflow.com/users/5133585",
"pm_score": 1,
"selected": false,
"text": "UK"
}
] | 2022/10/19 | [
"https://Stackoverflow.com/questions/74130811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8233408/"
] |
74,130,827 | <p><em>I have a json file with a similar output of a couple of hundred line.
What should be the approach to add a new element "RANK" to each dictionary and assign an increment value to it? How can it be done using python?</em></p>
<pre><code>XYZ=json.load(open("countries.geo.json",'r'))
</code></pre>
<p>OUTPUT</p>
<pre><code>**{'type': 'Feature',
'id': 'BEL',
'properties': {'name': 'Belgium'},
'geometry': {'type': 'Polygon',
'coordinates': [[[3.314971, 51.345781],
[4.047071, 51.267259],
[3.314971, 51.345781]]]}}
{'type': 'Feature',
'id': 'BLZ',
'properties': {'name': 'Belize'},
'geometry': {'type': 'Polygon',
'coordinates': [[[-89.14308, 17.808319],
[-89.150909, 17.955468],
[-89.14308, 17.808319]]]}}**
</code></pre>
<blockquote>
<p>DESIRED OUTPUT</p>
</blockquote>
<pre><code> **{'type': 'Feature',
'id': 'BEL',
'properties': {'name': 'Belgium'},
*'RANK':'1'*
'geometry': {'type': 'Polygon',
'coordinates': [[[3.314971, 51.345781],
[4.047071, 51.267259],
[3.314971, 51.345781]]]}}
{'type': 'Feature',
'id': 'BLZ',
'properties': {'name': 'Belize'},
*'RANK':'2'*
'geometry': {'type': 'Polygon',
'coordinates': [[[-89.14308, 17.808319],
[-89.150909, 17.955468],
[-89.14308, 17.808319]]]}}**
</code></pre>
| [
{
"answer_id": 74130932,
"author": "Sweeper",
"author_id": 5133585,
"author_profile": "https://Stackoverflow.com/users/5133585",
"pm_score": 1,
"selected": false,
"text": "UK"
}
] | 2022/10/19 | [
"https://Stackoverflow.com/questions/74130827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17794943/"
] |
74,130,829 | <p>When i try to import some data using xpath from the url in the following code i get an empty list:</p>
<pre><code>
import requests
from lxml import html
url = 'https://www.sofascore.com/team/football/palmeiras/1963'
browsers = {'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 \(KHTML, like Gecko) Chrome / 86.0.4240.198Safari / 537.36"}
page = requests.get(url, headers=browsers)
tree = html.fromstring(page.content)
elements = tree.xpath('//*[@id="__next"]/div/main/div/div[2]/div[2]/div/div[2]/div[3]/div[2]/div[2]/div[1]/span[1]')
print(elements[0].text)
</code></pre>
<p>Output:</p>
<pre><code>[]
</code></pre>
<p>What i expect:</p>
<pre><code>'Matches'
</code></pre>
<p>It's for a project that analyzes the behavior of brazilian teams of football, so i want to import all the statistics of each team and create a data frame with those data, but i need to pull all the data from the site first.</p>
| [
{
"answer_id": 74130932,
"author": "Sweeper",
"author_id": 5133585,
"author_profile": "https://Stackoverflow.com/users/5133585",
"pm_score": 1,
"selected": false,
"text": "UK"
}
] | 2022/10/19 | [
"https://Stackoverflow.com/questions/74130829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14453265/"
] |
74,130,858 | <p>This can be accomplished with</p>
<pre><code>cube = (
cube[::2, ::2, ::2]
+ cube[1::2, ::2, ::2]
+ cube[::2, 1::2, ::2]
+ cube[1::2, 1::2, ::2]
+ cube[::2, ::2, 1::2]
+ cube[1::2, ::2, 1::2]
+ cube[::2, 1::2, 1::2]
+ cube[1::2, 1::2, 1::2]
)
</code></pre>
<p>But I'm wondering if there is a function to accomplish this quickly and cleanly. If not, is there a canonical name for this operation?</p>
| [
{
"answer_id": 74131003,
"author": "ShlomiF",
"author_id": 5024514,
"author_profile": "https://Stackoverflow.com/users/5024514",
"pm_score": 2,
"selected": true,
"text": "block_reduce"
},
{
"answer_id": 74135158,
"author": "Daniel F",
"author_id": 4427777,
"author_pro... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74130858",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1842491/"
] |
74,130,863 | <p>I have a table in mysql database that has the following structure and data.</p>
<pre><code>City zip year value
AB, NM 87102 2012 150
AB, NM 87102 2013 175
AB, NM 87102 2014 200
DL, TX 75212 2018 100
DL, TX 75212 2019 150
DL, TX 75212 2020 175
AT, TX 83621 2020 150
</code></pre>
<p>I am trying to <code>group by</code> city, and zip fields and calculate % change between latest two available years for the group. Note, the latest two available years may not be consecutive and not all groups may have two years of data.</p>
<p>Expected output:</p>
<pre><code>City zip pct_change
AB, NM 87102 14.3
DL, TX 75212 16.6
</code></pre>
<p>Query:</p>
<pre><code>select City, zip, max(year), calculate diff between value
from table
group by City, zip
where ....
</code></pre>
| [
{
"answer_id": 74131003,
"author": "ShlomiF",
"author_id": 5024514,
"author_profile": "https://Stackoverflow.com/users/5024514",
"pm_score": 2,
"selected": true,
"text": "block_reduce"
},
{
"answer_id": 74135158,
"author": "Daniel F",
"author_id": 4427777,
"author_pro... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74130863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3380902/"
] |
74,130,866 | <p>I am a beginner with JavaScript and don't know how to solve this simple issue.
I want to add text in h2 from an array with for loop</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function () {
const titles = ["Title 1", "Title 2", "Title 3", "Title 3"];
for (let i = 0; i < titles.length; i++) {
var addText = "<h2>";
addText += titles[i];
addText += "</h2>";
$(".ic-table-h2").append(addText);
};
});</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
<div class="container">
<div class="ic-table-h2"></div>
<div class="ic-table-h2"></div>
<div class="ic-table-h2"></div>
<div class="ic-table-h2"></div>
</div></code></pre>
</div>
</div>
</p>
| [
{
"answer_id": 74131003,
"author": "ShlomiF",
"author_id": 5024514,
"author_profile": "https://Stackoverflow.com/users/5024514",
"pm_score": 2,
"selected": true,
"text": "block_reduce"
},
{
"answer_id": 74135158,
"author": "Daniel F",
"author_id": 4427777,
"author_pro... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74130866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20285880/"
] |
74,130,909 | <p>Is there an Excel formula that will return the first value in a set of non-sequential cells?</p>
<p>I am using this formula and it works for sequential cells, but not for non-sequential cells.</p>
<p><code>=INDEX(range,MATCH(FALSE,ISBLANK(range),0))</code></p>
<p>For example, if Row 2 in my spreadsheet was like this and I used the formula above with a range of B2:D2, the formula would return a value of 6.</p>
<p>What I want to do is find the first value of B2, D2, and F2 (or any non-sequential range), which would be 8. I updated the formula to what is below but that returned #N/A.</p>
<p><code>=INDEX((B2,D2,F2),MATCH(FALSE,ISBLANK((B2,D2,F2)),0))</code></p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Row 1</th>
<th>A</th>
<th>B</th>
<th>C</th>
<th>D</th>
<th>E</th>
<th>F</th>
</tr>
</thead>
<tbody>
<tr>
<td>Row 2</td>
<td>5</td>
<td></td>
<td>6</td>
<td>8</td>
<td>11</td>
<td>13</td>
</tr>
</tbody>
</table>
</div> | [
{
"answer_id": 74131758,
"author": "JvdV",
"author_id": 9758194,
"author_profile": "https://Stackoverflow.com/users/9758194",
"pm_score": 2,
"selected": false,
"text": "=@FILTER(B1:F1,ISEVEN(COLUMN(B1:F1))*(B1:F1<>\"\"),\"\")\n"
},
{
"answer_id": 74138315,
"author": "Tom Shar... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74130909",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18218543/"
] |
74,130,916 | <p>I'm working on a <a href="https://lshillman.github.io/anglo-piano/" rel="nofollow noreferrer">music web app</a> that has a piano keyboard. When a user presses a piano key, I'm using OscillatorNode to play a brief tone corresponding to the key:</p>
<pre><code>const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
function playNote(note) {
let oscillator;
let freq = notes[note];
console.debug(note + " (" + freq + " Hz)");
oscillator = audioCtx.createOscillator(); // create Oscillator node
oscillator.type = wavetypeEl.val(); // triangle wave by default
oscillator.frequency.setValueAtTime(freq, audioCtx.currentTime); // freq = value in hertz
oscillator.connect(audioCtx.destination);
oscillator.start();
oscillator.stop(audioCtx.currentTime + 0.5);
}
$('#keyboard button').on('click', (e) => {
playNote(e.target.dataset.note);
});
</code></pre>
<p>This works on all the desktop and Android browsers I've tried, but iOS stubbornly refuses to play any sound. I see that I need a user interaction to "unlock" an AudioContext on iOS, but I would have thought calling <code>playNote()</code> from my click function would have done the trick.</p>
<p><a href="https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/PlayingandSynthesizingSounds/PlayingandSynthesizingSounds.html" rel="nofollow noreferrer">According to Apple</a>, I should be able to use <code>noteOn()</code> on my oscillator object, instead of <code>oscillator.start()</code> the way I've got it in my example. But that doesn't seem to be a valid method.</p>
<p>I must be missing something simple here. Anybody know?</p>
| [
{
"answer_id": 74131758,
"author": "JvdV",
"author_id": 9758194,
"author_profile": "https://Stackoverflow.com/users/9758194",
"pm_score": 2,
"selected": false,
"text": "=@FILTER(B1:F1,ISEVEN(COLUMN(B1:F1))*(B1:F1<>\"\"),\"\")\n"
},
{
"answer_id": 74138315,
"author": "Tom Shar... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74130916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3304085/"
] |
74,130,954 | <p>An issue I'm amazed I couldn't solve on my own. I can not seem to remove the standard white background from any text added to my page. I have tried being broad and making the body and p tags transparent as well as being specific with classes. No luck.</p>
<p><a href="https://i.stack.imgur.com/VSSsF.jpg" rel="nofollow noreferrer">The white text background at the bottom</a></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>* {
margin: 0;
padding: 0;
font-family: sans-serif;
}
.backgroundImage {
background-image: linear-gradient(rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.75)), url(desk1.jpg);
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
height: 100vh;
}
body {
background: transparent;
background-color: transparent;
}
p {
background: transparent;
background-color: transparent;
}
.divText {
background: transparent;
background-color: transparent;
}
.text1 {
font-size: 40px;
background: transparent;
background-color: transparent;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="backgroundImage"></div>
<div class="divText">
<p class="text1">
many words are written here to take up lots and lots of space. i do this to test the scrolling of my background image thank you very very much
</p>
</div></code></pre>
</div>
</div>
</p>
| [
{
"answer_id": 74131758,
"author": "JvdV",
"author_id": 9758194,
"author_profile": "https://Stackoverflow.com/users/9758194",
"pm_score": 2,
"selected": false,
"text": "=@FILTER(B1:F1,ISEVEN(COLUMN(B1:F1))*(B1:F1<>\"\"),\"\")\n"
},
{
"answer_id": 74138315,
"author": "Tom Shar... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74130954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20285827/"
] |
74,130,961 | <p>I am provisioning an EC2 using Terraform, and I am leveraging PowerShell to programmatically create a local admin user on the EC2 when the Terraform is run. The problem I am running into is that when the EC2 is launched, and I go into the "View/Change User Data" option under "Instance Settings" on the EC2, it is showing the local admin user's password in plain text. Is there any way to do this so that it does not show the password within the User Data section? Below is the PS:</p>
<pre><code><powershell>
($User = "brittany")
$Password = ConvertTo-SecureString "MyPassword123" -AsPlainText -Force
New-LocalUser $User -Password $Password
Add-LocalGroupMember -Group "Remote Desktop Users” -Member $User
Add-LocalGroupMember -Group "Administrators" -Member $User
</powershell>
</code></pre>
<p><a href="https://i.stack.imgur.com/RZKTY.png" rel="nofollow noreferrer">EC2 User Data Screenshot</a></p>
| [
{
"answer_id": 74131484,
"author": "Paolo",
"author_id": 3390419,
"author_profile": "https://Stackoverflow.com/users/3390419",
"pm_score": 3,
"selected": true,
"text": "user_data = <<-EOF\n<powershell>\n($User = \"brittany\")\n$Password = (aws secretsmanager get-secret-value --secret-id ... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74130961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13730899/"
] |
74,130,996 | <p>I am trying to create a regex to match several different dimensional patterns and their units.</p>
<p>Below are examples of the patterns. The numbers can be an integer, or a decimal. The dimensional separator can be: "x", "by" or "transverse by". The units are cm or mm</p>
<p>3.4 x 2 cm</p>
<p>3.4 by 2 cm</p>
<p>3.4 mm x 2.0 mm</p>
<p>3.4 cm x 2.0 cm x 2 cm</p>
<p>3.4 x 2 x 2.0 x 2 cm</p>
<p>3.4 cm x 2 cm transverse by 2.0 cm</p>
<p>3.4 transverse by 2.0 cm</p>
<p>3.4 mm transverse by 2.0 mm</p>
<p>4 cm</p>
<p>4.5 cm</p>
<p>So far I have the following:</p>
<pre><code>(\d+(\.\d+|)\s?(x|by)\s?\d+(\.\d+|)(\s?(x|by)\s?\d*(\.?\d+|))?) (cm|mm)
</code></pre>
<p>But it doesn't pick up "transverse by", 3.4 mm x 2.0 mm, or 3 mm</p>
<p>Thanks in advance!</p>
| [
{
"answer_id": 74131484,
"author": "Paolo",
"author_id": 3390419,
"author_profile": "https://Stackoverflow.com/users/3390419",
"pm_score": 3,
"selected": true,
"text": "user_data = <<-EOF\n<powershell>\n($User = \"brittany\")\n$Password = (aws secretsmanager get-secret-value --secret-id ... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74130996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20285915/"
] |
74,131,015 | <p>I am a beginner in Android development. I am trying to implement RecyclerView which shows a list of groups after downloading it from the Realtime Database.
The function loadGroups() is called from the main activity to return a list which is then fed to the RecyclerView adapter.
The data is being downloaded correctly but seems like myList is returned first and elements from firebase are added a few millis later. I want the program to wait for the elements to be added to myList and then return it</p>
<pre><code>class DataSource {
private lateinit var myDatabase: DatabaseReference
var myList : MutableList<Group> = mutableListOf<Group>();
fun loadGroups(): MutableList<Group> {
// Here I want to let the loadGroupsFromFirebase() complete adding groups to mylist
// after that is completed, mylist should be returned
loadGroupsFromFirebase()
Log.d("mylist", "returning my list")
return myList
}
private fun loadGroupsFromFirebase(){
myDatabase = FirebaseDatabase.getInstance().getReference("myGroupsList")
val postListener = object : ValueEventListener {
override fun onDataChange(myDataSnapshot: DataSnapshot) {
if(myDataSnapshot.exists()){
Log.d("mylist", "does exist ${myDataSnapshot.getValue().toString()}")
myList.clear()
for(dataSnapshot in myDataSnapshot.children){
val myGroupDetails = dataSnapshot.getValue<Group>()!!;
myList.add(myGroupDetails)
myList.add(Group(myIconId=2131165282, myTitle="G1", myLink = "https://s*****************************************9", numberOfPeople=100))
Log.d("mylist", "does exist CODE 00 ${myList.toString()}")
}
}
else {
Log.d("mylist", "does not exist")
}
}
override fun onCancelled(databaseError: DatabaseError) {
// Getting Post failed, log a message
Log.w("mylist", "loadPost:onCancelled", databaseError.toException())
}
}
myDatabase.addValueEventListener(postListener)
}
</code></pre>
<p>}</p>
<p>Any help would be appreciated :)
Below is the screenshot of logcat.</p>
<p><a href="https://i.stack.imgur.com/jXtC7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jXtC7.png" alt="log screenshot" /></a></p>
| [
{
"answer_id": 74131484,
"author": "Paolo",
"author_id": 3390419,
"author_profile": "https://Stackoverflow.com/users/3390419",
"pm_score": 3,
"selected": true,
"text": "user_data = <<-EOF\n<powershell>\n($User = \"brittany\")\n$Password = (aws secretsmanager get-secret-value --secret-id ... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13385838/"
] |
74,131,019 | <p>IE, does PHP use its own, internal version of cURL or does it use whatever it finds in the local OS (Windows 10)? I'm in the unfortunate position of trying to make scripts written in 7.4 work on a permanent home that's saddled with 7.1. Before I force an update of PHP, I want to make sure chasing the right problem. I've searched php.ini and don't see a path to the local file system.</p>
<p>Thanks!</p>
| [
{
"answer_id": 74134427,
"author": "Misunderstood",
"author_id": 3813605,
"author_profile": "https://Stackoverflow.com/users/3813605",
"pm_score": 0,
"selected": false,
"text": "<?php\nphpinfo(); \n?>\n"
},
{
"answer_id": 74140976,
"author": "IMSoP",
"author_id": 157957,
... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19989383/"
] |
74,131,020 | <p>I am at my wits end as to why this loop is failing to concatenate the files the way I need it. Basically, lets say we have following files:</p>
<pre><code>AB124661.lane3.R1.fastq.gz
AB124661.lane4.R1.fastq.gz
AB124661.lane3.R2.fastq.gz
AB124661.lane4.R2.fastq.gz
</code></pre>
<p>What we want is:</p>
<pre><code>cat AB124661.lane3.R1.fastq.gz AB124661.lane4.R1.fastq.gz > AB124661.R1.fastq.gz
cat AB124661.lane3.R2.fastq.gz AB124661.lane4.R2.fastq.gz > AB124661.R2.fastq.gz
</code></pre>
<p>What I tried (and didn't work):</p>
<ol>
<li>Create and save file names (AB124661) to a ID file:</li>
</ol>
<blockquote>
<p>ls -1 <em>R1</em>.gz | awk -F '.' '{print $1}' | sort | uniq > ID</p>
</blockquote>
<p>This creates an ID file that stores the samples/files name.</p>
<ol start="2">
<li>Run the following loop:</li>
</ol>
<blockquote>
<pre><code>for i in `cat ./ID`; do cat $i\.lane3.R1.fastq.gz $i\.lane4.R1.fastq.gz \> out/$i\.R1.fastq.gz; done
for i in `cat ./ID`; do cat $i\.lane3.R2.fastq.gz $i\.lane4.R2.fastq.gz \> out/$i\.R2.fastq.gz; done
</code></pre>
</blockquote>
<p>The loop fails and concatenates into empty files.</p>
<p>Things I tried:</p>
<ul>
<li>Yes, the ID file is definitely in the folder</li>
<li>When I run with echo it shows the cat command correct</li>
</ul>
<p>Any help will be very much appreciated,</p>
<p>Best,</p>
<p>AC</p>
| [
{
"answer_id": 74131194,
"author": "glenn jackman",
"author_id": 7552,
"author_profile": "https://Stackoverflow.com/users/7552",
"pm_score": 3,
"selected": true,
"text": "\\>"
},
{
"answer_id": 74131227,
"author": "Xin Cheng",
"author_id": 4708399,
"author_profile": "... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13989408/"
] |
74,131,028 | <p>I have two different functions which has two different dictionaries. First, I have to merge to dictionaries into one and then connect two dataframe.</p>
<pre><code>import pandas as pd
output_df1 = {}
output_df1['diff_sum'] = 108
output_df1['cumsum'] = 232
out2 = {}
out2['carving'] = 1299
out2['bearing'] = 255
merge_dict = {**output_df1, **out2}
# upto this I'm able to do this
new_df = pd.DataFrame()
new_df['tata'] = merge_dict
new_df['diff_sum'] = 108
new_df
</code></pre>
<p>Getting result</p>
<p><a href="https://i.stack.imgur.com/6qYUV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6qYUV.png" alt="enter image description here" /></a></p>
<p>Want this</p>
<p><a href="https://i.stack.imgur.com/cyej4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cyej4.png" alt="enter image description here" /></a></p>
<p>How can I do it?</p>
| [
{
"answer_id": 74131163,
"author": "Andrej Kesely",
"author_id": 10035985,
"author_profile": "https://Stackoverflow.com/users/10035985",
"pm_score": 3,
"selected": true,
"text": "new_df = pd.DataFrame(merge_dict.values(), index=merge_dict, columns=[\"tata\"])\nprint(new_df)\n"
},
{
... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15543946/"
] |
74,131,047 | <p>Per the <a href="https://stat.ethz.ch/R-manual/R-devel/library/base/html/zMachine.html" rel="nofollow noreferrer">docs</a>, "on a typical R platform the smallest positive double is about <code>5e-324</code>." Given a double vector with values above, near, and below this limit:</p>
<pre class="lang-r prettyprint-override"><code>library(tibble)
small_vec <- c(4e-300, 4e-324, 4e-350)
small_df <- data.frame(x = small_vec)
small_tibble <- tibble(x = small_vec)
</code></pre>
<p>Printing <code>small_vec</code> and <code>small_df</code> give about what I'd expect:</p>
<pre class="lang-r prettyprint-override"><code>small_vec
#> [1] 4.000000e-300 4.940656e-324 0.000000e+00
small_df
#> x
#> 1 4.000000e-300
#> 2 4.940656e-324
#> 3 0.000000e+00
</code></pre>
<p>The second value isn't quite right, which I vaguely understand is due to floating point weirdness. The third number underflows to <code>0</code>. Fine. But printing as a tibble,</p>
<pre class="lang-r prettyprint-override"><code>small_tibble
#> # A tibble: 3 × 1
#> x
#> <dbl>
#> 1 4 e-300
#> 2 Inf.e-324
#> 3 0
</code></pre>
<p><sup>Created on 2022-10-19 with <a href="https://reprex.tidyverse.org" rel="nofollow noreferrer">reprex v2.0.2</a></sup></p>
<p>I'm thrown by <code>Inf.e-324</code> -- both the idea of <code>Inf</code> with an exponent, and the decimal point. What does this signify? Or is it possibly a bug in the tibble package?</p>
| [
{
"answer_id": 74131254,
"author": "Ben Bolker",
"author_id": 190277,
"author_profile": "https://Stackoverflow.com/users/190277",
"pm_score": 3,
"selected": true,
"text": "tibble"
},
{
"answer_id": 74132326,
"author": "Ric Villalba",
"author_id": 6912817,
"author_prof... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17303805/"
] |
74,131,078 | <p>So I've been learning to use useContext and useReducer hooks with action/dispatch and whenever I try to use dipatch function from any component, it throws out "Uncaught TypeError: dispatch is not a function" error.. it's been 5 days now:/</p>
<p>I try to access dispatch function in the following manner inside components</p>
<pre><code>// context
import { ModalContext } from "../Context/Contexts/ModalContext";
import { OPEN_IMAGE_MODAL } from "../Context/action.types";
const { dispatch } = useContext(ModalContext);
dispatch({
type: OPEN_IMAGE_MODAL,
payload: { isEnabled: true, imageDetails: { url: doc.url } },
});
</code></pre>
<p>Here are the ref files</p>
<p>App.js</p>
<pre><code>import React from "react";
// components
import Nav from "./Components/Nav";
import ImageUploadForm from "./Components/ImageUploadForm";
import ImageGrid from "./Components/ImageGrid";
// context
import { ModalContextProvider } from "./Context/Contexts/ModalContext";
const App = () => {
return (
<div className="App">
<Nav />
<ImageUploadForm />
<ModalContextProvider>
<ImageGrid/>
</ModalContextProvider>
</div>
);
};
export default App;
</code></pre>
<p>ModalContext.js (Context & Context Provider creation)</p>
<pre><code>import { createContext, useReducer } from "react";
// reducer
import { modalReducer } from "../Reducers/modalReducer";
// components
import ImageModal from "../../Components/ImageModal";
// creating and exporting context
export const ModalContext = createContext();
const initialState = { isEnabled: false, imageDetails: {} };
export const ModalContextProvider = ({ children }) => {
// for selected/clicked image
const [isEnabled, imageDetails, dispatch] = useReducer(
modalReducer,
initialState
);
return (
<ModalContext.Provider value={{ isEnabled, imageDetails, dispatch }}>
{children}
{isEnabled && <ImageModal />}
</ModalContext.Provider>
);
};
</code></pre>
<p>modalReducer.js (reducer fn)</p>
<pre><code>import { OPEN_IMAGE_MODAL, CLOSE_IMAGE_MODAL } from "../action.types";
export const modalReducer = (state, action) => {
switch (action.type) {
case OPEN_IMAGE_MODAL:
return {
...state,
isEnabled: true,
imageDetails: action.payload.imageDetails,
};
case CLOSE_IMAGE_MODAL:
return { ...state, isEnabled: false, imageDetails: {} };
default:
return { ...state };
}
};
</code></pre>
| [
{
"answer_id": 74131254,
"author": "Ben Bolker",
"author_id": 190277,
"author_profile": "https://Stackoverflow.com/users/190277",
"pm_score": 3,
"selected": true,
"text": "tibble"
},
{
"answer_id": 74132326,
"author": "Ric Villalba",
"author_id": 6912817,
"author_prof... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14392701/"
] |
74,131,083 | <p>I have an input file like below (please note that there may/may not be blank lines in the file</p>
<p>11111*Author Name</p>
<p>22222*Date</p>
<p>11111 01 Var-1</p>
<p>11111 02 Var-2</p>
<p>11111 02 Var-3</p>
<p>Rules to be used:</p>
<ul>
<li>If asterisk(*) is present at position # 6 of a record then skip the record.</li>
<li>First 6 bytes are sequence number which can be spaces as well. However, the first six bytes whether space or number can be ignored.</li>
<li>Only combine the records where asterisk is not present at position # 6.</li>
<li>Only consider data starting from position 7 in the input file up to positon 72.</li>
<li>Add comma as shown below</li>
</ul>
<p>Expected Output
01,Var-1,02,Var-2,02,Var-3</p>
<p>Below is the code that I was trying to print the record. However, I was not able to get comma(,) after each text. Some were prefixed with spaces. Can someone please help?</p>
<pre><code>with open("D:/Desktop/Files/Myfile.txt","r") as file_in:
for lines in file_in:
if "*" not in lines:
lines_new = " ".join(lines.split())
lines_fin = lines_new.replace(' ',',')
print(lines_fin,end=' ')
</code></pre>
| [
{
"answer_id": 74131328,
"author": "AshSmith88",
"author_id": 20281564,
"author_profile": "https://Stackoverflow.com/users/20281564",
"pm_score": 3,
"selected": true,
"text": "with open(\"D:/Desktop/Files/Myfile.txt\",\"r\") as file_in:\n for line in file_in:\n if line == \"\\n... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20285853/"
] |
74,131,150 | <p><strong>Problem:</strong>
I have a list of strings and I need to get rid of whitespaces before and after substring that looks like <code>'digit / digit'</code>. Been stuck on this for quite a while and still don't understand how to fix itI will appreciate any help.</p>
<p><strong>Sample input:</strong></p>
<pre class="lang-py prettyprint-override"><code>steps = [
'mix butter , flour , 1 / 3 c',
'sugar and 1-1 / 4 t',
'vanilla'
]
</code></pre>
<p><strong>Expected output:</strong></p>
<pre class="lang-py prettyprint-override"><code>[
'mixbutter,flour,1 / 3c',
'sugarand1-1 / 4t',
'vanilla'
]
</code></pre>
<p><strong>My approach:</strong></p>
<pre class="lang-py prettyprint-override"><code>steps_new = []
for step in steps:
step = re.sub(r'\s+[^\d+\s/\s\d+]','',step)
steps_new.append(step)
steps_new
</code></pre>
<p><strong>My output:</strong></p>
<pre class="lang-py prettyprint-override"><code>[
'mixutterlour 1 / 3',
'sugarnd 1-1 / 4',
'vanilla'
]
</code></pre>
| [
{
"answer_id": 74131328,
"author": "AshSmith88",
"author_id": 20281564,
"author_profile": "https://Stackoverflow.com/users/20281564",
"pm_score": 3,
"selected": true,
"text": "with open(\"D:/Desktop/Files/Myfile.txt\",\"r\") as file_in:\n for line in file_in:\n if line == \"\\n... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13682294/"
] |
74,131,153 | <p>In a rails 4.1 application I need to add an object to an "AssociationRelation"</p>
<pre><code> def index
employee = Employee.where(id_person: params[:id_person]).take
receipts_t = employee.receipts.where(:consent => true) #gives 3 results
receipts_n = employee.receipts.where(:consent => nil).limit(1) #gives 1 result
#I would need to add the null consent query result to the true consent results
#something similar to this and the result is still an association relation
@receipts = receipts_t + receipts_n
end
</code></pre>
<p>Is there a simple way to do this?</p>
| [
{
"answer_id": 74131328,
"author": "AshSmith88",
"author_id": 20281564,
"author_profile": "https://Stackoverflow.com/users/20281564",
"pm_score": 3,
"selected": true,
"text": "with open(\"D:/Desktop/Files/Myfile.txt\",\"r\") as file_in:\n for line in file_in:\n if line == \"\\n... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10892523/"
] |
74,131,155 | <p>I'd like to use <code>gsub</code> to remove characters from a filename.</p>
<p>In the example below the desired output is 23</p>
<pre><code>digs = "filepath/23-00.xlsx"
</code></pre>
<p>I can remove everything before 23 as follows:</p>
<pre><code>gsub("^\\D+", "",digs)
[1] "23-00.xlsx"
</code></pre>
<p>or everything after:</p>
<pre><code>gsub("\\-\\d+\\.xlsx$","", digs)
[1] "filepath/23"
</code></pre>
<p>How do I do both at the same time?</p>
| [
{
"answer_id": 74131252,
"author": "akrun",
"author_id": 3732271,
"author_profile": "https://Stackoverflow.com/users/3732271",
"pm_score": 4,
"selected": true,
"text": "|"
},
{
"answer_id": 74131297,
"author": "Wiktor Stribiżew",
"author_id": 3832970,
"author_profile"... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131155",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12452893/"
] |
74,131,177 | <pre><code>$homefolder = (gci \\SERVER\homefolder | select fullname)
$outfile = "$env:USERPROFILE\Desktop\Homefolder_Desktop_Redirect.csv"
ForEach ($dir in $homefolder)
{If(Test-Path ($dir.FullName +"\Desktop")){write-host $dir.Fullname" contains desktop" -ForegroundColor Yellow
"{0:N2} GB" -f ((Get-ChildItem $dir.fullname -Recurse | Measure-Object -Property Length -Sum -ErrorAction SilentlyContinue).Sum / 1GB)
}}
ForEach ($dir in $homefolder)
{If(Test-Path ($dir.FullName +"\Desktop")){}else{write-host $dir.Fullname" does not contain desktop" -ForegroundColor Red
"{0:N2} GB" -f ((Get-ChildItem $dir.fullname -Recurse | Measure-Object -Property Length -Sum -ErrorAction SilentlyContinue).Sum / 1GB)
}}
</code></pre>
<p>I'm trying to get this to output to a file. If I put the pipe between the last 2 <code>}}</code> or after the last <code>}</code> (in each Foreach), I'm told it's empty. If I put IF inside another set of parentheses, like <code>{(If</code> I get If isn't valid.</p>
<p>If I try to write/append after <code>1GB)</code> my outfile is just my script.</p>
<p>If I try making the <code>Foreach($dir in $homefolder)</code> a variable, the <code>in</code> is an unexpected token.</p>
<p>I'm sure this is something simple, but I haven't used PowerShell for much in the last 5 years... assistance is appreciated.</p>
<p>---UPDATE---</p>
<p>Thanks for the help, all!</p>
<p>This is what I have thanks to the assistance I've received.</p>
<pre><code>$outfile = "$env:USERPROFILE\Desktop\Homefolder_Desktop_Redirect.txt"
Write-Output "Contains desktop:" | Set-Content $outfile -Force
(Get-ChildItem \\SERVER\homefolder).FullName | ForEach-Object {
if(Test-Path (Join-Path $_ -ChildPath Desktop)) {
Write-Host "$_ contains desktop" -ForegroundColor Yellow
"$_ [{0:N2} GB]" -f (
(Get-ChildItem $_ -Recurse |
Measure-Object -Property Length -Sum -ErrorAction SilentlyContinue
).Sum / 1GB)
}
} | Add-Content $outfile -Force
Write-Output "Contains NO desktop:" | Add-Content $outfile -Force
(Get-ChildItem \\SERVER\homefolder).FullName | ForEach-Object {
if(Test-Path (Join-Path $_ -ChildPath Desktop)) {}
else{
Write-Host "$_ contains no desktop" -ForegroundColor Red
"$_ [{0:N2} GB]" -f (
(Get-ChildItem $_ -Recurse |
Measure-Object -Property Length -Sum -ErrorAction SilentlyContinue
).Sum / 1GB)
}
} | Add-Content $outfile -Force
Invoke-Item $outfile
</code></pre>
| [
{
"answer_id": 74131252,
"author": "akrun",
"author_id": 3732271,
"author_profile": "https://Stackoverflow.com/users/3732271",
"pm_score": 4,
"selected": true,
"text": "|"
},
{
"answer_id": 74131297,
"author": "Wiktor Stribiżew",
"author_id": 3832970,
"author_profile"... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5418922/"
] |
74,131,202 | <p>When editing a todo it will automictically clear the value, I would like it to contain its original value so you can edit upon it rather than typing everything all over again.</p>
<p>Im assuming usestate is setting the editingText into an empty string in which case in will always output a empty value?</p>
<p>Also I would like to incorporate a cancel button in which cancels eiditing and returns back to its current value.</p>
<pre><code> const App = () => {
const [todos, setTodos] = React.useState([]);
const [todo, setTodo] = React.useState("");
const [todoEditing, setTodoEditing] = React.useState(null);
const [editingText, setEditingText] = React.useState("");
function handleSubmit(e) {
e.preventDefault();
const newTodo = {
id: new Date().getTime(),
text: todo,
completed: false,
};
setTodos([...todos].concat(newTodo));
setTodo("");
}
function deleteTodo(id) {
let updatedTodos = [...todos].filter((todo) => todo.id !== id);
setTodos(updatedTodos);
}
function toggleComplete(id) {
let updatedTodos = [...todos].map((todo) => {
if (todo.id === id) {
todo.completed = !todo.completed;
}
return todo;
});
setTodos(updatedTodos);
}
function submitEdits(id) {
const updatedTodos = [...todos].map((todo) => {
if (todo.id === id) {
todo.text = editingText;
}
return todo;
});
setTodos(updatedTodos);
setTodoEditing(null);
}
return (
<div id="todo-list">
<h1>Todo List</h1>
<form onSubmit={handleSubmit}>
<input
type="text"
onChange={(e) => setTodo(e.target.value)}
value={todo}
/>
<button type="submit">Add Todo</button>
</form>
{todos.map((todo) => (
<div key={todo.id} className="todo">
<div className="todo-text">
{todo.id === todoEditing ? (
<input
type="text"
onChange={(e) => setEditingText(e.target.value)}
/>
) : (
<div>{todo.text}</div>
)}
</div>
<div className="todo-actions">
{todo.id === todoEditing ? (
<button onClick={() => submitEdits(todo.id)}>Submit Edits</button>
) : (
<button onClick={() => setTodoEditing(todo.id)}>Edit</button>
)}
<button onClick={() => deleteTodo(todo.id)}>Delete</button>
</div>
</div>
))}
</div>
);
};
export default App;
</code></pre>
| [
{
"answer_id": 74131252,
"author": "akrun",
"author_id": 3732271,
"author_profile": "https://Stackoverflow.com/users/3732271",
"pm_score": 4,
"selected": true,
"text": "|"
},
{
"answer_id": 74131297,
"author": "Wiktor Stribiżew",
"author_id": 3832970,
"author_profile"... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20285850/"
] |
74,131,208 | <p>I have a question about async programming and Task.WhenAll(). I have a code snippet that downloads a folder from google drive and it works as expected when i am debugging my code. However when I run the application without debugger the download function takes atleast 4x the time it takes when it runs with the debugger. I also get crash logs with TaskCancelled exceptions (System.Threading.Tasks.TaskCanceledException: A task was canceled.) which do not happen with the debugger attached. What needs to be changed for the code to work as expected without debugger attached. NB this snippet downloads +- 1000 files in about 22-25 seconds with debugger and 2min+ without debugger.</p>
<pre><code>public static async Task<bool> DownloadFolder(CloudDataModel.File file, string path, params string[] exclude)
{
try
{
if (file != null && !string.IsNullOrEmpty(file.id))
{
List<string> toExclude = new List<string>();
if(exclude != null)
{
toExclude = exclude.ToList();
}
List<Task> downloadFilesTask = new List<Task>();
var files = await file.GetFiles();
foreach (var f in files)
{
var task = f.Download(path);
downloadFilesTask.Add(task);
}
var folders = await file.GetFoldersAsync();
foreach (var folder in folders)
{
if (toExclude.Contains(folder.name))
{
continue;
}
Task task = null;
if (path.Equals(Statics.ProjectFolderName))
{
task = DownloadFolder(folder, folder.name);
}
else
{
task = DownloadFolder(folder, Path.Combine(path, folder.name));
}
downloadFilesTask.Add(task);
}
var array = downloadFilesTask.ToArray();
await Task.WhenAll(array);
return true;
}
}
catch (Exception e)
{
Crashes.TrackError(e);
}
return false;
}
</code></pre>
<p><strong>Edit</strong></p>
<p>after some more trial and error the fault has been identified.
the downloading of the file was the cause of the unexpected behaviour</p>
<pre><code>public static async Task<StorageFile> DownloadFile(CloudDataModel.File file, string destinationFolder)
{
try
{
if (file != null)
{
Debug.WriteLine($"start download {file.name}");
if (file.mimeType == Statics.GoogleDriveFolderMimeType)
{
Debug.WriteLine($"did not download resource, resource was folder instead of file. mimeType: {file.mimeType}");
return null;
}
var endpoint = Path.Combine(DownloadFileEndpoint, $"{file.id}?alt=media");
// this would cause the unexpected behaviour
HttpResponseMessage response = await client.GetAsync(endpoint);
StorageFile downloadedFile;
using (Stream streamToReadFrom = await response.Content.ReadAsStreamAsync())
{
var memstream = new MemoryStream();
StreamReader reader = new StreamReader(streamToReadFrom);
streamToReadFrom.Position = 0;
await streamToReadFrom.CopyToAsync(memstream);
downloadedFile = await fileHandler.SaveDownloadedCloudFile(memstream, file, destinationFolder);
Debug.WriteLine($"download finished {file.name}");
}
return downloadedFile;
}
return null;
}
catch (Exception e)
{
Crashes.TrackError(e);
return null;
}
}
</code></pre>
<p>After setting a timeout to the client (System.Net.Http.HttpClient) the code executed as expected.</p>
<pre><code>client.Timeout = new TimeSpan(0,0,5);
</code></pre>
| [
{
"answer_id": 74132997,
"author": "Theodor Zoulias",
"author_id": 11178549,
"author_profile": "https://Stackoverflow.com/users/11178549",
"pm_score": -1,
"selected": false,
"text": "SemaphoreSlim"
},
{
"answer_id": 74137117,
"author": "Rick Bieze",
"author_id": 6932086,
... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6932086/"
] |
74,131,217 | <p>I have an array of objects in a class, call it passengers.
I initialized the array with the x number of passengers, and that would make the array with length x, full of nulls.
I need to get a method from the class where I can substitute the next null value for an object.
What I'm doing right now is running through the whole array with a for loop and finding the first null value, then changing it to the object.</p>
<pre><code> if(passenger == null){
// add a new passenger to this position in the array
}
}
</code></pre>
<p>What I was wondering is if is there any built-in method that would make this faster, where I could just substitute the next null value in an array, for a value.
At the moment, I'm using Java 7, so there might be a Java 8 option, but it wouldn't work in my case.</p>
| [
{
"answer_id": 74131381,
"author": "Игорь Ходыко",
"author_id": 18754816,
"author_profile": "https://Stackoverflow.com/users/18754816",
"pm_score": -1,
"selected": false,
"text": "String[] passengers=new String[5];\n passengers[0]=\"aaa\";\n passengers[1]=\"bbb\";\n ... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10023825/"
] |
74,131,231 | <p>How can I use JavaScript to simulate the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/attr" rel="nofollow noreferrer">attr()</a> function? For example I want to indent the following paragraph using the value of <code>data-indent</code> as we do by <code>p { text-indent: attr(data-indent em) }</code>.</p>
<pre><code><p data-indent=4>Hello World :-)</p>
</code></pre>
<p><strong>EDIT:</strong> Most of you may not understand what I learned today because my question seems silly to you, but I think @G-Cyrillus's answer deserves more attention. Actually first I should mention that I was stupid not thinking about inline style. I thought it is neater to avoid that when you can use HTML class and id. But today I learned inline style is inevitable in some situations. This question was asked to solve my <a href="https://stackoverflow.com/q/74125173/2817520">another question</a>. Now I can easily use an HTML table to render a tree data structure without JavaScript in a neat manner.</p>
| [
{
"answer_id": 74131295,
"author": "Emiel Zuurbier",
"author_id": 11619647,
"author_profile": "https://Stackoverflow.com/users/11619647",
"pm_score": 2,
"selected": false,
"text": "const elements = document.querySelectorAll('[data-indent]');\nfor (const element of elements) {\n element.... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2817520/"
] |
74,131,237 | <p>A Kafka topic for my table is not created when using the <a href="https://hub.docker.com/r/debezium/connect" rel="nofollow noreferrer">debezium/connect</a> Docker image. Here's how I'm starting the container:</p>
<pre><code>docker run -it --rm --name debezium -p 8083:8083 -e GROUP_ID=1 -e CONFIG_STORAGE_TOPIC=my-connect-configs \
-e OFFSET_STORAGE_TOPIC=my-connect-offsets -e BOOTSTRAP_SERVERS=192.168.56.1:9092 \
-e CONNECT_NAME=my-connector -e CONNECT_CONNECTOR_CLASS=io.debezium.connector.postgresql.PostgresConnector \
-e CONNECT_TOPIC_PREFIX=my-prefix -e CONNECT_DATABASE_HOSTNAME=host.docker.internal -e CONNECT_DATABASE_PORT=5432 \
-e CONNECT_DATABASE_USER=postgres -e CONNECT_DATABASE_PASSWORD=root -e DATABASE_SERVER_NAME=mydb \
-e CONNECT_DATABASE_DBNAME=mydb -e CONNECT_TABLE_INCLUDE_LIST=myschema.my_table -e CONNECT_PLUGIN_NAME=pgoutput \
debezium/connect
</code></pre>
<p>I've tried using <code>CONNECT__</code> instead of <code>CONNECT_</code>, but I get the same results. A topic for the table is not created if I use the API:</p>
<pre><code>curl -H 'Content-Type: application/json' 127.0.0.1:8083/connectors --data '
{
"name": "prism",
"config": {
"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
"topic.prefix": my-connector",
"database.hostname": "host.docker.internal",
"database.port": "5432",
"database.user": "postgres",
"database.password": "root",
"database.server.name": "mydb",
"database.dbname" : "mydb",
"table.include.list": "myschema.my_table",
"plugin.name": "pgoutput"
}
}'
</code></pre>
<p>The topics <code>my-connect-configs</code> and <code>my-connect-offsets</code>, specified by <code>CONFIG_STORAGE_TOPIC</code> and <code>OFFSET_STORAGE_TOPIC</code>, are created.</p>
<p><code>http://localhost:8083/connectors/my-connector/status</code> shows this:</p>
<pre><code>{"name":"my-connector","connector":{"state":"RUNNING","worker_id":"172.17.0.3:8083"},"tasks":[{"id":0,"state":"RUNNING","worker_id":"172.17.0.3:8083"}],"type":"source"}
</code></pre>
<p>I was able to create a topic when using <code>bin/connect-standalone.sh</code> instead of the Docker image as per this <a href="https://stackoverflow.com/questions/74103659/debezium-postgresql-connector-not-creating-topic">question</a>.</p>
<p>Automatic topic creation is enabled and I don't see any errors/warnings in the log.</p>
| [
{
"answer_id": 74131295,
"author": "Emiel Zuurbier",
"author_id": 11619647,
"author_profile": "https://Stackoverflow.com/users/11619647",
"pm_score": 2,
"selected": false,
"text": "const elements = document.querySelectorAll('[data-indent]');\nfor (const element of elements) {\n element.... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2233706/"
] |
74,131,249 | <p>I'm writing a Beam ParDo transform in Go for a streaming Dataflow pipeline, as a DoFn. I'm trying to find a way to add a map that was computed at runtime, but pre-pipeline, to every DoFn. Putting it in using the state API seems not quite right, as it's constant data for the duration of the pipeline. But I can't seem to pass in a pre-initialized DoFn to do this. I tried</p>
<pre><code>type EngineMap struct {
Map map[string]string
}
type ResultProcessor struct {
engineMap EngineMap
}
... (ProcessElement defined, initialization)
processor := ResultProcessor{}
processor.engineMap.Map = make(map[string]string)
for k, v := range engines.Map {
processor.engineMap.Map[k] = v
}
register.DoFn2x1[context.Context, []byte, []string](&processor)
... (pipeline initialized, input "lines" defined)
result := beam.ParDo(s, &processor, lines)
</code></pre>
<p>but when I run this, the map in engineMap is still <strong>empty</strong> when the ProcessElement() method runs, even though it isn't after the <code>for</code> loop. I could pass this data as a side input, but this seems unnecessarily complicated for a fairly small map that is constant at pipeline run time, especially for a streaming pipeline.</p>
<p>Is there another way to pass the data along?</p>
| [
{
"answer_id": 74131796,
"author": "Ritesh Ghorse",
"author_id": 7042941,
"author_profile": "https://Stackoverflow.com/users/7042941",
"pm_score": 0,
"selected": false,
"text": "engineMap"
},
{
"answer_id": 74212901,
"author": "Robert Burke",
"author_id": 8656761,
"au... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12109678/"
] |
74,131,262 | <p>I have a dataframe that has missing values at each column, but at different rows. For simplicity, let's see the following dataframe (real dataframe is much more complex):</p>
<pre><code>first_column <- c(1, 2, NA,NA)
second_column <- c(NA, NA, 4,9)
df <- data.frame(first_column, second_column)
</code></pre>
<p>and we get:</p>
<pre><code> first_column second_column
1 1 NA
2 2 NA
3 NA 4
4 NA 9
</code></pre>
<p>Now, I want to reshape the dataframe, after removing these missing values. I want the following:</p>
<pre><code> first_column second_column
1 1 4
2 2 9
</code></pre>
<p>Is there an automatic way to do it (real dataframe has dimensions 1800 x 33)?</p>
| [
{
"answer_id": 74131279,
"author": "akrun",
"author_id": 3732271,
"author_profile": "https://Stackoverflow.com/users/3732271",
"pm_score": 2,
"selected": true,
"text": "NA"
},
{
"answer_id": 74131384,
"author": "B. Christian Kamgang",
"author_id": 10848898,
"author_pr... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14100976/"
] |
74,131,266 | <p>We have installed ckanext-datajson to export our datasets into U.S. Project Open Data metadata specification v.1.1 compatible format. However, there are data we do not want to appear in the output because the datasets are confidential. We thought about making the datasets private which does exclude them, but it also prevents anyone who is not in the organization from seeing the dataset, which we don't want.</p>
<p>Does anyone know a way to prevent datasets from outputting to JSON that doesn't involve making them private?</p>
| [
{
"answer_id": 74131279,
"author": "akrun",
"author_id": 3732271,
"author_profile": "https://Stackoverflow.com/users/3732271",
"pm_score": 2,
"selected": true,
"text": "NA"
},
{
"answer_id": 74131384,
"author": "B. Christian Kamgang",
"author_id": 10848898,
"author_pr... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10161180/"
] |
74,131,317 | <p>With Fetch API and useState, I try to fetch data from TMDB. After writing some code data is shown in the console correctly but can't retrieve.</p>
<pre><code>import React, { useState, useEffect } from 'react'
import MovieCard from '../components/MovieCard'
import { TrendingMovie } from '../components/Config'
export default function Trending() {
const [trendingList, setTrendingList] = useState([])
useEffect(() => {
const fetchData = async () => {
let res = await fetch(TrendingMovie(1))
let data = await res.json()
setTrendingList(data.results)
}
fetchData()
}, [])
console.log(trendingList)
return (
<div>
{trendingList && trendingList[0]?.adult}
</div>
)}
</code></pre>
<p><a href="https://i.stack.imgur.com/7WAlz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7WAlz.png" alt="enter image description here" /></a></p>
| [
{
"answer_id": 74131412,
"author": "Cloud89",
"author_id": 19490662,
"author_profile": "https://Stackoverflow.com/users/19490662",
"pm_score": 0,
"selected": false,
"text": "{TrendingMovie && TrendingMovie[0]?.adult}\n"
},
{
"answer_id": 74131473,
"author": "Chetan Kondawle",... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15093301/"
] |
74,131,348 | <p>For instance I have enum from thirdparty library:</p>
<pre><code>namespace Lib {
enum class Foo {
Bar,
Baz
};
};
</code></pre>
<p>I have tried use next wrapper</p>
<pre><code>namespace Qml {
Q_NAMESPACE
using Foo = Lib::Foo;
Q_ENUMS(Foo)
}
</code></pre>
<p>with <code>qmlRegisterUncreatableMetaObject</code>, but its don't work for me.</p>
<p>Can I register one in <code>Meta Object System</code> for using in <code>QML</code>, but without duplicates like:</p>
<pre><code>class QmlObject {
Q_GADGET
public:
enum Foo {
Bar = Lib::Bar,
Baz = Lib::Baz
};
Q_ENUM(Foo)
};
</code></pre>
<p>Version of <code>Qt</code> is <code>5.15.2</code>. Thanks.</p>
| [
{
"answer_id": 74131412,
"author": "Cloud89",
"author_id": 19490662,
"author_profile": "https://Stackoverflow.com/users/19490662",
"pm_score": 0,
"selected": false,
"text": "{TrendingMovie && TrendingMovie[0]?.adult}\n"
},
{
"answer_id": 74131473,
"author": "Chetan Kondawle",... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4607234/"
] |
74,131,356 | <p>I want to update the keys of a map.
I sorted the map by date, but now the keys are not in numerical order</p>
<p>original Map:</p>
<pre><code>Map<dynamic, dynamic> myMap = {
0: {"id": 754, "name": "luke", "date": 1665537500000},
1: {"id": 436, "name": "obi", "date": 1665532400000},
2: {"id": 866, "name": "vader", "date": 1665532500000},
};
myMapSorted = SplayTreeMap.from(myMap, (a, b) => myMap[a]['time'].compareTo(myMap[b]['time']));
print(myMapSorted);
</code></pre>
<p>sorted Map (with keys in not numerical order):</p>
<pre><code>{
1: {"id": 436, "name": "obi", "date": 1665532400000},
2: {"id": 866, "name": "vader", "date": 1665532500000},
0: {"id": 754, "name": "luke", "date": 1665537500000},
};
</code></pre>
<p>is there a way to update the keys?</p>
| [
{
"answer_id": 74131866,
"author": "BlazingRSj",
"author_id": 12862313,
"author_profile": "https://Stackoverflow.com/users/12862313",
"pm_score": 0,
"selected": false,
"text": "var sortMapByKey = Map.fromEntries(\n myMap.entries.toList()\n ..sort((e1, e2) => e1.key.compareTo(e2.key... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16126737/"
] |
74,131,358 | <p>Firstly i would like to apologize beforehand about this question. I imagine that it must be really straight forward, but i'm a beginner and had nowere to go.</p>
<p>I'm declaring the following pointers, outside all my functions (Global Variable):</p>
<pre><code>#include <ESP8266WiFi.h>
String* IP;
String* MAC;
</code></pre>
<p>Then, from inside a function i'm trying to change it's values:</p>
<pre><code>void networkInfo() {
String* IP = WiFi.localIP().toString();
String* MAC = WiFi.macAddress();
}
</code></pre>
<p>When i try to compile and execute, it gives me the following error:</p>
<pre><code>error: cannot convert 'String' to 'String*' in initialization
String* IP = WiFi.localIP().toString();
^
error: cannot convert 'String' to 'String*' in initialization
String* MAC = WiFi.macAddress();
^
</code></pre>
<p>Please, what am i doing wrong?
Thanks...</p>
<p>PS: I would like to state that before asking this question i REALLY did search on StackOverflow, tried many different approachs but none helped for me. (Most were incomplete or just really specific to the OPs question)</p>
<p>If this is a duplicate, i'm sorry. I didnt find the solution for this.</p>
<p><strong>Edit 1:</strong></p>
<p>Changed pointers to normal variables:</p>
<pre><code>// Global Variables
String IP;
String MAC;
</code></pre>
<p>Inside the function, changed ways that the variable is assigned:</p>
<pre><code>void networkInfo() {
IP = new String;
MAC = new String;
*IP = WiFi.localIP().toString();
*MAC = WiFi.macAddress();
}
</code></pre>
<p>But right here on networkInfo function it returned me a error.
Error on equals sign:</p>
<pre><code>****no viable overloaded '='****
</code></pre>
<p><strong>Edit 2:</strong></p>
<p>Further tests below.</p>
<ol>
<li>Changing variable names to address best practices, with g_Variable</li>
</ol>
<blockquote>
<pre><code>// Global Variables
String *g_IP;
String *g_MAC;
</code></pre>
</blockquote>
<ol start="2">
<li>Assigning variable as objet then giving a string to it.</li>
</ol>
<blockquote>
<pre><code>void networkInfo() {
g_IP = new String;
g_MAC = new String;
*g_IP = WiFi.localIP().toString();
}
void sendInfo() { cout << "Test: " << g_IP; }
</code></pre>
</blockquote>
<p>When calling sendInfo() function, the output was exactly:</p>
<pre><code>Test: 0x22beeb0
</code></pre>
<p>I expected the IP Address.</p>
<p><strong>Edit 3 (Solution):</strong>
For some weird reason i was able to solve this using g_IP = new String;
and then assigning as pointer. Weird, didnt understand why.</p>
<pre><code>// Global Variables
String *g_IP;
String *g_MAC;
// Prototypes - Functions you will use.
void networkInfo();
void sendInfo();
void initSerial();
void setup()
{
// Initialize Functions
initSerial();
networkInfo();
sendInfo();
}
void loop()
{
// Loop Functions
sendInfo();
}
void initSerial()
{
Serial.begin(115200); // Baudrate NodeMCU
}
void networkInfo() {
// Obs: Without new String a Error happens, below.
// ets Jan 8 2013,rst cause:4, boot mode:(1,6)
// wdt reset
// Why? IDK
g_IP = new String; // No idea why this works.
g_MAC = new String;
// Removing this two lines and above gives wdt reset error
*g_IP = WiFi.localIP().toString();
*g_MAC = WiFi.macAddress();
}
void sendInfo() {
delay(500);
Serial.println(*g_IP);
}
</code></pre>
| [
{
"answer_id": 74131455,
"author": "Anthony DiGiovanna",
"author_id": 20206254,
"author_profile": "https://Stackoverflow.com/users/20206254",
"pm_score": -1,
"selected": false,
"text": "String* IP = WiFi.localIP().toString();\n // ^ This variable is ^This returns a String.\n... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131358",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8297745/"
] |
74,131,369 | <p>I have the following scenario: A LUA function <em>LuaFuncA</em> calls a C++ function <em>CPPFunc</em> and passes an argument <em>Arg</em>, which is opaque to the CPP function and could be anything (whether nil, number, userdata etc.) and cannot be assumed to be of the same type each time <em>CPPFunc</em> is called.</p>
<p><em>LuaFuncA</em> then terminates and only C++ code is running. After a certain amount of time (which could be anything, from milliseconds to hours) <em>CPPFunc</em> needs to call another LUA function <em>LuaFuncB</em> and pass <em>Arg</em>.</p>
<p>Attempting the native solution of using <code>lua_getpointer(L, 1)</code> then pushing it back with <code>lua_pushlightuserdata(L, 1)</code> (L seems to be the same handle in both calls) results in the following error:</p>
<p><code>attempt to index local 'Arg' (a userdata value).</code></p>
<p>(in this case Arg was <code>{1, 2, 3, 4}</code> and I attempted to print <code>Arg[2]</code>)</p>
<p>Thank you for any advice!</p>
<p>EDIT: <code>CPPFunc</code> is a task scheduler routine. <code>LuaFuncA</code> basically registers <code>LuaFuncB</code> as a task, from which point <code>CPPFunc</code> need to call <code>LuaFuncB</code> at regular intervals, which means that the state must be either preserved or recreated before each call.</p>
<p>EDIT 2: The program is cross-platform and must be able to run natively on both Linux and Windows, therefore platform specific calls such as fork() cannot be used.</p>
| [
{
"answer_id": 74131570,
"author": "Lucas S.",
"author_id": 3124208,
"author_profile": "https://Stackoverflow.com/users/3124208",
"pm_score": 0,
"selected": false,
"text": "lua_State"
},
{
"answer_id": 74134805,
"author": "Joseph Sible-Reinstate Monica",
"author_id": 7509... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1996662/"
] |
74,131,371 | <p>I want to keep the package size small for quicker load times for the users.</p>
<p>I'm refactoring a little ecom site. It has a admin/product management site. 99% of users will never see this side of things.</p>
<p>Should I make a seperate project for admin site? It means maintaining 2 projects It should mean less for each user.</p>
<p>Does it really matter that much?</p>
| [
{
"answer_id": 74132210,
"author": "tao",
"author_id": 1891677,
"author_profile": "https://Stackoverflow.com/users/1891677",
"pm_score": 3,
"selected": true,
"text": ".vue"
}
] | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17822818/"
] |
74,131,377 | <p>Hi I'm learning Python by myself and I'm tying to refactor this code. I want to use declaration and invoke of the function.</p>
<p>So the original code is:</p>
<pre><code>num1 = int(input("Enter a number: "))
num1 = num1**2
num1 = num1 - 5
num1 = num1 / 3
num2 = int(input("Enter another number: "))
num2 = num2**2
num2 = num2 - 5
num2 = num2 / 3
result = Math.sqrt(num1*num2)
</code></pre>
<p>What I'm doing so far. Any suggestions?:</p>
<pre><code>import math
def calculate(num1,num2, result):
num1 = int(input("Enter a number: "))
num1 = num1**2
num1 = num1 - 5
num1 = num1 / 3
num2 = int(input("Enter another number: "))
num2 = num2**2
num2 = num2 - 5
num2 = num2 / 3
result = math.sqrt(num1*num2)
return(result)
print(calculate())
</code></pre>
| [
{
"answer_id": 74131444,
"author": "orby",
"author_id": 8476400,
"author_profile": "https://Stackoverflow.com/users/8476400",
"pm_score": 0,
"selected": false,
"text": "import math\n\ndef calculate(num1, num2):\n \n num1 = num1**2\n num1 = num1 - 5\n num1 = num1 / 3\n\n nu... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20141616/"
] |
74,131,378 | <p>This is my Searchcomponent, but it throws an Unexpected Mutation of "query" prop error, and I tried this way but still get an error.</p>
<pre><code> <template>
<div class="searchbar">
<input
type="text"
v-model="query.name" // this is the error
class="input"
placeholder="Search"
/>
<div v-if="query.name.length > 3">
<select v-model="query.status" class="select"> // This is the error
<option value="alive">Alive</option>
<option value="dead">Dead</option>
<option value="unknown">Unknown</option>
</select>
</div>
</div>
</template>
<script>
export default {
props: {
query: String
}
};
</script>
<style scoped>
.input {
font-family: Roboto;
font-size: 16px;
height: 56px;
border-radius: 8px;
width: 326px;
padding: 16px 48px;
line-height: 150%;
border: 1px solid rgba(0, 0, 0, 0.5);
background: url("../assets/search.svg") no-repeat scroll 10px center;
outline: none;
}
.input::placeholder {
line-height: 150%;
color: rgba(0, 0, 0, 0.5);
}
.select {
font-family: Roboto;
line-height: 19px;
color: rgba(0, 0, 0, 0.6);
font-size: 16px;
height: 56px;
border-radius: 8px;
width: 240px;
padding-left: 14px;
border: 1px solid rgba(0, 0, 0, 0.5);
outline: none;
background: url("../assets/arrow-up-down.svg") no-repeat scroll 90% center;
}
select {
-webkit-appearance: none;
-moz-appearance: none;
text-indent: 1px;
text-overflow: "";
}
.searchbar {
display: flex;
gap: 20px;
margin: 16px auto 61px;
}
</style>
</code></pre>
<p>This is the view Characters, that use the component Search and pass the query data</p>
<pre><code><template>
<div class="container">
<img src="../assets/characterLogo.svg" alt="logo-character" class="logo" />
<CharacterSearchBar :query="query" />
<p v-if="query.name.length < 4">
Enter 4 characters
</p>
<div class="cards-container" v-if="query.name.length > 3">
<CharacterCard
v-for="character in results"
:key="character.id"
:character="character"
/>
</div>
<div v-if="error" class="not-found">
Sorry, dont have any result
</div>
<div v-if="query.name.length > 3">
<button @click="loadMore" class="more-button">Load More</button>
</div>
</div>
</template>
<script>
import CharacterCard from "../components/CharacterCard.vue";
import CharacterSearchBar from "../components/CharacterSearchBar.vue";
import getData from "../composables/getData";
import { APISettings } from "../api/config";
import { watchEffect } from "vue";
import getFilterResults from "../composables/getFilterResults";
export default {
components: { CharacterCard, CharacterSearchBar },
setup() {
const { charactersUrl } = APISettings;
const { results, info, loadMore } = getData(charactersUrl);
const { fetchQuery, query, error } = getFilterResults(
charactersUrl,
results,
info
);
watchEffect(loadMore)
watchEffect(fetchQuery);
return { results, info, loadMore, query, error};
},
};
</script>
</code></pre>
<p>These are the errors that I get</p>
<p>error Unexpected mutation of "query" prop vue/no-mutating-props</p>
<p>error Unexpected mutation of "query" prop vue/no-mutating-props</p>
<p>I would greatly appreciate your help</p>
| [
{
"answer_id": 74131444,
"author": "orby",
"author_id": 8476400,
"author_profile": "https://Stackoverflow.com/users/8476400",
"pm_score": 0,
"selected": false,
"text": "import math\n\ndef calculate(num1, num2):\n \n num1 = num1**2\n num1 = num1 - 5\n num1 = num1 / 3\n\n nu... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20125070/"
] |
74,131,407 | <p><strong><code>Jenkins 3.346.2</code></strong></p>
<p>My proof of concept.</p>
<pre><code>pipeline {
agent {
label 'master'
}
stages {
stage('Test') {
steps {
script {
// The would be dynamically determined.
projects = [
[ name: 'project1', dir: 'path/1' ],
[ name: 'project2', dir: 'path/2' ],
[ name: 'project3', dir: 'path/3' ]
]
projectStages = [:]
projects.each { project ->
projectStages[project.name] = node {
agent {
kubernetes {
// Load a pod definition from a shared library.
yaml libraryResource('my-agent.yaml')
}
}
stages {
stage("Test $project.name") {
steps {
container('my-build-container') {
echo "Running: $project.name"
// Hostnames should be different (one for each project/pod).
sh('hostname')
}
}
}
}
}
}
parallel projectStages
}
}
}
}
}
</code></pre>
<p>It gets stuck on the <code>projects.each</code> line and hangs indefinitely.</p>
<pre><code>12:52:38 [Pipeline] node
12:52:53 Still waiting to schedule task
12:52:53 ‘Jenkins’ is reserved for jobs with matching label expression
etc...
</code></pre>
| [
{
"answer_id": 74131444,
"author": "orby",
"author_id": 8476400,
"author_profile": "https://Stackoverflow.com/users/8476400",
"pm_score": 0,
"selected": false,
"text": "import math\n\ndef calculate(num1, num2):\n \n num1 = num1**2\n num1 = num1 - 5\n num1 = num1 / 3\n\n nu... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1177418/"
] |
74,131,418 | <p>This <a href="https://pandas.pydata.org/docs/reference/api/pandas.to_datetime.html" rel="nofollow noreferrer">pandas documentation</a> says pandas <code>datetime</code> works with reference to <code>python</code> default <code>strftime</code>. But, It giving me different results with same dates in part of my code.</p>
<p><a href="https://i.stack.imgur.com/qUOnH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qUOnH.png" alt="format parameter in pandas" /></a></p>
<p>As here it is referencing to input <code>format</code> same as <code>python</code> <code>strftime</code>.</p>
<p>Using <code>python</code> <code>strptime</code></p>
<pre><code>import datetime
date = '19981128'
date_python = datetime.datetime.strptime(date, '%Y/%m/%d')
</code></pre>
<p>output:</p>
<pre><code>ValueError: time data '19981128' does not match format '%Y/%m/%d'
</code></pre>
<p>Using same with <code>pandas</code></p>
<pre><code>import pandas as pd
import datetime
date = '19981128'
date_pandas = pd.to_datetime(date, errors='coerce', format='%Y/%m/%d')
print(date_pandas)
</code></pre>
<p>output</p>
<pre><code>1998-11-28 00:00:00
</code></pre>
<p><code>pandas</code> Documention clearly says <code>datetime</code> module in <code>pandas</code> replicates behaviour of <code>python</code> strptime. Which is not happening here?</p>
| [
{
"answer_id": 74131444,
"author": "orby",
"author_id": 8476400,
"author_profile": "https://Stackoverflow.com/users/8476400",
"pm_score": 0,
"selected": false,
"text": "import math\n\ndef calculate(num1, num2):\n \n num1 = num1**2\n num1 = num1 - 5\n num1 = num1 / 3\n\n nu... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15358800/"
] |
74,131,447 | <p>I want to bind a ObservableCollection to a Itemscontrol inside a Datatemplate, that is inside another Datatemplate:</p>
<pre><code><ListView x:Name="list_befehlsfolge" Margin="5">
<ListView.ItemTemplate>
<DataTemplate DataType="{x:Type local:Befehlszeile}" >
<Expander Margin="5" Header="{Binding Path=Bezeichnung,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ItemsControl ItemsSource="{Binding Path=SubBefehlsliste}">
<DataTemplate DataType="{x:Type local:SubZeile_Text}">
<TextBox Text="{Binding Path=text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
</DataTemplate>
</ItemsControl>
</Expander>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</code></pre>
<p>Binding the source to <code>list_befehlsfolge.Itemsource</code> with code behind is no problem, but how can I bind <code>SubBefehlsliste</code>?</p>
<p>When I create a new instance of <code>SubBefehlsliste</code> like</p>
<pre><code>public class Befehlszeile : Position
{
public string Bezeichnung { get; set; } = "Befehlsname";
// crash at this line:
public ObservableCollection<Position> SubBefehlsliste { get; set; } = new ObservableCollection<Position>();
public Befehlszeile()
{
// SubBefehlsliste.Add(new SubZeile_Text());
}
}
</code></pre>
<p>it crashes with an error</p>
<blockquote>
<p>InvalidOperationException: The operation is invalid while using 'ItemsSource'. Instead, use ItemsControl.ItemsSource to access and modify items. (translated with google)</p>
</blockquote>
<p>(Position is a "Mother"-class for all Datatypes like SubZeile_Text and other, to add all to a ObservableCollection)</p>
| [
{
"answer_id": 74132270,
"author": "EldHasp",
"author_id": 13349759,
"author_profile": "https://Stackoverflow.com/users/13349759",
"pm_score": 1,
"selected": false,
"text": "Position"
},
{
"answer_id": 74183771,
"author": "user3600403",
"author_id": 3600403,
"author_p... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3600403/"
] |
74,131,454 | <p><a href="https://i.stack.imgur.com/R54kG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R54kG.jpg" alt="enter image description here" /></a></p>
<p>Unfortunately I know the quality isn't the best for cv.findChessboardCorners to be able to detect corners, but I am trying to identify corners detectors that will find corners in ROI (chessboard). I tried Harris Corner Detector but it didn't detect Chessboard corners but it detected corners in character corners.</p>
<p>What possible can I do to detect the corners of the square ?
Note this is an IR image, which is like a gray image ( 1 channel )</p>
| [
{
"answer_id": 74132270,
"author": "EldHasp",
"author_id": 13349759,
"author_profile": "https://Stackoverflow.com/users/13349759",
"pm_score": 1,
"selected": false,
"text": "Position"
},
{
"answer_id": 74183771,
"author": "user3600403",
"author_id": 3600403,
"author_p... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131454",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4350809/"
] |
74,131,498 | <pre><code>{
"isbn": "123-456-222",
"author": {
"_id": 1,
"lastname": "Doe",
"firstname": "Jane"
},
"editor": [
{
"_id": 1,
"lastname": "Smith",
"firstname": "Jane"
},
{
"_id": 2,
"lastname": "Lopez",
"firstname": "Jennifer"
}
],
"title": "The Ultimate Database Study Guide",
"category": [
"Non-Fiction",
"Technology"
]
}
</code></pre>
<p>I am using the MongoDB database and MongoDB .NET driver library in .NET Core. I can search by <code>isbn</code>, but I want to find all books with editor <code>firstname: Jane</code>, <code>lastname: Smith</code> and <code>firstname: Jennifer</code>, <code>lastname: Lopez</code>. How can I do that?</p>
| [
{
"answer_id": 74132270,
"author": "EldHasp",
"author_id": 13349759,
"author_profile": "https://Stackoverflow.com/users/13349759",
"pm_score": 1,
"selected": false,
"text": "Position"
},
{
"answer_id": 74183771,
"author": "user3600403",
"author_id": 3600403,
"author_p... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15052430/"
] |
74,131,547 | <p>I'm writing a program that will read from /etc/passwd and output the username and shell.</p>
<p>For example, here is the first line of the /etc/passwd file:</p>
<p>root:x:0:0:root:/root:/bin/bash</p>
<p>I need to only output the user and the shell. In this instance it would print:</p>
<p>root:/bin/bash</p>
<p>The values are seperated by : so I just need to print the string before the first : and the string after the 6th :</p>
<p>Here is the code I have so far:</p>
<pre><code>#include <unistd.h>
#include <fcntl.h>
//printf prototype
int printf(const char *text, ...);
void customized_print(char* buff,char* outbuff);
int main(void)
{
int fd;
int buff_size = 1;
char buff[512];
char outbuff[512];
int size;
fd = open("/etc/passwd",O_RDONLY);
if (fd < 0)
{
printf("Error opening file \n");
return -1;
}
while ((size = read(fd,buff,1))>0)
{
buff[1] = '\0';
customized_print("%s",outbuff);
}
}
void customized_print(char* buff,char* outbuff)
{
int i = 0, j = 0, count = 0;
while (i<512)
{
if((outbuff[j++]=buff[i++] == ':'))
break;
}
while(i<512 && count < 5)
{
if(buff[i++] == ':')
count++;
}
while (i < 512)
{
if( (outbuff[j++]=buff[i++] == '\0'))
break;
}
printf("%s\n",outbuff);
}
</code></pre>
<p>Im having some trouble utilizing the custimized print function to work when reading from a file</p>
<p>(Im creating prototypes for printf because one of the requirments was to wite the program without including stdio.h and stdlib.h)</p>
| [
{
"answer_id": 74131690,
"author": "Vadim Kashtanov",
"author_id": 17002112,
"author_profile": "https://Stackoverflow.com/users/17002112",
"pm_score": -1,
"selected": false,
"text": "FILE * fp = fopen(file_name, 'rb'); //rb = read binary\n\nint a;\n//Read the next int (4 byte, and char=... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15615382/"
] |
74,131,559 | <p>This is what I get when I run the command <code>pip install mariadb</code>:</p>
<pre><code>Defaulting to user installation because normal site-packages is not writeable
Collecting mariadb
Using cached mariadb-1.1.4.zip (97 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-6kwo2pga/mariadb_84568c03780743cba30d255711f92d08/setup.py", line 27, in <module>
cfg = get_config(options)
File "/tmp/pip-install-6kwo2pga/mariadb_84568c03780743cba30d255711f92d08/mariadb_posix.py", line 64, in get_config
print('MariaDB Connector/Python requires MariaDB Connector/C '
TypeError: not enough arguments for format string
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
</code></pre>
<p>I tried solving it for hours, but I couldn't do it and I came here, in need for solutions.
<strong>Yes, I installed the connector as well</strong>, even my teacher got surprised that I got that error after I tried installing the connector (<a href="https://mariadb.com/docs/connect/programming-languages/c/install/#connector-c-install-repo-install" rel="nofollow noreferrer">https://mariadb.com/docs/connect/programming-languages/c/install/#connector-c-install-repo-install</a>).</p>
<p>I tried reinstalling python and pip (not the best idea, because that took some time and I also had to reinstall my Desktop).
<strong>I also ran <code>sudo apt update</code> and <code>sudo apt upgrade</code></strong>, but nothing. I have even fixed it (it was literally broken, and I had to remove the package he was trying to update).</p>
<p>Anyways, I am totally clueless, I have even looked on other answers on stackoverflow and github regarding the same question, but it just seems like I cannot make it work for some reason. I would love some help if someone could assist me!</p>
| [
{
"answer_id": 74134618,
"author": "RidiX",
"author_id": 14461933,
"author_profile": "https://Stackoverflow.com/users/14461933",
"pm_score": 1,
"selected": true,
"text": "pip install mariadb==1.0.11\n"
},
{
"answer_id": 74136155,
"author": "Georg Richter",
"author_id": 69... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14461933/"
] |
74,131,561 | <p>I have the following dict which is composed of a list</p>
<pre><code>response = client.describe_auto_scaling_groups()
print(type(response),'\n')
for key,value in response.items():
print(type(value))
print(len(value))
</code></pre>
<p>the result to this is</p>
<pre><code><class 'dict'>
<class 'list'>
2
<class 'dict'>
4
</code></pre>
<p>I am interested only in the list output and when I further dig into the type of data in the list, I get</p>
<pre><code> for key,value in response.items():
print(type(value))
print(len(value))
for lst in value:
print(type(lst))
</code></pre>
<p>I get</p>
<pre><code><class 'dict'>
<class 'list'>
2
<class 'dict'>
<class 'dict'>
<class 'dict'>
4
<class 'str'>
<class 'str'>
<class 'str'>
<class 'str'>
</code></pre>
<p>So basically I have a 1 dict object, which has a 2 list object (corresponds to the 2 auto scaling groups) in it which has 4 str objects in it.</p>
<p>The <code>response</code> object looks like this</p>
<pre><code>{'AutoScalingGroups': [{'AutoScalingGroupName': 'eks-core-20221011202902697400000006-6ac1e45e-44ee-4a43-166c-12d3d432e241', 'AutoScalingGroupARN': 'arn:aws:autoscaling:ca-central-1:744734775600:autoScalingGroup:e700fbf0-178e-4ff8-8687-6b7103af5b65:autoScalingGroupName/eks-core-20221011202902697400000006-6ac1e45e-44ee-4a43-166c-12d3d432e241', 'MixedInstancesPolicy': {'LaunchTemplate': {'LaunchTemplateSpecification': {'LaunchTemplateId': 'lt-0477d3fffb684214d', 'LaunchTemplateName': 'eks-6ac1e45e-44ee-4a43-166c-12d3d432e241', 'Version': '1'}, 'Overrides': [{'InstanceType': 't3.2xlarge'}]}, 'InstancesDistribution': {'OnDemandAllocationStrategy': 'prioritized', 'OnDemandBaseCapacity': 0, 'OnDemandPercentageAboveBaseCapacity': 0, 'SpotAllocationStrategy': 'capacity-optimized'}}, 'MinSize': 3, 'MaxSize': 6, 'DesiredCapacity': 3, 'DefaultCooldown': 300, 'AvailabilityZones': ['ca-central-1d', 'ca-central-1b', 'ca-central-1a'], 'LoadBalancerNames': [], 'TargetGroupARNs': ['arn:aws:elasticloadbalancing:ca-central-1:744734775600:targetgroup/eks-ingress-http/3dfa91118f700452', 'arn:aws:elasticloadbalancing:ca-central-1:744734775600:targetgroup/eks-ingress/e4a924db58da487a'], 'HealthCheckType': 'EC2', 'HealthCheckGracePeriod': 15, 'Instances': [{'InstanceId': 'i-020d70d503bc32dbc', 'InstanceType': 't3.2xlarge', 'AvailabilityZone': 'ca-central-1b', 'LifecycleState': 'InService', 'HealthStatus': 'Healthy', 'LaunchTemplate': {'LaunchTemplateId': 'lt-0477d3fffb684214d', 'LaunchTemplateName': 'eks-6ac1e45e-44ee-4a43-166c-12d3d432e241', 'Version': '1'}, 'ProtectedFromScaleIn': False}, {'InstanceId': 'i-05da68bac7b47b5f6', 'InstanceType': 't3.2xlarge', 'AvailabilityZone': 'ca-central-1a', 'LifecycleState': 'InService', 'HealthStatus': 'Healthy', 'LaunchTemplate': {'LaunchTemplateId': 'lt-0477d3fffb684214d', 'LaunchTemplateName': 'eks-6ac1e45e-44ee-4a43-166c-12d3d432e241', 'Version': '1'}, 'ProtectedFromScaleIn': False}, {'InstanceId': 'i-099e1d57a3cb55d93', 'InstanceType': 't3.2xlarge', 'AvailabilityZone': 'ca-central-1d', 'LifecycleState': 'InService', 'HealthStatus': 'Healthy', 'LaunchTemplate': {'LaunchTemplateId': 'lt-0477d3fffb684214d', 'LaunchTemplateName': 'eks-6ac1e45e-44ee-4a43-166c-12d3d432e241', 'Version': '1'}, 'ProtectedFromScaleIn': False}], 'CreatedTime': datetime.datetime(2022, 10, 11, 20, 29, 50, 226000, tzinfo=tzutc()), 'SuspendedProcesses': [], 'VPCZoneIdentifier': 'subnet-0286d381da9f5fa9c,subnet-0fc58322f447bae71,subnet-0381004140a514844', 'EnabledMetrics': [{'Metric': 'GroupInServiceCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupTotalInstances', 'Granularity': '1Minute'}, {'Metric': 'WarmPoolDesiredCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupDesiredCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupAndWarmPoolDesiredCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupAndWarmPoolTotalCapacity', 'Granularity': '1Minute'}, {'Metric': 'WarmPoolTerminatingCapacity', 'Granularity': '1Minute'}, {'Metric': 'WarmPoolMinSize', 'Granularity': '1Minute'}, {'Metric': 'GroupMinSize', 'Granularity': '1Minute'}, {'Metric': 'GroupInServiceInstances', 'Granularity': '1Minute'}, {'Metric': 'WarmPoolPendingCapacity', 'Granularity': '1Minute'}, {'Metric': 'WarmPoolWarmedCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupStandbyCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupTerminatingInstances', 'Granularity': '1Minute'}, {'Metric': 'GroupMaxSize', 'Granularity': '1Minute'}, {'Metric': 'GroupPendingInstances', 'Granularity': '1Minute'}, {'Metric': 'GroupStandbyInstances', 'Granularity': '1Minute'}, {'Metric': 'GroupTerminatingCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupPendingCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupTotalCapacity', 'Granularity': '1Minute'}, {'Metric': 'WarmPoolTotalCapacity', 'Granularity': '1Minute'}], 'Tags': [{'ResourceId': 'eks-core-20221011202902697400000006-6ac1e45e-44ee-4a43-166c-12d3d432e241', 'ResourceType': 'auto-scaling-group', 'Key': 'eks:cluster-name', 'Value': 'dev-build', 'PropagateAtLaunch': True}, {'ResourceId': 'eks-core-20221011202902697400000006-6ac1e45e-44ee-4a43-166c-12d3d432e241', 'ResourceType': 'auto-scaling-group', 'Key': 'eks:nodegroup-name', 'Value': 'core-20221011202902697400000006', 'PropagateAtLaunch': True}, {'ResourceId': 'eks-core-20221011202902697400000006-6ac1e45e-44ee-4a43-166c-12d3d432e241', 'ResourceType': 'auto-scaling-group', 'Key': 'k8s.io/cluster-autoscaler/dev-build', 'Value': 'owned', 'PropagateAtLaunch': True}, {'ResourceId': 'eks-core-20221011202902697400000006-6ac1e45e-44ee-4a43-166c-12d3d432e241', 'ResourceType': 'auto-scaling-group', 'Key': 'k8s.io/cluster-autoscaler/enabled', 'Value': 'true', 'PropagateAtLaunch': True}, {'ResourceId': 'eks-core-20221011202902697400000006-6ac1e45e-44ee-4a43-166c-12d3d432e241', 'ResourceType': 'auto-scaling-group', 'Key': 'kubernetes.io/cluster/dev-build', 'Value': 'owned', 'PropagateAtLaunch': True}], 'TerminationPolicies': ['AllocationStrategy', 'OldestLaunchTemplate', 'OldestInstance'], 'NewInstancesProtectedFromScaleIn': False, 'ServiceLinkedRoleARN': 'arn:aws:iam::744734775600:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling', 'CapacityRebalance': True}, {'AutoScalingGroupName': 'eks-dip-jobs-2022101120290341260000000d-9ec1e45e-4631-847b-b82d-d42d0fc330f0', 'AutoScalingGroupARN': 'arn:aws:autoscaling:ca-central-1:744734775600:autoScalingGroup:e18ade5c-2740-4648-85b5-d7d6b3253629:autoScalingGroupName/eks-dip-jobs-2022101120290341260000000d-9ec1e45e-4631-847b-b82d-d42d0fc330f0', 'MixedInstancesPolicy': {'LaunchTemplate': {'LaunchTemplateSpecification': {'LaunchTemplateId': 'lt-0fda9790b0b400c88', 'LaunchTemplateName': 'eks-9ec1e45e-4631-847b-b82d-d42d0fc330f0', 'Version': '1'}, 'Overrides': [{'InstanceType': 't3.xlarge'}]}, 'InstancesDistribution': {'OnDemandAllocationStrategy': 'prioritized', 'OnDemandBaseCapacity': 0, 'OnDemandPercentageAboveBaseCapacity': 0, 'SpotAllocationStrategy': 'capacity-optimized'}}, 'MinSize': 0, 'MaxSize': 10, 'DesiredCapacity': 0, 'DefaultCooldown': 300, 'AvailabilityZones': ['ca-central-1d', 'ca-central-1b', 'ca-central-1a'], 'LoadBalancerNames': [], 'TargetGroupARNs': [], 'HealthCheckType': 'EC2', 'HealthCheckGracePeriod': 15, 'Instances': [], 'CreatedTime': datetime.datetime(2022, 10, 11, 20, 29, 41, 507000, tzinfo=tzutc()), 'SuspendedProcesses': [], 'VPCZoneIdentifier': 'subnet-0286d381da9f5fa9c,subnet-0fc58322f447bae71,subnet-0381004140a514844', 'EnabledMetrics': [{'Metric': 'GroupStandbyCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupPendingInstances', 'Granularity': '1Minute'}, {'Metric': 'GroupPendingCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupTerminatingCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupTotalCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupTerminatingInstances', 'Granularity': '1Minute'}, {'Metric': 'WarmPoolMinSize', 'Granularity': '1Minute'}, {'Metric': 'WarmPoolTerminatingCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupInServiceInstances', 'Granularity': '1Minute'}, {'Metric': 'WarmPoolWarmedCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupMaxSize', 'Granularity': '1Minute'}, {'Metric': 'GroupTotalInstances', 'Granularity': '1Minute'}, {'Metric': 'GroupInServiceCapacity', 'Granularity': '1Minute'}, {'Metric': 'WarmPoolDesiredCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupAndWarmPoolDesiredCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupAndWarmPoolTotalCapacity', 'Granularity': '1Minute'}, {'Metric': 'WarmPoolPendingCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupDesiredCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupMinSize', 'Granularity': '1Minute'}, {'Metric': 'WarmPoolTotalCapacity', 'Granularity': '1Minute'}, {'Metric': 'GroupStandbyInstances', 'Granularity': '1Minute'}], 'Tags': [{'ResourceId': 'eks-dip-jobs-2022101120290341260000000d-9ec1e45e-4631-847b-b82d-d42d0fc330f0', 'ResourceType': 'auto-scaling-group', 'Key': 'eks:cluster-name', 'Value': 'dev-build', 'PropagateAtLaunch': True}, {'ResourceId': 'eks-dip-jobs-2022101120290341260000000d-9ec1e45e-4631-847b-b82d-d42d0fc330f0', 'ResourceType': 'auto-scaling-group', 'Key': 'eks:nodegroup-name', 'Value': 'dip-jobs-2022101120290341260000000d', 'PropagateAtLaunch': True}, {'ResourceId': 'eks-dip-jobs-2022101120290341260000000d-9ec1e45e-4631-847b-b82d-d42d0fc330f0', 'ResourceType': 'auto-scaling-group', 'Key': 'k8s.io/cluster-autoscaler/dev-build', 'Value': 'owned', 'PropagateAtLaunch': True}, {'ResourceId': 'eks-dip-jobs-2022101120290341260000000d-9ec1e45e-4631-847b-b82d-d42d0fc330f0', 'ResourceType': 'auto-scaling-group', 'Key': 'k8s.io/cluster-autoscaler/enabled', 'Value': 'true', 'PropagateAtLaunch': True}, {'ResourceId': 'eks-dip-jobs-2022101120290341260000000d-9ec1e45e-4631-847b-b82d-d42d0fc330f0', 'ResourceType': 'auto-scaling-group', 'Key': 'kubernetes.io/cluster/dev-build', 'Value': 'owned', 'PropagateAtLaunch': True}], 'TerminationPolicies': ['AllocationStrategy', 'OldestLaunchTemplate', 'OldestInstance'], 'NewInstancesProtectedFromScaleIn': False, 'ServiceLinkedRoleARN': 'arn:aws:iam::744734775600:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling', 'CapacityRebalance': True}], 'ResponseMetadata': {'RequestId': 'e4d9be35-53d6-4efe-b66e-bc6ad1f91a19', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amzn-requestid': 'e4d9be35-53d6-4efe-b66e-bc6ad1f91a19', 'content-type': 'text/xml', 'content-length': '17188', 'vary': 'accept-encoding', 'date': 'Wed, 19 Oct 2022 20:17:05 GMT'}, 'RetryAttempts': 0}}
</code></pre>
<p>My end goal is to extract the <code>AutoScalingGroupName</code> and <code>DesiredCapacity</code> for each of the 2 list objects that are inside 1 list thats inside the main dict object.</p>
<p>The code I have till now is</p>
<pre><code> for key,value in response.items():
for k in value:
for keyy,valuee in k.items():
if keyy == 'AutoScalingGroupName':
print(valuee)
elif keyy == 'DesiredCapacity':
print(valuee)
</code></pre>
<p>This gives me</p>
<pre><code>eks-core-20221011202902697400000006-6ac1e45e-44ee-4a43-166c-12d3d432e241
3
eks-dip-jobs-2022101120290341260000000d-9ec1e45e-4631-847b-b82d-d42d0fc330f0
0
Traceback (most recent call last):
File "/Users/me/Work/gitlab/img-asg-exporter/aws.py", line 62, in <module>
get_asg_names()
File "/Users/me/Work/gitlab/img-asg-exporter/aws.py", line 55, in get_asg_names
for keyy,valuee in k.items():
AttributeError: 'str' object has no attribute 'items'
</code></pre>
<p>I understand why the error occurs and i know how to fix that. My question is whether this is the most optimal way to extract values like this ? I eventually want to append the values to a new dict and have it like</p>
<pre><code>final = {
"eks-core-20221011202902697400000006-6ac1e45e-44ee-4a43-166c-12d3d432e241": "3",
"eks-dip-jobs-2022101120290341260000000d-9ec1e45e-4631-847b-b82d-d42d0fc330f0": "0"
}
</code></pre>
| [
{
"answer_id": 74134618,
"author": "RidiX",
"author_id": 14461933,
"author_profile": "https://Stackoverflow.com/users/14461933",
"pm_score": 1,
"selected": true,
"text": "pip install mariadb==1.0.11\n"
},
{
"answer_id": 74136155,
"author": "Georg Richter",
"author_id": 69... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11659920/"
] |
74,131,575 | <p>I created an iOS test flight build using Fastlane, and I got this strange error, not sure why because it was working fine yesterday and now without any change in Fastlane configuration it gives me an error while uploading the build to the Apple App store.</p>
<p>errors wordings are as below</p>
<pre><code>[21:50:01]: Transporter transfer failed.
[21:50:01]:
[21:50:01]: Cannot obtain the content provider public id. Please specify a provider short name using the -asc_provider option.
[21:50:02]: Cannot obtain the content provider public id. Please specify a provider short name using the -asc_provider option.
Return status of iTunes Transporter was 1: Cannot obtain the content provider public id. Please specify a provider short name using the -asc_provider option.
The call to the iTMSTransporter completed with a non-zero exit status: 1. This indicates a failure.
[21:50:02]: Error uploading ipa file:
[21:50:02]: fastlane finished with errors
[!] Error uploading ipa file:
</code></pre>
<p>Refer below logs
<a href="https://i.stack.imgur.com/gtvU8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gtvU8.png" alt="enter image description here" /></a></p>
| [
{
"answer_id": 74139270,
"author": "Maheshvirus",
"author_id": 4615540,
"author_profile": "https://Stackoverflow.com/users/4615540",
"pm_score": 3,
"selected": false,
"text": "itc_provider"
},
{
"answer_id": 74143883,
"author": "Archimedes Trajano",
"author_id": 242042,
... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2138586/"
] |
74,131,585 | <p>Found this question by @CarstenWE but it had been closed with no answer: <a href="https://stackoverflow.com/questions/73308803/how-to-get-classification-report-from-the-confusion-matrix">How to get classification report from the confusion matrix?</a></p>
<p>As the question is closed, I opened this question to provide an answer.
The questions linked to the original all have answers to compute precision, recall, and f1-score. However, none seems to use the <code>classification_report</code> as the original question asked.</p>
| [
{
"answer_id": 74139270,
"author": "Maheshvirus",
"author_id": 4615540,
"author_profile": "https://Stackoverflow.com/users/4615540",
"pm_score": 3,
"selected": false,
"text": "itc_provider"
},
{
"answer_id": 74143883,
"author": "Archimedes Trajano",
"author_id": 242042,
... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3168934/"
] |
74,131,594 | <p>I have a dataset with a column storing hundreds of writing samples. My goal is to export each writing sample into a separate image. Below, my current code:</p>
<pre><code>library(tidyverse)
library(ggplot2)
library(ggtext)
library(magick)
df <- data.frame(
ID = 1:2,
Sample = c("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \r\r\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
)
</code></pre>
<p>First, I calculate the number of characters for each writing sample (spaces between words included) to establish the text size in <code>ggtext::geom_textbox</code>. This will enable users to set the same text size across all the writing samples:</p>
<pre><code>max_text <- df |>
rowwise() |>
mutate(n = nchar(Sample)) |>
ungroup() |>
top_n(1, n)
p_longest_text <- ggplot(max_text, aes(label = Sample)) +
ggtext::geom_textbox(x = 0, y = 1, width = 0.9, hjust = 0, vjust = 1, size = 3, box.colour = "white") +
theme_void()
ggsave("longest_text.png", p_longest_text, width = 1000, height = 1200, units = "px", bg = "white")
</code></pre>
<p>After establishing an adequate text size, I can use the value (in the current toy data set is <code>size = 3</code>) in the for-loop to generate one image for each writing sample. The text size will be the same across all the images:</p>
<pre><code>for(i in 1:nrow(df)) {
tec <- paste0(df[i,]$ID, ".png")
p <- ggplot(df[i,], aes(label = Sample)) +
ggtext::geom_textbox(x = 0, y = 1, width = 0.9, hjust = 0, vjust = 1, size = 3, box.colour = "white") +
theme_void()
ggsave(tec, p, width = 1000, height = 1200, units = "px", bg = "white")
}
</code></pre>
<p>Unfortunately, two issues remain:</p>
<ol>
<li>I am unable to crop out the empty space. Unfortunately, <code>image_trim()</code> does not work well because it leaves no margin between the text and the cropped section. <code>image_crop</code> seems more promising but I don't know how to adjust it to each image differently.</li>
<li>Right now, the code requires the user to manually try different text sizes to determine the value to use in the for-loop. It would be great to automatize this process so that the chunk of code can be run without a user's decision.</li>
</ol>
<p>Any help will be appreciated!</p>
| [
{
"answer_id": 74139270,
"author": "Maheshvirus",
"author_id": 4615540,
"author_profile": "https://Stackoverflow.com/users/4615540",
"pm_score": 3,
"selected": false,
"text": "itc_provider"
},
{
"answer_id": 74143883,
"author": "Archimedes Trajano",
"author_id": 242042,
... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8430337/"
] |
74,131,595 | <p>I've recently ran into this error with the google cloud storage SDK on Node.js.
I know for a fact that this worked in the past without any changes, but I haven't touched the code in a while and might be wrong.</p>
<p>Here's the error itself:</p>
<pre><code>Error: error:1E08010C:DECODER routines::unsupported
at Sign.sign (node:internal/crypto/sig:131:29)
at Object.sign (node_modules/jwa/index.js:152:45)
at Object.jwsSign [as sign] (node_modules/jws/lib/sign-stream.js:32:24)
at GoogleToken.requestToken (node_modules/gtoken/build/src/index.js:232:31)
at GoogleToken.getTokenAsyncInner (node_modules/gtoken/build/src/index.js:166:21)
at GoogleToken.getTokenAsync (node_modules/gtoken/build/src/index.js:145:55)
at GoogleToken.getToken (node_modules/gtoken/build/src/index.js:97:21)
at JWT.refreshTokenNoCache (node_modules/google-auth-library/build/src/auth/jwtclient.js:172:36)
at JWT.refreshToken (node_modules/google-auth-library/build/src/auth/oauth2client.js:153:24)
at JWT.getRequestMetadataAsync (node_modules/google-auth-library/build/src/auth/oauth2client.js:298:28) {
library: 'DECODER routines',
reason: 'unsupported',
code: 'ERR_OSSL_UNSUPPORTED'
}
</code></pre>
<p>The code that throws this error is the following:</p>
<pre class="lang-js prettyprint-override"><code>const credentials = {
type: process.env.TYPE,
project_id: process.env.PROJECT_ID,
private_key_id: process.env.PRIVATE_KEY_ID,
private_key: process.env.PRIVATE_KEY,
client_email: process.env.CLIENT_EMAIL,
client_id: process.env.CLIENT_ID,
auth_uri: process.env.AUTH_URI,
token_uri: process.env.TOKEN_URI,
auth_provider_x509_cert_url: process.env.AUTH_PROVIDER_X509_CERT_URL,
client_x509_cert_url: process.env.CLIENT_X509_CERT_URL,
};
const storage = new Storage({
credentials,
});
if (!req.file) {
logger('POST /profile_image', logLevels.error, 'No file uploaded!');
ResponseError.badRequest(res);
}
const bucketName = process.env.BUCKET_NAME;
const bucket = storage.bucket(bucketName);
const fileName = `profile_pics/${req.user}/${req.file.originalname}`;
const file = bucket.file(fileName);
const stream = file.createWriteStream({
metadata: {
contentType: req.file.mimetype,
},
});
stream.on('error', (err) => {
console.error('Error pushing the picture: ', err); <--- error
throw err;
});
stream.on('finish', () => {
return file.makePublic().then(async () => {
...
})
});
stream.end(req.file.buffer);
</code></pre>
<p>The <code>process.env</code> contains all the right values, I've made sure to try with a new private key but same error. Has anyone seen this one before?</p>
<p>TIA!</p>
| [
{
"answer_id": 74416545,
"author": "bobmcn",
"author_id": 47833,
"author_profile": "https://Stackoverflow.com/users/47833",
"pm_score": 0,
"selected": false,
"text": " openssl_conf = openssl_init\n \n [openssl_init]\n providers = provider_sect\n \n [provider_sect]\n default... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10437727/"
] |
74,131,599 | <p>I would like to execute some code from a non-main thread inside the main thread (UI thread) in .Net 6 with C#.</p>
<p>I've tried to use this code:</p>
<pre><code>await Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(
Windows.UI.Core.CoreDispatcherPriority.Normal,
() => { }
);
</code></pre>
<p>This doesn't work, since <code>Windows.UI.Core.CoreWindow.GetForCurrentThread()</code> returns <code>null</code>.</p>
<p>My second try was:</p>
<pre><code>await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
Windows.UI.Core.CoreDispatcherPriority.Normal,
() => { }
);
</code></pre>
<p>This fails, because <code>Windows.ApplicationModel.Core.CoreApplication.MainView</code> throws a <code>System.InvalidOperationException</code>.</p>
<p>Another way should be:</p>
<pre><code>await System.Windows.Threading.Dispatcher.RunAsync(
Windows.UI.Core.CoreDispatcherPriority.Normal,
() => { }
);
</code></pre>
<p>But the <code>System.Windows.Threading</code> namespace is not available for me, since I'm using .Net 6 and it's not longer supported in it.</p>
<p><strong>Any idea, how I can execute some code from a non-main thread inside the main-thread (UI thread)?</strong></p>
| [
{
"answer_id": 74131827,
"author": "Stephen Cleary",
"author_id": 263693,
"author_profile": "https://Stackoverflow.com/users/263693",
"pm_score": 2,
"selected": false,
"text": "async"
},
{
"answer_id": 74587777,
"author": "Willy",
"author_id": 20138168,
"author_profil... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20138168/"
] |
74,131,631 | <p>I am trying to debug an azure function app in VSCode using Python in a Windows10 environment. Whenever I launch the debugger it hangs for a long period of time and then opens a message box that says</p>
<blockquote>
<p>ECONNREFUSED 127.0.0.1:9091</p>
</blockquote>
<p>There are a bunch of posts about this but none seem helpful/can solve the problem. Here is what I've tried:</p>
<ul>
<li>uninstalling and re-installing different versions of
azure-function-core-tools using windows installer, npm and chocolatey</li>
<li>uninstalling and re-installing Azure Functions extension in VS Code</li>
<li>changing the extension bundle</li>
</ul>
<pre><code> "extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.3.0, 4.0.0)"
}
</code></pre>
<ul>
<li>modifying local.settings.json</li>
</ul>
<pre><code>{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "python"
}
}
</code></pre>
<ul>
<li>deleting C:\Users\admin.azure-functions-core-tools\Functions\ExtensionBundles</li>
<li>creating a function app from command line using "func init" and lauching debugger by running "func host start" in active venv</li>
</ul>
<p>I am using Python38 and really have no idea what else to try. Any suggestions are welcome.</p>
<p>Thanks!</p>
| [
{
"answer_id": 74131827,
"author": "Stephen Cleary",
"author_id": 263693,
"author_profile": "https://Stackoverflow.com/users/263693",
"pm_score": 2,
"selected": false,
"text": "async"
},
{
"answer_id": 74587777,
"author": "Willy",
"author_id": 20138168,
"author_profil... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131631",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11808813/"
] |
74,131,642 | <p>How do I set the keyboard shortcut character for a Windows Forms button with no text?</p>
<p>I have a Windows Forms app with some buttons with images but no text. Normally for a button, the shortcut is specified with the ampersand character (&). But what does one do when there's no text?</p>
<p>I know there are tricks, such as leading spaces to push the text off to the right or down. Or play with the font, forecolor, etc. But I don't like such tricks because they sometimes backfire.</p>
<p>Should I consider handling the shortcuts for all controls through the Key events of the form? How would this sort out which control is selected? Are form Key events filtered through the form before they're sent on to the Key events of the controls? I'm not sure what to do if I went this way.</p>
| [
{
"answer_id": 74135034,
"author": "Jimi",
"author_id": 7444103,
"author_profile": "https://Stackoverflow.com/users/7444103",
"pm_score": 2,
"selected": false,
"text": "[Flags]"
},
{
"answer_id": 74136198,
"author": "Henry",
"author_id": 3405661,
"author_profile": "ht... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2705042/"
] |
74,131,653 | <p>I want to retun only a valure:
in html</p>
<pre><code> <tr *ngFor="let valCorr of valueCall| async">
<th>{{valCorr }}</th>
</tr>
</code></pre>
<p>in ts</p>
<pre><code> valueCall:Observable<number[]>
//this.studentService.getResult() return an Observable<number[]>
this.valueCall:Observable=this.studentService.getResult().pipe(map(result=> result.filter(x => x>2)),take(1));
</code></pre>
<p>in my serivce</p>
<pre><code> getResult():Observable<number[]> {
return of([1,2,3,4,5,6]);
}
</code></pre>
<p>the result is not only one element take it seems doesn't work. anyone can help me?</p>
| [
{
"answer_id": 74135674,
"author": "Eliseo",
"author_id": 8558186,
"author_profile": "https://Stackoverflow.com/users/8558186",
"pm_score": -1,
"selected": false,
"text": "map((result:any[])=> {\n const values=result.filter(x => x>2)\n //be sure there're at least one element else retur... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5913236/"
] |
74,131,654 | <p>I am trying to make it so that when a user signs up on my application and confirms their account, that it updates the user mysql database on cpanel. I found that you can use AWS AWS RDS to create a database instance, however it is pretty pricey to use.</p>
<p>Is there a cheaper alternative to insert rows in my remote database through an AWS lambda trigger.</p>
| [
{
"answer_id": 74135674,
"author": "Eliseo",
"author_id": 8558186,
"author_profile": "https://Stackoverflow.com/users/8558186",
"pm_score": -1,
"selected": false,
"text": "map((result:any[])=> {\n const values=result.filter(x => x>2)\n //be sure there're at least one element else retur... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16645466/"
] |
74,131,669 | <p>We have 2 Tables Employees and Department.</p>
<ol>
<li>We want to show the maximum salary from each department and their corresponding employee name from the employee table and the department name from the department table.</li>
</ol>
<p>Employee Table</p>
<pre><code>EmpId | EmpName |salary |DeptId
101 shubh1 1000 1
101 shubh2 4000 1
102 shubh3 3000 2
102 shubh4 5000 2
103 shubh5 12000 3
103 shubh6 1000 3
104 shubh7 1400 4
104 shubh8 1000 4
</code></pre>
<p>Department Table</p>
<pre><code>DeptId | DeptName
1 ComputerScience
2 Mechanical
3 Aeronautics
4 Civil
</code></pre>
<p>I tried doing it but was getting error</p>
<pre><code>SELECT DeptName FROM Department where deptid IN(select MAX(salary),empname,deptid
FROM Employee
GROUP By Employee.deptid)
</code></pre>
<p><strong>Error</strong></p>
<blockquote>
<p>Token error: 'Column 'Employee.EmpName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.' on server 4e0652f832fd executing on line 1 (code: 8120, state: 1, class: 16)</p>
</blockquote>
<p>Can someone please help me.</p>
| [
{
"answer_id": 74135674,
"author": "Eliseo",
"author_id": 8558186,
"author_profile": "https://Stackoverflow.com/users/8558186",
"pm_score": -1,
"selected": false,
"text": "map((result:any[])=> {\n const values=result.filter(x => x>2)\n //be sure there're at least one element else retur... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16269829/"
] |
74,131,692 | <p>I have the below extension method where I pass the type and cast the object to the type but get a compile error at casting.</p>
<pre><code>public static void AddCellProperties(this ColumnInfo _columnInfo, Type type)
{
_columnInfo.SetCellUsing((c, o) =>
{
if (o == null) c.SetCellValue("NULL");
else c.SetCellValue((type)o); // getting an error here near "type"
})
.SetPropertyUsing(a => a as string == "NULL" ? null : Convert.ChangeType(a, type, CultureInfo.InvariantCulture));
}
</code></pre>
<p>But whereas this works.</p>
<pre><code>public static void AddCellProperties(this ColumnInfo _columnInfo)
{
_columnInfo.SetCellUsing((c, o) =>
{
if (o == null) c.SetCellValue("NULL");
else c.SetCellValue((int)o);
})
.SetPropertyUsing(a => a as string == "NULL" ? null : Convert.ChangeType(a, typeof(int), CultureInfo.InvariantCulture));
}
</code></pre>
<p>I am just trying to replace the <code>int</code> with <code>type</code> so that caller can pass whatever type.</p>
<p>Could anyone please let me know how I can overcome this issue? Thanks in advance!!!</p>
| [
{
"answer_id": 74135674,
"author": "Eliseo",
"author_id": 8558186,
"author_profile": "https://Stackoverflow.com/users/8558186",
"pm_score": -1,
"selected": false,
"text": "map((result:any[])=> {\n const values=result.filter(x => x>2)\n //be sure there're at least one element else retur... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20073360/"
] |
74,131,713 | <p>I have questions on where to even start on this problem.
The problem requires the following.</p>
<pre><code>// We want to create a function that will add numbers together,
// when called in succession.
add(1)(2); // == 3
</code></pre>
<p>I have never seen functions be used in such a way, and I am currently at a loss of where to start. Furthermore, I tried to do some research on parameter chaining, but this is all I could find.</p>
<p><a href="https://levelup.gitconnected.com/how-to-implement-method-chaining-in-c-3ec9f255972a" rel="nofollow noreferrer">https://levelup.gitconnected.com/how-to-implement-method-chaining-in-c-3ec9f255972a</a></p>
<p>If you guys have any questions, I can edit my code or question. Any help is appreciated.</p>
| [
{
"answer_id": 74131754,
"author": "bolov",
"author_id": 2805305,
"author_profile": "https://Stackoverflow.com/users/2805305",
"pm_score": 0,
"selected": false,
"text": "operator()"
},
{
"answer_id": 74131761,
"author": "JeJo",
"author_id": 9609840,
"author_profile": ... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20277500/"
] |
74,131,722 | <p>I know that the code is incorrect and that the ADDDATE function should be used, but I'm trying to find out if a specific behaviour is caused by this bug.</p>
<p>So, does anyone know what exactly happens if I have the statement</p>
<pre><code>SELECT * FROM MyTable WHERE TheTimestamp > (NOW()-86400);
</code></pre>
<p>when TheTimestamp is of the datetime data type?</p>
| [
{
"answer_id": 74132028,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 1,
"selected": true,
"text": "NOW()"
},
{
"answer_id": 74132038,
"author": "Lauri Warsen",
"author_id": 13155009,
"author_profi... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13465354/"
] |
74,131,752 | <p>I'm trying to round my numbers to 1 decimal places. This could be with any number with many decimal places or no decimal places.
But now I'm trying to go with 8.25 as an example because when I try rounding it it always be cut or rounded to 8.2 but I'm looking for it to be 8.3 . Pls help</p>
<p><code>print(round(result,1)) #result -> 8.2</code></p>
<p><code>"{:.1f}".format(result) #result -> 8.2 I was thinking about adding 0.05 to it and cut for 1 decimal place but I feel like it might affect the other number since it could be any number </code></p>
| [
{
"answer_id": 74132028,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 1,
"selected": true,
"text": "NOW()"
},
{
"answer_id": 74132038,
"author": "Lauri Warsen",
"author_id": 13155009,
"author_profi... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17617414/"
] |
74,131,755 | <p>Lets say I have a table like this;</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>John</td>
</tr>
<tr>
<td>2</td>
<td>Doe</td>
</tr>
<tr>
<td>5</td>
<td>Rose</td>
</tr>
<tr>
<td>11</td>
<td>Michael</td>
</tr>
<tr>
<td>15</td>
<td>Pedro</td>
</tr>
</tbody>
</table>
</div>
<p>and my select query like this;</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>John</td>
</tr>
<tr>
<td>5</td>
<td>Rose</td>
</tr>
</tbody>
</table>
</div>
<p>I want to select next rows according to my query which like this;</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>Doe</td>
</tr>
<tr>
<td>11</td>
<td>Michael</td>
</tr>
</tbody>
</table>
</div>
<p><code>1 John</code>s next row is <code>2 Doe</code> and <code>5 Roes</code>'s next row <code>11 Michael</code></p>
| [
{
"answer_id": 74132028,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 1,
"selected": true,
"text": "NOW()"
},
{
"answer_id": 74132038,
"author": "Lauri Warsen",
"author_id": 13155009,
"author_profi... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12709579/"
] |
74,131,774 | <p>I'm trying to build a LoRaWAN Infrastructure using the Azure IoT Hub. For that I have set up an Azure IoT Edge on a virtual machine.</p>
<p><strong>I want to connect gateways to that IoT Edge</strong>. How can I achieve this?</p>
<p>The infrastructure would look like something like this:</p>
<p><a href="https://i.stack.imgur.com/bSa4y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bSa4y.png" alt="enter image description here" /></a></p>
<p>I don't want to run the IoT Edge Gateway on the gateways directly, as I would need to install docker on a gateway which is performance wise not ideal. Is this even the way it's intended to be used?</p>
| [
{
"answer_id": 74132028,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 1,
"selected": true,
"text": "NOW()"
},
{
"answer_id": 74132038,
"author": "Lauri Warsen",
"author_id": 13155009,
"author_profi... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10065674/"
] |
74,131,787 | <p>I have an array of objects:</p>
<pre><code>const data = [
{id: 1, date: {month: {value: 6, label: "June"}, year: {value: 2022, label: "2022"}},
{id: 2, date: {month: {value: 7, label: "July"}, year: {value: 2022, label: "2022"}}
]
</code></pre>
<p>I need to map over the array and combine the values for the date so it would look like this:</p>
<pre><code>const data = [
{id: 1, date: "June, 2022"},
{id: 2, date: "July, 2022"}
]
</code></pre>
<p>I would like to use Ramda. I can map over the array, however, I am not sure how to combine nested objects and make it a string.</p>
| [
{
"answer_id": 74132499,
"author": "Ori Drori",
"author_id": 5157454,
"author_profile": "https://Stackoverflow.com/users/5157454",
"pm_score": 0,
"selected": false,
"text": "date"
},
{
"answer_id": 74132560,
"author": "Fishamble",
"author_id": 19610921,
"author_profil... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16856744/"
] |
74,131,790 | <p>I'm using XGBoost model to predict attacks, But I get 100% accuracy, I tried Random Forest as well, and same, I get 100%. How can I handle this ovrefitting problem ?
The steps I followed are:
Data cleaning
Data splitting
Feature scaling
Feature selection
I even tried to change this order, but still get the same thing.
Do you have any idea how to handle this? Thanks</p>
| [
{
"answer_id": 74137385,
"author": "biihu",
"author_id": 12149833,
"author_profile": "https://Stackoverflow.com/users/12149833",
"pm_score": 2,
"selected": true,
"text": "param = {\n 'eta': 0.1, \n 'max_depth': 1, \n 'objective': 'multi:softprob', \n 'num_class': 3} \n\nste... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12149833/"
] |
74,131,808 | <p>Given the following 2 states as an example:</p>
<ul>
<li><code>state_a: 'mode_1' | 'mode_2' | 'mode_3'</code></li>
<li><code>state_b: boolean</code></li>
</ul>
<p><code>state_b</code> can only be <code>false</code> whenever <code>state_a === 'mode_2'</code>, and when <code>state_a !== 'mode_2</code>', <code>state_b</code> should return to the previous value (i.e. it's limits opened up. For example, if it was <code>true -> false (limited) -> true</code> or <code>false -> false (limited) -> false</code>).</p>
<p>What's the usual practice/style to define such a behavior in Redux?</p>
| [
{
"answer_id": 74135475,
"author": "Drew Reese",
"author_id": 8690857,
"author_profile": "https://Stackoverflow.com/users/8690857",
"pm_score": 1,
"selected": false,
"text": "state_b"
},
{
"answer_id": 74135483,
"author": "slideshowp2",
"author_id": 6463558,
"author_p... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/977819/"
] |
74,131,826 | <p>I'm working on the Leetcode problem <a href="https://leetcode.com/problems/balanced-binary-tree/" rel="nofollow noreferrer">110. Balanced Binary Tree</a> and I'm confused on how the subtree values are getting populated when doing recursion. After looking at a few solutions, here's the code I have in Javascript:</p>
<pre><code>/**
* Definition for a binary tree node.
* function TreeNode(val, left, right) {
* this.val = (val===undefined ? 0 : val)
* this.left = (left===undefined ? null : left)
* this.right = (right===undefined ? null : right)
* }
*/
/**
* @param {TreeNode} root
* @return {boolean}
*/
var isBalanced = function(root) {
return treeHeight(root) !== -1;
};
function treeHeight(root){
if(!root) return 0;
const leftSubTree = treeHeight(root.left);
const rightSubTree = treeHeight(root.right);
if(leftSubTree === -1 || rightSubTree === -1) return -1; // how can recursion lead to either subtree being -1? At this point I don't know how this can be true other than "that's just how recursion works"
if(Math.abs(leftSubTree - rightSubTree) > 1) return -1; // how are the values of either subtree even obtained here?
return Math.max(leftSubTree, rightSubTree) + 1; // same as the previous question. how do either subtree even get values?
}
</code></pre>
<p>I'm trying to understand the following lines:</p>
<pre><code> if(leftSubTree === -1 || rightSubTree === -1) return -1; // how can recursion lead to either subtree being -1? At this point I don't know how this can be true other than "that's just how recursion works"
if(Math.abs(leftSubTree - rightSubTree) > 1) return -1; // how are the values of either subtree even obtained here?
return Math.max(leftSubTree, rightSubTree) + 1; // same as the previous question. how do either subtree even get values?
</code></pre>
<p>I get that the recursion will traverse down the tree on the left side and the rightside. I don't get how through recursion, the subtrees values are getting computed. Can someone explain it please?</p>
| [
{
"answer_id": 74131994,
"author": "IT goldman",
"author_id": 3807365,
"author_profile": "https://Stackoverflow.com/users/3807365",
"pm_score": 0,
"selected": false,
"text": "+1"
},
{
"answer_id": 74132001,
"author": "trincot",
"author_id": 5459839,
"author_profile": ... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4701396/"
] |
74,131,846 | <p>I need to build a C++ program with CMake but it cannot find Boost.</p>
<p>I'm getting the following error no matter what solutions I've found online for other people with this problem...</p>
<pre><code>-- Compiling with C++ standard: 17
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Boost (missing: Boost_INCLUDE_DIR) (Required is at least
version "1.68.0")
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.22/Modules/FindBoost.cmake:2360 (find_package_handle_standard_args)
CMakeLists.txt:49 (find_package)
</code></pre>
<p>This is the part of my CMakeLists.txt looking for Boost</p>
<pre><code>if(NUMCPP_NO_USE_BOOST)
target_compile_definitions(${ALL_INTERFACE_TARGET} INTERFACE -DNUMCPP_NO_USE_BOOST)
else()
find_package(Boost 1.68.0 REQUIRED)
target_link_libraries(${ALL_INTERFACE_TARGET} INTERFACE Boost::boost)
endif()
</code></pre>
<p>I have installed boost with <code>sudo apt-get install libboost-all-dev</code> and a few other apt-get options. I always see <code>0 upgraded, 0 newly installed, 0 to remove</code> after running.</p>
<p>$ whereis boost
boost: /usr/include/boost</p>
<p>Do I need to specify it in the cmake .. line in the terminal somehow?</p>
| [
{
"answer_id": 74131994,
"author": "IT goldman",
"author_id": 3807365,
"author_profile": "https://Stackoverflow.com/users/3807365",
"pm_score": 0,
"selected": false,
"text": "+1"
},
{
"answer_id": 74132001,
"author": "trincot",
"author_id": 5459839,
"author_profile": ... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5256048/"
] |
74,131,864 | <p>Hey i have a simple function called cont_to_cat that i can not get to work. Basically what i want this function to do is create another column in the dataframe df based on a column called here score_col (the parameter of the function is a string) in the same dataframe df. I want to create this new column(i want to call it 'cat-'+score_col) based on conditions on the other column (first condition if df$score_col<6 new column equals "Rating: 6-" ..)</p>
<pre><code>#dataframe to test
df <- as.data.frame(matrix(runif(n=10, min=0, max=10), nrow=10))
cont_to_cat<-function(df,score_col){
s<-paste('cat_',score_col,sep='')
print(s)
print(df[[score_col]])
df$s <- with(df, ifelse(df$score_col <6,'Rating: 6-',
ifelse(df$score_col >=6 & df$score_col < 7, 'Good: 6+',
ifelse(df$score_col >=7 & df$score_col < 8, 'Very good: 7+',
ifelse(df$score_col >=8 & df$score_col < 9, 'Fabulous: 8+',
ifelse(df$score_col >= 9, 'Superb: 9+','NULL'))))))
return(df)
}
new_df<-cont_to_cat(df,'V1')
</code></pre>
<p>after i run this code i get the error below:
<a href="https://i.stack.imgur.com/0w7GC.png" rel="nofollow noreferrer">enter image description here</a>
(Error in <code>$<-.data.frame</code>(<code>*tmp*</code>, "s", value = logical(0)) :
le tableau de remplacement a 0 lignes, le tableau remplacé en a 10)
This bug got me inactive for a while. I appreciate your help.</p>
| [
{
"answer_id": 74132041,
"author": "Jilber Urbina",
"author_id": 1315767,
"author_profile": "https://Stackoverflow.com/users/1315767",
"pm_score": 1,
"selected": false,
"text": "case_when"
},
{
"answer_id": 74132272,
"author": "thelatemail",
"author_id": 496803,
"auth... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19356322/"
] |
74,131,885 | <p>I have XML that looks basically like this:</p>
<pre><code><course>
<class>
<person>
<name>bob</name>
<age>19</age>
</person>
<person>
<name>john</name>
<age>18</age>
<person>
</class>
<class>
<person>
<name>jane</name>
<age>19</age>
</person>
<person>
<name>greg</name>
<age>20</age>
</person>
</class>
</course>
</code></pre>
<p>I also have all their grades, and because of the way my original data is set up, the easiest way for me to add all their grades is actually to add them via XSLT. So, I have XSLT that looks like this:</p>
<pre><code> <xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="course/class/person[1]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:copy-of select="node()"/>
<grade>A</grade>
</xsl:copy>
</xsl:template>
<xsl:template match="course/class/person[2]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:copy-of select="node()"/>
<grade>B</grade>
</xsl:copy>
</xsl:template>
</code></pre>
<p>This code works great to add all of the grades for <code>class[1]</code>, but I would like to use it to add <code>class[2]</code> (and 3 and 4 and so on) while keeping the <code>person</code> numbering consecutive, even across <code>class</code> elements. So, while Jane is actually <code>class[2]/person[1]</code>, I just want her to be <code>person[3]</code>. Is that possible at all?</p>
| [
{
"answer_id": 74131956,
"author": "Martin Honnen",
"author_id": 252228,
"author_profile": "https://Stackoverflow.com/users/252228",
"pm_score": 2,
"selected": true,
"text": "<xsl:template match=\"(//person)[3]\">"
},
{
"answer_id": 74132985,
"author": "Michael Kay",
"aut... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16979563/"
] |
74,131,907 | <p>Let's say I have a class called <code>RandomObject</code>:</p>
<pre><code>public class RandomObject implements Comparable<RandomObject> {
private String name;
private int value;
public RandomObject(String name, int value) {
this.name = name;
this.value = value;
}
.
.
.
public int compareTo(RandomObject rn) {
return Integer.compare(value, rn.value);
}
</code></pre>
<p>And this array of <code>RandomObject</code>s (each one of them holding a random int value that will be used for comparison purposes):</p>
<pre><code>RandomObject[] arr = new RandomObject[10];
for (int i = 0; i < arr.length; ++i) {
arr[i] = new RandomObject(" ", (int) (Math.random() * 50));
}
</code></pre>
<p>I also have a class called <code>Quicksort</code> containing the following sort methods:</p>
<pre><code>public static <T extends Comparable<? super T>> void sort(T[] a) {
sort(a, 0, a.length - 1);
}
public static <T extends Comparable<? super T>> void sort(T[] a, int start, int end) {
int left = start, right = end;
T pivot = a[(left + right) / 2];
do {
while (a[left].compareTo(pivot) < 0) {
left++;
}
while (a[right].compareTo(pivot) > 0) {
right--;
}
if (left <= right) {
T temp = a[left];
a[left++] = a[right];
a[right--] = temp;
}
} while (left <= right);
if (start < right) {
sort(a, start, right);
}
if (left < end) {
sort(a, left, end);
}
}
</code></pre>
<p>Calling <code>Quicksort.sort(arr)</code> works normally and sorts <code>arr</code> by value.</p>
<p>However, I also have a <code>BinarySearch</code> class with the following <code>search</code> method:</p>
<pre><code>public static <T extends Comparable<? super T>> int search(T[] a, T value) {
int start = 0, end = a.length - 1;
do {
int mid = start + (end - start) / 2;
if (a[mid].compareTo(value) == 0) {
return mid;
} else if (a[mid].compareTo(value) > 0) {
end = mid;
} else {
start = mid + 1;
}
} while (start < end);
return -1;
}
</code></pre>
<p>And when I try to perform a search like this:</p>
<pre><code>Integer x = 2;
System.out.println("Trying to find x: " + BinarySearch.search(arr, x));
</code></pre>
<p>Something goes wrong:</p>
<blockquote>
<p>"java: method search in class br.com.algorithms.BinarySearch cannot be applied to given types;<br>
required: T[],T<br>
found: br.com.algorithms.RandomObject[],java.lang.Integer<br>
reason: inference variable T has incompatible bounds<br>
lower bounds: br.com.algorithms.RandomObject,java.lang.Integer,java.lang.Comparable<? super T><br>
lower bounds: java.lang.Integer,br.com.algorithms.RandomObject"<br></p>
</blockquote>
<p><a href="https://i.stack.imgur.com/zlfUr.png" rel="nofollow noreferrer">no instance(s) of type variable(s) exist so that RandomObject conforms to an Integer</a></p>
<p>I'm struggling to understand why the <code>sort</code> method works while the <code>search</code> one doesn't in this case. If both methods require <code>T[]</code> and I am providing <code>RandomObject[]</code> for both cases, why isn't search compiling? What's exactly the difference here?</p>
| [
{
"answer_id": 74131962,
"author": "Louis Wasserman",
"author_id": 869736,
"author_profile": "https://Stackoverflow.com/users/869736",
"pm_score": 1,
"selected": false,
"text": "T[]"
},
{
"answer_id": 74132109,
"author": "Sweeper",
"author_id": 5133585,
"author_profil... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19529989/"
] |
74,131,919 | <p>I've noticed many apps have settings pages which have controls which behave like buttons, but don't look like buttons.</p>
<p>Anyone know what type of controls these are?</p>
<p>Specifically the one I am tapping on in the linked video file below:</p>
<p><a href="https://drive.google.com/file/d/1leWuXqCirSRnsLFaRFyQmLQRvBLFAXu4/view?usp=drivesdk" rel="nofollow noreferrer">Video example</a>.</p>
| [
{
"answer_id": 74131962,
"author": "Louis Wasserman",
"author_id": 869736,
"author_profile": "https://Stackoverflow.com/users/869736",
"pm_score": 1,
"selected": false,
"text": "T[]"
},
{
"answer_id": 74132109,
"author": "Sweeper",
"author_id": 5133585,
"author_profil... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/364312/"
] |
74,131,922 | <p>I have a list of dictionaries and would like to get the earliest date value (and date only!) from the list. See example below:</p>
<pre><code>{'taps': [{'duration': 0,
'datetime': '2022-06-05T09:35:56.131498'},
{'duratin': 518,
'datetime': '2022-06-05T09:35:56.649846',
{'duration': 500,
'datetime': '2022-06-06T09:35:57.150820'}]}
</code></pre>
<p>From the example above, I want to get 2022-06-05.</p>
| [
{
"answer_id": 74131962,
"author": "Louis Wasserman",
"author_id": 869736,
"author_profile": "https://Stackoverflow.com/users/869736",
"pm_score": 1,
"selected": false,
"text": "T[]"
},
{
"answer_id": 74132109,
"author": "Sweeper",
"author_id": 5133585,
"author_profil... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7991624/"
] |
74,131,924 | <p>Basically, I was trying to recreate IconLabel with some of my own classes in QML. However, it worked, in a limited sense:</p>
<pre class="lang-json prettyprint-override"><code>import QtQuick 2.15
import QtQuick.Controls.Material 2.15
import QtQuick.Layouts 1.15
Item {
id: root
property int spacing: 8
property string direction: "left"
property string icon: ""
property bool is_img: false
property int icon_size: 24
property int font_size: 14
property string text: ""
property string font: "Roboto"
property color color: "black"
property color icon_color: "black"
property color text_color: "black"
Component.onCompleted: {
var cmd = `
import QtQuick 2.15
import QtQuick.Controls.Material 2.15
import QtQuick.Layouts 1.15
`;
var isHorizontal = direction === "left" || direction === "right";
var alignmentCmd = `Layout.alignment: ${isHorizontal ? "Qt.AlignVCenter" : "Qt.AlignHCenter"}`;
var iconCmd = "";
if (icon_color === "black")
icon_color = color;
if (text_color === "black")
text_color = color;
if (root.icon !== "") {
if (is_img) {
iconCmd = `MImage {
source: "${icon}"
Layout.alignment: ${isHorizontal ? "Qt.AlignVCenter" : "Qt.AlignHCenter"}
Layout.fillWidth: true
Layout.fillHeight: true
fillMode: Image.PreserveAspectCrop
width: ${icon_size}
height: ${icon_size}
}`;
} else {
iconCmd = `MIcon {
icon: root.icon
color: root.icon_color
${alignmentCmd}
width: ${icon_size}
height: ${icon_size}
}`;
}
}
var textCmd = `
Text {
text: root.text
font.pixelSize: root.font_size
font.family: root.font
color: root.text_color
${alignmentCmd}
}
`;
var componentCmd = direction === "left" || direction === "top" ? iconCmd + textCmd : textCmd + iconCmd;
cmd += `
${isHorizontal ? "RowLayout" : "ColumnLayout"} {
spacing: ${isHorizontal ? "root.spacing" : "0"}
${componentCmd}
}`;
Qt.createQmlObject(cmd, root, "dynamicComponent");
}
}
</code></pre>
<p>It does do everything that I want if I used it alone, like
<a href="https://i.stack.imgur.com/g7w34.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/g7w34.png" alt="Shown a MWE" /></a></p>
<pre class="lang-json prettyprint-override"><code>import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Dialogs
import QtQuick.Controls.Material 2.15
import "components"
ApplicationWindow {
id: root
visible: true
width: 640
height: 480
title: qsTr("Hello World")
MIconLabel {
icon_color: Material.color(Material.Red, Material.Shade500)
direction: "right"
icon: "home"
text: "Home"
}
MIconLabel {
icon_color: "black"
icon: "menu"
text: "Menu"
y: 100
}
}
</code></pre>
<p>But for some reason, it rejects to cooperate with RowLayout or anything of this nature.</p>
<p><a href="https://i.stack.imgur.com/GJ7nj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GJ7nj.png" alt="Failure Case" /></a></p>
<pre class="lang-json prettyprint-override"><code>import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Dialogs
import QtQuick.Controls.Material 2.15
import "components"
ApplicationWindow {
id: root
visible: true
width: 640
height: 480
title: qsTr("Hello World")
ColumnLayout {
MIconLabel {
icon_color: Material.color(Material.Red, Material.Shade500)
direction: "right"
icon: "home"
text: "Home"
}
MIconLabel {
icon_color: "black"
icon: "menu"
text: "Menu"
}
}
}
</code></pre>
<p>Hence, I ask if there is some way that I can make the parent detect the newly created objects (like refresh or remeasure methods?). I tried to resize the window in hope of repainting the event, but nothing good happens. I also used <code>console.log</code> at the end of the initialization method to print out the dimension of the newly created object, and the dimension of the root object, and the following expression evaluates to <code>True</code>: <code>root.width == object.width == root.childrenRect.width</code> and <code>root.height == object.height == root.childrenRect.height</code>.</p>
<p>Just to explain some details here: <code>MIcon</code> is a wrapper of <code>Text</code> class with the <code>font.family</code> pre-declared as <code>Material Icons</code>. And <code>MImage</code> is basically an wrapper around Image with rounded corners and a placeholder, if no image is provided.</p>
| [
{
"answer_id": 74132686,
"author": "Stephen Quan",
"author_id": 881441,
"author_profile": "https://Stackoverflow.com/users/881441",
"pm_score": 2,
"selected": true,
"text": "icon.source"
},
{
"answer_id": 74133143,
"author": "Yubo",
"author_id": 17110656,
"author_prof... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17110656/"
] |
74,131,949 | <p>I am aware that training a spaCy model (say, Named Entity Recognition), requires <a href="https://spacy.io/usage/training#quickstart" rel="nofollow noreferrer">running some commands from CLI</a>. However, because I need to train a spaCy model inside a <a href="https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/pipelines/lightweight_functions_component_io_kfp.ipynb" rel="nofollow noreferrer">Vertex AI Pipeline Component</a> (which can be simply considered as a <em>"Pure Python script"</em>), training a spaCy model from CLI IS NOT an option for my use case. My current attempt looks like this:</p>
<pre class="lang-py prettyprint-override"><code>
#train.py
# IMPORTANT: Assume all the necessary files are already available in the same directory than this script
import spacy
import subprocess
subprocess.run(["python", "-m", "spacy", "init", "fill-config", "base_config.cfg", "config.cfg"])
subprocess.run(["python", "-m", "spacy", "train", "config.cfg",
"--output", "my_model",
"--paths.train", "train.spacy",
"--paths.dev", "dev.spacy"])
</code></pre>
<p>Which allows me to carry-on with the training (however not being quite stable at times). But I don't know if this is the best implementation, or there is something better or more recommended (once again, NOT involving CLI).</p>
<p><strong>IMPORTANT:</strong> As a Python script, if I run it via <code>python train.py</code>, it should run without a problem.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 74132686,
"author": "Stephen Quan",
"author_id": 881441,
"author_profile": "https://Stackoverflow.com/users/881441",
"pm_score": 2,
"selected": true,
"text": "icon.source"
},
{
"answer_id": 74133143,
"author": "Yubo",
"author_id": 17110656,
"author_prof... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74131949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16706763/"
] |
74,132,008 | <p>I am working on an Azure Functions app in Visual Studio 2022. I have two functions that use EventGridTrigger and am expecting a blob notification when an item is added/changed to blob storage.</p>
<p>I have the Azurite storage emulator running and can upload a file, I am trying to work out if it is possible to have it trigger an event (file added/updated etc.)</p>
<p>I have the AzureEventGridSimulator configured - however, it is looking like I may have to manually trigger an event.</p>
<p>Does anyone know if Azurite can be used fire event grid events?</p>
<p>Regards
Andy</p>
| [
{
"answer_id": 74132686,
"author": "Stephen Quan",
"author_id": 881441,
"author_profile": "https://Stackoverflow.com/users/881441",
"pm_score": 2,
"selected": true,
"text": "icon.source"
},
{
"answer_id": 74133143,
"author": "Yubo",
"author_id": 17110656,
"author_prof... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9388510/"
] |
74,132,051 | <p>I want to get the raw function pointer from an <code>std::function</code> that has been assigned a lambda expression.</p>
<p>When <code>std::function</code> is assigned a regular function, this works as expected:</p>
<pre><code>#include <functional>
#include <iostream>
bool my_function(int x) {}
using my_type = bool(*)(int);
int main() {
std::function f = my_function;
auto pointer = f.target<my_type>();
// Prints 1
std::cout << (pointer != nullptr) << std::endl;
return 0;
}
</code></pre>
<p>However, when I change this example to use a lambda, it does not work:</p>
<pre><code>#include <functional>
#include <iostream>
using my_type = bool(*)(int);
int main() {
std::function f = [](int) -> bool {};
auto pointer = f.target<my_type>();
// Prints 0
std::cout << (pointer != nullptr) << std::endl;
return 0;
}
</code></pre>
<p>Why does the second example print 0 and how could it be fixed to print 1?</p>
| [
{
"answer_id": 74132712,
"author": "user18533375",
"author_id": 18533375,
"author_profile": "https://Stackoverflow.com/users/18533375",
"pm_score": 2,
"selected": false,
"text": "#include <functional>\n#include <iostream>\n\nint main() {\n auto lambda = [](int x) -> bool { return x !=... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10992173/"
] |
74,132,063 | <p>I have this:</p>
<pre><code>let mp = {
transaction_amount: Number(data.amount_total),
description: 'signature',
payment_method_id: paymentType,
}
if (paymentType !== 'credit_card') {
mp.token = data.token
}
</code></pre>
<p>but typescript is saying token doesnt exist on type mp, how can I add the key 'token' there with its value?</p>
| [
{
"answer_id": 74132712,
"author": "user18533375",
"author_id": 18533375,
"author_profile": "https://Stackoverflow.com/users/18533375",
"pm_score": 2,
"selected": false,
"text": "#include <functional>\n#include <iostream>\n\nint main() {\n auto lambda = [](int x) -> bool { return x !=... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17993881/"
] |
74,132,116 | <p>I'm currently writing a bash script and struggling with something that looked fairly simple at first.</p>
<p>I'm trying to create a function that calls a <code>kubectl</code> (Kubernetes) command. The command is expecting the path to a file as an argument although I'd like to pass the content itself (multiline YAML text). It works in the shell but can't make it work in my function. I've tried many things and the latest looks like that (it's just a subset of the the YAML content):</p>
<pre><code>#!/bin/bash
AGENT_NAME="default"
deploy_agent_statefulset() {
kubectl apply -n default -f - $(cat <<- END
kind: ConfigMap
metadata:
name: $AGENT_NAME
apiVersion: v1
data:
agent.yaml: |
metrics:
wal_directory: /var/lib/agent/wal
END
)
}
deploy_agent_statefulset
</code></pre>
<p>The initial command that works in the shell is the following.</p>
<pre><code>cat <<'EOF' | NAMESPACE=default /bin/sh -c 'kubectl apply -n $NAMESPACE -f -'
kind: ConfigMap
...
</code></pre>
<p>I'm sure I m doing a lot of things wrong - keen to get some help</p>
<p>Thank you.
name: grafana-agent</p>
| [
{
"answer_id": 74132530,
"author": "Philippe",
"author_id": 2125671,
"author_profile": "https://Stackoverflow.com/users/2125671",
"pm_score": 3,
"selected": true,
"text": "#!/bin/bash\n\nAGENT_NAME=\"default\"\n\ndeploy_agent_statefulset() {\n kubectl apply -n default -f - <<END\nkind:... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1878421/"
] |
74,132,130 | <p>I’m new to computer science and really stuck on this question so any help would be great :).</p>
<p>Firstly I was given the following global variable:</p>
<pre><code> ARROWS = ‘<>^v’
</code></pre>
<p>The idea is to create a function that takes in a string and an integer (n). The function should then replace the first n number of characters with ‘X’. So far this is easy, however, the problem is that the characters should ONLY be replaced if it is a part of the global variable ARROWS. If it isn’t, it should not be modified but still counts as one of the n numbers. The following exemplifies what needs to be done:</p>
<pre><code> >>>function(‘>>.<>>...’, 4)
‘XX.X>>...’
>>>function(‘>..>..>’, 6)
‘X..X..>’
>>>function(‘..>>>.’, 2)
‘..>>>.’
</code></pre>
<p>Please help :)</p>
| [
{
"answer_id": 74132214,
"author": "figbar",
"author_id": 8189599,
"author_profile": "https://Stackoverflow.com/users/8189599",
"pm_score": 0,
"selected": false,
"text": "re"
},
{
"answer_id": 74132217,
"author": "Barmar",
"author_id": 1491895,
"author_profile": "http... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20115402/"
] |
74,132,152 | <p>I have a dictionary like the following:</p>
<pre><code>original = {"Triclusters":{"0":{"%Missings":"0","ColumnPattern":"Constant","Data":
{"0":[["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]
,["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72",
"-1.72"]],
"1":[["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]
,["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]],
"2":[["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]
,["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]]},
"#contexts":3,"PlaidCoherency":"No Overlapping","%Errors":"0","%Noise":"0",
"X":[0,2,3,4],"ContextPattern":"Constant","Y":[0,2,6,7],
"RowPattern":"Constant","Z":[0,1,2],"#rows":4,"#columns":4},
"1":{"%Missings":"0","ColumnPattern":"None","Data":{"0":[["-3.52","-9.34","-9.04","-2.56"],
["-3.52","-9.34","-9.04","-2.56"]
,["-3.52","-9.34","-9.04","-2.56"]
,["-3.52","-9.34","-9.04","-2.56"]],
"1":[["7.04","-2.13","2.04","5.09"],
["7.04","-2.13","2.04","5.09"],
["7.04","-2.13","2.04","5.09"],
["7.04","-2.13","2.04","5.09"]],
"2":[["2.17","5.93","-5.47","-8.74"],
["2.17","5.93","-5.47","-8.74"],
["2.17","5.93","-5.47","-8.74"],
["2.17","5.93","-5.47","-8.74"]]},
"#contexts":3,"PlaidCoherency":"No Overlapping","%Errors":"0","%Noise":"0",
"X":[0,1,2,3],"ContextPattern":"None","Y":[1,3,4,9],"RowPattern":"Constant",
"Z":[0,1,2],"#rows":4,"#columns":4}},"#DatasetMinValue":-10,"#DatasetColumns":10,
"#DatasetContexts":3,"#DatasetMaxValue":10,"#DatasetRows":5}
</code></pre>
<p>and I want to obtain a dictionary like this:</p>
<pre><code>new_dictionary = {"0":{"0":[["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]
,["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]],
"1":[["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]
,["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]],
"2":[["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]
,["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]]},
"1":{"0":[["-3.52","-9.34","-9.04","-2.56"],["-3.52","-9.34","-9.04","-2.56"],
["-3.52","-9.34","-9.04","-2.56"],["-3.52","-9.34","-9.04","-2.56"]],
"1":[["7.04","-2.13","2.04","5.09"],["7.04","-2.13","2.04","5.09"],
["7.04","-2.13","2.04","5.09"],["7.04","-2.13","2.04","5.09"]],
"2":[["2.17","5.93","-5.47","-8.74"],["2.17","5.93","-5.47","-8.74"],
["2.17","5.93","-5.47","-8.74"],["2.17","5.93","-5.47","-8.74"]]}}`
</code></pre>
<p>I don't have much experience on how to subset nested dictionaries, how can I do it?</p>
| [
{
"answer_id": 74132214,
"author": "figbar",
"author_id": 8189599,
"author_profile": "https://Stackoverflow.com/users/8189599",
"pm_score": 0,
"selected": false,
"text": "re"
},
{
"answer_id": 74132217,
"author": "Barmar",
"author_id": 1491895,
"author_profile": "http... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20115298/"
] |
74,132,155 | <p>i have this problem at line snapshot.value</p>
<pre><code> @override
void initState() {
super.initState();
databaseReference
.child('ESP32_Device')
.once()
.then((DatabaseEvent snapshot) {
double temp = snapshot.value['Temperature']['Data'];
double humidity = snapshot.value['Humidity']['Data'];
isLoading = true;
_DashboardInit(temp, humidity);
});
}
</code></pre>
<p>photo of problem</p>
<p><a href="https://i.stack.imgur.com/4UwrX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4UwrX.png" alt="" /></a></p>
| [
{
"answer_id": 74132214,
"author": "figbar",
"author_id": 8189599,
"author_profile": "https://Stackoverflow.com/users/8189599",
"pm_score": 0,
"selected": false,
"text": "re"
},
{
"answer_id": 74132217,
"author": "Barmar",
"author_id": 1491895,
"author_profile": "http... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132155",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20285587/"
] |
74,132,175 | <p>I use gitlab to do continuous integration (I'm on windows).</p>
<p>When I push my react project I get an error:</p>
<blockquote>
<p>Treating warnings as errors because process.env.CI = true. Most CI
servers set it automatically.</p>
</blockquote>
<p>I tried to:</p>
<ul>
<li>add an environment variable CI = false or CI = "" in gitlab environnement variable.</li>
<li>add variables CI = false or CI = "" in gitlab-ci.yml</li>
<li>add environment = ["CI="] in config.toml</li>
<li>add environment variable in windows directly CI -> ""</li>
</ul>
<p>but still got the error.</p>
<p>How to do please?</p>
<p><strong>Update 2022-10-20 10:03</strong></p>
<p>I'm building on a remote server</p>
<p>package.json</p>
<pre><code>scripts": {
"startapp": "lerna run start --scope=app",
"startpdf": "lerna run start --scope=pdfserver",
"start": "lerna run start",
"bootstrap": "npx lerna bootstrap --hoist",
"build": "lerna run build",
"buildapp": "lerna run build --scope=app",
"buildpdf": "lerna run build --scope=pdfserver",
"serveapp": "lerna run serve",
"publish": "npm run bootstrap && npm run build && npm run serveapp"
</code></pre>
<p>}</p>
<p>gitlab-ci.yml</p>
<pre><code> stages:
- build
buildTest:
stage: build
tags:
- app-test
script:
- cp -r -fo "packages\app\.env.test" "packages\app\.env"
- npm run bootstrap
- npm run build
- npm run startpdf
only:
- dev
</code></pre>
<p>config.toml</p>
<pre><code> [[runners]]
name = "app-test"
url = "https://gitlab.com/"
id = xxx
token = "xxx"
token_obtained_at = xxx
token_expires_at = xxx
executor = "shell"
shell = "powershell"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
</code></pre>
<p>Thanks.</p>
| [
{
"answer_id": 74132214,
"author": "figbar",
"author_id": 8189599,
"author_profile": "https://Stackoverflow.com/users/8189599",
"pm_score": 0,
"selected": false,
"text": "re"
},
{
"answer_id": 74132217,
"author": "Barmar",
"author_id": 1491895,
"author_profile": "http... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4827931/"
] |
74,132,180 | <p>I want to make histogram of a column in my dataset using python that looks similar like this which I got from excel, I would like to have an overflow bin as in this picture below:</p>
<p><a href="https://i.stack.imgur.com/E9CM3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/E9CM3.png" alt="enter image description here" /></a></p>
<p>Thanks</p>
| [
{
"answer_id": 74132214,
"author": "figbar",
"author_id": 8189599,
"author_profile": "https://Stackoverflow.com/users/8189599",
"pm_score": 0,
"selected": false,
"text": "re"
},
{
"answer_id": 74132217,
"author": "Barmar",
"author_id": 1491895,
"author_profile": "http... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20160998/"
] |
74,132,182 | <p>Setup:</p>
<p>Below is a section of code that generates a table of sample names in an unusual set of formats. The task is to convert them into a standard format. The also list the desired result for each name so there is no confusion on the request.</p>
<pre><code>DROP TABLE IF EXISTS #temp;
CREATE TABLE #temp (Testname VARCHAR(20) null, Desiredresult VARCHAR(20) null);
INSERT INTO #temp(Testname, Desiredresult)
VALUES('ct last/firstn bc', 'Firstn Last');
INSERT INTO #temp(Testname, Desiredresult)
VALUES('ct lastn/first', 'First Lastn');
INSERT INTO #temp(Testname, Desiredresult)
VALUES('last/firstname bs', 'Firstname Last');
INSERT INTO #temp(Testname, Desiredresult)
VALUES('lastname/first', 'First Lastname');
INSERT INTO #temp(Testname, Desiredresult)
VALUES('First Last', 'First Last');
INSERT INTO #temp(Testname, Desiredresult)
VALUES('Firstname A Lastname', 'Firstname Lastname');
</code></pre>
<p>I was able to generate code that works for this but I have no doubt it is not the most efficient method of doing this. I am curious to know a better approach to this task. Below is the code I wrote for this.</p>
<pre><code>DROP TABLE IF EXISTS #test
SELECT *
,CASE
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 2 AND CHARINDEX('/',T.Testname) <> 0 THEN SUBSTRING(T.Testname,CHARINDEX('/',T.Testname)+1,LEN(T.Testname)-CHARINDEX('/',T.Testname)+1-CHARINDEX(' ',REVERSE(T.Testname))-1)
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 2 AND CHARINDEX('/',T.Testname) = 0 THEN LEFT(T.Testname,CHARINDEX(' ',T.Testname)-1)
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 1 AND CHARINDEX('/',T.Testname) <> 0 AND CHARINDEX(' ',T.Testname) < CHARINDEX('/',T.TestName) THEN SUBSTRING(T.Testname,CHARINDEX('/',T.Testname)+1,LEN(T.Testname))
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 1 AND CHARINDEX('/',T.Testname) <> 0 AND CHARINDEX(' ',T.Testname) > CHARINDEX('/',T.TestName)THEN SUBSTRING(T.Testname,CHARINDEX('/',T.Testname)+1,CHARINDEX(' ',T.Testname)-CHARINDEX('/',T.Testname)-1)
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 1 AND CHARINDEX('/',T.Testname) = 0 THEN LEFT(T.Testname,CHARINDEX(' ',T.Testname)-1)
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 0 THEN SUBSTRING(T.Testname,CHARINDEX('/',T.Testname)+1,LEN(T.Testname))
END AS FirstName
,CASE
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 2 AND CHARINDEX('/',T.Testname) <> 0 THEN SUBSTRING(T.Testname,CHARINDEX(' ',T.Testname)+1,CHARINDEX('/',T.Testname)-CHARINDEX(' ',T.Testname)-1)
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 2 AND CHARINDEX('/',T.Testname) = 0 THEN RIGHT(T.Testname,CHARINDEX(' ',REVERSE(T.Testname))-1)
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 1 AND CHARINDEX('/',T.Testname) <> 0 AND CHARINDEX(' ',T.Testname) < CHARINDEX('/',T.TestName) THEN SUBSTRING(T.Testname,CHARINDEX(' ',T.Testname)+1,CHARINDEX('/',T.Testname)-CHARINDEX(' ',T.Testname)-1)
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 1 AND CHARINDEX('/',T.Testname) <> 0 AND CHARINDEX(' ',T.Testname) > CHARINDEX('/',T.TestName)THEN SUBSTRING(T.Testname,1,CHARINDEX('/',T.Testname)-1)
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 1 AND CHARINDEX('/',T.Testname) = 0 THEN RIGHT(T.Testname,CHARINDEX(' ',REVERSE(T.Testname))-1)
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 0 THEN SUBSTRING(T.Testname,1,CHARINDEX('/',T.Testname)-1)
END AS LastName
,CASE
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 2 AND CHARINDEX('/',T.Testname) <> 0 THEN SUBSTRING(T.Testname,CHARINDEX('/',T.Testname)+1,LEN(T.Testname)-CHARINDEX('/',T.Testname)+1-CHARINDEX(' ',REVERSE(T.Testname))) + SUBSTRING(T.Testname,CHARINDEX(' ',T.Testname)+1,CHARINDEX('/',T.Testname)-CHARINDEX(' ',T.Testname)-1)
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 2 AND CHARINDEX('/',T.Testname) = 0 THEN LEFT(T.Testname,CHARINDEX(' ',T.Testname)-1) + RIGHT(T.Testname,CHARINDEX(' ',REVERSE(T.Testname)))
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 1 AND CHARINDEX('/',T.Testname) <> 0 AND CHARINDEX(' ',T.Testname) < CHARINDEX('/',T.TestName) THEN SUBSTRING(T.Testname,CHARINDEX('/',T.Testname)+1,LEN(T.Testname)) + ' ' + SUBSTRING(T.Testname,CHARINDEX(' ',T.Testname)+1,CHARINDEX('/',T.Testname)-CHARINDEX(' ',T.Testname)-1)
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 1 AND CHARINDEX('/',T.Testname) <> 0 AND CHARINDEX(' ',T.Testname) > CHARINDEX('/',T.TestName)THEN SUBSTRING(T.Testname,CHARINDEX('/',T.Testname)+1,CHARINDEX(' ',T.Testname)-CHARINDEX('/',T.Testname)-1) + ' ' + SUBSTRING(T.Testname,1,CHARINDEX('/',T.Testname)-1)
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 1 AND CHARINDEX('/',T.Testname) = 0 THEN T.Testname
WHEN LEN(Testname)-LEN(REPLACE(Testname, ' ', '')) = 0 THEN SUBSTRING(T.Testname,CHARINDEX('/',T.Testname)+1,LEN(T.Testname)) + ' ' + SUBSTRING(T.Testname,1,CHARINDEX('/',T.Testname)-1)
END AS FullName
INTO #test
FROM #temp AS T
SELECT
T.Testname
,T.Desiredresult
,UPPER(LEFT(T.FirstName,1))+LOWER(RIGHT(T.FirstName,LEN(T.FirstName)-1))+' '+UPPER(LEFT(T.LastName,1))+LOWER(RIGHT(T.LastName,LEN(T.LastName)-1)) AS ProperName
FROM #test AS T
</code></pre>
| [
{
"answer_id": 74132947,
"author": "John Cappelletti",
"author_id": 1570000,
"author_profile": "https://Stackoverflow.com/users/1570000",
"pm_score": 3,
"selected": true,
"text": "Select A.* \n ,DispName = case when charindex('/',TestName)>0 \n then ltrim(conca... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4083998/"
] |
74,132,187 | <p>I wrote this</p>
<p>hover the animation: <code>animated slideIn</code> doesn't trigger, while the console show notihing</p>
<pre><code>let getAddToCart = document.querySelectorAll('.addToCart');
let getCartBadge = document.querySelector('.cartBadge');
getAddToCart.forEach((item) => {
item.addEventListener('click', function (e) {
e.preventDefault();
console.log('clicked');
// animate the cartBadge
getCartBadge.classList.add('animated', 'slideIn');
// other stuff
});
});
</code></pre>
| [
{
"answer_id": 74132947,
"author": "John Cappelletti",
"author_id": 1570000,
"author_profile": "https://Stackoverflow.com/users/1570000",
"pm_score": 3,
"selected": true,
"text": "Select A.* \n ,DispName = case when charindex('/',TestName)>0 \n then ltrim(conca... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/521466/"
] |
74,132,219 | <p>Goodnight.</p>
<p>I have a project done in Python and Django and today I added one more Model Table and added a column manually and it worked in the development environment.</p>
<p>But when deploying to Heroku , Heroku cannot find this manually created column and returns this error "column does not exist" .</p>
<p>How do I manually add a column to the Heroku database?</p>
| [
{
"answer_id": 74132947,
"author": "John Cappelletti",
"author_id": 1570000,
"author_profile": "https://Stackoverflow.com/users/1570000",
"pm_score": 3,
"selected": true,
"text": "Select A.* \n ,DispName = case when charindex('/',TestName)>0 \n then ltrim(conca... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18487284/"
] |
74,132,221 | <p>I was trying to make my google sheets document automatically sort on date (ascending). When I run the code by myself, it works but the onEdit function which would make it automatic, doesn't work.</p>
<p>I followed this Youtube video and changed the values to my document: <a href="https://www.youtube.com/watch?v=3EUI_PgxarA" rel="nofollow noreferrer">https://www.youtube.com/watch?v=3EUI_PgxarA</a> . A couple of days ago the onEdit function did work and there have been no further changes since.</p>
<p>This is my code:</p>
<pre><code>function autoSort(){
const ss = SpreadsheetApp.getActiveSpreadsheet()
const ws = ss.getSheetByName("Toekomstplanning")
const range = ws.getRange(5,1,ws.getLastRow()-1,6)
range.sort({column: 6, ascending: true})
}
function onEdit(e){
const row = e.range.getRow()
const column = e.range.getColumn()
if(!(column === 6 && row >= 5)) return
autoSort()
}
</code></pre>
| [
{
"answer_id": 74132947,
"author": "John Cappelletti",
"author_id": 1570000,
"author_profile": "https://Stackoverflow.com/users/1570000",
"pm_score": 3,
"selected": true,
"text": "Select A.* \n ,DispName = case when charindex('/',TestName)>0 \n then ltrim(conca... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20286577/"
] |
74,132,248 | <p>I am building a wagtail site. I've followed <a href="https://docs.wagtail.org/en/stable/advanced_topics/customisation/custom_user_models.html" rel="nofollow noreferrer">the instructions found in the docs</a> and my additional fields show up in the edit and create user forms, found at [site url]/admin/users/[user id]. However, I want them to also show up in the account settings page accessed from the bottom left. <a href="https://docs.wagtail.org/en/stable/extending/custom_account_settings.html" rel="nofollow noreferrer">This page</a> seems to describe what I want to do, but I don't understand the instructions it gives.</p>
<p>I have an app named user, and my settings point the AUTH_USER_MODEL to the model User within it. My models.py in this app is as follows</p>
<pre><code>from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
id = models.AutoField(primary_key=True)
bio = models.CharField(blank=True, null=True, max_length=2048)
nickname = models.CharField(blank=True, null=True, max_length=64)
def __str__(self):
"""String representation of this user"""
return self.get_full_name()
</code></pre>
<p>and my forms.py is</p>
<pre><code>from django import forms
from django.utils.translation import gettext_lazy as _
from wagtail.users.forms import UserEditForm, UserCreationForm
class CustomUserEditForm(UserEditForm):
nickname = forms.CharField(required=False, label=_("Nickname"))
bio = forms.CharField(required=False, label=_("Bio"))
class CustomUserCreationForm(UserCreationForm):
nickname = forms.CharField(required=False, label=_("Nickname"))
bio = forms.CharField(required=False, label=_("Bio"))
</code></pre>
<p>From the docs it sounds like I would want to add something like this to that same forms.py:</p>
<pre><code>class CustomSettingsForm(forms.ModelForm):
nickname = forms.CharField(required=False, label=_("Nickname"))
bio = forms.CharField(required=False, label=_("Bio"))
class Meta:
model = django.contrib.auth.get_user_model()
fields = [...]
</code></pre>
<p>and this to the (otherwise empty) hooks.py:</p>
<pre><code>from wagtail.admin.views.account import BaseSettingsPanel
from wagtail import hooks
from .forms import CustomSettingsForm
@hooks.register('register_account_settings_panel')
class CustomSettingsPanel(BaseSettingsPanel):
name = 'custom'
title = "My custom settings"
order = 500
form_class = CustomSettingsForm
form_object = 'user'
</code></pre>
<p>I've tried a lot of variations on this, and I can't get anything to work. Usually I get no new fields in the accounts settings panel, and this error on the edit page:</p>
<pre><code>TypeError at /admin/users/1/ sequence item 0: expected str instance, ellipsis found
</code></pre>
<p>All I want to do is allow the user to modify these additional fields from the user settings panel, as not all users will have permissions to edit the user model (as found at /admin/users).</p>
| [
{
"answer_id": 74132947,
"author": "John Cappelletti",
"author_id": 1570000,
"author_profile": "https://Stackoverflow.com/users/1570000",
"pm_score": 3,
"selected": true,
"text": "Select A.* \n ,DispName = case when charindex('/',TestName)>0 \n then ltrim(conca... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20095325/"
] |
74,132,253 | <p>I've been looking into Python and using the record.linkage toolkit for address matching. I've found the string matching algorithms such as levenshtein are returning false matches for very common addresses. Ideally an address with one very unique word matching would be more highly scored than very common words, e.g. "12 Pellican street" and "12 Pellican road" is a better match than "20 Main Street" and "34 Main Street".</p>
<p>Is there a method for incorporating a weighted string matching, so that addresses with more unique words carrying more importance for matching?</p>
| [
{
"answer_id": 74132292,
"author": "Rahul K P",
"author_id": 4407666,
"author_profile": "https://Stackoverflow.com/users/4407666",
"pm_score": 1,
"selected": false,
"text": "fuzzywuzzy"
}
] | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20286483/"
] |
74,132,255 | <p>I'm using <code>tailwindcss</code> with <code>Remix.run</code> and trying to figure out how can I change some primary colors in <code>tailwindcss</code> dynamically from data I get from my server.
I've seen some examples using <code>Next.js</code> framework, but couldn't manage to do that in <code>Remix.run</code>.</p>
| [
{
"answer_id": 74132501,
"author": "Matthieu Riegler",
"author_id": 884123,
"author_profile": "https://Stackoverflow.com/users/884123",
"pm_score": 2,
"selected": false,
"text": "module.exports = {\n theme: {\n colors: {\n // Using modern `rgb`\n primary: 'rgb(var(--color-p... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5458331/"
] |
74,132,279 | <p>I am having trouble understanding an interview question, I am meant to print out the index of the character where it is out of alphabetical order. I do not know how to ascertain the index of a character where it is out of alphabetical order. I wrote the full question below:</p>
<p>Write an algorithm to check if a string is sorted in alphabetical order and print O If it is, if it is not in alphabetical order, then print the index of the character where it is out of alphabetical order.</p>
<pre><code>import java.util.Arrays;
public class ArrayAlphabet {
static boolean isAlphabaticOrder(String s)
{
// length of the string
int n = s.length();
// create a character array
// of the length of the string
char c[] = new char [n];
// assign the string
// to character array
for (int i = 0; i < n; i++) {
c[i] = s.charAt(i);
}
// sort the character array
Arrays.sort(c);
// check if the character array
// is equal to the string or not
for (int i = 0; i < n; i++)
if (c[i] != s.charAt(i))
return false;
return true;
}
}
public class Main extends ArrayAlphabet {
public static void main(String args[]) {
String s = "aadbbbcc";
// check whether the string is
// in alphabetical order or not
if (isAlphabaticOrder(s))
System.out.println("0");
else
System.out.println("No");
}
}
</code></pre>
| [
{
"answer_id": 74132347,
"author": "Jagrut Sharma",
"author_id": 2780480,
"author_profile": "https://Stackoverflow.com/users/2780480",
"pm_score": 1,
"selected": false,
"text": "01234\nacfbg\n\nstart by highest seen = a\n\nindex = 0, char = a, highest seen = a, a < a? no. [highest seen =... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20235627/"
] |
74,132,297 | <p>I have an array object like below</p>
<pre><code>[
{
id: 123,
startdate: '2022-06-05',
enddate: '2023-04-05'
},{
id: 123,
startdate: '2021-06-05',
enddate: '2021-04-05'
}
]
</code></pre>
<p>I have to add a row <code>isHistory</code> based on the condition of startdate if it belongs to current year. Like in the above example, the result should be</p>
<pre><code>[
{
id: 123,
startdate: '2022-06-05',
enddate: '2023-04-05',
isHistory: false
},{
id: 123,
startdate: '2021-06-05',
enddate: '2021-04-05',
isHistory: true
}
]
</code></pre>
<p>How can I acheive this? I am trying to map through the object but how do I compare the startdate on each iteration and add a new row, I am struggling in that.</p>
<p>Any suggestions?</p>
| [
{
"answer_id": 74132378,
"author": "Mohammed Ahmed",
"author_id": 4292093,
"author_profile": "https://Stackoverflow.com/users/4292093",
"pm_score": -1,
"selected": false,
"text": "const arr = [\n {\n id: 1,\n startdate: \"2022-06-05\",\n enddate: \"2023-04-05\"\n },\n {\n ... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10896566/"
] |
74,132,361 | <p>I want to add class "active" to "fav-contractors" container only when number inside "fav-con-count" span is greater than 0.</p>
<p>This is HTML code</p>
<pre><code><span class="fav-contractors">
<span class="fav-con-count">7</span>
</span>
</code></pre>
<p>and this is jQuery code</p>
<pre><code>function favCounter() {
if ($(".fav-con-count").textContent > 0) {
$(".fav-contractors").addClass("active");
}
};
favCounter();
</code></pre>
<p>Which "if" rule should I use? I also tried something like that but it didn't work:</p>
<pre><code>function favCounter() {
var favValue = $(".fav-con-count").textContent;
if (+favValue > 0)) {
$(".fav-contractors").addClass("active");
}
};
favCounter();
</code></pre>
| [
{
"answer_id": 74132397,
"author": "Haim Abeles",
"author_id": 15298697,
"author_profile": "https://Stackoverflow.com/users/15298697",
"pm_score": 0,
"selected": false,
"text": ".text()"
},
{
"answer_id": 74132632,
"author": "Roko C. Buljan",
"author_id": 383904,
"aut... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20286627/"
] |
74,132,364 | <p>I have two functions:</p>
<p><code>job_status</code> is getting a response from boto3 api.</p>
<p><code>jobs_details</code>is a list comprehension that performs <code>job_status</code> on each element of the input list.</p>
<p>I want to change <code>jobs_details</code> into a decorator of <code>jobs_status</code> but below solutions throws <code>inner() takes 1 positional argument but 2 were given</code> error.</p>
<p>Appreciate any comment/alternative approach to my issue. Thanks!</p>
<pre><code>import boto3
class GlueClient:
def __init__(self):
self.glue_client = boto3.client('glue')
#self.envs = envs
def jobs_list(self):
response = self.glue_client.list_jobs()
result = response["JobNames"]
while "NextToken" in response:
response = self.glue_client.list_jobs(NextToken=response["NextToken"])
result.extend(response["JobNames"])
return [e for e in result if "jobs_xyz" in e]
#WHAT IS CURRENTLY
def job_status(self, job_name):
paginator = self.glue_client.get_paginator('get_job_runs')
response = paginator.paginate(JobName=job_name)
return response
def jobs_details(self, jobs):
return [self.job_status(e) for e in jobs]
#WHAT IS EXPECTED
def pass_by_list_comprehension(func):
def inner(list_of_val):
return [func(value) for value in list_of_val ]
return inner
@pass_by_list_comprehension
def job_status(self, job_name):
paginator = self.glue_client.get_paginator('get_job_runs')
response = paginator.paginate(JobName=job_name)
return response
glue_client = GlueClient()
jobs = glue_client.jobs_list()
jobs_status = glue_client.job_status(jobs)
print(jobs)
</code></pre>
| [
{
"answer_id": 74132582,
"author": "CrazyChucky",
"author_id": 12975140,
"author_profile": "https://Stackoverflow.com/users/12975140",
"pm_score": 2,
"selected": true,
"text": "job_status"
},
{
"answer_id": 74132616,
"author": "juanpa.arrivillaga",
"author_id": 5014455,
... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132364",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7920004/"
] |
74,132,365 | <p>I have a pandas df as below where the scores of two players are tabulated. I want to calculate the <em>sum of each game</em> of each player where each game is scored consecutively. For example the first game played by A has a total score of 12, the second game played by A has a total score of 10, the first game played by B has a total score of 4 etc. How can I do this pandas way (vectorised or groupby etc) please?</p>
<p><code>df_players.groupby("Player").sum("Score")</code>
does only give overall total score and not for each game individually.</p>
<p>Many thanks.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Player</th>
<th>Score</th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
<td>10</td>
</tr>
<tr>
<td>A</td>
<td>2</td>
</tr>
<tr>
<td>B</td>
<td>1</td>
</tr>
<tr>
<td>B</td>
<td>3</td>
</tr>
<tr>
<td>A</td>
<td>3</td>
</tr>
<tr>
<td>A</td>
<td>7</td>
</tr>
<tr>
<td>B</td>
<td>2</td>
</tr>
</tbody>
</table>
</div> | [
{
"answer_id": 74132444,
"author": "scotscotmcc",
"author_id": 15804190,
"author_profile": "https://Stackoverflow.com/users/15804190",
"pm_score": 0,
"selected": false,
"text": "cumsum()"
},
{
"answer_id": 74132640,
"author": "Code Different",
"author_id": 2538939,
"a... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9441039/"
] |
74,132,388 | <p>I am trying to concatenate certain row values (<code>Strings</code>) given varying conditions in R. I have flagged the row values in <code>Flag</code> (the flagging criteria are irrelevant in this example).</p>
<p>Notations: <strong>B</strong> is the beginning of a run and <strong>E</strong> the end. <strong>0</strong> is outside the run. <strong>1</strong> denotes any strings excluding <strong>B</strong> and <strong>E</strong> in the run. Your solution does not need to follow my convention.</p>
<p>Rules: Every run must begin with <strong>B</strong> and ends with <strong>E</strong>. There can be any number of <strong>1</strong> in the run. Any <code>Strings</code> positioned between <strong>B</strong> and <strong>E</strong> (both inclusive) are to be concatenated in the order as they are positioned in the run, and replace the <strong>B</strong>-string. . <strong>0</strong>-string will remain in the dataframe. <strong>1</strong>- and <strong>E</strong>-strings will be removed after concatenation.</p>
<p>I haven't come up with anything close to the desired output.</p>
<pre><code>set.seed(128)
df2 <- data.frame(Strings = sample(letters, 17, replace = T),
Flag = c(0,"B",1,1,"E","B","E","B","E",0,"B",1,1,1,"E",0,0))
Strings Flag
1 d 0
2 r B
3 q 1
4 r 1
5 v E
6 f B
7 y E
8 u B
9 c E
10 x 0
11 h B
12 w 1
13 x 1
14 t 1
15 j E
16 d 0
17 j 0
</code></pre>
<p>Intermediate output.</p>
<pre><code> Strings Flag Result
1 d 0 d
2 r B r q r v
3 q 1 q
4 r 1 r
5 v E v
6 f B f y
7 y E y
8 u B u c
9 c E c
10 x 0 x
11 h B h w x t j
12 w 1 w
13 x 1 x
14 t 1 t
15 j E j
16 d 0 d
17 j 0 j
</code></pre>
<p>Desired output.</p>
<pre><code> Result
1 d
2 r q r v
3 f y
4 u c
5 x
6 h w x t j
7 d
8 j
</code></pre>
| [
{
"answer_id": 74132444,
"author": "scotscotmcc",
"author_id": 15804190,
"author_profile": "https://Stackoverflow.com/users/15804190",
"pm_score": 0,
"selected": false,
"text": "cumsum()"
},
{
"answer_id": 74132640,
"author": "Code Different",
"author_id": 2538939,
"a... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9436275/"
] |
74,132,389 | <p>I am trying to extract url with match.
I'm trying to find the filename after the "/" character.
But url is always variable so i have to start from end</p>
<p><code>123</code>, <code>123.py</code>, <code>123.dat</code></p>
<pre><code>url://xxxxx/yyyyy/123
url://xxxxx/yyyyy/123.py
url://xxxxx/yyyyy/123.dat
</code></pre>
<p>I tried <code>url:match("^.+(%..+)$")</code> but I can't access files that don't start with a <code>.</code>.</p>
| [
{
"answer_id": 74132450,
"author": "Wiktor Stribiżew",
"author_id": 3832970,
"author_profile": "https://Stackoverflow.com/users/3832970",
"pm_score": 1,
"selected": false,
"text": "url:gsub(\".*/\", \"\")\n"
},
{
"answer_id": 74135270,
"author": "LMD",
"author_id": 718531... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19621343/"
] |
74,132,395 | <p>I tried to split string into 3 parts but its not working properly.
i need it to be split by + and - and =.</p>
<pre><code>int main() {
double a, b, c, x, x1, x2, d;
string str, part1, part2, part3, avand, miand, azand;
str = "2+4x-2x^2=0";
size_t count = count_if(str.begin(), str.end(), [](char c) {return c == 'x'; });
if (count == 2) {
int i = 0;
while (str[i] != '+' && str[i] != '-') {
part1 = part1 + str[i];
i++;
}
while (str[i] != '+' && str[i] != '=') {
part2 = part2 + str[i];
i++;
}
i++;
for (i; i < str.length(); i++) {
part3 = part3 + str[i];
}
}
}
</code></pre>
| [
{
"answer_id": 74132458,
"author": "Retep",
"author_id": 15360790,
"author_profile": "https://Stackoverflow.com/users/15360790",
"pm_score": 0,
"selected": false,
"text": "i++;"
},
{
"answer_id": 74132780,
"author": "PaulMcKenzie",
"author_id": 3133316,
"author_profil... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20036903/"
] |
74,132,443 | <p>I wrote a loop that made 10 graphs in R:</p>
<pre><code>library(plotly)
for (i in 1:10)
{
d_i = data.frame(x = rnorm(100,100,100), y = rnorm(100,100,100))
title_i = paste0("title_",i)
p_i = plot_ly(data = d_i, x = ~x, y = ~y) %>% layout(title = title_i)
htmlwidgets::saveWidget(as_widget(p_i), paste0("plot_",i, ".html"))
}
</code></pre>
<p>I have this code (<a href="https://stackoverflow.com/questions/62266111/input-menu-contents-do-not-overflow-row-box-in-flexdashboard">Input menu contents do not overflow row box in flexdashboard</a>) that makes a dashboard in R:</p>
<pre><code>---
title: "Test Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
runtime: shiny
---
```{r setup, include=FALSE}
library(flexdashboard)
library(shiny)
```
Column {data-width=100}
-----------------------------------------------------------------------
### Window 1
```{r}
selectInput("project", label = NULL, choices = c("A","B","C","D"))
```
Column {data-width=400}
-----------------------------------------------------------------------
### Chart B
```{r}
renderPlot({
plot(rnorm(1000), type = "l", main = paste("Project:",input$project, " Data:", input$data))
})
```
</code></pre>
<p><strong>I would like to adapt this code so that the drop down menu allows the user to load the previously created graph/html file (e.g. from "My Documents") that is being searched for.</strong> For example, if the user searches for "plot_7", then plot_7 is displayed.</p>
<p>I tried the following code:</p>
<pre><code>---
title: "Test Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
runtime: shiny
---
```{r setup, include=FALSE}
library(flexdashboard)
library(shiny)
```
Column {data-width=100}
-----------------------------------------------------------------------
### Window 1
```{r}
plots = rep("plot", 10)
i = seq(1:100)
choice = paste0(plots, "_",i)
selectInput("project", label = NULL, choices = choice)
```
Column {data-width=400}
-----------------------------------------------------------------------
### Chart B
```{r}
renderPlot({
<object class="one" type="text/html" data="plot_i.html"></object>
})
```
</code></pre>
<p>But this returns the following error:</p>
<pre><code>Error: <text<:2:1 unexpected '<'
1: renderPlot({
2:<
^
</code></pre>
<p>Can someone please show me how I can fix this? And is it possible to do this WITHOUT shiny? (i.e. only in flexdashboard)</p>
<p>Thank you!</p>
| [
{
"answer_id": 74132458,
"author": "Retep",
"author_id": 15360790,
"author_profile": "https://Stackoverflow.com/users/15360790",
"pm_score": 0,
"selected": false,
"text": "i++;"
},
{
"answer_id": 74132780,
"author": "PaulMcKenzie",
"author_id": 3133316,
"author_profil... | 2022/10/19 | [
"https://Stackoverflow.com/questions/74132443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13203841/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.