question_id int64 37.6M 73.2M | input_text stringlengths 88 52.4k | output_text stringlengths 37 35.6k | title stringlengths 15 150 | tags stringlengths 1 107 | q_score int64 -19 397 | view_count int64 3 879k | answer_count int64 1 21 | accepted_answer_id int64 37.6M 73.8M | answer_id int64 37.6M 73.8M | a_score int64 -5 1.29k | is_accepted bool 1
class | creation_date stringlengths 20 24 | input_text_instruct stringlengths 251 52.6k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
72,973,728 | Java - Use a DocumentFilter to limit allowed characters and length<p>Is it possible to use a single <code>DocumentFilter</code> to limit both the allowed characters and the number of characters in a <code>JTextField</code>?
I don't get how to do both and I didn't find any fully working workaround.</p> | <p>Ok, I finally get how it works! I needed to use <code>if</code>s in <code>replace()</code> method, because that's the code that gets called everytime the user inputs/pastes anything in the <code>JTextField</code>:</p>
<ol>
<li>if the already inserted text length (<code>fb.getDocument().getLength()</code>) summed to ... | Java - Use a DocumentFilter to limit allowed characters and length | java|swing|jtextfield|documentfilter | -1 | 47 | 1 | 72,974,794 | 72,974,794 | 1 | true | 2022-07-13T23:38:10.450Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java - Use a DocumentFilter to limit allowed characters and length<p>Is it possible to use a single <code>DocumentFilter</code> to limit both the allowed cha... |
72,779,215 | Multivariable for loop with conditional increment/decrement<p>Is there a neat way to do something like this?</p>
<pre><code> for (int left = 0, right = height.length - 1;
left < height;
height[left] < height[right] ? left++ : right--)
</code></pre>
<p>I will be increasing left only if the... | <p>Yes, you can do that, but I don't see why you would want to. However, to make it work, we just need to make sure that the loop uses valid statements.</p>
<p>Remember that a <code>for</code> loop consists of:</p>
<pre><code>for (initialization; termination; increment) {
statement(s)
}
</code></pre>
<p>Your last s... | Multivariable for loop with conditional increment/decrement | java|for-loop|conditional-statements | 1 | 47 | 2 | 72,780,302 | 72,780,302 | 1 | true | 2022-06-27T23:21:42.093Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multivariable for loop with conditional increment/decrement<p>Is there a neat way to do something like this?</p>
<pre><code> for (int left = 0, right ... |
72,907,967 | Laravel 9 createMany() Child Tables When Parent is Created<p>I'm working on a gardening app for indoor/outdoor home growers. A <code>run</code> has many <code>cultivars</code> and a <code>cultivar</code> belongs to the <code>run</code>.</p>
<p>When a user creates a new <code>run</code>, they enter how many <code>cultiv... | <p>You can use <a href="https://www.php.net/manual/en/control-structures.for.php" rel="nofollow noreferrer"><code>for</code></a> to repeat many <code>create()</code> calls as required:</p>
<pre><code>$run = Run::create([
'tenant_id' => 1,
'name' => $this->name,
'cultivars' => 2
]);
$numberToCr... | Laravel 9 createMany() Child Tables When Parent is Created | php|laravel | 0 | 47 | 1 | 72,908,068 | 72,908,068 | 1 | true | 2022-07-08T07:17:20.947Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Laravel 9 createMany() Child Tables When Parent is Created<p>I'm working on a gardening app for indoor/outdoor home growers. A <code>run</code> has many <cod... |
72,802,710 | How could I combine "default assignment" and conversion to lowercase?<p>I would like to combine default assignment, as seen <a href="https://stackoverflow.com/questions/2013547/assigning-default-values-to-shell-variables-with-a-single-command-in-bash">here</a>, with conversion to lowercase, as seen <a href="https://sta... | <p>Unfortunately, you cannot use nested substitution in bash (and most other shells).</p>
<p>However, in your specific case you can use tools such a <code>tr</code> to handle the lowercase conversion, and use variable substitution to handle the default value.</p>
<p>For instance :</p>
<pre><code>MY_ENV_VAR=$(tr [:upper... | How could I combine "default assignment" and conversion to lowercase? | bash|variable-assignment | 3 | 47 | 4 | 72,803,719 | 72,803,719 | 2 | true | 2022-06-29T14:01:25.050Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How could I combine "default assignment" and conversion to lowercase?<p>I would like to combine default assignment, as seen <a href="https://stackoverflow.co... |
72,815,729 | Add a column to a `tibble` that gives it's list position<p>I have a list of <code>tibbles</code> and I want to add a column to each <code>tibble</code> that represents it's position in a list.</p>
<p>Lets say I have the following:</p>
<pre class="lang-r prettyprint-override"><code>library(tidyverse)
l <- list(
ti... | <p>A possible solution:</p>
<pre class="lang-r prettyprint-override"><code>library(tidyverse)
imap(l, ~ bind_cols(.x, pos = .y))
#> [[1]]
#> # A tibble: 3 x 3
#> x y pos
#> <int> <int> <int>
#> 1 1 3 1
#> 2 2 2 1
#> 3 3 1 1
#>... | Add a column to a `tibble` that gives it's list position | r|dplyr|tidyverse|purrr | 1 | 47 | 1 | 72,815,766 | 72,815,766 | 2 | true | 2022-06-30T12:20:35.047Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add a column to a `tibble` that gives it's list position<p>I have a list of <code>tibbles</code> and I want to add a column to each <code>tibble</code> that ... |
72,817,367 | How to extract an image area and plug it back in the original image?<p>I am working with 3D images(300) of size (128x128x128). I want to extract the image area (remove the background), do some transformation, and plug the transformed part back on the original image. How can I do this in python?</p>
<p>This is what I tr... | <p>Ok, if I've read your question correctly, you want to apply some function, <code>f</code>, to all the voxels which are not background pixels (<code>0</code>)?</p>
<p>In that case, you can do this using the <code>np.where</code> function in <code>numpy</code>, but I'll provide a longer example which does the same thi... | How to extract an image area and plug it back in the original image? | python|numpy|extract|reshape|imaging | 0 | 47 | 1 | 72,818,443 | 72,818,443 | 2 | true | 2022-06-30T14:14:08.490Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to extract an image area and plug it back in the original image?<p>I am working with 3D images(300) of size (128x128x128). I want to extract the image ar... |
72,819,251 | I cant click in a button and selenium not finding element selenium python<p><a href="https://i.stack.imgur.com/3IJiH.png" rel="nofollow noreferrer">Web page inspect</a></p>
<p>I want the bot to click on Ya, Benar
I tried this but it didn't work for me:</p>
<pre><code>driver.find_elements_by_xpath("//*[contains(tex... | <p>If you want to user <code>find_elements_by_xpath</code> procede like this:</p>
<pre><code>buttons = driver.find_elements_by_xpath("//*[contains(text(), 'Ya, Benar')]")
for btn in buttons:
btn.click()
</code></pre>
<p>it means that <code>find_elements_by_xpath</code> returns an array</p> | I cant click in a button and selenium not finding element selenium python | python|selenium|selenium-webdriver|xpath|webdriver | 1 | 47 | 2 | 72,819,548 | 72,819,548 | 2 | true | 2022-06-30T16:37:58.110Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I cant click in a button and selenium not finding element selenium python<p><a href="https://i.stack.imgur.com/3IJiH.png" rel="nofollow noreferrer">Web page ... |
72,833,544 | Nested dictionary from API - in python<p>I have a API, from which Iam trying to create a output as a nested json/dict.</p>
<p>API looks somehow like this:</p>
<pre><code>{
"skuNO": "SK0011 - Green Stator with Terminal Box",
"toStationLocation": "Line 1 - Statio... | <pre><code>final_dict = {}
for data in test_data:
key = data["toStationLocation"]
sku = data["skuNO"].split()[0]
quant = int(data["quantity"])
if key not in final_dict:
final_dict[key] = {sku: quant}
elif sku not in final_dict[key]:
final_dict[key][... | Nested dictionary from API - in python | python|dictionary | 0 | 47 | 2 | 72,833,755 | 72,833,755 | 2 | true | 2022-07-01T18:51:54.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Nested dictionary from API - in python<p>I have a API, from which Iam trying to create a output as a nested json/dict.</p>
<p>API looks somehow like this:</p... |
72,831,106 | MySQL Node.js module: Unable to create connection pool. Error: Access denied for user<p>I am trying to create a connection pool using:</p>
<pre><code> mysql.createPool(dbConnOptions)
</code></pre>
<p>My dbConnOptions object is:</p>
<pre><code> var dbConnOptions = {
host: '192.168.5.1... | <p>You have created a user <code>johndoe@localhost</code> but you try to access the db with <code>johndoe@myhost</code> and there is no user <code>johndoe@%</code> so you can't grant any privileges to that user.</p>
<p><code>johndoe@host1</code> and <code>johndoe@host2</code> are two totally different users (eventhough... | MySQL Node.js module: Unable to create connection pool. Error: Access denied for user | mysql|node.js|connection-pooling | 0 | 47 | 1 | 72,838,074 | 72,838,074 | 2 | true | 2022-07-01T14:55:23.533Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MySQL Node.js module: Unable to create connection pool. Error: Access denied for user<p>I am trying to create a connection pool using:</p>
<pre><code> mysql... |
72,844,023 | How to run scanner in a while loop<pre><code> public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("1 - login");
System.out.println("2 - regrister");
int firstSelection = scanner.nextInt();
while(firstSelection > 2 || ... | <pre><code>public static void main(String[] args) {
int firstSelection;
Scanner scanner = new Scanner(System.in);
while (true) {
System.out.println("1 - login");
System.out.println("2 - regrister");
firstSelection = scanner.nextInt();
if (firstSelection =... | How to run scanner in a while loop | java|while-loop|duplicates|java.util.scanner | 1 | 47 | 2 | 72,844,112 | 72,844,112 | 2 | true | 2022-07-03T05:06:02.850Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to run scanner in a while loop<pre><code> public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.p... |
72,850,262 | Python class inheritance dynamic class variable<p>This is what I want to do:</p>
<pre><code>class Base:
_type = None
name: str = _type.name
class a(Base):
_type = UnityType
a_instance = a()
a_instance.name # Expecting UnityType.name to be some string.
</code></pre>
<p>While trying this, I get <code>'None... | <p>I think you need <code>Base.name</code> to be a <code>property</code>, so that it's evaluated when it's accessed rather than when <code>Base</code> is defined:</p>
<pre><code>from typing import Optional, Protocol, Type
class Named(Protocol):
name: str
class Base:
_type: Optional[Type[Named]] = None
@c... | Python class inheritance dynamic class variable | python|class|oop|inheritance | 0 | 47 | 1 | 72,850,314 | 72,850,314 | 2 | true | 2022-07-03T22:17:18.220Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python class inheritance dynamic class variable<p>This is what I want to do:</p>
<pre><code>class Base:
_type = None
name: str = _type.name
class a(... |
72,850,308 | File Read/Write in Python<p>The code below works for updating my json file but it unnecessarily opens the file twice, once to read and then to write. I tried opening it with 'r+' instead of 'r', but then it appended the revised json instead of replacing the original file. 'w+' also didn't work - the file couldn't be re... | <p>That's already a good way to do it. The "w" also deletes the existing file so that you don't have to worry about existing data when you add new stuff. If you want to do it without reopening, you could seek to the beginning and truncate the file</p>
<pre><code>with open(shared_file_path,'r+') as json_file:
... | File Read/Write in Python | python|python-3.x | 0 | 47 | 2 | 72,850,503 | 72,850,503 | 2 | true | 2022-07-03T22:27:47.420Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
File Read/Write in Python<p>The code below works for updating my json file but it unnecessarily opens the file twice, once to read and then to write. I tried... |
72,854,874 | how to detect if the button back of the phone is pressed?<p>is it possible to detect that user clicked on the button back of the phone as this image and change it functionality for example if the user clicked on that button i want to take him to the page Data() not to the previous page .
<a href="https://i.stack.imgu... | <p>WillPopScope widget can detect your backpress</p>
<pre><code>@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
///your code here...
return false;
},
child:Scaffold(),
);
}
</code></pre> | how to detect if the button back of the phone is pressed? | flutter | 1 | 47 | 2 | 72,855,189 | 72,855,189 | 2 | true | 2022-07-04T09:56:04.043Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to detect if the button back of the phone is pressed?<p>is it possible to detect that user clicked on the button back of the phone as this image and cha... |
72,864,441 | Spring Data JPA vs Hibernate : Where are the implementation of methods in JPARepository?<p>I'm new to JPA and Hibernate. I understand that Hibernate is a implementation of JPA but Spring Data JPA is a JPA Data Access Abstraction (and not an implementation of JPA).</p>
<p>But</p>
<p><strong>StudentRepository.java</stron... | <p>The <a href="https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-starters/spring-boot-starter-data-jpa/build.gradle" rel="nofollow noreferrer"><code>spring-boot-starter-data-jpa</code></a> includes Hibernate. The starters are, as the name implies, starters to make it easier for y... | Spring Data JPA vs Hibernate : Where are the implementation of methods in JPARepository? | spring|spring-boot|hibernate|jpa|spring-data-jpa | 0 | 47 | 1 | 72,864,478 | 72,864,478 | 2 | true | 2022-07-05T05:37:51.047Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spring Data JPA vs Hibernate : Where are the implementation of methods in JPARepository?<p>I'm new to JPA and Hibernate. I understand that Hibernate is a imp... |
72,878,044 | How to show list of data based on the user in Laravel<p>I have two table (three actually, but in this context it's only related to these two tables), Pekerjaan and User. Both table are in eloquent. User hasMany pekerjaans, and Pekerjaan belongsTo User. In the User table it has status 'super' and 'ppk'. 'Super' is a sup... | <pre><code> public function tabelpekerjaan(){
if(Auth::user()->status=='super'){
$pekerjaan = Pekerjaan::with('penyedia')->paginate();
return view('admin.datapekerjaan', compact('pekerjaan'));
}else{
$pekerjaan = Auth::user()->pekerjaans;
return view('admin.datapekerjaan... | How to show list of data based on the user in Laravel | php|mysql|laravel|eloquent | 2 | 47 | 1 | 72,878,156 | 72,878,156 | 2 | true | 2022-07-06T04:42:42.660Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to show list of data based on the user in Laravel<p>I have two table (three actually, but in this context it's only related to these two tables), Pekerja... |
72,878,152 | What is the time and space complexity of this code? I'm very confused on this subject so I am asking<p>This is my code, it is a russian peasant multiplication algorithm. I find the time and space complexity very confusing so I needed some help.</p>
<p>This is also for java language</p>
<p>Thank you.</p>
<pre><code>int ... | <p>The loop continues to execute provided that <code>num2</code> be greater than zero. After each iteration of the loop, <code>num2</code> is halved. This means that the loop will execute <code>log_2(num2)</code> times. So, assuming <code>num2</code> be represented by <code>N</code>, we can say that the complexity o... | What is the time and space complexity of this code? I'm very confused on this subject so I am asking | java|time-complexity|space-complexity | -1 | 47 | 1 | 72,878,178 | 72,878,178 | 2 | true | 2022-07-06T05:02:53.043Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the time and space complexity of this code? I'm very confused on this subject so I am asking<p>This is my code, it is a russian peasant multiplicatio... |
72,879,687 | How to check that a string follows a format in python?<p>I want to check if a value of the string variable follows the format <code>x.y.z</code> i.e</p>
<pre><code> version = "1.0.5" -- True
version ="2.2" -- False
</code></pre>
<p>How to do this in python?</p> | <p>As comments sugegsted, the best solution is to use regular expression:</p>
<pre><code>import re
pattern = re.compile("[0-9].[0-9].[0-9]")
print(True if pattern.match("1.0.5") != None else False)
</code></pre>
<p><strong>Output:</strong></p>
<pre><code>True
</code></pre> | How to check that a string follows a format in python? | python|python-3.x|string | -4 | 47 | 1 | 72,879,775 | 72,879,775 | 2 | true | 2022-07-06T07:47:12.690Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to check that a string follows a format in python?<p>I want to check if a value of the string variable follows the format <code>x.y.z</code> i.e</p>
<pre... |
72,879,663 | How to check default first radio button in angular material<p>Trying to checked the first radio button as default. But I do not know how to do it. If any one knows please help to find the solution.</p>
<p>app.component.html:</p>
<pre class="lang-html prettyprint-override"><code> <div class="input"&g... | <p>You can add the index to <code>*ngFor</code> and set <code>checked</code> when index is equal to zero.</p>
<pre class="lang-html prettyprint-override"><code><div class="input">
<mat-radio-group class="radio-group">
<mat-radio-button
class="radio-button"
... | How to check default first radio button in angular material | angular|angular-material|angular8 | -1 | 47 | 1 | 72,879,851 | 72,879,851 | 2 | true | 2022-07-06T07:45:35.050Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to check default first radio button in angular material<p>Trying to checked the first radio button as default. But I do not know how to do it. If any one... |
72,883,068 | How to verify if my app have ALL_FILES_ACCESS_PERMISSION?<p>I give all files access by this method :</p>
<pre><code>if (!hasPermissionToManageFiles(myContext)){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R){
try {
Intent intentFiles = new Intent();
intentFiles.setAction(Settings.ACTION_MANA... | <p>According to the <a href="https://developer.android.com/reference/android/os/Environment#isExternalStorageManager()" rel="nofollow noreferrer">docs</a> you should use <code>Environment.isExternalStorageManager</code> method instead of the <code>checkSelfPermission</code>.</p> | How to verify if my app have ALL_FILES_ACCESS_PERMISSION? | java|android|permissions|scoped-storage | 1 | 47 | 1 | 72,883,517 | 72,883,517 | 2 | true | 2022-07-06T11:47:16.180Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to verify if my app have ALL_FILES_ACCESS_PERMISSION?<p>I give all files access by this method :</p>
<pre><code>if (!hasPermissionToManageFiles(myContext... |
72,886,738 | iOS: How to create a scrollable UIStackView?<p><a href="https://i.stack.imgur.com/rsfXw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rsfXw.png" alt="I am trying to recreate this" /></a></p>
<p>How can i create something like this? I believe the labels should be buttons because i would like to clic... | <p>Did you tried to adopt <code>UICollectionView</code> insted of StackView?</p>
<p>I think it could support this approach better than StackViews</p> | iOS: How to create a scrollable UIStackView? | ios|swift|uikit | -2 | 47 | 2 | 72,886,845 | 72,886,845 | 2 | true | 2022-07-06T16:05:56.903Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
iOS: How to create a scrollable UIStackView?<p><a href="https://i.stack.imgur.com/rsfXw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rs... |
72,889,702 | i am working on a game in python arcade for a school asessment, and i have a timer to spawn enemies over time, it tries to spawn them in menu screen<p>im working on a python arcade game, where you run around a top-down world, shooting zombies that spawn over time. i am using a timer to spawn enemies every few seconds, ... | <p>Within your <code>on_update()</code> method move this if block</p>
<pre><code> if self.total_time > self.enemy_diff:
for i in range(self.enemy_count):
# enemy texture
enemy = arcade.Sprite(":resources:images/animated_characters/zombie/zombie_idle.png", ... | i am working on a game in python arcade for a school asessment, and i have a timer to spawn enemies over time, it tries to spawn them in menu screen | python|arcade | 1 | 47 | 1 | 72,890,831 | 72,890,831 | 2 | true | 2022-07-06T20:50:21.627Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
i am working on a game in python arcade for a school asessment, and i have a timer to spawn enemies over time, it tries to spawn them in menu screen<p>im wor... |
72,903,471 | Rename a column based on the content of it<p>I saw some similar questions but not quite the one I was looking for.</p>
<p>I have a excel sheet that is delivered to me:</p>
<ul>
<li>The columns I need are there</li>
<li>the column names are on the second row</li>
<li>but <strong>the order of the columns may vary</strong... | <p>You can use a boolean mask to find the right column:</p>
<pre><code>df.columns = [c if not m else 'city'
for c, m in zip(df.columns, df.eq('Brussels').any())]
print(df)
# Output
name city number
1 Nick Brussels 15
2 Tom Paris 14
</code></pre> | Rename a column based on the content of it | python|pandas|dataframe|multiple-columns|rename | 0 | 47 | 2 | 72,903,605 | 72,903,605 | 2 | true | 2022-07-07T19:48:15.837Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rename a column based on the content of it<p>I saw some similar questions but not quite the one I was looking for.</p>
<p>I have a excel sheet that is delive... |
72,911,734 | How to set the value of a list to NA, depending on value in another column<p>I have a dataframe <code>df_list</code> which contains a column <code>cars</code> of class list.
I want to set the value of the list in column cars to <code>NA</code> if the value in column <code>gear</code> is equal to 3.</p>
<p>Below some of... | <p>You can just use <code>ifelse</code>:</p>
<pre class="lang-r prettyprint-override"><code>df_list %>%
mutate(cars = ifelse(gear == 3, NA, cars))
</code></pre>
<p>This gives:</p>
<pre class="lang-r prettyprint-override"><code>[[1]]
[1] NA
[[2]]
[1] "Mazda RX4" "Mazda RX4 Wag" "Da... | How to set the value of a list to NA, depending on value in another column | r|tidyverse|purrr | 1 | 47 | 2 | 72,911,796 | 72,911,796 | 2 | true | 2022-07-08T12:53:00.017Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to set the value of a list to NA, depending on value in another column<p>I have a dataframe <code>df_list</code> which contains a column <code>cars</code... |
72,905,809 | Change color of Bokeh CrosshairTool<p>Is there a way to change the color for CrosshairTool in Bokeh?</p>
<p>From <a href="https://stackoverflow.com/a/63812308/1090455">another related question</a> I borrowed this example code:</p>
<pre><code>import numpy as np
from bokeh.plotting import figure, show
from bokeh.layouts ... | <p>As per the documentation: <a href="http://docs.bokeh.org/en/latest/docs/reference/models/tools.html#crosshairtool" rel="nofollow noreferrer">http://docs.bokeh.org/en/latest/docs/reference/models/tools.html#crosshairtool</a></p>
<p>Set the public attributes <code>line_color</code> and <code>line_alpha</code> to modif... | Change color of Bokeh CrosshairTool | python|bokeh | 0 | 47 | 1 | 72,912,462 | 72,912,462 | 2 | true | 2022-07-08T01:31:50.847Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change color of Bokeh CrosshairTool<p>Is there a way to change the color for CrosshairTool in Bokeh?</p>
<p>From <a href="https://stackoverflow.com/a/6381230... |
72,887,592 | Build error: Primefaces 11.0.0 release from source<p>Build primefaces 11.0.0 release:</p>
<blockquote>
<p>mvn clean install -Prelease -X</p>
</blockquote>
<pre><code>[DEBUG] Generating signature for primefaces\target\primefaces-parent-11.0.0.pom
[INFO] -------------------------------------------------------------------... | <p>To do the build and minify the resources run this Maven command.</p>
<p><code>mvn clean install -Pminify</code></p> | Build error: Primefaces 11.0.0 release from source | maven|build|primefaces|release | 1 | 47 | 1 | 72,912,552 | 72,912,552 | 2 | true | 2022-07-06T17:19:28.937Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Build error: Primefaces 11.0.0 release from source<p>Build primefaces 11.0.0 release:</p>
<blockquote>
<p>mvn clean install -Prelease -X</p>
</blockquote>
<p... |
72,913,013 | Why doesn't work the multer as a middleware?<p>I the app.js there is a direct route <code>app.post('/upload', upload.single('image'), (req, res) => { res.json({ message: 'pic uploaded' }); });</code></p>
<p>When I make a post request to <code>/upload</code>, the image will be uploaded. However, when I use it like <c... | <p>Your statement</p>
<pre class="lang-js prettyprint-override"><code>cb(null, '../images');
</code></pre>
<p>contains a relative path, which is probably evaluated relative to the current working directory of the Node.js process. It is safer to make it relative to the directory containing the Javascript file <code>phon... | Why doesn't work the multer as a middleware? | node.js|express|multer | 0 | 47 | 1 | 72,913,754 | 72,913,754 | 2 | true | 2022-07-08T14:35:42.470Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why doesn't work the multer as a middleware?<p>I the app.js there is a direct route <code>app.post('/upload', upload.single('image'), (req, res) => { res.... |
72,930,674 | lua: Can I use string to use variable?<p>I want string to use variable.</p>
<pre><code>variable1 = "Hello"
a = "variable" .. 1
print(a)
</code></pre>
<p>but it printed variable1 (of cource), <br />
Can I print "Hello"(variable1) using variable a?</p> | <p>Yes, this is exactly what <a href="https://www.lua.org/pil/11.html" rel="nofollow noreferrer">tables</a> are for - you can just rewrite your code as</p>
<pre class="lang-lua prettyprint-override"><code>local variables = {}
variables.variable1 = "Hello"
local a = "variable" .. 1
print(variables[a]... | lua: Can I use string to use variable? | lua | 0 | 47 | 1 | 72,930,711 | 72,930,711 | 2 | true | 2022-07-10T17:53:13.650Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
lua: Can I use string to use variable?<p>I want string to use variable.</p>
<pre><code>variable1 = "Hello"
a = "variable" .. 1
print(a)
<... |
72,946,707 | Combine grouped DF in Julia with Floats and Strings<p>I have a bunch of Grouped DataFrames <code>gdf</code> that I want to combine. I want to combine the GDF with the mean var1 which is a Float and the first element of var2 which is a String.</p>
<p>I tried</p>
<pre><code>combine(gdf, :var1 .=> mean, :var2 .=> fi... | <p>This is the way to do it with DataFrames.jl:</p>
<pre><code>julia> using DataFrames
julia> using Statistics
julia> df = DataFrame(id=[1,2,1,2,1,2], var1=1.5:1:6.5, var2=string.(1:6))
6×3 DataFrame
Row │ id var1 var2
│ Int64 Float64 String
─────┼────────────────────────
1 │ 1 1.... | Combine grouped DF in Julia with Floats and Strings | julia|split-apply-combine|julia-dataframe | 2 | 47 | 1 | 72,947,525 | 72,947,525 | 2 | true | 2022-07-12T03:25:38.233Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Combine grouped DF in Julia with Floats and Strings<p>I have a bunch of Grouped DataFrames <code>gdf</code> that I want to combine. I want to combine the GDF... |
72,949,458 | How to run the equivalent of Excel's cumulative countifs in R using dplyr?<p>I am trying to run the equivalent of Excel's cumulative countifs formulas in R, using dplyr, but am having problems. I can run countifs in dplyr, but not accumulating the countifs row by row, as illustrated below in the Excel excerpt. I am try... | <p>Using <code>group_by</code> and <code>cumsum</code> you could do:</p>
<pre class="lang-r prettyprint-override"><code>library(dplyr)
Class_to_Count <- 1
myData |>
group_by(Element) |>
mutate(Class_Count = cumsum(Class == Class_to_Count))
#> # A tibble: 7 × 3
#> # Groups: Element [3]
#> E... | How to run the equivalent of Excel's cumulative countifs in R using dplyr? | r|excel|dplyr|countif | 1 | 47 | 2 | 72,949,777 | 72,949,777 | 2 | true | 2022-07-12T08:48:02.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to run the equivalent of Excel's cumulative countifs in R using dplyr?<p>I am trying to run the equivalent of Excel's cumulative countifs formulas in R, ... |
72,952,101 | Database does not update after a method with Doctrine<p>I am creating a library management system in Symfony to progress.</p>
<p>So I have a book, user, category entity.</p>
<p>So I want to create the borrow a book function.
However, when I perform the action, the book does not change in the database (book must become ... | <p>You are updating the borrowed boolean when availability is equal to true.</p>
<p>What you want to do is check if the book is not borrowed, and if it's not update the value of your boolean.</p>
<p>You do not need to persist <code>$book</code> and <code>$user</code> since they are already persisted. Also you only need... | Database does not update after a method with Doctrine | php|symfony|doctrine | 0 | 47 | 1 | 72,952,206 | 72,952,206 | 2 | true | 2022-07-12T12:11:11.843Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Database does not update after a method with Doctrine<p>I am creating a library management system in Symfony to progress.</p>
<p>So I have a book, user, cate... |
72,952,920 | GoogleAPI, Python: How to avoid getting ID of specified file in Google Drive<p>I have this part of script which is listing files in my local folder, replaces old files in Google Drive by files from local folder and adds new files to Google Drive from local folder.</p>
<p>How to modify the script to check if there is fi... | <p>Okay first off i am not a python expert but I can see the issue. In the sction of code below. You create the new file. which returns to you a file id.</p>
<pre><code>id = file.get("id")
</code></pre>
<p>Yet you are still returning</p>
<pre><code>return items[0]["id"]
</code></pre>
<p>which is e... | GoogleAPI, Python: How to avoid getting ID of specified file in Google Drive | python|google-api|google-drive-api|google-api-python-client | 1 | 47 | 1 | 72,953,079 | 72,953,079 | 2 | true | 2022-07-12T13:13:35.733Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
GoogleAPI, Python: How to avoid getting ID of specified file in Google Drive<p>I have this part of script which is listing files in my local folder, replaces... |
72,954,255 | extracting data from unstructured JSON in big query<p>I have JSON as a string in a big query field:</p>
<pre><code>[{"name":"user_group","value":"regular"},{"name":"checkout_version","value":"2.2"},{"name":"currency",&qu... | <p>consider below query</p>
<pre class="lang-sql prettyprint-override"><code>WITH json_data AS (
SELECT '[{"name":"user_group","value":"regular"},{"name":"checkout_version","value":"2.2"},{"name":"currency","value... | extracting data from unstructured JSON in big query | sql|json|regex|google-bigquery | 0 | 47 | 1 | 72,954,371 | 72,954,371 | 2 | true | 2022-07-12T14:48:16.853Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
extracting data from unstructured JSON in big query<p>I have JSON as a string in a big query field:</p>
<pre><code>[{"name":"user_group",... |
72,955,015 | Python regex replacement with str.replace. Pattern (wordhypenword) Replacement (wordspacehypenspaceword)<p>I have the following regex pattern word-word, so</p>
<pre><code>r'\w+\-\w+
</code></pre>
<p>I would like to replace it with</p>
<pre><code>r'\w+\s\-\s\w+
</code></pre>
<p><strong>Example:</strong>
I would like to... | <p>You can not use a new pattern in the replacement. Instead you can use 2 capture groups in the initial pattern, and use <code>\1 - \2</code> in the replacement.</p>
<p>You can capture <code>-</code> also in a group, but as it is a single character that you are literally matching you can also just use that in the repl... | Python regex replacement with str.replace. Pattern (wordhypenword) Replacement (wordspacehypenspaceword) | python|python-3.x|regex|pattern-matching | 0 | 47 | 1 | 72,955,082 | 72,955,082 | 2 | true | 2022-07-12T15:44:00.207Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python regex replacement with str.replace. Pattern (wordhypenword) Replacement (wordspacehypenspaceword)<p>I have the following regex pattern word-word, so</... |
72,960,367 | Take inverse of multiple columns in R dataframe at the same time<p>In the following data frame <code>df</code>, I want to take the inverse of columns "l3" to "l5". I could do this column by column like <code>df$l3 <- 1 / df$l3</code>. But how can I do this for multiple columns at the same time? I... | <p>In this case <code>dplyr</code>s <code>mutate(across(..</code> is very handy:</p>
<pre><code>library(dplyr)
df %>%
mutate(across(l3:l5, ~1/.))
</code></pre>
<pre><code>level l1 l2 l3 l4 l5 l6 l7 l8
1 A 1 1 1.0000000 1.0000000 1.0000000 1 1 1
2 A 2 2 0.5000000 0.5000000 0.... | Take inverse of multiple columns in R dataframe at the same time | r|dataframe | 0 | 47 | 2 | 72,960,511 | 72,960,511 | 2 | true | 2022-07-13T02:47:13.967Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Take inverse of multiple columns in R dataframe at the same time<p>In the following data frame <code>df</code>, I want to take the inverse of columns "l... |
72,974,891 | How do I merge two dataframes by partial string match?<p>I have two dataframes of Premier League soccer players:</p>
<p>df1:</p>
<pre><code>ID Player Team Pos
1 Gabriel Dos Santos Arsenal DF
218 Conor Gallagher Crystal Palace MF
396 Gabriel Jesus Manches... | <p>You can use the package <code>fuzzywuzzy</code> to do fuzzy matching.</p>
<pre><code>import pandas as pd
from fuzzywuzzy import fuzz
from fuzzywuzzy import process
df1 = pd.DataFrame({'Key':['Apple', 'Banana', 'Orange', 'Strawberry']})
df2 = pd.DataFrame({'Key':['Aple', 'Mango', 'Orag', 'Straw', 'Bannanna', 'Berry'... | How do I merge two dataframes by partial string match? | python|pandas|join|merge|substring | 0 | 47 | 1 | 72,975,637 | 72,975,637 | 2 | true | 2022-07-14T03:33:07.133Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I merge two dataframes by partial string match?<p>I have two dataframes of Premier League soccer players:</p>
<p>df1:</p>
<pre><code>ID Player ... |
72,977,288 | What's the proper regex for removing "?()"<p>I am trying to remove <strong>?,() and "</strong> from the below string my initial matches are working but for these 3 it not matching kindly suggest what is the issue here</p>
<pre><code>data = "(The rain - :in ,Spain?)"
regexpat = re.sub(r"'|,|;|.|:|... | <p>You can use a character class to shorten the pattern, and escape the dot to match it literally.</p>
<p>Using <code>/?</code> in an alternation matches an optional <code>/</code>, but you can just add the <code>/</code>to the character class. If you also meant to match <code>?</code> you can also add that one.</p>
<p... | What's the proper regex for removing "?()" | python|python-3.x|regex|regression | 1 | 47 | 3 | 72,977,514 | 72,977,514 | 2 | true | 2022-07-14T08:12:26.403Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What's the proper regex for removing "?()"<p>I am trying to remove <strong>?,() and "</strong> from the below string my initial matches are working but ... |
72,980,351 | How can pass data from recyclerview to New Activity<p>hi i want parse my data in to new activity .
I did this but it doesn't work properly and it doesn't transfer data
You can see my code below</p>
<p>my adapter
ItemViewAdapter.kt</p>
<pre><code> package com.example.app.adapter
import android.content.Context
import... | <p>When you set the data, you call <code>getItemId(position)</code> for every single line. This returns a <code>long</code>, not a string (and you put the same <code>long</code> for each attribute, which makes no sense)</p>
<pre class="lang-kotlin prettyprint-override"><code>intent.putExtra("title", getItemId... | How can pass data from recyclerview to New Activity | android|kotlin|android-recyclerview | 0 | 47 | 2 | 72,980,615 | 72,980,615 | 2 | true | 2022-07-14T12:16:16.340Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can pass data from recyclerview to New Activity<p>hi i want parse my data in to new activity .
I did this but it doesn't work properly and it doesn't tra... |
72,981,224 | Search number in array C<p>For some reason, the option does not work for me when I enter a number that is not in the array. And at the same time, how can I do it when, for example, I enter</p>
<pre class="lang-none prettyprint-override"><code>Enter the 1st element (-1 for the end of the entry): 1
Enter the 1st element ... | <ul>
<li>You invoked <em>undefined behavior</em> by using the value of uninitialized non-static local variable <code>n</code> in the loop conditions <code>i<n</code>. You should use the number of elements of the array instead of <code>n</code> in the first loop, and set <code>n</code> to <code>i</code> after the fir... | Search number in array C | arrays|c | 0 | 47 | 1 | 72,981,425 | 72,981,425 | 2 | true | 2022-07-14T13:20:35.083Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Search number in array C<p>For some reason, the option does not work for me when I enter a number that is not in the array. And at the same time, how can I d... |
72,974,484 | Add a column with filename to Psql table in nifi<p>I have a table that consists of 2 columns</p>
<pre><code> cattlegendernm | price
----------------+-------
Female | 10094
Female | 12001
Male | 12704
</code></pre>
<p>I would like to add another column with filename to this... | <p>Using a <em><strong>PutSQL</strong></em> processor would be suitable to add such a DDL statement like</p>
<pre><code>ALTER TABLE T ADD COLUMN filename VARCHAR(150)
</code></pre>
<p>into the <em><strong>SQL Statement</strong></em> attribute of the <em><strong>properties</strong></em> tab as illustrated below</p>
<p><... | Add a column with filename to Psql table in nifi | postgresql|apache-nifi | 1 | 47 | 1 | 72,986,421 | 72,986,421 | 2 | true | 2022-07-14T02:18:04.750Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add a column with filename to Psql table in nifi<p>I have a table that consists of 2 columns</p>
<pre><code> cattlegendernm | price
----------------+-------... |
72,986,853 | How to print specific json data for multiple instances?<pre><code>import requests
url = "https://api.gametools.network/bf1/players/?gameId=7218126050214"
r = requests.get(url)
data = r.json()
print(data['teams'][1]['players'][0]['name'])
print(data['teams'][1]['players'][1]['name'])
print(data['teams'][1]['p... | <p>Here is how to iterate over a list:</p>
<pre><code>l = [1, 2, 3, 4]
for element in l:
print(l)
</code></pre>
<p>Once you know that, it's only a matter of breaking nested iteration problems down to their simplest form above. So you just need to get the list which you need to iterate over, and then use the above ... | How to print specific json data for multiple instances? | python|json|discord.py | 1 | 47 | 2 | 72,986,945 | 72,986,945 | 2 | true | 2022-07-14T21:30:37.137Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to print specific json data for multiple instances?<pre><code>import requests
url = "https://api.gametools.network/bf1/players/?gameId=721812605021... |
72,991,109 | Year-month-week expression<p>I have a data written in specific expression. To simplify the data, here is the example I made:</p>
<pre><code>df<-data.frame(date=c(2012034,2012044,2012051,2012063,2012074),
math=c(100,100,23,46,78))
</code></pre>
<p><code>2012034</code> means 4th week of march,2012. Like... | <p>One way to do it is by also specifying the day of the week and subtract it at the end, i.e.</p>
<pre><code>as.Date(paste0(df$date, '-1'), '%Y%m%U-%u') - 1
#[1] "2012-03-22" "2012-04-22" "2012-05-01" "2012-06-15" "2012-07-22"
</code></pre> | Year-month-week expression | r|dataframe|time | 0 | 47 | 1 | 72,991,447 | 72,991,447 | 2 | true | 2022-07-15T08:24:05.863Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Year-month-week expression<p>I have a data written in specific expression. To simplify the data, here is the example I made:</p>
<pre><code>df<-data.frame... |
72,991,846 | Pandas adding values into the dataframe<p>Here is my code where I'm trying to add/append new values to the third column:</p>
<pre><code> file = 'excel_name.xlsx'
df = pd.read_excel(file, engine='openpyxl')
print(df)
df.insert(3, 'sub', [1, 7, 4, 1])
print('test', df)
</code></pre>... | <p>you can use this. This will work for both even and uneven length of list which doesn't match for the length of columns</p>
<pre><code>l = [1,7,4,1]
df.loc[range(len(l)),'sub'] = l
</code></pre> | Pandas adding values into the dataframe | python|pandas | 2 | 47 | 2 | 72,992,135 | 72,992,135 | 2 | true | 2022-07-15T09:26:49.693Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas adding values into the dataframe<p>Here is my code where I'm trying to add/append new values to the third column:</p>
<pre><code> file = 'excel... |
73,005,327 | My string letter replacement code doesn't work<pre><code>import re
text = input("Enter text: ")
text = text.lower()
len = len(text)
lenid = len - 1
def translate(text):
translation = ""
slocid = text.index("s")
for letter in text:
if (text[lenid] == "s") or (... | <p>You currently translate the text character by character, but your regex and <code>replace</code> work on the whole string so you can just apply them to the whole string instead.</p>
<pre><code>def translate(text):
return re.sub(r"s\b", "ς", text)\
.replace("s", "σ&qu... | My string letter replacement code doesn't work | python|string|replace | 2 | 47 | 2 | 73,005,499 | 73,005,499 | 2 | true | 2022-07-16T15:13:23.373Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
My string letter replacement code doesn't work<pre><code>import re
text = input("Enter text: ")
text = text.lower()
len = len(text)
lenid = len - 1... |
73,006,876 | Join/ Merge 2 Comma Separated Text Files<p>I would really appreciate assistance in developing Python/ Pandas code to left-join 2 separate CSV files. I'm very new to Python so unclear how to begin. I have used Excel plugins to achieve same but it would normally hang or take hours to complete due to the huge amount of re... | <p>You can use <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.merge.html#pandas.merge" rel="nofollow noreferrer"><code>.merge</code></a> with <code>indicator=</code> parameter:</p>
<pre class="lang-py prettyprint-override"><code>out = df1.merge(
df2, left_on="AN", right_on=&quo... | Join/ Merge 2 Comma Separated Text Files | python|pandas|csv | 1 | 47 | 2 | 73,006,914 | 73,006,914 | 2 | true | 2022-07-16T18:52:17.133Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Join/ Merge 2 Comma Separated Text Files<p>I would really appreciate assistance in developing Python/ Pandas code to left-join 2 separate CSV files. I'm very... |
73,007,076 | QListView context menu gets wrong context<p>I write a PySide6 application where I have a layout with three QListView widgets next to each other. Each displays something with a different list model, and all shall have a context menu. What doesn't work is that the right list model or list view gets resolved. This leads t... | <p>This is happening because lambdas are not immutable objects. All non parameter variables used inside of a lambda will update whenever that variable updates.</p>
<p>So when you connect to the slot:</p>
<pre><code>lambda pos: self.show_context_menu(list_view, pos)
</code></pre>
<p>On each iteration of your for loop y... | QListView context menu gets wrong context | python|qt|pyside6 | 1 | 47 | 1 | 73,010,065 | 73,010,065 | 2 | true | 2022-07-16T19:26:05.157Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
QListView context menu gets wrong context<p>I write a PySide6 application where I have a layout with three QListView widgets next to each other. Each display... |
73,011,807 | QML Button assign arrow shortcut<p>Is it possible to assign an arrow shortcut to a QML Button? With the Action item I can assign a shortcut by string or by KeySequence (<a href="https://doc.qt.io/qt-6/qml-qtquick-controls2-action.html#shortcut-prop" rel="nofollow noreferrer">https://doc.qt.io/qt-6/qml-qtquick-controls2... | <p>you can use <a href="https://doc.qt.io/qt-6/qml-qtquick-shortcut.html" rel="nofollow noreferrer">Shortcut</a> ,like this :</p>
<pre><code>import QtQuick
import QtQuick.Controls 2.15
Window {
width: 640
height: 480
visible: true
title: qsTr("Shortcut")
Button {
id: button
... | QML Button assign arrow shortcut | qt|qml|qtquick2 | 1 | 47 | 1 | 73,011,931 | 73,011,931 | 2 | true | 2022-07-17T12:33:09.893Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
QML Button assign arrow shortcut<p>Is it possible to assign an arrow shortcut to a QML Button? With the Action item I can assign a shortcut by string or by K... |
73,018,420 | How to sort Option List in alphabetical order in ReactJS<p>Beginner at JavaScript and ReactJs.
I'm trying to sort this list while displaying options on the front end.</p>
<pre><code> <Select
value={Reactivity}
options={[
{ label: "Chicken", value: "Ch... | <p>You can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort" rel="nofollow noreferrer">Array.sort</a></p>
<pre class="lang-js prettyprint-override"><code><Select
value={Reactivity}
options={[
{ label: "Chicken", value: "Chicken&qu... | How to sort Option List in alphabetical order in ReactJS | javascript|reactjs | 0 | 47 | 2 | 73,018,439 | 73,018,439 | 2 | true | 2022-07-18T07:05:04.773Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to sort Option List in alphabetical order in ReactJS<p>Beginner at JavaScript and ReactJs.
I'm trying to sort this list while displaying options on the f... |
73,023,654 | GKE public endpoint - will it change?<p>I have a GKE cluster that has a public IP for the master. For example, when I run <code>gcloud container clusters describe</code>, I see a line like below:</p>
<pre><code>publicEndpoint: 34.68.128.12
</code></pre>
<p>Questions:</p>
<ol>
<li>Does the public IP change arbitrarily?<... | <p>I believe public endpoints on GKE are immutable, so it will not change.</p> | GKE public endpoint - will it change? | google-kubernetes-engine|gke-networking | 0 | 47 | 2 | 73,025,115 | 73,025,115 | 2 | true | 2022-07-18T14:04:51.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
GKE public endpoint - will it change?<p>I have a GKE cluster that has a public IP for the master. For example, when I run <code>gcloud container clusters des... |
73,009,228 | How to type pass through function decorators<p>The illustrative <code>enhanceFn</code> function below doesn't change the passed in function type <code>T</code> only wraps it with additional functionality - such as logging. <code>as unknown as T</code> overrides the return type and the <code>any[]</code> type is used in... | <blockquote>
<p>The illustrative <code>enhanceFn</code> function below doesn't change the passed in function type <code>T</code> only wraps it with additional functionality - such as logging</p>
</blockquote>
<p>In the example, you provided, that's not quite the case. TS infers your <code>fn</code> type like this:</p>
... | How to type pass through function decorators | typescript | 2 | 47 | 1 | 73,009,404 | 73,009,404 | 2 | true | 2022-07-17T04:18:08.943Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to type pass through function decorators<p>The illustrative <code>enhanceFn</code> function below doesn't change the passed in function type <code>T</cod... |
72,831,853 | SQL Indexes, how to create better<p>I use SQL Azure and have a table with 1M records. Table has columns (main):</p>
<p><code>Id</code> - int, autoincrement identity</p>
<p><code>IMEI</code> - unique index</p>
<p><code>Sync1</code> - bool, not nullable</p>
<p><code>Sync2</code> - bool, not nullable</p>
<p>From these 1M ... | <p>two indexing ideas to try:</p>
<h3>1) Index each of the sync fields separately:</h3>
<pre><code>CREATE NONCLUSTERED INDEX IX_MyTable_Sync1 ON MyTable
(Sync1)
INCLUDE (IMEI, Sync2, FieldA, FieldB, FieldC);
CREATE NONCLUSTERED INDEX IX_MyTable_Sync2 ON MyTable
(Sync2)
INCLUDE (IMEI, Sync1, Fie... | SQL Indexes, how to create better | sql|indexing|azure-sql-database|database-indexes | 0 | 47 | 1 | 72,833,250 | 72,833,250 | 2 | true | 2022-07-01T15:57:06.967Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL Indexes, how to create better<p>I use SQL Azure and have a table with 1M records. Table has columns (main):</p>
<p><code>Id</code> - int, autoincrement i... |
72,915,350 | Test if Item of a VBA dictionary is equal to a given value without adding key and item to the dictionary<p>I need to test if the Item of a VBA Dictionary is equal to a given value, without adding a new key and value to the dictionary.</p>
<pre><code>dict.RemoveAll
MsgBox dict.Exists(key)
</code></pre>
<p>MsgBox dict.Ex... | <p>Use <code>exists()</code> to check if a key exists:</p>
<pre><code>Sub foo()
Dim dict As Scripting.Dictionary
Dim key As String
key = "key1"
Set dict = New Dictionary
Debug.Print dict(key) ' -- create a value of Empty for the key
Debug.Print dict.Count ' -- 1 (yikes!)
Set dict = New Dictionary
Debug.Pri... | Test if Item of a VBA dictionary is equal to a given value without adding key and item to the dictionary | vba|dictionary | 2 | 47 | 2 | 72,915,540 | 72,915,540 | 2 | true | 2022-07-08T18:05:12.417Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Test if Item of a VBA dictionary is equal to a given value without adding key and item to the dictionary<p>I need to test if the Item of a VBA Dictionary is ... |
72,789,967 | Parsing JSON output from Juniper switch using Ansible<p>I have this JSON output from Juniper switch where I need to get the remote system name associated with <code>lldp_local_parent_interface_name</code> having the value <code>ae0</code>.<br />
So, I only know the value <code>ae0</code> and I need to get the remote s... | <p>If you do not care about the exact hierarchy of nodes and their names beside <code>lldp_neighbor_information</code>, you can use a cohort of <a href="https://jmespath.org/tutorial.html#object-projections" rel="nofollow noreferrer">object projections</a> and <a href="https://jmespath.org/tutorial.html#flatten-project... | Parsing JSON output from Juniper switch using Ansible | json|ansible|jmespath|juniper | 2 | 47 | 1 | 72,791,477 | 72,791,477 | 2 | true | 2022-06-28T16:16:26.243Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Parsing JSON output from Juniper switch using Ansible<p>I have this JSON output from Juniper switch where I need to get the remote system name associated wit... |
72,943,506 | Python -- How do I use onkey to exit a while loop?<p>I'm trying to build a game similar to snake with the turtle library. I was able to make the turtle continually move forward with a <code>while True</code> loop, and also make turns without breaking the while loop.</p>
<p>Now I'm trying to figure out a way to exit the... | <p>If you just want the snake to stop moving, <code>snake.done()</code> should be <code>turtle.done()</code>. <code>done</code> is a turtle module function, not a <code>turtle.Turtle</code> method, so you can call it as a function, but not on the <code>Turtle</code> object.</p> | Python -- How do I use onkey to exit a while loop? | python|while-loop|turtle-graphics | 0 | 47 | 1 | 72,943,553 | 72,943,553 | 2 | true | 2022-07-11T19:08:41.777Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python -- How do I use onkey to exit a while loop?<p>I'm trying to build a game similar to snake with the turtle library. I was able to make the turtle conti... |
72,796,730 | How to get <a>data only if start with '#' python<p>Hello im trying to get hashtags list from caption..
only will scraping data if only the data start with '#'</p>
<pre><code>hashtags = driver.find_elements(By.CSS_SELECTOR, "li > div > div > div._a9zr > div._a9zs > span > a")
for tag in hash... | <p>You can use <code>startswith()</code> method to sort and to get the data items those contain only <code>#</code></p>
<pre><code>for tag in hashtags:
if tag.startswith('#'):
print(tag.text)
</code></pre>
<p>Try:
At first,you have to invoke <code>.text</code> method then <code>startswith(</code>)` method w... | How to get <a>data only if start with '#' python | python|selenium|web-scraping | 0 | 47 | 2 | 72,796,797 | 72,796,797 | 2 | true | 2022-06-29T06:31:01.937Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get <a>data only if start with '#' python<p>Hello im trying to get hashtags list from caption..
only will scraping data if only the data start with '#... |
72,904,457 | How in multimap run for range from to?<p>I need to go from the beginning +3 and from the end -3
that is, if the total size is 10, then I have to iterate from 3 to 7
who it doesnt work?</p>
<pre><code>std::multimap<int,int> _multimap;
for(auto it = _multimap.begin() + 3; it != _multimap.end() - 3; it++) {
std:... | <p>The problem is that the class template <code>std::multimap</code> does not have random access iterators. It has bidirectional iterators.</p>
<p>So you may not write</p>
<pre><code>_multimap.begin() + 3
or
_multimap.end() - 3
</code></pre>
<p>Instead you could write the for loop the following way using standard fun... | How in multimap run for range from to? | c++|for-loop|iterator|range|multimap | 0 | 47 | 1 | 72,904,537 | 72,904,537 | 2 | true | 2022-07-07T21:31:36.590Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How in multimap run for range from to?<p>I need to go from the beginning +3 and from the end -3
that is, if the total size is 10, then I have to iterate from... |
72,782,725 | "Object synchronization method was called from an unsynchronized block of code" error in Callback test<p>The following class is supposed to test, if an expected number of asynchronous Callbacks was received:</p>
<pre><code>class Program
{
static List<int> callbackObjects = new List<int>();
static in... | <blockquote>
<p>Is it because <code>Monitor.Enter</code> and <code>Monitor.Exit</code> are invoked in different scopes/threads?</p>
</blockquote>
<p>Yes, exactly that. <code>Monitor</code> is thread-bound.</p>
<p>However, IMO you should also consider whether the multiple callbacks can themselves be overlapped; if they ... | "Object synchronization method was called from an unsynchronized block of code" error in Callback test | c#|.net|multithreading|asynchronous | 1 | 47 | 1 | 72,783,263 | 72,783,263 | 2 | true | 2022-06-28T07:59:35.453Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
"Object synchronization method was called from an unsynchronized block of code" error in Callback test<p>The following class is supposed to test, if an expec... |
72,962,349 | SQL: join last 3 values with matching key to single row<p>I have a table which looks like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>id</th>
<th>date</th>
<th>user</th>
<th>value</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2022-07-13 16:42:33.1233</td>
<td>1</td>
<td>'123'</t... | <p>Use <code>array_agg</code> as a window function (in <code>ROWS</code> mode) and set the window to <code>3 PRECEDING</code> and <code>1 PRECEDING</code>, partitioned by <code>user</code> and ordered by <code>date</code>:</p>
<pre><code>SELECT *, array_agg(value) OVER w
FROM t
WINDOW w AS (PARTITION BY user_id ORDER B... | SQL: join last 3 values with matching key to single row | sql|postgresql | 1 | 47 | 1 | 72,962,980 | 72,962,980 | 2 | true | 2022-07-13T07:20:57.163Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL: join last 3 values with matching key to single row<p>I have a table which looks like this:</p>
<div class="s-table-container">
<table class="s-table">
<... |
72,987,585 | Use of select with multiple sockets<p>I would like to manage the sockets so that I can only accept connections once and then listen to the file descriptor of each socket and intercept the messages sent.</p>
<p>After a lot of trouble, I don't understand why my code systematically goes into the <code>FD_ISSET()</code> fu... | <p><code>select()</code> <em>modifies</em> the <code>fd_set</code> object(s) you pass to it, so each loop iteration needs to make a copy of them, not pass the original <code>fd_set</code>s you're using to track your connections. Something like this:</p>
<pre class="lang-c prettyprint-override"><code>FD_SET(socket, &am... | Use of select with multiple sockets | c|sockets | 0 | 47 | 1 | 72,987,699 | 72,987,699 | 2 | true | 2022-07-14T23:23:16.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use of select with multiple sockets<p>I would like to manage the sockets so that I can only accept connections once and then listen to the file descriptor of... |
72,963,630 | Problem with receiving mails from the SENT folder<pre><code>if ( IdIMAP1->SelectMailBox( "SENT" ) )
{
TIdIMAP4SearchRec sr[1];
sr[0].SearchKey = skAll;
IdIMAP1->UIDSearchMailBox( EXISTINGARRAY(sr) );
int ile = IdIMAP1->MailBox->SearchResult.Length;
}
</code></pre>
<p>Error:<... | <blockquote>
<p>Error:</p>
<blockquote>
<p>First chance exception at $757BF192. Exception class EIdReadLnMaxLineLengthExceeded with message 'Max line length exceeded.'.</p>
</blockquote>
<p>... What does this error mean and how can I fix it?</p>
</blockquote>
<p>It means <code>TIdIMAP4</code> called the <code>IOHandler... | Problem with receiving mails from the SENT folder | c++|indy10 | 0 | 47 | 1 | 73,000,332 | 73,000,332 | 2 | true | 2022-07-13T09:04:47.510Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Problem with receiving mails from the SENT folder<pre><code>if ( IdIMAP1->SelectMailBox( "SENT" ) )
{
TIdIMAP4SearchRec sr[1];
sr[0].Sear... |
72,996,193 | Capture all characters in single string between regex matches<p>I have a log file with the following format:</p>
<pre><code>00:00:09.476 ;; 00:00:11.111 side:start top:15% bottom:10% sound:80%
FOO BAR FOO FOO FOO BAR
00:00:11.111 ;; 00:00:12.278 side:start top:15% bottom:10% sound:78%
BAR BAR BAR' BAR. FOO.BAR
00:00:... | <p>You can use re.findall with a pattern using a lookahead:</p>
<pre><code>^\d\d:\d\d:\d\d.\d\d\d ;; \d\d:\d\d:\d\d.\d\d\d .*((?:\n(?!\d\d:\d\d:\d\d.\d\d\d ;; \d\d:\d\d:\d\d.\d\d\d).*)*)
</code></pre>
<p><a href="https://regex101.com/r/7QSuXx/1" rel="nofollow noreferrer">Regex demo</a></p>
<pre><code>import re
pattern... | Capture all characters in single string between regex matches | python|python-3.x|regex|parsing|text | 1 | 47 | 2 | 72,996,252 | 72,996,252 | 2 | true | 2022-07-15T15:20:57.130Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Capture all characters in single string between regex matches<p>I have a log file with the following format:</p>
<pre><code>00:00:09.476 ;; 00:00:11.111 side... |
72,778,660 | Python/Pandas - Unstack or Melt multidimensional table<p>I'm having a beginning to the language issue with unpivoting a table. I'm hoping that it's just a vocabulary thing and I'll be off and running. I have a table with three dimensions, within the dimensions, there are three elements and this table covers three time... | <p>Reading a Multi-Dimensional Table in CSV format:</p>
<pre><code>df = pd.read_csv('df_pivoted.csv', header=[0,1,2], index_col=[0])
...
male_female Total M F
adult_youth Total A Y Total A ... | Python/Pandas - Unstack or Melt multidimensional table | python|pandas | 1 | 47 | 1 | 72,778,986 | 72,778,986 | 2 | true | 2022-06-27T21:50:55.843Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python/Pandas - Unstack or Melt multidimensional table<p>I'm having a beginning to the language issue with unpivoting a table. I'm hoping that it's just a vo... |
73,017,148 | How can I create an array of sequential values through the input of the minimum and maximum values?<p>Let's say I want a logical sequence between 0 and 100 that has 1 number between them, so I set 0 in B1, 100 in B3 and add the formula in B2:</p>
<p><a href="https://i.stack.imgur.com/ZSJx5.png" rel="nofollow noreferrer... | <p>By formula</p>
<pre><code>=arrayformula(sequence(B3+1,1,B1*B3,(B2-B1))/B3)
</code></pre>
<p>or, according the the precision you need</p>
<pre><code>=arrayformula((sequence(B3+1,1,B1*1000*B3,(B2-B1)*1000)/B3)/1000)
</code></pre>
<p><a href="https://i.stack.imgur.com/7a70j.png" rel="nofollow noreferrer"><img src="http... | How can I create an array of sequential values through the input of the minimum and maximum values? | javascript|google-apps-script|google-sheets | 0 | 47 | 2 | 73,018,291 | 73,018,291 | 2 | true | 2022-07-18T03:54:08.100Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I create an array of sequential values through the input of the minimum and maximum values?<p>Let's say I want a logical sequence between 0 and 100 t... |
72,832,335 | Use Axios .then() with for loop index variable<p>I want to iterate some page URLs, stored in an array, and retrieve them to do an operation over their html file. Since I need to store a result from said operation for each page to use them the next time I call the function, I want to pass the index (i) in the onResponse... | <p>try using <code>let</code> instead of <code>var</code></p>
<pre class="lang-js prettyprint-override"><code>for (let i = 0; i < pages.length; i++) {
</code></pre>
<p><code>let</code> are block scoped and <code>var</code> are function scoped.</p>
<p>Since you are calling an <code>async</code> method, using <code>va... | Use Axios .then() with for loop index variable | javascript|axios | 2 | 47 | 2 | 72,832,444 | 72,832,444 | 2 | true | 2022-07-01T16:41:13.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use Axios .then() with for loop index variable<p>I want to iterate some page URLs, stored in an array, and retrieve them to do an operation over their html f... |
72,802,892 | Grep first regex group<p>I want to grep the first regex group of a log file with a certain pattern starting with date-time and ending with database.</p>
<p>Regex:</p>
<pre><code>^(([0-9]{4})-([0-1][0-9])-([0-3][0-9])\s([0-1][0-9]|[2][0-3]):([0-5][0-9]):([0-5][0-9]))((.*)(\n|.)*?)(targetServerType: database)$
</code></p... | <p>You may use this simpler <code>awk</code> solution instead of a complex <code>grep</code>:</p>
<pre class="lang-bash prettyprint-override"><code>awk -F, '
/targetServerType: database$/ { print ts }
/^[0-9]{4}(-[0-9]{2}){2}/ { ts = $1 }
' file.log
2022-07-10 15:24:55
2022-07-09 13:12:42
</code></pre> | Grep first regex group | regex|awk|grep | 1 | 47 | 1 | 72,803,459 | 72,803,459 | 2 | true | 2022-06-29T14:13:59.900Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Grep first regex group<p>I want to grep the first regex group of a log file with a certain pattern starting with date-time and ending with database.</p>
<p>R... |
72,979,894 | Entity Framework's Eager Loading populates last record only<p>I have a ASP.NET Core 3.1 Web API with the following database context:</p>
<pre class="lang-cs prettyprint-override"><code>namespace Api.Database.EF
{
using System;
using Microsoft.EntityFrameworkCore;
using Api.Database.EF.Models;
publ... | <p>You have duplicate <code>StatusId</code> values in <code>SearchFilterData</code>, which is against the configured one-to-one relationship (one-to-one means the <code>StatusId</code> is unique in the referencing side as well, i.e. in <code>SearchFilterData</code>), hence the results you are getting from EF Core.</p>
... | Entity Framework's Eager Loading populates last record only | c#|asp.net-core|entity-framework-core|asp.net-core-webapi | 1 | 47 | 1 | 72,980,968 | 72,980,968 | 2 | true | 2022-07-14T11:38:55.667Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Entity Framework's Eager Loading populates last record only<p>I have a ASP.NET Core 3.1 Web API with the following database context:</p>
<pre class="lang-cs ... |
72,911,347 | Building a python file from within another python script<p>I am trying to compile a python file into a .exe from within another script. The main issue I am having is with the command to build it as I need to input the file path which I have as a variable in my code. When I try and run it, it takes the name of the varia... | <p>I did not run the entire script you provided but based on the comment from Anentropic try replacing your line</p>
<pre><code>os.system('cmd /k"PyInstaller" + installPath')
</code></pre>
<p>with either</p>
<pre><code>os.system('cmd /k"PyInstaller" ' + installPath)
</code></pre>
<p>or</p>
<pre><cod... | Building a python file from within another python script | python | 1 | 47 | 1 | 72,912,110 | 72,912,110 | 2 | true | 2022-07-08T12:22:09.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Building a python file from within another python script<p>I am trying to compile a python file into a .exe from within another script. The main issue I am h... |
73,015,944 | How reduce width of showMaterialModalBottomSheet?<p>i used showMaterialModalBottomSheet want to reduce the width, not full-screen width</p>
<pre><code>floatingActionButton: FloatingActionButton(
onPressed: () {
showMaterialModalBottomSheet(
backgroundColor: Theme.of(context).appBarTh... | <p>show bottom sheet method has a constraints property which can be used to reduce the width. Add this to showBottomSheet method</p>
<pre class="lang-dart prettyprint-override"><code>constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width-50,
),
</code></pre> | How reduce width of showMaterialModalBottomSheet? | flutter|dart | 1 | 47 | 1 | 73,016,494 | 73,016,494 | 2 | true | 2022-07-17T23:03:51.907Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How reduce width of showMaterialModalBottomSheet?<p>i used showMaterialModalBottomSheet want to reduce the width, not full-screen width</p>
<pre><code>floati... |
72,861,589 | How to sort a list of lists using the Stream API?<p>I want to output all names starting with the letter "A" and sort them in reverse alphabetical order using the Stream API. The result should look like this: Ann, Andrew, Alex, Adisson. How do I do this?</p>
<pre><code>List<List<String>> list = Ar... | <p>Since you are assigning the result to a <code>List<List<String>></code> it appears you want to filter and sort each list and then print them. Here is how it might be done.</p>
<ul>
<li>Stream the list of lists.</li>
<li>then stream each individual list and:
<ul>
<li>apply the filter</li>
<li>sort in rev... | How to sort a list of lists using the Stream API? | java | 0 | 47 | 1 | 72,863,267 | 72,863,267 | 2 | true | 2022-07-04T20:09:52.970Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to sort a list of lists using the Stream API?<p>I want to output all names starting with the letter "A" and sort them in reverse alphabetical o... |
72,902,015 | How can I write a file3 with different columns from a matched result queried from file1 to file2?<p>I have file1.txt and file2.txt with the following structure</p>
<p>File1.txt</p>
<pre><code>5511913332222
5511910000023
5511910000029
5511910000034
</code></pre>
<p>File2.txt</p>
<pre><code>5511910000029|BLOCKED|7|30/... | <pre><code>$ awk -F'|' -v OFS='|' 'NR==FNR {a[$1];next} ($1 && $1 in a){print $1,$2}' File1.txt File2.txt
5511910000034|AVAIL
</code></pre>
<p>To save output to File3.txt <code> ... {print $1,$2 > "File3.txt"} ...</code></p> | How can I write a file3 with different columns from a matched result queried from file1 to file2? | linux|bash|shell|awk|text | 1 | 47 | 3 | 72,902,934 | 72,902,934 | 2 | true | 2022-07-07T17:25:39.827Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I write a file3 with different columns from a matched result queried from file1 to file2?<p>I have file1.txt and file2.txt with the following structu... |
72,901,474 | How to execute a function when a condition is met in Flutter/Dart?<p>I have a function:</p>
<pre class="lang-dart prettyprint-override"><code> //Alert Dialog about questions and answers
void _showAlertDialog() {
// set up the buttons
Widget Answer1Button = TextButton(
child: Text(_listData[_listCount]... | <p>You are missing the <code>()</code></p>
<pre class="lang-dart prettyprint-override"><code> void _nextCSV() {
setState(() {
_listData = _listData;
_listData[_listCount][2] == "" ? _showAlertDialog() : print('False');
});
}
</code></pre>
<p>But even inside the <code>setState</code> you... | How to execute a function when a condition is met in Flutter/Dart? | flutter|dart|flutter-layout | 1 | 47 | 1 | 72,901,526 | 72,901,526 | 2 | true | 2022-07-07T16:40:21.620Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to execute a function when a condition is met in Flutter/Dart?<p>I have a function:</p>
<pre class="lang-dart prettyprint-override"><code> //Alert Dialo... |
72,984,236 | Passing pointers to dll function with ctypes<p>I have a vendor-provided DLL for connecting to a piece of lab equipment. The DLL has a function</p>
<pre><code>long search_devices(char **serial_number_list, uint32_t *dev_count)
</code></pre>
<p>that I'm trying to access from Python. What I've done is</p>
<pre><code>impor... | <p>The C usage example shows how to call the function. Below is a test function I used that fills out data as described:</p>
<p><strong>test.c</strong></p>
<pre class="lang-c prettyprint-override"><code>#include <stdint.h>
#include <stdio.h>
__declspec(dllexport)
long search_devices(char **serial_number_l... | Passing pointers to dll function with ctypes | python|pointers|dll|ctypes|libusb | 0 | 47 | 1 | 72,985,660 | 72,985,660 | 2 | true | 2022-07-14T17:04:23.230Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Passing pointers to dll function with ctypes<p>I have a vendor-provided DLL for connecting to a piece of lab equipment. The DLL has a function</p>
<pre><code... |
72,994,406 | including react jsx dependencies, npm install fails<p>The information I have surrounding the issue is perhaps tangential</p>
<p>but I've create an electron app that uses react, but <em>without</em> using <code>create-react-app</code></p>
<p>no going back, so now i'm trying to include dev dependencies for working with j... | <p>It's a known <a href="https://github.com/npm/cli/issues/1257" rel="nofollow noreferrer">bug</a> in v6.</p>
<p>Upgrade your <code>npm</code> to above version 6 (<code>npm install -g npm</code>) to fix it.</p> | including react jsx dependencies, npm install fails | reactjs|electron|npm-install | 0 | 47 | 1 | 72,994,471 | 72,994,471 | 2 | true | 2022-07-15T13:00:26.940Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
including react jsx dependencies, npm install fails<p>The information I have surrounding the issue is perhaps tangential</p>
<p>but I've create an electron a... |
72,979,040 | Select data rows with condition Erlang<p>I am new to erlang. I have following data record.</p>
<pre><code>-record(tracked_connection, {id,node,vhost,name,pid,protocol,type,peer_host,peer_port,username,connected_at}).
</code></pre>
<p>I need to select data in following SQL format</p>
<pre><code>Select * from tracked_con... | <p>You can do it like this:</p>
<pre><code>mnesia:select(Tab,[{#tracked_connection{username = "xxxxx", _ = '_'},[],['$_']}]).
</code></pre>
<p>That is, in the <a href="https://www.erlang.org/doc/apps/erts/match_spec.html" rel="nofollow noreferrer">match spec</a>, the username field of the record must match &q... | Select data rows with condition Erlang | erlang|erlang-otp|mnesia|erlang-shell | 1 | 47 | 1 | 72,980,945 | 72,980,945 | 2 | true | 2022-07-14T10:27:03.203Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Select data rows with condition Erlang<p>I am new to erlang. I have following data record.</p>
<pre><code>-record(tracked_connection, {id,node,vhost,name,pid... |
72,941,387 | Error handling: How can I await and re execute function after a timeout<p>I would like to handle async timeouts by awaiting the execution and re-executing a function including error handling after it fails.</p>
<p><strong>Pseudo code:</strong></p>
<pre><code>01 call and await async function update()
02 if no error ->... | <p>Not sure if this is what you're looking for, but here's an example of retrying an async call until success, with a 3 second delay between each attempt:</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 p... | Error handling: How can I await and re execute function after a timeout | javascript|node.js | 0 | 47 | 1 | 72,941,600 | 72,941,600 | 2 | true | 2022-07-11T15:59:02.080Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error handling: How can I await and re execute function after a timeout<p>I would like to handle async timeouts by awaiting the execution and re-executing a ... |
73,014,904 | Compare Two Values in different columns<p>I have this worksheet and i need to compare the "venda" values with "esperado".
If Vendas > Esperado i need to paint the status cell with green, if Vendas < Esperado it will be red</p>
<p><a href="https://i.stack.imgur.com/Rctpa.png" rel="nofollow nore... | <p>Please, use the next code. It will create two <code>Union</code> ranges (for each cell interior color type), according to the required condition and color their interior at the code end, at once. That's why it will be fast enough for reasonable ranges number of rows. If huge ranges, I can supply a different solutio... | Compare Two Values in different columns | excel|vba|if-statement|compare | -1 | 47 | 2 | 73,015,112 | 73,015,112 | 2 | true | 2022-07-17T19:51:32.813Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Compare Two Values in different columns<p>I have this worksheet and i need to compare the "venda" values with "esperado".
If Vendas > ... |
72,945,901 | List comprehension on nested for loop<p>I have a list:</p>
<pre><code>l1 = [1,2,3,6,8,1,2,3]
</code></pre>
<p>I want to iterate over list and print list of numbers starting and ending with same number.I have done it with for loop:</p>
<pre><code>iniatializing = 1
for i in l1:
for j in range(iniatializing,len(l1)):
... | <p>I suppose what you want to achieve is:</p>
<p>For each <code>i</code>, <code>j</code> (<code>i < j</code>), if <code>l1[i]==l2[j]</code>, print the subset between <code>i</code> and <code>j</code>.</p>
<pre class="lang-py prettyprint-override"><code>n = len(l1)
[l1[i:j+1] for i in range(n) for j in range(i+1, n) ... | List comprehension on nested for loop | python|loops|nested|list-comprehension | -1 | 47 | 1 | 72,945,954 | 72,945,954 | 2 | true | 2022-07-12T00:30:55.187Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
List comprehension on nested for loop<p>I have a list:</p>
<pre><code>l1 = [1,2,3,6,8,1,2,3]
</code></pre>
<p>I want to iterate over list and print list of n... |
72,886,666 | javascript - get element that was clicked from collection of items<p>Having this code:</p>
<pre><code>let ev = document.querySelectorAll('.event p')
for (let i = 0; i < ev.length; i++) {
ev[i].addEventListener("click", function (e) {
// add this only for current clicked elem
e.currentT... | <p>You can reuse <code>ev</code> inside the event listener, like this: <code>ev.forEach(evt => evt.src = './warning.png');</code></p>
<p>If the list of <code>.event p</code> changes, recalculate the list again, e.g. put <code>ev = document.querySelectorAll('.event p')</code> inside the listener.</p>
<pre><code>let e... | javascript - get element that was clicked from collection of items | javascript | 0 | 47 | 3 | 72,886,783 | 72,886,783 | 2 | true | 2022-07-06T16:00:39.120Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
javascript - get element that was clicked from collection of items<p>Having this code:</p>
<pre><code>let ev = document.querySelectorAll('.event p')
for (le... |
72,963,200 | JavaScript insert createElement till parent element is "full"<p>I've some wrapping element on my HTML page which has a relative width and height setting, to cover all of the available screen.</p>
<pre class="lang-html prettyprint-override"><code><body onload="init()">
<div id="wrapper" ... | <p>Another answer, much simpler</p>
<p>Here I compare scrollHeight and offsetHeight, offsetHeight is the display height, scrollHeight is the actual overflow height, when offsetHeight >= scrollHeight, the wrapper is not filled</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel... | JavaScript insert createElement till parent element is "full" | javascript|html|css|createelement | 0 | 47 | 3 | 72,963,809 | 72,963,809 | 2 | true | 2022-07-13T08:34:33.383Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JavaScript insert createElement till parent element is "full"<p>I've some wrapping element on my HTML page which has a relative width and height setting, to ... |
72,962,766 | Is there a way to collapse the sidebar by default<p>Is there a way to collapse the sidebar by default. Right now, it is showing by default once the application is open. Can we make it collapsed by default</p>
<pre><code>library(shiny)
library(shinyjs)
ui <- fluidPage(
useShinyjs(),
navbarPage("",
... | <p>Here is a UI based solution which avoids flashing the <code>sidebarPanel</code> on startup:</p>
<pre><code>library(shiny)
library(shinyjs)
ui <- fluidPage(useShinyjs(),
navbarPage("",
tabPanel(
"tab",
... | Is there a way to collapse the sidebar by default | r|shiny | 2 | 47 | 3 | 72,963,336 | 72,963,336 | 2 | true | 2022-07-13T07:58:04.550Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way to collapse the sidebar by default<p>Is there a way to collapse the sidebar by default. Right now, it is showing by default once the applicat... |
72,905,138 | setTimeout function doesnt work after 10 seconds, it works as soon as i click on it<p>I am trying to replace a image 10 seconds after a user click on the start button but however it works instantly.</p>
<p>I tried doing console.log on setTimeoout variable but it shouws 1 second.</p>
<p>what am i doing wrong?</p>
<pre><... | <p>setTimeout is a callback function, you can use it for example this way:</p>
<pre><code>document.querySelector(".btn-outline-danger").addEventListener("click", () => {
setTimeout(() => {
document.getElementById("pokeball-open").style.display = "flex";
... | setTimeout function doesnt work after 10 seconds, it works as soon as i click on it | javascript|dom|settimeout | -1 | 47 | 1 | 72,905,173 | 72,905,173 | 2 | true | 2022-07-07T23:15:38.957Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
setTimeout function doesnt work after 10 seconds, it works as soon as i click on it<p>I am trying to replace a image 10 seconds after a user click on the sta... |
72,962,120 | How to disable ActiveMQ web site http://localhost:8161/<p>I am a simple admin who is trying to stop users from logging into ActiveMQ as part of a security audit. We don't use this webpage at all so I want to disable this page all together. Which configs should I change in order to achieve this?</p>
<p>This is the page ... | <p>To disable the embedded Web console, you simply need to comment out, or remove, the import element that imports the Jetty configuration into your broker's configuration file <code>activemq.xml</code>:</p>
<pre class="lang-xml prettyprint-override"><code><beans ... >
<broker ... >
...
<... | How to disable ActiveMQ web site http://localhost:8161/ | activemq | 0 | 47 | 1 | 72,966,919 | 72,966,919 | 2 | true | 2022-07-13T07:01:20.347Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to disable ActiveMQ web site http://localhost:8161/<p>I am a simple admin who is trying to stop users from logging into ActiveMQ as part of a security au... |
72,770,619 | .NET PowerBIClient NuGet Package adds wrong relative URI<p>I try to encapsule our PowerBI Server REST API via the PowerBI Client NuGet Package from Microsoft.
I ran into the problem that the URI gets a wrong relative path added.
The REST API of our Reporting Server (on-premise) has a base URI like: <a href="https://nic... | <p>The PowerBI Client package encapsulates access to the <a href="https://docs.microsoft.com/en-us/rest/api/power-bi/" rel="nofollow noreferrer">PowerBI REST API</a>.</p>
<p>This API is distinct from the <a href="https://app.swaggerhub.com/apis/microsoft-rs/SSRS/2.0" rel="nofollow noreferrer">Reporting Services REST AP... | .NET PowerBIClient NuGet Package adds wrong relative URI | c#|powerbi|nuget-package|power-bi-report-server | 1 | 47 | 1 | 72,771,530 | 72,771,530 | 3 | true | 2022-06-27T10:31:58.550Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
.NET PowerBIClient NuGet Package adds wrong relative URI<p>I try to encapsule our PowerBI Server REST API via the PowerBI Client NuGet Package from Microsoft... |
72,803,285 | Remove all strings with less than n characters from data frame with exception (Python)<p><strong>Input</strong></p>
<pre><code>data = {'ID':[1,2,3,4,5,6,7], 'Column_A':['This', 'Is', 'A','Test', '• ', '•', '•test']}
df_in = pd.dataframe(data)
</code></pre>
<p><strong>Output</strong></p>
<pre><code>data = {'ID':[1,4,5,... | <pre><code>import pandas as pd
data = {'ID':[1,2,3,4,5,6,7], 'Column_A':['This', 'Is', 'A','Test', '• ', '•', '•test']}
df_in = pd.DataFrame(data)
# here is the condition you are looking for
df_in = df_in[(df_in['Column_A'].str.len() > 3) | (df_in["Column_A&qu... | Remove all strings with less than n characters from data frame with exception (Python) | python|pandas|dataframe | 1 | 47 | 2 | 72,803,502 | 72,803,502 | 3 | true | 2022-06-29T14:39:00.987Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove all strings with less than n characters from data frame with exception (Python)<p><strong>Input</strong></p>
<pre><code>data = {'ID':[1,2,3,4,5,6,7], ... |
72,800,074 | Testcafe: hide part of DOM elements during screenshots<p>I am doing some visual testings using Testcafe (Typescript)
I would like to hide some DOM elements during the screenshots creation</p>
<pre><code>import { Selector } from 'testcafe';
fixture`Getting Started`
.page`https://mypage.com`;
test('My first test', ... | <p>You can use <a href="https://testcafe.io/documentation/402671/reference/test-api/clientfunction" rel="nofollow noreferrer"><code>ClientFunction</code></a> and hide the element manually with JS.</p>
<pre class="lang-js prettyprint-override"><code>test('Hide element', async t => {
const hideElement = ClientFunc... | Testcafe: hide part of DOM elements during screenshots | typescript|testcafe|visual-testing | 1 | 47 | 1 | 72,811,378 | 72,811,378 | 3 | true | 2022-06-29T10:46:07.510Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Testcafe: hide part of DOM elements during screenshots<p>I am doing some visual testings using Testcafe (Typescript)
I would like to hide some DOM elements d... |
72,832,944 | How to Convert Nested Object in Key Value Pair in Javascript<p><strong>I want to do this with programming</strong></p>
<p><strong>Problem</strong></p>
<pre><code> attributes: {
allow: [ '0' ],
create: [ '0' ],
all: [ '0' ],
rfid: [ '0' ],
}
</code></pre>
<p><strong>What I want is</strong></p>
<pre><cod... | <p><strong>Functional approach:</strong></p>
<p>You can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries" rel="nofollow noreferrer"><code>Object.entries</code></a> to turn an object <code>{ a: 1, b: 2 }</code> into an array of arrays (containing pairs of keys ... | How to Convert Nested Object in Key Value Pair in Javascript | javascript|json|object | -2 | 47 | 1 | 72,833,034 | 72,833,034 | 3 | true | 2022-07-01T17:45:12.517Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to Convert Nested Object in Key Value Pair in Javascript<p><strong>I want to do this with programming</strong></p>
<p><strong>Problem</strong></p>
<pre><... |
72,860,012 | Deserializie multiple JSON Objects from file C#<p>I'm serializing Objects as JSON String in a .txt file with the following code:</p>
<pre><code>private void ReserveTable_Click(object sender, EventArgs e)
{
Reservation CreateReservation = new Reservation(textBoxFirstName.Text, textBoxSecondName.Text... | <p>The issue is that a collection of items in JSON format is not represented by taking individual serialized items and appending them after one another (like in your output example. What you want is a collection format in JSON, which should look like this:</p>
<pre><code>[{"Firstname":"Rainer",&quo... | Deserializie multiple JSON Objects from file C# | c#|loops|deserialization | 2 | 47 | 1 | 72,860,146 | 72,860,146 | 3 | true | 2022-07-04T17:01:22.263Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Deserializie multiple JSON Objects from file C#<p>I'm serializing Objects as JSON String in a .txt file with the following code:</p>
<pre><code>private void ... |
72,856,211 | Why does XmlSerializer fail to serialize this class even though I added the XmlInclude attribute for derived classes?<p><strong>Problem</strong></p>
<p>I am trying to XML serialize the class "ProfileSerialize" but I get this inner exception when calling <code>xsSubmit.Serialize(writer, obj)</code> in the <em>... | <p>Your problem is not with <a href="https://docs.microsoft.com/en-us/dotnet/api/system.xml.serialization.xmlincludeattribute" rel="nofollow noreferrer"><code>XmlInclude</code></a>. Your problem is that you are trying to assign the two properties of <code>ProfileFormatNumber</code>, <code>Divider</code> and (from the ... | Why does XmlSerializer fail to serialize this class even though I added the XmlInclude attribute for derived classes? | xml|vb.net|xml-serialization|xmlserializer | 1 | 47 | 1 | 72,860,824 | 72,860,824 | 3 | true | 2022-07-04T11:48:19.690Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does XmlSerializer fail to serialize this class even though I added the XmlInclude attribute for derived classes?<p><strong>Problem</strong></p>
<p>I am ... |
72,868,389 | How can I iterate through a keyless list of jsons (string) with python?<p>I am using json.dumps and end up with the following json:</p>
<pre><code>[{
"name": "Luke",
"surname": "Skywalker",
"age": 34
},
{
"name": "Han",
"surname": "Sol... | <p><code>json.dumps</code> takes some data and turns it into a string that is the JSON representation of that data.</p>
<p>To iterate over the data, just iterate over it instead of calling <code>json.dumps</code> on it:</p>
<pre><code># Wrong!
my_data = [...]
jsons = json.dumps(my_data)
for x in jsons:
print(x) # p... | How can I iterate through a keyless list of jsons (string) with python? | python|json | 0 | 47 | 1 | 72,868,419 | 72,868,419 | 3 | true | 2022-07-05T11:07:18.890Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I iterate through a keyless list of jsons (string) with python?<p>I am using json.dumps and end up with the following json:</p>
<pre><code>[{
"n... |
72,874,490 | Why the java.lang.CharacterDataLatin1#digit function in JDK generates the whole digit byte array?<p>In the <a href="https://github.com/twosigma/OpenJDK/blob/master/make/data/characterdata/CharacterDataLatin1.java.template#L172" rel="nofollow noreferrer">source code</a>, it says that:</p>
<blockquote>
<p>Analysis has sh... | <p>This trick optimizes performance of the standard <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Character.html#digit(char,int)" rel="nofollow noreferrer"><code>Character.digit</code></a> method.</p>
<p>Most often, this method is called for
<a href="https://en.wikipedia.org/wiki/ISO/I... | Why the java.lang.CharacterDataLatin1#digit function in JDK generates the whole digit byte array? | java|jvm | 0 | 47 | 1 | 72,875,138 | 72,875,138 | 3 | true | 2022-07-05T19:16:15.323Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why the java.lang.CharacterDataLatin1#digit function in JDK generates the whole digit byte array?<p>In the <a href="https://github.com/twosigma/OpenJDK/blob/... |
72,881,769 | How to make a perfect bash wrapper script<p>I need to make a bash script to replace a certain application.<br />
Script should do some work and then execute said application in a way that everything (parameters both positional and named, env variables, signals etc.) will work as if it was the original application execu... | <p>You should check your scripts with shellcheck .</p>
<pre><code>Line 7:
exec php8.1 $@
^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements.
</code></pre>
<p>Use:</p>
<pre><code>exec php8.1 "$@"
</code></pre> | How to make a perfect bash wrapper script | linux|bash | 0 | 47 | 2 | 72,882,121 | 72,882,121 | 3 | true | 2022-07-06T10:17:55.953Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make a perfect bash wrapper script<p>I need to make a bash script to replace a certain application.<br />
Script should do some work and then execute ... |
72,891,546 | "golang.org/x/time/rate" and Context<p>What's the purpose of passing the context to Wait() function in the example below?</p>
<p>Let's say there is a limiter that allow 3 requests per second.</p>
<p>Does it mean that limiter will not be a shared resource in the sense that, for each "Process" function call, it... | <p>First, you need to understand the different purposes of the <code>rate.Limiter</code> and <code>context.Context</code> types. The <code>Limiter</code> allows you to control the rate at which concurrent processes are executed. The <code>Context</code> allows to terminate a process or group of processes if there is ... | "golang.org/x/time/rate" and Context | go|time|throttling|rate-limiting | 1 | 47 | 2 | 72,893,411 | 72,893,411 | 3 | true | 2022-07-07T02:04:08.013Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
"golang.org/x/time/rate" and Context<p>What's the purpose of passing the context to Wait() function in the example below?</p>
<p>Let's say there is a limiter... |
72,898,316 | tryCatch() in across() fails when the error comes from another column<p>I use <code>across()</code> and I want to put <code>NA</code> where the computation fails. I tried to use <code>tryCatch()</code> but can't make it work in my case, whereas there are situations where it works.</p>
<p>This works:</p>
<pre class="lan... | <p>The problem isn't the <code>tryCatch</code> because the code you run doesn't trigger an error. Basically you are running</p>
<pre><code>foo <- function(x) tryCatch(x[which(mtcars$mpg==10000)], error = function(e) NA))
foo(mtcars$drat)
# numeric(0)
</code></pre>
<p>And notice that no error is triggered. That expre... | tryCatch() in across() fails when the error comes from another column | r|dplyr | 1 | 47 | 2 | 72,898,454 | 72,898,454 | 3 | true | 2022-07-07T13:02:21.507Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
tryCatch() in across() fails when the error comes from another column<p>I use <code>across()</code> and I want to put <code>NA</code> where the computation f... |
72,922,764 | Cannot cast to class imported on condition of TYPE_CHECKING<h2>1. Context</h2>
<p>I often import python modules only for the type-checker, like <code>mypy</code>. For example:</p>
<pre><code>if TYPE_CHECKING:
import bar
</code></pre>
<p>I would then use module <code>bar</code> in type hints throughout the code. The... | <p>Generally speaking, you can pass type names to any of the <code>typing</code> functions as strings. <code>mypy</code> will be smart enough to do the resolution, and the Python runtime won't complain since it's just a string. So you can do the cast like this.</p>
<pre><code>bar_obj = cast('bar.Bar', foo_obj.get_somet... | Cannot cast to class imported on condition of TYPE_CHECKING | python|python-3.x|casting|mypy|python-3.10 | 1 | 47 | 1 | 72,923,160 | 72,923,160 | 3 | true | 2022-07-09T15:49:28.500Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cannot cast to class imported on condition of TYPE_CHECKING<h2>1. Context</h2>
<p>I often import python modules only for the type-checker, like <code>mypy</c... |
73,001,155 | Error expected : Ternary conditional nil for not optional type of parameter in SwiftUI function<p>Code below works fine even if optional type isn't what the <code>.gesture()</code> modifier really wants for its parameter type.</p>
<pre><code>someKindOfView
.gesture(condition ? DragGesture() : nil)
</code></pre>
<... | <p>Because the <code>Gesture</code> is generic protocol...</p>
<p><a href="https://i.stack.imgur.com/kGTQ4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kGTQ4.png" alt="demo1" /></a></p>
<p>and so the <code>gesture</code> modifier accepts generic type conforming to <code>Gesture</code></p>
<p><a hr... | Error expected : Ternary conditional nil for not optional type of parameter in SwiftUI function | ios|swift|swiftui | -2 | 47 | 1 | 73,001,602 | 73,001,602 | 3 | true | 2022-07-16T02:38:41.467Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error expected : Ternary conditional nil for not optional type of parameter in SwiftUI function<p>Code below works fine even if optional type isn't what the ... |
72,991,825 | Chinese characters with multiple unicode representations<p>Some Chinese characters have multiple Unicode representations. For example, although the characters 金 and 金 are usually rendered the same, they actually have different underlying unicodes (see <a href="https://www.compart.com/en/unicode/U+91D1" rel="nofollow no... | <p>The solution is <a href="https://www.unicode.org/reports/tr15/" rel="nofollow noreferrer">Unicode Normalization</a>.</p>
<p><em>Is there a public database where I can query these kinds of correspondences between Unicode characters that are actually the "same"?</em> Yes, there is <a href="https://www.unicod... | Chinese characters with multiple unicode representations | unicode|cjk|chinese-locale | 2 | 47 | 1 | 73,012,190 | 73,012,190 | 3 | true | 2022-07-15T09:24:51.517Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Chinese characters with multiple unicode representations<p>Some Chinese characters have multiple Unicode representations. For example, although the character... |
73,019,013 | Add polygon to teh featureLayer<p>I tried go add a polygon to the feature layer. In getting an error in the console,
<em>Object { name: "feature-layer:missing-parameters", details: undefined, message: "'addFeatures', 'updateFeatures', 'deleteFeatures', 'addAttachments', 'updateAttachments' or 'deleteAtta... | <p>the function <code>applyEdits(edits, options?)</code> takes as mandatory parameter an object of the form,</p>
<pre><code>{
addFeatures: Graphic[]|Collection<Graphic>
updateFeatures: Graphic[]|Collection<Graphic>
deleteFeatures: Graphic[]|Collection<Graphic>|Object[]
addAttachments: ... | Add polygon to teh featureLayer | arcgis|arcgis-js-api | 0 | 47 | 1 | 73,022,721 | 73,022,721 | 3 | true | 2022-07-18T07:58:02.597Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add polygon to teh featureLayer<p>I tried go add a polygon to the feature layer. In getting an error in the console,
<em>Object { name: "feature-layer:m... |
72,907,806 | How to solve a problem with a higher order function?<p>I don't seem to fully understand how "closing" works. I have an input when changing which I need to call functions and pass 2 arguments to it. But I also need the event of this event.</p>
<p>My version below doesn't work. Only the first part of the functi... | <p>Replace</p>
<pre><code><input type="checkbox" onChange={() => handleChangeClosure(user.userId, "Controller")}/>
</code></pre>
<p>With</p>
<pre><code><input type="checkbox" onChange={handleChangeClosure(user.userId, "Controller")}/>
</code></pre>
<p>The <code>han... | How to solve a problem with a higher order function? | javascript|reactjs|typescript | 1 | 47 | 2 | 72,907,887 | 72,907,887 | 3 | true | 2022-07-08T07:04:03.993Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to solve a problem with a higher order function?<p>I don't seem to fully understand how "closing" works. I have an input when changing which I ... |
72,946,793 | snprintf function keeps pausing and cause the program to terminate in C<p>I have been working on this function that takes a customer struct and returns an allocated string with detailed info using <code>snprintf</code> to form the string.</p>
<pre><code>char* to_string(custumer cus)
{
char* buffer = (char*) malloc(... | <p>You pass 12 data arguments to your <code>snprint</code> call but provide only 11 format specifiers.</p>
<p>It would seem to me that the <code>cus.opening</code> argument is superfluous – indeed, how does <code>snprint</code> know what to do with that <em>structure</em> argument?</p>
<p>Compiling your code as provide... | snprintf function keeps pausing and cause the program to terminate in C | c|struct|printf|malloc | 0 | 47 | 1 | 72,946,884 | 72,946,884 | 3 | true | 2022-07-12T03:42:28.413Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
snprintf function keeps pausing and cause the program to terminate in C<p>I have been working on this function that takes a customer struct and returns an al... |
72,956,632 | How do I keep both parts of a concatenated variable when using melt() on two or more variables? (data.table::melt())<p>I'm trying to reshape (i.e., make longer) a dataframe with concatenated variables using the data.table::melt() function. Both variables are concatenated with year. [<em>note</em>: I am using data.table... | <p>It may be easier with <code>pivot_longer</code></p>
<pre><code>library(tidyr)
library(dplyr)
pivot_longer(dt, cols = -id, names_to = c(".value", "year"), names_sep = "_")%>%
arrange(year)
</code></pre>
<p>-output</p>
<pre><code># A tibble: 9 × 4
id year varA varB
<dbl... | How do I keep both parts of a concatenated variable when using melt() on two or more variables? (data.table::melt()) | r|data.table|melt | 2 | 47 | 1 | 72,956,648 | 72,956,648 | 3 | true | 2022-07-12T18:04:22.220Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I keep both parts of a concatenated variable when using melt() on two or more variables? (data.table::melt())<p>I'm trying to reshape (i.e., make long... |
73,015,829 | How to separate dataset into the same fixed size of groups?<p>I am wondering how to separate all elements in a list into several groups with the same size of length.</p>
<p>For example, there is a list containing 12 elements: <code>A = [1,2,3,4,5,6,7,8,9,10,11,12]</code>.
Then, 4 adjacent elements in <code>A</code> are... | <p>You could try this handy one by using more_itertools:</p>
<p>It's to group elements from iterable into <em>fixed-length groups of length</em> n (in this case is 4)</p>
<pre><code>>>> from more_itertools import grouper
>>> list(grouper(lst, 3))
[(1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12)]
>>... | How to separate dataset into the same fixed size of groups? | python | -1 | 47 | 3 | 73,015,857 | 73,015,857 | 3 | true | 2022-07-17T22:39:17.843Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to separate dataset into the same fixed size of groups?<p>I am wondering how to separate all elements in a list into several groups with the same size of... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.