qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
794,663 | Is there a built in method in .NET to convert a number to the string representation of the number? For example, 1 becomes one, 2 becomes two, etc. | 2009/04/27 | [
"https://Stackoverflow.com/questions/794663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | Ah, there may not be a class to do this, but there was a code golf question which I provided a C# example for:
[Code Golf: Number to Words](https://stackoverflow.com/questions/309884/code-golf-number-to-words/408776#408776)
However, it's not the easiest to read and it only goes up to decimal.MaxValue, so I've written... | Based on Ryan Emerle's solution, this adds dashes at the correct locations, does not include trailing spaces, does not pluralize numbers, and properly handles an input of zero (0):
```
public static string ToText(long n) {
return _toText(n, true);
}
private static string _toText(long n, bool isFirst = false) {
... |
794,663 | Is there a built in method in .NET to convert a number to the string representation of the number? For example, 1 becomes one, 2 becomes two, etc. | 2009/04/27 | [
"https://Stackoverflow.com/questions/794663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | I've always been a fan of the recursive method
```
public static string NumberToText( int n)
{
if ( n < 0 )
return "Minus " + NumberToText(-n);
else if ( n == 0 )
return "";
else if ( n <= 19 )
return new string[] {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight",
... | Ah, there may not be a class to do this, but there was a code golf question which I provided a C# example for:
[Code Golf: Number to Words](https://stackoverflow.com/questions/309884/code-golf-number-to-words/408776#408776)
However, it's not the easiest to read and it only goes up to decimal.MaxValue, so I've written... |
794,663 | Is there a built in method in .NET to convert a number to the string representation of the number? For example, 1 becomes one, 2 becomes two, etc. | 2009/04/27 | [
"https://Stackoverflow.com/questions/794663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | I've always been a fan of the recursive method
```
public static string NumberToText( int n)
{
if ( n < 0 )
return "Minus " + NumberToText(-n);
else if ( n == 0 )
return "";
else if ( n <= 19 )
return new string[] {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight",
... | There's no built in solution in `.net`, but there are good libraries around. The best currently is definitely [Humanizr](http://humanizr.net/):
```
Console.WriteLine(794663.ToWords()); // => seven hundred and ninety-four thousand six hundred and sixty-three
```
It also supports ordinal, and roman representations:
`... |
794,663 | Is there a built in method in .NET to convert a number to the string representation of the number? For example, 1 becomes one, 2 becomes two, etc. | 2009/04/27 | [
"https://Stackoverflow.com/questions/794663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | ```
public string IntToString(int number)//nobody really uses negative numbers
{
if(number == 0)
return "zero";
else
if(number == 1)
return "one";
.......
else
if(number == 2147483647)
return "two billion one hundred forty seven million fou... | There's no built in solution in `.net`, but there are good libraries around. The best currently is definitely [Humanizr](http://humanizr.net/):
```
Console.WriteLine(794663.ToWords()); // => seven hundred and ninety-four thousand six hundred and sixty-three
```
It also supports ordinal, and roman representations:
`... |
31,535,146 | I'm working with a data frame similar to the extract below:
```
df <- data.frame(A=c("Some messy string to be used",222,0),
B=c("Very important ? indicator from 2001", 888, 44),
C=c("001 This variable / makes no sense", 888, 44),
D=c("Geography", 1, 2))
```
I would... | 2015/07/21 | [
"https://Stackoverflow.com/questions/31535146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1655567/"
] | You don’t need to use `make.names` at all — you can assign the strings *directly*. This works perfectly fine in R. You just need to backtick-quote the names when you try to use them as R names (e.g. after the `$` operator):
```
names(df) = unlist(df[1,])
df$`Some messy string to be used`
``` | use `stringsAsFactors = F` in data.frame which will create columns as char instead of factors. then make names on it.
```
df <- data.frame(A=c("Some messy string to be used",222,0),
B=c("Very important ? indicator from 2001", 888, 44),
C=c("001 This variable / makes no sense", 888, 44),
... |
24,236,367 | Can someone explain the following:
```
In [9]: str( """w'o"w""")
Out[9]: 'w\'o"w'
```
why the double quote has no escape? it does the same thing with or without the escape:
```
In [10]: print ( 'w\'o"w')
w'o"w
In [11]: print ( 'w\'o\"w')
w'o"w
```
And in the following two cases there's no escape:
```
In [... | 2014/06/16 | [
"https://Stackoverflow.com/questions/24236367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2440470/"
] | When the Python console (which includes IPython) shows the value of a string, it does so by printing the `repr()` of the string. `repr()` will produce output that could be parsed by the Python parser, so it will include backslash-escapes when necessary. (And only when necessary). If all the quotes in a string are singl... | When you enclose a string with `single quotes`, you need escape the `single quotes` within the string - otherwise how would the interpreter know if the string is meant to be ended or not?
Conversely, when you are enclosing a string with `double quotes`, you need to escape the `double quotes` within the string.
`"""` ... |
24,236,367 | Can someone explain the following:
```
In [9]: str( """w'o"w""")
Out[9]: 'w\'o"w'
```
why the double quote has no escape? it does the same thing with or without the escape:
```
In [10]: print ( 'w\'o"w')
w'o"w
In [11]: print ( 'w\'o\"w')
w'o"w
```
And in the following two cases there's no escape:
```
In [... | 2014/06/16 | [
"https://Stackoverflow.com/questions/24236367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2440470/"
] | When the Python console (which includes IPython) shows the value of a string, it does so by printing the `repr()` of the string. `repr()` will produce output that could be parsed by the Python parser, so it will include backslash-escapes when necessary. (And only when necessary). If all the quotes in a string are singl... | The only reasonn you have to escape the start/end of string character is so the compiler/interpreter knows that that symbol doesn't mean the start/end of the string scope.
Therefore, If the character is `'`, then `'` becomes a special character, and `"` is not. And vise versa. And if you start it with `'''` or `"""` ... |
14,156,490 | ```
public class ConsoleControl {
private static Viewer mainGUI;
public static Viewer getMainGUI()
{
return mainGUI;
}
public static void main(String[] args){
// Imports the Java UI Manager, which allows you to change the basic GUI of the Application
try {
UIManager.setLookAndFeel("co... | 2013/01/04 | [
"https://Stackoverflow.com/questions/14156490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1396743/"
] | in typescript you can mark items as optional:
```
interface Person {
name: string;
address?: string;
}
```
name is required and address is optional for implementation | If you promise that you implement an interface, you have to implement it all.
One solution would be to have a base class that implements the 40 properties if you only want to deal with 5 properties in B.
```
interface A {
propA: string;
propB: string;
}
class C implements A {
public propA = "";
public ... |
14,156,490 | ```
public class ConsoleControl {
private static Viewer mainGUI;
public static Viewer getMainGUI()
{
return mainGUI;
}
public static void main(String[] args){
// Imports the Java UI Manager, which allows you to change the basic GUI of the Application
try {
UIManager.setLookAndFeel("co... | 2013/01/04 | [
"https://Stackoverflow.com/questions/14156490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1396743/"
] | If you promise that you implement an interface, you have to implement it all.
One solution would be to have a base class that implements the 40 properties if you only want to deal with 5 properties in B.
```
interface A {
propA: string;
propB: string;
}
class C implements A {
public propA = "";
public ... | 40 items in an interface is quite alot.
Also, if you only need 5 for a certain class it indicates a design problem.
An alternative design is to have multiple related interfaces and divide the properties into more logical groups.
```
interface ICar ...
interface IRacingCar : ICar
interface IFlyingCar : ICar
interfa... |
14,156,490 | ```
public class ConsoleControl {
private static Viewer mainGUI;
public static Viewer getMainGUI()
{
return mainGUI;
}
public static void main(String[] args){
// Imports the Java UI Manager, which allows you to change the basic GUI of the Application
try {
UIManager.setLookAndFeel("co... | 2013/01/04 | [
"https://Stackoverflow.com/questions/14156490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1396743/"
] | in typescript you can mark items as optional:
```
interface Person {
name: string;
address?: string;
}
```
name is required and address is optional for implementation | 40 items in an interface is quite alot.
Also, if you only need 5 for a certain class it indicates a design problem.
An alternative design is to have multiple related interfaces and divide the properties into more logical groups.
```
interface ICar ...
interface IRacingCar : ICar
interface IFlyingCar : ICar
interfa... |
60,255,898 | I always thought that computers nowadays are already programmed to directly execute high-level programming, but apparently not. Is there any specific reason why we haven't done that yet? Any cons of high-level programming. | 2020/02/17 | [
"https://Stackoverflow.com/questions/60255898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12909227/"
] | I'm by no means a CS expert, but from my experience dealing with different layers of a computer system, layers of abstraction are very important to enable a collaborative development environment. For instance, when you want to implement a neural network, would you prefer implement everything manually, or use an existin... | *This calls for speculation and over simplification, so that is what I will do*
What you describe is an interpreted language, and the question is why are we not running hardware interpreters?
The rational is simply it is more **cost efficient** (both calculated in both silcon area and in Watt / useful work) to make a... |
75,590 | When I am putting a WordPress value inside the attribute tag, for example, the following method does not need `esc_attr`
e.g.
```
// JS code
alert('<?php echo get_bloginfo('name');?>');
```
the following method does need `esc_attr`
```
// JS code
alert('<?php echo esc_attr($post->post_title);?>');
```
What is th... | 2012/12/10 | [
"https://wordpress.stackexchange.com/questions/75590",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/13654/"
] | [You can look at the Codex](http://codex.wordpress.org/Function_Reference/esc_attr).
>
> Encodes < > & " ' (less than, greater than, ampersand, double quote,
> single quote). Will never double encode entities.
>
>
>
Given that, arguably, [both of those strings need sanitization](http://codex.wordpress.org/Data_V... | If your post title has single quote in it. Output of your code would be
alert('It's bad');
that is, breaking your JavaScript code and you will get "Unexpected identifier". When you use [esc\_attr](http://codex.wordpress.org/Function_Reference/esc_attr), output would be
alert('It's bad');
Post title will be enc... |
75,590 | When I am putting a WordPress value inside the attribute tag, for example, the following method does not need `esc_attr`
e.g.
```
// JS code
alert('<?php echo get_bloginfo('name');?>');
```
the following method does need `esc_attr`
```
// JS code
alert('<?php echo esc_attr($post->post_title);?>');
```
What is th... | 2012/12/10 | [
"https://wordpress.stackexchange.com/questions/75590",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/13654/"
] | You use `esc_attr()` when you are outputting something intended to be in an HTML attribute.
In your case, you should be using `esc_js()`, or possibly `json_encode()` instead. | If your post title has single quote in it. Output of your code would be
alert('It's bad');
that is, breaking your JavaScript code and you will get "Unexpected identifier". When you use [esc\_attr](http://codex.wordpress.org/Function_Reference/esc_attr), output would be
alert('It's bad');
Post title will be enc... |
75,590 | When I am putting a WordPress value inside the attribute tag, for example, the following method does not need `esc_attr`
e.g.
```
// JS code
alert('<?php echo get_bloginfo('name');?>');
```
the following method does need `esc_attr`
```
// JS code
alert('<?php echo esc_attr($post->post_title);?>');
```
What is th... | 2012/12/10 | [
"https://wordpress.stackexchange.com/questions/75590",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/13654/"
] | [You can look at the Codex](http://codex.wordpress.org/Function_Reference/esc_attr).
>
> Encodes < > & " ' (less than, greater than, ampersand, double quote,
> single quote). Will never double encode entities.
>
>
>
Given that, arguably, [both of those strings need sanitization](http://codex.wordpress.org/Data_V... | You use `esc_attr()` when you are outputting something intended to be in an HTML attribute.
In your case, you should be using `esc_js()`, or possibly `json_encode()` instead. |
57,576,540 | I am trying to find out the following:
1. Can Apache Kafka run on OpenJDK
2. What are the requirements for installation
3. What are the differences between
Using OracleJDK, I know it works on my machine
[Setting Up and Running Apache Kafka on Windows OS](https://dzone.com/articles/running-apache-kafka-on-windows-... | 2019/08/20 | [
"https://Stackoverflow.com/questions/57576540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/637493/"
] | 1. According to [Kafka Docs](https://kafka.apache.org/documentation/#java),
>
> From a security perspective, we recommend you use the latest released
> version of JDK 1.8 as older freely available versions have disclosed
> security vulnerabilities. LinkedIn is currently running JDK 1.8 u5
> (looking to upgrade to ... | 1. Yes
2. <https://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_system_requirements.html> should indicate similar requirements to the current version of openjdk.
3. OpenJDK is an open source version of the JDK. Oracle's JDK is not open source and requires a license for non personal use. There isn't an... |
152,456 | Would a modern pharmacist be able to improve life expectancy of the known world by a huge margin if they traveled back to ancient times with none of their equipment preferably around 1500bc Egypt | 2019/08/06 | [
"https://worldbuilding.stackexchange.com/questions/152456",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/56296/"
] | You're asking two questions. Don't do that.
>
> How useful would a pharmacist be in ancient times
>
>
>
Depending on where they qualified and the nature of their qualification, potentially quite useful. [Pharmacognosy](https://en.wikipedia.org/wiki/Pharmacognosy) is often a part of, or at least an optional part o... | Pharmacists are well educated in the biology and chemistry of their profession. While they wouldn't have access to the modern pharmacopeia, they'd have an understanding of how they work. Given their training in science (scientific method, germ theory, etc) they'd be able to develop pharmaceuticals derived from natural ... |
152,456 | Would a modern pharmacist be able to improve life expectancy of the known world by a huge margin if they traveled back to ancient times with none of their equipment preferably around 1500bc Egypt | 2019/08/06 | [
"https://worldbuilding.stackexchange.com/questions/152456",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/56296/"
] | You're asking two questions. Don't do that.
>
> How useful would a pharmacist be in ancient times
>
>
>
Depending on where they qualified and the nature of their qualification, potentially quite useful. [Pharmacognosy](https://en.wikipedia.org/wiki/Pharmacognosy) is often a part of, or at least an optional part o... | As suggested, the usual education of a pharmacist is much more about quality control and quantity control issues than it is about creating medicine.
However, pharmacists also know a lot about things like which common household materials are toxic, what to do about in a pinch and at a moment's notice, and such related ... |
152,456 | Would a modern pharmacist be able to improve life expectancy of the known world by a huge margin if they traveled back to ancient times with none of their equipment preferably around 1500bc Egypt | 2019/08/06 | [
"https://worldbuilding.stackexchange.com/questions/152456",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/56296/"
] | You're asking two questions. Don't do that.
>
> How useful would a pharmacist be in ancient times
>
>
>
Depending on where they qualified and the nature of their qualification, potentially quite useful. [Pharmacognosy](https://en.wikipedia.org/wiki/Pharmacognosy) is often a part of, or at least an optional part o... | Antibiotics are probably one of the most useful things I can think would improve survival in the absence of all the other tools available to modern medics. |
152,456 | Would a modern pharmacist be able to improve life expectancy of the known world by a huge margin if they traveled back to ancient times with none of their equipment preferably around 1500bc Egypt | 2019/08/06 | [
"https://worldbuilding.stackexchange.com/questions/152456",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/56296/"
] | You're asking two questions. Don't do that.
>
> How useful would a pharmacist be in ancient times
>
>
>
Depending on where they qualified and the nature of their qualification, potentially quite useful. [Pharmacognosy](https://en.wikipedia.org/wiki/Pharmacognosy) is often a part of, or at least an optional part o... | **Yes, if he somehow finds himself in a position of influence**
But this would unlikely be a result of specific pharmacicst's training. Any modern health professional knows enough about hygiene, antiseptics and epidemiology to make general advice which can significantly improve average life expectancy. The biggest pro... |
152,456 | Would a modern pharmacist be able to improve life expectancy of the known world by a huge margin if they traveled back to ancient times with none of their equipment preferably around 1500bc Egypt | 2019/08/06 | [
"https://worldbuilding.stackexchange.com/questions/152456",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/56296/"
] | Pharmacists are well educated in the biology and chemistry of their profession. While they wouldn't have access to the modern pharmacopeia, they'd have an understanding of how they work. Given their training in science (scientific method, germ theory, etc) they'd be able to develop pharmaceuticals derived from natural ... | As suggested, the usual education of a pharmacist is much more about quality control and quantity control issues than it is about creating medicine.
However, pharmacists also know a lot about things like which common household materials are toxic, what to do about in a pinch and at a moment's notice, and such related ... |
152,456 | Would a modern pharmacist be able to improve life expectancy of the known world by a huge margin if they traveled back to ancient times with none of their equipment preferably around 1500bc Egypt | 2019/08/06 | [
"https://worldbuilding.stackexchange.com/questions/152456",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/56296/"
] | Pharmacists are well educated in the biology and chemistry of their profession. While they wouldn't have access to the modern pharmacopeia, they'd have an understanding of how they work. Given their training in science (scientific method, germ theory, etc) they'd be able to develop pharmaceuticals derived from natural ... | Antibiotics are probably one of the most useful things I can think would improve survival in the absence of all the other tools available to modern medics. |
152,456 | Would a modern pharmacist be able to improve life expectancy of the known world by a huge margin if they traveled back to ancient times with none of their equipment preferably around 1500bc Egypt | 2019/08/06 | [
"https://worldbuilding.stackexchange.com/questions/152456",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/56296/"
] | As suggested, the usual education of a pharmacist is much more about quality control and quantity control issues than it is about creating medicine.
However, pharmacists also know a lot about things like which common household materials are toxic, what to do about in a pinch and at a moment's notice, and such related ... | Antibiotics are probably one of the most useful things I can think would improve survival in the absence of all the other tools available to modern medics. |
152,456 | Would a modern pharmacist be able to improve life expectancy of the known world by a huge margin if they traveled back to ancient times with none of their equipment preferably around 1500bc Egypt | 2019/08/06 | [
"https://worldbuilding.stackexchange.com/questions/152456",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/56296/"
] | **Yes, if he somehow finds himself in a position of influence**
But this would unlikely be a result of specific pharmacicst's training. Any modern health professional knows enough about hygiene, antiseptics and epidemiology to make general advice which can significantly improve average life expectancy. The biggest pro... | As suggested, the usual education of a pharmacist is much more about quality control and quantity control issues than it is about creating medicine.
However, pharmacists also know a lot about things like which common household materials are toxic, what to do about in a pinch and at a moment's notice, and such related ... |
152,456 | Would a modern pharmacist be able to improve life expectancy of the known world by a huge margin if they traveled back to ancient times with none of their equipment preferably around 1500bc Egypt | 2019/08/06 | [
"https://worldbuilding.stackexchange.com/questions/152456",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/56296/"
] | **Yes, if he somehow finds himself in a position of influence**
But this would unlikely be a result of specific pharmacicst's training. Any modern health professional knows enough about hygiene, antiseptics and epidemiology to make general advice which can significantly improve average life expectancy. The biggest pro... | Antibiotics are probably one of the most useful things I can think would improve survival in the absence of all the other tools available to modern medics. |
57,553,322 | I am developing using Java 8 a function that must handle the conversion from `String` to `LocalDateTime` of the following dates:
* 2019-06-20 12:18:07.207 +0000 UTC
* 2019-06-20 12:18:07.20 +0000 UTC
* 2019-06-20 12:18:07.2 +0000 UTC
* 2019-06-20 12:18:07 +0000 UTC
The strings are produced from an external library th... | 2019/08/19 | [
"https://Stackoverflow.com/questions/57553322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1173755/"
] | You can build the pattern using `DateTimeFormatterBuilder` and reuse `ISO_LOCAL_DATE` and `ISO_LOCAL_TIME` constants:
```
DateTimeFormatter formatter = new DateTimeFormatterBuilder()
.append(DateTimeFormatter.ISO_LOCAL_DATE)
.appendLiteral(" ")
.append(DateTimeFormatter.ISO_LOCA... | I think it is better to use a `DateTimeFormatterBuilder` for that purpose. For the optional parts just use one of the follwing methods :
1. [OptionalStart()](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatterBuilder.html#optionalStart--) & [OptionalEnd()](https://docs.oracle.com/javase/8/docs... |
57,553,322 | I am developing using Java 8 a function that must handle the conversion from `String` to `LocalDateTime` of the following dates:
* 2019-06-20 12:18:07.207 +0000 UTC
* 2019-06-20 12:18:07.20 +0000 UTC
* 2019-06-20 12:18:07.2 +0000 UTC
* 2019-06-20 12:18:07 +0000 UTC
The strings are produced from an external library th... | 2019/08/19 | [
"https://Stackoverflow.com/questions/57553322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1173755/"
] | I think it is better to use a `DateTimeFormatterBuilder` for that purpose. For the optional parts just use one of the follwing methods :
1. [OptionalStart()](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatterBuilder.html#optionalStart--) & [OptionalEnd()](https://docs.oracle.com/javase/8/docs... | Here is my example that I use in one app that takes different formats
as you can see millisecond is optional and also 'Z' at end.
```
new DateTimeFormatterBuilder()
.appendPattern("yyyy-MM-dd'T'HH:mm:ss")
.optionalStart()
.appendLiteral('.')
.appendValue(ChronoField.MILLI_OF_SECOND, 1, 3, SignS... |
57,553,322 | I am developing using Java 8 a function that must handle the conversion from `String` to `LocalDateTime` of the following dates:
* 2019-06-20 12:18:07.207 +0000 UTC
* 2019-06-20 12:18:07.20 +0000 UTC
* 2019-06-20 12:18:07.2 +0000 UTC
* 2019-06-20 12:18:07 +0000 UTC
The strings are produced from an external library th... | 2019/08/19 | [
"https://Stackoverflow.com/questions/57553322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1173755/"
] | You can build the pattern using `DateTimeFormatterBuilder` and reuse `ISO_LOCAL_DATE` and `ISO_LOCAL_TIME` constants:
```
DateTimeFormatter formatter = new DateTimeFormatterBuilder()
.append(DateTimeFormatter.ISO_LOCAL_DATE)
.appendLiteral(" ")
.append(DateTimeFormatter.ISO_LOCA... | Here is my example that I use in one app that takes different formats
as you can see millisecond is optional and also 'Z' at end.
```
new DateTimeFormatterBuilder()
.appendPattern("yyyy-MM-dd'T'HH:mm:ss")
.optionalStart()
.appendLiteral('.')
.appendValue(ChronoField.MILLI_OF_SECOND, 1, 3, SignS... |
18,035,412 | My SQL is a bit rusty. I'm not been able to find a way to retrieve rows where one value is greater than the other one. For example, I have the following row:
```
{
ROWID 1,
CreatedAt 2013-08-03 10:10:23:344,
UpdatedAt 2013-08-03 11:10:23:344,
}
```
I would like to perform the query 'select all ... | 2013/08/03 | [
"https://Stackoverflow.com/questions/18035412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/686765/"
] | Specify the desired columns between the `SELECT` and `FROM` and your predicates after the `WHERE`.
```
SELECT ROWID, CreatedAt, UpdatedAt FROM TableName WHERE UpdatedAt > CreateAt;
```
Remember with SQL that if all of the predicates in your query do not evaluate to `True` in some way, the row will not return. | Did you try
```
Select *
From table
where CreatedAt < UpdatedAt
``` |
18,304,570 | Okay, I have this text that I want to appear after 20s. I am using the animation-delay property but it is not working. Perhaps, I am doing something wrong.
Please help me out to get to right track..
Here is my code..
```
@import url(http://fonts.googleapis.com/css?family=Economica);
#text{
font-family:'Economica', s... | 2013/08/18 | [
"https://Stackoverflow.com/questions/18304570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1052179/"
] | You've specified the `-webkit` versions in the wrong order. The `-webkit-animation` replaces the delay rule that you just set up. Reverse the order so that the delay comes after.
```
-webkit-animation:fade-in 5s;
-webkit-animation-delay:15s;
```
You can avoid these issues if you always set a single attribute:
```
-... | You need to place the `animation-delay` rule *after* the shorthand, as the shorthand is resetting your value to the default which is `0s` - or you could just place it within the shorthand:
```
#text {
-moz-animation: fade-in 5s 15s;
-webkit-animation: fade-in 5s 15s;
animation: fade-in 5s 15s;
}
```
<htt... |
7,559,615 | Folks,
I have a feeling there's a classic design pattern that covers this case, but I don't have a reference handy.
I have a situation where a user clicks a button and another part of the web page responds. What's unusual (or at least inconvenient) is that the button and the reponding part of the web page are in very... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7559615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/490374/"
] | Sounds like you need an EventAggregator. You should find the implementation in the Composite Application Library.
The EventAggregator allows you to register to notifications and raise them from completely separated parts of the application. | I'm not sure if I understand you correctly, but it sounds like you want to assign multiple buttons to the same event handler, which you can do like this:
```
<asp:Button ID="Button1" runat="server" Text="Button 1" OnClick="Button_Click" ... />
<asp:Button ID="Button2" runat="server" Text="Button 2" OnClick="Button_Cli... |
7,559,615 | Folks,
I have a feeling there's a classic design pattern that covers this case, but I don't have a reference handy.
I have a situation where a user clicks a button and another part of the web page responds. What's unusual (or at least inconvenient) is that the button and the reponding part of the web page are in very... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7559615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/490374/"
] | Sounds like you need an EventAggregator. You should find the implementation in the Composite Application Library.
The EventAggregator allows you to register to notifications and raise them from completely separated parts of the application. | **For server side events you can use:**
The Reactive Extensions (Rx)...
<http://msdn.microsoft.com/en-us/data/gg577609>
**For Client side events you can use:**
Backbone JS
<http://documentcloud.github.com/backbone/>
Knockout JS
<http://knockoutjs.com/>
You mentioned you couldn't use jQuery may I ask... |
7,559,615 | Folks,
I have a feeling there's a classic design pattern that covers this case, but I don't have a reference handy.
I have a situation where a user clicks a button and another part of the web page responds. What's unusual (or at least inconvenient) is that the button and the reponding part of the web page are in very... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7559615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/490374/"
] | **For server side events you can use:**
The Reactive Extensions (Rx)...
<http://msdn.microsoft.com/en-us/data/gg577609>
**For Client side events you can use:**
Backbone JS
<http://documentcloud.github.com/backbone/>
Knockout JS
<http://knockoutjs.com/>
You mentioned you couldn't use jQuery may I ask... | I'm not sure if I understand you correctly, but it sounds like you want to assign multiple buttons to the same event handler, which you can do like this:
```
<asp:Button ID="Button1" runat="server" Text="Button 1" OnClick="Button_Click" ... />
<asp:Button ID="Button2" runat="server" Text="Button 2" OnClick="Button_Cli... |
14,495,349 | Is there any way that we can change or **highlight the color or the certain row of ul tag** on its double click event?
```
<c:forEach var="food" varStatus="i" items="${foodList}">
<c:set var="foodInfo" value="${food.key}"/>
<ul class="scroller_result" ondblclick="showDetails('${foodInfo}','m','iPad');"">
... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14495349",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/751689/"
] | This is wrong in at least two ways:
1. Turn of `magic_quotes` completely if you can. At least you are not using it, but `$input` may not be scalar
2. `htmlentities` is for *display*, not storage. Never encode for storage!
3. `mysql_*` functions are deprecated. There is no guarantee you will have an open mysql connecti... | Look what you're actually doing:
Magic quotes is a bulk escaping of all incoming data, which makes you vulnerable, as escaping alone doesn't make your data "safe" by any means.
So, you are cleaning these bulk escapes... and then apply the very same escaping again :) |
28,394,143 | ```
#Figure 1, right at the bottom of the code, needs the error bars.
import scipy as sp
import numpy as np
import pylab as pl
import matplotlib as mpl
import numpy.random as nr
import matplotlib.pyplot as plt
M = 91.0
G = 2.5
RS = 0.14
JS = -0.033
S = np.arange(20,140,0.1)
def sigs(com):
for i in com:... | 2015/02/08 | [
"https://Stackoverflow.com/questions/28394143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4542998/"
] | Note that [`bar()` also accepts a `yerr=` argument](http://matplotlib.org/api/axes_api.html?highlight=bar#matplotlib.axes.Axes.bar):
```
pl.bar(cos, s, width=0.05, yerr=yerr)
```
This will automatically place the errorbars in the centers of each bar. There's no need to draw the bars first, then use `errorbar()` to d... | The problem is that you use the same x-data (cos in your case) for the error bars and bar plot. One simple solution is to add 1/2 bar width to the x-data for the error bars, in other words:
```
plt.errorbar(cos + 0.025 , s, yerr=yerr, fmt = 'o')
```
where 0.025 is half the bar width. |
59,087,054 | I have successfully trained a u-net for the specific task of cell segmentation using `(256, 256, 1)` grayscale input and `(256, 256, 1)` binary label. I used zhixuhao's unet implemention in Keras (git rep. [here](https://github.com/zhixuhao/unet)).What I am trying to do now is to train the same model using multiple gra... | 2019/11/28 | [
"https://Stackoverflow.com/questions/59087054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12041431/"
] | Your expected input shape is `(32, 256, 256, 2)` whereas the output shape of your generator is `(2, 32, 256, 256, 1)`. It's because `np.stack` is adding one additional dimension than the input arrays. You can solve this by using `np.concatenate` instead of `np.stack` in your `train_generator` [last line of code block] ... | As suggested by @bit01, `np.stack` is adding one additional dimension than the input arrays! To get things working I edited the last line of the `MultipleInputTrainGenerator` function as below :
```
img = np.squeeze(np.stack((img1, img2), axis=3), axis=4)
yield (img, mask1)
```
It should work to with `np.concatenat... |
30,104 | Ok so first off a bit of background. I've been working professionally three years in a software engineer position after my BSc. in Mathematics and Physics. At some point I realized I missed doing true research so I enrolled in Masters in Financial Mathematics, which seemed to me the ideal trade off between maths, progr... | 2014/10/17 | [
"https://academia.stackexchange.com/questions/30104",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/23010/"
] | As scaaahu commented: This happens ALL the time in industry (one could say it is the rule, not the exception). We do not always get to pick our teams and it is common for high-performers to be stuck with those who do not really care about the quality of their work. Will someone get fired in industry? Maybe...maybe not ... | I had the same thing happen to me during my MBA; it was heavy in group projects.
I was trying to keep a perfect GPA and my team mates just cared about passing.
There is no really way to complain or rant. I just couldn’t trust them to do anything. I would take over the project, assign them a BS part and do the lion wo... |
30,104 | Ok so first off a bit of background. I've been working professionally three years in a software engineer position after my BSc. in Mathematics and Physics. At some point I realized I missed doing true research so I enrolled in Masters in Financial Mathematics, which seemed to me the ideal trade off between maths, progr... | 2014/10/17 | [
"https://academia.stackexchange.com/questions/30104",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/23010/"
] | As scaaahu commented: This happens ALL the time in industry (one could say it is the rule, not the exception). We do not always get to pick our teams and it is common for high-performers to be stuck with those who do not really care about the quality of their work. Will someone get fired in industry? Maybe...maybe not ... | I've faced the same situation in the past. And that was during a semester-long project. At the time I was stuck in a team of 4, where I ended-up doing over 70% of the work.
The problem in such setup is that, no matter that you try to voice your concerns, the other party will only hear what is convenient to them and no... |
69,086,620 | This is my function
```
function randomNum2(num)
f = io.open("result.csv", "a+")
num = math.randomseed(os.clock()*100000000000)
f:write(string.format("%s\n", num))
f:close()
return "TETB"..(math.random(1000000000))
end
```
The output from `result.csv` file like.
```
nil
nil
nil
nil
nil
nil
nil
n... | 2021/09/07 | [
"https://Stackoverflow.com/questions/69086620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16850716/"
] | The `math.randomseed` function doesn't return anything, it just sets the `math` library to use a certain number as the basis for the "random" numbers, you should use the `math.random` function after running `math.randomseed` which configures the library, `math.random` returns a number and you can specify a range betwee... | Do more `local` variable.
And do not concat (..) a `string` with a `number`.
Convert `math.random()` with `tostring()` on the fly.
I corrected your version to...
```
randomNum2=function()
local f = io.open("result.csv", "a+")
local rand = "TETB"..tostring(math.random(100000000000))
f:write(string.... |
24,041,513 | I received this exception while using `GregorianCalendar`
`java.lang.IllegalArgumentException: Bad class: class java.util.GregorianCalendar`
Who know how to fix,
Please help me.
p/s : I used the following code :
```
Calendar someDate = GregorianCalendar.getInstance();
someDate.add(Calendar.DAY_OF_YEAR, -7)... | 2014/06/04 | [
"https://Stackoverflow.com/questions/24041513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2522405/"
] | A Calendar can't be directly formatted, you need to get the Date from the Calendar, like this:
```
String formattedDate = dateFormat.format(someDate.getTime());
``` | As one of the answers here: [Using GregorianCalendar with SimpleDateFormat](https://stackoverflow.com/questions/10829942/using-gregoriancalendar-with-simpledateformat) says "A SimpleDateFormat, as its name indicates, formats Dates."
So, try this:
```
String formattedDate = dateFormat.format(someDate.getDate());
``` |
6,628,949 | What I ultimately need to do is run an `$.ajax()` call and then after that is run, open a new window.
A use clicks on a "Preview" button that saves their current form then opens a new window that shows a preview of the item with the data that was just saved.
But as-is, the `window.open` function gets blocked by popup... | 2011/07/08 | [
"https://Stackoverflow.com/questions/6628949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147586/"
] | I ran into this problem recently and found this work-around:
1) call `window.open` just before calling `$.ajax` and save window reference:
```
var newWindow = window.open(...);
```
2) on callback set `location` property of the saved window reference:
```
newWindow.location = url;
```
Maybe it will help you too. | According this [this post](https://stackoverflow.com/questions/2587677/avoid-browser-pop-up-blockers), it looks like you would have to open your window in direct response to the click (to avoid getting hit by the popup blockers) rather than waiting until the AJAX call completes to open the new window. |
6,628,949 | What I ultimately need to do is run an `$.ajax()` call and then after that is run, open a new window.
A use clicks on a "Preview" button that saves their current form then opens a new window that shows a preview of the item with the data that was just saved.
But as-is, the `window.open` function gets blocked by popup... | 2011/07/08 | [
"https://Stackoverflow.com/questions/6628949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147586/"
] | I ran into this problem recently and found this work-around:
1) call `window.open` just before calling `$.ajax` and save window reference:
```
var newWindow = window.open(...);
```
2) on callback set `location` property of the saved window reference:
```
newWindow.location = url;
```
Maybe it will help you too. | Popup blockers usually works blocking every popup shown not triggered by a direct user action, like clicking on a button or a link.
If you use a ajax request on your click event, the request is fired asyncronous from the click event, that's why by the time the ajax request has done its job and you get your event with ... |
6,628,949 | What I ultimately need to do is run an `$.ajax()` call and then after that is run, open a new window.
A use clicks on a "Preview" button that saves their current form then opens a new window that shows a preview of the item with the data that was just saved.
But as-is, the `window.open` function gets blocked by popup... | 2011/07/08 | [
"https://Stackoverflow.com/questions/6628949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147586/"
] | I ran into this problem recently and found this work-around:
1) call `window.open` just before calling `$.ajax` and save window reference:
```
var newWindow = window.open(...);
```
2) on callback set `location` property of the saved window reference:
```
newWindow.location = url;
```
Maybe it will help you too. | I solved my case by making the Ajax call synchronous. E.g. (with jQuery):
```
$("form").submit(function(e){
e.preventDefault();
$.ajax({
async: false,
url: ...,
data: ...,
success: function(results){
if(results.valid){
window.open(...);
}
}
})... |
6,628,949 | What I ultimately need to do is run an `$.ajax()` call and then after that is run, open a new window.
A use clicks on a "Preview" button that saves their current form then opens a new window that shows a preview of the item with the data that was just saved.
But as-is, the `window.open` function gets blocked by popup... | 2011/07/08 | [
"https://Stackoverflow.com/questions/6628949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147586/"
] | I ran into this problem recently and found this work-around:
1) call `window.open` just before calling `$.ajax` and save window reference:
```
var newWindow = window.open(...);
```
2) on callback set `location` property of the saved window reference:
```
newWindow.location = url;
```
Maybe it will help you too. | ```
const newWin = window.open(`${BASE_URL}`, 'expampleName')
if (newWin) {
newWin.onload = () => {
const currentOpenWindow = newWin
const href = newWin.location.href
}
}
``` |
6,628,949 | What I ultimately need to do is run an `$.ajax()` call and then after that is run, open a new window.
A use clicks on a "Preview" button that saves their current form then opens a new window that shows a preview of the item with the data that was just saved.
But as-is, the `window.open` function gets blocked by popup... | 2011/07/08 | [
"https://Stackoverflow.com/questions/6628949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147586/"
] | Popup blockers usually works blocking every popup shown not triggered by a direct user action, like clicking on a button or a link.
If you use a ajax request on your click event, the request is fired asyncronous from the click event, that's why by the time the ajax request has done its job and you get your event with ... | According this [this post](https://stackoverflow.com/questions/2587677/avoid-browser-pop-up-blockers), it looks like you would have to open your window in direct response to the click (to avoid getting hit by the popup blockers) rather than waiting until the AJAX call completes to open the new window. |
6,628,949 | What I ultimately need to do is run an `$.ajax()` call and then after that is run, open a new window.
A use clicks on a "Preview" button that saves their current form then opens a new window that shows a preview of the item with the data that was just saved.
But as-is, the `window.open` function gets blocked by popup... | 2011/07/08 | [
"https://Stackoverflow.com/questions/6628949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147586/"
] | According this [this post](https://stackoverflow.com/questions/2587677/avoid-browser-pop-up-blockers), it looks like you would have to open your window in direct response to the click (to avoid getting hit by the popup blockers) rather than waiting until the AJAX call completes to open the new window. | I solved my case by making the Ajax call synchronous. E.g. (with jQuery):
```
$("form").submit(function(e){
e.preventDefault();
$.ajax({
async: false,
url: ...,
data: ...,
success: function(results){
if(results.valid){
window.open(...);
}
}
})... |
6,628,949 | What I ultimately need to do is run an `$.ajax()` call and then after that is run, open a new window.
A use clicks on a "Preview" button that saves their current form then opens a new window that shows a preview of the item with the data that was just saved.
But as-is, the `window.open` function gets blocked by popup... | 2011/07/08 | [
"https://Stackoverflow.com/questions/6628949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147586/"
] | According this [this post](https://stackoverflow.com/questions/2587677/avoid-browser-pop-up-blockers), it looks like you would have to open your window in direct response to the click (to avoid getting hit by the popup blockers) rather than waiting until the AJAX call completes to open the new window. | ```
const newWin = window.open(`${BASE_URL}`, 'expampleName')
if (newWin) {
newWin.onload = () => {
const currentOpenWindow = newWin
const href = newWin.location.href
}
}
``` |
6,628,949 | What I ultimately need to do is run an `$.ajax()` call and then after that is run, open a new window.
A use clicks on a "Preview" button that saves their current form then opens a new window that shows a preview of the item with the data that was just saved.
But as-is, the `window.open` function gets blocked by popup... | 2011/07/08 | [
"https://Stackoverflow.com/questions/6628949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147586/"
] | Popup blockers usually works blocking every popup shown not triggered by a direct user action, like clicking on a button or a link.
If you use a ajax request on your click event, the request is fired asyncronous from the click event, that's why by the time the ajax request has done its job and you get your event with ... | I solved my case by making the Ajax call synchronous. E.g. (with jQuery):
```
$("form").submit(function(e){
e.preventDefault();
$.ajax({
async: false,
url: ...,
data: ...,
success: function(results){
if(results.valid){
window.open(...);
}
}
})... |
6,628,949 | What I ultimately need to do is run an `$.ajax()` call and then after that is run, open a new window.
A use clicks on a "Preview" button that saves their current form then opens a new window that shows a preview of the item with the data that was just saved.
But as-is, the `window.open` function gets blocked by popup... | 2011/07/08 | [
"https://Stackoverflow.com/questions/6628949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147586/"
] | Popup blockers usually works blocking every popup shown not triggered by a direct user action, like clicking on a button or a link.
If you use a ajax request on your click event, the request is fired asyncronous from the click event, that's why by the time the ajax request has done its job and you get your event with ... | ```
const newWin = window.open(`${BASE_URL}`, 'expampleName')
if (newWin) {
newWin.onload = () => {
const currentOpenWindow = newWin
const href = newWin.location.href
}
}
``` |
6,628,949 | What I ultimately need to do is run an `$.ajax()` call and then after that is run, open a new window.
A use clicks on a "Preview" button that saves their current form then opens a new window that shows a preview of the item with the data that was just saved.
But as-is, the `window.open` function gets blocked by popup... | 2011/07/08 | [
"https://Stackoverflow.com/questions/6628949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147586/"
] | I solved my case by making the Ajax call synchronous. E.g. (with jQuery):
```
$("form").submit(function(e){
e.preventDefault();
$.ajax({
async: false,
url: ...,
data: ...,
success: function(results){
if(results.valid){
window.open(...);
}
}
})... | ```
const newWin = window.open(`${BASE_URL}`, 'expampleName')
if (newWin) {
newWin.onload = () => {
const currentOpenWindow = newWin
const href = newWin.location.href
}
}
``` |
15,486,630 | I have a folder with many files, out of which I need to: open the files for this week, store them in an array, pass them to a sub, and loop through them for getting summary information.
I am able to get the desired day files from the below code. But the code is throwing an error for storing it in the array and passing... | 2013/03/18 | [
"https://Stackoverflow.com/questions/15486630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2175642/"
] | Your `strArray` variable is of type `Single`. If you want that variable to be a string array, you must declare it as such:
`Dim strArray(0 to 5) As String`
EDIT:
Now that you've changed your code to use `strArray() As String` rather than `strArray As Single`, you should update your `CreateStats` sub procedure to acc... | By naming your array `strArray` it appears that you are going to have an array of strings, and in fact you attempt to store workbook names in it. However, you declared array to be Single, which is a numeric data type. Depending on what your `CreateStats(strArray)` sub does, you may need to change that from Single to St... |
42,962,613 | When using the typical 3D plot like so:
```
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.gca(projection='3d')
```
`flake8` reports the expected error:
```
./tools.py:62:9: F401 'mpl_toolkits.mplot3d.Axes3D' imported but unused
```
I know it can be avoided us... | 2017/03/22 | [
"https://Stackoverflow.com/questions/42962613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4958717/"
] | If this is only about actually using the import at least once, you can do
```
ax = fig.gca(projection=Axes3D.name)
```
as `"3d"` is the name of the `Axes3D` class by which it is registered to the projection list. | ```
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
fig = plt.figure()
ax = Axes3D(fig)
```
However, if I understand the [documentation](https://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html#getting-started) well, it is not the preferred way anymore since version 1.0.0. I still mention it... |
1,330,746 | So I've just watched this wonderful [Numberphile](https://www.youtube.com/watch?v=seUU2bZtfgM) video about transcendental numbers.
In the video, the guy shows that
$$e=\sum\_{n=0}^\infty\frac{1}{n!}=1+\frac{1}{1}+\frac{1}{1\cdot2}+\frac{1}{1\cdot2\cdot3}+\cdots$$
In the video, he says that if a number can be reduced... | 2015/06/18 | [
"https://math.stackexchange.com/questions/1330746",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/188070/"
] | For (1), a property $P$ which does not hold of the empty set satisfies your condition if and only if there is some set $X$ such that for all sets $Y$, $P(Y)$ implies $X\subseteq Y$.
One direction is easy; for the other, suppose there were no such $X$. Fix some $Y$ such that $P(Y)$ holds (note: $P$ can't be empty, othe... | First note that if we have a collection of intersection-compatible $P\_i,i\in I$, then their "intersection" $$\tag0P(X)\equiv\forall i\in I\colon P\_i(X)$$ is also intersection-compatible: If $P\_i(A\_\alpha)$ for all $i$ and $\alpha$, then $P\_i(\bigcap A\_\alpha)$ for all $i$. (On the other hand, already $P\_1(X)\lor... |
17,916,770 | I'd like to run a function server side using a Python file on my Google App Engine application with this Ajax call.
```
function test(){
request = $.ajax({
url: "test.py?some_vars...",
type: "get",
});
request.done(function (response, textStatus, jqXHR){
console.log(response);
});
}
```
When I r... | 2013/07/29 | [
"https://Stackoverflow.com/questions/17916770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You need to set up a handler in app.yaml that maps to your test.py. | You'll need a route that looks something like...
```
- url: /test.py
script: test.app
``` |
42,645,715 | I have a `RecyclerView` and below there's an `EditText`. I want when user taps outside the `EditText` to close the keyboard.
I searched and find this answer [here](https://stackoverflow.com/a/19828165/423980) but it doesn't work for me. User taps outside but `EditText` still has focus.
My XML code is :
```
<android.... | 2017/03/07 | [
"https://Stackoverflow.com/questions/42645715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4856442/"
] | Simply set an `onTouchListener()` to your `RecyclerView` and call the `hideKeyboard()` method from it. | close it when your `editText` losses it's focus.
like that:
```
EditText editText = (EditText) findViewById(R.id.edittxt);
editText.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
// code to execute whe... |
42,645,715 | I have a `RecyclerView` and below there's an `EditText`. I want when user taps outside the `EditText` to close the keyboard.
I searched and find this answer [here](https://stackoverflow.com/a/19828165/423980) but it doesn't work for me. User taps outside but `EditText` still has focus.
My XML code is :
```
<android.... | 2017/03/07 | [
"https://Stackoverflow.com/questions/42645715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4856442/"
] | Simply set an `onTouchListener()` to your `RecyclerView` and call the `hideKeyboard()` method from it. | Call this method on recyclerview touch listener...
```
public static void hideKeyboard(final Activity activity) {
final View view = activity.getCurrentFocus();
final InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
Handler handler = new Handler();
... |
58,648,309 | I am using EntityFramework 6.3.0 in .Net 4.7.2
I have this code in C#
```
int userId = 1;
string statusValue = StatusCodes.Failing; // This is a string for anyone wondering, not an Enum
return (from statusRow in DbContext.Statuses
where statusRow.UserId == userId
&& statusRow.Status == statusValue
... | 2019/10/31 | [
"https://Stackoverflow.com/questions/58648309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1356/"
] | "Hardware » Erase all Content and Settings" in the simulator fixed the problem.
Probably some leftover from the Betas. | This is caused by toggling the software keyboard.
If your test fails launch your app, tap a text field and note the lack of software keyboard. Select `I/O` > `Keyboard` > `Toggle Software Keyboard` from the simulator menu, or Cmd-K with the simulator in focus and the keyboard should then show. Re-run your test and it... |
10,379,316 | I need to load test a site with a simulated user load. For this I intend to record the web server logs for a given 10-minute usage of an average user and use this to replay on multiple concurrent threads to simulate a realistic load.
Here's the tools I've looked at and rejected:
**Apache benchmark**...can program it ... | 2012/04/30 | [
"https://Stackoverflow.com/questions/10379316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/328915/"
] | JMeter is capable of injecting constant and random details into your test plan, check out [4.4 Timers](http://jmeter.apache.org/usermanual/test_plan.html#timers) and especially [18.6 Timers](http://jmeter.apache.org/usermanual/component_reference.html#timers):
>
> * Constant Timer
> * Gaussian Random Timer
> * Unifo... | Maybe gor?
>
> Gor is an open-source tool for capturing and replaying live HTTP
> traffic into a test environment in order to continuously test your
> system with real data. It can be used to increase confidence in code
> deployments, configuration changes and infrastructure changes.
> <https://goreplay.org>
>
>... |
10,379,316 | I need to load test a site with a simulated user load. For this I intend to record the web server logs for a given 10-minute usage of an average user and use this to replay on multiple concurrent threads to simulate a realistic load.
Here's the tools I've looked at and rejected:
**Apache benchmark**...can program it ... | 2012/04/30 | [
"https://Stackoverflow.com/questions/10379316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/328915/"
] | JMeter is capable of injecting constant and random details into your test plan, check out [4.4 Timers](http://jmeter.apache.org/usermanual/test_plan.html#timers) and especially [18.6 Timers](http://jmeter.apache.org/usermanual/component_reference.html#timers):
>
> * Constant Timer
> * Gaussian Random Timer
> * Unifo... | Late for the party, but [this example](https://www.blazemeter.com/blog/stop-making-assumptions-learn-how-replay-your-production-traffic-jmeter) seems to be describing exactly what you are looking for, using Jmeter only.
<https://www.blazemeter.com/blog/stop-making-assumptions-learn-how-replay-your-production-traffic-... |
10,379,316 | I need to load test a site with a simulated user load. For this I intend to record the web server logs for a given 10-minute usage of an average user and use this to replay on multiple concurrent threads to simulate a realistic load.
Here's the tools I've looked at and rejected:
**Apache benchmark**...can program it ... | 2012/04/30 | [
"https://Stackoverflow.com/questions/10379316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/328915/"
] | Another vote for JMeter, it's a good tool for what you need. But, regardless of the tool, a word on your approach: Sadly, it isn't really possible to just point a tool at a webserver log and get a valid load test in return. There just isn't enough data stored in the logs to give you that (not unless all your pages are ... | Maybe gor?
>
> Gor is an open-source tool for capturing and replaying live HTTP
> traffic into a test environment in order to continuously test your
> system with real data. It can be used to increase confidence in code
> deployments, configuration changes and infrastructure changes.
> <https://goreplay.org>
>
>... |
10,379,316 | I need to load test a site with a simulated user load. For this I intend to record the web server logs for a given 10-minute usage of an average user and use this to replay on multiple concurrent threads to simulate a realistic load.
Here's the tools I've looked at and rejected:
**Apache benchmark**...can program it ... | 2012/04/30 | [
"https://Stackoverflow.com/questions/10379316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/328915/"
] | Another vote for JMeter, it's a good tool for what you need. But, regardless of the tool, a word on your approach: Sadly, it isn't really possible to just point a tool at a webserver log and get a valid load test in return. There just isn't enough data stored in the logs to give you that (not unless all your pages are ... | Late for the party, but [this example](https://www.blazemeter.com/blog/stop-making-assumptions-learn-how-replay-your-production-traffic-jmeter) seems to be describing exactly what you are looking for, using Jmeter only.
<https://www.blazemeter.com/blog/stop-making-assumptions-learn-how-replay-your-production-traffic-... |
10,379,316 | I need to load test a site with a simulated user load. For this I intend to record the web server logs for a given 10-minute usage of an average user and use this to replay on multiple concurrent threads to simulate a realistic load.
Here's the tools I've looked at and rejected:
**Apache benchmark**...can program it ... | 2012/04/30 | [
"https://Stackoverflow.com/questions/10379316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/328915/"
] | Had a similar problem - needed a tool to replay logs from production sever keeping all gaps as is. Also, wanted to manipulate some http headers.
Being sysadmin, first scripted on bash with ab. Wasn't that great speedwise.
Jmeter is great if only it was simple to use.
So, ended up writing own tool to load test by re... | Maybe gor?
>
> Gor is an open-source tool for capturing and replaying live HTTP
> traffic into a test environment in order to continuously test your
> system with real data. It can be used to increase confidence in code
> deployments, configuration changes and infrastructure changes.
> <https://goreplay.org>
>
>... |
10,379,316 | I need to load test a site with a simulated user load. For this I intend to record the web server logs for a given 10-minute usage of an average user and use this to replay on multiple concurrent threads to simulate a realistic load.
Here's the tools I've looked at and rejected:
**Apache benchmark**...can program it ... | 2012/04/30 | [
"https://Stackoverflow.com/questions/10379316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/328915/"
] | Had a similar problem - needed a tool to replay logs from production sever keeping all gaps as is. Also, wanted to manipulate some http headers.
Being sysadmin, first scripted on bash with ab. Wasn't that great speedwise.
Jmeter is great if only it was simple to use.
So, ended up writing own tool to load test by re... | Late for the party, but [this example](https://www.blazemeter.com/blog/stop-making-assumptions-learn-how-replay-your-production-traffic-jmeter) seems to be describing exactly what you are looking for, using Jmeter only.
<https://www.blazemeter.com/blog/stop-making-assumptions-learn-how-replay-your-production-traffic-... |
10,379,316 | I need to load test a site with a simulated user load. For this I intend to record the web server logs for a given 10-minute usage of an average user and use this to replay on multiple concurrent threads to simulate a realistic load.
Here's the tools I've looked at and rejected:
**Apache benchmark**...can program it ... | 2012/04/30 | [
"https://Stackoverflow.com/questions/10379316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/328915/"
] | I solved this by using Celery. Celery by its nature will spawn asynchronous workers which is what you need. A task can also take a "countdown" parameter so you can schedule requests.
The task is fairly simple:
```
import requests
from celery.task import task
@task(max_retries=0, ignore_result=True)
def get_url(url,... | Maybe gor?
>
> Gor is an open-source tool for capturing and replaying live HTTP
> traffic into a test environment in order to continuously test your
> system with real data. It can be used to increase confidence in code
> deployments, configuration changes and infrastructure changes.
> <https://goreplay.org>
>
>... |
10,379,316 | I need to load test a site with a simulated user load. For this I intend to record the web server logs for a given 10-minute usage of an average user and use this to replay on multiple concurrent threads to simulate a realistic load.
Here's the tools I've looked at and rejected:
**Apache benchmark**...can program it ... | 2012/04/30 | [
"https://Stackoverflow.com/questions/10379316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/328915/"
] | I solved this by using Celery. Celery by its nature will spawn asynchronous workers which is what you need. A task can also take a "countdown" parameter so you can schedule requests.
The task is fairly simple:
```
import requests
from celery.task import task
@task(max_retries=0, ignore_result=True)
def get_url(url,... | Late for the party, but [this example](https://www.blazemeter.com/blog/stop-making-assumptions-learn-how-replay-your-production-traffic-jmeter) seems to be describing exactly what you are looking for, using Jmeter only.
<https://www.blazemeter.com/blog/stop-making-assumptions-learn-how-replay-your-production-traffic-... |
61,081,590 | I have the following dataset that has a line for each employee clocking in and corresponding clock-out into the company premises.
[](https://i.stack.imgur.com/pUh2O.png)
I want to create a matrix (summary) of how many people from each division are in the building in ... | 2020/04/07 | [
"https://Stackoverflow.com/questions/61081590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019687/"
] | I ran a POC project spinning 100 parallel tasks both with MySql.Data 8.0.19 and MySqlConnector 0.63.2 on .NET Core 3.1 console application. I create, open and dispose the connection into the context of every single task. Both providers runs to completion without errors.
The specifics are that MySql.Data queries run **... | Multi-threading with MySQL *must* use independent connections. Given that, multithreading is not a MySQL question but an issue for the client language, C# in your question.
That is, build your threads without regard to MySQL, *then* create a connection in each thread that needs to do queries. It will be on your should... |
30,669,165 | int a, b, c;
```
Scanner scan = new Scanner(System.in);
System.out.println("Inserire a");
a = scan.nextInt();
System.out.println("Inserire b");
b = scan.nextInt();
System.out.println("Inserire c");
c = scan.nextInt();
if (a == b && a == c){
System.out.println("All the same");
}
if (((a==b) && b!=c) || ((a==c) &&... | 2015/06/05 | [
"https://Stackoverflow.com/questions/30669165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4978424/"
] | You would have to do something like this as having an else if after an else for the same block will cause you issues. If this is not the behavior you are looking for please supply more info and I'll try to help :)
```
int a, b, c;
Scanner scan = new Scanner(System.in);
System.out.println("Inserire a");
a = scan.next... | Try using else if instead of the second if an cut paste the else part after all the else if s. |
30,669,165 | int a, b, c;
```
Scanner scan = new Scanner(System.in);
System.out.println("Inserire a");
a = scan.nextInt();
System.out.println("Inserire b");
b = scan.nextInt();
System.out.println("Inserire c");
c = scan.nextInt();
if (a == b && a == c){
System.out.println("All the same");
}
if (((a==b) && b!=c) || ((a==c) &&... | 2015/06/05 | [
"https://Stackoverflow.com/questions/30669165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4978424/"
] | You would have to do something like this as having an else if after an else for the same block will cause you issues. If this is not the behavior you are looking for please supply more info and I'll try to help :)
```
int a, b, c;
Scanner scan = new Scanner(System.in);
System.out.println("Inserire a");
a = scan.next... | If you've indented your code well then you've figured out that:
You have `if-else-else` instead of `if-else-if-else`
```
if (a == b && a == c){
System.out.println("All the same");
}
if (((a==b) && b!=c) || ((a==c) && (b!=c)) || ((b == c) && (a!= c))); //Also you have a ";" here, why?
{
System.out.println("T... |
20,234,168 | ```
> x<-c("01.mp3","invite.mp3")
> x[grep(x,pattern="[:digit:]")]
[1] "invite.mp3"
```
In the regular expression,Why i can not get "01.mp3"? | 2013/11/27 | [
"https://Stackoverflow.com/questions/20234168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1982032/"
] | If you want to get "01.mp3" because it consists of two digits and ".mp3", then you could do something like:
```
x<-c("01.mp3","invite.mp3")
x[grep(x,pattern="[0-9]{2}.mp3")]
``` | I *think* what's happening here (and someone will presumably correct me), is that you are not actually matching what you think you are. You need to put the bracket list `[:digit:]` inside brackets to match the list, otherwise you are matching the literal characters in `:digit:`. You can see this by adding a third eleme... |
58,310,511 | I'm basically try to save a volley response in my room db so I can later retrieve it for offline usage, but every time I start my app, I get this exception.
```
String api_keys = "MyApiKey" + awayid;
JsonObjectRequest jsonObjectRequest2 = new JsonObjectRequest(Request.Method.GET, api_keys, null, new Response.Listener... | 2019/10/09 | [
"https://Stackoverflow.com/questions/58310511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9773423/"
] | **For JupyterLab**
Go to `Settings` and choose `Advanced Settings editor`. Under the `Keyboard shortcuts` tab, copy the entire `System Defaults` content to `User Preferences` column and find section containing:
```
"command": "notebook:run-in-console",
"keys": [
""
],
```
Add the key combination... | Once JupterLab is open click the Settings dropdown menu. Select Advanced Settings Editor.
Select Keyboard Shortcuts.
You’ll see a dictionary for each option in the System Defaults panel. There are a bunch of options, so you might want to Command + F (Ctrl + F on Windows) to find the one you want. Copy the code of the o... |
63,063,280 | I'm trying to create new object with different properties name from Array.
Array is:
```
profiles: Array(1)
0:
column:
name: "profileName"
title: "Profile name"
status: "Active"
```
I want to create new function that return object with two properties:
id: 'profileName',
profileStatus: 'A... | 2020/07/23 | [
"https://Stackoverflow.com/questions/63063280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9378116/"
] | I've just tested here and this seems to be working actually
```
const getProfile1 = (p) => p.reduce((obj, profile) =>({
...obj,
id: profile.column.name,
profileStatus: profile.status,
}), {});
``` | You can use map as an alternative.
```js
var profiles = [{"column":{"name": "profileName3","title": "3Profile name"},"status": "Active"},{"column":{"name": "profileName","title": "Profile name"},"status": "Active"}];
function getProfile(profiles) {
if (!profiles.length) return undefined;
return profiles.map(f... |
63,063,280 | I'm trying to create new object with different properties name from Array.
Array is:
```
profiles: Array(1)
0:
column:
name: "profileName"
title: "Profile name"
status: "Active"
```
I want to create new function that return object with two properties:
id: 'profileName',
profileStatus: 'A... | 2020/07/23 | [
"https://Stackoverflow.com/questions/63063280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9378116/"
] | I've just tested here and this seems to be working actually
```
const getProfile1 = (p) => p.reduce((obj, profile) =>({
...obj,
id: profile.column.name,
profileStatus: profile.status,
}), {});
``` | Whenever I use `reduce` in this way, I usually index the final object by some sort of an `id`. As noted in another answer, you could use `map` in this situation as well. If you really want your final data structure to be an object, however, you could do something like this:
```
/**
* returns object indexed by profile... |
357,702 | [](https://i.stack.imgur.com/inkmq.jpg)
I'd like to remove the socket links from this item, and return it to 0 links. However, I can't figure out a way to 0-link the item, so to speak. The crafting bench only offers recipes for two-socket to three-soc... | 2019/09/17 | [
"https://gaming.stackexchange.com/questions/357702",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/18916/"
] | One possible way to get a permanent ingame crosshair (only with NVIDIA Geforce Experience):
---
1. **Download** NVIDIA GeForce Experience.
2. **Search for** your "NVIDIA Corporation\Ansel\ShaderMod (My path was: "C:\Program Files\NVIDIA Corporation\Ansel\ShaderMod").
3. **Change** one of the Sticker.png (for example ... | **csgo release notes for 10/7/2019:**
This issue was finally fixed by valve. As you can see in the picture, now, default crosshairs (`cl_crosshairstyle 1`) behave like the others.
[](https://i.stack.imgur.com/MluKw.png)
I'm glad this was finally fix... |
33,514,027 | Anyone knows whats the Scala equivalent of the below java stream operation - findFirst()
```
lst.stream()
.filter(x -> x > 5)
.findFirst()
```
Thank you | 2015/11/04 | [
"https://Stackoverflow.com/questions/33514027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3903112/"
] | You can simple use `lst.find(_ > 5)` which will return an `Option`. This is basically the same as (but more efficient than) writing `lst.filter(_ > 5).headOption` which will also return an `Option` or swapping `headOption` for `head` (highly discouraged) which will throw an exception if nothing is found. | As @Aivean noted:
```
scala> List(1,2,3,4,5,6,7,8,9,10).view.find(_ > 5)
res0: Option[Int] = Some(6)
```
See these questions:
[In Scala, what does "view" do?](https://stackoverflow.com/questions/6799648/in-scala-what-does-view-do)
[What is the difference between the methods iterator and view?](https://stackoverflo... |
4,302,623 | I am trying to get grid on view, for this I am using the jqgrid. and my action controller methods is returning me json data. I want to pick this data up in the 'var. in jquery. I am using asp.net mvc. how can i get this I tried :
```
$.getJSON(url:gridDataUrl,{}, function(jsonData) {
alert(jsonData);
});
);
```
W... | 2010/11/29 | [
"https://Stackoverflow.com/questions/4302623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/165309/"
] | The [`$.getJSON()`](http://api.jquery.com/jQuery.getJSON/) method signature is
```
jQuery.getJSON(url, [data], [callback(data, textStatus, xhr)])
```
...so it should look like this:
```
$.getJSON(gridDataUrl, function(jsonData) {
alert(jsonData);
});
```
Note that the first param is the URL as just a string (n... | ```
$.getJSON("@Url.Action("Search")", $("#jsonform").serialize(), function (data) {
$("#results").html("");
$("#phoneTemplate").tmpl(data).appendTo("#results");
});
return false;
});
```
I use this code along with template plugin for jquery to get json data from an action and render it on the client.
are y... |
50,000,163 | Unable to redirect to different page. It throws the following error:
>
> Error: Cannot match any routes. URL Segment:
> 'cart-items/448511.16099990235'
>
>
>
Can somebody help?
This is in my app.routing.ts
```
//....
{
path: 'cart-items/:id',
component: CartComponent
}
//....
```
This is my html
```
<a c... | 2018/04/24 | [
"https://Stackoverflow.com/questions/50000163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8937599/"
] | try
```
[routerLink] = " 'cart-items/' + randomUserId"
```
or
```
routerLink = "cart-items/{{card.id}}"
``` | You should remove href,
```
<a class="btn btn-success btn-sm ml-3" [routerLink]="['/cart-items', randomUserId]"> ... </a>
``` |
50,000,163 | Unable to redirect to different page. It throws the following error:
>
> Error: Cannot match any routes. URL Segment:
> 'cart-items/448511.16099990235'
>
>
>
Can somebody help?
This is in my app.routing.ts
```
//....
{
path: 'cart-items/:id',
component: CartComponent
}
//....
```
This is my html
```
<a c... | 2018/04/24 | [
"https://Stackoverflow.com/questions/50000163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8937599/"
] | try
```
[routerLink] = " 'cart-items/' + randomUserId"
```
or
```
routerLink = "cart-items/{{card.id}}"
``` | I think issue is because there is `.` in your params so in order to redirect use navigateByUrl from your controller side like this
```
this._router.navigateByUrl('/cart-items/' + randomUserId)
```
Refer here for more info
* <https://github.com/angular/angular/issues/8249> |
50,000,163 | Unable to redirect to different page. It throws the following error:
>
> Error: Cannot match any routes. URL Segment:
> 'cart-items/448511.16099990235'
>
>
>
Can somebody help?
This is in my app.routing.ts
```
//....
{
path: 'cart-items/:id',
component: CartComponent
}
//....
```
This is my html
```
<a c... | 2018/04/24 | [
"https://Stackoverflow.com/questions/50000163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8937599/"
] | try
```
[routerLink] = " 'cart-items/' + randomUserId"
```
or
```
routerLink = "cart-items/{{card.id}}"
``` | you code looks ok just remove `href="javascript:void(0)"` and try like this
```
<a class="btn btn-success btn-sm ml-3"
[routerLink]=" ['/cart-items', randomUserId]"> ... </a>
```
seems like issue with the value you are passing which is `448511.16099990235`, which contains `.` i.e. decimal value
are you sure on... |
48,736,243 | I am trying to Select everything from two tables and display them through JSON. Here is my shot at trying that:
```
<?php
// Create connection
$conn = new mysqli("localhost", "root", "****", "user");
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Getting the received JSON int... | 2018/02/11 | [
"https://Stackoverflow.com/questions/48736243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8585896/"
] | I know you mentioned it in your question, but it bears repeating- this is vulnerable to SQL injections because you are referencing user input from the `$_GET` array directly in your SQL query without first sanitizing it or, better, using prepared statements.
`$result = $conn->query($sql, $usql);`
The [`mysqli::quer... | Try this
```
<?php
//$conn = ... connect to database
$sql = "SELECT * FROM users WHERE username = '$username'";
$usql = "SELECT * FROM user_images WHERE username = '$username'";
$queryTableOne = mysqli_query($conn, $sql);
$queryTableTwo = mysqli_query($conn, $usql);
$json = mysqli_fetch_array($queryTableOne, MYS... |
144,035 | I was needing to reinforce 5 shelf bookcase that was leaning to one side and had sagging bookshelves. I had read about using 1/8 inch plywood/hardboard, but it seems to me that it would be too flimsy. Wouldn’t it need 1/4 inch material?It is leaning over a few inches based on how unlevel bottom set of doors are. | 2018/07/27 | [
"https://diy.stackexchange.com/questions/144035",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/55420/"
] | The backing doesn't need to be very thick to prevent the deformation (parallelogramming) you are seeing because it works by tension rather than compression. The edges of heavier backing would show more and require molding to cover them. Lay the shelf unit down on its front, square it up and use small brads or fine fini... | The back will hold the case square by virtue of compression AND tension. All you need to do is attach a single wood strip diagonally to opposite corners (compression and tension). That is all. Or instead, attach two wires, each diagonally to opposite corners to form an X (tension only). Or cut open a large garbage bag ... |
35,934,061 | I have some interfaces in my angular2 application. One of them is for the products that I fetch from a remote API.
My interface:
```
export interface Product {
id: number;
name: string;
}
```
When fetching products in my service I do something like this:
```
this.http.get(productsUrl).map(res => <Product>r... | 2016/03/11 | [
"https://Stackoverflow.com/questions/35934061",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1221132/"
] | Sounds like a bug in Android Studio. If you want to file a bug report, there are some instructions for doing so [here](http://tools.android.com/filing-bugs/studio). You can always [download the NDK](http://developer.android.com/ndk/downloads/index.html) separately and move it to the ndk-bundle location manually. | Tried it again, this time with Android Studio 2.1. It got stuck again at some .h file. I left it the way it was and after about 30 minutes, the unzipping was successfully completed and the NDK was updated.
I keep having the similar issue everytime I update NDK. You might have to wait for upto 2 hours, but it does gets... |
17,320,788 | How could functions similar to PHP's `explode` and `implode` be implemented with APL?
I tried to work it out myself and came up with a solution which I'm posting below. I'd like to see other ways that this might be solved. | 2013/06/26 | [
"https://Stackoverflow.com/questions/17320788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634046/"
] | **Explode:**
Given the following text string and delimiter string:
```
F←'CAT BIRD DOG'
B←' '
```
Explode can be accomplished as follows:
```
S←⍴,B
P←(⊃~∨/(-S-⍳S)⌽¨S⍴⊂B⍷F)⊂F
P[2] ⍝ returns BIRD
```
**Limitations:**
PHP's explode function returns a null array value when two delimiters are adjacent to each other.... | An interesting alternative for implode can be accomplished with reduction:
```
p←'cat' 'bird' 'dog'
↑{⍺,'-',⍵}/p
cat-bird-dog
```
This technique does not need to explicitly reference the shape of the delimiter.
And an interesting alternative to explode can be done with n-wise reduction:
```
f←'CA... |
17,320,788 | How could functions similar to PHP's `explode` and `implode` be implemented with APL?
I tried to work it out myself and came up with a solution which I'm posting below. I'd like to see other ways that this might be solved. | 2013/06/26 | [
"https://Stackoverflow.com/questions/17320788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634046/"
] | Pé, the quest for "short" and/or "elegant" solutions to standard-problems in APL is older than PHP and even older than new terminology, such as "explode", "implode" (I think - but I must admit I do not know how old these terms really are...). Anyway, the early APL guys used the term "idiom" for such "solutions to stand... | **Explode:**
Given the following text string and delimiter string:
```
F←'CAT BIRD DOG'
B←' '
```
Explode can be accomplished as follows:
```
S←⍴,B
P←(⊃~∨/(-S-⍳S)⌽¨S⍴⊂B⍷F)⊂F
P[2] ⍝ returns BIRD
```
**Limitations:**
PHP's explode function returns a null array value when two delimiters are adjacent to each other.... |
17,320,788 | How could functions similar to PHP's `explode` and `implode` be implemented with APL?
I tried to work it out myself and came up with a solution which I'm posting below. I'd like to see other ways that this might be solved. | 2013/06/26 | [
"https://Stackoverflow.com/questions/17320788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634046/"
] | Pé, the quest for "short" and/or "elegant" solutions to standard-problems in APL is older than PHP and even older than new terminology, such as "explode", "implode" (I think - but I must admit I do not know how old these terms really are...). Anyway, the early APL guys used the term "idiom" for such "solutions to stand... | An interesting alternative for implode can be accomplished with reduction:
```
p←'cat' 'bird' 'dog'
↑{⍺,'-',⍵}/p
cat-bird-dog
```
This technique does not need to explicitly reference the shape of the delimiter.
And an interesting alternative to explode can be done with n-wise reduction:
```
f←'CA... |
27,663,617 | I have the following script :
```
public void addcheese(int addcheese) {
if (cheeseamount + addcheese < mincapacity) {
System.out.println("Sorry no more cheese can be removed.");
} else if (cheeseamount + addcheese <= maxcapacity) {
if ((cheeseamount + addcheese > 1900) && (cheeseamount + addc... | 2014/12/27 | [
"https://Stackoverflow.com/questions/27663617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Here is a solution:
```
public void addcheese(int addcheese)
{
final int target = cheeseamount + addcheese;
if (target < mincapacity) {
System.out.println("Sorry, no cheese can be removed");
return;
}
if (target >= maxcapacity) {
cheeseamount = maxcapacity;
System.out... | Add another if else with this condition:
```
else if (cheeseamount != maxcapacity && cheeseamount + addcheese > maxcapacity) {
cheeseamount = maxcapacity;
System.out.println("Warning : The box just reached it's maximum capacity.");
}
``` |
27,663,617 | I have the following script :
```
public void addcheese(int addcheese) {
if (cheeseamount + addcheese < mincapacity) {
System.out.println("Sorry no more cheese can be removed.");
} else if (cheeseamount + addcheese <= maxcapacity) {
if ((cheeseamount + addcheese > 1900) && (cheeseamount + addc... | 2014/12/27 | [
"https://Stackoverflow.com/questions/27663617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Here is a solution:
```
public void addcheese(int addcheese)
{
final int target = cheeseamount + addcheese;
if (target < mincapacity) {
System.out.println("Sorry, no cheese can be removed");
return;
}
if (target >= maxcapacity) {
cheeseamount = maxcapacity;
System.out... | One way to accomplish this is by modifying your else statement. In the else statement you can simply set the amount of cheese to the maximum amount, essentially adding as much cheese as possible and discarding the rest:
```
else {
cheeseamount = 2000;
System.out.println("This storage box has no... |
53,228 | I have a 2Tb+ SAP database with 8 datafiles, the first files have grown to fill the available disk space on our HP EVA5000, and the growth is now on the new files.
We upgraded SQL from SQL server 2000 to 2005 and Checkdb works differently, and now fails with no space to create snapshot. We have added 50Gb to each file ... | 2009/08/12 | [
"https://serverfault.com/questions/53228",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | Ooh I just read this last night in SQL Server 2008 Internals book (thanks Paul Randal). If it runs out of space the snapshot gets deleted. What I mean is in SQL 2005+ the internal engine is actually creating a snapshot behind the scenes and running checkdb against that. You can't access this snapshot as its invisible t... | Take a look at this article on Paul's blog which answers your questions:
<http://www.sqlskills.com/BLOGS/PAUL/post/CHECKDB-From-Every-Angle-Why-would-CHECKDB-run-out-of-space.aspx> |
19,287,267 | Suppose there is a test script that is being executed and an error occurs, can someone explain how QTP detects that it is an error? Basically I want to know how QTP detects this error? Eg: Maybe some variable that is continuously monitered to check whether an error has occured.
I looked at Err.Number, but that is modi... | 2013/10/10 | [
"https://Stackoverflow.com/questions/19287267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1174848/"
] | This may be of limited use to you since I'm effectively saying "write your own test execution engine", but it's perfectly achievable. Just start small and build up the features piece by piece, and you'll have something cool that meets your own unique needs in no time.
Whilst it's perhaps useful to have the error that ... | QTP reports that a test execution failed in one of the following situations
* An object that should perform an action cannot be identified
* When executing an action the action fails (e.g. illegal value)
* A checkpoint fails, this means the test creator specified a state the application should have and it actually has... |
25,505,094 | I need to create a batch file to create a folder from substring of a filename
example filename : txt\_abc\_123
create a folder with the name between "\_" (abc)
and the filename with (123)
any help will be much appreciated. | 2014/08/26 | [
"https://Stackoverflow.com/questions/25505094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3978791/"
] | In theory this might work:
```
ALTER TABLE [dbo].[Table1] WITH NOCHECK ADD
CONSTRAINT [FK_Table1_ScenarioResult]
FOREIGN KEY ([ScenarioResultID]) REFERENCES [dbo].[ScenarioResult] ([ScenarioResultID])
ON DELETE CASCADE
```
Not sure how you checked for integrity of existing values, but it should be:
```
SELECT COU... | This one was baffling me aswell, and then the penny dropped.
I was trying to create a Foreign Key using "Database Diagrams" in SQL Server 2012, but it refused to let me as it claimed to clash with the foreign key I was trying to create. Huh ?
But, I had accepted the defaults to "**Enforce foreign key constraint**". B... |
25,505,094 | I need to create a batch file to create a folder from substring of a filename
example filename : txt\_abc\_123
create a folder with the name between "\_" (abc)
and the filename with (123)
any help will be much appreciated. | 2014/08/26 | [
"https://Stackoverflow.com/questions/25505094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3978791/"
] | In theory this might work:
```
ALTER TABLE [dbo].[Table1] WITH NOCHECK ADD
CONSTRAINT [FK_Table1_ScenarioResult]
FOREIGN KEY ([ScenarioResultID]) REFERENCES [dbo].[ScenarioResult] ([ScenarioResultID])
ON DELETE CASCADE
```
Not sure how you checked for integrity of existing values, but it should be:
```
SELECT COU... | I had the same issue
I clear the data of the tables where i want to edit the content and add a new foreign key constraint and retry.
It works for me.
I hope it help you. |
142,603 | Do continuous maps necessarily preserve topological invariants? Or is it necessary for the maps to be homeomorphisms? Are there simple examples where continuous maps do not preserve these invariants? | 2012/05/08 | [
"https://math.stackexchange.com/questions/142603",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/30884/"
] | Note that there is a continuous map from any topological space to a single point, so no invariant that can distinguish non-points from points will be preserved in general. A homeomorphism will preserve every invariant (by the definition of invariant, as pointed out by lhf).
However, many topological invariants (such a... | A [topological invariant](http://en.wikipedia.org/wiki/Topological_property) is usually defined as a property preserved under homeomorphisms.
There are topological properties, such as compactness and connectedness, that are preserved even under continuous functions.
Not all topological properties are preserved under ... |
25,724,196 | Well, this question may be done due to my poor understanding of the job of the delegates.
Using the model/view framework. I have made several derived delegates till now, but what I need right now is to get a select-option-delegate (for example a combobox) to show as options the data saved on a column of my QTableMode... | 2014/09/08 | [
"https://Stackoverflow.com/questions/25724196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2348235/"
] | When users lock phone or switch to another app your app executes `Application_Deactivated` and when it comes back to foreground it executes `Application_Activated` (In your `App` class).
You can save last activation time in `Application_Deactivated` and check if it is 20mins later in `Application_Activated`.
**EDIT:*... | You can use the `App.RootFrame`'s `Unobscured` event for this. Attach the event handler like this in your MainPage.xaml
```
App.RootFrame.Unobscured += RootFrame_Unobscured;
```
And in the event handler navigate to the page.
```
void RootFrame_Unobscured(object sender, EventArgs e)
{
NavigationService.Naviga... |
3,252 | My LHBS sells whole hops, hop pellets, and hop plugs. Is there a way to know which this recipe calls for, and is there some sort of conversion formula between the different forms?
<http://lancasterhomebrew.com/2010/06/bells-hopslam-clone-recipe/> | 2011/01/24 | [
"https://homebrew.stackexchange.com/questions/3252",
"https://homebrew.stackexchange.com",
"https://homebrew.stackexchange.com/users/-1/"
] | [This](https://homebrew.stackexchange.com/questions/3111/why-do-all-my-beers-taste-better-after-having-aged-for-a-couple-months/3118#3118) answers your question. Your beer is young and very green. It needs time to age. Don't despair. Give it time, both to carbonate in the bottle and age a bit after that.
Many home br... | A lot happens during carbonation. I just finished an ESB batch that was intensely bitter before carbonation, but tastes quite fine now. Bottle it up and see what happens. |
231,433 | Is it possible to tile an image in the *Compositor*? I would like to use the compositor to tile an image and preview in live what the final "tiled" render will be like.
[](https://i.stack.imgur.com/SqHM8.png)
**EDIT2:**
As noted in @ayoreis's comment... | 2021/07/23 | [
"https://blender.stackexchange.com/questions/231433",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/36625/"
] | Seems to be working fine for me ...
[](https://i.stack.imgur.com/d9kWN.png)
Note: in a case you want to fit tiles into *Render Dimension* ...
* ad *Scale* node, switch to *Render Size* and
* use *Mix* node to combine outputs of Scale node and Transf... | You can do "something" like tiling like this:
[](https://i.stack.imgur.com/pqsuL.jpg) |
231,433 | Is it possible to tile an image in the *Compositor*? I would like to use the compositor to tile an image and preview in live what the final "tiled" render will be like.
[](https://i.stack.imgur.com/SqHM8.png)
**EDIT2:**
As noted in @ayoreis's comment... | 2021/07/23 | [
"https://blender.stackexchange.com/questions/231433",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/36625/"
] | I have used this node setup many times.
You could even make a custom node to control it better.
[](https://i.stack.imgur.com/eD7zy.png) | You can do "something" like tiling like this:
[](https://i.stack.imgur.com/pqsuL.jpg) |
231,433 | Is it possible to tile an image in the *Compositor*? I would like to use the compositor to tile an image and preview in live what the final "tiled" render will be like.
[](https://i.stack.imgur.com/SqHM8.png)
**EDIT2:**
As noted in @ayoreis's comment... | 2021/07/23 | [
"https://blender.stackexchange.com/questions/231433",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/36625/"
] | Seems to be working fine for me ...
[](https://i.stack.imgur.com/d9kWN.png)
Note: in a case you want to fit tiles into *Render Dimension* ...
* ad *Scale* node, switch to *Render Size* and
* use *Mix* node to combine outputs of Scale node and Transf... | I have used this node setup many times.
You could even make a custom node to control it better.
[](https://i.stack.imgur.com/eD7zy.png) |
39,871,669 | [2 images of same icon with different color](http://i.stack.imgur.com/4xPhe.png)
We have to achieve the loading effect like the image attached below.
[Result Image](http://i.stack.imgur.com/pHcdJ.png) | 2016/10/05 | [
"https://Stackoverflow.com/questions/39871669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5644410/"
] | Worked it out. The reporter was using the globally built reporter.js file (in AppData folder), not the one inside the plugin folder. All I needed was to print the results just before the *"return output;"* statement. Looking something like;
```
var d = new Date();
var fileDate = (d.getMonth()+1)+'-'+d.getDate()+'-'+d.... | I don't think that previous solution was a good practice because of changing the webdriverio itself. Now I'm using **json-reporter** which makes parsing information very easy and logs everything needed |
27,524,248 | I'm in an interesting conundrum.
In my app, I am using a recursive `<script>` which is referred to in my main page via an `ng-include`:
```
<div ng-include="'theTemplate.html'" onload="one=features.items.one"></div>
```
The data for `features.items.one` is loaded via external api using `$http` and is set when the `... | 2014/12/17 | [
"https://Stackoverflow.com/questions/27524248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1675976/"
] | Extending my comment:
```
<div ng-if="your condition">
<div ng-include="'theTemplate.html'" onload="one=features.items.one"></div>
</div>
``` | Use a controller, and consider refactoring to a service in due course
```
<div ng-include="'theTemplate.html'" ng-controller="myCtrl"></div>
```
and then add a controller
```
xxx.controller('myCtrl', function($scope, Features) {
$http request.then(function(data) {
$scope.one = data.items.one;
})
})
``` |
34,610,415 | How can I increase the height of the banner on click of
After clicking again it should go to less mode. | 2016/01/05 | [
"https://Stackoverflow.com/questions/34610415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5747163/"
] | You can make `.sqBan` `display:none;` and use `show()` and `hide()` in jQuery, or use `toggle()`.
```js
$(document).ready(function(){
$('.moreBan').click(function(){
$('.sqBan').toggleClass('expand');
});
});
```
```css
.sqBan {height:50px;background:indianred;transition:height .3s linear;}
.sqBan.expand... | Define a CSS class which sets the larger height and then use `toggleClass()` to turn it on and off. Try this:
```js
$('.moreBan').click(function() {
$('.sqBan').toggleClass('large');
});
```
```css
.sqBan {
background-color: #C00;
}
.large {
height: 100px;
}
```
```html
<script src="https://ajax.googlea... |
26,346,164 | Suppose I have a class called `NodeList` with two fields, called `value` (type `Object`) and `index` (type `int`). `NodeList` implements an interface called `Copiable`, with a single method called `copyNotSyncronized()`.
I want the `NodeList` version of `copyNotSincronyzed()` to recognize if `this.value` implements `... | 2014/10/13 | [
"https://Stackoverflow.com/questions/26346164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3854176/"
] | this.value is of type `Object`. And you are trying to put it into a type `Class<T implements Copiable>`. The compiler does not know how to do that so you are getting a compilation error.
In order to make this check you should use the instanceof operator, combine with a cast, like this:
```
if (this.value instanceof C... | An interface is a type, like a class. Therefore, when another class implements it, any object of that class can be used polymorphically as that interface.
Which means that you can check if that object implements that interface simply by using `x instanceof Y`. It's an operator that tells you whether x "is a" Y, and Y ... |
26,346,164 | Suppose I have a class called `NodeList` with two fields, called `value` (type `Object`) and `index` (type `int`). `NodeList` implements an interface called `Copiable`, with a single method called `copyNotSyncronized()`.
I want the `NodeList` version of `copyNotSincronyzed()` to recognize if `this.value` implements `... | 2014/10/13 | [
"https://Stackoverflow.com/questions/26346164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3854176/"
] | this.value is of type `Object`. And you are trying to put it into a type `Class<T implements Copiable>`. The compiler does not know how to do that so you are getting a compilation error.
In order to make this check you should use the instanceof operator, combine with a cast, like this:
```
if (this.value instanceof C... | Java has an interface `Clonable` that lets you clone unlinked (unsynchronized) objects through a method `Object clone()`. There is a lot of controversy around this and the bottomline is that it's discouraged.
A widely accepted way of creating copies of objects is by using a *copy-constructor*. This will not work for g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.