qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
70,064,813 | I am making an object rotate with the rotation angle of the hand. It is working well and I am able to rotate the 3D model object. Unfortunately now I only want the object to rotate in its z-axis. I am trying to use `Quaternion.Euler (0, 0, rot.eulerAngles.z);` but does not work and the model rotates in all 3 axes. How ... | 2021/11/22 | [
"https://Stackoverflow.com/questions/70064813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17455643/"
] | The problems that I noticed:
1. main: `scanf("%s",&str);` is the wrong type for `str` (`char (*)[100]`) and should be `scanf("%s", str);`. `char str[100]` uses a magic 100 value, instead `#define STR_LEN 99` so you can do `char str[STR_LEN + 1]`. The way you use `scanf` is subject to buffer overflow instead you should... | As advised, always ensure that your local variables are initialized before attempting to use them. As for your problem, if your sole desire is to find duplicate strings then you could approach it this way:-
```
#include<stdio.h>
#define CHAR_SIZE 100
int length(char[]);
void duplicate(char[], int);
// Finding the dup... |
66,903,281 | Hey guys so I am new to OOP and trying to make my first OOP program. But then I encountered a problem. I don't know why the values hasn't changed even though I put a variable on the parameter of the constructor.
Here is my code:
```
public class Phone {
public static void main(String[] args) {
addContact... | 2021/04/01 | [
"https://Stackoverflow.com/questions/66903281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14848183/"
] | The problem is that you're creating a new `Contacts` in each method, which means a `Contacts` is born in that method and dies when the method ends.
A possible solution is to create a `static` `Contacts` variable in `Phone`. It's important that it is declared as `static` because you'll then use it in `static` methods.
... | Use like below,
```
public class MyClass {
Contact contact = null;
public static void main(String[] args) {
addContact();
viewContact();
}
private void addContact() {
//your scanner logic to get input goes here
....
contact = new Contact(name, number);
}
private void viewContact() {... |
33,524,758 | I'm new with Angular and wanted to know how can I handle the following issue :
```
<input class="form-control" type="text" value="{{add_item.value}}" onfocus="this.value=''" onblur="this.value={{add_item.value}}">
```
of course this doesn't work.
I would like to get back the first value onblur if the input is empty... | 2015/11/04 | [
"https://Stackoverflow.com/questions/33524758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4249374/"
] | You have to rethink the problem, this could be a possible solution:
```
public class Recursion1 {
private static int endValue;
private static int startValue = 1 ;
public Recursion1(int endValue){
Recursion1.endValue = endValue;
}
public static void main(String[] args) {
Recursion1 me = new Recursion1(4);
... | I would recommend to keep the creation of the resulting `String` separate from printing. That would allow you to do anything else you want with the result and it's likely to be more efficient. Also for efficiency, `StringBuilder` is recommended as it avoids creating and discarding many `String` objects. Also for effici... |
1,325,380 | So I have a Perl class. It has a `sort()` method, and I want it to be more or less identical to the built-in `sort()` function:
```
$object->sort(sub ($$) { $_[0] <=> $_[1] });
```
But I can't do:
```
$object->sort(sub { $a <=> $b });
```
Because of scoping. But the List::Util module does this with `reduce()`. I ... | 2009/08/24 | [
"https://Stackoverflow.com/questions/1325380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60777/"
] | You could use [Sub::Identify](http://search.cpan.org/perldoc?Sub::Identify) to find out the package (which it calls `stash_name`) associated with the coderef. Then set $a and $b in that package as required. You may need to use `no strict 'refs'` in your method to get that to work.
Here's Evee's answer modified to work... | You can use [the `local` operator](http://perldoc.perl.org/functions/local.html) to set values for `$a` and `$b` for the duration of the subroutine call:
```
sub sample
{
my $callback = shift;
for (my $i = 0; $i < @_; $i += 2) {
local ($a, $b) = @_[$i, $i + 1];
$callback->();
}
}
sa... |
1,325,380 | So I have a Perl class. It has a `sort()` method, and I want it to be more or less identical to the built-in `sort()` function:
```
$object->sort(sub ($$) { $_[0] <=> $_[1] });
```
But I can't do:
```
$object->sort(sub { $a <=> $b });
```
Because of scoping. But the List::Util module does this with `reduce()`. I ... | 2009/08/24 | [
"https://Stackoverflow.com/questions/1325380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60777/"
] | Well, the other two answers are both half-right. Here's a working solution that actually sorts:
```
package Foo;
use strict;
use warnings;
sub sort {
my ($self, $sub) = @_;
my ($pkg) = caller;
my @x = qw(1 6 39 2 5);
print "@x\n";
{
no strict 'refs';
@x = sort {
local... | You can use [the `local` operator](http://perldoc.perl.org/functions/local.html) to set values for `$a` and `$b` for the duration of the subroutine call:
```
sub sample
{
my $callback = shift;
for (my $i = 0; $i < @_; $i += 2) {
local ($a, $b) = @_[$i, $i + 1];
$callback->();
}
}
sa... |
1,325,380 | So I have a Perl class. It has a `sort()` method, and I want it to be more or less identical to the built-in `sort()` function:
```
$object->sort(sub ($$) { $_[0] <=> $_[1] });
```
But I can't do:
```
$object->sort(sub { $a <=> $b });
```
Because of scoping. But the List::Util module does this with `reduce()`. I ... | 2009/08/24 | [
"https://Stackoverflow.com/questions/1325380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60777/"
] | Well, the other two answers are both half-right. Here's a working solution that actually sorts:
```
package Foo;
use strict;
use warnings;
sub sort {
my ($self, $sub) = @_;
my ($pkg) = caller;
my @x = qw(1 6 39 2 5);
print "@x\n";
{
no strict 'refs';
@x = sort {
local... | You could use [Sub::Identify](http://search.cpan.org/perldoc?Sub::Identify) to find out the package (which it calls `stash_name`) associated with the coderef. Then set $a and $b in that package as required. You may need to use `no strict 'refs'` in your method to get that to work.
Here's Evee's answer modified to work... |
33,079,241 | I am developing an app where I want to update the value of the particular product count.
1.In main menu there are sliding tabs, where I will be having list of products with plus and minus to add that particular product to the cart.I am preserving the count using singleton class.
2.Now I am clicking on the search butt... | 2015/10/12 | [
"https://Stackoverflow.com/questions/33079241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4322958/"
] | I Got answer.
I wrote `'modules'=>[...]` inside `'components'=>[...]`, which was wrong.
Now, **config/web.php**
```
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'components' => [
.
.
.
],
'modules' => [
'user' => [
'class' => 'dektrium\user\Mod... | If u rewrote user model and ['/user/security/login'] redirecting to '/user/login' with 404, open web config and look for 'urlManager' component.
If you have enblePrettyUrl on, look on rules.
The problem is there - change it or delete. |
2,994,249 | Okay, a before;
```
Array (
'home' => array('order' => 1),
'about' => array(),
'folio' => array('order' => 2),
'folio/web' => array('order' => 2),
'folio/print' => array('order' => 1)
'contact' => array('order' => 2)
)
```
And a desired after;
```
Array (
'home' => array('order' => 1),
... | 2010/06/08 | [
"https://Stackoverflow.com/questions/2994249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247223/"
] | I believe I figured it out...
```
s --> x.
s --> a,d.
s --> a,s,d.
x --> [].
x --> b,b,x,c,c.
a --> [a].
b --> [b].
c --> [c].
d --> [d].
?- s([],[]).
Yes
?- s([a,b,c,c,d],[]).
No
?- s([a,a,a,b,b,c,c,d,d,d],[]).
Yes
```
It's amusing to look at the solution and think, "I racked my brain over *that*?" But I guess... | How about something like:
```
n(L,N) --> n(L,N,0).
n(_,N,N) --> [], !.
n(L,N,K) --> L, {K1 is K + 1}, n(L, N, K1).
abbccd(N,M) -->
{M1 is 2*M},
n("a",N),
n("b",M1),
n("c",M1),
n("d",N).
gen :-
forall((
between(1,4,N),
between(1,4,M),
phrase(abbccd(N,M),S),
... |
2,994,249 | Okay, a before;
```
Array (
'home' => array('order' => 1),
'about' => array(),
'folio' => array('order' => 2),
'folio/web' => array('order' => 2),
'folio/print' => array('order' => 1)
'contact' => array('order' => 2)
)
```
And a desired after;
```
Array (
'home' => array('order' => 1),
... | 2010/06/08 | [
"https://Stackoverflow.com/questions/2994249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247223/"
] | @Timothy, your answer works, but it generates duplicates:
```
?- length(S,_), s(S,[]).
S = [] ;
S = [a, d] ;
S = [a, d] ; % XXX
S = [b, b, c, c] ;
S = [a, a, d, d] ;
S = [a, a, d, d] ; % XXX
```
This can be fixed by removing one clause, leaving the DCG:
```
s --> x.
s --> a,s,d.
x --> [].
x --> b,b... | How about something like:
```
n(L,N) --> n(L,N,0).
n(_,N,N) --> [], !.
n(L,N,K) --> L, {K1 is K + 1}, n(L, N, K1).
abbccd(N,M) -->
{M1 is 2*M},
n("a",N),
n("b",M1),
n("c",M1),
n("d",N).
gen :-
forall((
between(1,4,N),
between(1,4,M),
phrase(abbccd(N,M),S),
... |
2,994,249 | Okay, a before;
```
Array (
'home' => array('order' => 1),
'about' => array(),
'folio' => array('order' => 2),
'folio/web' => array('order' => 2),
'folio/print' => array('order' => 1)
'contact' => array('order' => 2)
)
```
And a desired after;
```
Array (
'home' => array('order' => 1),
... | 2010/06/08 | [
"https://Stackoverflow.com/questions/2994249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247223/"
] | @Timothy, your answer works, but it generates duplicates:
```
?- length(S,_), s(S,[]).
S = [] ;
S = [a, d] ;
S = [a, d] ; % XXX
S = [b, b, c, c] ;
S = [a, a, d, d] ;
S = [a, a, d, d] ; % XXX
```
This can be fixed by removing one clause, leaving the DCG:
```
s --> x.
s --> a,s,d.
x --> [].
x --> b,b... | I believe I figured it out...
```
s --> x.
s --> a,d.
s --> a,s,d.
x --> [].
x --> b,b,x,c,c.
a --> [a].
b --> [b].
c --> [c].
d --> [d].
?- s([],[]).
Yes
?- s([a,b,c,c,d],[]).
No
?- s([a,a,a,b,b,c,c,d,d,d],[]).
Yes
```
It's amusing to look at the solution and think, "I racked my brain over *that*?" But I guess... |
15,590,449 | I created a stored procedure to search my database by name. I have many text files saved in database named like: a.txt, a1.txt,a2.txt,a3.txt,...
When i run my stoerd procedure only 1 resoult is showing.
```
SELECT * FROM cars WHERE name LIKE CONCAT ('%', search ,'%');
```
What is the problem here? | 2013/03/23 | [
"https://Stackoverflow.com/questions/15590449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1309089/"
] | Your problem solution is
```
SELECT * FROM cars WHERE name LIKE CONCAT ('%'. $search . '%');
```
or if you are using directly then on sql server then
```
SELECT * FROM cars WHERE name LIKE CONCAT ('%search%');
``` | If `$search` (note the dollar sign) is a PHP variable (I assume that because you tagged the question with "php"), you don't have to use the SQL function `CONCAT` but join the strings in PHP and send it all to MySQL:
```
$sql = 'SELECT * FROM cars WHERE name LIKE "%'.$search.'%"';
```
That's because `CONCAT` will mak... |
15,590,449 | I created a stored procedure to search my database by name. I have many text files saved in database named like: a.txt, a1.txt,a2.txt,a3.txt,...
When i run my stoerd procedure only 1 resoult is showing.
```
SELECT * FROM cars WHERE name LIKE CONCAT ('%', search ,'%');
```
What is the problem here? | 2013/03/23 | [
"https://Stackoverflow.com/questions/15590449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1309089/"
] | Your problem solution is
```
SELECT * FROM cars WHERE name LIKE CONCAT ('%'. $search . '%');
```
or if you are using directly then on sql server then
```
SELECT * FROM cars WHERE name LIKE CONCAT ('%search%');
``` | try this
```
SELECT * FROM cars WHERE name LIKE '%$search%' ;
```
or this
```
WHERE name LIKE '$search'
``` |
4,964,475 | Is there any way to ignore a directory when you push remotely? The catch is I don't want to ignore it. I still want to track the directory, and have local commits and branches for it. Say, I'm working on a project that relies on a database. This project does not have transitional schema or anything. It is populated wit... | 2011/02/11 | [
"https://Stackoverflow.com/questions/4964475",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/119301/"
] | It's possible to ignore files from inclusion to your repository by adding them to the .gitignore file -- but I don't think that's what you want.
Try this: <http://book.git-scm.com/4_ignoring_files.html> | Why not track the database in a separate repository without a remote branch?
(Note that if you never push remotely, you wont have a backup if your hard drive fails.) |
4,964,475 | Is there any way to ignore a directory when you push remotely? The catch is I don't want to ignore it. I still want to track the directory, and have local commits and branches for it. Say, I'm working on a project that relies on a database. This project does not have transitional schema or anything. It is populated wit... | 2011/02/11 | [
"https://Stackoverflow.com/questions/4964475",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/119301/"
] | When you push a given branch, you push the commits on that branch. If those commits include the contents of a given directory, you will be pushing that content.
Your two options are:
* Keep that directory on a branch (or branches) which are never merged into the branches you push. You can still merge other changes in... | Why not track the database in a separate repository without a remote branch?
(Note that if you never push remotely, you wont have a backup if your hard drive fails.) |
4,964,475 | Is there any way to ignore a directory when you push remotely? The catch is I don't want to ignore it. I still want to track the directory, and have local commits and branches for it. Say, I'm working on a project that relies on a database. This project does not have transitional schema or anything. It is populated wit... | 2011/02/11 | [
"https://Stackoverflow.com/questions/4964475",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/119301/"
] | When you push a given branch, you push the commits on that branch. If those commits include the contents of a given directory, you will be pushing that content.
Your two options are:
* Keep that directory on a branch (or branches) which are never merged into the branches you push. You can still merge other changes in... | It's possible to ignore files from inclusion to your repository by adding them to the .gitignore file -- but I don't think that's what you want.
Try this: <http://book.git-scm.com/4_ignoring_files.html> |
4,489,703 | I am new to Spring.
We are using spring security feature.
Database connectivity: eclipselink implementation of JPA.
Database: MySql
While using spring security, Configuration of authentication provider is as follows,-
```
<authentication-provider>
<jdbc-user-service id="userDetailsService" data-source-ref="Data... | 2010/12/20 | [
"https://Stackoverflow.com/questions/4489703",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/548611/"
] | Basically you probably need to [implement `UserDetailsService` yourself](http://static.springsource.org/spring-security/site/docs/3.0.x/reference/technical-overview.html#d0e1588).
So you would for example have a `User` entity, and your [`UserDetailsService`](http://static.springsource.org/spring-security/site/docs/3.0... | An easier way for authentication in your case is to get one of your service layer classes implement `org.springframework.security.core.userdetails.UserDetailsService` interface. This interface contain only one method `UserDetails loadUserByUsername(String username)`. You have to make sure that you return a `UserDetails... |
416,764 | >
> Show that an algebraically closed field must be infinite.
>
>
>
**Answer**
If F is a finite field with elements $a\_1, ... , a\_n$ the polynomial $f(X)=1 + \prod\_{i=1}^n (X - a\_i)$ has no root in F, so F cannot be algebraically closed.
**My Question**
Could we not use the same argument if F was countably... | 2013/06/10 | [
"https://math.stackexchange.com/questions/416764",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | We can't, because $\prod\_{i=1}^\infty (X-a\_i)$ is not a polynomial. Infinite combinations of finitary operations are not defined; when we do talk about them, what is really going on is that we are taking some sort of limit, but to do that we need topology to be present, and even then, the infinitary operation will be... | Since there are a countable number of polynomials over $\mathbb Q$, the roots of those polynomials are also countable (countable union of finite sets is countable).
The sum and product of elements algebraic over $\mathbb Q$ are both algebraic over $\mathbb Q$.
An element which is algebraic over an algebraic extension... |
73,733,257 | suppose that I have the two functions below:
```
def copy(src, dst) -> bool
"copy src to dst return True if succeed else False"
def delete(src) -> bool
"delete src return True if succeed else False"
```
src and dst can be complicated Objects, not just generic. the code is implemented correctly.
using those... | 2022/09/15 | [
"https://Stackoverflow.com/questions/73733257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15532852/"
] | The [`and` operator](https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not) already evaluates arguments left-to-right. It's also a short-circuit operator i.e. it only evaluates the right argument if the left one is true (since if it was false then the expression would return false whatever the r... | I may have misunderstood you, but Python's `and` operator will shortcut the evaluation so that if you have `func1(action) and func2(action)` then `func2(action)` will only be called if `func1(action)` returns True. If it returns False, then `func2(action)` is not called.
Also, the functions are called in the order in ... |
2,144,448 | >
> Let $a,b,c$ be integers, with $a$ and $b$ relatively prime. Then
> $$
> a\mid bc\implies a\mid c.
> $$
>
>
>
The proof starts as follows:
>
> Let $x,y\in\mathbb Z$ with $xa+yb=1$. From $a\mid bc$ we get $a\mid xac+ybc=\dots$
>
>
>
I can follow the rest of the proof. However, I don't understand why
$$
a\... | 2017/02/14 | [
"https://math.stackexchange.com/questions/2144448",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/405827/"
] | $a\mid xac$ trivially since $a=xc\cdot a$. Hence $a\mid xac$ and $a \mid ybc$. This implies $a \mid xac+ybc$. As simple as that. | First notice $a|xac$ because $xac=a(xc)$. Then notice $a|ybc$ because $a|bc$ so if $bc=ak$ then $ybc=y(ak)=a(yk)$.
Now that we know that $a|xac$ and $a|ybc$ we have $a|xac+ybc$. |
8,278,912 | I installed Icinga 1.6.0beta and tried to install it's new web interface using this [manual](http://docs.icinga.org/latest/en/icinga-web-scratch.html). But it was written for Apache. So I used the following configuration file for nginx to run the interface, but no success. I get directory listing denied in error logs. ... | 2011/11/26 | [
"https://Stackoverflow.com/questions/8278912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/153015/"
] | "Seed" the random number generator by getting the number of seconds since midnight and then passing it in:
```
Random rand = new Random(secs);
```
This still does not generate perfectly random numbers, but should serve your purpose. | I am not so conversant in C#.
But I don't think this problem would occur in Java because the default constructor of Random class uses a seed based on current time and a unique count identifier.Below is code from **java.util.Random** class.
```
private static volatile long seedUniquifier = 8682522807148012L;
public Ra... |
8,278,912 | I installed Icinga 1.6.0beta and tried to install it's new web interface using this [manual](http://docs.icinga.org/latest/en/icinga-web-scratch.html). But it was written for Apache. So I used the following configuration file for nginx to run the interface, but no success. I get directory listing denied in error logs. ... | 2011/11/26 | [
"https://Stackoverflow.com/questions/8278912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/153015/"
] | Very few "random" number generators are actually random. Almost all are pseudorandom, following a predictable sequence when started with the same [seed value](http://en.wikipedia.org/wiki/Random_seed). Many [pseudorandom number generators](http://en.wikipedia.org/wiki/Pseudorandom_number_generator) (PRNGs) get their se... | "Seed" the random number generator by getting the number of seconds since midnight and then passing it in:
```
Random rand = new Random(secs);
```
This still does not generate perfectly random numbers, but should serve your purpose. |
8,278,912 | I installed Icinga 1.6.0beta and tried to install it's new web interface using this [manual](http://docs.icinga.org/latest/en/icinga-web-scratch.html). But it was written for Apache. So I used the following configuration file for nginx to run the interface, but no success. I get directory listing denied in error logs. ... | 2011/11/26 | [
"https://Stackoverflow.com/questions/8278912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/153015/"
] | "Seed" the random number generator by getting the number of seconds since midnight and then passing it in:
```
Random rand = new Random(secs);
```
This still does not generate perfectly random numbers, but should serve your purpose. | You can use a chaotic map to generate random numbers. The C++ code below (GenRandRea) returns a vector of random number using the so-called "Tent map" (<https://www.wikiwand.com/en/Tent_map>). The seed is an integer that is used to generate x (as a number between 0. and 1.) as input of the iterative map. Diferent seeds... |
8,278,912 | I installed Icinga 1.6.0beta and tried to install it's new web interface using this [manual](http://docs.icinga.org/latest/en/icinga-web-scratch.html). But it was written for Apache. So I used the following configuration file for nginx to run the interface, but no success. I get directory listing denied in error logs. ... | 2011/11/26 | [
"https://Stackoverflow.com/questions/8278912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/153015/"
] | Very few "random" number generators are actually random. Almost all are pseudorandom, following a predictable sequence when started with the same [seed value](http://en.wikipedia.org/wiki/Random_seed). Many [pseudorandom number generators](http://en.wikipedia.org/wiki/Pseudorandom_number_generator) (PRNGs) get their se... | I am not so conversant in C#.
But I don't think this problem would occur in Java because the default constructor of Random class uses a seed based on current time and a unique count identifier.Below is code from **java.util.Random** class.
```
private static volatile long seedUniquifier = 8682522807148012L;
public Ra... |
8,278,912 | I installed Icinga 1.6.0beta and tried to install it's new web interface using this [manual](http://docs.icinga.org/latest/en/icinga-web-scratch.html). But it was written for Apache. So I used the following configuration file for nginx to run the interface, but no success. I get directory listing denied in error logs. ... | 2011/11/26 | [
"https://Stackoverflow.com/questions/8278912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/153015/"
] | Producing the same sequence over and over is often a feature, not a bug, as long as you control it. Producing a repeatable sequence makes debugging easier. If you are serious about wanting a non-reproducible random sequence, you could look for a secure random number generator with this as a design aim. You've tagged yo... | I am not so conversant in C#.
But I don't think this problem would occur in Java because the default constructor of Random class uses a seed based on current time and a unique count identifier.Below is code from **java.util.Random** class.
```
private static volatile long seedUniquifier = 8682522807148012L;
public Ra... |
8,278,912 | I installed Icinga 1.6.0beta and tried to install it's new web interface using this [manual](http://docs.icinga.org/latest/en/icinga-web-scratch.html). But it was written for Apache. So I used the following configuration file for nginx to run the interface, but no success. I get directory listing denied in error logs. ... | 2011/11/26 | [
"https://Stackoverflow.com/questions/8278912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/153015/"
] | Very few "random" number generators are actually random. Almost all are pseudorandom, following a predictable sequence when started with the same [seed value](http://en.wikipedia.org/wiki/Random_seed). Many [pseudorandom number generators](http://en.wikipedia.org/wiki/Pseudorandom_number_generator) (PRNGs) get their se... | Producing the same sequence over and over is often a feature, not a bug, as long as you control it. Producing a repeatable sequence makes debugging easier. If you are serious about wanting a non-reproducible random sequence, you could look for a secure random number generator with this as a design aim. You've tagged yo... |
8,278,912 | I installed Icinga 1.6.0beta and tried to install it's new web interface using this [manual](http://docs.icinga.org/latest/en/icinga-web-scratch.html). But it was written for Apache. So I used the following configuration file for nginx to run the interface, but no success. I get directory listing denied in error logs. ... | 2011/11/26 | [
"https://Stackoverflow.com/questions/8278912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/153015/"
] | Very few "random" number generators are actually random. Almost all are pseudorandom, following a predictable sequence when started with the same [seed value](http://en.wikipedia.org/wiki/Random_seed). Many [pseudorandom number generators](http://en.wikipedia.org/wiki/Pseudorandom_number_generator) (PRNGs) get their se... | You can use a chaotic map to generate random numbers. The C++ code below (GenRandRea) returns a vector of random number using the so-called "Tent map" (<https://www.wikiwand.com/en/Tent_map>). The seed is an integer that is used to generate x (as a number between 0. and 1.) as input of the iterative map. Diferent seeds... |
8,278,912 | I installed Icinga 1.6.0beta and tried to install it's new web interface using this [manual](http://docs.icinga.org/latest/en/icinga-web-scratch.html). But it was written for Apache. So I used the following configuration file for nginx to run the interface, but no success. I get directory listing denied in error logs. ... | 2011/11/26 | [
"https://Stackoverflow.com/questions/8278912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/153015/"
] | Producing the same sequence over and over is often a feature, not a bug, as long as you control it. Producing a repeatable sequence makes debugging easier. If you are serious about wanting a non-reproducible random sequence, you could look for a secure random number generator with this as a design aim. You've tagged yo... | You can use a chaotic map to generate random numbers. The C++ code below (GenRandRea) returns a vector of random number using the so-called "Tent map" (<https://www.wikiwand.com/en/Tent_map>). The seed is an integer that is used to generate x (as a number between 0. and 1.) as input of the iterative map. Diferent seeds... |
39,744,205 | When I use `Ctrl+C` on an image on my PC and `Ctrl+V` on an WYSIWUG editor, it creates an image converted via base64. But this changes from browser and the OS I use.
What I want is to know if there are some ways to prevent it via Javascript before the `Ctrl+V` has effect? | 2016/09/28 | [
"https://Stackoverflow.com/questions/39744205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6220490/"
] | This worked for me:
```
GET /_search
{
"query": {
"wildcard": {
"lastname": "aya*"
}
}
}
```
I had wasted many hours until I read this online:
>
> ...if you search a not\_analyzed field and use wildcards, you MUST NOT
> include any capital letters in your query...
>
>
>
The whole time it was ... | I'm guessing your `lastname` field is probably `analyzed` and thus the token that was indexed is `ayala` and not `Ayala`. So since `wildcard` queries are not analyzed you need to specify the search term in lowercase:
Try this:
```
POST /_search
{
"query":{
"filtered" : {
"filter" : {
"boo... |
36,970,221 | I am trying to compare certain values with diff times in CSV file. ex: iam searching for the first 27 bytes value and save its time. Then second 27 value and time is different from first one then save its time then third etc.The problem is when i try to save time to a variable to compare it with the second same value i... | 2016/05/01 | [
"https://Stackoverflow.com/questions/36970221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6278529/"
] | You're using globals incorrectly - the `global` modifier is used inside of a function to indicate that the variable has global read/write permissions. However,
`T3` is never set on certain execution paths, and so you get this error.
You want your setup to be something of the form:
```
T1 = None # or your preferred i... | You need to declare the vars as global inside your function. Otherwise python assumes it's in the local scope only.
Try adding this under your function declaration (leaving the vars declared in the outer scope as well:
```
def searchfunc():
global T1, T2, T3, T4
``` |
19,540,195 | ```
select packageid,status+' Date : '+UpdatedOn from [Shipment_Package]
```
The below error is appeared when executing the above code in sql server. The type of `UpdatedOn` is `DateTime` and status is a `varchar`. We wanted to concatenate the status, Date and UpdatedOn.
error:
>
> Conversion failed when convert... | 2013/10/23 | [
"https://Stackoverflow.com/questions/19540195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2901979/"
] | You need to convert `UpdatedOn` to `varchar` something like this:
```
select packageid, status + ' Date : ' + CAST(UpdatedOn AS VARCHAR(10))
from [Shipment_Package];
```
You might also need to use [`CONVERT`](http://msdn.microsoft.com/en-us/library/ms187928.aspx) if you want to format the datetime in a specific form... | To achive what you need, you would need to CAST the Date?
Example would be;
Your current, incorrect code:
```
select packageid,status+' Date : '+UpdatedOn from [Shipment_Package]
```
Suggested solution:
```
select packageid,status + ' Date : ' + CAST(UpdatedOn AS VARCHAR(20))
from [Shipment_Package]
```
[MSDN... |
19,540,195 | ```
select packageid,status+' Date : '+UpdatedOn from [Shipment_Package]
```
The below error is appeared when executing the above code in sql server. The type of `UpdatedOn` is `DateTime` and status is a `varchar`. We wanted to concatenate the status, Date and UpdatedOn.
error:
>
> Conversion failed when convert... | 2013/10/23 | [
"https://Stackoverflow.com/questions/19540195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2901979/"
] | You need to convert `UpdatedOn` to `varchar` something like this:
```
select packageid, status + ' Date : ' + CAST(UpdatedOn AS VARCHAR(10))
from [Shipment_Package];
```
You might also need to use [`CONVERT`](http://msdn.microsoft.com/en-us/library/ms187928.aspx) if you want to format the datetime in a specific form... | To account for null values, try this:
```
select packageid,
'Status: ' + isnull(status, '(null)') + ', Date : '
+ case when UpdatedOn is null then '(null)' else convert(varchar(20), UpdatedOn, 104) end as status_text
from [Shipment_Package]
``` |
19,540,195 | ```
select packageid,status+' Date : '+UpdatedOn from [Shipment_Package]
```
The below error is appeared when executing the above code in sql server. The type of `UpdatedOn` is `DateTime` and status is a `varchar`. We wanted to concatenate the status, Date and UpdatedOn.
error:
>
> Conversion failed when convert... | 2013/10/23 | [
"https://Stackoverflow.com/questions/19540195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2901979/"
] | You need to convert `UpdatedOn` to `varchar` something like this:
```
select packageid, status + ' Date : ' + CAST(UpdatedOn AS VARCHAR(10))
from [Shipment_Package];
```
You might also need to use [`CONVERT`](http://msdn.microsoft.com/en-us/library/ms187928.aspx) if you want to format the datetime in a specific form... | Convert Datetime column into varchar for sql Server you can use below code
```
select packageid,status+' Date : '+CONVERT(VARCHAR,UpdatedOn,120) from [Shipment_Package]
```
120 code will convert your date into this format : 2020-06-12 15:09:00
other format you can use from [this link](https://www.mssqltips.com/sq... |
45,652,538 | Say, there is a class, Employee
```
@Getter
Class Employee {
empId;
empName;
empDept;
}
```
I am trying to get a comma delimetered list of unique-departments from the list of employees in the String departments (Ex: 'Sales', 'Tech', 'Ops', 'Training')
```
List<Employee> employees = getListOfEmployees();... | 2017/08/12 | [
"https://Stackoverflow.com/questions/45652538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1639485/"
] | Simply, add the `distinct` intermediate operation before the `collect` reduction operation i.e:
```
...
...
.map(emp -> String.format("'%s'", emp.getEmpDept()))
.distinct()
.collect(Collectors.joining(","));
``` | Or a little bit cleaner:
```
employees
.stream()
.map(Employee::getEmpDept)
.filter(Objects::nonNull)
.map(x -> String.format("'%s'", x))
.distinct()
.collect(Collectors.joining(","));
```
Just notice that using the stateful intermediate operations (like `distinct` or... |
45,652,538 | Say, there is a class, Employee
```
@Getter
Class Employee {
empId;
empName;
empDept;
}
```
I am trying to get a comma delimetered list of unique-departments from the list of employees in the String departments (Ex: 'Sales', 'Tech', 'Ops', 'Training')
```
List<Employee> employees = getListOfEmployees();... | 2017/08/12 | [
"https://Stackoverflow.com/questions/45652538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1639485/"
] | Simply, add the `distinct` intermediate operation before the `collect` reduction operation i.e:
```
...
...
.map(emp -> String.format("'%s'", emp.getEmpDept()))
.distinct()
.collect(Collectors.joining(","));
``` | Also if you'd like to skip the map operation, `Collectors#joining` has an overloaded version which accepts prefix and suffix parameters and you can then have something like:
```
employees
.stream()
.map( Employee::getEmpDept )
.filter( Objects::nonNull )
.distinct()
... |
45,652,538 | Say, there is a class, Employee
```
@Getter
Class Employee {
empId;
empName;
empDept;
}
```
I am trying to get a comma delimetered list of unique-departments from the list of employees in the String departments (Ex: 'Sales', 'Tech', 'Ops', 'Training')
```
List<Employee> employees = getListOfEmployees();... | 2017/08/12 | [
"https://Stackoverflow.com/questions/45652538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1639485/"
] | Or a little bit cleaner:
```
employees
.stream()
.map(Employee::getEmpDept)
.filter(Objects::nonNull)
.map(x -> String.format("'%s'", x))
.distinct()
.collect(Collectors.joining(","));
```
Just notice that using the stateful intermediate operations (like `distinct` or... | Also if you'd like to skip the map operation, `Collectors#joining` has an overloaded version which accepts prefix and suffix parameters and you can then have something like:
```
employees
.stream()
.map( Employee::getEmpDept )
.filter( Objects::nonNull )
.distinct()
... |
5,539,629 | I read 11mb textfile with php:
```
$data_array = array();
$counter = 0;
while(!feof($fh)) {
$buffer = fgets($fh, 4096);
$data_array[$counter] = $buffer;
$counter++;
}
```
Then I want to use implode function to get all into one variable.
```
$data = implode("",$data_array);
```
But the ... | 2011/04/04 | [
"https://Stackoverflow.com/questions/5539629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/691233/"
] | First of all, you're trying to reinvent the wheel. There is already function in PHP for that:
```
$data = file_get_contents($filename)
```
Second, if you're not getting any results, check the memory and time limits you have set in `php.ini`. | have you tried `$data = file_get_contents('filename');`? |
5,539,629 | I read 11mb textfile with php:
```
$data_array = array();
$counter = 0;
while(!feof($fh)) {
$buffer = fgets($fh, 4096);
$data_array[$counter] = $buffer;
$counter++;
}
```
Then I want to use implode function to get all into one variable.
```
$data = implode("",$data_array);
```
But the ... | 2011/04/04 | [
"https://Stackoverflow.com/questions/5539629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/691233/"
] | First of all, you're trying to reinvent the wheel. There is already function in PHP for that:
```
$data = file_get_contents($filename)
```
Second, if you're not getting any results, check the memory and time limits you have set in `php.ini`. | You should try to make the text file smaller parts if you can. Also there's execution limit in php.ini file 30 seconds should be default after which the script is terminated. |
29,174,983 | **Update**
Following link provide a working demo with Highchart-ng and the JSON rebuild solution. If you try to use JSON data from Splunk in highchart, this will save your day :)
<http://plnkr.co/edit/Nl47Hz5Cnj1jvUT3DTBt?p=preview>
--
I am trying to get a JSON response from Splunk to fit into highchart, but im hav... | 2015/03/20 | [
"https://Stackoverflow.com/questions/29174983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4341658/"
] | You *can't* "force" the compiler to inline it, unless you are considering some implementation-specific tools that you have not mentioned, so the question is entirely moot.
If your compiler is already not doing so then it has a reason. | Depending on how you wrote your function.
In some cases, yes!
```
void doSomething(int *src, int *dst,
const int loopCountInner, const int loopCountOuter)
{
int i, j;
for(i=0; i<loopCounterOuter; i++){
for(j=0; j<loopCounterInner; j++){
*dst = someCalc... |
29,174,983 | **Update**
Following link provide a working demo with Highchart-ng and the JSON rebuild solution. If you try to use JSON data from Splunk in highchart, this will save your day :)
<http://plnkr.co/edit/Nl47Hz5Cnj1jvUT3DTBt?p=preview>
--
I am trying to get a JSON response from Splunk to fit into highchart, but im hav... | 2015/03/20 | [
"https://Stackoverflow.com/questions/29174983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4341658/"
] | No, there are notable exceptions. Take this code for example:
```
void do_something_often(void) {
x++;
if (x == 100000000) {
do_a_lot_of_work();
}
}
```
Let's say `do_something_often()` is called very often and from many places. `do_a_lot_of_work()` is called very rarely (one out of every one hun... | Depending on how you wrote your function.
In some cases, yes!
```
void doSomething(int *src, int *dst,
const int loopCountInner, const int loopCountOuter)
{
int i, j;
for(i=0; i<loopCounterOuter; i++){
for(j=0; j<loopCounterInner; j++){
*dst = someCalc... |
29,174,983 | **Update**
Following link provide a working demo with Highchart-ng and the JSON rebuild solution. If you try to use JSON data from Splunk in highchart, this will save your day :)
<http://plnkr.co/edit/Nl47Hz5Cnj1jvUT3DTBt?p=preview>
--
I am trying to get a JSON response from Splunk to fit into highchart, but im hav... | 2015/03/20 | [
"https://Stackoverflow.com/questions/29174983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4341658/"
] | One legitimate case where it makes sense *not* to inline a function, even if it's only called from a single location, is if the call to the function is rare and almost always skipped. Keeping the instructions before the function call and the instructions after the function call closely together in memory may allow thos... | No, if the code is a rarely used function then keeping it off the 'hot path' will be beneficial. An inline function will use up cache space [instruction cache] whether or not the code is actually used. Tools like LTCG combined with Profile Guided optimisation (in the MSFT world, not sure about Linux) go to great pains ... |
29,174,983 | **Update**
Following link provide a working demo with Highchart-ng and the JSON rebuild solution. If you try to use JSON data from Splunk in highchart, this will save your day :)
<http://plnkr.co/edit/Nl47Hz5Cnj1jvUT3DTBt?p=preview>
--
I am trying to get a JSON response from Splunk to fit into highchart, but im hav... | 2015/03/20 | [
"https://Stackoverflow.com/questions/29174983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4341658/"
] | No, there are notable exceptions. Take this code for example:
```
void do_something_often(void) {
x++;
if (x == 100000000) {
do_a_lot_of_work();
}
}
```
Let's say `do_something_often()` is called very often and from many places. `do_a_lot_of_work()` is called very rarely (one out of every one hun... | Make sure that the function definition is not exported. If it is, it obviously needs to be compiled, and that means that if your function is big probably the *call* will not be inlined. (Remember, it's the *call* that gets inlined, not the function. A function might get inlined in one place and called in another, etc.)... |
29,174,983 | **Update**
Following link provide a working demo with Highchart-ng and the JSON rebuild solution. If you try to use JSON data from Splunk in highchart, this will save your day :)
<http://plnkr.co/edit/Nl47Hz5Cnj1jvUT3DTBt?p=preview>
--
I am trying to get a JSON response from Splunk to fit into highchart, but im hav... | 2015/03/20 | [
"https://Stackoverflow.com/questions/29174983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4341658/"
] | One legitimate case where it makes sense *not* to inline a function, even if it's only called from a single location, is if the call to the function is rare and almost always skipped. Keeping the instructions before the function call and the instructions after the function call closely together in memory may allow thos... | If the function is called only once, there should be no performance disadvantages in inlining it. However, that does not mean you should blindly inline all functions. For example, if the code in question is Linux kernel code and you're using the BUG\_ON or WARN\_ON statement to print a stack trace, you don't get the fu... |
29,174,983 | **Update**
Following link provide a working demo with Highchart-ng and the JSON rebuild solution. If you try to use JSON data from Splunk in highchart, this will save your day :)
<http://plnkr.co/edit/Nl47Hz5Cnj1jvUT3DTBt?p=preview>
--
I am trying to get a JSON response from Splunk to fit into highchart, but im hav... | 2015/03/20 | [
"https://Stackoverflow.com/questions/29174983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4341658/"
] | You *can't* "force" the compiler to inline it, unless you are considering some implementation-specific tools that you have not mentioned, so the question is entirely moot.
If your compiler is already not doing so then it has a reason. | Make sure that the function definition is not exported. If it is, it obviously needs to be compiled, and that means that if your function is big probably the *call* will not be inlined. (Remember, it's the *call* that gets inlined, not the function. A function might get inlined in one place and called in another, etc.)... |
29,174,983 | **Update**
Following link provide a working demo with Highchart-ng and the JSON rebuild solution. If you try to use JSON data from Splunk in highchart, this will save your day :)
<http://plnkr.co/edit/Nl47Hz5Cnj1jvUT3DTBt?p=preview>
--
I am trying to get a JSON response from Splunk to fit into highchart, but im hav... | 2015/03/20 | [
"https://Stackoverflow.com/questions/29174983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4341658/"
] | No, there are notable exceptions. Take this code for example:
```
void do_something_often(void) {
x++;
if (x == 100000000) {
do_a_lot_of_work();
}
}
```
Let's say `do_something_often()` is called very often and from many places. `do_a_lot_of_work()` is called very rarely (one out of every one hun... | No, if the code is a rarely used function then keeping it off the 'hot path' will be beneficial. An inline function will use up cache space [instruction cache] whether or not the code is actually used. Tools like LTCG combined with Profile Guided optimisation (in the MSFT world, not sure about Linux) go to great pains ... |
29,174,983 | **Update**
Following link provide a working demo with Highchart-ng and the JSON rebuild solution. If you try to use JSON data from Splunk in highchart, this will save your day :)
<http://plnkr.co/edit/Nl47Hz5Cnj1jvUT3DTBt?p=preview>
--
I am trying to get a JSON response from Splunk to fit into highchart, but im hav... | 2015/03/20 | [
"https://Stackoverflow.com/questions/29174983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4341658/"
] | One legitimate case where it makes sense *not* to inline a function, even if it's only called from a single location, is if the call to the function is rare and almost always skipped. Keeping the instructions before the function call and the instructions after the function call closely together in memory may allow thos... | You *can't* "force" the compiler to inline it, unless you are considering some implementation-specific tools that you have not mentioned, so the question is entirely moot.
If your compiler is already not doing so then it has a reason. |
29,174,983 | **Update**
Following link provide a working demo with Highchart-ng and the JSON rebuild solution. If you try to use JSON data from Splunk in highchart, this will save your day :)
<http://plnkr.co/edit/Nl47Hz5Cnj1jvUT3DTBt?p=preview>
--
I am trying to get a JSON response from Splunk to fit into highchart, but im hav... | 2015/03/20 | [
"https://Stackoverflow.com/questions/29174983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4341658/"
] | No, there are notable exceptions. Take this code for example:
```
void do_something_often(void) {
x++;
if (x == 100000000) {
do_a_lot_of_work();
}
}
```
Let's say `do_something_often()` is called very often and from many places. `do_a_lot_of_work()` is called very rarely (one out of every one hun... | You *can't* "force" the compiler to inline it, unless you are considering some implementation-specific tools that you have not mentioned, so the question is entirely moot.
If your compiler is already not doing so then it has a reason. |
29,174,983 | **Update**
Following link provide a working demo with Highchart-ng and the JSON rebuild solution. If you try to use JSON data from Splunk in highchart, this will save your day :)
<http://plnkr.co/edit/Nl47Hz5Cnj1jvUT3DTBt?p=preview>
--
I am trying to get a JSON response from Splunk to fit into highchart, but im hav... | 2015/03/20 | [
"https://Stackoverflow.com/questions/29174983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4341658/"
] | You *can't* "force" the compiler to inline it, unless you are considering some implementation-specific tools that you have not mentioned, so the question is entirely moot.
If your compiler is already not doing so then it has a reason. | If the function is called only once, there should be no performance disadvantages in inlining it. However, that does not mean you should blindly inline all functions. For example, if the code in question is Linux kernel code and you're using the BUG\_ON or WARN\_ON statement to print a stack trace, you don't get the fu... |
12,518,682 | While I'm running my rspec-rails & cucumber-rails tests, every time a request is made the info about it gets on the log output making it hard to follow and to read.
```
Thing::SearchController
logs data about searches
Processing by Thing::SearchController#index as HTML
Parameters: {"q"=>"thingamabob"}
Rendered v... | 2012/09/20 | [
"https://Stackoverflow.com/questions/12518682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/202613/"
] | Answering your original question, the good way to test if your ISP is not blocking listed ports is this:
```
# yum -y install tcpdump
# tcpdump -i eth0 "port 137 or port 138 or port 139 or port 445"
```
(substitute eth0 with the name of the interface connected to the Internet).
Then you should try accessing the sha... | In the file `/etc/samba/smb.conf`, under the section `[global]`, below the workgroup line add this two lines :
```
client min protocol = NT1
client max protocol = SMB3
``` |
880,087 | I know target="\_blank" is supposed to make the thing open in a new window, and for some browsers, like FF3, it will actually make it open in a new tab. Is there a way to exercise more control over this behavior as a developer? | 2009/05/18 | [
"https://Stackoverflow.com/questions/880087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83898/"
] | According to <https://developer.mozilla.org/En/Window.open>, """
**How do I open a referenced resource of a link in a new tab? or in a specific tab?**
Currently, you can not. Only the user can set his advanced preferences to do that. K-meleon 1.1, a Mozilla-based browser, gives complete control and power to the user r... | Whether something targeted to "\_blank" opens to a new tab or window is a browser/user specific option settable in most new tab supported browsers. There is no way to target a tab yet. |
880,087 | I know target="\_blank" is supposed to make the thing open in a new window, and for some browsers, like FF3, it will actually make it open in a new tab. Is there a way to exercise more control over this behavior as a developer? | 2009/05/18 | [
"https://Stackoverflow.com/questions/880087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83898/"
] | According to <https://developer.mozilla.org/En/Window.open>, """
**How do I open a referenced resource of a link in a new tab? or in a specific tab?**
Currently, you can not. Only the user can set his advanced preferences to do that. K-meleon 1.1, a Mozilla-based browser, gives complete control and power to the user r... | Currently the final decision on how to open a link is in the hands of the user and their browser.
Also, I wouldn't be too happy if a developer overrode my choice in the way that you are describing. I only ever want one browser window open at a time, and do not want child windows to appear. Other people feel much the o... |
880,087 | I know target="\_blank" is supposed to make the thing open in a new window, and for some browsers, like FF3, it will actually make it open in a new tab. Is there a way to exercise more control over this behavior as a developer? | 2009/05/18 | [
"https://Stackoverflow.com/questions/880087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83898/"
] | Currently the final decision on how to open a link is in the hands of the user and their browser.
Also, I wouldn't be too happy if a developer overrode my choice in the way that you are describing. I only ever want one browser window open at a time, and do not want child windows to appear. Other people feel much the o... | Whether something targeted to "\_blank" opens to a new tab or window is a browser/user specific option settable in most new tab supported browsers. There is no way to target a tab yet. |
60,726,875 | I have an array of objects where some objects are undefined and I want to know how to remove them i got it how many of them but don't know how to remove them from an array of objects. i know this method to use but i want some more standard way to do it
```
const data = [
{
roleDoc:{
... | 2020/03/17 | [
"https://Stackoverflow.com/questions/60726875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12923643/"
] | You could do with [`Array#filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) and `!!` only matched valid
```js
const data = [ { roleDoc:{ name:"A" } }, { roleDoc: undefined } ,{ roleDoc:{ name:"c" } },{ roleDoc:{ name:"c" } }, { roleDoc: undefined },{ roleDoc:{ nam... | You can use [`.filter()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) to remove `undefined` ones.
Try the following:
```js
const data = [{ roleDoc:{ name:"A" } }, { roleDoc: undefined } ,{ roleDoc:{ name:"c"}},{roleDoc:{name:"c"} }, { roleDoc: undefined },{ roleDoc:... |
60,726,875 | I have an array of objects where some objects are undefined and I want to know how to remove them i got it how many of them but don't know how to remove them from an array of objects. i know this method to use but i want some more standard way to do it
```
const data = [
{
roleDoc:{
... | 2020/03/17 | [
"https://Stackoverflow.com/questions/60726875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12923643/"
] | You can use [`.filter()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) to remove `undefined` ones.
Try the following:
```js
const data = [{ roleDoc:{ name:"A" } }, { roleDoc: undefined } ,{ roleDoc:{ name:"c"}},{roleDoc:{name:"c"} }, { roleDoc: undefined },{ roleDoc:... | You could use a function programming approach using the [`Array.filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) function:
```js
const data = [
{
roleDoc: {
name: "A"
}
},
{
roleDoc: undefined
},
{
... |
60,726,875 | I have an array of objects where some objects are undefined and I want to know how to remove them i got it how many of them but don't know how to remove them from an array of objects. i know this method to use but i want some more standard way to do it
```
const data = [
{
roleDoc:{
... | 2020/03/17 | [
"https://Stackoverflow.com/questions/60726875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12923643/"
] | You could do with [`Array#filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) and `!!` only matched valid
```js
const data = [ { roleDoc:{ name:"A" } }, { roleDoc: undefined } ,{ roleDoc:{ name:"c" } },{ roleDoc:{ name:"c" } }, { roleDoc: undefined },{ roleDoc:{ nam... | You could use a function programming approach using the [`Array.filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) function:
```js
const data = [
{
roleDoc: {
name: "A"
}
},
{
roleDoc: undefined
},
{
... |
66,711,339 | I am trying to set up webdriver sampler in Jmeter in my company's network. I have tried all the suggestions from the link
[1]: <https://www.blazemeter.com/blog/webdriver-sampler-your-top-ten-questions-answered>
But facing the error can not find chrome binary and browser has not been configured. Please ensure at least ... | 2021/03/19 | [
"https://Stackoverflow.com/questions/66711339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4409932/"
] | This is an interesting edge case. `-n` option assumes numbers and numbers have one decimal point. Therefore the comparison for uniqueness is only the first two tokens. Workaround is using version sort instead.
```
... | sort -V -u
``` | Yeah that's a bit of a doosie ... assuming the input is in the last snippet (and putting AA,BB,CC,DD,etc on end of lines to see what's going on we see this output..
```
| sort --debug -t. -k1,4 -n -u
Memory to be used for sorting: 4294967296
Number of CPUs: 4
Using collate rules of C locale
Byte sort is used
Positive ... |
33,329,737 | How do I render a list of existing categories in my views?
My categories table has a `:name` column.
products view
```
= f.select :category_name, Category.all.map{|s| [s.name]}
```
Category.rb
```
class Category < ActiveRecord::Base
has_many :categoricals
validates :name, uniqueness: { case_sensitive: f... | 2015/10/25 | [
"https://Stackoverflow.com/questions/33329737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I never understand why people don't use [`collection_select`](http://apidock.com/rails/ActionView/Helpers/FormOptionsHelper/collection_select) over `select`:
```
= f.collection_select :category_id, Category.all, :id, :name
```
---
It seems the real problem is due to your relations:
```
#app/models/category.rb
clas... | Try:
```
= f.select :category_name, Category.all.map{|s| s.name}
```
In order to make this work, you have to have `category_name` column present in your `products` table. |
49,108,644 | I can't figure out what actually is returned by this call and how I can display it in HTML as an `img` tag. When I use the same URI using the online Microsoft Graph Explorer test environment I get the image as intended.
```
var requestUri =
"https://graph.microsoft.com/v1.0/barfoo.onmicrosoft.com/users/xxxxx-xxxx... | 2018/03/05 | [
"https://Stackoverflow.com/questions/49108644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/817455/"
] | `HttpClient` can give you the response as a `Stream`.
In ASP.NET Core, I've done this with:
```
[HttpGet]
public async Task<IActionResult> ProfilePhoto()
{
//removed all the code which you already have
HttpResponseMessage res = await client.SendAsync(request);
return File(await res.Content.ReadAsStreamAs... | Once you have the users photo response you should be able to render the image along the following lines:
src="data:image/jpeg;base64,{{ user.profilePic }}" |
24,838 | In episode one, when Baltar is seduced by what turns out to be a Cylon in the form of a human, the Cylon's spine glows red and shines through her skin. Was this just a special effect for the benefit of the TV audience? Do any or all of the other human looking Cylons in the 2004 series suffer from this give away indicat... | 2012/10/17 | [
"https://scifi.stackexchange.com/questions/24838",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/4356/"
] | I don't believe this is ever specifically given a reason. However there are two occurrences as far as I can recall:
The first is with Baltar and number 6, who are apparently deeply in love.
The next is with Boomer and Helo, who again are both apparently deeply in love.
Since the human Cylons were designed to not be ... | I'm going to go out on a limb here, and say that it wasn't a literal depiction so much as a story-telling device meant for the audience. This show was very serious throughout its run, even grim... they weren't doing goofy stuff and breaking the 4th wall or anything like that, and so I know that it might be difficult fo... |
24,838 | In episode one, when Baltar is seduced by what turns out to be a Cylon in the form of a human, the Cylon's spine glows red and shines through her skin. Was this just a special effect for the benefit of the TV audience? Do any or all of the other human looking Cylons in the 2004 series suffer from this give away indicat... | 2012/10/17 | [
"https://scifi.stackexchange.com/questions/24838",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/4356/"
] | I don't believe this is ever specifically given a reason. However there are two occurrences as far as I can recall:
The first is with Baltar and number 6, who are apparently deeply in love.
The next is with Boomer and Helo, who again are both apparently deeply in love.
Since the human Cylons were designed to not be ... | According to the [official novelisation](http://en.battlestarwiki.org/wiki/Battlestar_Galactica_(2005_Novel)), the glow was into various spectra that couldn't be seen with the naked eye. There's no special indication *why* her spine was glowing, other than it grew with her "sexual fervor", suggesting a physiological re... |
24,838 | In episode one, when Baltar is seduced by what turns out to be a Cylon in the form of a human, the Cylon's spine glows red and shines through her skin. Was this just a special effect for the benefit of the TV audience? Do any or all of the other human looking Cylons in the 2004 series suffer from this give away indicat... | 2012/10/17 | [
"https://scifi.stackexchange.com/questions/24838",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/4356/"
] | I'm going to go out on a limb here, and say that it wasn't a literal depiction so much as a story-telling device meant for the audience. This show was very serious throughout its run, even grim... they weren't doing goofy stuff and breaking the 4th wall or anything like that, and so I know that it might be difficult fo... | According to the [official novelisation](http://en.battlestarwiki.org/wiki/Battlestar_Galactica_(2005_Novel)), the glow was into various spectra that couldn't be seen with the naked eye. There's no special indication *why* her spine was glowing, other than it grew with her "sexual fervor", suggesting a physiological re... |
50,118,383 | How can I add text at the top right corner of a table cell without interfering with the existing text content of the cell?
For example, I have a simple HTML table:
```
<table>
<tr>
<td>Abc</td>
<td>Defg</td>
</tr>
<tr>
<td>Hijkl</td>
<td>Mno</td>
</tr>
</table>
```
It looks like this:
[![enter image descrip... | 2018/05/01 | [
"https://Stackoverflow.com/questions/50118383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1325279/"
] | Use pseudo elements to add to the td
```css
td {
position: relative;
width: 200px;
height: 200px;
background: yellow;
}
td.one::after {
content: 'stuff here';
position: absolute;
top: 0;
right: 0;
background: green;
}
td.two::after {
content: 'different stuff';
position: absolute... | Put a div inside the td, make it position relative. Add that label as span/div or whatever element, make it absolute with `top: 0, right: 0` |
50,118,383 | How can I add text at the top right corner of a table cell without interfering with the existing text content of the cell?
For example, I have a simple HTML table:
```
<table>
<tr>
<td>Abc</td>
<td>Defg</td>
</tr>
<tr>
<td>Hijkl</td>
<td>Mno</td>
</tr>
</table>
```
It looks like this:
[![enter image descrip... | 2018/05/01 | [
"https://Stackoverflow.com/questions/50118383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1325279/"
] | Put a div inside the td, make it position relative. Add that label as span/div or whatever element, make it absolute with `top: 0, right: 0` | ```
Use Following code :
```
`<table>
<tr>
<td>Table Data come here
<div class="topright">Next Code</div>
</td>
</tr>
</table>
<style type="text/css">
td {
position: relative;
width: 200px;
height: 200px;
background: yellow;
}
td .topright {
position: absolute;
top: 0;
right: 0;
background: green;
}
<... |
50,118,383 | How can I add text at the top right corner of a table cell without interfering with the existing text content of the cell?
For example, I have a simple HTML table:
```
<table>
<tr>
<td>Abc</td>
<td>Defg</td>
</tr>
<tr>
<td>Hijkl</td>
<td>Mno</td>
</tr>
</table>
```
It looks like this:
[![enter image descrip... | 2018/05/01 | [
"https://Stackoverflow.com/questions/50118383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1325279/"
] | Put a div inside the td, make it position relative. Add that label as span/div or whatever element, make it absolute with `top: 0, right: 0` | ```
<table>
<tr>
<td>Abc</td>
<td>Defg<span> some label </span></td>
</tr>
<tr>
<td>Hijkl</td>
<td>Defg<span> some label </span></td>
</tr>
</table>
table {
border:1px solid black;
}
td {
width: 200px;
height: 50px;
border:1px solid gray;
position: relative;
}
td span {
position: absolute;
ri... |
50,118,383 | How can I add text at the top right corner of a table cell without interfering with the existing text content of the cell?
For example, I have a simple HTML table:
```
<table>
<tr>
<td>Abc</td>
<td>Defg</td>
</tr>
<tr>
<td>Hijkl</td>
<td>Mno</td>
</tr>
</table>
```
It looks like this:
[![enter image descrip... | 2018/05/01 | [
"https://Stackoverflow.com/questions/50118383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1325279/"
] | Use pseudo elements to add to the td
```css
td {
position: relative;
width: 200px;
height: 200px;
background: yellow;
}
td.one::after {
content: 'stuff here';
position: absolute;
top: 0;
right: 0;
background: green;
}
td.two::after {
content: 'different stuff';
position: absolute... | ```
Use Following code :
```
`<table>
<tr>
<td>Table Data come here
<div class="topright">Next Code</div>
</td>
</tr>
</table>
<style type="text/css">
td {
position: relative;
width: 200px;
height: 200px;
background: yellow;
}
td .topright {
position: absolute;
top: 0;
right: 0;
background: green;
}
<... |
50,118,383 | How can I add text at the top right corner of a table cell without interfering with the existing text content of the cell?
For example, I have a simple HTML table:
```
<table>
<tr>
<td>Abc</td>
<td>Defg</td>
</tr>
<tr>
<td>Hijkl</td>
<td>Mno</td>
</tr>
</table>
```
It looks like this:
[![enter image descrip... | 2018/05/01 | [
"https://Stackoverflow.com/questions/50118383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1325279/"
] | Use pseudo elements to add to the td
```css
td {
position: relative;
width: 200px;
height: 200px;
background: yellow;
}
td.one::after {
content: 'stuff here';
position: absolute;
top: 0;
right: 0;
background: green;
}
td.two::after {
content: 'different stuff';
position: absolute... | ```
<table>
<tr>
<td>Abc</td>
<td>Defg<span> some label </span></td>
</tr>
<tr>
<td>Hijkl</td>
<td>Defg<span> some label </span></td>
</tr>
</table>
table {
border:1px solid black;
}
td {
width: 200px;
height: 50px;
border:1px solid gray;
position: relative;
}
td span {
position: absolute;
ri... |
28,683,208 | Hey guys I'm trying to get an image to stick to the bottom of my website. I can get it to stick to the bottom but then it stretches... This is my code:
```
<style>
img {
position: fixed;
bottom: 0;
}
</style>
<img src="fire.jpg" width="100%" height="100%" />
```
Instead of nicely sticking to the ... | 2015/02/23 | [
"https://Stackoverflow.com/questions/28683208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4182107/"
] | I think what you're after is this:
```
<style>
.background-img {
position: fixed;
top: 0;
bottom: 0;
width: 100%;
background-image: url(/images/fire.jpg);
background-size: cover; /* or "contain" */
background-position: center bottom;
}
</style>
<body>
<div class="background-img"></div>... | If you skip width and height the image will use its default size and stick to the bottom. |
28,683,208 | Hey guys I'm trying to get an image to stick to the bottom of my website. I can get it to stick to the bottom but then it stretches... This is my code:
```
<style>
img {
position: fixed;
bottom: 0;
}
</style>
<img src="fire.jpg" width="100%" height="100%" />
```
Instead of nicely sticking to the ... | 2015/02/23 | [
"https://Stackoverflow.com/questions/28683208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4182107/"
] | I think what you're after is this:
```
<style>
.background-img {
position: fixed;
top: 0;
bottom: 0;
width: 100%;
background-image: url(/images/fire.jpg);
background-size: cover; /* or "contain" */
background-position: center bottom;
}
</style>
<body>
<div class="background-img"></div>... | Try this!
```css
div {
background: #F3F3F4 url("http://2.bp.blogspot.com/-CC6No3LtfEY/T6PQLbfzNBI/AAAAAAAAMhI/E7mlV7hya4M/s1600/google.jpg") no-repeat bottom;
height: 100%;
width: 100%;
bottom: 0px;
left: 0px;
position: fixed;
}
```
```html
<div></div>
``` |
28,683,208 | Hey guys I'm trying to get an image to stick to the bottom of my website. I can get it to stick to the bottom but then it stretches... This is my code:
```
<style>
img {
position: fixed;
bottom: 0;
}
</style>
<img src="fire.jpg" width="100%" height="100%" />
```
Instead of nicely sticking to the ... | 2015/02/23 | [
"https://Stackoverflow.com/questions/28683208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4182107/"
] | I think what you're after is this:
```
<style>
.background-img {
position: fixed;
top: 0;
bottom: 0;
width: 100%;
background-image: url(/images/fire.jpg);
background-size: cover; /* or "contain" */
background-position: center bottom;
}
</style>
<body>
<div class="background-img"></div>... | First of all remove the `width` and `height` properties of your `img` tag. Then add to your img css `max-width: 100%` that will make your image responsive, and adapt to the screen size. |
28,683,208 | Hey guys I'm trying to get an image to stick to the bottom of my website. I can get it to stick to the bottom but then it stretches... This is my code:
```
<style>
img {
position: fixed;
bottom: 0;
}
</style>
<img src="fire.jpg" width="100%" height="100%" />
```
Instead of nicely sticking to the ... | 2015/02/23 | [
"https://Stackoverflow.com/questions/28683208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4182107/"
] | Try this!
```css
div {
background: #F3F3F4 url("http://2.bp.blogspot.com/-CC6No3LtfEY/T6PQLbfzNBI/AAAAAAAAMhI/E7mlV7hya4M/s1600/google.jpg") no-repeat bottom;
height: 100%;
width: 100%;
bottom: 0px;
left: 0px;
position: fixed;
}
```
```html
<div></div>
``` | If you skip width and height the image will use its default size and stick to the bottom. |
28,683,208 | Hey guys I'm trying to get an image to stick to the bottom of my website. I can get it to stick to the bottom but then it stretches... This is my code:
```
<style>
img {
position: fixed;
bottom: 0;
}
</style>
<img src="fire.jpg" width="100%" height="100%" />
```
Instead of nicely sticking to the ... | 2015/02/23 | [
"https://Stackoverflow.com/questions/28683208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4182107/"
] | Try this!
```css
div {
background: #F3F3F4 url("http://2.bp.blogspot.com/-CC6No3LtfEY/T6PQLbfzNBI/AAAAAAAAMhI/E7mlV7hya4M/s1600/google.jpg") no-repeat bottom;
height: 100%;
width: 100%;
bottom: 0px;
left: 0px;
position: fixed;
}
```
```html
<div></div>
``` | First of all remove the `width` and `height` properties of your `img` tag. Then add to your img css `max-width: 100%` that will make your image responsive, and adapt to the screen size. |
44,447,335 | **I was trying to run my app but my console area doesn't show anything**
*I tried many solution but I can't fix that*
**any help please ??** | 2017/06/09 | [
"https://Stackoverflow.com/questions/44447335",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7980600/"
] | I think you've deactivated your console by mistake, try pressing: *shift-command-c*
Alternatively, you can do that by going to:
>
> View -> Debug Area -> Activate Console.
>
>
> | To open console
```
command+shift+y
``` |
16,902,408 | Am using `$.Deferred()` to wait for asynchronous call and then get data from it.
Tried this so far : <http://jsfiddle.net/RMSbx/1/>
```
var result = "";
function asyncCallWrapper () {
return $.Deferred(function(def) { asyncCallFunction(arg1, function ( //Fires a callback when completed
def.resolve(data);
)))
}... | 2013/06/03 | [
"https://Stackoverflow.com/questions/16902408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/366346/"
] | If you're using Javascript (you didn't specify), you can just access the value by doing this:
```
sCurrentLine.issue
```
That's it. | Just for the sake of completeness there is another way access it in javascript
```
sCurrentLine["issue"]
``` |
30,039,246 | I want to concatenate vectors according to another vector values. To simplify question, I'm giving a similar situation:
Let assume I have a cell which it has 3 vectors in it (s\_i):
```
s_1 = [1 2 3];
s_2 = [2 1 3];
s_3 = [3 1 2];
s_i = {s_1, s_2 , s_3 } ;
bits = [1 2 1 3 1];
```
So I want to create a new vector ... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30039246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4298049/"
] | It's very simple:
```
new_vector = [s_i{bits}]
``` | Try this:
```
new_vector = cell2mat(s_i(bits))
```
---
Result with the above test case:
```
new_vector =
1 2 3 2 1 3 1 2 3 3 1 2 1 2 3
``` |
5,333 | I am a TA for complexity theory course. I want to explain the Exponential Time Hypothesis (ETH) to undergraduate students. They have done algorithm and theory of computation course. They know about SAT problem, with brute force algorithms to solve SAT. I have explained the ETH hypothesis in less than half hour.
One wa... | 2018/12/30 | [
"https://cseducators.stackexchange.com/questions/5333",
"https://cseducators.stackexchange.com",
"https://cseducators.stackexchange.com/users/6393/"
] | It seems that you are aiming to convey the significance of disproving ETH? If you're looking to leave some impression, it's always better to show rather than tell.
I think your students need to see some examples of practical areas and difficult problems that efficiently reduce to SAT. If you can demonstrate to them th... | I'm not sure I understand your dilemma, especially for the students you describe. Many computational problems can be shown to be "reducible" to others using a sub exponential (usually polynomial) run time algorithm. That is to say, a solution to one of these problems can be transformed into a solution of a different pr... |
41,812,082 | I have a script that will check for multiple conditions in if statement and run a desired command if its true.
```
if [ ! -f /tmp/a ] && [ ! -f /tmp/b ]; then
touch /tmp/c else
echo "file exists" fi
```
I would now need to know which out of the multiple condition was true.
Eg: /tmp/a or /tmp/... | 2017/01/23 | [
"https://Stackoverflow.com/questions/41812082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2700022/"
] | Below is an example of what you should do to get the label display updated after every press of your button.
* You need to use `textvariable` instead of `text` in label.
* You need to declare a `StringVar` variable in your main code and have it updated in your function mov1.
* Note my example on how to get a string be... | ```
labelWelkSpeler = Label(root, text=("Nu is speler ",playervar.get()," aan de beurt")) #player
```
This gets the value of playervar ONCE (at the time you create the label), and builds the text of the label at that time. (And probably doesn't build the text you actually wanted, as what you wrote is a tuple con... |
192,820 | Is something wrong with StackOverflow's spam filter? Recently there have been huge numbers of spam topics related to football streaming. They have all been spam flagged and deleted but there are more getting posted all the time, I just flagged another 6 or so a few minutes ago. This has been going on for around 3 days ... | 2013/08/11 | [
"https://meta.stackexchange.com/questions/192820",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/226630/"
] | I've decided to attack the problem at the root, shutting down the spam blogs themselves.
The secret here is to run Google searches using queries like `site:blogspot.com watch football` (the `site:` operator as used here limits the search to the `blogspot.com` domain), click on and examine any suspicious results, and p... | The spam is not new. Drupal Answers was hit **really** hard with it starting in Dec/Jan. Other sites have had it bad, too (Ask Ubuntu was one). The SE team has done a fantastic job with the automatic filters, but the spam evolves rather often, so automatic blocking isn't effective for long.
The proper course of action... |
192,820 | Is something wrong with StackOverflow's spam filter? Recently there have been huge numbers of spam topics related to football streaming. They have all been spam flagged and deleted but there are more getting posted all the time, I just flagged another 6 or so a few minutes ago. This has been going on for around 3 days ... | 2013/08/11 | [
"https://meta.stackexchange.com/questions/192820",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/226630/"
] | We're trying to get better at keeping this at bay. The problem affects all sites that see any kind of traffic, some more than others. I can't go into very much detail because frankly, there isn't a whole lot of detail that belongs to an agreed implementation at this point.
However ....
A big mistake we have made in t... | The spam is not new. Drupal Answers was hit **really** hard with it starting in Dec/Jan. Other sites have had it bad, too (Ask Ubuntu was one). The SE team has done a fantastic job with the automatic filters, but the spam evolves rather often, so automatic blocking isn't effective for long.
The proper course of action... |
192,820 | Is something wrong with StackOverflow's spam filter? Recently there have been huge numbers of spam topics related to football streaming. They have all been spam flagged and deleted but there are more getting posted all the time, I just flagged another 6 or so a few minutes ago. This has been going on for around 3 days ... | 2013/08/11 | [
"https://meta.stackexchange.com/questions/192820",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/226630/"
] | We're trying to get better at keeping this at bay. The problem affects all sites that see any kind of traffic, some more than others. I can't go into very much detail because frankly, there isn't a whole lot of detail that belongs to an agreed implementation at this point.
However ....
A big mistake we have made in t... | I've decided to attack the problem at the root, shutting down the spam blogs themselves.
The secret here is to run Google searches using queries like `site:blogspot.com watch football` (the `site:` operator as used here limits the search to the `blogspot.com` domain), click on and examine any suspicious results, and p... |
24,439,683 | I am just wondering is it possible to do something like this:
```
private int _x;
public int X
{
get{ return _x;}
set{_x = value; OnPropertyChanged(*theNameOfTheProperty*);}
}
```
without actually specifying `OnPropertyChanged("X");`
I guess making `OnPropertyChanged` more generic maybe using reflection... | 2014/06/26 | [
"https://Stackoverflow.com/questions/24439683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/990173/"
] | There are two ways to *sort of* do what you are asking. The first (.NET 4.5+ only!) way to do it is to modify OnPropertyChanged to:
```
private void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
....
}
```
Then you call it from the setter:
```
set
{
_var = value;
OnPropertyChanged();
}
``... | You can declare your `OnPropertyChanged` this way:
```
protected void OnPropertyChanged([CallerMemberName] string name = "")
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}
``... |
128,261 | Sometimes when I read I notice that some authors say **"the first time"** while others say **"for the first time"**. Of course mostly in different situations but is there a difference? What does the preposition change?
1. I have done it the first time in my life.
2. I have done it for the first time in my life.
Or
1... | 2017/05/02 | [
"https://ell.stackexchange.com/questions/128261",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/44134/"
] | You cannot use the present perfect with a time phrase that excludes the present, which *the first time* does, unlike *for the first time*.
"The first time" requires the past tense.
>
> I drove a car the first time at age 16.
>
>
> I drove a car for the first time at age 16.
>
>
> WooHoo! I have driven a car for... | This question has confused me for a long time. In my opinion (I am not a native speaker of English):
**the first time** can be used as conjunction, while **for the first time** can only be used as adverse:
>
> The first time *I saw him*, he was wearing a black coat.
>
>
> For the first time I *saw* him wearing a b... |
46,006,445 | I want to convert Int to ternary base
Like this:
```
42 -> 1120
```
What is the best way to do it in Scala? | 2017/09/01 | [
"https://Stackoverflow.com/questions/46006445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4518180/"
] | You can use `java.lang.Integer.toString(n, radix)`:
```
Integer.toString(42, 3)
``` | Use Java's [`Integer#toString(int, int)`](http://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html#toString-int-int-) method:
```
scala> Integer.toString(42, 3)
res0: String = 1120
``` |
37,202,346 | I tried to do the javascript to validate the date enter is in correct way. For example, for ETA(estimate time arrival), the date should be earlier than ETD(estimate time departure).
This is the form:
```
<form>
<label>ETA</label>
<input id="etadate" name="etadate" type="date" />
<... | 2016/05/13 | [
"https://Stackoverflow.com/questions/37202346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | S3 is not like a Linux file system.
Your S3 storage consists of buckets which contain objects in a completely flat space. The concept of "folder" is artificial: an object with key "foo" lives in the same flat bucket namespace as an object with key "path/to/bar". There is no separate step of creating a folder; you just... | Either the bucket name you given is incorrect or you didn't create the bucket.
You need to check out documentation about [Bucket Restriction](https://docs.aws.amazon.com/AmazonS3/latest/userguide/BucketRestrictions.html). From the documentation
>
> * Bucket names must be at least 3 and no more than 63 characters lon... |
7,825,152 | I have this code :
```
public void GenerateWtW() {
ExecutorService exec = Executors.newFixedThreadPool(30);
ConcurrentHashMap<String, Double> tf_idfCache = new ConcurrentHashMap<String, Double>();
ArrayList<String> allwords = getAllWords();
int no_docs = getNumberOfDocs();
in... | 2011/10/19 | [
"https://Stackoverflow.com/questions/7825152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/597076/"
] | I believe it's because `import scalaz._; import Scalaz._` imports all members from the `scalaz` package *and* from the `scalaz.Scalaz` object.
If you will just import `import scalaz.Scalaz._`, then you *only* import members from the `scalaz.Scalaz` object. | import scalaz.\_ imports all [type]classes from the core package.
import Scalaz.\_ imports implicits which make all these classes useful. Like conversions from standard collections to MA and getting Option wrapper and so on.
So you can use one without another.
I believe this is a conscious design decision to allow u... |
39,346 | I have seen the following sentences:
>
> Es ist besser, nicht den Kopf zu verlieren.
>
>
> Hör auf mich zu schlagen.
>
>
>
I would make the first sentence with simpler: *Verlieren* simply means *to lose.* So wouldn’t *den Kopf verlieren* already mean what I need? Why add *zu* here?
The same goes for the second ... | 2017/09/26 | [
"https://german.stackexchange.com/questions/39346",
"https://german.stackexchange.com",
"https://german.stackexchange.com/users/21682/"
] | There are many uses for the infinitive in German, sometimes with *zu*, sometimes without it. To keep it simple, I sum up the three cases with *zu* for someone who knows English:
First, sometimes when English uses its gerund, which German lacks:
>
> Zu lesen fällt mir leicht.
>
>
>
*Reading comes easy to me.*
BU... | You need to add "zu" in order to complete your thought about losing.
That's because the "infinitive" is "to lose" only in English. German has an infinitive form that ends in "en," verlieren. There is no "to" in that version.
When the German uses zu in "zu verlieren," the context is "in order/not *to lose*." The itali... |
46,235,473 | I am a newbie in Python and am just learning how to code. I have been working on a code that defines a function can trim a set of lines given in by the user and passes it onto another python script that calls it. The code is as follows:
```
import re
import sys
def calltrimport():
f=open("temp1.txt","w")
... | 2017/09/15 | [
"https://Stackoverflow.com/questions/46235473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8522778/"
] | After two days of losing my mind over the issue, I realized that *my raw input had "non-breaking-spaces" instead of "regular spaces"*. I realized this when I pasted the input in MS-Word and enabled the formatting characters display. To get around it, I explicitly set the default Python encoding to "UTF-8" by adding the... | This is unfortunately a guess (partly because you're printing `line` instead of `content` when there's an error), but could there be TAB characters in your input instead of spaces? The failing
```
split('] ')[1]
```
means that the string `'] '` doesn't appear in (that part of) the line.
More generally: try rewritin... |
38,106,456 | I'm trying to fetch my records in my **users** table and populate them in table if the input is correct using Raw SQL Queries. Trying this convert from SQL to Laravel Queries:
`SELECT * FROM`users`WHERE username = 'shadow'`
Unfortunately it gives me a error.
>
> Undefined variable: users (View: C:\Users\JohnFrancis... | 2016/06/29 | [
"https://Stackoverflow.com/questions/38106456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5991121/"
] | This should do what you want:
```
$user = User::where('username', $username)->get();
if ($user->isEmpty()) {
dd('Failed');
else {
dd('Success');
}
``` | If you are using a model, there is no need for DB::select. You would find a User by their username like so:
```
$user = User::where('username', '=', (the username))->get();
``` |
34,131,811 | I'm using superfish menu and I have a problem.
In the header, I have a logo holder `div` with the logo badge `div` and logo name `div` inside. When the user hovers over a top level link the sf-mega drop menu is show and a class of `.sfHover` is applied to the parent `li`.
My issue is that I need the logo badge to sho... | 2015/12/07 | [
"https://Stackoverflow.com/questions/34131811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1171010/"
] | Your usage of [hover()](https://api.jquery.com/hover/) is wrong here. It expects handler functions as argument. You should use it like this :
```
$('#mainMenu.sf-menu ul li').hover(
function() { // when the mouse pointer enters the element.
if ($(this).hasClass('sfHover')) {
$('.logoHolder .kingswor... | You can use pure css. here's the link.
```
//css FILE
.box {
height: 300px;
width: 300px;
background: red;
}
.hidden {
height: 100px;
width: 100px;
background: white;
display:none;
}
.box:hover .hidden {
display: block;
}
//HTML
<html>
<body>
<div class="box">
<div class="hidden">
He... |
37,721,709 | I have a column containing cells of text string which includes text and numbers. I found a great formula that finds the first number in the string and extracts it to the corresponding cell e.g.
Text String: "Initial commission of £9,999.99, then renewal commission of £9.9 from month 99"
Entering this formula `=LOOK... | 2016/06/09 | [
"https://Stackoverflow.com/questions/37721709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3917840/"
] | So this is the proposed function - it uses a simple 2-state approach. The problem with a general solution is with using a comma both as a thousands separator and part of the text as in the question. So 999,999 could be a single number or two separate numbers. Also, 99,99,99 although not a valid number returns TRUE from... | Well I managed to sort it out in the end with a crazy long formula.
Its not the prettiest of formulas but it does the job.
Thank you for your suggestiongs to which did lead me down the trail of thought to get the answer. Here are my formulas.
The string of text is in a table column called 'Event Label' formula refere... |
13,161,397 | If n is very big, and k is very small, can I say that O(kn) is linear complexity?
What if k is closed to n/2, but not more than n/2? Do I consider it still as linear complexity? Or quadratic complexity O(n^2)?
Is there a limit to how big k is, to consider O(kn) as quadratic complexity? | 2012/10/31 | [
"https://Stackoverflow.com/questions/13161397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/957352/"
] | If `k` is a constant, then any O(kn) function is O(n), i.e. linear
If `k` is a function of `n` and is O(n), then any O(kn) function is O(n^2). n/2 is O(n). Furthermore, `(n^2)/2` is *not* O(n), and so if `k` is close to `n/2` then `kn` is not O(n).
If `k` is not O(n), then `kn` is not O(n^2). | Assuming that k and n are independent variables, saying O(kn) is linear is a proper statement. |
10,949,081 | I've started using PHP lately... all is good except one thing.
I am trying to call a function from another php file... but it's not working.
It's probably really simple, but I haven't found anything useful to solve it.
I've used "required\_once " but it still does not work.
Does anyone know where I'm going wrong?
```... | 2012/06/08 | [
"https://Stackoverflow.com/questions/10949081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/831467/"
] | You don't need the $ before your function call
```
$short_url = $encode($long_id);
```
should be
```
$short_url = encode($long_id);
``` | The dollar sign would only be needed if the function is stored in a variable (which it isn't).
```
$short_url = encode($long_id);
``` |
10,949,081 | I've started using PHP lately... all is good except one thing.
I am trying to call a function from another php file... but it's not working.
It's probably really simple, but I haven't found anything useful to solve it.
I've used "required\_once " but it still does not work.
Does anyone know where I'm going wrong?
```... | 2012/06/08 | [
"https://Stackoverflow.com/questions/10949081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/831467/"
] | The dollar sign would only be needed if the function is stored in a variable (which it isn't).
```
$short_url = encode($long_id);
``` | As all others have said:
```
$short_url = encode($long_id);
```
But also you could clean up your require\_once statements:
```
define('DS', DIRECTORY_SEPARATOR);
require_once(dirname(__FILE__) . DS . 'database_functions.php');
require_once(dirname(__FILE__) . DS . 'encode_decode.php');
```
Instead of the define()... |
10,949,081 | I've started using PHP lately... all is good except one thing.
I am trying to call a function from another php file... but it's not working.
It's probably really simple, but I haven't found anything useful to solve it.
I've used "required\_once " but it still does not work.
Does anyone know where I'm going wrong?
```... | 2012/06/08 | [
"https://Stackoverflow.com/questions/10949081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/831467/"
] | You don't need the $ before your function call
```
$short_url = $encode($long_id);
```
should be
```
$short_url = encode($long_id);
``` | remove the dollar sign from in front of the function. a dollar sign in PHP indicates a variable |
10,949,081 | I've started using PHP lately... all is good except one thing.
I am trying to call a function from another php file... but it's not working.
It's probably really simple, but I haven't found anything useful to solve it.
I've used "required\_once " but it still does not work.
Does anyone know where I'm going wrong?
```... | 2012/06/08 | [
"https://Stackoverflow.com/questions/10949081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/831467/"
] | You don't need the $ before your function call
```
$short_url = $encode($long_id);
```
should be
```
$short_url = encode($long_id);
``` | As all others have said:
```
$short_url = encode($long_id);
```
But also you could clean up your require\_once statements:
```
define('DS', DIRECTORY_SEPARATOR);
require_once(dirname(__FILE__) . DS . 'database_functions.php');
require_once(dirname(__FILE__) . DS . 'encode_decode.php');
```
Instead of the define()... |
10,949,081 | I've started using PHP lately... all is good except one thing.
I am trying to call a function from another php file... but it's not working.
It's probably really simple, but I haven't found anything useful to solve it.
I've used "required\_once " but it still does not work.
Does anyone know where I'm going wrong?
```... | 2012/06/08 | [
"https://Stackoverflow.com/questions/10949081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/831467/"
] | remove the dollar sign from in front of the function. a dollar sign in PHP indicates a variable | As all others have said:
```
$short_url = encode($long_id);
```
But also you could clean up your require\_once statements:
```
define('DS', DIRECTORY_SEPARATOR);
require_once(dirname(__FILE__) . DS . 'database_functions.php');
require_once(dirname(__FILE__) . DS . 'encode_decode.php');
```
Instead of the define()... |
29,276,762 | I have a site with urls:
```
http://example.com/controller-name/page/about
http://example.com/controller-name/page/contactus
http://example.com/controller-name/page/services
```
But I need the urls like:
```
http://example.com/controller-name/about
http://example.com/controller-name/contactus
http://example.com/con... | 2015/03/26 | [
"https://Stackoverflow.com/questions/29276762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653023/"
] | Please add your
//execute background task
```
BackTask bt=new BackTask();
bt.execute();
```
in `onCreate()` **instead** on `onStart()`;
For more understanding please have a look at
[http://developer.android.com/training/basics/activity-lifecycle/index.html](http://developer.android.com/training/basics/act... | One way to make your activities respond better when you're checking for data remotely would be to cache data using onSaveInstanceState() and saving the record list in a bundle from which you can read during the onCreate() of your activity.
As just in case if the system decides to zap your activity from the stack then ... |
1,647,005 | The setup: I have a computer with Windows and two NICs; let's call them NIC1 and NIC2. NIC1 is used to interface with the corporate network, and NIC2 is used to interact with some equipment we'll call "the device". NIC1 uses DHCP, and NIC2 is assigned a static ip with no default gateway. The device on NIC2 is connected... | 2021/05/05 | [
"https://superuser.com/questions/1647005",
"https://superuser.com",
"https://superuser.com/users/1331529/"
] | >
> The problem: Sometimes it takes a little longer for the device to finish this reset/reboot cycle, and if the device is still down when the software polls it, the OS goes from looking for it through NIC 2, where it should be, and starts looking on NIC 1.
>
>
>
Connect the device through a cheap Ethernet switch.... | Let's say you have `eth0` configured by DHCP with some 172.16.x.x address and your target has address 192.168.1.1 and is directly connected to `eth1`.
* Configure `eth1` as 192.168.1.2/30
* Configure a subinterface `eth0:1` with 192.168.1.5/29
Now your box will normally try to contact the target via the most specific... |
1,647,005 | The setup: I have a computer with Windows and two NICs; let's call them NIC1 and NIC2. NIC1 is used to interface with the corporate network, and NIC2 is used to interact with some equipment we'll call "the device". NIC1 uses DHCP, and NIC2 is assigned a static ip with no default gateway. The device on NIC2 is connected... | 2021/05/05 | [
"https://superuser.com/questions/1647005",
"https://superuser.com",
"https://superuser.com/users/1331529/"
] | I was able to achieve my desired functionality by deleting the default route of 0.0.0.0/0.
I then created a routing table with entries to direct non-192.0.0.0/255 traffic to the external interface. I did this with 9 entries with the following IP/masks:
* 0.0.0.0/2
* 64.0.0.0/2
* 128.0.0.0/2
* 224.0.0.0/3
* 208.0.0.0/... | Let's say you have `eth0` configured by DHCP with some 172.16.x.x address and your target has address 192.168.1.1 and is directly connected to `eth1`.
* Configure `eth1` as 192.168.1.2/30
* Configure a subinterface `eth0:1` with 192.168.1.5/29
Now your box will normally try to contact the target via the most specific... |
13,119,876 | I have a Camel route such as:
```
<route errorHandlerRef="myDeadLetterErrorHandler">
<from uri="activemq:queue:source"/>
<to uri="activemq:queue:destA">
<to uri="activemq:queue:destB">
<to uri="activemq:queue:destC">
</route>
```
When one endpoint fail, I set a redeliveryPolicy to retry to send the ... | 2012/10/29 | [
"https://Stackoverflow.com/questions/13119876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1652262/"
] | Remove the attribute : `type="text/jscript"` or replace it with `text/javascript` and see if that works | error is here:
```
<script type="text/jscript">
```
It should be like this:
```
<script type="text/javascript">
``` |
13,119,876 | I have a Camel route such as:
```
<route errorHandlerRef="myDeadLetterErrorHandler">
<from uri="activemq:queue:source"/>
<to uri="activemq:queue:destA">
<to uri="activemq:queue:destB">
<to uri="activemq:queue:destC">
</route>
```
When one endpoint fail, I set a redeliveryPolicy to retry to send the ... | 2012/10/29 | [
"https://Stackoverflow.com/questions/13119876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1652262/"
] | Remove the attribute : `type="text/jscript"` or replace it with `text/javascript` and see if that works | type="text/jscript" could be the problem. If you change that to type="text/javascript" it does seem to work. |
13,119,876 | I have a Camel route such as:
```
<route errorHandlerRef="myDeadLetterErrorHandler">
<from uri="activemq:queue:source"/>
<to uri="activemq:queue:destA">
<to uri="activemq:queue:destB">
<to uri="activemq:queue:destC">
</route>
```
When one endpoint fail, I set a redeliveryPolicy to retry to send the ... | 2012/10/29 | [
"https://Stackoverflow.com/questions/13119876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1652262/"
] | error is here:
```
<script type="text/jscript">
```
It should be like this:
```
<script type="text/javascript">
``` | type="text/jscript" could be the problem. If you change that to type="text/javascript" it does seem to work. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.