qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
74,180,451 | <p>i tried to create a tool for my company to send an email to our IT when a user account is expired.</p>
<p>This part works fine so far.</p>
<p>But we have an issue. Sometimes we change the expiration date of the accounts. The problem is that i saved the names into a txt file because we run that script every night to check for new expired accounts. If that txt wouldn´t exist, then we would get hundrets of emails every day.</p>
<p>I tried multiple convert things like "[Datetime] $UserAccountsExpiredDate -ge $TodaysDate" But there is always an error message like this:</p>
<pre><code>"@{AccountExpirationDate=13.11.2022 00:00:00}" vom Typ "Selected.Microsoft.ActiveDirectory.Management.ADUser" kann nicht in den Typ "System.DateTime" konvertiert
werden."
In C:\Scripte\AbgelaufeneUserSkript\Abfrage_abgelaufene_User_NicoTest_Teiltest.ps1:38 Zeichen:9
+ if(([Datetime] $userAccountExpiredDate -ge $TodaysDate))
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastConstructorException
</code></pre>
<p>I know that many of you cant speak german. The AccountExpirationDate can´t be converted into System-Datetime.</p>
<p>I couldn´t find any solution, so im here right now. My original code is below this:</p>
<pre><code>
$Users = Get-ADUser -Filter * -Properties Name, Enabled, AccountExpirationDate, LastLogonDate, department | ? {($_.AccountExpirationDate -NE $NULL -AND $_.AccountExpirationDate -LT (Get-Date)) }
$TxtPath = "C:\scripte\AbgelaufeneUserSkript\Abgelaufene_Benutzer.txt"
$UserDeactivated = Get-Content $TxtPath
$TodaysDate = (Get-Date).ToString()
if(Test-Path $TxtPath)
{
}
else
{
New-Item $TxtPath
}
echo $TodaysDate
foreach($userintxt in Get-Content $TxtPath)
{
Write-Host $userintxt
$userAccountExpiredDate = (Get-ADUser $userintxt -Properties AccountExpirationDate) | Select-Object AccountExpirationDate
Write-Host $userAccountExpiredDate
echo $userintxt.Name
if(($userAccountExpiredDate -ge $TodaysDate))
{
Write-Host $userintxt.Name "This account is no more expired"
}
else
{
Write-Host $userintxt.Name "This account is still expired"
}
}
</code></pre>
| [
{
"answer_id": 74180744,
"author": "Avshalom",
"author_id": 4568320,
"author_profile": "https://Stackoverflow.com/users/4568320",
"pm_score": 1,
"selected": false,
"text": "[Datetime]::ParseExact"
},
{
"answer_id": 74181101,
"author": "Theo",
"author_id": 9898643,
"au... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20321220/"
] |
74,180,452 | <p>I'm new to coding so I would like to ask if there is an easy way to put certain objects below or above each other in HTML or CSS? If there is can you please explain how? I couldn't find any articles explaining this. <a href="https://i.stack.imgur.com/AZSzn.png" rel="nofollow noreferrer">Example Here</a></p>
<p>I'll answer any question to the best of my ability.</p>
| [
{
"answer_id": 74180744,
"author": "Avshalom",
"author_id": 4568320,
"author_profile": "https://Stackoverflow.com/users/4568320",
"pm_score": 1,
"selected": false,
"text": "[Datetime]::ParseExact"
},
{
"answer_id": 74181101,
"author": "Theo",
"author_id": 9898643,
"au... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20321031/"
] |
74,180,466 | <p>I have a django project that was created on an Oracle database and I want to switch to ANOTHER Oracle database. I have followed this tutorial <a href="https://pythonfusion.com/switch-database-django/" rel="nofollow noreferrer">https://pythonfusion.com/switch-database-django/</a>, but there is a problem that not all models are created initially in Django, some are created using inspectdb on existing tables in other databases . Therefore, when using the migrate <em>--database=new</em> command, I get errors about those tables that already existed before Django was created. Is there a way to migrate only the models and tables necessary for Django to work? (users, auth...)</p>
| [
{
"answer_id": 74180601,
"author": "Arthur",
"author_id": 13065557,
"author_profile": "https://Stackoverflow.com/users/13065557",
"pm_score": 1,
"selected": false,
"text": "class MyModel(models.Model):\n ...\n\n class Meta:\n managed = False # This means django will ignore M... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20321258/"
] |
74,180,467 | <p>I have a GeoJson file and added it to my project file, but I don't know how to import and use it in my map component. I tried the code below, but it didn't work.</p>
<pre class="lang-html prettyprint-override"><code><template>
<div class="locationMap">
<l-map
:zoom="6"
:center="[47.31322, -1.319482]"
style="height: 800px; width: 1000px"
>
<l-tile-layer :url="url" :attribution="attribution" />
<l-geo-json
:geojson="geojson"
:options="options"
:options-style="styleFunction"
/>
</l-map>
</div>
</template>
<script>
import geojson from "../components/provinces.json";
export default {
name: "locationMap",
data() {
return {
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
attribution:
'&copy; <a target="_blank" href="http://osm.org/copyright">OpenStreetMap</a>contributors',
geojson: null,
};
},
mounted() {
this.geojson = geojson;
},
};
</script>
</code></pre>
| [
{
"answer_id": 74298320,
"author": "Bruno Cardoso",
"author_id": 19072723,
"author_profile": "https://Stackoverflow.com/users/19072723",
"pm_score": 1,
"selected": false,
"text": "async created () {\n const jsonFile = await fetch('../components/provinces.json')\n this.geojson = await j... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17702251/"
] |
74,180,480 | <p>i have a react component thats keep re-rendering idk why but i think the reason is the data fetching</p>
<p>data code :</p>
<pre><code>export function KPI_Stock_Utilisation() {
const [kpi_stock_utilisation, setKpi_stock_utilisation] = useState([{}]);
useEffect(() => {
axios.get("http://localhost:5137/KPI_Stock_Utilisation").then((response) => {
setKpi_stock_utilisation((existingData) => {
return response.data;
});
});
}, []);
console.log('data get')
return kpi_stock_utilisation;
}
</code></pre>
<p>this log displayed many times , and the log in the component too</p>
<p>component code :</p>
<pre><code>import React from "react";
import { KPI_Stock_Utilisation } from "../../Data/data";
import { useEffect } from "react";
export default function WarehouseUtilisChart(props) {
let kpi_stock_utilisations =KPI_Stock_Utilisation();
let Stock_utilisation = (kpi_stock_utilisations.length / 402) * 100;
console.log('component render')
return (
<div>
<p>{kpi_stock_utilisations}</p>
</div>
);
}
</code></pre>
<p>im new with react i tried useEffect inside the componenets but its not working</p>
| [
{
"answer_id": 74180565,
"author": "Oleg Brazhnichenko",
"author_id": 7028321,
"author_profile": "https://Stackoverflow.com/users/7028321",
"pm_score": 0,
"selected": false,
"text": "let kpi_stock_utilisations =KPI_Stock_Utilisation();"
},
{
"answer_id": 74180730,
"author": "... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20012195/"
] |
74,180,488 | <p>I'm trying to use the <code>select-xml</code> cmdlet in Powershell to query some XAML files in my .NET project. Here's what I've tried:</p>
<pre><code>select-xml -content (cat $xaml_file_path) -xpath "//GroupBox"
</code></pre>
<p>Where <code>$xaml_file_path</code> is simply a string containing the file path to the XAML file of interest.</p>
<p>This throws an error:</p>
<blockquote>
<p>Select-Xml: Cannot validate argument on parameter 'Content'. The argument is null, empty, or an element of the argument collection contains a null value. Supply a collection that does not contain any null values and then try the command again.</p>
</blockquote>
<p>I know the XAML is valid since it compiles fine on Visual Studio. So I'm thinking there might be something else going on here.</p>
<p>Is there a way to query XAML files using Powershell? If so how?</p>
| [
{
"answer_id": 74180818,
"author": "user32882",
"author_id": 3783002,
"author_profile": "https://Stackoverflow.com/users/3783002",
"pm_score": 1,
"selected": false,
"text": "xmllint"
},
{
"answer_id": 74181458,
"author": "mklement0",
"author_id": 45375,
"author_profil... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3783002/"
] |
74,180,540 | <p>i'm trying execute project python in terminal but appear this error:</p>
<pre><code>(base) hopu@docker-manager1:~/bentoml-airquality$ python src/main.py
Traceback (most recent call last):
File "src/main.py", line 7, in <module>
from src import VERSION, SERVICE, DOCKER_IMAGE_NAME
ModuleNotFoundError: No module named 'src'
</code></pre>
<p>The project hierarchy is as follows:</p>
<p><a href="https://i.stack.imgur.com/octVb.png" rel="nofollow noreferrer">Project hierarchy</a></p>
<p>If I execute project with any IDE, it works well.</p>
| [
{
"answer_id": 74180629,
"author": "Steinn Hauser Magnusson",
"author_id": 13819183,
"author_profile": "https://Stackoverflow.com/users/13819183",
"pm_score": 2,
"selected": false,
"text": "/src"
},
{
"answer_id": 74181017,
"author": "Serge Ballesta",
"author_id": 3545273... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15767572/"
] |
74,180,625 | <p>I created a VPN App and it is working correctly in Release and Debug APK files but when I upload it to Play Store, and then downloaded from Play Store it does not connect to the server and say "<strong>no process running</strong>" and give me the below error:</p>
<pre><code>CANNOT LINK EXECUTABLE "/data/user/0/com.sharptech.sharpvpn/cache/c_pie_openvpn.arm64-v8a": library "libopenvpn.so" not found
pid: 3736, tid: 3736, name: c_pie_openvpn.a >>> /data/user/0/com.sharptech.sharpvpn/cache/c_pie_openvpn.arm64-v8a <<<
Abort message: 'CANNOT LINK EXECUTABLE "/data/user/0/com.sharptech.sharpvpn/cache/c_pie_openvpn.arm64-v8a": library "libopenvpn.so" not found'
</code></pre>
<p>My Gradle Build is below:</p>
<pre><code> plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.sharptech.sharpvpn"
minSdk 21
targetSdk 32
versionCode 8
resConfigs "en"
versionName "1.7"
android.defaultConfig.ndk.debugSymbolLevel = 'FULL'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
dataBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(path: ':vpnLib')
implementation platform('com.google.firebase:firebase-bom:31.0.1')
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.firebase:firebase-analytics:21.2.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.airbnb.android:lottie:5.2.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.github.bumptech.glide:glide:4.14.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
implementation 'com.android.ndk.thirdparty:openssl:1.1.1l-beta-1'
//ads
//implementation 'com.google.android.gms:play-services-ads:21.3.0'
//implementation 'com.google.ads.mediation:applovin:11.5.2.0'
//implementation 'com.google.ads.mediation:facebook:6.11.0.1'
}
</code></pre>
<p>And I also use a vpnlib module which build.gradle file is:</p>
<pre><code>apply plugin: 'com.android.library'
android {
compileSdk 32
defaultConfig {
minSdk 21
targetSdk 32
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
namespace 'de.blinkt.openvpn'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
}
</code></pre>
| [
{
"answer_id": 74180853,
"author": "Pierre",
"author_id": 4265103,
"author_profile": "https://Stackoverflow.com/users/4265103",
"pm_score": 1,
"selected": false,
"text": "libopenvpn.so"
},
{
"answer_id": 74197443,
"author": "Rafiqullah Taibzada",
"author_id": 19519143,
... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19519143/"
] |
74,180,644 | <p>I don't see any questions on SO regarding this, so I would like to ask how a Python class object instance is passed into a function and how it behaves within the function. I have some suspicions from the behaviour I got from running this snippet:</p>
<p>(Note: I understand there are better ways to achieve the same behaviour for this example. My actual use case involves slightly more complicated manouevers: threading etc. I'm just more interested in understanding exactly what is happening with the argument passed.).</p>
<pre><code>class Animal:
def __init__(self, name, sound):
self.name = name
self.sound = sound
def change_animal(animal_1, animal_2):
animal_1 = None
animal_1 = animal_2
# or better yet,
# animal_1 = copy.deepcopy(animal_2)
# main
animal_1 = Animal('dog', 'bark')
animal_2 = Animal('duck', 'quack')
change_animal(animal_1, animal_2)
print(animal_1.name)
</code></pre>
<p>Prints <code>dog</code>. I always thought it would change the instance and print <code>duck</code>.</p>
<p>Whereas using this:</p>
<pre><code>def change_animal(animal_1, animal_2):
animal_1.name = animal_2.name
animal_1.sound = animal_2.sound
</code></pre>
<p>Prints <code>duck</code> showing that the instance has been changed?</p>
<p>I wanted to avoid writing anything that requires me to reassign each attribute individually because there is a high likelihood of someone missing a variable and erroneously having a combination of updated and old values.</p>
| [
{
"answer_id": 74180853,
"author": "Pierre",
"author_id": 4265103,
"author_profile": "https://Stackoverflow.com/users/4265103",
"pm_score": 1,
"selected": false,
"text": "libopenvpn.so"
},
{
"answer_id": 74197443,
"author": "Rafiqullah Taibzada",
"author_id": 19519143,
... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16627522/"
] |
74,180,651 | <pre><code>string rec_rev_str(string *str,int size){
if(size == 0){
return *str;
}
swap((*str)[0],(*str)[size]);`// size is the index from the end`
return rec_rev_str(str+1,size-1);
}
int main(){
string str = "great";
int size = 5;
int start = 0;
int end = size - 1;
string* ptr = &str;
rec_rev_str(ptr,size-1);
cout<<str<<endl;
}
</code></pre>
<ol>
<li>I don't understand how to point str+1 (the first index of the string like we do in an array e.g. arr + 1)</li>
</ol>
| [
{
"answer_id": 74180871,
"author": "Botond Horváth",
"author_id": 16825566,
"author_profile": "https://Stackoverflow.com/users/16825566",
"pm_score": -1,
"selected": false,
"text": "string"
},
{
"answer_id": 74181136,
"author": "mani",
"author_id": 2303348,
"author_pr... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10402670/"
] |
74,180,672 | <p>I have problem with Keys in pynput</p>
<p>on_press function should check if button pressed i 'h' but it gives error</p>
<pre><code>from pynput.keyboard import Key, Listener
def on_press(key):
print(key)
if key == Key.h:
print('done')
def on_release(key):
print('{0} release'.format(key))
if key == Key.esc:
return False
# Collect events until released
with Listener(
on_press=on_press,
on_release=on_release) as listener:
listener.join()
</code></pre>
| [
{
"answer_id": 74180874,
"author": "D.L",
"author_id": 7318120,
"author_profile": "https://Stackoverflow.com/users/7318120",
"pm_score": 1,
"selected": false,
"text": "if key == Key.h:"
},
{
"answer_id": 74181155,
"author": "W3ke",
"author_id": 19361172,
"author_profi... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19361172/"
] |
74,180,690 | <p>I have a model who looks like this :</p>
<pre class="lang-py prettyprint-override"><code>class Test(models.Model):
user = models.ForeignKey('users.CustomUser', models.CASCADE)
name = models.CharField(max_length=64)
class TestVersion(models.Model):
test = models.ForeignKey('Test', models.CASCADE)
name = models.CharField(max_length=255)
validation_1 = models.BooleanField(default=False, editable=False)
validation_2 = models.BooleanField(default=False, editable=False)
validation_3 = models.BooleanField(default=False, editable=False)
validation_4 = models.BooleanField(default=False, editable=False)
</code></pre>
<p>Sometimes i have like hundreds of <code>TestVersion</code> linked to a <code>Test</code>.</p>
<p>And I want something like :</p>
<pre class="lang-py prettyprint-override"><code>user_test = Test.objects.filter(
user=request.user
).annotate(
number_of_test=Count('testversion', distinct=True),
all_validation_1="True or False ?", # if all testversion_set.all() of the current test are True, return True else False.
all_validation_2="True or False ?", # same
all_validation_3="True or False ?", # same
all_validation_4="True or False ?", # same
).distinct()
# I Want for example :
test_1 = user_test.first()
test_1_validation_1 = test_1.testversion_set.all().count()
test_1_validation_1_true = test_1.testversion_set.filter(validation_1=True).count()
all_validation_1 = test_1_validation_1 == test_1_validation_true
test_1.all_validation_1 == all_validation_1 # True
# Or something like :
test_1 = user_test.first()
all_validation_1 = all(test_1.testversion_set.all().values_list('validation_1', flat=True))
test_1.all_validation_1 == all_validation_1 # True
</code></pre>
<p>I have not been able to find what techniques were used to achieve this level of accuracy with related objects in annotate method.</p>
<p>Any ideas ?</p>
<p>Thank's</p>
<p><strong>Update :</strong> Thank's you <a href="https://stackoverflow.com/users/6562458/sumithran">Sumithran</a> for your answer.</p>
<p>But I don't want <code>all_validated</code> I want to manage <code>all_validation_1</code> next to <code>all_validation_2</code> for some check.</p>
<p>If I take example on your solution, it almost work with a little throwback that I don't understant :</p>
<pre class="lang-py prettyprint-override"><code>test = Test.objects.annotate(
number_of_test=Count("testversion", distinct=True)
).annotate(
all_validation_1=Case(
When(Q(testversion__validation_1=True), then=Value(True)),
default=Value(False),
output_field=BooleanField(),
),
all_validation_2=Case(
When(Q(testversion__validation_2=True), then=Value(True)),
default=Value(False),
output_field=BooleanField(),
)
)
</code></pre>
<p>But for some <code>Test</code> objects there is some duplication :</p>
<pre class="lang-py prettyprint-override"><code>test.filter(name='test_27')
>> <QuerySet [<Test: test_27>, <Test: test_27>]>
test.filter(name='test_27')[0] == test.filter(name='test_27')[1]
>> True
test.filter(name='test_27')[0].all_validation_1
>> True
test.filter(name='test_27')[1].all_validation_1
>> False
</code></pre>
<p>What I'm doing wrong ?</p>
| [
{
"answer_id": 74181106,
"author": "Sumithran",
"author_id": 6562458,
"author_profile": "https://Stackoverflow.com/users/6562458",
"pm_score": 1,
"selected": false,
"text": "from django.db.models import Case, When, Value, BooleanField, Count, Q\n\ntest = Test.objects.annotate(\n numbe... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8293533/"
] |
74,180,706 | <p>My future builder is not working snapshot data is empty.
In other future builder cases my code works correctly.
My api gets correct data too.
this is my run terminal:</p>
<p><img src="https://i.stack.imgur.com/H7GuW.png" alt="" /></p>
<pre><code>
static Future<List<User>> getUser() async {
var url = '${Constants.BASE_NO_TOKEN_DOMAIN}api?action=user_profile&token=${Constants.USER_TOKEN}';
final response = await http.get(Uri.parse(url));
final body = jsonDecode(response.body);
return body['data'].map<User>(User.fromJson).toList();
}
@override
void initState() {
super.initState();
userFuture = getUser();
getToken();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
color: Color.fromRGBO(245, 248, 250, 1),
padding: EdgeInsets.only(left: 16, top: 25, right: 16),
child: ListView(
children: [
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(12))),
padding: EdgeInsets.only(left: 10, right: 10),
height: 120,
child: FutureBuilder<List<User>>(
future: userFuture,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator();
} else if (snapshot.hasData) {
final user = snapshot.data!;
return buildUser(user);
} else {
print(snapshot.data);
print(snapshot.error);
return Text("No widget to build");
}
},
) // FutureBuilder
), //Container
</code></pre>
| [
{
"answer_id": 74180908,
"author": "Ivo",
"author_id": 1514861,
"author_profile": "https://Stackoverflow.com/users/1514861",
"pm_score": 1,
"selected": false,
"text": " static Future<List<User>> getUser() async {\n var url = '${Constants.BASE_NO_TOKEN_DOMAIN}api?action=user_profile&t... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20320364/"
] |
74,180,708 | <p>I have a JSON that returns a date in the following date format:</p>
<pre><code>datetime(2015, 12, 1)
</code></pre>
<p>So the key value from JSON is</p>
<pre><code>'CreateDate': datetime(2015, 1, 1)
</code></pre>
<p>In order to be able to subtract two dates, I need to convert above to date format:</p>
<pre><code>YYYY/MM/DD
</code></pre>
<p>so in above case that would become: 2015/12/01</p>
<p>Is there a smart way to do that? Is it at all possible? Or do I really have to parse it as a block of text? I tried using datetime.strptime, but I can't get it to work.</p>
| [
{
"answer_id": 74180745,
"author": "JimmyNJ",
"author_id": 6016071,
"author_profile": "https://Stackoverflow.com/users/6016071",
"pm_score": 2,
"selected": false,
"text": "datetime(2015,12,1).strftime(\"%Y/%m/%d\")\n"
},
{
"answer_id": 74180824,
"author": "Fome",
"author_... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11070684/"
] |
74,180,718 | <p>I use razor file and want use C# btnStateTag variable as tag name.
So I use it as @btnStateAttr in HTML part.
But it doesn't work</p>
<pre><code>@{
string btnStateAttr = "";
if (EditFormParameter.SendingCompleted)
{
btnStateAttr = "disabled";
}
}
<div class="form-group row my-4">
<button class="col-sm-3 btn btn-success" @btnStateAttr type="button">Send</button>
</div>
</code></pre>
<p>What is wrong here.</p>
<p>I want to add an attribute - disabled.</p>
| [
{
"answer_id": 74180976,
"author": "Dimitris Maragkos",
"author_id": 10839134,
"author_profile": "https://Stackoverflow.com/users/10839134",
"pm_score": 2,
"selected": false,
"text": "<button class=\"...\" disabled=\"@EditFormParameter.SendingCompleted\" type=\"button\">Send</button>\n"
... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1525808/"
] |
74,180,734 | <p>I have a pandas data frame with a column named "content" that contains text. I want to remove some words from each text within this column. I thought of replacing each string by empty string, but when I print the result of my function I see that the words have not been removed. My code is below:</p>
<pre><code>def replace_words(t):
words = ['Livre', 'Chapitre', 'Titre', 'Chapter', 'Article' ]
for i in t:
if i in words:
t.replace (i, '')
else:
continue
print(t)
st = 'this is Livre and Chapitre and Titre and Chapter and Article'
replace_words(st)
</code></pre>
<p>An example of desired result is: 'this is and and and and '</p>
<p>With the code below I want to apply the function above to each text in the column "content":</p>
<pre><code>df['content'].apply(lambda x: replace_words(x))
</code></pre>
<p>Can someone help me to create a function that removes all the words I need and then apply this function to all the texts within my df column?</p>
| [
{
"answer_id": 74180976,
"author": "Dimitris Maragkos",
"author_id": 10839134,
"author_profile": "https://Stackoverflow.com/users/10839134",
"pm_score": 2,
"selected": false,
"text": "<button class=\"...\" disabled=\"@EditFormParameter.SendingCompleted\" type=\"button\">Send</button>\n"
... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19381301/"
] |
74,180,740 | <p>I have XY datasets that have been concatenated together along with labels and are in one column. I want to split the dataset after the string labels, split the numerical data then then insert a third column of the label. So it goes from this:</p>
<pre><code>import pandas as pd
df = pd.DataFrame.from_dict({'XYZ':
['Monday', '120 12', '119 51', '133 85', '1414 268', 'Wednesday', '3 62', '4 27',
'Friday', '23 100', '155 300', '123 400'], })
print(df)
</code></pre>
<p>To this format...</p>
<pre><code>df2 = pd.DataFrame.from_dict(
{
'X': ['120', '119', '133', '1414', '3', '4', '23', '155', '123'],
'Y': [ '12', '51', '85', '268', '62', '27', '100', '300', '400'],
'z': [ 'Monday', 'Monday', 'Monday', 'Monday', 'Wednesday', 'Wednesday', 'Friday', 'Friday', 'Friday']
}
)
print(df2)
</code></pre>
<p>What would be the best way to do this?</p>
| [
{
"answer_id": 74180976,
"author": "Dimitris Maragkos",
"author_id": 10839134,
"author_profile": "https://Stackoverflow.com/users/10839134",
"pm_score": 2,
"selected": false,
"text": "<button class=\"...\" disabled=\"@EditFormParameter.SendingCompleted\" type=\"button\">Send</button>\n"
... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20321150/"
] |
74,180,743 | <h1>EDIT:</h1>
<p>Please note that the problem in this question was simply that I accidentally put <code>zoo::na.locf(l[[i]][1], na.rm=TRUE)</code>, when it should be <code>zoo::na.locf(l[[i]][1], na.rm=FALSE)</code>. However by the time I figured this out the question had already received two answers. As a result, instead of removing the question (as this is discouraged after people have submitted answers), I have slightly adapted the question, to make sure the post will at least have some merit.</p>
<h1>Question:</h1>
<p>I have a list of dataframes:</p>
<pre><code>test_dat <- structure(list(...5 = c("euro", "euro", NA, NA, NA, NA,
NA, "dollar", NA)), row.names = c(NA, -9L), class = c("tbl_df",
"tbl", "data.frame"))
test_dat2 <- structure(list(...5 = c(NA, "euro", NA, NA, NA, NA,
NA, "dollar", NA)), row.names = c(NA, -9L), class = c("tbl_df",
"tbl", "data.frame"))
test_dat2
# A tibble: 9 × 1
...5
<chr>
1 NA
2 euro
3 NA
4 NA
5 NA
6 NA
7 NA
8 dollar
9 NA
l = list(test_dat , test_dat2)
</code></pre>
<p>I want to fill <code>NA</code>'s in the list of df's, but sometimes there is a leading <code>NA</code>. I do not know for which entries there is leading <code>NA</code>.</p>
<pre><code>for (i in seq_along(l)){
# Fill first column
l[[i]][1] <- zoo::na.locf(l[[i]][1])
}
</code></pre>
<p>Leading to:</p>
<pre><code>Error:
! Assigned data `zoo::na.locf(l[[i]][1])` must be compatible with existing data.
✖ Existing data has 9 rows.
✖ Assigned data has 8 rows.
ℹ Only vectors of size 1 are recycled.
Run `rlang::last_error()` to see where the error occurred.
</code></pre>
<p>I assumed that the following would solve it, but did not:</p>
<pre><code>for (i in seq_along(l)){
# Fill first column
l[[i]][1] <- zoo::na.locf(l[[i]][1], na.rm=TRUE)
}
</code></pre>
<p>Desired output:</p>
<pre><code>test_dat2
# A tibble: 9 × 1
...5
<chr>
1 NA
2 euro
3 euro
4 euro
5 euro
6 euro
7 euro
8 dollar
9 dollar
</code></pre>
| [
{
"answer_id": 74180976,
"author": "Dimitris Maragkos",
"author_id": 10839134,
"author_profile": "https://Stackoverflow.com/users/10839134",
"pm_score": 2,
"selected": false,
"text": "<button class=\"...\" disabled=\"@EditFormParameter.SendingCompleted\" type=\"button\">Send</button>\n"
... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8071608/"
] |
74,180,758 | <p>I have a table named <code>Bank</code> that contains a <code>Bank_Values</code> column. I need a calculated <code>Bank_Value_Unique</code> column to shows whether each <code>Bank_Value</code> exists somewhere else in the table (i.e. whether its count is greater than 1).</p>
<p>I prepared this query, but it does not work. Could anyone help me with this and/or modify this query?</p>
<pre><code>SELECT
CASE
WHEN NULLIF(LTRIM(RTRIM(Bank_Value)), '') =
(SELECT Bank_Value
FROM [Bank]
GROUP BY Bank_Value
HAVING COUNT(*) = 1)
THEN '0' ELSE '1'
END AS Bank_Key_Unique
FROM [Bank]
</code></pre>
| [
{
"answer_id": 74180976,
"author": "Dimitris Maragkos",
"author_id": 10839134,
"author_profile": "https://Stackoverflow.com/users/10839134",
"pm_score": 2,
"selected": false,
"text": "<button class=\"...\" disabled=\"@EditFormParameter.SendingCompleted\" type=\"button\">Send</button>\n"
... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19494546/"
] |
74,180,767 | <p>I am trying to import CSVs inside a Importer Component and pass on the Data to the Parent and change useState there...</p>
<p>So here i am trying to call said Component and pass on the useState function.</p>
<pre><code> const [database, setDatabase] = useState([]);
useEffect(() => {
<Importer setdata={(data) => setDatabase([...data])} />;
}, []);
</code></pre>
<p>and Child Component is importing the CSV and passing on the data to be displayed after changing the State with useState:</p>
<pre><code>const importAllCsv = (props) => {
text("template.csv").then((data) => {
//console.log(data);
const psv = dsvFormat(";");
//console.log(psv.parse(data));
DATABASE = psv.parse(data);
console.log(DATABASE);
props.setdata(DATABASE);
});
};
export default function Importer(props) {
return importAllCsv(props);
}
</code></pre>
| [
{
"answer_id": 74180901,
"author": "Aliyan",
"author_id": 19561859,
"author_profile": "https://Stackoverflow.com/users/19561859",
"pm_score": -1,
"selected": false,
"text": "props.setdata((prevState) => [...prevState, ...DATABASE])\n"
},
{
"answer_id": 74181875,
"author": "Af... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20222286/"
] |
74,180,788 | <p>Having a Pipeline which needs some manual Input I tried to set the current date formated as default value like this</p>
<pre><code>parameters:
- name: StartDate
displayName: StartDate
type: string
default: $(Date:dd/MM/yyyy)
</code></pre>
<p>but it shows just the text. It has to be a string because later it is used as arm template input.</p>
<p>Is there a way to give current date a default value ?
maybe even calculated as year plus two !?</p>
<p>regards for any hint on that</p>
| [
{
"answer_id": 74181533,
"author": "Dilly B",
"author_id": 2670623,
"author_profile": "https://Stackoverflow.com/users/2670623",
"pm_score": 0,
"selected": false,
"text": "trigger:\n branches:\n include:\n - main/*\n\npool:\n vmImage: ubuntu-latest\n\nparameters:\n - name: startD... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3732793/"
] |
74,180,791 | <p>[Solved by making in an in between type]</p>
<pre><code>struct ColorType: Identifiable {
var id = UUID()
var color: Color
}
</code></pre>
<p>End of edit</p>
<p>I have an array with custom SwiftUI <code>Color</code>s which reside in the assets folder. Within a <code>View</code> a <code>Foreach</code> itterates through these values like this:</p>
<pre><code>let colors: [Color] = [Color("InstrumentColor100"),Color("InstrumentColor100"),Color("InstrumentColor101")]
ForEach( colors, id: \.self) { color in
Rectangle().fill(color)
}
</code></pre>
<p>This will serve me the runtime error:
ForEach<Array, Color, _ShapeView<Rectangle, Color>>: the ID NamedColor(name: "InstrumentColor100", bundle: nil) occurs multiple times within the collection, this will give undefined results!</p>
<p>I do understant this is due to id: .self not finding unique values to create unique ID's. I found <a href="https://stackoverflow.com/questions/72811440/swiftui-foreach-explanation">this answer</a> stating to use <code>id: \.keyPath</code> but I do not have a keyPath rendering 3 aditional errors.</p>
<p>What would be a low overhead way to make these values (apear) unique?</p>
<p>BTW, the code works, but the console overflows wthe the sayd error.</p>
| [
{
"answer_id": 74180877,
"author": "DarkDust",
"author_id": 400056,
"author_profile": "https://Stackoverflow.com/users/400056",
"pm_score": 1,
"selected": false,
"text": "let foo = [\"a\", \"b\", \"c\"]\nlet bar = Array(foo.enumerated())\nprint(bar)\n// [(offset: 0, element: \"a\"), (off... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18950690/"
] |
74,180,810 | <p>I have a code where I am trying to display all the child elements of the <code>card-container</code> element, which is each <code>card</code>, into the same row unless there is not enough space. The code is as follows:</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>@import url('https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap');
* {
font-family: 'Ubuntu', sans-serif;
text-transform: capitalize;
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: #f0f0f0;
}
.heading {
text-align: center;
font-size: 2.25em;
padding: 1.25em 0;
/* y-padding = 0.3em */
color: #00cc99;
}
.card-container {
display: grid;
/*repeat(auto-fit, minmax(10em, 1fr));*/
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-template-rows: 1fr;
column-gap: 15px;
padding: 20px;
}
.card-container .card {
/* grid-row: 1; */
/* width:%; */
padding: 0.6em;
border: 0.15em solid #00cc99;
border-radius: 10px;
text-align: center;
background-color: white;
box-shadow: 5px 5px #00cc99;
}
.card-container .card .card-icon {
margin-top: 10px;
}
.card-container .card .card-icon i {
margin: 10px 0;
font-size: 1.5em;
color: #00cc99;
}
.card-container .card .card-title {
color: #00cc99;
font-size: 1.125em;
margin-top: 3px;
}
.card-container .card p {
font-size: 0.8em;
color: #555;
padding: 10px;
}
.card-container .card a {
color: #00cc99;
text-decoration: none;
display: block;
font-size: 1.125em;
;
padding: 10px, 0px;
}
.card-container .card a:hover {
color: #8d4cd6;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Services</title>
<script src="https://kit.fontawesome.com/364bf5035f.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<h1 class="heading">Our Services</h1>
<div class="card-container">
<div class="card">
<div class="card-icon">
<i class="fa-solid fa-code"></i>
</div>
<h3 class="card-title">web development</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Pariatur, laborum nesciunt. Error, animi? Quidem saepe aliquam quaerat commodi nam minus adipisci provident aperiam sint cum.</p>
<a href="#">know more <i class="fa-solid fa-angles-right"></i></a>
</div>
<br><br>
<div class="card">
<div class="card-icon">
<i class="fa-solid fa-tools"></i>
</div>
<h3 class="card-title">web design</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Pariatur, laborum nesciunt. Error, animi? Quidem saepe aliquam quaerat commodi nam minus adipisci provident aperiam sint cum.</p>
<a href="#">know more <i class="fa-solid fa-angles-right"></i></a>
</div>
<br><br>
<div class="card">
<div class="card-icon">
<i class="fa-solid fa-brush"></i>
</div>
<h3 class="card-title">Animation</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Pariatur, laborum nesciunt. Error, animi? Quidem saepe aliquam quaerat commodi nam minus adipisci provident aperiam sint cum.</p>
<a href="#">know more <i class="fa-solid fa-angles-right"></i></a>
</div>
<br><br>
<div class="card">
<div class="card-icon">
<i class="fa-solid fa-bullhorn"></i>
</div>
<h3 class="card-title">digital marketing</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Pariatur, laborum nesciunt. Error, animi? Quidem saepe aliquam quaerat commodi nam minus adipisci provident aperiam sint cum.</p>
<a href="#">know more <i class="fa-solid fa-angles-right"></i></a>
</div>
</div>
</body>
</html></code></pre>
</div>
</div>
</p>
<p>I have tried setting the <code>grid-template-rows: 1fr;</code> and setting the <code>grid-row:1;</code>. The first one doesn't make any change and the latter creates an overflow on decreasing the window/screen size.<br />
I have also tried using <code>repeat(auto-fit, minmax(10em, 1fr));</code> but that only seems to reduce the width and no other change.</p>
| [
{
"answer_id": 74180959,
"author": "Sigurd Mazanti",
"author_id": 14776809,
"author_profile": "https://Stackoverflow.com/users/14776809",
"pm_score": 1,
"selected": false,
"text": "<br>"
},
{
"answer_id": 74180982,
"author": "G-Cyrillus",
"author_id": 2442099,
"author... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18116417/"
] |
74,180,830 | <p>I am using "<a href="https://wordpress.org/plugins/wt-woocommerce-related-products/" rel="nofollow noreferrer">Related Products for WooCommerce</a>" plug-in 1.4.6 by <a href="https://www.webtoffee.com" rel="nofollow noreferrer">WebToffee</a> to display related products in each product page of an eCommerce website.
I am trying to display related products in the same order as they were entered for each product (a very specific order for each product) but to no avail. I have tried every sorting option of the plug-in.</p>
<p>Does anyone know how to achieve that with some additional PHP ?
For instance, for upsells, I am using the following code in the functions.php file of the theme, which works as expected :</p>
<pre><code>// ORDER BY
add_filter( 'woocommerce_upsells_orderby', 'filter_woocommerce_upsells_orderby', 10, 1 );
function filter_woocommerce_upsells_orderby( $orderby ){
return "none";
};
// ORDER
add_filter( 'woocommerce_upsells_order', 'filter_woocommerce_upsells_order', 10, 1 );
function filter_woocommerce_upsells_order($order){
return 'menu_order';
};
</code></pre>
<p>Thank you in advance.</p>
| [
{
"answer_id": 74180959,
"author": "Sigurd Mazanti",
"author_id": 14776809,
"author_profile": "https://Stackoverflow.com/users/14776809",
"pm_score": 1,
"selected": false,
"text": "<br>"
},
{
"answer_id": 74180982,
"author": "G-Cyrillus",
"author_id": 2442099,
"author... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3102556/"
] |
74,180,836 | <p>I have a country dropdown. When the user select any country, its id sent to the database instead of country name. How can I get the id of a selected option?</p>
<pre><code>function RegisterPlayer() {
const handleSubmit = (values, { setFieldError }) => {
const RegisterAsPlayerForm = {
full_name: values.fullname,
display_name: values.displayname,
nick_name: values.nickname,
dob: values.dob,
gender: values.gender,
country: values.country,
birth_city: values.city,
address: values.address,
phone: values.phone,
sport_id: values.sport,
speciality_id: values.speciality,
user_id: values.user_id,
file: values.profilephoto,
coverPhoto: values.coverPhoto,
};
let access_token = "fj7VfkpK8Yo4gZwGf4crRPIA5vHj1xw_";
axios
.post(
`http://192.168.18.8/goc-backend/api/web/index.php/v1/player/registerplayer`,
{ RegisterAsPlayerForm },
{
headers: {
Authorization: `Bearer ${access_token}`,
</code></pre>
<p>Here is select option code:</p>
<pre><code><select
className="inputBox"
type="option" name="country" onChange={handleChange}
onBlur={handleBlur} value={values.country} id="country" >
<option value=""> Country </option>
{countriesname.map((getcountry) => (
<option>{getcountry.name} </option> ))}
</select>
<p className="req-errors">
{touched.country && errors.country} </p>
</code></pre>
| [
{
"answer_id": 74180895,
"author": "David",
"author_id": 328193,
"author_profile": "https://Stackoverflow.com/users/328193",
"pm_score": 0,
"selected": false,
"text": "<option value={getcountry.id}>{getcountry.name}</option>\n"
},
{
"answer_id": 74180914,
"author": "Zein",
... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20321434/"
] |
74,180,879 | <p>After I update my Rstudio today, when I tried to get z-scores of a data frame by using <code>mutate()</code> and <code>scale()</code>, it returns a matrix with a 'new name' warning:</p>
<pre><code>df <- df %>% group_by(participants) %>% mutate(zscore=scale(answer))
New names:
* NA -> ...8
class(df$zscore)
[1] "matrix" "array"
</code></pre>
<p>The column of the z-scores should have been named 'zscore', but why it is now named '...8'? I never had any problems with the codes before. Is it because of the update?</p>
| [
{
"answer_id": 74180895,
"author": "David",
"author_id": 328193,
"author_profile": "https://Stackoverflow.com/users/328193",
"pm_score": 0,
"selected": false,
"text": "<option value={getcountry.id}>{getcountry.name}</option>\n"
},
{
"answer_id": 74180914,
"author": "Zein",
... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20321505/"
] |
74,180,891 | <p>I would like to be able to specify maxResults when using the golang BigQuery library. It isn't clear how to do this, though. I don't see it as an option in the documentation, and I have browsed the source to try to find it but I only see some sporadic usage in seemingly functionality not related to queries. Is there a way to circumvent this issue?</p>
| [
{
"answer_id": 74213385,
"author": "shollyman",
"author_id": 212435,
"author_profile": "https://Stackoverflow.com/users/212435",
"pm_score": 0,
"selected": false,
"text": "google.golang.org/api/iterator"
}
] | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4212335/"
] |
74,180,894 | <p>I am converting pdf files into images and then into Text Files (using Python). I need to read all the text files I converted from PDF to Text and remove the CRLF from the end of each string.</p>
<p>My text file looks something like this:</p>
<p><strong>CRLF</strong><br/>
BlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla<strong>CRLF</strong><br/>
<strong>CRLF</strong><br/></p>
<p>I want to remove the CRFL at the end of every string, but leave those that are on their own on an empty line (i.e there is no string before it)</p>
<p>This is my first time posting on Stackoverflow, so bear with me.</p>
<p><br>Edit: I want to fix the files I have and not create new ones. The aim is to have the paragraphs kept as intended, because otherwise when I read the file, it reads it line by line and does not return a paragraph but a line because of the CRFL at the end of each string.</p>
<p>I have this code but it's not doing anything:</p>
<pre><code>txt_filepaths = glob.glob("**/*.txt", recursive=True)
start = time.time()
def paragraph():
#clean text file
TextFile = os.listdir(save_text_path)
TextFile.sort()
this_text = open(save_text_path + name, 'a', encoding="utf-8")
with open(filepath, "r", encoding="utf-8") as fp:
lines = list(fp) #text as a list
Text1 = []
row = []
for line in lines:
line = line.rstrip()
if line:
#if not row:
# results.append('\n')
row.append(line)
else:
if row:
Text1.append(' '.join(row))
row = []
# for last element this code has to be after loop
if row:
Text1.append(' '.join(row))
row = []
this_text.write(Text1)
print('Processing next page')
this_text.close()
print(f"Program took {time.time() - start} seconds")
</code></pre>
| [
{
"answer_id": 74213385,
"author": "shollyman",
"author_id": 212435,
"author_profile": "https://Stackoverflow.com/users/212435",
"pm_score": 0,
"selected": false,
"text": "google.golang.org/api/iterator"
}
] | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8769777/"
] |
74,180,904 | <p>I am learning python and I am almost done with making tick tack toe but the code for checking if the game is a tie seems more complicated then it needs to be. is there a way of simplifying this?</p>
<pre><code> if a1 != " " and a2 != " " and a3 != " " and b1 != " " and b2 != " " and b3 != " " and c1 != " " and c2 != " " and c3 != " ":
board()
print("its a tie!")
quit()
</code></pre>
| [
{
"answer_id": 74213385,
"author": "shollyman",
"author_id": 212435,
"author_profile": "https://Stackoverflow.com/users/212435",
"pm_score": 0,
"selected": false,
"text": "google.golang.org/api/iterator"
}
] | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20321517/"
] |
74,180,934 | <p>Using bash how do I find a string and update the string next to it for example pass value</p>
<pre><code>my.site.com|test2.spin:80
</code></pre>
<p><strong>proxy_pass.map</strong></p>
<pre><code>my.site2.com test2.spin:80
my.site.com test.spin:8080;
</code></pre>
<p>Expected output is to update <strong>proxy_pass.map</strong> with</p>
<pre><code>my.site2.com test2.spin:80
my.site.com test2.spin:80;
</code></pre>
<p>I tried using awk</p>
<pre><code>awk '{gsub(/^my\.site\.com\s+[A-Za-z0-9]+\.spin:8080;$/,"my.site2.comtest2.spin:80"); print}' proxy_pass.map
</code></pre>
<p>but does not seem to work. Is there a better way to approch the problem. ?</p>
| [
{
"answer_id": 74181047,
"author": "RavinderSingh13",
"author_id": 5866580,
"author_profile": "https://Stackoverflow.com/users/5866580",
"pm_score": 1,
"selected": false,
"text": "awk"
},
{
"answer_id": 74181683,
"author": "user1934428",
"author_id": 1934428,
"author_... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74180934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/584239/"
] |
74,181,074 | <p>For some demo purposes, I'd like to add a toolbar at the very top of a page for better live demo capabilities.
That means I don't know the structure of the web page, as I am running live demos on different web ages of customers.
Currently, my script works on some pages quite well on others not.</p>
<p>Using developer Tools, for me, it looks like the main pain is when there is a class in the body, and I assume this is added dynamically by some logic. Open up the page then in Chrome - Developer tools, I can see my DIV at the top of the page, but closing the developer tools, it looks like the class in the body is overlaying my toolbar.</p>
<p>What I have tried is:</p>
<pre><code>window.parent.document.body.insertBefore(toolbar, document.body.firstChild);
</code></pre>
<p>or</p>
<pre><code>document.body.insertBefore(toolbar, document.body.firstChild);
</code></pre>
<p>and certainly the option in Tampermonkey:</p>
<pre><code>// @run-at document-end
</code></pre>
<p>But unfortunately with no luck.</p>
<p>I case anybody has found a more stable way to add something at the top of te page would be much appreciated under the awareness, when I don't know the page, there might be room to fail.</p>
<p>Thank you!</p>
| [
{
"answer_id": 74181047,
"author": "RavinderSingh13",
"author_id": 5866580,
"author_profile": "https://Stackoverflow.com/users/5866580",
"pm_score": 1,
"selected": false,
"text": "awk"
},
{
"answer_id": 74181683,
"author": "user1934428",
"author_id": 1934428,
"author_... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/535542/"
] |
74,181,076 | <p>I am writing a project with cpp. when I use <code>git merge other_branch</code> I concur a wired problem:</p>
<p>On my branch <code>My</code>, there is a header file <code>Foo.h</code> in <code>${PROJECT_ROOT}</code> directory,on the branch I want to merge <code>other_branch</code>, there is a header file <code>foo.h</code> in <code>${PROJECT_ROOT}</code>. <code>Foo.h</code> and <code>foo.h</code> have different content, when I use the <code>git merge other_branch</code> on <code>My</code> branch, git replace <code>Foo.h</code> with <code>foo.h</code>. In fact, the <code>Foo.h</code> disappear, only <code>foo.h</code> header file exists in <code>${PROJECT_ROOT}</code>. To fix the conflict, I rename <code>foo.h</code> to <code>Foo.h</code> and change the content, after fixing the problem, I use <code>git add .</code> and <code>git commit -m "..."</code> to finish the merge. After doing this, I use <code>git status</code> to see my workspace condition, I find that <code>Foo.h</code> is not staged for commit. So I use <code>git add Foo.h</code> to staged the file but nothing happen, <code>Foo.h</code> is still not staged for commit, it's wired.</p>
<p>I want to know:</p>
<ol>
<li>why git replace <code>Foo.h</code> with <code>foo.h</code> instead of reporting the conflict?</li>
<li>why doesn't <code>git add .</code> work?</li>
</ol>
<p>PS. When I see the remote repository, I find <code>Foo.h</code> and <code>foo.h</code> all exist. and my operating system is MacOS.</p>
<p>My conclusion is: git is case sensitive and MacOS's files are case insensitive, git actually want to keep <code>foo.h</code> and <code>Foo.h</code> but OSX regards <code>Foo.h</code> and <code>foo.h</code> as one file, so only <code>foo.h</code> exist, when I rename <code>foo.h</code> to <code>Foo.h</code> git still regard <code>Foo.h</code> as <code>foo.h</code>, thus when I use <code>git add Foo.h</code>, git add <code>foo.h</code> actually, so the <code>Foo.h</code> in git become a phantom.</p>
| [
{
"answer_id": 74181217,
"author": "Sam Varshavchik",
"author_id": 3943312,
"author_profile": "https://Stackoverflow.com/users/3943312",
"pm_score": 2,
"selected": true,
"text": "git"
},
{
"answer_id": 74187287,
"author": "bk2204",
"author_id": 8705432,
"author_profil... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15315834/"
] |
74,181,089 | <p>I have a function that generates an appended string in a for loop from values I have saved in the variable <code>batch_values</code>, which is a list with ~80 string values. I then use the appended string to execute the code that is saved in the final appended string.</p>
<p>Like so:</p>
<pre><code>part_to_append_1 = ''
for i in batch_values:
part_name = i.split("x")[0]
part_value = i.split("y")[1]
part_to_append = f"({part_name} = '{part_value}'),"
part_to_append_1 = part_to_append_1 + part_to_append
query = f'''EXECUTE {part_to_append_1};'''
run_query(query);
</code></pre>
<p>What I'm trying to do now, is to have the <code>run_query</code> be executed every time I iterate over <code>i</code> 10 time and then continue until <code>batch_values</code> list is finished. This is what I tried:</p>
<pre><code>for i in batch_values:
part_to_append_1 = ''
while (i<=10):
part_name = i.split("x")[0]
part_value = i.split("y")[1]
part_to_append = f"({part_name} = '{part_value}'),"
part_to_append_1 = part_to_append_1 + part_to_append
query = f'''EXECUTE {part_to_append_1};'''
run_query(query);
</code></pre>
<p>But this doesn't generate the desired result. What is the correct way do this?</p>
| [
{
"answer_id": 74181254,
"author": "Nacho R.",
"author_id": 12207183,
"author_profile": "https://Stackoverflow.com/users/12207183",
"pm_score": 2,
"selected": false,
"text": "part_to_append_1 = ''\n\nfor num, i in enumerate(batch_values, start=1):\n if num%10 == 0:\n part_to_ap... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7615751/"
] |
74,181,093 | <p>In the picture its shown that the 2 sets of list aren't at the same height or width. I am new to html/ccs and I cant figure how to fix it.</p>
<p>I've already tried to chance the margin to 0 instead of auto because i though it would solve the problem.</p>
<p>The line of code I've been told my mistake is placed in is this:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>ul.lister {
display: inline-block;
text-align: left;
margin-top: auto;
margin-buttom: auto;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><ul class="lister">
<p><big>Jeg ønsker mig... (snacks edition)</big></p>
<li> FaxeKondi (gerne i ramme).</li>
<li> Saltede peanuts </li>
<li> Corny Müslibar m. banan og chokolade</li>
<li> MælkeChokolade</li>
<li> HvidChokolade</li>
</ul>
<ul class="lister">
<p><big>Jeg ønsker mig... (gavekort edition)</big></p>
<li> Sport24</li>
<li> Normal</li>
<li> Løvbjerg</p>
<li> Føtex</li>
<li> Lidl</li>
<li> Aldi</li>
<li> MacDonals</li>
<li> Netto</li>
</ul></code></pre>
</div>
</div>
</p>
<p>thanks in advance and sorry if there is some words that have been misspelled</p>
| [
{
"answer_id": 74181304,
"author": "pistevw",
"author_id": 3983968,
"author_profile": "https://Stackoverflow.com/users/3983968",
"pm_score": 1,
"selected": false,
"text": "ul"
},
{
"answer_id": 74181383,
"author": "Adam",
"author_id": 12571484,
"author_profile": "http... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20321529/"
] |
74,181,107 | <p>What is currently the best and easiest way to change CSS style using javascript?
I have several elements on the page with <code>class="colorManipul"</code> and in css <code>.colorManipul{filter: grayscale(33%);}</code>
I want to change the value directly in CSS so that it is reflected on all required elements with this class
Thanks for the advice, link, example, ... just anything</p>
| [
{
"answer_id": 74181304,
"author": "pistevw",
"author_id": 3983968,
"author_profile": "https://Stackoverflow.com/users/3983968",
"pm_score": 1,
"selected": false,
"text": "ul"
},
{
"answer_id": 74181383,
"author": "Adam",
"author_id": 12571484,
"author_profile": "http... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4533246/"
] |
74,181,160 | <p>I have a banner in my react app which I can close:</p>
<p>I persist this state in localStorage:</p>
<pre><code> const [bannerShown, setBannerShown] = useState(true);
useEffect(() => {
const data = localStorage.getItem('MY_APP_STATE');
if (data !== null) {
setBannerShown(JSON.parse(data));
}
}, []);
useEffect(() => {
localStorage.setItem('MY_APP_STATE', JSON.stringify(bannerShown));
}, [bannerShown]);
{bannerShown && (<MyBanner onClick={() => setBannerShown(false)} />)}
</code></pre>
<p>This is working fine. Now I want to <em>add</em> a condition:</p>
<p>I only want to show the banner when it contains a certain query param:</p>
<pre><code>import queryString from 'query-string';
const queryParams = queryString.parse(location.search);
const hasQueryParam = queryString
.stringify(queryParams)
.includes('foo=bar');
</code></pre>
<p>How do I combine above <em>state</em> and <em>boolean</em> (<code>hasQueryParam</code>) in a clean way?</p>
| [
{
"answer_id": 74181278,
"author": "David",
"author_id": 13019276,
"author_profile": "https://Stackoverflow.com/users/13019276",
"pm_score": 0,
"selected": false,
"text": "{bannerShown && hasQueryParam && (<MyBanner onClick={() => setBannerShown(false)} />)}"
},
{
"answer_id": 74... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4822666/"
] |
74,181,179 | <p>I'm struggeling with removing the blinking indicator that pops up when writing something into my textarea. I've tried matching the color to the background color, but that hid my text as well. Does anyone have a quick fix for this in html/css? Thanks a lot ;)</p>
| [
{
"answer_id": 74181278,
"author": "David",
"author_id": 13019276,
"author_profile": "https://Stackoverflow.com/users/13019276",
"pm_score": 0,
"selected": false,
"text": "{bannerShown && hasQueryParam && (<MyBanner onClick={() => setBannerShown(false)} />)}"
},
{
"answer_id": 74... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19895948/"
] |
74,181,181 | <p>Please, how do I make HTML form button disable when countdown date expires, I was able to create a count-down date, but I don't really know how to disable the button once the count-down displays "expired".</p>
<pre><code>// The output of the count-down date
<div class="value text-danger" id="demo"></div>
//html form button
<form>
<input type="text" placeholder="your full name">
<button>Join</button>
</form>
// count down JavaScript
<script>
// Set the date we're counting down to
var countDownDate = new Date("Nov 22, 2022 11:34:38") .getTime();
// Update the count down every 1 second
var x = setInterval(function() {
// Get today's date and time
var now = new Date().getTime();
// Find the distance between now and the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Output the result in an element with id="demo"
document.getElementById("demo").innerHTML = days + " days remaining" ;
// If the count down is over, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById("demo").innerHTML = "EXPIRED";
}
}, 1000);
</script>
</code></pre>
| [
{
"answer_id": 74181278,
"author": "David",
"author_id": 13019276,
"author_profile": "https://Stackoverflow.com/users/13019276",
"pm_score": 0,
"selected": false,
"text": "{bannerShown && hasQueryParam && (<MyBanner onClick={() => setBannerShown(false)} />)}"
},
{
"answer_id": 74... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19203808/"
] |
74,181,186 | <p>I have the following JSON:</p>
<pre><code>{
"ruleName": "PhoneNumber",
"ruleSetInput": [
{
"PersonCode": "85782",
"PhoneTypeId": "1",
"PhoneClassId": "0",
"DiallingCode": "021",
"PhoneNumber": "9321662",
"Extension": "",
"Status": "",
"User": "2",
"DateCapturd": ""
}
]
}
</code></pre>
<p>The JSON won't always have the same fields in the <code>ruleSetInput</code> node. I need to map each value under <code>ruleSetInput</code> to a class with the following class:</p>
<pre class="lang-cs prettyprint-override"><code>public class Parameter
{
public string Name { get; set; }
public string Value { get; set; }
[JsonIgnore]
public int Type { get; set; }
}
</code></pre>
<p>As an example Parameter would be a list and contain a value of:</p>
<blockquote>
<p>Name: "PersonCode", Value: "85782"</p>
</blockquote>
<p>How can I dynamically create this mapping? I have tried <code>Newtonsoft.Json</code> but the mapping will only work if the object that I am deserializing has this exact structure.</p>
| [
{
"answer_id": 74181241,
"author": "Andreas Hässler",
"author_id": 6301242,
"author_profile": "https://Stackoverflow.com/users/6301242",
"pm_score": 1,
"selected": true,
"text": "ruleSetInput"
},
{
"answer_id": 74181486,
"author": "Yong Shun",
"author_id": 8017690,
"a... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5239235/"
] |
74,181,206 | <p>I have my own context manager class: <code>my_context_manager</code>, I want to convert the result to the giving <code>output_type</code>, can be for example <code>str</code>, <code>list</code>, <code>int</code> whatever, I tried to play with the <code>__enter__</code> , <code>__exit__</code> methods, in <code>my_context_manager</code>, but I didn't find how to get the variable used inside the with scope,</p>
<pre class="lang-py prettyprint-override"><code>with my_context_manager(output_type): # output_type can be str, int etc
result = 5 + 2 #( or any other any arithmetical operation operation)
</code></pre>
| [
{
"answer_id": 74181239,
"author": "AKX",
"author_id": 51685,
"author_profile": "https://Stackoverflow.com/users/51685",
"pm_score": 3,
"selected": true,
"text": "with"
},
{
"answer_id": 74182860,
"author": "HichamDz38",
"author_id": 3502460,
"author_profile": "https:... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3502460/"
] |
74,181,211 | <p>Hi Im currently struggling with navigation in <code>Jetpack Compose</code> due to <code>@composable invocations can only happen from the context of an @composable function</code>. I have a function:</p>
<pre><code>private fun signInResult(result: FirebaseAuthUIAuthenticationResult) {
val response = result.idpResponse
if (result.resultCode == RESULT_OK) {
user = FirebaseAuth.getInstance().currentUser
Log.e("MainActivity.kt", "Innlogging vellykket")
ScreenMain()
} else {
Log.e("MainActivity.kt", "Feil med innlogging" + response?.error?.errorCode)
}
}
</code></pre>
<p>and used with my navigation class shown under I only get the error message shown above, how do I fix it?</p>
<pre><code>@Composable
fun ScreenMain(){
val navController = rememberNavController()
NavHost(navController = navController, startDestination = Routes.Vareliste.route) {
composable(Routes.SignUp.route) {
SignUp(navController = navController)
}
composable(Routes.ForgotPassword.route) { navBackStack ->
ForgotPassword(navController = navController)
}
composable(Routes.Vareliste.route) { navBackStack ->
Vareliste(navController = navController)
}
composable(Routes.Handlekurv.route) { navBackStack ->
Handlekurv(navController = navController)
}
composable(Routes.Profileromoss.route) { navBackStack ->
Profileromoss(navController = navController)
}
}
}
</code></pre>
<p><strong>EDIT WITH COMPLETE CODE</strong>
Here is the whole code for the class if you guys wanted to see it!</p>
<pre><code>class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
JetpackComposeDemoTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
) {
LoginPage()
}
}
}
}
private var user: FirebaseUser? = FirebaseAuth.getInstance().currentUser
private lateinit var auth: FirebaseAuth
@Composable
fun LoginPage() {
Box(modifier = Modifier.fillMaxSize()) {
}
Column(
modifier = Modifier.padding(20.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(text = "Velkommen til ITGuys", style = TextStyle(fontSize = 36.sp))
Spacer(modifier = Modifier.height(20.dp))
Box(modifier = Modifier.padding(40.dp, 0.dp, 40.dp, 0.dp)) {
Button(
onClick = { signIn() },
shape = RoundedCornerShape(50.dp),
modifier = Modifier
.fillMaxWidth()
.height(50.dp)
) {
Text(text = "Logg inn")
}
}
}
}
private fun signIn() {
val providers = arrayListOf(
AuthUI.IdpConfig.EmailBuilder().build(),
AuthUI.IdpConfig.GoogleBuilder().build()
)
val signinIntent = AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(providers)
.build()
signInLauncher.launch(signinIntent)
}
private val signInLauncher = registerForActivityResult(
FirebaseAuthUIActivityResultContract()
) {
res -> this.signInResult(res)
}
private fun signInResult(result: FirebaseAuthUIAuthenticationResult) {
val response = result.idpResponse
if (result.resultCode == RESULT_OK) {
user = FirebaseAuth.getInstance().currentUser
Log.e("MainActivity.kt", "Innlogging vellykket")
ScreenMain()
} else {
Log.e("MainActivity.kt", "Feil med innlogging" + response?.error?.errorCode)
}
}
</code></pre>
<p>}</p>
<p>I need to add more text to be allowed to post this much code you can ignore this text cause it is just for being able to post.</p>
| [
{
"answer_id": 74182946,
"author": "z.y",
"author_id": 19023745,
"author_profile": "https://Stackoverflow.com/users/19023745",
"pm_score": 2,
"selected": false,
"text": "Firebase Authentication"
},
{
"answer_id": 74191295,
"author": "sgtpotatoe",
"author_id": 9467134,
... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20291253/"
] |
74,181,247 | <h1>The problem</h1>
<p>I need to use JDK10 to compile a legacy project I have to work on. I know it is a short-term support release whose lifetime has ended. But before the project is updated to a newer Java version I need to be able to build and run it on my development machine.</p>
<blockquote>
<p>Note: The project does build correctly on its CI pipeline and does run on the production environment. The problem is not related to the project but to my machine.</p>
</blockquote>
<p>The problem I am running into is I <strong>cannot compile any java code with JDK10</strong>, but <strong>other JDKs</strong> such as 8, 9, 11, 12 and 17 <strong>do work</strong>.</p>
<h1>Reproduce the problem</h1>
<p>To showcase my problem, I am trying to compile a simple hello world program <code>Test.java</code>:</p>
<pre class="lang-java prettyprint-override"><code>public class Test {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
</code></pre>
<p>I am using the prebuilt JDK from <a href="https://jdk.java.net/archive/" rel="nofollow noreferrer">OpenJDK</a>, but I have also tried and reproduced this problem with the <a href="https://www.azul.com/downloads/?os=ubuntu&architecture=x86-64-bit&package=jdk&show-old-builds=true" rel="nofollow noreferrer">Zulu</a> distribution.</p>
<p>I can consistently reproduce the problem with:</p>
<pre class="lang-bash prettyprint-override"><code>$ wget https://download.java.net/java/GA/jdk10/10.0.2/19aef61b38124481863b1413dce1855f/13/openjdk-10.0.2_linux-x64_bin.tar.gz
...
2022-10-24 14:10:31 (11,1 MB/s) - ‘openjdk-10.0.2_linux-x64_bin.tar.gz’ saved [204892533/204892533]
$ tar -xzf openjdk-10.0.2_linux-x64_bin.tar.gz
$ jdk-10.0.2/bin/java -version
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment 18.3 (build 10.0.2+13)
OpenJDK 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)
$ jdk-10.0.2/bin/javac -version
javac 10.0.2
$ jdk-10.0.2/bin/javac Test.java
Exception in thread "main" java.lang.ClassFormatError: Ille in class file <Unknown>
at java.base/jdk.internal.misc.Unsafe.defineAnonymousClass0(Native Method)
at java.base/jdk.internal.misc.Unsafe.defineAnonymousClass(Unsafe.java:1223)
at java.base/java.lang.invoke.InnerClassLambdaMetafactory.spinInnerClass(InnerClassLambdaMetafactory.java:320)
at java.base/java.lang.invoke.InnerClassLambdaMetafactory.buildCallSite(InnerClassLambdaMetafactory.java:188)
at java.base/java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:317)
at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:330)
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:250)
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:240)
at jdk.compiler/com.sun.tools.javac.code.Symtab.doEnterClass(Symtab.java:700)
at jdk.compiler/com.sun.tools.javac.code.Symtab.enterClass(Symtab.java:714)
at jdk.compiler/com.sun.tools.javac.code.Symtab.enterClass(Symtab.java:275)
at jdk.compiler/com.sun.tools.javac.code.Symtab.<init>(Symtab.java:485)
at jdk.compiler/com.sun.tools.javac.code.Symtab.instance(Symtab.java:89)
at jdk.compiler/com.sun.tools.javac.comp.Attr.<init>(Attr.java:128)
at jdk.compiler/com.sun.tools.javac.comp.Attr.instance(Attr.java:119)
at jdk.compiler/com.sun.tools.javac.comp.Annotate.<init>(Annotate.java:109)
at jdk.compiler/com.sun.tools.javac.comp.Annotate.instance(Annotate.java:84)
at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.<init>(ClassReader.java:235)
at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.instance(ClassReader.java:228)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.<init>(ClassFinder.java:180)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.instance(ClassFinder.java:173)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.<init>(JavaCompiler.java:386)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.instance(JavaCompiler.java:115)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:291)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:165)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
</code></pre>
<h1>Already checked</h1>
<h2>Other JDKs</h2>
<p>With java 11 it works:</p>
<pre class="lang-bash prettyprint-override"><code>$ wget https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz
...
2022-10-24 14:08:42 (10,6 MB/s) - ‘openjdk-11.0.2_linux-x64_bin.tar.gz’ saved [187513052/187513052]
$ tar -xzf openjdk-11.0.2_linux-x64_bin.tar.gz
$ jdk-11.0.2/bin/java -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
$ jdk-11.0.2/bin/javac -version
javac 11.0.2
$ jdk-11.0.2/bin/javac Test.java
$ jdk-11.0.2/bin/java Test
Hello, world!
</code></pre>
<p>It also works with java 9:</p>
<pre class="lang-bash prettyprint-override"><code>$ wget https://download.java.net/java/GA/jdk9/9.0.4/binaries/openjdk-9.0.4_linux-x64_bin.tar.gz
...
2022-10-24 14:31:05 (11,0 MB/s) - ‘openjdk-9.0.4_linux-x64_bin.tar.gz’ saved [206018615/206018615]
$ tar -xzf openjdk-9.0.4_linux-x64_bin.tar.gz
$ jdk-9.0.4/bin/java -version
openjdk version "9.0.4"
OpenJDK Runtime Environment (build 9.0.4+11)
OpenJDK 64-Bit Server VM (build 9.0.4+11, mixed mode)
$ jdk-9.0.4/bin/javac -version
javac 9.0.4
$ jdk-9.0.4/bin/javac Test.java
$ jdk-9.0.4/bin/java Test
Hello, world!
</code></pre>
<p>Same goes with java 8, 12 and 17.</p>
<p>I have also tried the <a href="https://www.azul.com/downloads/?os=ubuntu&architecture=x86-64-bit&package=jdk&show-old-builds=true" rel="nofollow noreferrer">Zulu distributions</a>.</p>
<h2>Fresh install</h2>
<p>I have tried installing a fresh <a href="https://releases.ubuntu.com/22.04/" rel="nofollow noreferrer">Ubuntu 22.04 Desktop image</a> on a VirtualBox. The problem cannot be reproduced. When downloading openjdk 10 and compiling/running the simple <code>Test.java</code> file, it does work as expected. It has to be related to my machine configuration.</p>
<h1>OS information</h1>
<p>Here are some details about my OS:</p>
<pre class="lang-bash prettyprint-override"><code>$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
$ uname --all
Linux Work-Miguel 5.15.0-52-generic #58-Ubuntu SMP Thu Oct 13 08:03:55 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
</code></pre>
| [
{
"answer_id": 74183941,
"author": "Panagiotis Bougioukos",
"author_id": 7237884,
"author_profile": "https://Stackoverflow.com/users/7237884",
"pm_score": 1,
"selected": false,
"text": "$ jdk-10.0.2/bin/javac Test.java\nException in thread \"main\" java.lang.ClassFormatError: Ille in cla... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13688761/"
] |
74,181,269 | <p>I'm building a bash script that needs to send a json payload to an API. The payload below is stored in <code>payload.json</code>, will be used all the time and is in the same path as the script. The <code>""</code> values are what I need to populate with variables from within the same script.</p>
<pre><code>{
"appId": "",
"appName": "",
"authType": "OIDC",
"authSettings": {
"applicationType": "SERVICE",
"clientAuthenticationType": "CLIENT_SECRET",
"grantTypes": [
"CLIENT_CREDENTIALS"
],
"groups": [
""
],
"responseTypes": [
"TOKEN"
],
"inclusion": [
"",
"",
"",
""
],
"tokenValidity": {
"accessTokenLifetimeMinutes": 60,
"refreshTokenLifetimeMinutes": 10080,
"refreshTokenWindowMinutes": 1440
}
}
}
</code></pre>
<p>I'm not sure how to achieve this correctly.</p>
<p>How can I pass single values to <code>.appId</code>, <code>.appName</code> and multiple values to <code>.groups[]</code>, <code>.inclusion[]</code> all at the same time?</p>
<p>I started on this path for each variable but got nowhere:</p>
<pre><code>appId=31337
jq '.appId = "${appId}"' config.json > tempfile.json
</code></pre>
<p>Any help is appreciated.</p>
| [
{
"answer_id": 74181436,
"author": "knittl",
"author_id": 112968,
"author_profile": "https://Stackoverflow.com/users/112968",
"pm_score": 0,
"selected": false,
"text": "--arg"
},
{
"answer_id": 74182847,
"author": "glenn jackman",
"author_id": 7552,
"author_profile": ... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3175368/"
] |
74,181,277 | <p>I have a column in my pandas dataframe which has rows containing the below:</p>
<p>2021-01-04T23:00:00.000+00:00</p>
<p>I would like to split it and keep only the date element and convert the string to a date format:</p>
<p>04/01/2021</p>
<p>I have tried to use split string but I am unable to get to the final stage of then converting to a date format.</p>
<p>Thank you!</p>
| [
{
"answer_id": 74181436,
"author": "knittl",
"author_id": 112968,
"author_profile": "https://Stackoverflow.com/users/112968",
"pm_score": 0,
"selected": false,
"text": "--arg"
},
{
"answer_id": 74182847,
"author": "glenn jackman",
"author_id": 7552,
"author_profile": ... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19631653/"
] |
74,181,292 | <p>Apologies if this has been asked and answered, but I can't see that it has.</p>
<p>I have a hosted form that i want to prepopulate known data with a query string, which can contain multiple dates. The dates don't populate into the form with a forward slash but do with a period; therefore, I'm looking to put a code step into Zapier so that after the URL is formed I can do that replacement and then encode what's left. Zapier has Javascript or Python.</p>
<p>I've got nowhere in Python, but got this far in JS.</p>
<p>let INPUT = inputData.INPUT;</p>
<p>let OUTPUT = INPUT.replace(/b[\d{2}/\d{2}/\d{4}]/g, ".");</p>
<p>output = [{INPUT, OUTPUT}];</p>
<p>I think I'm close but every variation on the above either replaces all the forward slashes or replace everything but the dates with periods.</p>
<p>Thanks in advance</p>
| [
{
"answer_id": 74181436,
"author": "knittl",
"author_id": 112968,
"author_profile": "https://Stackoverflow.com/users/112968",
"pm_score": 0,
"selected": false,
"text": "--arg"
},
{
"answer_id": 74182847,
"author": "glenn jackman",
"author_id": 7552,
"author_profile": ... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20321135/"
] |
74,181,324 | <p>I have table for permission</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>ID</th>
<th>UserID</th>
<th>Date</th>
<th>Permission</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1370</td>
<td>2022/10/24</td>
<td>Approved</td>
</tr>
<tr>
<td>2</td>
<td>1370</td>
<td>2022/10/31</td>
<td>Rejected</td>
</tr>
<tr>
<td>3</td>
<td>1370</td>
<td>2022/11/07</td>
<td>Approved</td>
</tr>
<tr>
<td>4</td>
<td>1370</td>
<td>2022/11/14</td>
<td>Approved</td>
</tr>
<tr>
<td>5</td>
<td>1370</td>
<td>2022/11/21</td>
<td>Rejected</td>
</tr>
<tr>
<td>6</td>
<td>1370</td>
<td>2022/11/28</td>
<td>Rejected</td>
</tr>
<tr>
<td>7</td>
<td>1370</td>
<td>2022/12/05</td>
<td>Rejected</td>
</tr>
<tr>
<td>8</td>
<td>1370</td>
<td>2022/12/12</td>
<td>Approved</td>
</tr>
<tr>
<td>9</td>
<td>1370</td>
<td>2022/12/19</td>
<td>Approved</td>
</tr>
<tr>
<td>10</td>
<td>1370</td>
<td>2022/12/26</td>
<td>Approved</td>
</tr>
<tr>
<td>11</td>
<td>1370</td>
<td>2023/01/02</td>
<td>Rejected</td>
</tr>
<tr>
<td>12</td>
<td>2456</td>
<td>2022/12/26</td>
<td>Rejected</td>
</tr>
<tr>
<td>13</td>
<td>2456</td>
<td>2023/01/02</td>
<td>Rejected</td>
</tr>
<tr>
<td>14</td>
<td>2456</td>
<td>2023/01/09</td>
<td>Approved</td>
</tr>
<tr>
<td>15</td>
<td>2456</td>
<td>2023/01/16</td>
<td>Approved</td>
</tr>
</tbody>
</table>
</div>
<p>I want select query to group dates based on start date and end date</p>
<p>result query like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>UserID</th>
<th>Date From</th>
<th>Date Till</th>
<th>Permission</th>
</tr>
</thead>
<tbody>
<tr>
<td>1370</td>
<td>2022/10/24</td>
<td>2022/10/24</td>
<td>Approved</td>
</tr>
<tr>
<td>1370</td>
<td>2022/10/31</td>
<td>2022/10/31</td>
<td>Rejected</td>
</tr>
<tr>
<td>1370</td>
<td>2022/11/07</td>
<td>2022/11/14</td>
<td>Approved</td>
</tr>
<tr>
<td>1370</td>
<td>2022/11/21</td>
<td>2022/12/05</td>
<td>Rejected</td>
</tr>
<tr>
<td>1370</td>
<td>2022/12/12</td>
<td>2022/12/26</td>
<td>Approved</td>
</tr>
<tr>
<td>1370</td>
<td>2023/01/02</td>
<td>2023/01/02</td>
<td>Rejected</td>
</tr>
<tr>
<td>2456</td>
<td>2022/12/26</td>
<td>2023/01/02</td>
<td>Rejected</td>
</tr>
<tr>
<td>2456</td>
<td>2023/01/09</td>
<td>2023/01/16</td>
<td>Approved</td>
</tr>
</tbody>
</table>
</div>
<p><strong>EDIT:</strong></p>
<p>this is a part of my table for userID = 1370 and 2456. users request for permission and system approve or reject their request. each day can reject or approved. so when i want to response their request , either get them result of all 365 days of year separately , or group rows with start and end date period. –</p>
| [
{
"answer_id": 74189430,
"author": "Arya Basiri",
"author_id": 2593097,
"author_profile": "https://Stackoverflow.com/users/2593097",
"pm_score": 1,
"selected": true,
"text": "Function partID(userID, rowID)\nDim dbs As DAO.Database\nDim rst As DAO.Recordset\n\n Set dbs = CurrentDb\n ... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2593097/"
] |
74,181,334 | <p>I would like to generate an automatic ID attached to every instantiation of a class, respecting the order of appearance of the instantiation statements in the source code. I found this: <a href="https://stackoverflow.com/questions/56128482/how-to-generate-auto-id-in-c">How to generate auto id in c++?</a></p>
<p>At the end of that example it looks like the ID produced by incrementing a static variable is unique and also sequential:</p>
<pre><code>Id id1; // id1.get_id() will return 1
Id id2; // id2.get_id() will return 2
Id id3; // id3.get_id() will return 3
</code></pre>
<p>I can understand the IDs are unique, but can I be sure they are also sequential?
Couldn't be, for instance, I get something like:</p>
<pre><code>Id id1; // id1.get_id() will return 2
Id id2; // id2.get_id() will return 1
Id id3; // id3.get_id() will return 3
</code></pre>
<p>...because who knows in which order the compiler is going to do the instantiations?</p>
<p>Is that ok, or is there a safe way to get the desired result?</p>
<p>Best regards</p>
| [
{
"answer_id": 74189430,
"author": "Arya Basiri",
"author_id": 2593097,
"author_profile": "https://Stackoverflow.com/users/2593097",
"pm_score": 1,
"selected": true,
"text": "Function partID(userID, rowID)\nDim dbs As DAO.Database\nDim rst As DAO.Recordset\n\n Set dbs = CurrentDb\n ... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14265619/"
] |
74,181,344 | <p>I'm trying to figure out how an async main method is started in C#. To do this I would like to create an example of a new Thread that is the same as the async main thread.</p>
<p>This is how it is done without async:</p>
<pre><code>class Program
{
public static void Main(string[] args)
{
Thread t = new Thread(Main2)
{ IsBackground = false };
t.Start();
}
public static void Main2()
{
Console.WriteLine("Helloooo");
Thread.Sleep(1000);
Console.WriteLine("Woooorld");
}
}
</code></pre>
<p>If I run the code above, the following is printed:</p>
<pre><code>Helloooo
Woooorld
</code></pre>
<p>You can see that I don't add a <code>t.Join()</code> that's because t is a foreground thread. But if try to do the same with async the following happens:</p>
<pre><code>class Program
{
public static void Main(string[] args)
{
Thread t = new Thread(Main2)
{ IsBackground = false };
t.Start();
}
// Can't use "public static async Task main2"
// because you need to pass in a void method to a new thread
public static async void Main2()
{
Console.WriteLine("Helloooo");
await Task.Delay(1000);
Console.WriteLine("Woooorld");
}
}
</code></pre>
<p>Only</p>
<pre><code>Helloooo
</code></pre>
<p>Is printed, and the program exits, even though the new thread is a foreground thread. Now I understand what is happening here, When the new thread reaches <code>await Task.Delay(1000);</code> It starts up a state machine and releases the thread for other things. What I want to know is what I have to change to let my original thread die, and let my new thread take over. I want to understand how the async/await chain gets <em>started</em>.</p>
| [
{
"answer_id": 74181487,
"author": "Heinzi",
"author_id": 87698,
"author_profile": "https://Stackoverflow.com/users/87698",
"pm_score": 1,
"selected": false,
"text": "SynchronizationContext.Current"
},
{
"answer_id": 74181556,
"author": "Jeroen van Langen",
"author_id": 2... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1004708/"
] |
74,181,347 | <p>I am trying to add a link to my text so that when the user clicks the text it redirects him to a website, the text is under an item tag which is under a menu tag in my xml file, but I don't know how to make this work. This is what I added so far. This is the xml file for the content of my navigation drawer, the navigation drawer code is in my activty_main.xml which is already functioning.</p>
<pre><code> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="HardcodedText">
<item
android:id="@+id/nav_one"
android:title="link3"
android:text="@string/hyperlink"/>
<item
android:id="@+id/nav_two"
android:title="Settings" />
<item
android:id="@+id/nav_three"
android:title="link1" />
</menu>
</code></pre>
<p>and this is what I added in my string.xml file</p>
<pre><code><string name="hyperlink"><a href="https://www.youtube.com/">start</a></string>
</code></pre>
<p>however the problem is that I don't know how to make it work. I don't know what to add to my mainactivity to make this work. This is what I added to my main activity but it obviously doesn't work.</p>
<pre><code>MenuItem menuItem = findViewById(R.id.nav_one);
menuItem.setMovementMethod(LinkMovementMethod.getInstance());
</code></pre>
<p>What do I have to change and add to make this work?</p>
| [
{
"answer_id": 74181487,
"author": "Heinzi",
"author_id": 87698,
"author_profile": "https://Stackoverflow.com/users/87698",
"pm_score": 1,
"selected": false,
"text": "SynchronizationContext.Current"
},
{
"answer_id": 74181556,
"author": "Jeroen van Langen",
"author_id": 2... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181347",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20205826/"
] |
74,181,351 | <p>how do i split the values in the column COD into 3 columns with different length? in particular as you can see below i need one number on the first column, 2 numbers on the second and 3 on the third. Any idea?</p>
<pre><code>COD CODA CODB CODC
140022 1 40 022
140031 1 40 031
140032 1 40 032
140033 1 40 033
140034 1 40 034
140035 1 40 035
140036 1 40 036
</code></pre>
<p>Thanks!</p>
| [
{
"answer_id": 74181386,
"author": "mozway",
"author_id": 16343464,
"author_profile": "https://Stackoverflow.com/users/16343464",
"pm_score": 4,
"selected": true,
"text": "str.extract"
},
{
"answer_id": 74181557,
"author": "user3435121",
"author_id": 3435121,
"author_... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19693319/"
] |
74,181,356 | <p>I understand it’s rather basic, but I’m only trying to get a grasp on basic functions.</p>
<p>I have produced some code by partially my own knowledge and partial bits from different guides.</p>
<p>I am not getting any errors, but the label is not displaying itself as “Text”. I believe it’s to do with the order/place my code is put.</p>
<p>Please help explain how I can fix this!</p>
<p>Please note as well:</p>
<ul>
<li>I have just a single label called myLabel (named under the document section of my the identity inspector</li>
<li>It is has the text “Loaded” put into it already when I put it in.</li>
<li>I have no other code anywhere, only the default new project code.</li>
<li>I renamed the ViewController to ViewManager to avoid a class error.</li>
</ul>
<p><a href="https://i.stack.imgur.com/lTDXa.jpg" rel="nofollow noreferrer">First image: This is the image just so you know the location and other bits. I’ll attach the code too:</a></p>
<p><a href="https://i.stack.imgur.com/V6a6t.png" rel="nofollow noreferrer">Second image: What I get, with no errors:</a></p>
<p><a href="https://i.stack.imgur.com/zhtGP.jpg" rel="nofollow noreferrer">Third image: My main storyboard file:</a></p>
<p>And now it in code:</p>
<pre><code>import UIKit
class ViewController: UIViewController {
@IBOutlet weak var myLabel: UILabel!
@IBAction func labelSet() {
myLabel.text = "Text"
}
}
</code></pre>
| [
{
"answer_id": 74181386,
"author": "mozway",
"author_id": 16343464,
"author_profile": "https://Stackoverflow.com/users/16343464",
"pm_score": 4,
"selected": true,
"text": "str.extract"
},
{
"answer_id": 74181557,
"author": "user3435121",
"author_id": 3435121,
"author_... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19992481/"
] |
74,181,358 | <p>I'm currently reviewing a program that we're using to populate a custom table since it was experiencing performance issues, and I'm looking for ways to optimize performance. One idea that I came up with was to consolidate loop statements that iterate over similar tables, but I wasn't sure how it would affect the performance and would like to ask for confirmation and/or recommendations if possible. So like the title says, does minimizing <strong>LOOP AT</strong>-statements improve overall runtime efficiency?</p>
<p>Shown below is a simplified example of the original code with 2 loops that are separated with different <strong>WHERE</strong>-clause, and then the latter is my idea to consolidate the loop and separate it into multiple <strong>ELSEIF</strong>-statements as needed.</p>
<p><strong>ORIGINAL CODE:</strong></p>
<pre><code>IF param = 'X'.
LOOP AT lt_intab
INTO wa_intab
WHERE field_one = const_one.
SELECT *
FROM db_table
WHERE field_two = wa_intab-field_two.
MOVE-CORRESPONDING db_table TO wa_outtab.
APPEND wa_outtab TO lt_outtab.
CLEAR wa_outtab.
ENDSELECT.
ENDLOOP.
ENDIF.
LOOP AT lt_intab
INTO wa_intab
WHERE field_one = const_two.
SELECT *
FROM db_table
WHERE field_three = wa_intab-field_three.
MOVE-CORRESPONDING db_table TO wa_outtab.
APPEND wa_outtab TO lt_outtab.
CLEAR wa_outtab.
ENDSELECT.
ENDLOOP.
</code></pre>
<p><strong>OPTIMIZED CODE:</strong></p>
<pre><code>LOOP AT lt_intab
INTO wa_intab
IF param = 'X'
AND wa_intab-field_one = const_one.
SELECT *
FROM db_table
WHERE field_two = wa_intab-field_two.
MOVE-CORRESPONDING db_table TO wa_outtab.
APPEND wa_outtab TO lt_outtab.
CLEAR wa_outtab.
ENDSELECT.
ELSEIF wa_intab-field_one = const_two.
SELECT *
FROM db_table
WHERE field_three = wa_intab-field_three.
MOVE-CORRESPONDING db_table TO wa_outtab.
APPEND wa_outtab TO lt_outtab.
CLEAR wa_outtab.
ENDSELECT.
ENDIF.
ENDLOOP.
</code></pre>
<p>Is the optimized code a better approach of looping through similar tables?</p>
| [
{
"answer_id": 74181870,
"author": "peterulb",
"author_id": 6874359,
"author_profile": "https://Stackoverflow.com/users/6874359",
"pm_score": 3,
"selected": true,
"text": "field_one"
},
{
"answer_id": 74185947,
"author": "Pearli",
"author_id": 7935435,
"author_profile... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181358",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16693377/"
] |
74,181,374 | <p>I have a large dataframe which combines data from multiple excel (xlsx) files. The problem is every column with decimal values is seperated with a dot.I need to replace every dot with a comma. I have already tried using the replace function, but the issue some columns also contains string values. So my question is, how do I replace dot with comma on each column in my dataframe and also keep the string values?</p>
<p>Example:</p>
<p>Column a: <br>
14.01 -> 14,01 <br>
No data (keep)</p>
| [
{
"answer_id": 74181870,
"author": "peterulb",
"author_id": 6874359,
"author_profile": "https://Stackoverflow.com/users/6874359",
"pm_score": 3,
"selected": true,
"text": "field_one"
},
{
"answer_id": 74185947,
"author": "Pearli",
"author_id": 7935435,
"author_profile... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1020623/"
] |
74,181,399 | <p>So I made a simple piece of code to add 1 to a value. I create two process and I am creating a pipe for storage the information beetween iterations. In the first cycle it gives the correct value but in the second iterration it gives two errors.
My code:</p>
<pre><code>def processMain():
number = 0
r, w = os.pipe()
for _ in range(2):
pid = os.fork()
if pid == 0:
number = int(number)
number += 1
number = str(number)
os.close(r)
w = os.fdopen(w, "w")
w.write(number)
print("write")
sys.exit(0)
else:
os.wait()
os.close(w)
r = os.fdopen(r)
number = r.read()
print("read")
print(number)
</code></pre>
<p>I excute the function and it gives me this results:</p>
<pre><code>write
read
Traceback (most recent call last):
File "/home/aluno-di/area-de-aluno/SO/projeto/grupoXX/tests.py", line 31, in <module>
processMain()
File "/home/aluno-di/area-de-aluno/SO/projeto/grupoXX/tests.py", line 15, in processMain
os.close(r)
TypeError: '_io.TextIOWrapper' object cannot be interpreted as an integer
Traceback (most recent call last):
File "/home/aluno-di/area-de-aluno/SO/projeto/grupoXX/tests.py", line 31, in <module>
processMain()
File "/home/aluno-di/area-de-aluno/SO/projeto/grupoXX/tests.py", line 24, in processMain
os.close(w)
OSError: [Errno 9] Bad file descriptor
</code></pre>
<p>I don't understand what I am doing wrong or what I am not doing that I need to do to this work.</p>
| [
{
"answer_id": 74181870,
"author": "peterulb",
"author_id": 6874359,
"author_profile": "https://Stackoverflow.com/users/6874359",
"pm_score": 3,
"selected": true,
"text": "field_one"
},
{
"answer_id": 74185947,
"author": "Pearli",
"author_id": 7935435,
"author_profile... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17464079/"
] |
74,181,450 | <p>I have a modal, and this modal has two interfaces, the first is “QRReader” and the second is “PatientForm”, and the modal has two buttons, the first is “Approve” and the second is “Cancel”.
And I want to hide the two buttons within the interface of the "QRReader"</p>
<p>How can i solve the problem?</p>
<p>And this file contains the entire modal, knowing that the BasicModal tag is modal</p>
<pre><code>import { Button, Col, Row } from "antd";
import {
useState
} from "react";
import { QrReader } from "react-qr-reader";
import patient from "../../../api/nuclearMedicineApi/services/Patient";
import { decrypt } from "../../../utils/decryption";
import PatientForm from "./form";
import { QrcodeOutlined } from '@ant-design/icons';
import BasicModal from "../modal";
import { FormattedMessage } from "react-intl";
import { notify } from "../notification";
const QRScanner = () => {
const [data, setData] = useState<number>(0);
const [patientInfoData, setPatientInfoData] = useState({})
const [modelVisible, setModelVisible] = useState<any>();
console.log('datadatadata: ', data)
const openNotificationWithIcon = () => {
// onSuccess: (data) => {
notify('success', 'ok', 'approve-message');
// },
};
return (
<>
<QrcodeOutlined
className='cursor-pointer'
style={{ fontSize: '2rem' }}
color={'#fff'}
onClick={(e) => {
e.stopPropagation()
setModelVisible(true)
}}
/>
<BasicModal
header={<>
<h2 className='text-primary'><FormattedMessage id="qr-scanner" /></h2>
</>}
content={
<>
{
data !=0 ?
<PatientForm patientInfoData={patientInfoData} data={data} />
:
<Row>
<Col span={18} offset={3}>
<QrReader
onResult={async (result: any, error) => {
if (!!result) {
const t = result?.text;
const d = decrypt(t);
let zz: any = d.match(/(\d+)/)
Math.floor(zz[0])
setData(zz[0]);
const pationInfo = await patient.patientGet({ Id: Number(zz[0]) })
setPatientInfoData(pationInfo)
}
if (!!error) {
console.info(error);
}
}} // style={{ width: '100%' }}
constraints={{ facingMode: 'user' }}
// style={{ width: '100%' }}
/>
</Col>
</Row>
}
<Row>
<Col span={1} offset={3}>
<Button
type='primary'
className='savebtn'
onClick={() => {
patient.switchToPresent(data || 0)
openNotificationWithIcon()
}}
>
<FormattedMessage id={'approve'} />
</Button>
</Col>
<Col span={8} offset={4}>
<Button
type='default'
className='savebtn'
onClick={() => {
setModelVisible(false);
setData(0);
}}
>
<FormattedMessage id={'cancel'} />
</Button>
</Col>
</Row>
</>
}
isOpen={modelVisible}
footer={false}
width='50vw'
handleCancel={() => {
setModelVisible(false);
}}
afterClose={
() => setData(0)
}
/>
</>
)
};
export default QRScanner;
</code></pre>
| [
{
"answer_id": 74181716,
"author": "TheFlorinator",
"author_id": 8900764,
"author_profile": "https://Stackoverflow.com/users/8900764",
"pm_score": 1,
"selected": false,
"text": "{ data = 0 && (\n <Row>\n <Col span={1} offset={3}>\n <Button\n type='primary'\n classN... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16377085/"
] |
74,181,482 | <p>I have int number of the type yyyy000000 y can be 1 or 0 if the first y is 0 th len is 9 instead of 10</p>
<p>for example :</p>
<p>1111000000
111000000
0
1010000000</p>
<p>it is type of int..</p>
<p>what is the best way to check if the secound digit is 1 or the first?</p>
<p>every one of the first four mean something</p>
<p>It is posible to do something like <code>1111000000.ToString()[1] == '1'</code></p>
<p>but is will take long time to cast of to sting if I run on alot of data.. there is any faster way to do it?</p>
| [
{
"answer_id": 74181702,
"author": "Nekura",
"author_id": 5908198,
"author_profile": "https://Stackoverflow.com/users/5908198",
"pm_score": 2,
"selected": false,
"text": "if (x < 1000000000) {\n // First digit is 0\n} else {\n // First digit is 1\n}\n"
},
{
"answer_id": 74182... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1626763/"
] |
74,181,512 | <p>I am trying to change the name of a sheet according to the value of a cell.</p>
<p>here is the code I am using.</p>
<pre><code>
from openpyxl import load_workbook
wb = load_workbook('file_name.xlsx')
ws = wb['Sheet 1']
sheet_name = ws['B2']
ws.title = f'Marketing {sheet_name}'
</code></pre>
<p>This code works, but
my problem is I only need to extract the first 3 characters from the cell ws['B2'].
How can I do that.</p>
| [
{
"answer_id": 74181638,
"author": "BigBen",
"author_id": 9245853,
"author_profile": "https://Stackoverflow.com/users/9245853",
"pm_score": 2,
"selected": false,
"text": "sheet_name = ws['B2'].value[:3]\n"
},
{
"answer_id": 74193805,
"author": "Henrique Ianni Silva",
"aut... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20240047/"
] |
74,181,574 | <p>I am writing a program to open other programs for me. os.system() would always freeze my app, so I switched to subprocess. I did some research and this is how a tutorial told me to open a program. I have only replaced the path for my variable, which contains the path. After I run this, only a commabd prompt window opens and nothing else. How can I fix this?
Code:</p>
<pre><code>from subprocess import Popen
filename1 = "C:/Program Files/Google/Chrome/Application/chrome.exe"
Popen(["cmd", "/c", "start", filename1)
</code></pre>
| [
{
"answer_id": 74181638,
"author": "BigBen",
"author_id": 9245853,
"author_profile": "https://Stackoverflow.com/users/9245853",
"pm_score": 2,
"selected": false,
"text": "sheet_name = ws['B2'].value[:3]\n"
},
{
"answer_id": 74193805,
"author": "Henrique Ianni Silva",
"aut... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19973965/"
] |
74,181,654 | <p>I'm trying to recreate Apple's festival lights image in SwiftUI (screenshot from Apple India's website). Expected result:</p>
<p><a href="https://i.stack.imgur.com/Mp1J7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mp1J7.png" alt="Apple India Diwali logo" /></a></p>
<p>Here's what I've managed to achieve so far:</p>
<p><a href="https://i.stack.imgur.com/D3mGR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D3mGR.png" alt="enter image description here" /></a></p>
<p>MY UNDERSTANDING SO FAR: Images are not Shapes, so we can't stroke their borders, but I also found that shadow() modifier places shadows on image borders just fine. So, I need a way to customize the shadow somehow and understand how it works.</p>
<p>WHAT I'VE TRIED SO FAR: Besides the code above, I tried to unsuccessfully convert a given SF Symbol to a <code>Shape</code> using Vision framework's contour detection, based on my understanding of this article: <a href="https://www.iosdevie.com/p/new-in-ios-14-vision-contour-detection" rel="nofollow noreferrer">https://www.iosdevie.com/p/new-in-ios-14-vision-contour-detection</a></p>
<p>Can someone please guide me on how I would go about doing this, preferably using SF symbols only.</p>
| [
{
"answer_id": 74197544,
"author": "DonMag",
"author_id": 6257435,
"author_profile": "https://Stackoverflow.com/users/6257435",
"pm_score": 2,
"selected": true,
"text": "Vision"
},
{
"answer_id": 74205286,
"author": "technusm1",
"author_id": 4385319,
"author_profile":... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4385319/"
] |
74,181,676 | <p>I am trying to set up a variable that contains a string representation of a value with leading zeroes. I know I can printf to terminal the value, and I can pass the string output of printf to a variable. It seems however that assigning the value string to a new variable reinterprets the value and if I then print it, the value has lost its leading zeroes.</p>
<p>How do we work with variables in bash scripts to avoid implicit type inferences and ultimately how do I get to the solution I'm looking for. FYI I'm looking to concatenate a large fixed length string numeric, something like a part number, and build it from smaller prepared strings.</p>
<p><strong>Update:</strong></p>
<p>Turns out exactly how variables are assigned changes their interpretation in some way, see below:</p>
<p><strong>Example:</strong></p>
<pre><code>#!/bin/bash
a=3
b=4
aStr=$(printf %03d $a)
bStr=$(printf %03d $b)
echo $aStr$bStr
</code></pre>
<p>output</p>
<pre><code>$ ./test.sh
003004
$
</code></pre>
<p>Alternate form:</p>
<pre><code>#!/bin/bash
((a = 3))
((b = 4))
((aStr = $(printf %03d $a)))
((bStr = $(printf %03d $b)))
echo $aStr$bStr
</code></pre>
<p>output</p>
<pre><code>$ ./test.sh
34
$
</code></pre>
| [
{
"answer_id": 74181986,
"author": "KamilCuk",
"author_id": 9072753,
"author_profile": "https://Stackoverflow.com/users/9072753",
"pm_score": 2,
"selected": false,
"text": "declare -i var"
},
{
"answer_id": 74182459,
"author": "user1934428",
"author_id": 1934428,
"aut... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/576262/"
] |
74,181,687 | <p>I'm looking for insert many values in a table and take the ID refernce from another table. I have tried diffent ways, and finaly I have found this that works.</p>
<pre><code>INSERT INTO tblUserFreeProperty (id, identname, val, pos)
VALUES ((SELECT id FROM tblpart where tblPart.ordernr=N'3CFSU05'),N'DSR_Mag.G', N'??_??@False', 1),
((SELECT id FROM tblpart where tblPart.ordernr=N'3CFSU05'),N'DSR_Mag.Qta_C', N'??_??@0', 2),
((SELECT id FROM tblpart where tblPart.ordernr=N'3CFSU05'),N'DSR_Mag.Qta_M', N'??_??@0', 3),
((SELECT id FROM tblpart where tblPart.ordernr=N'3CFSU05'),N'DSR_Mag.UbicM', N'??_??@No', 4),
((SELECT id FROM tblpart where tblPart.ordernr=N'3CFSU05'),N'DSR_Mag.UbicS', N'??_??@', 5),
((SELECT id FROM tblpart where tblPart.ordernr=N'3CFSU05'),N'DSR_Mag.UbicP', N'??_??@', 6),
((SELECT id FROM tblpart where tblPart.ordernr=N'3CFSU05'),N'DSR_Mag.UbicC', N'??_??@', 7);
</code></pre>
<p>This works, but I'm looking for a "easy query" because I need to write the command from Visual Studio</p>
| [
{
"answer_id": 74181986,
"author": "KamilCuk",
"author_id": 9072753,
"author_profile": "https://Stackoverflow.com/users/9072753",
"pm_score": 2,
"selected": false,
"text": "declare -i var"
},
{
"answer_id": 74182459,
"author": "user1934428",
"author_id": 1934428,
"aut... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5575430/"
] |
74,181,689 | <p>I want to create a new column in pandas in which I get a comment that says: Opened today() need update in today + 8 days. This is what I've got, but have not been able to fix this error.</p>
<p>This is my code:</p>
<pre><code>import pandas as pd
import datetime
from datetime import timedelta
Today = datetime.date.today()
def add_days_to_date(date, days):
subtracted_date = pd.to_datetime(date) + timedelta(days=days)
subtracted_date = subtracted_date.strftime("%m-%d")
return(subtracted_date)
RepliedSent_date = ("Opened", Today, "need update", add_days_to_date(Today, 8))
df.loc[(df['col1'] != ' ') & (df['col2'] != ' '), "Replied/sent date"] = RepliedSent_date
</code></pre>
<p>Any help would be greatly appreciated! Thanks.</p>
| [
{
"answer_id": 74181986,
"author": "KamilCuk",
"author_id": 9072753,
"author_profile": "https://Stackoverflow.com/users/9072753",
"pm_score": 2,
"selected": false,
"text": "declare -i var"
},
{
"answer_id": 74182459,
"author": "user1934428",
"author_id": 1934428,
"aut... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20264459/"
] |
74,181,699 | <p>My goal is to web scrape a dynamic web page's HTML using Playwright for Python.
Within an ordered list, there are multiple list items, and each contains multiple spans, of which one span has a button / link. Once there is a click on the button, it will execute further code and scrape the HTML using BeautifulSoup.</p>
<p>Here is an example of the structure.</p>
<pre><code><script>
function demoA () { alert("Button clicked"); }
</script>
<h2>Simple list with buttons</h2>
<div class="simlist">
<ol class="list_ord">
<li class="header-section_ord"><span
class="item">Category </span><span
class="item">Count </span></li>
<li class="item_ord"><span>Beginner</span><span>6</span><button
class="item_ord" onclick="demoA()">Information</button></li>
<li class="item_ord"><span>Advanced</span><span>2</span><button
class="item_ord" onclick="demoA()">Information</button></li>
</ol>
</div>
</code></pre>
<p>I've been able to get Playwright to click on the button I want, using this Python code.</p>
<pre><code>from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.firefox.launch()
page = browser.new_page()
page.goto('http://localhost:1234/SimpleListButtons.html')
print("Opened content page")
item_locator = page.locator('li').filter(has_text='Advanced').filter(has=page.get_by_role('button'))
print(item_locator.inner_html())
item_locator.locator('button').click()
print("Button clicked")
</code></pre>
<p>My questions:</p>
<ol>
<li>With the above code, I'm able to select the button which I want to be clicked using filter criteria. Is there a better way to do it?</li>
<li>How can one iterate through the list items e.g. in a for loop and click each list item's button (and subsequently do further scraping?</li>
</ol>
| [
{
"answer_id": 74181986,
"author": "KamilCuk",
"author_id": 9072753,
"author_profile": "https://Stackoverflow.com/users/9072753",
"pm_score": 2,
"selected": false,
"text": "declare -i var"
},
{
"answer_id": 74182459,
"author": "user1934428",
"author_id": 1934428,
"aut... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9492754/"
] |
74,181,722 | <p>I have a data feed that I download on a regular bases into a csv. It looks like this</p>
<pre><code>TABLE # 196712 / 9000_
>= 10 : 0.002
>= 5 : 0.001
>= 2 : 0.0005
>= 1 : 0.0002
>= 0.5 : 0.0001
>= 0.2 : 0.0001
>= 0.1 : 0.0001
>= 0.0001 : 0.0001
TABLE # 196714 / Dark
>= 0.0001 : 5e-05
TABLE # 196715 / GBD
>= 25 : 0.01
>= 10 : 0.005
>= 5 : 0.0025
>= 0.1 : 0.001
>= 0.0005 : 0.005
</code></pre>
<p>I would like to parse the file and categorize the data into a dictionary, where the number after the hash is a unique id (the new dict key) and the following rows (starting with >=) are volumes plus associated penalty values.</p>
<p>s.th like this would work:</p>
<pre><code>{196712: [(10,0.002),(5,0.001),(2,0.0005),(1,0.0002),(0.5,0.0001),(0.2,0.0001),(0.1,0.0001),(0.0001, 0.0001)],
196714: [(0.0001,5e-05)],
196715: [(25,0.01),(10,0.005),(5,0.0025),(0.1,0.001),(0.0005,0.005)]}
</code></pre>
<p>What I would do to filter it outside python would be a grep and get the following lines, however the varying number of lines between IDs makes it more complex. Any other suggested more convenient data structure could be used as well.</p>
| [
{
"answer_id": 74181821,
"author": "Andrej Kesely",
"author_id": 10035985,
"author_profile": "https://Stackoverflow.com/users/10035985",
"pm_score": 2,
"selected": true,
"text": "s = \"\"\"\\\nTABLE # 196712 / 9000_\n>= 10 : 0.002\n>= 5 : 0.001\n>= 2 : 0.0005\n>= 1 : 0.0002\n>... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1612060/"
] |
74,181,735 | <p>I am new to the concept of Redux, Just trying to add a className to a div in App.js when the redux state change.</p>
<pre><code>const menuToggle = useSelector((state) => state.menuToggle);
<div className="App">
<div className={`layout-wrapper ${menuToggle ? 'toggled' : ''}`}>
<div className="layout-container">
</code></pre>
<p>Redux State is getting change
<a href="https://i.stack.imgur.com/EdIzc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EdIzc.png" alt="enter image description here" /></a></p>
<p>when menuToggle turns true then the className is getting added. But when it is updating as false the App.js not re-rendering.</p>
<p><a href="https://i.stack.imgur.com/eP4Ez.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eP4Ez.png" alt="enter image description here" /></a></p>
<p>Can anybody tell me what I am missing?</p>
| [
{
"answer_id": 74181821,
"author": "Andrej Kesely",
"author_id": 10035985,
"author_profile": "https://Stackoverflow.com/users/10035985",
"pm_score": 2,
"selected": true,
"text": "s = \"\"\"\\\nTABLE # 196712 / 9000_\n>= 10 : 0.002\n>= 5 : 0.001\n>= 2 : 0.0005\n>= 1 : 0.0002\n>... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181735",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20216412/"
] |
74,181,747 | <p>What is the right syntax for searching an excel table connected with Excel Online for Business connector?</p>
<p>I've tried the following things:</p>
<p><a href="https://i.stack.imgur.com/9p2uM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9p2uM.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/qZxhO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qZxhO.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/m1REj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/m1REj.png" alt="enter image description here" /></a></p>
| [
{
"answer_id": 74226554,
"author": "Ganesh Sanap",
"author_id": 8624276,
"author_profile": "https://Stackoverflow.com/users/8624276",
"pm_score": 0,
"selected": false,
"text": ";"
}
] | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14859193/"
] |
74,181,758 | <p>This is my code written in C++ that is supposed to produce 2 triangles, however I am getting a blank screen. Is there something I am missing?</p>
<pre><code>#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <glm/vec3.hpp> // glm::vec3
#include <glm/vec4.hpp> // glm::vec4
#include <glm/mat4x4.hpp> // glm::mat4
#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
using namespace std;
static string ParseShader(string filepath) {
ifstream stream(filepath);
string line;
stringstream stringStream;
while (getline(stream, line))
{
stringStream << line << '\n';
}
return stringStream.str();
}
static unsigned int CompileShader(unsigned int type, const string& source) {
unsigned int id = glCreateShader(type);
const char* src = source.c_str(); // this returns a pointer to data inside the string, the first character
glShaderSource(id, 1, &src, nullptr); // shader id, count of source codes, a pointer to the array that holds the strings
glCompileShader(id);
int result;
glGetShaderiv(id, GL_COMPILE_STATUS, &result);
if (result == GL_FALSE) {
int length;
glGetShaderiv(id, GL_INFO_LOG_LENGTH, &length);
char* message = (char*)alloca(length * sizeof(char));
glGetShaderInfoLog(id, length, &length, message);
cout << type << endl;
cout << message << endl;
glDeleteShader(id);
return 0;
}
return id;
}
// takes the shader codes as a string parameters
static unsigned int CreateShader(const string& vertexShader, const string& fragmentShader)
{
GLuint program = glCreateProgram();
unsigned int vs = CompileShader(GL_VERTEX_SHADER, vertexShader);
unsigned int fs = CompileShader(GL_FRAGMENT_SHADER, fragmentShader);
glAttachShader(program, vs);
glAttachShader(program, fs);
glLinkProgram(program);
glValidateProgram(program); // validate if the program is valid and can be run in the current state of opengl
glDeleteShader(vs);
glDeleteShader(fs);
return program;
}
int main(void)
{
GLFWwindow* window;
float Angle = 0;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
// call glewInit after creating the context...
GLenum err = glewInit();
if (GLEW_OK != err)
{
/* Problem: glewInit failed, something is seriously wrong. */
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
}
GLfloat coordinates[12] = {
-0.5f, 0.5f,
0.0f, 0.5f,
0.5f, 0.5f,
-0.5f, -0.5f,
0.0f, -0.5f,
0.5f, -0.5f
};
GLuint indices[6] = { 0, 3, 1, 4, 2, 5 };
GLuint position_buffer;
glGenBuffers(1, &position_buffer);
glBindBuffer(GL_ARRAY_BUFFER, position_buffer);
glBufferData(GL_ARRAY_BUFFER, 6 * 2 * sizeof(float), coordinates, GL_STATIC_DRAW);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, 0); //vertex positions
glEnableVertexAttribArray(0);
GLuint index_buffer;
glGenBuffers(1, &index_buffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, 6 * sizeof(GLuint), indices, GL_STATIC_DRAW);
string vertexSource = ParseShader("vertex.shader");
string fragmentSource = ParseShader("fragment.shader");
unsigned int program = CreateShader(vertexSource, fragmentSource);
glUseProgram(program);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
// Render here
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDrawElements(GL_TRIANGLE_STRIP, 6, GL_UNSIGNED_INT, nullptr);
//Swap front and back buffers
glfwSwapBuffers(window);
// Poll for and process events
glfwPollEvents();
}
glDeleteProgram(program);
glfwTerminate();
return 0;
}
</code></pre>
<p>This is my vertex shader.</p>
<pre><code>#version 330 core
layout(location = 0) in vec4 position;
layout(location = 1) in vec4 color;
out vec4 var_color;
void main()
{
var_color = color;
gl_Position = position;
};
</code></pre>
<p>And here is my fragment shader.</p>
<pre><code>#version 330 core
out vec4 color;
in vec4 var_color;
void main()
{
//color = vec4(1.0f, 0.0f, 0.0f, 1.0f);
color = var_color;
//discard;
};
</code></pre>
<p>I get a black screen as a result, I doubt this is an issue with my machine as other code snippets worked on it.</p>
| [
{
"answer_id": 74182394,
"author": "Gilles-Philippe Paillé",
"author_id": 11292489,
"author_profile": "https://Stackoverflow.com/users/11292489",
"pm_score": 3,
"selected": true,
"text": "GLfloat colors[24] = { // Random colors\n 1.0f, 1.0f, 1.0f, 1.0f,\n 1.0f, 0.0f, 1.0f, 1.0f,\... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13005243/"
] |
74,181,779 | <p>To be more specific, my source code is compiled and linked successfully when I am running it from inside the container.
However, when I am trying to build the image from a Dockerfile it fails.
i.e.:</p>
<p>this works (These lines are from the terminal "inside" the container):</p>
<pre><code>cd AppFolder; make; //success
</code></pre>
<p>this does not (These are lines from the dockerfile):</p>
<pre><code>RUN git clone <url> && cd APPFolder && make
</code></pre>
<p>Now I get:</p>
<pre><code>/usr/bin/ld: warning: libcuda.so.1 needed by...
</code></pre>
<p>How can I build the application from the dockerfile?</p>
| [
{
"answer_id": 74182394,
"author": "Gilles-Philippe Paillé",
"author_id": 11292489,
"author_profile": "https://Stackoverflow.com/users/11292489",
"pm_score": 3,
"selected": true,
"text": "GLfloat colors[24] = { // Random colors\n 1.0f, 1.0f, 1.0f, 1.0f,\n 1.0f, 0.0f, 1.0f, 1.0f,\... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7158576/"
] |
74,181,782 | <p>I'm getting this issue after upgrading angular version to the latest in my project:</p>
<p>The type 'string' is not assignable to type 'ReportTeamFilter[]'</p>
<p>the problem is when I do searchOptions.BusinessLst = this.business.value;</p>
<pre><code>business = new FormControl('');
var searchOptions: DelegateSearch = new DelegateSearch();
searchOptions.BusinessLst = this.business.value;
</code></pre>
<p>delegate.ts</p>
<pre><code>import { ReportingFilter }
export class DelegateSearch {
public BusinessLst: ReportingTeamFilter[];
constructor() {}
}
</code></pre>
<p>reporting-model.ts</p>
<pre><code>export class ReportingTeamFilter {
public Id: number;
public Name: string;
public Date: Date;
constructor(){}
}
</code></pre>
<p>Any idea on how to fix this issue?</p>
<p>Thank you</p>
| [
{
"answer_id": 74181939,
"author": "Fabian Strathaus",
"author_id": 17298437,
"author_profile": "https://Stackoverflow.com/users/17298437",
"pm_score": 2,
"selected": true,
"text": "business = new FormControl('');"
},
{
"answer_id": 74181993,
"author": "Bozhinovski",
"aut... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2246242/"
] |
74,181,799 | <p>(sorry for my English), i'm trying to use ursina on visual studio but when i run my code the IDE show a file: texture.py and and in particular the error: no module named 'direct'
I try to install direct but there are other error and i don't understand why for me this module is necessary and in internet i don't found of it nothing.</p>
<p>thanks for the help</p>
<p>sorry,<a href="https://i.stack.imgur.com/w5TM6.png" rel="nofollow noreferrer">the start of the error</a></p>
<p><a href="https://i.stack.imgur.com/Cf9a5.png" rel="nofollow noreferrer">the error</a></p>
<p><a href="https://i.stack.imgur.com/qaugh.png" rel="nofollow noreferrer">the error</a></p>
| [
{
"answer_id": 74248087,
"author": "pokepetter",
"author_id": 12811086,
"author_profile": "https://Stackoverflow.com/users/12811086",
"pm_score": 1,
"selected": false,
"text": "direct"
},
{
"answer_id": 74254318,
"author": "Lixt",
"author_id": 11647955,
"author_profil... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20321947/"
] |
74,181,819 | <p>I would like to develop an IOS app to get notification such as title and body from all applications in iPhone. Is it possible to do that?</p>
| [
{
"answer_id": 74248087,
"author": "pokepetter",
"author_id": 12811086,
"author_profile": "https://Stackoverflow.com/users/12811086",
"pm_score": 1,
"selected": false,
"text": "direct"
},
{
"answer_id": 74254318,
"author": "Lixt",
"author_id": 11647955,
"author_profil... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20269970/"
] |
74,181,826 | <p>I am struggling with figuring out how to return a conditional value to a column based on values in selected columns on same index row. see the attached picture.</p>
<ol>
<li><p>I have a df where "<0" column is supposed to count the number of instances in previous 18 columns where valueas are less than 0.</p>
</li>
<li><p>I also need to count the total number of columns excluding NaN for each row.</p>
</li>
</ol>
<p>any suggestions?</p>
<p><a href="https://i.stack.imgur.com/uaDI8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uaDI8.png" alt="enter image description here" /></a></p>
| [
{
"answer_id": 74248087,
"author": "pokepetter",
"author_id": 12811086,
"author_profile": "https://Stackoverflow.com/users/12811086",
"pm_score": 1,
"selected": false,
"text": "direct"
},
{
"answer_id": 74254318,
"author": "Lixt",
"author_id": 11647955,
"author_profil... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17336035/"
] |
74,181,841 | <p>I use Wordpress with Woocommerce plugin, and now all product reviews go to "approved" section in Products -> Reviews.
I need to make it goes in waitlist by default instead.
Can't find solution, maybe i'm blind)
So how can i do it?</p>
| [
{
"answer_id": 74248087,
"author": "pokepetter",
"author_id": 12811086,
"author_profile": "https://Stackoverflow.com/users/12811086",
"pm_score": 1,
"selected": false,
"text": "direct"
},
{
"answer_id": 74254318,
"author": "Lixt",
"author_id": 11647955,
"author_profil... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20322087/"
] |
74,181,852 | <p>I want to uninstall a program. There can be several versions of this program installed at the same time. I want to uninstall them with the uninstall string from the registry.</p>
<p>I need to get the subkeys of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
which contain the words "jump client" and "cloud". If the name of the subkey contains these words, then I need to get the Display Name and the Uninstall String. The Display Name also contains these two words.</p>
<p>For example:
I need the Uninstall String and Display Name of "123-Jump Client – 189.38-cloud" and the Uninstall String and Display Name of "245-Jump Client – 184-cloud".
<a href="https://i.stack.imgur.com/lgFUY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lgFUY.png" alt="enter image description here" /></a></p>
<p>I tried</p>
<pre><code>Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"|Where-Object {$_.DisplayName -contains "jump client" -and $_.DisplayName -contains "cloud"}
</code></pre>
<p>That does not work.</p>
<p>Thanks!</p>
| [
{
"answer_id": 74182015,
"author": "Theo",
"author_id": 9898643,
"author_profile": "https://Stackoverflow.com/users/9898643",
"pm_score": 2,
"selected": false,
"text": "-contains"
},
{
"answer_id": 74182875,
"author": "zett42",
"author_id": 7571258,
"author_profile": ... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18209625/"
] |
74,181,856 | <p>I get this message on the front page of my website:</p>
<blockquote>
<p>Fatal error: Uncaught Error: Call to undefined function create_function() in /customers/7/e/7/jovobytes.be/httpd.www/wp-content/themes/inovado/framework/inc/widgets/custommenu.php:67 Stack trace: #0 /customers/7/e/7/jovobytes.be/httpd.www/wp-content/themes/inovado/functions.php(39): include_once() #1 /customers/7/e/7/jovobytes.be/httpd.www/wp-settings.php(566): include('/customers/7/e/...') #2 /customers/7/e/7/jovobytes.be/httpd.www/wp-config.php(96): require_once('/customers/7/e/...') #3 /customers/7/e/7/jovobytes.be/httpd.www/wp-load.php(50): require_once('/customers/7/e/...') #4 /customers/7/e/7/jovobytes.be/httpd.www/wp-blog-header.php(13): require_once('/customers/7/e/...') #5 /customers/7/e/7/jovobytes.be/httpd.www/index.php(17): require('/customers/7/e/...') #6 {main} thrown in /customers/7/e/7/jovobytes.be/httpd.www/wp-content/themes/inovado/framework/inc/widgets/custommenu.php on line 67</p>
</blockquote>
<p>so i looked up the corresponding file of the theme and need to rewrite the code so it's compatible with php 8.0. Any help would be appreceated !!!</p>
<pre><code><?php
class WP_Nav_Menu_Widget_Desc extends WP_Widget {
function __construct() {
parent::WP_Widget(false, 'minti.SideNav', array('description' => 'Display a Side Navigation'));
}
function widget($args, $instance) {
// Get menu
$nav_menu = wp_get_nav_menu_object( $instance['nav_menu'] );
if ( !$nav_menu )
return;
echo $args['before_widget'];
//if ( !empty($instance['title']) )
// echo $args['before_title'] . $instance['title'] . $args['after_title'];
wp_nav_menu( array( 'depth' => 1, 'menu' => $nav_menu ) );
echo $args['after_widget'];
}
function update( $new_instance, $old_instance ) {
$instance['nav_menu'] = (int) $new_instance['nav_menu'];
return $instance;
}
function form( $instance ) {
$nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';
// Get menus
$menus = get_terms( 'nav_menu', array( 'hide_empty' => false ) );
// If no menus exists, direct the user to go and create some.
if ( !$menus ) {
echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.'), admin_url('nav-menus.php') ) .'</p>';
return;
}
?>
<p>
<label for="<?php echo $this->get_field_id('nav_menu'); ?>"><?php _e('Select Menu:'); ?></label>
<select id="<?php echo $this->get_field_id('nav_menu'); ?>" name="<?php echo $this->get_field_name('nav_menu'); ?>">
<?php
foreach ( $menus as $menu ) {
$selected = $nav_menu == $menu->term_id ? ' selected="selected"' : '';
echo '<option'. $selected .' value="'. $menu->term_id .'">'. $menu->name .'</option>';
}
?>
</select>
</p>
<?php
}
}
add_action('widgets_init', create_function('', 'return register_widget("WP_Nav_Menu_Widget_Desc");'));
?>
</code></pre>
| [
{
"answer_id": 74182015,
"author": "Theo",
"author_id": 9898643,
"author_profile": "https://Stackoverflow.com/users/9898643",
"pm_score": 2,
"selected": false,
"text": "-contains"
},
{
"answer_id": 74182875,
"author": "zett42",
"author_id": 7571258,
"author_profile": ... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20322082/"
] |
74,181,860 | <p>Below is my thread pool code. after 3 hours' debugging, i turn to you guys for help ToT. <br />
Q1: Is there some wrong with my code? It came up some race conditions while i executed this code <br />
Q2: The sub-threads did not execute before I add sleep() function in my main function, I want to figure that out too. <br />
PS: I executed this code under unbuntu system.</p>
<pre><code>//this is thread_pool.h
#ifndef _THREAD_POLL_H_
#define _THREAD_POLL_H_
#include <list>
#include <vector>
#include <unistd.h>
// #include "locker.h"
#include <pthread.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <semaphore.h>
class thread_pool {
private:
struct task {
void (*fun)(void*);
void* arg;
};
private:
int size; //the num of working threads
pthread_mutex_t lock; //a mutex
sem_t sem; //semaphore to indicate the num of jobs
std::list<task> tasks;
std::vector<pthread_t> threads;
const int default_size = 16;
int is_shutdown;
public:
thread_pool();
thread_pool(int num);
~thread_pool();
void add_job(void (*fun)(void*), void* arg);
private:
static void* work(void* arg); //the working threads' call back
void run(); //the actual function that work() calls
};
#endif
</code></pre>
<pre><code>//this is thread_pool.cpp
#include "thread_pool.h"
thread_pool::thread_pool(int num) : size(num), is_shutdown(0) {
if (num <= 0) {
fprintf(stderr, "the num of working threads is incorrect\n");
exit(1);
}
pthread_mutex_init(&lock, NULL);
sem_init(&sem, 0, 0);
threads.resize(num);
pthread_mutex_lock(&lock);
for (int i = 0; i < num; i++) {
pthread_create(&threads[i], NULL, work, this);
// printf("thread %d is created\n", threads[i]);
pthread_detach(threads[i]);
}
pthread_mutex_unlock(&lock);
}
thread_pool::thread_pool() : thread_pool(default_size) {}
thread_pool::~thread_pool() {
is_shutdown = 1;
for (int i = 0; i < size; i++)
sem_post(&sem);
pthread_mutex_destroy(&lock);
sem_destroy(&sem);
}
void* thread_pool::work(void* arg) {
thread_pool* pool = (thread_pool*)arg;
pool->run();
return pool;
}
void thread_pool::run() {
while (true) {
sem_wait(&sem);
if (is_shutdown) {
break;
}
pthread_mutex_lock(&lock);
if (tasks.empty()) {
pthread_mutex_unlock(&lock);
continue;
}
// printf("thread %d run\n", pthread_self());
task tmp = tasks.front();
tasks.pop_front();
pthread_mutex_unlock(&lock);
tmp.fun(tmp.arg);
}
}
void thread_pool::add_job(void (*fun)(void*), void* arg) {
pthread_mutex_lock(&lock);
task tmp;
tmp.fun = fun;
tmp.arg = arg;
tasks.push_back(tmp);
sem_post(&sem);
pthread_mutex_unlock(&lock);
}
</code></pre>
<p>below is the minimal reproducible example, when executing the <code>main</code> function, the output of the <code>fun</code> contains the same number.</p>
<pre><code>#include <stdio.h>
#include "thread_pool.h"
int idx = 0;
void func(void* arg) {
printf("%d\n", *(int*)arg);
usleep(100);
}
int main() {
thread_pool tp(8);
while (1) {
tp.add_job(func, (void*)&idx);
idx++;
}
}
</code></pre>
| [
{
"answer_id": 74182605,
"author": "Frodyne",
"author_id": 11829247,
"author_profile": "https://Stackoverflow.com/users/11829247",
"pm_score": 2,
"selected": false,
"text": "main"
},
{
"answer_id": 74192220,
"author": "Torch",
"author_id": 19252975,
"author_profile": ... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19252975/"
] |
74,181,877 | <p>I am trying to make a form appear after clicking a button, I believe I have defined the button and the form in my JavaScript code below, I keep trying to click on the button to make it appear but it is not working, what am I missing here?
I would also like to add a function to make the form disappear when adding something.
(This is for the Library project for The Odin Project)</p>
<p>Thanks in advance for your time and help.</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>//define button and form//
const popUpForm = document.getElementById("popUpForm");
var button = document.getElementById("addBook");
//Form Pop-Up//
//button.onclick = () => {window.open('hello!')};//
//button function//
button.addEventListener("click", function(openForm) {
document.getElementById("popUpForm").style.display = "block";
};</code></pre>
<pre class="snippet-code-css lang-css prettyprint-override"><code>h1 {
font-family: ohno-blazeface, sans-serif;
font-weight: 100;
font-style: normal;
font-size: 8vh;
color: #001D4A;
}
.head-box {
background-color: #9DD1F1;
display: flex;
justify-content: center;
}
h2 {
font-family: poppins, sans-serif;
font-weight: 300;
font-style: normal;
font-size: 3vh;
color: #c2e8ff;
}
button {
height: 10vh;
width: 20vh;
font-size: 3vh;
background-color: #27476E;
border-radius: 22px;
border-color: #daf1ff;
border-width: 2px;
border-style: solid;
}
button:hover {
background-color: #192c44;
}
body {
background-color: #9DD1F1;
}
.body-box {
display: flex;
justify-content: center;
}
/* The pop up form - hidden by default */
.form-popup {
display: none;
position: fixed;
bottom: 0;
right: 15px;
border: 3px solid #f1f1f1;
z-index: 9;
}
.form-container {
display: block;
max-width: 300px;
padding: 10px;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="head-box">
<h1>My Library</h1>
</div>
<div class="body-box">
<button id="addBook" button onclick="openForm"><h2>Add Book</h2></button>
</div>
<!-----Form information----->
<div class="form-popup">
<form action="example.com/path" class="form-container" id="popUpForm">
<input type="text" id="title" placeholder="Title">
<input type="author" id="author" placeholder="Author">
<input type="pages" id="pages" placeholder="Pages">
<input type="checkbox" id="readOption" name="readOption">
<label for="readOption">Have you read it?</label>
<button type="submit">Submit</button>
</form>
</div></code></pre>
</div>
</div>
</p>
| [
{
"answer_id": 74182117,
"author": "morganney",
"author_id": 258174,
"author_profile": "https://Stackoverflow.com/users/258174",
"pm_score": 2,
"selected": true,
"text": ")"
},
{
"answer_id": 74182271,
"author": "Andrei Fedorov",
"author_id": 6641198,
"author_profile"... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18013003/"
] |
74,181,921 | <p>I have two UI function component and i wanna render them synchronous, I mean when the first component render finished,it will be delete into DOM then the second component will be render after that.</p>
<pre><code>import React, {useEffect, useState} from "react";
import Home from "./Home";
import Loading from "./Loading";
export default function Web() {
const [beforeLoad, setBeforeLoad] = useState(false);
useEffect(() => {
async () => {
await (new Promise<void>(resolve => {
setTimeout(() =>{
resolve(() => setBeforeLoad(true))
}, 2500)
}))
}}, [])
if(!beforeLoad) {
return <div className="bg-gradient-to-r from-violet-500 to-fuchsia-500" style={{
width: '100wh',
height: '100vh',
padding: 0,
margin: 0,
overflow: 'hidden',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
perspective: '500px'
}}>
<Loading />
</div>
} else if(beforeLoad) {
return <Home />
}
}
</code></pre>
<p>i used async await into hook but maybe i'm wrong.</p>
<p>as you can see, i wanna render Loading component first then Home component will be render after that.</p>
| [
{
"answer_id": 74182478,
"author": "Shoaib Amin",
"author_id": 19580087,
"author_profile": "https://Stackoverflow.com/users/19580087",
"pm_score": 1,
"selected": true,
"text": "import React, { useEffect, useState } from \"react\";\n\nexport default function Web() {\n const [beforeLoad, ... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16701415/"
] |
74,181,946 | <p>I have a data frame that looks like this :</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;">date</th>
<th style="text-align: left;">var</th>
<th style="text-align: center;">cat_low</th>
<th style="text-align: right;">dog_low</th>
<th style="text-align: left;">cat_high</th>
<th style="text-align: center;">dog_high</th>
<th style="text-align: right;">Love</th>
<th style="text-align: right;">Friend</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">2022-01-01</td>
<td style="text-align: left;">A</td>
<td style="text-align: center;">1</td>
<td style="text-align: right;">7</td>
<td style="text-align: left;">13</td>
<td style="text-align: center;">19</td>
<td style="text-align: right;">NA</td>
<td style="text-align: right;">friend</td>
</tr>
<tr>
<td style="text-align: left;">2022-01-01</td>
<td style="text-align: left;">A</td>
<td style="text-align: center;">2</td>
<td style="text-align: right;">8</td>
<td style="text-align: left;">14</td>
<td style="text-align: center;">20</td>
<td style="text-align: right;">NA</td>
<td style="text-align: right;">friend</td>
</tr>
<tr>
<td style="text-align: left;">2022-01-01</td>
<td style="text-align: left;">A</td>
<td style="text-align: center;">3</td>
<td style="text-align: right;">9</td>
<td style="text-align: left;">15</td>
<td style="text-align: center;">21</td>
<td style="text-align: right;">NA</td>
<td style="text-align: right;">friend</td>
</tr>
<tr>
<td style="text-align: left;">2022-02-01</td>
<td style="text-align: left;">B</td>
<td style="text-align: center;">4</td>
<td style="text-align: right;">10</td>
<td style="text-align: left;">16</td>
<td style="text-align: center;">22</td>
<td style="text-align: right;">love</td>
<td style="text-align: right;">NA</td>
</tr>
<tr>
<td style="text-align: left;">2022-02-01</td>
<td style="text-align: left;">B</td>
<td style="text-align: center;">5</td>
<td style="text-align: right;">11</td>
<td style="text-align: left;">17</td>
<td style="text-align: center;">23</td>
<td style="text-align: right;">love</td>
<td style="text-align: right;">NA</td>
</tr>
<tr>
<td style="text-align: left;">2022-02-01</td>
<td style="text-align: left;">B</td>
<td style="text-align: center;">6</td>
<td style="text-align: right;">12</td>
<td style="text-align: left;">18</td>
<td style="text-align: center;">24</td>
<td style="text-align: right;">love</td>
<td style="text-align: right;">NA</td>
</tr>
</tbody>
</table>
</div>
<p>I want to select the columns related to columns Love and Friend. If the column Love is love to give the columns that starts with cat and if the column Friend is friend to give me the columns that start with dog.</p>
<p>ideally i want to look like this :</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;">date</th>
<th style="text-align: center;">var</th>
<th style="text-align: right;">a</th>
<th style="text-align: right;">b</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">2022-01-01</td>
<td style="text-align: center;">A</td>
<td style="text-align: right;">7</td>
<td style="text-align: right;">19</td>
</tr>
<tr>
<td style="text-align: left;">2022-01-01</td>
<td style="text-align: center;">A</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">20</td>
</tr>
<tr>
<td style="text-align: left;">2022-01-01</td>
<td style="text-align: center;">A</td>
<td style="text-align: right;">9</td>
<td style="text-align: right;">21</td>
</tr>
<tr>
<td style="text-align: left;">2022-02-01</td>
<td style="text-align: center;">B</td>
<td style="text-align: right;">4</td>
<td style="text-align: right;">16</td>
</tr>
<tr>
<td style="text-align: left;">2022-02-01</td>
<td style="text-align: center;">B</td>
<td style="text-align: right;">5</td>
<td style="text-align: right;">17</td>
</tr>
<tr>
<td style="text-align: left;">2022-02-01</td>
<td style="text-align: center;">B</td>
<td style="text-align: right;">6</td>
<td style="text-align: right;">18</td>
</tr>
</tbody>
</table>
</div>
<pre><code>library(lubridate)
date = c(rep(as.Date("2022-01-01"),3),rep(as.Date("2022-02-01"),3))
var = c(rep("A",3),rep("B",3))
cat_low = seq(1,6,1)
dog_low = seq(7,12,1)
cat_high = seq(13,18,1)
dog_high = seq(19,24,1)
Friend = c(rep("friend",3),rep(NA,3))
Love = c(rep(NA,3),rep("love",3))
df = tibble(date,var,cat_low,dog_low,cat_high,dog_high,Love,Friend);df
</code></pre>
<p>Any help? How i can do that in R using dplyr ?</p>
| [
{
"answer_id": 74182478,
"author": "Shoaib Amin",
"author_id": 19580087,
"author_profile": "https://Stackoverflow.com/users/19580087",
"pm_score": 1,
"selected": true,
"text": "import React, { useEffect, useState } from \"react\";\n\nexport default function Web() {\n const [beforeLoad, ... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16346449/"
] |
74,181,958 | <p>I'm trying to change the border color of a ListBox.</p>
<p>I made this custom control where i have a function that makes the border by drawing.</p>
<p>After had it working, noticed that can't use ListBox.Items anymore, methods such as .Add() or .Clear().</p>
<p>Code of the Custom ListBox:</p>
<pre><code>class CustomListBox : UserControl
{
//Fields
private Color borderColor = Color.MediumSlateBlue;
private int borderSize = 1;
//Items
private ListBox Listb;
//Properties
[Category("Custom")]
public Color BorderColor
{
get { return borderColor; }
set
{
borderColor = value;
}
}
[Category("Custom")]
public int BorderSize
{
get { return borderSize; }
set
{
borderSize = value;
this.Padding = new Padding(borderSize);//Border Size
AdjustListBoxDimensions();
}
}
public CustomListBox()
{
Listb = new ListBox();
this.SuspendLayout();
// ListBox
Listb.BorderStyle = BorderStyle.None;
Listb.DrawMode = DrawMode.OwnerDrawFixed;
Listb.ForeColor = Color.FromArgb(((int)(((byte)(249)))), ((int)(((byte)(249)))), ((int)(((byte)(249)))));
Listb.FormattingEnabled = true;
Listb.ItemHeight = 24;
Listb.Location = new Point(567, 64);
Listb.Name = "CustomListBox";
Listb.Size = new Size(235, 936);
Listb.DrawItem += new DrawItemEventHandler(Listb_DrawItem);
this.MinimumSize = new Size(200, 30);
this.Size = new Size(200, 30);
this.Padding = new Padding(borderSize);//Border Size
this.Font = new Font(this.Font.Name, 12F);
this.ResumeLayout();
AdjustListBoxDimensions();
}
// Highlight event
private void Listb_DrawItem(object sender, DrawItemEventArgs e)
{
Color backgroundColor = Color.FromArgb(50, 50, 50);
Color horizontalColor = Color.FromArgb(100, 100, 100);
if (e.Index >= 0)
{
SolidBrush sb = new SolidBrush(((e.State & DrawItemState.Selected) == DrawItemState.Selected) ? horizontalColor : backgroundColor);
e.Graphics.FillRectangle(sb, e.Bounds);
string text = Listb.Items[e.Index].ToString();
SolidBrush tb = new SolidBrush(e.ForeColor);
e.Graphics.DrawString(text, e.Font, tb, Listb.GetItemRectangle(e.Index).Location);
}
}
//Adjust Dimension (Still in test)
private void AdjustListBoxDimensions()
{
Listb.Location = new Point()
{
X = this.Width - this.Padding.Right - Listb.Width,
Y = Listb.Height
};
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics graph = e.Graphics;
//Draw border
using (Pen penBorder = new Pen(borderColor, borderSize))
{
penBorder.Alignment = PenAlignment.Inset;
graph.DrawRectangle(penBorder, 0, 0, this.Width - 0.5F, this.Height - 0.5F);
}
}
}
</code></pre>
<p>My problem is that i can't use the ListBox properties/methods, is there a way to inherit them?</p>
| [
{
"answer_id": 74182252,
"author": "Nino",
"author_id": 6170890,
"author_profile": "https://Stackoverflow.com/users/6170890",
"pm_score": 3,
"selected": true,
"text": "Listbox"
},
{
"answer_id": 74182546,
"author": "Filipe",
"author_id": 20309644,
"author_profile": "h... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20309644/"
] |
74,181,973 | <p>I have a sheet in Excel 365 with the columns A and B as shown below and I want to get columns C and D with some formula (not VBA!). That is, I want to repeat every <em>Title</em> for <em>Count</em> times and add a running number to it.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th></th>
<th>A</th>
<th>B</th>
<th>C</th>
<th>D</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>1</strong></td>
<td><strong>Title</strong></td>
<td><strong>Count</strong></td>
<td><strong>Running Title</strong></td>
<td><strong>Running Number</strong></td>
</tr>
<tr>
<td><strong>2</strong></td>
<td>Anna</td>
<td>3</td>
<td>Anna</td>
<td>1</td>
</tr>
<tr>
<td><strong>3</strong></td>
<td>Ben</td>
<td>2</td>
<td>Anna</td>
<td>2</td>
</tr>
<tr>
<td><strong>4</strong></td>
<td></td>
<td></td>
<td>Anna</td>
<td>3</td>
</tr>
<tr>
<td><strong>5</strong></td>
<td></td>
<td></td>
<td>Ben</td>
<td>1</td>
</tr>
<tr>
<td><strong>6</strong></td>
<td></td>
<td></td>
<td>Ben</td>
<td>2</td>
</tr>
</tbody>
</table>
</div>
<p>For the <strong>Running Title</strong>, I found a <a href="https://excelmee.com/excel-formulas/excel-formula-to-make-duplicates-of-every-row-n-times" rel="nofollow noreferrer">somewhat arcane formula</a> that looks somewhat unstable (relying on string processing). It basically uses the following formula to create an array that is <code>{2,2,2,3,3}</code> and <code>XLOOKUP</code> on that to get the titles.</p>
<pre><code>=XLOOKUP(
IFERROR(
FILTERXML(
"<a><b>"&
SUBSTITUTE(TRIM(TEXTJOIN(" ",TRUE,REPT(ROW($A$2:$A$100)&" ",$B$2:$B$100)))," ","</b><b>")&
"</b></a>",
"//b"
),
""),
ROW($A$2:$A$100),
A2:A100
)
</code></pre>
<p>This works, but it would be great to see some less patchy formula (i.e. not relying on specifics on how Excel treats strings) for the purpose.</p>
<p>For the <strong>Running Number</strong>, I <em>could</em> use a formula like <code>=IF($A2<>"",IF($C1=$C2,$D1+1,1),"")</code> in cell D2 and extend it downwards by dragging the lower right corner downwards. This works, but I would love to see a <em>spilling</em> formula that only has to be defined in D2 and nowhere else.</p>
<p>In summary, is there a way to create columns C and D in the example above without having to define the size of the output (like I do by manually expanding the formula area) and without resorting to functions that depend on the internal workings of strings in Excel?</p>
| [
{
"answer_id": 74182252,
"author": "Nino",
"author_id": 6170890,
"author_profile": "https://Stackoverflow.com/users/6170890",
"pm_score": 3,
"selected": true,
"text": "Listbox"
},
{
"answer_id": 74182546,
"author": "Filipe",
"author_id": 20309644,
"author_profile": "h... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74181973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20321972/"
] |
74,182,038 | <p>I'm coding in Symfony a search bar working with a query builder for an entity named "Structure" which is related to an entity "Partenaire" (OneToMany), it's working great but the problem is that it shows all the structures and I need to display only the structures related to the Partenaire. If someone can help me to solve this issue, thank you.</p>
<p>PartenaireController.php:</p>
<pre><code>#[Route('/{id}', name: 'app_partenaire_show', methods: ['GET', 'POST'])]
public function show(Partenaire $partenaire, EntityManagerInterface $entityManager, PartenaireRepository $partenaireRepository,Request $request, PartenairePermissionRepository $partenairePermissionRepository, StructureRepository $structureRepository): Response
{
$getEmail = $this->getUser()->getEmail();
$partenaireId = $entityManager->getRepository(Partenaire::class)->findOneBy([
'id' => $request->get('id')
]);
$search2 = $structureRepository->findOneBySomeField2(
$request->query->get('q')
);
return $this->render('partenaire/show.html.twig', [
'partenaire' => $partenaire,
'permission'=>$partenairePermissionRepository->findBy(
['partenaire' => $partenaireId],
),
'structures'=>$search2, // show all the structures
/* 'structures'=>$structureRepository->findBy( // show the structure linked to the partenaire but doesn't work with the search
['partenaire' => $partenaireId],
[],
),*/
'email'=>$getEmail,
]);
}
</code></pre>
<p>StructureRepository.php :</p>
<pre><code>public function findOneBySomeField2(string $search2 = null): array
{
$queryBuilder = $this->createQueryBuilder('q')
->orderBy('q.id' , 'ASC');
if ($search2) {
$queryBuilder->andWhere('q.Adresse LIKE :search')
->setParameter('search', '%'.$search2.'%');
}
return $queryBuilder->getQuery()
->getResult()
;
}
</code></pre>
| [
{
"answer_id": 74182343,
"author": "Floxblah",
"author_id": 4671147,
"author_profile": "https://Stackoverflow.com/users/4671147",
"pm_score": 2,
"selected": false,
"text": "public function findByPartenaireWithFilter(Partenaire $partenaire, string $search2 = null): array\n{\n $queryBui... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19641177/"
] |
74,182,057 | <p>I know there are other ways to do this, but I am want to use <code>match</code> here.</p>
<p>In this snip, the <code>break</code> piece matches for all integers > 0, but I want it to match only <code>n</code>' I'm using the cast because it wasn't working without it. Not working <em>with</em> it either but...</p>
<pre><code>#times is a simple list of python datetimes
n=len(times)
for i,time in enumerate(times) :
print(f'{i} {time}')
match int(i):
case 0 :
print('continuing')
continue
case int(n) :
print(f'breaking for {i}')
#break
case __ :
period = times[i+1] - time
print(period)
</code></pre>
| [
{
"answer_id": 74183151,
"author": "gimix",
"author_id": 15844296,
"author_profile": "https://Stackoverflow.com/users/15844296",
"pm_score": 0,
"selected": false,
"text": "n"
},
{
"answer_id": 74185320,
"author": "Stephen Boston",
"author_id": 4386557,
"author_profile... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4386557/"
] |
74,182,071 | <p>I've been having trouble with finding the average of an array of lists, specifically by row and by column. I know what I want to do with it, but I'm struggling with finding what kind of code to write for it. The array is as follows:</p>
<pre><code>data = [[126, 91, 43],
[534, 59, 148],
[53, 78, 1],
[725, 727, 729],
[0, 12, 0],
[64, 23, 3]]
</code></pre>
<p>By row, I want to essentially find the averages of each individual list within this array without combining them. By column, I want to find the averages of the x'th item in each list within the array. What I want to code is as follows:
By row: find how many lists there are in the array, then calculate their means individually. The index range would be unlimited.
By column: find how many lists there are in the array, take only the x'th terms from each list, and calculate their means. The index range would be unlimited.
Any help is appreciated.</p>
| [
{
"answer_id": 74182185,
"author": "Jamie.Sgro",
"author_id": 11550733,
"author_profile": "https://Stackoverflow.com/users/11550733",
"pm_score": 3,
"selected": true,
"text": "import statistics\n\ndata = [\n [126, 91, 43],\n [534, 59, 148],\n [53, 78, 1],\n [725, 727, 729],\n... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20322128/"
] |
74,182,080 | <p>I set up the PostgreSQL using Docker Compose and the content of the file <strong>(compose.yaml)</strong> is like so:</p>
<pre><code>name: postgres-container
services:
database:
image: postgres
restart: always
environment:
- POSTGRES_PASSWORD
// OR POSTGRES_PASSWORD = ${POSTGRES_PASSWORD}
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:
</code></pre>
<p>I ran <code>docker compose up</code> command inside the terminal and then after initializing the server and database, I tried to connect to the PostgreSQL using <code>psql -h localhost -U postgres</code>.</p>
<p>Then it prompt me for password so <strong>I entered the password that matched exactly in my .env file</strong> in my project folder but I'm still unable to enter the PostgreSQL server and gave me error.</p>
<pre><code>psql: error: connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL: password authentication failed for user "postgres"
connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL: password authentication failed for user "postgres"
</code></pre>
<p><strong>Below is my .env file</strong>:</p>
<pre><code># When adding additional env variables, the schema in /env/schema.mjs should be updated accordingly
# Prisma
DATABASE_URL=postgres://postgres:postgres@localhost/crud?connect_timeout=10
# Next Auth
NEXTAUTH_SECRET=...
NEXTAUTH_URL=http://localhost:3000
# Next Auth Google Provider
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
# Next Auth Discord Provider
DISCORD_CLIENT_ID=...
DISCORD_CLIENT_SECRET=...
# PostgreSQL Auth
POSTGRES_PASSWORD=postgres
</code></pre>
<p>How do I solve this issue? I already did:</p>
<ul>
<li>Delete volume that store the data</li>
<li>Delete the container that runs</li>
<li>Delete the PostgreSQL image</li>
</ul>
<p><strong>And when I ran <code>docker compose convert</code> command, it gave me true value:</strong></p>
<pre><code>name: postgres-container
services:
database:
environment:
POSTGRES_PASSWORD: postgres
image: postgres
networks:
default: null
restart: always
volumes:
- type: volume
source: pgdata
target: /var/lib/postgresql/data
volume: {}
networks:
default:
name: postgres-container_default
volumes:
pgdata:
name: postgres-container_pgdata
</code></pre>
| [
{
"answer_id": 74182185,
"author": "Jamie.Sgro",
"author_id": 11550733,
"author_profile": "https://Stackoverflow.com/users/11550733",
"pm_score": 3,
"selected": true,
"text": "import statistics\n\ndata = [\n [126, 91, 43],\n [534, 59, 148],\n [53, 78, 1],\n [725, 727, 729],\n... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19475423/"
] |
74,182,090 | <p>For firefox,chrome,safarim,edge it works smth like this:</p>
<pre><code>driver_instance = webdriver.Chrome(chrome_options=chrome_options)
</code></pre>
<p>But I can't find information on how to do the same for the Opera web driver and apparently it's supported. I downloaded the Opera webdriver, put it in my PATH but what command I'm supposed to run to make it run in Opera?</p>
| [
{
"answer_id": 74182239,
"author": "Akzy",
"author_id": 11863448,
"author_profile": "https://Stackoverflow.com/users/11863448",
"pm_score": 1,
"selected": false,
"text": "opera"
},
{
"answer_id": 74182645,
"author": "Xeyal",
"author_id": 12592798,
"author_profile": "h... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20322188/"
] |
74,182,154 | <p>I'm trying to find the index of the minimum value of a 1D array and then find the corresponding column from a 2D array, I do this using:</p>
<pre><code>find_index = np.where(min(function())
</code></pre>
<p>where the function creates the array in question. The array is a single column with 8 values. This seems to be working, but the problem arises when I then try to find the corresponding column of the 8x8 array. I've tried</p>
<pre><code>find_column = varr[:,find_index]
</code></pre>
<p>and also</p>
<pre><code>column_needed = [:,find_index]
find_column = np.take(varr, column_needed)
</code></pre>
<p>where varr is the 8x8 array and find_index is the index I found from the 1D array.
Is there a way to do this? I think I understand why my approaches aren't working but I can't seem to find an approach that does work.</p>
<pre><code>varr = np.array([1],[2],[3])
varr2 = np.array([1,2,3], [4,5,6], [7,8,9])
find_index = np.where(min(varr))
find_column = varr2[:,find_index]'
</code></pre>
<p>Edited to attempt to get the code to show up as code and add a simple example, this is my first post :)</p>
| [
{
"answer_id": 74182239,
"author": "Akzy",
"author_id": 11863448,
"author_profile": "https://Stackoverflow.com/users/11863448",
"pm_score": 1,
"selected": false,
"text": "opera"
},
{
"answer_id": 74182645,
"author": "Xeyal",
"author_id": 12592798,
"author_profile": "h... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20322194/"
] |
74,182,166 | <p>i make ajax call for method using ajax and laravel so i put the token on the head of my blade file and send it with the form but i get an error 219 'csrf token mismatch " i can't find way i'm getting the error</p>
<pre><code> <head>
<meta name="csrf-token" content="{{ csrf_token() }}" />
</head>
<form id="formId">
<input id="news_letter_mail"
name="email"
class="form-control"
placeholder="Entrez votre E-mail *" />
<div class="call_to_action mb-4">
<a href="#" id="newsletter"> <button >Envoyer un Message</button> </a>
<span><i class='bx bx-right-arrow-alt'></i></span>
</div>
</form>
<script>
$("#newsletter").click(function(event){
event.preventDefault();
var name="moussa";
var email="moussaeloifi14@gmail.com";
var message="ok";
var CSRF_TOKEN = $('meta[name="csrf-token"]').attr('content');
console.log(CSRF_TOKEN);
$.ajax({
url: '/newsletter',
type: 'POST',
dataType: 'json',
// headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
data:{_token: CSRF_TOKEN,name: name,email: email,message: message}, // the value of input having id vid
success: function(response){ // What to do if we succeed
console.log(response);
},
error: function (error) {
}
});
});
</script>
</code></pre>
| [
{
"answer_id": 74182239,
"author": "Akzy",
"author_id": 11863448,
"author_profile": "https://Stackoverflow.com/users/11863448",
"pm_score": 1,
"selected": false,
"text": "opera"
},
{
"answer_id": 74182645,
"author": "Xeyal",
"author_id": 12592798,
"author_profile": "h... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16455484/"
] |
74,182,258 | <p>I am creating an app that is similiar in function with instagram and i have come across an issue when posting a new photo. When a user posts a new photo it is saved into this state.</p>
<p><code>const [posts, setPosts] = useState([]);</code></p>
<p>When the page renders and the useEffect runs the image is not displayed on the screen because it is async, so what i did was add "posts" as a dependencies to the useeffect. This created an infinite loop i think because it calls itself but i am unsure of any other way of going about this. This is the useEffect code.</p>
<pre><code>useEffect(() => {
const getPosts = async () => {
const data = await getDocs(postCollectionRef);
setPosts(data.docs.map((doc) => ({...doc.data(), id: doc.id})));
}
getPosts()
}, [])
</code></pre>
| [
{
"answer_id": 74182239,
"author": "Akzy",
"author_id": 11863448,
"author_profile": "https://Stackoverflow.com/users/11863448",
"pm_score": 1,
"selected": false,
"text": "opera"
},
{
"answer_id": 74182645,
"author": "Xeyal",
"author_id": 12592798,
"author_profile": "h... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15468002/"
] |
74,182,261 | <p>In my program, sometimes a function needs to be executed when an event is fired, sometimes not, and there seems to be a problem with this. In order to understand that problem, I would like to know what happens in the following cases:</p>
<pre><code>_manager.InputOkHandler += InputHandler; // add the InputHandler to the event.
...
_manager.InputOkHandler += InputHandler; // add the same InputHandler to the event again. (1)
...
_manager.InputOkHandler -= InputHandler; // remove an/the InputHandler from the event. (2)
</code></pre>
<p>... and at another moment:</p>
<pre><code>_manager.InputOkHandler += InputHandler; // add the Input Handler to the event.
...
_manager.InputOkHandler -= InputHandler; // remove the InputHandler from the event.
...
_manager.InputOkHandler -= InputHandler; // remove an InputHandler from the event. (3)
</code></pre>
<ul>
<li>(1) : will the <code>InputHandler</code> be added twice? If yes, what does this mean?</li>
<li>(2) : will only one <code>InputHandler</code> be removed or both (if possible)?</li>
<li>(3) : will this raise an <code>Exception</code>? If yes, which one?</li>
</ul>
<p>... and finally: is it possible to show a list of all "subscribed" functions/methods to an event and how?</p>
| [
{
"answer_id": 74182484,
"author": "Irwene",
"author_id": 2245256,
"author_profile": "https://Stackoverflow.com/users/2245256",
"pm_score": 2,
"selected": false,
"text": "public class A\n{\n public event EventHandler MyEvent;\n\n public void RaiseEvent()\n {\n MyEvent?.In... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4279155/"
] |
74,182,266 | <p>I'm trying to map XML to JSON using XSLT 3.0</p>
<p>my broad plan is to take the input, map it to some elements in memory, and then map that to 'map's and 'array's to by applying templates and then letting the XSLT serialise that as JSON.</p>
<p>Here is my initial effort:</p>
<pre><code><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
version="3.0">
<xsl:output method="json" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:variable name="dsl" as="element()">
<epg lastBuildDate="10/4/2019 9:46:00 AM">
</epg>
</xsl:variable>
<xsl:variable name="output">
<xsl:apply-templates select="$dsl" mode="interpret"/>
</xsl:variable>
<xsl:sequence select="$output"/>
</xsl:template>
<xsl:template match="epg" mode="interpret">
<xsl:sequence select="map {
'lastBuildDate' : @lastBuildDate
}"/>
</xsl:template>
</xsl:stylesheet>
</code></pre>
<p>sadly I get</p>
<pre><code>Cannot add a map to an XDM node tree
</code></pre>
<p>in the 'interpret' template.</p>
| [
{
"answer_id": 74182484,
"author": "Irwene",
"author_id": 2245256,
"author_profile": "https://Stackoverflow.com/users/2245256",
"pm_score": 2,
"selected": false,
"text": "public class A\n{\n public event EventHandler MyEvent;\n\n public void RaiseEvent()\n {\n MyEvent?.In... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2088029/"
] |
74,182,312 | <p><a href="https://i.stack.imgur.com/PbOfr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PbOfr.png" alt="enter image description here" /></a>I´ve created an <strong>Azure Synapse Analytics Pipeline</strong> that must be triggered by the creation of a file within a <strong>Azure Gen2 storage account</strong>.</p>
<p>Somehow the <strong>blob creation event</strong> (i.e. when I upload the file in the corresponding container and folder) doesn´t fire anything and the pipeline does not start. I´ve registered the <em>Microsoft.EventGrid</em> and <em>Microsoft.Synapse</em> resource providers in the subscription, <a href="https://learn.microsoft.com/en-us/azure/data-factory/how-to-create-event-trigger?tabs=data-factory" rel="nofollow noreferrer">as suggested by the Microsoft official documentation</a>.</p>
<p>Am I missing anything? As far as I know, and according to the Microsoft documentation and the many tutorials I've read, I don´t need any Event Topic/Event subscription...</p>
| [
{
"answer_id": 74182484,
"author": "Irwene",
"author_id": 2245256,
"author_profile": "https://Stackoverflow.com/users/2245256",
"pm_score": 2,
"selected": false,
"text": "public class A\n{\n public event EventHandler MyEvent;\n\n public void RaiseEvent()\n {\n MyEvent?.In... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3050089/"
] |
74,182,314 | <p>i am curios on how i would get a logo above the Navbar
Like this:
<a href="https://i.stack.imgur.com/DDRPW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DDRPW.png" alt="enter image description here" /></a></p>
<p>I am not really sure how i can achieve this, i basically want the navbar to not be at the very top, but have the logo-top at the top of the site, then have the Navbar centered on the Logo, while the Logo is above the Navbar, so basically a part of the Navbar should be hidden behind it, and then align the buttons left and right of it</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>body {
margin: 0;
font-size: 28px;
font-family: Arial, Helvetica, sans-serif;
}
.navbar {
overflow: hidden;
background-color: grey;
}
.navbar a {
display: inline-block;
font-size: 16px;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.dropdown {
display: inline-block;
}
.dropdown .dropbtn {
display: inline-block;
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
font-family: inherit;
margin: 0;
}
.navbar a:hover, .dropdown:hover .dropbtn {
background-color: red;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #ddd;
}
.dropdown:hover .dropdown-content {
display: block;
}
.content {
padding: 16px;
}
.sticky {
position: fixed;
top: 0;
width: 100%;
}
.sticky + .content {
padding-top: 60px;
}
.logo {
width: 10% !important;
height: 10% !important;
position: absolute;
left: 50%;
margin-left: -50px !important; /* 50% of your logo width */
display: block;
}
</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code> <div class="navbar" align="center">
<a href="#home">Home</a>
<a href="#news">News</a>
<img src="https://via.placeholder.com/50" width="5%; height=5%; z-index: 10">
<div class="dropdown">
<button class="dropbtn">Server
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content" align="center">
<a href="#"> Server 2</a>
<a href="#"> Server 1</a>
</div>
</div>
<a href="#news">Discord</a>
</div> </code></pre>
</div>
</div>
</p>
| [
{
"answer_id": 74182543,
"author": "Damzaky",
"author_id": 7552340,
"author_profile": "https://Stackoverflow.com/users/7552340",
"pm_score": 2,
"selected": true,
"text": ".middle-logo"
}
] | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16905893/"
] |
74,182,326 | <pre><code>#include <stdio.h>
#define ONE 1
#define TWO 2
#define OOPS 42
#define DEF_FOO(x) void foo_##x(void){ printf(#x" %d\n",x);}
DEF_FOO(ONE);
DEF_FOO(TWO);
DEF_FOO(OOPS);
int main()
{
foo_ONE();
foo_TWO();
foo_OOPS();
return 0;
}
</code></pre>
<p>gives :</p>
<pre><code>ONE 1
TWO 2
OOPS 42
</code></pre>
<p>I would like this:</p>
<pre><code>#include <stdio.h>
#define ONE 1
#define TWO 2
#define OOPS 42
#define DEF_BAR(x) void bar_??x??(void){ printf(#x" %d\n",x);}
DEF_BAR(ONE);
DEF_BAR(TWO);
DEF_BAR(OOPS);
int main()
{
bar_1();
bar_2();
bar_42();
return 0;
}
</code></pre>
<p>gives :</p>
<pre><code>ONE 1
TWO 2
OOPS 42
</code></pre>
<p>or (its does not matter)</p>
<pre><code>1 1
2 2
42 42
</code></pre>
<p>Could I use the value of a token? In theory, preprocessor should know its value, does it?</p>
| [
{
"answer_id": 74182543,
"author": "Damzaky",
"author_id": 7552340,
"author_profile": "https://Stackoverflow.com/users/7552340",
"pm_score": 2,
"selected": true,
"text": ".middle-logo"
}
] | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10734452/"
] |
74,182,331 | <p>I'm brand new to javascript and appreciate everyone's help. I'm looping an array that might have 5 to 10 different records in it. This is what I'm doing so far and it works just fine. I didn't think including the array was necessary but let me know if it is.</p>
<pre><code>obj = relatedActivities.data;
console.log(obj);
for (var i = 0; i < obj.length; i++) {
var activityType = (obj[i].Activity_Type)
}
</code></pre>
<p>The only problem with this is I need to put each record's value in a particular place.
What I want is a different variable every time it loops.</p>
<p>So the first record, the variable name would be something like:</p>
<p><strong>activityType0 = obj[0].Activity_Type</strong></p>
<p>and for the second record it would be:</p>
<p><strong>activityType1 = obj[1].Activity_Type</strong></p>
<p>I hope that makes sense.</p>
<p>Thank you all much!</p>
| [
{
"answer_id": 74182543,
"author": "Damzaky",
"author_id": 7552340,
"author_profile": "https://Stackoverflow.com/users/7552340",
"pm_score": 2,
"selected": true,
"text": ".middle-logo"
}
] | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3010033/"
] |
74,182,370 | <p>I would like to merge two dictionaries, but if they have the same key, I would only merge non-duplicate values.</p>
<p>The following code works, but I have a question if it's possible to rewrite this when trying to get a union by using <strong>|</strong> or (**dict1, **dict2)? When I tried using <strong>|</strong>, my output would be from this <code>dict_merge({ 'A': [1, 2, 3] }, { 'A': [2, 3, 4] })</code> to this <code>{'A': [2, 3, 4]}</code></p>
<pre><code>def dict_merge(dict1, dict2):
for key in dict2.keys():
if key in dict1.keys():
d3 = dict1[key] + dict2[key]
d3 = set(d3)
dict1[key] = list(d3)
else:
dict1[key] = dict2[key]
return dict1
dict_merge({ 'A': [1, 2, 3] }, { 'B': [2, 4, 5, 6]})
</code></pre>
<p>Output</p>
<pre><code>{ 'A': [1, 2, 3], 'B': [2, 4, 5, 6] }
</code></pre>
| [
{
"answer_id": 74183842,
"author": "Chris",
"author_id": 15261315,
"author_profile": "https://Stackoverflow.com/users/15261315",
"pm_score": 1,
"selected": true,
"text": ">>> d1 = { 'A': [1, 2, 3] }\n>>> d2 = { 'A': [2, 3, 4] }\n>>> d1.keys() | d2.keys()\n{'A'}\n"
},
{
"answer_id... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20138426/"
] |
74,182,391 | <p>So I've been trying at this for quite some time now.</p>
<p>On this site I need to be able to place a script tag that will embed a contact form and newsletter sign up form etc to specific pages. So for example on the contact page the contact form script tag will live.</p>
<p>I've tried a bunch of different methods but I'm unable to get the result I'm after for what seems like a pretty basic thing to be able to do.</p>
<p>What I'm finding is initially it seems like it works fine, the script tag works and I see what I expect on the page. But then when you navigate away from the page and go back to it the script tag isn't displaying. It's only when I then refresh the page again will the stuff the script tag is supposed to output appear.</p>
<p>I'm assuming this is happening because with use of the Link tag the website doesn't reload between navigation, instead it all works like a SPA with no reload but it's that refresh that triggers the Script tag to execute.</p>
<p>In my research on this I've seen people recommend not using the Link tag and instead just using a tags so when navigating to the page it has to reload and force the Script tag to display. Only in my case it's not really an option because I am unable to tell which page the client has decided to output a script tag or not because the website is fully dynamic and able to be constructed all via the CMS.</p>
<p>I've tried:</p>
<p>Doing the dangerouslySetInnerHTML trick with the script. Unfortunately the same thing happens as I've described above</p>
<pre><code><div
dangerouslySetInnerHTML={{__html: `<script src=""></script>`}}
/>
</code></pre>
<p>I've also tried using next's built in Script tag <a href="https://nextjs.org/docs/api-reference/next/script" rel="nofollow noreferrer">https://nextjs.org/docs/api-reference/next/script</a> with all the different strategy props. Unfortunately the script content either didn't display at all or it acted the same as above.</p>
<p>I've also tried creating a helper function that uses the useEffect to instate the script tag only after navigating to the page, like so:</p>
<pre><code>import { useEffect } from "react"
const useScript = (url) => {
useEffect(() => {
const script = document.createElement("script")
script.src = url
script.async = true
document.body.appendChild(script)
return () => {
document.body.removeChild(script)
}
}, [url])
}
export default useScript;
</code></pre>
<p>and then in the component output to a page:</p>
<pre><code><div>
{useScript("...")}
</div>
</code></pre>
<p>This did work! Every time you navigate to the page with the script on it did output the contents of the script tag - not needing a page refresh. The only thing is the contents of the script tag was always output right at the bottom of the page, below the footer and everything. As opposed to where the actual useScript is put in the component.</p>
<p>I tried altering how the useEffect works by making it append the script into an already existing div in the component:</p>
<pre><code>import { useEffect } from "react"
const useScript = (url) => {
useEffect(() => {
const script = document.createElement("script")
script.src = url
script.async = true
script.defer = true
document.getElementById('scriptEx').appendChild(script)
return () => {
document.body.removeChild(script)
}
}, [url])
}
export default useScript;
</code></pre>
<p>But for some reason this doesn't act the same way as the previous setup. On navigation to the page the contents of the script tag don't display again.</p>
<p>The last method I found that does work every single time, but seems like a really ridiculous method to use is putting the script tag inside of an iFrame:</p>
<pre><code><iframe
srcDoc={`
<!doctype html>
<html>
<head>
</head>
<body>
<div>
<script src="..."></script>
</div>
</body>
</html>
`}
/>
</code></pre>
<p>There's got to be a way to do this seemingly simple thing.</p>
<p>If anyone could help it'd be really appreciated!</p>
<p><strong>Edit</strong>: Here is an example of what I am seeing using Next's Script tag: <a href="https://i.imgur.com/4JeiLFO.png" rel="nofollow noreferrer">https://i.imgur.com/4JeiLFO.png</a></p>
<p>And here is the jsx that makes up that page:</p>
<pre><code>
import Script from "next/script";
const example = () => {
return (
<div>
The Nav is above this
<div>
<p>Container for the form</p>
<Script src="//basingstokegov.uk.com/resources/sharing/embed.js?sharing=lp-embed&domain=basingstokegov.uk.com&id=3IWH-BN7%2Fthank-you%22" async />
</div>
The footer is below this
</div>
)
}
export default example
</code></pre>
| [
{
"answer_id": 74183842,
"author": "Chris",
"author_id": 15261315,
"author_profile": "https://Stackoverflow.com/users/15261315",
"pm_score": 1,
"selected": true,
"text": ">>> d1 = { 'A': [1, 2, 3] }\n>>> d2 = { 'A': [2, 3, 4] }\n>>> d1.keys() | d2.keys()\n{'A'}\n"
},
{
"answer_id... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10259523/"
] |
74,182,392 | <p>I am looking for a way to enable personal Hotspot programatically in iOS using Swift or Objective-C but did not see any API or way to achieve that.</p>
<p>My question is that even possible to do that?</p>
<p>Does Apple allow that?</p>
<p>Also as per Apple Developer Documentation <a href="https://developer.apple.com/documentation/networkextension/hotspot_helper" rel="nofollow noreferrer">HotSpot Helper</a> what are the controls we can achieve that ??</p>
<pre><code>Hotspot Communication
Hotspot helpers can use these APIs to communicate with the hotspot even when Wi-Fi is not the default route.
func bind(to: NEHotspotHelperCommand)
Binds a URL request to the network interface associated with the hotspot helper command instance.
In-Provider Networking
Network APIs for use by all types of NetworkExtension providers and by hotspot helpers.
</code></pre>
| [
{
"answer_id": 74192147,
"author": "Pushkraj Lanjekar",
"author_id": 1878198,
"author_profile": "https://Stackoverflow.com/users/1878198",
"pm_score": 2,
"selected": false,
"text": "Settings"
},
{
"answer_id": 74279538,
"author": "Mr Developer",
"author_id": 20384561,
... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2656275/"
] |
74,182,393 | <p>I am trying to do multiple things at the same time...</p>
<ol>
<li>Replace a select dropdown</li>
<li>Have the select dropdown trigger the visibility of a div (it's a child of the div after #1).</li>
</ol>
<p>I have this HTML:</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>let $displays = $('.view-id-dashboard');
$displays.eq(1).toggle();
let $selects = $('.dashboard-select');
$('select[data-drupal-selector="edit-sort-order"]').each(function(index) {
$("label[for='" + this.id + "']").text('Edited/Created by me');
this.replaceWith($selects.get(index));
});
$selects.on('change', function() {
$selects.val(this.value);
$displays.toggle();
});</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="view view-dashboard view-id-dashboard view-display-id-embed_1">
<p>
First div, contains lots of things, I only kept the select dropdown to be replaced.
</p>
<select data-drupal-selector="edit-sort-order" id="edit-sort-order" name="sort_order" class="form-select form-element form-element--type-select">
<option value="ASC">Asc</option>
<option value="DESC" selected="selected">Desc</option>
</select>
</div>
<div class="view view-dashboard view-id-dashboard view-display-id-embed_2">
<p>
Second div, contains lots of things, again only kept the relevant select below.
</p>
<select data-drupal-selector="edit-sort-order" id="edit-sort-order" name="sort_order" class="form-select form-element form-element--type-select">
<option value="ASC">Asc</option>
<option value="DESC" selected="selected">Desc</option>
</select>
</div>
<p>
I added this verbatim and this is the problem.
</p>
<select class="dashboard-select form-select form-element form-element--type-select">
<option value="edited_by_me">Edited by me</option>
<option value="created_by_me">Created by me</option>
</select>
<select class="dashboard-select form-select form-element form-element--type-select">
<option value="edited_by_me">Edited by me</option>
<option value="created_by_me">Created by me</option>
</select></code></pre>
</div>
</div>
</p>
<p>This works as intended but I am very unhappy I needed to add the same <code><select class="dashboard-select</code> twice. I tried various ways of <code>.clone()</code>, <code>.add()</code> and such to no avail.</p>
| [
{
"answer_id": 74182574,
"author": "Barmar",
"author_id": 1491895,
"author_profile": "https://Stackoverflow.com/users/1491895",
"pm_score": 0,
"selected": false,
"text": "append()"
},
{
"answer_id": 74182737,
"author": "trincot",
"author_id": 5459839,
"author_profile"... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/308851/"
] |
74,182,444 | <p>I'm using tailwind css to style a little angular app, the problem is:
i want my form to have a fixed position at the bottom of the page but it seems that classes like "top-100 left-50" are not working</p>
<p>home-component.html</p>
<pre><code><main class="container bg-green-200 h-full m-auto">
<app-search class="fixed top-100"></app-search>
<app-fruits-cards></app-fruits-cards>
</main>
</code></pre>
<p>searchbar-component.html:</p>
<pre><code><form *ngIf="searchForm" [formGroup]="searchForm" (ngSubmit)="onSubmit()" class="bg-slate-100 rounded p-3">
<label for="searchInput">Search</label>
<input formControlName="fruitName" type="text" id="searchInput" class=""/>
<button type="submit" class="rounded-full">search</button>
</form>
</code></pre>
<p>I actually tried to use the "top-100" class into the form element directly but it still doesn't work, what am I doing wrong here?</p>
| [
{
"answer_id": 74182574,
"author": "Barmar",
"author_id": 1491895,
"author_profile": "https://Stackoverflow.com/users/1491895",
"pm_score": 0,
"selected": false,
"text": "append()"
},
{
"answer_id": 74182737,
"author": "trincot",
"author_id": 5459839,
"author_profile"... | 2022/10/24 | [
"https://Stackoverflow.com/questions/74182444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20138556/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.