qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
50,304,502 | I'm building one app where on top of Camera view I need to show something. Here is my code.
```
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
List<CameraDescription> cameras;
void main() async {
runApp(new MaterialApp(
home: new CameraApp(),
));
}
class C... | 2018/05/12 | [
"https://Stackoverflow.com/questions/50304502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304215/"
] | giving height to widget which is throwing error solved my issue | I solved the problem this way:
```
children: <Widget>[
(controller== null)
? Container()
: controller.value.Initialized
? Container(child: CameraPreview(controller))
: Container(),
],
``` |
50,304,502 | I'm building one app where on top of Camera view I need to show something. Here is my code.
```
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
List<CameraDescription> cameras;
void main() async {
runApp(new MaterialApp(
home: new CameraApp(),
));
}
class C... | 2018/05/12 | [
"https://Stackoverflow.com/questions/50304502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304215/"
] | I had this problem before and putting a height into the parent widget of `AspectRatio` fixed it. | giving height to widget which is throwing error solved my issue |
50,304,502 | I'm building one app where on top of Camera view I need to show something. Here is my code.
```
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
List<CameraDescription> cameras;
void main() async {
runApp(new MaterialApp(
home: new CameraApp(),
));
}
class C... | 2018/05/12 | [
"https://Stackoverflow.com/questions/50304502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304215/"
] | giving height to widget which is throwing error solved my issue | Most of the time. `HOT RESTART (R)` will fix this error. |
50,304,502 | I'm building one app where on top of Camera view I need to show something. Here is my code.
```
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
List<CameraDescription> cameras;
void main() async {
runApp(new MaterialApp(
home: new CameraApp(),
));
}
class C... | 2018/05/12 | [
"https://Stackoverflow.com/questions/50304502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304215/"
] | If you have created and assigned value to the variable and still it shows `getter 'value' was called on null`,
try to `Run` or `Restart` your app instead of `Hot Reload`. Because `Hot Reload` will not call `initstate()` (where variables assign their values) which will be only called by `Restarting` the app. | ```
aspectRatio: (this.controller?.value?.aspectRatio) ?? false
```
`aspectRatio` is a double value and you assigned it to `false` when it is `null`. Give it a double value. |
50,304,502 | I'm building one app where on top of Camera view I need to show something. Here is my code.
```
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
List<CameraDescription> cameras;
void main() async {
runApp(new MaterialApp(
home: new CameraApp(),
));
}
class C... | 2018/05/12 | [
"https://Stackoverflow.com/questions/50304502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304215/"
] | If you have created and assigned value to the variable and still it shows `getter 'value' was called on null`,
try to `Run` or `Restart` your app instead of `Hot Reload`. Because `Hot Reload` will not call `initstate()` (where variables assign their values) which will be only called by `Restarting` the app. | I had this problem before and putting a height into the parent widget of `AspectRatio` fixed it. |
50,304,502 | I'm building one app where on top of Camera view I need to show something. Here is my code.
```
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
List<CameraDescription> cameras;
void main() async {
runApp(new MaterialApp(
home: new CameraApp(),
));
}
class C... | 2018/05/12 | [
"https://Stackoverflow.com/questions/50304502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304215/"
] | In the `initState`, you don't always instantiate a controller.
Which means it can be `null`. Therefore inside the `build` method, you need to check null to not crash
```
(!this.controller?.value?.initialized ?? false) ? new Container() : cameraView ,
``` | ```
aspectRatio: (this.controller?.value?.aspectRatio) ?? false
```
`aspectRatio` is a double value and you assigned it to `false` when it is `null`. Give it a double value. |
50,304,502 | I'm building one app where on top of Camera view I need to show something. Here is my code.
```
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
List<CameraDescription> cameras;
void main() async {
runApp(new MaterialApp(
home: new CameraApp(),
));
}
class C... | 2018/05/12 | [
"https://Stackoverflow.com/questions/50304502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304215/"
] | I solved the problem this way:
```
children: <Widget>[
(controller== null)
? Container()
: controller.value.Initialized
? Container(child: CameraPreview(controller))
: Container(),
],
``` | Most of the time. `HOT RESTART (R)` will fix this error. |
44,063,027 | I need to show confirm dialog message as html, this is how looks my dialog in component:
```
this.confirmationService.confirm({
header: "Change user status",
message: "Do you want to change user status to <strong>" + status + "</strong >?",
accept: () => {
//
}
});
```
... | 2017/05/19 | [
"https://Stackoverflow.com/questions/44063027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3471882/"
] | so this is kind of old, but for the future- the solution is to change the quote type of `message`.
so, change
```
message: "Do you want to change user status to <strong>" + status + "</strong >?",
```
to
```
message: `Do you want to change user status to <strong>" + status + "</strong >?`,
``` | PrimeNG ConfirmDialog's message element class is ui-confirmdialog-message
Set up a property (e.g: message) in your ts file
```
public message: string;
this.confirmationService.confirm({
header: "Change user status",
message: this.message,
accept: () => {
//
}
});
this.message = d... |
24,789,585 | I am trying to update users **via AJAX** from my index view, so I have the following view:
```
<% @users.each do |user| %>
<tr>
<td><%= user.email %></td>
<td>
<%= form_for [:admin, user], :remote => true, :authenticity_token => true, :format => :json do |f| %>
<%= f.radio_button :app... | 2014/07/16 | [
"https://Stackoverflow.com/questions/24789585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196150/"
] | You should change your onclick handler, from `this.form.submit()` to `$(this).closest("form").trigger("submit");`
As you have it now you are directly submitting the form, so jquery-ujs can't handle the event. | Add this javascript snippet on your page:
```
$("form").on("ajax:complete", (xhr, status) ->
location.reload();
)
```
You might want to use ajax:success and ajax:error instead of ajax:complete.
If AJAX is not used then you can redirect to the index page after an update:
```
def update
@user = User.find(params[... |
24,789,585 | I am trying to update users **via AJAX** from my index view, so I have the following view:
```
<% @users.each do |user| %>
<tr>
<td><%= user.email %></td>
<td>
<%= form_for [:admin, user], :remote => true, :authenticity_token => true, :format => :json do |f| %>
<%= f.radio_button :app... | 2014/07/16 | [
"https://Stackoverflow.com/questions/24789585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196150/"
] | **JS**
Firstly, I don't understand *exactly* what you're trying to achieve
I surmise that you're trying to capture the updated data you've just sent? If this is the case, I would not use the `json` MIME-type; instead, I would just send a plain `JS` request.
The JSON mime type is mainly for the likes of `API`s - wher... | Add this javascript snippet on your page:
```
$("form").on("ajax:complete", (xhr, status) ->
location.reload();
)
```
You might want to use ajax:success and ajax:error instead of ajax:complete.
If AJAX is not used then you can redirect to the index page after an update:
```
def update
@user = User.find(params[... |
71,252,692 | When updating one DataFrame based on info from second one the NaN's are not transferred.
With below code
```
import pandas as pd
import numpy as np
df1 = pd.DataFrame({'A':[1,2,3,4,5], 'B':[4,5,6,7,8]})
df2 = pd.DataFrame({'A':[1,2,3], 'B':[7,np.nan,6]})
df1.update(df2)
```
The new DataFrame will look as below:
[![... | 2022/02/24 | [
"https://Stackoverflow.com/questions/71252692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16659145/"
] | Try this,
```
bool isCountryChanged = false; // for update UI when country changed.
appBar: AppBar(
backgroundColor: Colors.transparent,
leading: const Icon(
Icons.public,
color: Colors.black,
size: 27,
),
title: const Text(
"Kelime Öğren",
style: TextStyle(color: Colors.... | You can create a variable of type duration and then create a function which returns a future builder which is going to await for the duration to finish then display the country but in the mean time will display a circular indicator |
71,252,692 | When updating one DataFrame based on info from second one the NaN's are not transferred.
With below code
```
import pandas as pd
import numpy as np
df1 = pd.DataFrame({'A':[1,2,3,4,5], 'B':[4,5,6,7,8]})
df2 = pd.DataFrame({'A':[1,2,3], 'B':[7,np.nan,6]})
df1.update(df2)
```
The new DataFrame will look as below:
[![... | 2022/02/24 | [
"https://Stackoverflow.com/questions/71252692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16659145/"
] | Need a ternary operator which can control your data is ready or not if not CircularProgressIndicator() will shown at appbar unless you can see your data.For example you can be try to fetch data from db that can be take time or maybe you cant fetch data so in this stuation must be show a progress indicator when data rea... | You can create a variable of type duration and then create a function which returns a future builder which is going to await for the duration to finish then display the country but in the mean time will display a circular indicator |
41,553,641 | ```
["trnx_date"]=>
array(2) {
[0]=>
string(10) "2017-01-10"
[1]=>
string(10) "2017-01-10"
}
["curr_from"]=>
array(2) {
[0]=>
string(3) "USD"
[1]=>
string(3) "PHP"
}
["curr_from_amt"]=>
array(2) {
[0]=>
string(8) "4,000.00"
[1]=>
string(8) "3,000.00"
}
... | 2017/01/09 | [
"https://Stackoverflow.com/questions/41553641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1504299/"
] | Assuming all the sub-arrays have the same length, you can use a simple `for` loop that iterates over the index of one of them, and use that to access each of the sub-arrays at that index. Then combine all of them into the associative array for each customer.
```
$result = array();
$keys = array_keys($array);
$len = co... | How about this?
```
// assume $arr is your original data array
$keys = array_keys($arr);
$result = array();
foreach($keys as $key) {
$vals = $arr[$key];
foreach($vals as $i =>$val) {
if (!is_array($result[$i]) {
$result[$i] = array();
}
$result[$i][$key] = $val;
}
}
var_... |
41,553,641 | ```
["trnx_date"]=>
array(2) {
[0]=>
string(10) "2017-01-10"
[1]=>
string(10) "2017-01-10"
}
["curr_from"]=>
array(2) {
[0]=>
string(3) "USD"
[1]=>
string(3) "PHP"
}
["curr_from_amt"]=>
array(2) {
[0]=>
string(8) "4,000.00"
[1]=>
string(8) "3,000.00"
}
... | 2017/01/09 | [
"https://Stackoverflow.com/questions/41553641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1504299/"
] | ```
$arr = array(
'trnx_date' => array('2017-01-10', '2017-01-10'),
'curr_from' => array('USD', 'PHP'),
'curr_from_amt' => array('4,000.00', '3,000.00'),
'curr_to' => array('GBP', 'SAR'),
'curr_to_amt' => array('3,000.00', '2,000.00'),
'amount' => array('7,000.00', '5,000.00')
);
$arr_out = arr... | How about this?
```
// assume $arr is your original data array
$keys = array_keys($arr);
$result = array();
foreach($keys as $key) {
$vals = $arr[$key];
foreach($vals as $i =>$val) {
if (!is_array($result[$i]) {
$result[$i] = array();
}
$result[$i][$key] = $val;
}
}
var_... |
61,469,253 | I have an `appsettings.json` file where I want to transform the value located at:
```
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=MyDatabase;Trusted_Connection=True;MultipleActiveResultSets=true"
},
```
I found the following answer so I know that an app service can retrieve... | 2020/04/27 | [
"https://Stackoverflow.com/questions/61469253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3850405/"
] | Read a similar question from VSTS (Visual Studio Team Services) and was able to solve it.
Created a `Pipeline variable` called `ConnectionStrings.DefaultConnection` that had a reference value to my linked variable group.
If my secret was named `ConnectionStringsDefaultConnection` I would hook this up as a linked vari... | One of the option will be to use Key Vault directly in your application instead of replacing your appsettings.json. You can configure this in `CreateHostBuilder` method:
```cs
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((context,... |
61,469,253 | I have an `appsettings.json` file where I want to transform the value located at:
```
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=MyDatabase;Trusted_Connection=True;MultipleActiveResultSets=true"
},
```
I found the following answer so I know that an app service can retrieve... | 2020/04/27 | [
"https://Stackoverflow.com/questions/61469253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3850405/"
] | Read a similar question from VSTS (Visual Studio Team Services) and was able to solve it.
Created a `Pipeline variable` called `ConnectionStrings.DefaultConnection` that had a reference value to my linked variable group.
If my secret was named `ConnectionStringsDefaultConnection` I would hook this up as a linked vari... | I managed to resolve this issue automatically without the need to manage all the variables by myself.
I used the idea of @Ogglas and made this little script in an Azure Powershell task.
```
$results = Get-AzKeyVaultSecret -VaultName $(key-vault-name)
foreach ($result in $results)
{
if ($result.Name.Contains("--"... |
61,469,253 | I have an `appsettings.json` file where I want to transform the value located at:
```
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=MyDatabase;Trusted_Connection=True;MultipleActiveResultSets=true"
},
```
I found the following answer so I know that an app service can retrieve... | 2020/04/27 | [
"https://Stackoverflow.com/questions/61469253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3850405/"
] | I managed to resolve this issue automatically without the need to manage all the variables by myself.
I used the idea of @Ogglas and made this little script in an Azure Powershell task.
```
$results = Get-AzKeyVaultSecret -VaultName $(key-vault-name)
foreach ($result in $results)
{
if ($result.Name.Contains("--"... | One of the option will be to use Key Vault directly in your application instead of replacing your appsettings.json. You can configure this in `CreateHostBuilder` method:
```cs
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((context,... |
2,016 | Hi guys, can any one please give me an examples of Subtextual sound and Visual amplification sound within a film. | 2010/07/16 | [
"https://sound.stackexchange.com/questions/2016",
"https://sound.stackexchange.com",
"https://sound.stackexchange.com/users/442/"
] | Emmanuel,
Can you clarify what exactly you are asking? I say this because it would be useful to have some idea about what specifically you are looking to find out.
Film sound will contain a lot of subtexts in varying degrees. From a basic illiciting of an emotional response from the audience (animal sounds layered in... | Thank you Ian.....Basically Visual Amplication sound is one of the 6 Areas of sound within a film, which are found on the David Sonnenschein`s book (The Expressive Power Of Music, Voice And Sound Effects In Cinema), but I needed a clear understandind of how it works within a film..By the way I`m still a student whose i... |
9,834,289 | Using the native Android MediaPlayer class I am able to play Shoutcast streams. Furthermore, using streamscraper (http://code.google.com/p/streamscraper/) I am able to get the metadata for the current playing song in the stream.
I would like to know if there is a way to be notified when the song in the radio stream c... | 2012/03/23 | [
"https://Stackoverflow.com/questions/9834289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/345191/"
] | Shorthand properties (such as `border`) are not supported by `jQuery.css()`.
<http://api.jquery.com/css/> | I'm not sure this will solve your problem, but I would start by trying to clean up the way you're making that link. You may have missed one or two quotes. Instead of the confusion of escaping or failing to escape double quotes, just surround your string with single quotes:
```
var merkTag = '<a class="deletemerk" href... |
9,834,289 | Using the native Android MediaPlayer class I am able to play Shoutcast streams. Furthermore, using streamscraper (http://code.google.com/p/streamscraper/) I am able to get the metadata for the current playing song in the stream.
I would like to know if there is a way to be notified when the song in the radio stream c... | 2012/03/23 | [
"https://Stackoverflow.com/questions/9834289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/345191/"
] | If you want to use all the three properties of border, try defining them independently , it might solve your problem. | I'm not sure this will solve your problem, but I would start by trying to clean up the way you're making that link. You may have missed one or two quotes. Instead of the confusion of escaping or failing to escape double quotes, just surround your string with single quotes:
```
var merkTag = '<a class="deletemerk" href... |
9,834,289 | Using the native Android MediaPlayer class I am able to play Shoutcast streams. Furthermore, using streamscraper (http://code.google.com/p/streamscraper/) I am able to get the metadata for the current playing song in the stream.
I would like to know if there is a way to be notified when the song in the radio stream c... | 2012/03/23 | [
"https://Stackoverflow.com/questions/9834289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/345191/"
] | Shorthand properties (such as `border`) are not supported by `jQuery.css()`.
<http://api.jquery.com/css/> | If you want to use all the three properties of border, try defining them independently , it might solve your problem. |
30,568,353 | I want to serialize and deserialize an immutable object using com.fasterxml.jackson.databind.ObjectMapper.
The immutable class looks like this (just 3 internal attributes, getters and constructors):
```
public final class ImportResultItemImpl implements ImportResultItem {
private final ImportResultItemType resu... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30568353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717958/"
] | To let Jackson know how to create an object for deserialization, use the [`@JsonCreator`](http://fasterxml.github.io/jackson-annotations/javadoc/2.2.0/com/fasterxml/jackson/annotation/JsonCreator.html) and [`@JsonProperty`](http://fasterxml.github.io/jackson-annotations/javadoc/2.2.0/com/fasterxml/jackson/annotation/Js... | You can use a private default constructor, Jackson will then fill the fields via reflection even if they are private final.
EDIT: And use a protected/package-protected default constructor for parent classes if you have inheritance. |
30,568,353 | I want to serialize and deserialize an immutable object using com.fasterxml.jackson.databind.ObjectMapper.
The immutable class looks like this (just 3 internal attributes, getters and constructors):
```
public final class ImportResultItemImpl implements ImportResultItem {
private final ImportResultItemType resu... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30568353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717958/"
] | To let Jackson know how to create an object for deserialization, use the [`@JsonCreator`](http://fasterxml.github.io/jackson-annotations/javadoc/2.2.0/com/fasterxml/jackson/annotation/JsonCreator.html) and [`@JsonProperty`](http://fasterxml.github.io/jackson-annotations/javadoc/2.2.0/com/fasterxml/jackson/annotation/Js... | The first answer of Sergei Petunin is right.
However, we could simplify code with removing redundant @JsonProperty annotations on each parameter of constructor.
It can be done with adding com.fasterxml.jackson.module.paramnames.ParameterNamesModule into ObjectMapper:
```
new ObjectMapper()
.registerModule(n... |
30,568,353 | I want to serialize and deserialize an immutable object using com.fasterxml.jackson.databind.ObjectMapper.
The immutable class looks like this (just 3 internal attributes, getters and constructors):
```
public final class ImportResultItemImpl implements ImportResultItem {
private final ImportResultItemType resu... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30568353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717958/"
] | To let Jackson know how to create an object for deserialization, use the [`@JsonCreator`](http://fasterxml.github.io/jackson-annotations/javadoc/2.2.0/com/fasterxml/jackson/annotation/JsonCreator.html) and [`@JsonProperty`](http://fasterxml.github.io/jackson-annotations/javadoc/2.2.0/com/fasterxml/jackson/annotation/Js... | It's 2021, I had the same issue. Unfortunately, the previous answers in this thread weren't helpful in my case, because:
1. I need to deserialize `java.net.HttpCookie` class object. I can't modify it.
2. Due to some reasons, I use jackson-databind-2.11.0 version. `ParameterNamesModule` has been added in 3+ version.
S... |
30,568,353 | I want to serialize and deserialize an immutable object using com.fasterxml.jackson.databind.ObjectMapper.
The immutable class looks like this (just 3 internal attributes, getters and constructors):
```
public final class ImportResultItemImpl implements ImportResultItem {
private final ImportResultItemType resu... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30568353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717958/"
] | To let Jackson know how to create an object for deserialization, use the [`@JsonCreator`](http://fasterxml.github.io/jackson-annotations/javadoc/2.2.0/com/fasterxml/jackson/annotation/JsonCreator.html) and [`@JsonProperty`](http://fasterxml.github.io/jackson-annotations/javadoc/2.2.0/com/fasterxml/jackson/annotation/Js... | Since Java 14 and [Jackson 2.12.0](https://github.com/FasterXML/jackson-future-ideas/issues/46) you can use a [record](https://docs.oracle.com/en/java/javase/14/language/records.html) class like this:
```
public record ImportResultItemImpl(String name, ImportResultItemType resultType, String message) implements Import... |
30,568,353 | I want to serialize and deserialize an immutable object using com.fasterxml.jackson.databind.ObjectMapper.
The immutable class looks like this (just 3 internal attributes, getters and constructors):
```
public final class ImportResultItemImpl implements ImportResultItem {
private final ImportResultItemType resu... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30568353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717958/"
] | You can use a private default constructor, Jackson will then fill the fields via reflection even if they are private final.
EDIT: And use a protected/package-protected default constructor for parent classes if you have inheritance. | The first answer of Sergei Petunin is right.
However, we could simplify code with removing redundant @JsonProperty annotations on each parameter of constructor.
It can be done with adding com.fasterxml.jackson.module.paramnames.ParameterNamesModule into ObjectMapper:
```
new ObjectMapper()
.registerModule(n... |
30,568,353 | I want to serialize and deserialize an immutable object using com.fasterxml.jackson.databind.ObjectMapper.
The immutable class looks like this (just 3 internal attributes, getters and constructors):
```
public final class ImportResultItemImpl implements ImportResultItem {
private final ImportResultItemType resu... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30568353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717958/"
] | You can use a private default constructor, Jackson will then fill the fields via reflection even if they are private final.
EDIT: And use a protected/package-protected default constructor for parent classes if you have inheritance. | It's 2021, I had the same issue. Unfortunately, the previous answers in this thread weren't helpful in my case, because:
1. I need to deserialize `java.net.HttpCookie` class object. I can't modify it.
2. Due to some reasons, I use jackson-databind-2.11.0 version. `ParameterNamesModule` has been added in 3+ version.
S... |
30,568,353 | I want to serialize and deserialize an immutable object using com.fasterxml.jackson.databind.ObjectMapper.
The immutable class looks like this (just 3 internal attributes, getters and constructors):
```
public final class ImportResultItemImpl implements ImportResultItem {
private final ImportResultItemType resu... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30568353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717958/"
] | You can use a private default constructor, Jackson will then fill the fields via reflection even if they are private final.
EDIT: And use a protected/package-protected default constructor for parent classes if you have inheritance. | Since Java 14 and [Jackson 2.12.0](https://github.com/FasterXML/jackson-future-ideas/issues/46) you can use a [record](https://docs.oracle.com/en/java/javase/14/language/records.html) class like this:
```
public record ImportResultItemImpl(String name, ImportResultItemType resultType, String message) implements Import... |
30,568,353 | I want to serialize and deserialize an immutable object using com.fasterxml.jackson.databind.ObjectMapper.
The immutable class looks like this (just 3 internal attributes, getters and constructors):
```
public final class ImportResultItemImpl implements ImportResultItem {
private final ImportResultItemType resu... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30568353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717958/"
] | The first answer of Sergei Petunin is right.
However, we could simplify code with removing redundant @JsonProperty annotations on each parameter of constructor.
It can be done with adding com.fasterxml.jackson.module.paramnames.ParameterNamesModule into ObjectMapper:
```
new ObjectMapper()
.registerModule(n... | It's 2021, I had the same issue. Unfortunately, the previous answers in this thread weren't helpful in my case, because:
1. I need to deserialize `java.net.HttpCookie` class object. I can't modify it.
2. Due to some reasons, I use jackson-databind-2.11.0 version. `ParameterNamesModule` has been added in 3+ version.
S... |
30,568,353 | I want to serialize and deserialize an immutable object using com.fasterxml.jackson.databind.ObjectMapper.
The immutable class looks like this (just 3 internal attributes, getters and constructors):
```
public final class ImportResultItemImpl implements ImportResultItem {
private final ImportResultItemType resu... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30568353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717958/"
] | The first answer of Sergei Petunin is right.
However, we could simplify code with removing redundant @JsonProperty annotations on each parameter of constructor.
It can be done with adding com.fasterxml.jackson.module.paramnames.ParameterNamesModule into ObjectMapper:
```
new ObjectMapper()
.registerModule(n... | Since Java 14 and [Jackson 2.12.0](https://github.com/FasterXML/jackson-future-ideas/issues/46) you can use a [record](https://docs.oracle.com/en/java/javase/14/language/records.html) class like this:
```
public record ImportResultItemImpl(String name, ImportResultItemType resultType, String message) implements Import... |
30,568,353 | I want to serialize and deserialize an immutable object using com.fasterxml.jackson.databind.ObjectMapper.
The immutable class looks like this (just 3 internal attributes, getters and constructors):
```
public final class ImportResultItemImpl implements ImportResultItem {
private final ImportResultItemType resu... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30568353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717958/"
] | It's 2021, I had the same issue. Unfortunately, the previous answers in this thread weren't helpful in my case, because:
1. I need to deserialize `java.net.HttpCookie` class object. I can't modify it.
2. Due to some reasons, I use jackson-databind-2.11.0 version. `ParameterNamesModule` has been added in 3+ version.
S... | Since Java 14 and [Jackson 2.12.0](https://github.com/FasterXML/jackson-future-ideas/issues/46) you can use a [record](https://docs.oracle.com/en/java/javase/14/language/records.html) class like this:
```
public record ImportResultItemImpl(String name, ImportResultItemType resultType, String message) implements Import... |
6,662,497 | I have some links that have \_2 if they are duplicates, I want to keep the href the same but change the text to remove the \_2, sometimes there's an \_3 or \_4 so I just want to remove from the text everything after the \_.
Here is an example of the href's I want to change
```
<li style="display: list-item;" class="... | 2011/07/12 | [
"https://Stackoverflow.com/questions/6662497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/526938/"
] | you can try this:
```
$(this).text($(this).text().replace(/_\d+$/, "_"));
``` | ```
$(this).text($(this).text().split('_')[0]);
``` |
6,662,497 | I have some links that have \_2 if they are duplicates, I want to keep the href the same but change the text to remove the \_2, sometimes there's an \_3 or \_4 so I just want to remove from the text everything after the \_.
Here is an example of the href's I want to change
```
<li style="display: list-item;" class="... | 2011/07/12 | [
"https://Stackoverflow.com/questions/6662497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/526938/"
] | you can try this:
```
$(this).text($(this).text().replace(/_\d+$/, "_"));
``` | `$(this).text($(this).text().replace(/_([0-9])+/, ''));` |
39,851,616 | I tried to switch to popup alert and click on OK button, but i got an error saying that xpath (for OK button) is not found.
But this is working for me sometimes using the same code. Could anyone help me out on this. I tried all possible ways that is available in blogs. But i couldn't make it | 2016/10/04 | [
"https://Stackoverflow.com/questions/39851616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3318753/"
] | you need to move control to your pop-up window first before doing any operation on pop-up window:-
below code is to move selenium control on pop-up window
```
driver.switchTo().alert();
```
by writing below line
```
alert.accept();
```
alert will get close | Based on the original question and the subsequent comments, I suspect what you're dealing with is a browser pop up window and not an alert. So this won't work
```
driver.switchTo().alert().accept();
```
You need to use window handles
```
Set<String> handles = driver.getWindowHandles();
Iterator<String> windows = h... |
131,056 | In the [Matrix](https://matrix.org/) instant messaging protocol, when using the reference implementation of the Matrix server (called `synapse`), there is an [admin API](https://github.com/matrix-org/synapse/blob/master/docs/admin_api/) with functions like [resetting a password](https://github.com/matrix-org/synapse/bl... | 2019/06/20 | [
"https://webapps.stackexchange.com/questions/131056",
"https://webapps.stackexchange.com",
"https://webapps.stackexchange.com/users/75677/"
] | Solution to find your access token:
1. Log in to the account you want to get the access token for. Click on the name in the top left corner, then "Settings".
2. Click the "Help & About" tab (left side of the dialog).
3. Scroll to the bottom and click on `<click to reveal>` part of Access
Token.
4. Copy your access tok... | These `access_token` API keys were listed in the [Riot](https://riot.im/) web application until not too long ago, somewhere under the account settings. In the newest version, I could no longer find them there.
So instead, I use a technique I found [here](https://github.com/matrix-org/synapse/issues/1707#issuecomment-4... |
131,056 | In the [Matrix](https://matrix.org/) instant messaging protocol, when using the reference implementation of the Matrix server (called `synapse`), there is an [admin API](https://github.com/matrix-org/synapse/blob/master/docs/admin_api/) with functions like [resetting a password](https://github.com/matrix-org/synapse/bl... | 2019/06/20 | [
"https://webapps.stackexchange.com/questions/131056",
"https://webapps.stackexchange.com",
"https://webapps.stackexchange.com/users/75677/"
] | These `access_token` API keys were listed in the [Riot](https://riot.im/) web application until not too long ago, somewhere under the account settings. In the newest version, I could no longer find them there.
So instead, I use a technique I found [here](https://github.com/matrix-org/synapse/issues/1707#issuecomment-4... | With the current version of the Matrix protocol, getting an access\_token programmatically works slightly different:
To find out the endpoint, e.g., for matrix.org, you need to check a `.well-known` file for the API URL ([Documentation](https://spec.matrix.org/v1.1/client-server-api/#well-known-uri)): `https://matrix.... |
131,056 | In the [Matrix](https://matrix.org/) instant messaging protocol, when using the reference implementation of the Matrix server (called `synapse`), there is an [admin API](https://github.com/matrix-org/synapse/blob/master/docs/admin_api/) with functions like [resetting a password](https://github.com/matrix-org/synapse/bl... | 2019/06/20 | [
"https://webapps.stackexchange.com/questions/131056",
"https://webapps.stackexchange.com",
"https://webapps.stackexchange.com/users/75677/"
] | Solution to find your access token:
1. Log in to the account you want to get the access token for. Click on the name in the top left corner, then "Settings".
2. Click the "Help & About" tab (left side of the dialog).
3. Scroll to the bottom and click on `<click to reveal>` part of Access
Token.
4. Copy your access tok... | With the current version of the Matrix protocol, getting an access\_token programmatically works slightly different:
To find out the endpoint, e.g., for matrix.org, you need to check a `.well-known` file for the API URL ([Documentation](https://spec.matrix.org/v1.1/client-server-api/#well-known-uri)): `https://matrix.... |
67,651,333 | I have built a python class, which takes a string as input
I have put 3 functions in the python class.
First function is to count no of upper and lower case
Second function is to truncate the string
Third function is to check if the string is a palindrome
```
class stringUtility():
def _init_(self,string):
... | 2021/05/22 | [
"https://Stackoverflow.com/questions/67651333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | There's a lot amiss with Windows Terminal [#10153](https://github.com/microsoft/terminal/issues/10153), since the developers were as they say [*"shooting from the hip"*](https://www.collinsdictionary.com/us/dictionary/english/to-shoot-from-the-hip). There's no study of the available documentation, testing, etc.
The bu... | Summarizing the discussion I had on the [Windows Terminal bug tracker about the missing support for DECRQM or XTSAVE+XTRESTORE](https://github.com/microsoft/terminal/issues/10153) :
>
> It is the implicit assumption that terminal-based application would
> set any desired modes upon start and **reset to the default** ... |
59,067,075 | array = ["£179.95", "£199.95", "£89.95"]
How to multiple this values add get the total values in ios swift 4.
Please help me. | 2019/11/27 | [
"https://Stackoverflow.com/questions/59067075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11923334/"
] | Try this. This will Works.
```
$a = 1;
$x = 1;
$array = [];
$array[] = array(
'name' => 'name',
'type' => 'type',
'label' => 'label',
);
if( $a == $x ){
$array[] = array(
'name' => 'name',
'type' => 'type',
'label' => 'label',
);
}
$array[] = array(
'name' => 'name',
'type' => '... | Hope help:
```
$a = 1;
$x = 1;
$array = array(
array(
'name' => 'name',
'type' => 'type',
'label' => 'label',
),
array(
'name' => 'name',
'type' => 'type',
'label' => 'label',
),
);
if ( $a === $x ) {
$array[] = array(
'name' => 'name',
... |
6,040,640 | I have an sql query in which I need to select the records from table where the time is between 3:00 PM yesterday to 3:00 PM today *if* today's time is more than 3:00 PM.
If today's time is less than that, like if today's time is 1:00 PM. then then my query should take today's time as 1:00 PM (which should return me re... | 2011/05/18 | [
"https://Stackoverflow.com/questions/6040640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96180/"
] | The best way of handling this is to use an [IF statement](http://www.techonthenet.com/oracle/loops/if_then.php):
```
IF TO_CHAR(SYSDATE, 'HH24') >= 15 THEN
SELECT x.*
FROM YOUR_TABLE x
WHERE x.date_column BETWEEN TO_DATE(TO_CHAR(SYSDATE -1, 'YYYY-MM-DD')|| ' 15:00:00', 'YYYY-MM-DD HH24:MI:SS')
... | There is no need for an IF statement. This can be solved easily with simple SQL.
My table T23 has some records with dates; here is a sample with times at 3.00pm:
```
SQL> select id, some_date from t23
2 where to_char(some_date,'HH24') = '15'
3 /
ID SOME_DATE
---------- ---------
14 16-MAY-11
... |
18,877,580 | Consider the following snippet:
```
"12-18" -Contains "-"
```
You’d think this evaluates to `true`, but it doesn't. This will evaluate to `false` instead. I’m not sure why this happens, but it does.
To avoid this, you can use this instead:
```
"12-18".Contains("-")
```
Now the expression will evaluate to true.
... | 2013/09/18 | [
"https://Stackoverflow.com/questions/18877580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/770270/"
] | The `-Contains` operator doesn't do substring comparisons and the match must be on a complete string and is used to search collections.
From the documentation you linked to:
>
> -Contains
> Description: Containment operator. **Tells whether a collection of reference values includes a single test value.**
>
>
>
... | `-Contains` is actually a collection operator. It is true if the collection contains the object. It is not limited to strings.
[`-match` and `-imatch`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-6) are regular expression string matcher... |
18,877,580 | Consider the following snippet:
```
"12-18" -Contains "-"
```
You’d think this evaluates to `true`, but it doesn't. This will evaluate to `false` instead. I’m not sure why this happens, but it does.
To avoid this, you can use this instead:
```
"12-18".Contains("-")
```
Now the expression will evaluate to true.
... | 2013/09/18 | [
"https://Stackoverflow.com/questions/18877580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/770270/"
] | The `-Contains` operator doesn't do substring comparisons and the match must be on a complete string and is used to search collections.
From the documentation you linked to:
>
> -Contains
> Description: Containment operator. **Tells whether a collection of reference values includes a single test value.**
>
>
>
... | You can use `like`:
```
"12-18" -like "*-*"
```
Or `split` for `contains`:
```
"12-18" -split "" -contains "-"
``` |
18,877,580 | Consider the following snippet:
```
"12-18" -Contains "-"
```
You’d think this evaluates to `true`, but it doesn't. This will evaluate to `false` instead. I’m not sure why this happens, but it does.
To avoid this, you can use this instead:
```
"12-18".Contains("-")
```
Now the expression will evaluate to true.
... | 2013/09/18 | [
"https://Stackoverflow.com/questions/18877580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/770270/"
] | The `-Contains` operator doesn't do substring comparisons and the match must be on a complete string and is used to search collections.
From the documentation you linked to:
>
> -Contains
> Description: Containment operator. **Tells whether a collection of reference values includes a single test value.**
>
>
>
... | * `like` is best, or at least easiest.
* `match` is used for regex comparisons.
Reference: *[About Comparison Operators](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comparison_operators)* |
18,877,580 | Consider the following snippet:
```
"12-18" -Contains "-"
```
You’d think this evaluates to `true`, but it doesn't. This will evaluate to `false` instead. I’m not sure why this happens, but it does.
To avoid this, you can use this instead:
```
"12-18".Contains("-")
```
Now the expression will evaluate to true.
... | 2013/09/18 | [
"https://Stackoverflow.com/questions/18877580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/770270/"
] | `-Contains` is actually a collection operator. It is true if the collection contains the object. It is not limited to strings.
[`-match` and `-imatch`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-6) are regular expression string matcher... | You can use `like`:
```
"12-18" -like "*-*"
```
Or `split` for `contains`:
```
"12-18" -split "" -contains "-"
``` |
18,877,580 | Consider the following snippet:
```
"12-18" -Contains "-"
```
You’d think this evaluates to `true`, but it doesn't. This will evaluate to `false` instead. I’m not sure why this happens, but it does.
To avoid this, you can use this instead:
```
"12-18".Contains("-")
```
Now the expression will evaluate to true.
... | 2013/09/18 | [
"https://Stackoverflow.com/questions/18877580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/770270/"
] | `-Contains` is actually a collection operator. It is true if the collection contains the object. It is not limited to strings.
[`-match` and `-imatch`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-6) are regular expression string matcher... | * `like` is best, or at least easiest.
* `match` is used for regex comparisons.
Reference: *[About Comparison Operators](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comparison_operators)* |
18,877,580 | Consider the following snippet:
```
"12-18" -Contains "-"
```
You’d think this evaluates to `true`, but it doesn't. This will evaluate to `false` instead. I’m not sure why this happens, but it does.
To avoid this, you can use this instead:
```
"12-18".Contains("-")
```
Now the expression will evaluate to true.
... | 2013/09/18 | [
"https://Stackoverflow.com/questions/18877580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/770270/"
] | You can use `like`:
```
"12-18" -like "*-*"
```
Or `split` for `contains`:
```
"12-18" -split "" -contains "-"
``` | * `like` is best, or at least easiest.
* `match` is used for regex comparisons.
Reference: *[About Comparison Operators](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comparison_operators)* |
2,880,449 | after some simplification, we get (2004y)/(y-2004)=x
and by looking at the prime factorization of 2004 we observe there are only 12 ways in which 2004 can be expressed as the product of two integers.
which gives us 12 ordered pairs.But the answer is 45. how?(sorry for not using mathjax my browser does not support it) | 2018/08/12 | [
"https://math.stackexchange.com/questions/2880449",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/570638/"
] | Guide:
Once we get $$2004y+2004x=xy$$
$$-2004y-2004x+xy=0$$
$$2004^2-2004y-2004x+xy=2004^2$$
$$(2004-x)(2004-y)=2004^2=2^4\cdot 3^2\cdot 167^2$$
Can you complete the task? | 1/x +1/y=2004
y+x/xy = 1/2004
2004(x+y)=xy
0=xy-2004x-2004y
0=(x-2004)(y-2004)-(2004)^2
(2004)^2=(x-2004)(y-2004)
It should be pretty easy from here. Just find the factors of 2004 squared. |
2,880,449 | after some simplification, we get (2004y)/(y-2004)=x
and by looking at the prime factorization of 2004 we observe there are only 12 ways in which 2004 can be expressed as the product of two integers.
which gives us 12 ordered pairs.But the answer is 45. how?(sorry for not using mathjax my browser does not support it) | 2018/08/12 | [
"https://math.stackexchange.com/questions/2880449",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/570638/"
] | $$\frac{1}{x}+\frac{1}{y}= \frac{1}{2004}$$
Rearrange:
$(x-2004)(y-2004)=2004^2 = 2^4\cdot3^2\cdot167^2$.
There are exactly $5\cdot 3\cdot 3= 45$ positive integer divisors of this number, so it has $90$ integer divisors. This yields 90 solutions.
For example, one case is that $x-2004= -2^3\cdot3$, and then $y-2004=-... | 1/x +1/y=2004
y+x/xy = 1/2004
2004(x+y)=xy
0=xy-2004x-2004y
0=(x-2004)(y-2004)-(2004)^2
(2004)^2=(x-2004)(y-2004)
It should be pretty easy from here. Just find the factors of 2004 squared. |
50,603,368 | Trying to update one element of an array in this.state I'm getting an (expected ,) error but cant see where I've gone wrong. Do I need to create a temporary array update that, then assign the whole array back to the state
This is essentially what I have
```
this.state = { array: ['a', 'b', 'c'] };
onBack() {
this.... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50603368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608821/"
] | Manoj's answer will work, there is another way using the updater function *(funtinal `setState`)* for `setState` (which you can read about [here](https://reactjs.org/docs/react-component.html#setstate "setState"))
```js
onBack() {
this.setState(prevState => {
let newArray = prevState.array
newArray[2] = "som... | using hooks
===========
```
const [totalSet, setTotalSet] = useState(null);
```
console.log(totalSet); // {sets: Array(3), subscribed: false}
```
setTotalSet(datas => ({
...datas,
sets: updatedSet,
}));
``` |
50,603,368 | Trying to update one element of an array in this.state I'm getting an (expected ,) error but cant see where I've gone wrong. Do I need to create a temporary array update that, then assign the whole array back to the state
This is essentially what I have
```
this.state = { array: ['a', 'b', 'c'] };
onBack() {
this.... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50603368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608821/"
] | Manoj's answer will work, there is another way using the updater function *(funtinal `setState`)* for `setState` (which you can read about [here](https://reactjs.org/docs/react-component.html#setstate "setState"))
```js
onBack() {
this.setState(prevState => {
let newArray = prevState.array
newArray[2] = "som... | ***Create a temporary array update that, then assign the whole array back to the state***
```
var arr = [];
arr = this.state.array;
arr[2] = "something";
this.setState({
array : arr
});
``` |
50,603,368 | Trying to update one element of an array in this.state I'm getting an (expected ,) error but cant see where I've gone wrong. Do I need to create a temporary array update that, then assign the whole array back to the state
This is essentially what I have
```
this.state = { array: ['a', 'b', 'c'] };
onBack() {
this.... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50603368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608821/"
] | Manoj's answer will work, there is another way using the updater function *(funtinal `setState`)* for `setState` (which you can read about [here](https://reactjs.org/docs/react-component.html#setstate "setState"))
```js
onBack() {
this.setState(prevState => {
let newArray = prevState.array
newArray[2] = "som... | Use [Object.assign({});](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
```
let array= Object.assign({}, this.state.array); //creating copy of object
array[2]="something"
this.setState({array});
``` |
50,603,368 | Trying to update one element of an array in this.state I'm getting an (expected ,) error but cant see where I've gone wrong. Do I need to create a temporary array update that, then assign the whole array back to the state
This is essentially what I have
```
this.state = { array: ['a', 'b', 'c'] };
onBack() {
this.... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50603368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608821/"
] | You can't update the state like this.
>
> Never mutate this.state directly, as calling setState() afterwards may replace the mutation you made. Treat this.state as if it were immutable.
>
>
>
Read [React docs](https://reactjs.org/docs/react-component.html#state).
You can do something like this :
```
let newArra... | Use [Object.assign({});](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
```
let array= Object.assign({}, this.state.array); //creating copy of object
array[2]="something"
this.setState({array});
``` |
50,603,368 | Trying to update one element of an array in this.state I'm getting an (expected ,) error but cant see where I've gone wrong. Do I need to create a temporary array update that, then assign the whole array back to the state
This is essentially what I have
```
this.state = { array: ['a', 'b', 'c'] };
onBack() {
this.... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50603368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608821/"
] | You can't update the state like this.
>
> Never mutate this.state directly, as calling setState() afterwards may replace the mutation you made. Treat this.state as if it were immutable.
>
>
>
Read [React docs](https://reactjs.org/docs/react-component.html#state).
You can do something like this :
```
let newArra... | Manoj's answer will work, there is another way using the updater function *(funtinal `setState`)* for `setState` (which you can read about [here](https://reactjs.org/docs/react-component.html#setstate "setState"))
```js
onBack() {
this.setState(prevState => {
let newArray = prevState.array
newArray[2] = "som... |
50,603,368 | Trying to update one element of an array in this.state I'm getting an (expected ,) error but cant see where I've gone wrong. Do I need to create a temporary array update that, then assign the whole array back to the state
This is essentially what I have
```
this.state = { array: ['a', 'b', 'c'] };
onBack() {
this.... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50603368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608821/"
] | You can't update the state like this.
>
> Never mutate this.state directly, as calling setState() afterwards may replace the mutation you made. Treat this.state as if it were immutable.
>
>
>
Read [React docs](https://reactjs.org/docs/react-component.html#state).
You can do something like this :
```
let newArra... | using hooks
===========
```
const [totalSet, setTotalSet] = useState(null);
```
console.log(totalSet); // {sets: Array(3), subscribed: false}
```
setTotalSet(datas => ({
...datas,
sets: updatedSet,
}));
``` |
50,603,368 | Trying to update one element of an array in this.state I'm getting an (expected ,) error but cant see where I've gone wrong. Do I need to create a temporary array update that, then assign the whole array back to the state
This is essentially what I have
```
this.state = { array: ['a', 'b', 'c'] };
onBack() {
this.... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50603368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608821/"
] | If you are bother to set the new updated array on your `currentArray` using spread function, you may use `Array.from(duplicateArray)`
```
let duplicateArray = [...currentArray] //duplicate the array into new array
duplicateArray[index].value = 'x'; // update the field you want to update
setCurrentArray(Array.from(dupl... | ***Create a temporary array update that, then assign the whole array back to the state***
```
var arr = [];
arr = this.state.array;
arr[2] = "something";
this.setState({
array : arr
});
``` |
50,603,368 | Trying to update one element of an array in this.state I'm getting an (expected ,) error but cant see where I've gone wrong. Do I need to create a temporary array update that, then assign the whole array back to the state
This is essentially what I have
```
this.state = { array: ['a', 'b', 'c'] };
onBack() {
this.... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50603368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608821/"
] | using hooks
===========
```
const [totalSet, setTotalSet] = useState(null);
```
console.log(totalSet); // {sets: Array(3), subscribed: false}
```
setTotalSet(datas => ({
...datas,
sets: updatedSet,
}));
``` | ***Create a temporary array update that, then assign the whole array back to the state***
```
var arr = [];
arr = this.state.array;
arr[2] = "something";
this.setState({
array : arr
});
``` |
50,603,368 | Trying to update one element of an array in this.state I'm getting an (expected ,) error but cant see where I've gone wrong. Do I need to create a temporary array update that, then assign the whole array back to the state
This is essentially what I have
```
this.state = { array: ['a', 'b', 'c'] };
onBack() {
this.... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50603368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608821/"
] | You can't update the state like this.
>
> Never mutate this.state directly, as calling setState() afterwards may replace the mutation you made. Treat this.state as if it were immutable.
>
>
>
Read [React docs](https://reactjs.org/docs/react-component.html#state).
You can do something like this :
```
let newArra... | ***Create a temporary array update that, then assign the whole array back to the state***
```
var arr = [];
arr = this.state.array;
arr[2] = "something";
this.setState({
array : arr
});
``` |
50,603,368 | Trying to update one element of an array in this.state I'm getting an (expected ,) error but cant see where I've gone wrong. Do I need to create a temporary array update that, then assign the whole array back to the state
This is essentially what I have
```
this.state = { array: ['a', 'b', 'c'] };
onBack() {
this.... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50603368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608821/"
] | Manoj's answer will work, there is another way using the updater function *(funtinal `setState`)* for `setState` (which you can read about [here](https://reactjs.org/docs/react-component.html#setstate "setState"))
```js
onBack() {
this.setState(prevState => {
let newArray = prevState.array
newArray[2] = "som... | If you are bother to set the new updated array on your `currentArray` using spread function, you may use `Array.from(duplicateArray)`
```
let duplicateArray = [...currentArray] //duplicate the array into new array
duplicateArray[index].value = 'x'; // update the field you want to update
setCurrentArray(Array.from(dupl... |
18,410,997 | I have two to three variables that I want to mix into strings and then place them all into a table, however I can't figure out how to make the variables mix.
What I have is
```
document.write('<table cellspacing="0" cellpadding="5">')
var a = ["String1", "String2"]
var n = ["string3", "String4"]
for(var i=0; i... | 2013/08/23 | [
"https://Stackoverflow.com/questions/18410997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2014858/"
] | You need an additional loop -
```
for(var i = 0; i < a.length; i++) {
for (var j = 0; j < b.length; j++) {
document.write('<tr'>);
document.write('<td>' + a[i] + b[j] + '</td>');
document.write('</td>');
}
}
```
P.S.: Do you really need to create elements using `document.write`? It's... | ```
document.write('<table cellspacing="0" cellpadding="5">');
var a = ["String1", "String2"];
var b = ["string3", "String4"];
for(var i=0; i <b.length; i++){
for (var j=0;j<a.length;j++){
document.write('<tr>');
document.write('<td>' + (a[i]) + (b[j]) +'</td>');
document.write('</td>');
... |
18,410,997 | I have two to three variables that I want to mix into strings and then place them all into a table, however I can't figure out how to make the variables mix.
What I have is
```
document.write('<table cellspacing="0" cellpadding="5">')
var a = ["String1", "String2"]
var n = ["string3", "String4"]
for(var i=0; i... | 2013/08/23 | [
"https://Stackoverflow.com/questions/18410997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2014858/"
] | You need an additional loop -
```
for(var i = 0; i < a.length; i++) {
for (var j = 0; j < b.length; j++) {
document.write('<tr'>);
document.write('<td>' + a[i] + b[j] + '</td>');
document.write('</td>');
}
}
```
P.S.: Do you really need to create elements using `document.write`? It's... | ```
document.write('<table cellspacing="0" cellpadding="5">');
var a = ["String1", "String2"];
var n = ["String3", "String4"];
for (var i = 0; i < a.length; i++)
{
for (var j = 0; j < n.length; j++)
{
document.write("<tr>");
document.write("<td>" + a[i] + "</td><td>" + n[j] + "</td>");
... |
18,410,997 | I have two to three variables that I want to mix into strings and then place them all into a table, however I can't figure out how to make the variables mix.
What I have is
```
document.write('<table cellspacing="0" cellpadding="5">')
var a = ["String1", "String2"]
var n = ["string3", "String4"]
for(var i=0; i... | 2013/08/23 | [
"https://Stackoverflow.com/questions/18410997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2014858/"
] | You need an additional loop -
```
for(var i = 0; i < a.length; i++) {
for (var j = 0; j < b.length; j++) {
document.write('<tr'>);
document.write('<td>' + a[i] + b[j] + '</td>');
document.write('</td>');
}
}
```
P.S.: Do you really need to create elements using `document.write`? It's... | Here's a working solution after fixing a lot of syntax errors:
```
document.write('<table cellspacing="0" cellpadding="5">')
var a = ["String1", "String2"]
var n = ["string3", "String4"]
for(var i=0; i<a.length; i++){
for (x=0;x<n.length;x++) {
document.write('<tr>')
document.write('<td>' + (a[i]) + (n[x])... |
22,651,117 | I am using captcha and I want to create a captcha using the cpatcha helper!I read the user guide and write a piece of code,but it fails to create an captcha,also here is no error displayed on the page,so I just can't find where I am wrong,my code is as follows:
```
public function captcha(){
$this->load->helpe... | 2014/03/26 | [
"https://Stackoverflow.com/questions/22651117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3392958/"
] | It looks like derby locking issue. you can temporarily fix this issue by deleting the lock file inside the directory `/var/lib/hive/metastore/metastore_db`. But this issue will also occur in future also
`sudo rm -rf /var/lib/hive/metastore/metastore_db/*.lck`
With default hive metastore embedded derby, it is not poss... | update `hive-site.xml` under `~/hive/conf` folder as below name/value and try this:
```
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=/var/lib/hive/metastore/metastore_db;create=true</value>
``` |
22,651,117 | I am using captcha and I want to create a captcha using the cpatcha helper!I read the user guide and write a piece of code,but it fails to create an captcha,also here is no error displayed on the page,so I just can't find where I am wrong,my code is as follows:
```
public function captcha(){
$this->load->helpe... | 2014/03/26 | [
"https://Stackoverflow.com/questions/22651117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3392958/"
] | It looks like derby locking issue. you can temporarily fix this issue by deleting the lock file inside the directory `/var/lib/hive/metastore/metastore_db`. But this issue will also occur in future also
`sudo rm -rf /var/lib/hive/metastore/metastore_db/*.lck`
With default hive metastore embedded derby, it is not poss... | I've encountered similar error when I forgot about another instance of `spark-shell` running on same node. |
22,651,117 | I am using captcha and I want to create a captcha using the cpatcha helper!I read the user guide and write a piece of code,but it fails to create an captcha,also here is no error displayed on the page,so I just can't find where I am wrong,my code is as follows:
```
public function captcha(){
$this->load->helpe... | 2014/03/26 | [
"https://Stackoverflow.com/questions/22651117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3392958/"
] | It looks like derby locking issue. you can temporarily fix this issue by deleting the lock file inside the directory `/var/lib/hive/metastore/metastore_db`. But this issue will also occur in future also
`sudo rm -rf /var/lib/hive/metastore/metastore_db/*.lck`
With default hive metastore embedded derby, it is not poss... | In my case I needed to create a directory and grant proper permissions:
```
$ sudo mkdir /var/lib/hive/metastore/
$ sudo chown hdfs:hdfs /var/lib/hive/metastore/
``` |
22,651,117 | I am using captcha and I want to create a captcha using the cpatcha helper!I read the user guide and write a piece of code,but it fails to create an captcha,also here is no error displayed on the page,so I just can't find where I am wrong,my code is as follows:
```
public function captcha(){
$this->load->helpe... | 2014/03/26 | [
"https://Stackoverflow.com/questions/22651117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3392958/"
] | I've encountered similar error when I forgot about another instance of `spark-shell` running on same node. | update `hive-site.xml` under `~/hive/conf` folder as below name/value and try this:
```
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=/var/lib/hive/metastore/metastore_db;create=true</value>
``` |
22,651,117 | I am using captcha and I want to create a captcha using the cpatcha helper!I read the user guide and write a piece of code,but it fails to create an captcha,also here is no error displayed on the page,so I just can't find where I am wrong,my code is as follows:
```
public function captcha(){
$this->load->helpe... | 2014/03/26 | [
"https://Stackoverflow.com/questions/22651117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3392958/"
] | update `hive-site.xml` under `~/hive/conf` folder as below name/value and try this:
```
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=/var/lib/hive/metastore/metastore_db;create=true</value>
``` | In my case I needed to create a directory and grant proper permissions:
```
$ sudo mkdir /var/lib/hive/metastore/
$ sudo chown hdfs:hdfs /var/lib/hive/metastore/
``` |
22,651,117 | I am using captcha and I want to create a captcha using the cpatcha helper!I read the user guide and write a piece of code,but it fails to create an captcha,also here is no error displayed on the page,so I just can't find where I am wrong,my code is as follows:
```
public function captcha(){
$this->load->helpe... | 2014/03/26 | [
"https://Stackoverflow.com/questions/22651117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3392958/"
] | I've encountered similar error when I forgot about another instance of `spark-shell` running on same node. | In my case I needed to create a directory and grant proper permissions:
```
$ sudo mkdir /var/lib/hive/metastore/
$ sudo chown hdfs:hdfs /var/lib/hive/metastore/
``` |
146,490 | Is there a simple way to select only one radio button with the `<apex:selectRadio>` component? I searched for examples and found two posts on this topic that did not resolve the issue I'm having. I might be missing something simple. | 2016/10/30 | [
"https://salesforce.stackexchange.com/questions/146490",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/7528/"
] | The reason you are having this issue is because it is not one Radio button. It is a list of radio buttons. While in each one you can only select one options. For every one you can choose one.
I don't think there is a very quick fix for this one. Either, you give up using apex repeat in this case and put all the oppor... | There's no way to have it work the way you expect; each iteration in your apex:repeat creates a new radio group, which is why you can select all of the radios. They're simply not one logical group. To get a better idea of how apex:selectRadio is supposed to work, check out this trivial page:
```
<apex:page>
<apex:fo... |
25,496,692 | I'm trying to open multiple windows with JavaFX, I have an eventlistener that opens a new window when a button is clicked it looks like this:
```
@FXML
private void joinAction() {
Parent root;
try {
Stage stage = (Stage) joinButton.getScene().getWindow();
stage.close();
root = FXMLLoad... | 2014/08/26 | [
"https://Stackoverflow.com/questions/25496692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2292723/"
] | The recommended approach is to define a controller for each FXML. Since controllers are very lightweight this shouldn't add much overhead. The controller for your main.fxml file might be as simple as
```
import javafx.fxml.FXML ;
public class MainController {
@FXML
private void sendChat() {
// ...
}
}
```
... | You need to add top level element fx:controller. Look at this answer:<https://stackoverflow.com/a/41316536/4247308> |
25,496,692 | I'm trying to open multiple windows with JavaFX, I have an eventlistener that opens a new window when a button is clicked it looks like this:
```
@FXML
private void joinAction() {
Parent root;
try {
Stage stage = (Stage) joinButton.getScene().getWindow();
stage.close();
root = FXMLLoad... | 2014/08/26 | [
"https://Stackoverflow.com/questions/25496692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2292723/"
] | The recommended approach is to define a controller for each FXML. Since controllers are very lightweight this shouldn't add much overhead. The controller for your main.fxml file might be as simple as
```
import javafx.fxml.FXML ;
public class MainController {
@FXML
private void sendChat() {
// ...
}
}
```
... | I create Borderpane, and inside it vbox at left and scene at the center and also implement initializable . Every time i click diff button in vbox, it changes only scene. For every scene, i create scene.fxml file. |
62,521,767 | I have variable from an HTML form that are currently being posted to one table in my database table.
I would like to post those same variables to other tables at the same time within the same function. Is this possible? Here is my current PHP function that is posting successfully to one table
```
<?php
$var1 = $_... | 2020/06/22 | [
"https://Stackoverflow.com/questions/62521767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13794315/"
] | Yes, it is possible. You can do what you are doing now, but you need to call `execute()` method after preparing each query. Apart from this, it would also be a good idea to wrap this in a transaction. Transactions help you make you sure that either all or none operations are successful. If one of them fails the others ... | Try to call $stmt->execute(); after every calling of $stmt->bind\_param();
Take a look at this solved problem for executing multiple queries at the same call.
[PDO support for multiple queries (PDO\_MYSQL, PDO\_MYSQLND)](https://stackoverflow.com/questions/6346674/pdo-support-for-multiple-queries-pdo-mysql-pdo-mysqlnd... |
11,088,343 | Let's say I have a table with 1M rows and I need to add an index on it. What would be the process of doing so? Am I able to do `ALTER TABLE table ADD INDEX column (column)` directly on production? Or do I need to take other things into account to add the index.
How does one normally go about adding an index on a live... | 2012/06/18 | [
"https://Stackoverflow.com/questions/11088343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/651174/"
] | First, get the `GtkTextBuffer` from the `GtkTextView` using `gtk_text_view_get_buffer()`. Then get the start and end *GtkTextIters* from the buffer to use to get the text of the buffer. Finally, write that text to the file using the API of your choice, however, I would recommend `Gio`. Here's a snippet from my old tuto... | ```
void on_toolbutton3_clicked(GtkToolButton *toolbutton, gpointer data)
{
GtkWidget *dialog;
dialog = gtk_file_chooser_dialog_new ("Abspeichern...",
NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
... |
852,814 | I'm trying to set up a VM network using vmbuilder. When setting it up using Ubuntu 12.04 there are no problems. However, when trying any of the newer LTS (14.04 or 16.04) i get the following error when I try to build my KVM:
```
Configuration file '/etc/sudoers'
==> Modified (by you or by a script) since installation.... | 2016/11/23 | [
"https://askubuntu.com/questions/852814",
"https://askubuntu.com",
"https://askubuntu.com/users/622692/"
] | I have exactly the same bug, on several fresh 1604 installations. I don't know why this doesn't get fixed, because it would come up if they ever tested this package.
The solution I found from another post is:
1. change the word 'dist-upgrade' to 'update' in
/usr/lib/python2.7/dist-packages/VMBuilder/plugins/ubuntu/d... | From launchpad discussion:
>
> can you find in file /usr/lib/python2.7/dist-packages/VMBuilder/plugins/ubuntu/dapper.py
> next string:
>
>
> self.run\_in\_target('apt-get', '-y', '--force-yes', 'dist-upgrade',
>
>
> and replace with:
>
>
> self.run\_in\_target('apt-get', '-y', '--force-yes',
> '--option=Dpkg:... |
852,814 | I'm trying to set up a VM network using vmbuilder. When setting it up using Ubuntu 12.04 there are no problems. However, when trying any of the newer LTS (14.04 or 16.04) i get the following error when I try to build my KVM:
```
Configuration file '/etc/sudoers'
==> Modified (by you or by a script) since installation.... | 2016/11/23 | [
"https://askubuntu.com/questions/852814",
"https://askubuntu.com",
"https://askubuntu.com/users/622692/"
] | I have exactly the same bug, on several fresh 1604 installations. I don't know why this doesn't get fixed, because it would come up if they ever tested this package.
The solution I found from another post is:
1. change the word 'dist-upgrade' to 'update' in
/usr/lib/python2.7/dist-packages/VMBuilder/plugins/ubuntu/d... | Note that there is a slightly better maintained community fork of python-vm-builder at <https://github.com/newroco/vmbuilder>.
Instead of using the system package, you install it with `sudo python setup.py install` |
852,814 | I'm trying to set up a VM network using vmbuilder. When setting it up using Ubuntu 12.04 there are no problems. However, when trying any of the newer LTS (14.04 or 16.04) i get the following error when I try to build my KVM:
```
Configuration file '/etc/sudoers'
==> Modified (by you or by a script) since installation.... | 2016/11/23 | [
"https://askubuntu.com/questions/852814",
"https://askubuntu.com",
"https://askubuntu.com/users/622692/"
] | Note that there is a slightly better maintained community fork of python-vm-builder at <https://github.com/newroco/vmbuilder>.
Instead of using the system package, you install it with `sudo python setup.py install` | From launchpad discussion:
>
> can you find in file /usr/lib/python2.7/dist-packages/VMBuilder/plugins/ubuntu/dapper.py
> next string:
>
>
> self.run\_in\_target('apt-get', '-y', '--force-yes', 'dist-upgrade',
>
>
> and replace with:
>
>
> self.run\_in\_target('apt-get', '-y', '--force-yes',
> '--option=Dpkg:... |
461,545 | Какой вариант верный? Спасибо!
1. Слишком быстро они отнимают у маленького, едва покрытого перьями тельца, драгоценное тепло.
2. Слишком быстро они отнимают у маленького, едва покрытого перьями тельца драгоценное тепло. | 2020/07/24 | [
"https://rus.stackexchange.com/questions/461545",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/192143/"
] | **О качестве ответа**
Как я себе представляю хороший ответ?
С одной стороны, мы отвечаем **конкретному**, а не абстрактному автору, поэтому желательно понять ход его мыслей.
С другой стороны, информационная часть ответа должна иметь **безотносительную ценность**, так как по большому счету каждый ответ влияет на каче... | ***Слишком быстро они отнимают у маленького, едва покрытого перьями тельца драгоценное тепло***.
Конечно, второй вариант корректный — запятая после слова *тельце* не нужна.
Наверное, если у вас возник такой вопрос, то вы не очень разобрались со структурой предложения, я поясню:
*Они отнимают* (Что?) *тепло* (У кого?... |
56,223 | I've noticed from titles of songs and poems, a definite article is used such as:
>
> 'An die Hoffnung'
>
> 'An die Freude'
>
> 'An die Musik'
>
>
>
A few websites give examples of the use of definite articles before nouns like
>
> 'Der Winter kommt'
>
>
>
rather than
>
> 'Winter kommt'
>
>
... | 2020/01/30 | [
"https://german.stackexchange.com/questions/56223",
"https://german.stackexchange.com",
"https://german.stackexchange.com/users/41488/"
] | German word order is not as strict as English word order. You may place subjects and objects as you like. The case markers tell the reader if a noun is a subject or an object, and which type of object.
German has no case markers on nouns apart from some exceptions (genitive singular and dative plural of some declinati... | See section 3 of this link for where the definite article is used in German (but not in English)
<https://www.google.co.uk/amp/s/grammar.collinsdictionary.com/amp/german-easy-learning/articles> |
26,153 | I have a Channel Form set up which is working fine and inserting entries into a Channel with the default status.
Now there is a requirement to allow the status to be changed when creating the entry via the Channel Form but for the life of me I can't get it to work.
I have tried using the Channel Form {status} tags an... | 2014/10/10 | [
"https://expressionengine.stackexchange.com/questions/26153",
"https://expressionengine.stackexchange.com",
"https://expressionengine.stackexchange.com/users/159/"
] | I've encountered exactly the same problem with 2.10.1. No matter what I set the status to, it always writes as 'Open'. I'm sure I've got the proper group assigned and title-casing for 'Pending'... I can only conclude it's a system bug. | Silly question, but you're sure the custom status group is assigned to that channel, right?
Have you tried {status\_menu} ?
<https://ellislab.com/expressionengine/user-guide/add-ons/channel/channel_form/#status>
Although the second code you tried looks like it should work. |
26,153 | I have a Channel Form set up which is working fine and inserting entries into a Channel with the default status.
Now there is a requirement to allow the status to be changed when creating the entry via the Channel Form but for the life of me I can't get it to work.
I have tried using the Channel Form {status} tags an... | 2014/10/10 | [
"https://expressionengine.stackexchange.com/questions/26153",
"https://expressionengine.stackexchange.com",
"https://expressionengine.stackexchange.com/users/159/"
] | I've encountered exactly the same problem with 2.10.1. No matter what I set the status to, it always writes as 'Open'. I'm sure I've got the proper group assigned and title-casing for 'Pending'... I can only conclude it's a system bug. | i've this hardcoded checkbox tag working, didn't did anything special, try this..
```
<label for="open"><input name="status" type="radio" value="open" id="open" {if "{status}" == 'open'}Checked{/if}> <strong>Public</strong> </label>
<label for="draft"><input name="status" type="radio" value="draft" id="draft" {if "{st... |
26,153 | I have a Channel Form set up which is working fine and inserting entries into a Channel with the default status.
Now there is a requirement to allow the status to be changed when creating the entry via the Channel Form but for the life of me I can't get it to work.
I have tried using the Channel Form {status} tags an... | 2014/10/10 | [
"https://expressionengine.stackexchange.com/questions/26153",
"https://expressionengine.stackexchange.com",
"https://expressionengine.stackexchange.com/users/159/"
] | I've encountered exactly the same problem with 2.10.1. No matter what I set the status to, it always writes as 'Open'. I'm sure I've got the proper group assigned and title-casing for 'Pending'... I can only conclude it's a system bug. | i assume from your hard coded example you've set up the Status group with those entries? status is validated against the status group...
As Marc Miller illudes to, have you linked your custom status group to the channel you are posting in (Admin -> Channel Administration -> Channels -> Edit Group Assignments (on the d... |
23,654 | My neighbor who lives across the hall from me in my apartment building is clearly trying to extend an olive branch of friendship. We met at a community gathering for residents a little over a month ago and got along splendidly, but due to opposing work schedules we have not seen each other since. I gather he has some s... | 2019/12/04 | [
"https://interpersonal.stackexchange.com/questions/23654",
"https://interpersonal.stackexchange.com",
"https://interpersonal.stackexchange.com/users/284/"
] | Honesty is the best policy here. He's only going to feel like you're "blowing him off" if your refusals are without reason. If you think more offers are forthcoming, your next response should be something like:
>
> Yes!
>
>
>
Or, if you can't, then:
>
> I'm sorry I keep turning down your invites, I really want ... | **My answers to you questions**
I am one of those people readily sending invitations to new acquaintances until I am tired of getting only "No, no" 's. I made a rule out of it: You're out at three no's in a row. You know too well why:
>
> I make him think that I'm blowing him off.
>
>
>
I have a second rule thou... |
63,983,714 | What would a piece of code look like which checks today's date, and if it's a particular date, it will print out a message?
The context is that I'm making a birthday cake for my son who codes and I want to write a themed Happy Birthday message on top correctly. (Sorry, not as clever or serious as a lot of the things o... | 2020/09/20 | [
"https://Stackoverflow.com/questions/63983714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14311302/"
] | ```
# Import datetime class from datetime module
from datetime import datetime
birthday = "20/09/1998"
# Parses the string into a datetime object
birthday_obj = datetime.strptime(birthday, '%d/%m/%Y')
# Gets todays date
now = datetime.now()
# Checks the day and month to verify birthday status
if(birthday_obj.day ==... | For your purpose, it might be easier to use regular expressions if you are familiar with them. You can search any patterns you like, after converting datetimes to string, or better yet if you already have datetimes in string formats.
For datetime to string format conversion codes, check out -
[format-codes](https://do... |
4,200,359 | I want to “rank” [primitive] Pythagorean triples by some metric that could reasonably be referred to as “size”.
Naturally, there are a huge number of options: size of hypotenuse, size of smallest leg, perimeter, area, radius of incircle, etc. etc. etc. (Note: One thing I *don’t* want to use is the row index from the t... | 2021/07/16 | [
"https://math.stackexchange.com/questions/4200359",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/93271/"
] | Given that side-A is odd, side-B is even, and side-C is odd, they take the form of $A = (2x+1), B=4y, C=4z+1), x,y,z\in\mathbb{N}.\quad$ Finding them is a relatively easy but pick any of the three and the solution seems incomplete without the other two. Also, side-A is larger than side-B for half of all triples. (I can... | Concerning the so-called sign issue with the ternary tree:
The Wikipedia essay cited elsewhere on this page gives the three matrices $$A=\pmatrix{1&-2&2\cr2&-1&2\cr2&-2&3\cr},\qquad B=\pmatrix{1&2&2\cr2&1&2\cr2&2&3\cr},\qquad C=\pmatrix{-1&2&2\cr-2&1&2\cr-2&2&3\cr}$$ with the properties that 1) if $v$ is a (positive) ... |
4,200,359 | I want to “rank” [primitive] Pythagorean triples by some metric that could reasonably be referred to as “size”.
Naturally, there are a huge number of options: size of hypotenuse, size of smallest leg, perimeter, area, radius of incircle, etc. etc. etc. (Note: One thing I *don’t* want to use is the row index from the t... | 2021/07/16 | [
"https://math.stackexchange.com/questions/4200359",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/93271/"
] | In all the series I searched, I could not find anything suggesting that any $A\times B\times C$ product represents more than one Pythagorean triple. [Here](https://oeis.org/A063011) are primitive triple product values.
$$P=(m^2-k^2)(2mk)(m^2+k^2) =2 m^5k - 2 mk^5\implies 2mk^5- 2 m^5k + P=0$$
One method of finding th... | Concerning the so-called sign issue with the ternary tree:
The Wikipedia essay cited elsewhere on this page gives the three matrices $$A=\pmatrix{1&-2&2\cr2&-1&2\cr2&-2&3\cr},\qquad B=\pmatrix{1&2&2\cr2&1&2\cr2&2&3\cr},\qquad C=\pmatrix{-1&2&2\cr-2&1&2\cr-2&2&3\cr}$$ with the properties that 1) if $v$ is a (positive) ... |
4,200,359 | I want to “rank” [primitive] Pythagorean triples by some metric that could reasonably be referred to as “size”.
Naturally, there are a huge number of options: size of hypotenuse, size of smallest leg, perimeter, area, radius of incircle, etc. etc. etc. (Note: One thing I *don’t* want to use is the row index from the t... | 2021/07/16 | [
"https://math.stackexchange.com/questions/4200359",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/93271/"
] | Too big for a comment.
In 2009, I arranged the smallest primitives in a pattern where the same values of $C-B$ were all in the same respective rows. All were odd squares $(2n-1)^2$ and each A-value increment was $(2n-1)$.
It was then easy develop a new formula $F(n,k)$ and, later, to see that it was the same as Eucli... | Concerning the so-called sign issue with the ternary tree:
The Wikipedia essay cited elsewhere on this page gives the three matrices $$A=\pmatrix{1&-2&2\cr2&-1&2\cr2&-2&3\cr},\qquad B=\pmatrix{1&2&2\cr2&1&2\cr2&2&3\cr},\qquad C=\pmatrix{-1&2&2\cr-2&1&2\cr-2&2&3\cr}$$ with the properties that 1) if $v$ is a (positive) ... |
59,608,312 | I am trying to set up the workspace for creating mods for Minecraft. I installed JRE, installed JDK 8. I installed eclipse. I downloaded the latest mdk file of minecraft forge. I setup the environment variables for JDK. I extracted the forge zip file. I opened powershell in the extracted forge folder. I ran the command... | 2020/01/06 | [
"https://Stackoverflow.com/questions/59608312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10551333/"
] | I think the gradle version you are using is too high.Youre currently using gradle 5.0 and you should try to use gradle 4.9. | The solution that worked for me is simple instead of `gradlew setupDecompWorkspace`, use `gradlew eclipse`. For those of you who found this as a result on google, it won't with Intellij. |
59,608,312 | I am trying to set up the workspace for creating mods for Minecraft. I installed JRE, installed JDK 8. I installed eclipse. I downloaded the latest mdk file of minecraft forge. I setup the environment variables for JDK. I extracted the forge zip file. I opened powershell in the extracted forge folder. I ran the command... | 2020/01/06 | [
"https://Stackoverflow.com/questions/59608312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10551333/"
] | Replacing every instance of "http://files.minecraftforge.net/maven" with "https://libraries.minecraft.net" in build.gradle fixed it for me. | The solution that worked for me is simple instead of `gradlew setupDecompWorkspace`, use `gradlew eclipse`. For those of you who found this as a result on google, it won't with Intellij. |
55,665,395 | I am supposed to solve Problem 25 from Projecteuler. Below is my code, I have no clue, why it is not working.
Can anyone help me?
```
n <- 0
a <- 1
b <- 1
c <- 0
while (nchar(a)<1000)
n <- n+1
c <- b
b <- a
a <- a + c
```
Thanks | 2019/04/13 | [
"https://Stackoverflow.com/questions/55665395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10432814/"
] | Generation of non-repeatable numbers is not an easy task compared to a simple shuffling the array or a collection using [`Collections::shuffle`](https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#shuffle-java.util.List-).
```
final String[] fruitArray = new String[]{"apple", "orange", "pear", "banana... | You can use Random() object in java.
Below is an example of getting 3 random elements from an ArrayList hope this help you.
```
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class GFG {
// Drive Function
public static void main(String[] args)
{
// create a list ... |
55,665,395 | I am supposed to solve Problem 25 from Projecteuler. Below is my code, I have no clue, why it is not working.
Can anyone help me?
```
n <- 0
a <- 1
b <- 1
c <- 0
while (nchar(a)<1000)
n <- n+1
c <- b
b <- a
a <- a + c
```
Thanks | 2019/04/13 | [
"https://Stackoverflow.com/questions/55665395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10432814/"
] | Generation of non-repeatable numbers is not an easy task compared to a simple shuffling the array or a collection using [`Collections::shuffle`](https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#shuffle-java.util.List-).
```
final String[] fruitArray = new String[]{"apple", "orange", "pear", "banana... | Create an array of random integers and use them as index for the array
```
int[] indexes = new Random().ints(4, 0, fruitsArray.length).toArray();
for (int i = 0; i < indexes.length; i++) {
System.out.println(fruitsArray[i]);
}
``` |
318,005 | When you actually read what's written in the [Help Center](https://meta.stackexchange.com/help/referencing), it strongly implies that only *answers* need to give attribution (see added emphasis):
>
> Plagiarism - posting the work of others with no indication that it is not your own - is frowned on by our community, a... | 2018/11/08 | [
"https://meta.stackexchange.com/questions/318005",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/323179/"
] | This was finally changed, though the help page still lives under the "answering" category. To quote (emphasis added):
>
> Plagiarism - posting the work of others with no indication that it is not your own - is frowned on by our community, and may result in your **content** being down-voted or deleted.
>
>
> If you ... | I can't imagine any possible reason for disallowing plagiarism in answers but not in questions. Whatever the reasons are for not allowing it in the one should apply equally to the other. It doesn't matter where you post something—if it's obvious it's from somebody else, but you haven't provided attribution, then that's... |
14,884,516 | I have a table formatted like the one below, i want to split it up so theres a column for month and year ie. January 2014 then another column for cost. So effectively each row would be split into 12 different rows, but i cant for the life of me figure out how to approach it. Any help would be greatly appreciated
```
... | 2013/02/14 | [
"https://Stackoverflow.com/questions/14884516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1902540/"
] | You should be able to use the [`UNPIVOT`](http://msdn.microsoft.com/en-us/library/ms177410%28v=sql.105%29.aspx) function which converts the data from columns into rows:
```
select itemid,
detail,
type,
cat,
Month,
2014 as Year,
value
from Line14
unpivot
(
value
for Month in (Jan_14, Feb_14, Mar_14, Apr... | build the new table as you describe - then write 12 `insert as select` statements grabbing each month's money value and hardcoding the month value. |
7,328 | I have a very High resolution image in illustrator, which leads to a very heavy eps file size, I'm asking for a batch tool or a script to compress the eps image , in other words reduce its resolution without affecting the width and height of the image.I don't want to export the image as a separated Jpg file | 2012/05/08 | [
"https://graphicdesign.stackexchange.com/questions/7328",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/4501/"
] | Object > Rasterize and choose a lower resolution setting.
This will embed any linked image, however. | What if you exported the files as PDFs? As part of the process, you can change the resolution of all images in the document. They're scaled so that the positioning is kept in tact.
From there, you could resave as EPS, if required (although I can't think of many situations where a EPS would be required over a PDF?).
H... |
7,328 | I have a very High resolution image in illustrator, which leads to a very heavy eps file size, I'm asking for a batch tool or a script to compress the eps image , in other words reduce its resolution without affecting the width and height of the image.I don't want to export the image as a separated Jpg file | 2012/05/08 | [
"https://graphicdesign.stackexchange.com/questions/7328",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/4501/"
] | Object > Rasterize and choose a lower resolution setting.
This will embed any linked image, however. | Built into Bridge is a handy script called "Image Processor" (`Tools > Photoshop > Image Processor...`). This allows you to select a bunch of images and run them through Photoshop to save PSD, JPEG or PNG copies. You can specify the maximum size (horizontal and vertical) in the dialog.
For even more sophistication and... |
24,408,248 | Recently I downloaded qemu, and ran configure, make and make install.
when I run
```
qemu-system-sparc linux-0.2.img
```
I just see a message below
>
> VNC server running on `::1:5900'
>
>
>
At this state, when I open vncviewer window by typing `vncviewer :5900`, then I see the window.
The window shows th... | 2014/06/25 | [
"https://Stackoverflow.com/questions/24408248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1511337/"
] | I solved this problem by installing sdl-devel to my CentOS.
I reran ./configure --target-list=sparc-softmmu --enable-sdl
and did make, make install
and the problem is gone! | first
according to what @Chan Kim said, but there is nothing about `qemu-system-i386` and `qemu-system-x86_64` in `qemu/bin`.
then
run `./configure --prefix=/data/local/qemu --target-list=i386-softmmu,arm-softmmu,x86_64-softmmu --disable-vnc --enable-sdl`, then I find all about qemu-system. |
46,877 | I'm trying to enable my polystrips addon but I receive this error every time I try to check the enable addon box.[](https://i.stack.imgur.com/04VOC.png) | 2016/02/13 | [
"https://blender.stackexchange.com/questions/46877",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/21819/"
] | It appears you need to grab the code from here <https://github.com/CGCookie/retopology-lib> and put the source files (ie `__init__.py, common_utilities.py, common_drawing.py, common_classes.py`) into the empty retopology-polystrips-master/lib folder | Most commonly, these kinds of errors have been solved by disabling any old versions of the addon, deleting them from your addons directory, re-installing the addon, saving user preferences and re-starting blender.
best,
Patrick |
336,692 | I'm having a lot of trouble to find lore.
I exhausted the bookstore, the auction, Mansur until the Stag door and the expeditions I could find. Where else can I find lore? | 2018/07/28 | [
"https://gaming.stackexchange.com/questions/336692",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/116230/"
] | This is the way I see to be the quickest path to acquire Lore:
1. Keep buying everything from Morland's Shop. It will keep bringing books to study that will become Lore.
2. When Morland's shop closes, start buying books at Oriflamme's Auction House until it doesn't have any more books to sell. Oriflamme can also be fo... | maybe this will help:
>
> Lore Fragments are a resource that can be obtained from studying some books, and some interactions. They can be upgraded by studying it with a fragment same aspect and level(or, for knock fragments, upgraded with any same level fragment except for secret histories). All fragments(except Secr... |
9,561,093 | I have an XML column with this value
```
<sso_links>
<linktype>mytype</linktype>
<url>http://mydomain.com</url>
<linktype>mytype2</linktype>
<url>http://somedomain.com</url>
</sso_links>
```
I've tried using SQL to query this by value but this only returns scalar type
```
SELECT XMLCOLUMN.value('//linkt... | 2012/03/05 | [
"https://Stackoverflow.com/questions/9561093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1248945/"
] | Oftentimes such patterns are evaluated in order, with the first prefix matching being the one chosen.
Try moving your most general regex to the end:
```
application = webapp.WSGIApplication([
('/(\w+)',MainMain)],
('/', MainMain),
debug=True)
``` | ```
>>> url = 'http://example.appspot.com/abc%20asd'
>>> import urllib
>>> import urlparse
>>> urllib.unquote_plus(urlparse.urlparse(url)[2][1:])
'abc asd'
``` |
65,441,773 | Here's the workflow:
Get a https link --> write to filesystem --> read from filesystem --> Get the sha256 hash.
*It works all good on my local machine running node 10.15.3 But when i initiate a lambda function on AWS, the output is null.* Some problem may lie with the readable stream. Here's the code. You can run it ... | 2020/12/24 | [
"https://Stackoverflow.com/questions/65441773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10845323/"
] | I'm not sure why std::map is necessary, but this should do what you want.
```
for (const auto& s : synonyms) {
auto object = s.begin();
if (object->first == word || object->second == word) {
++amount;
}
}
```
Since each element in your set `s` is a map of size 1, you can access its element by usi... | ```
for (const std::map<string, string>& m : synonyms)
{
for (const std::pair<string, string>& p : m)
{
if (p->first == word || p->second == word)
{
++amount;
}
}
}
``` |
20,388,634 | I want to print doubles so that the decimals line up. For example:
```
1.2345
12.3456
```
should result in
```
1.2345
12.3456
```
I have looked everywhere, and the top recommendation is to use the following method (the 5s can be anything):
```
printf(%5.5f\n");
```
I have tried this with the following (very) ... | 2013/12/04 | [
"https://Stackoverflow.com/questions/20388634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/813111/"
] | The number before the `.` is minimum characters *total*, not just before the radix point.
```
printf("%21.10f\n", 0.523431);
``` | When you use `"%10.10f"` you are telling `printf()` "use 10 character positions to print the number (optional minus sign, integer part, decimal point and decimal part). From these 10 positions, reserve 10 for decimal part. If this is not possible, ignore the first number and use whatever positions needed to print the n... |
725,261 | I have a word doc where when you look at the file preview in the Finder window on a mac (osx), it shows the first page and on the upper right corner of the page, theres a Qlikview logo (im guessing Qlikview contributed to the creation of the document). However when you open the document itself, the logo is not there an... | 2014/03/06 | [
"https://superuser.com/questions/725261",
"https://superuser.com",
"https://superuser.com/users/305427/"
] | I found this page after having the same issue. Solution:
Click into your header /footer. Click > Different First Page.
The logo and header will come up from an old source.
Delete it, and then unselect Different First Page.
Problem solved! | This is not proper answer using MS Word, but Works.
Open your Document with LibreOffice.org (I have Cent OS 7 in another machine), You will see the "watermark" select it and delete. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.