qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
42,627 | If I am living in England around 1000 and some Scandinavian raiders show up at my village to pillage our farms, which phrase would I be most likely to be saying:
* "Oh no, here come the Vikings!"
* "Oh no, here come the Northmen!"
* "Oh no, here come the Norsemen!"
* "Oh no, here come the Danes!"
* "Oh no, here come t... | 2017/12/28 | [
"https://history.stackexchange.com/questions/42627",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/4748/"
] | Usually "Danes", or the "pagans"[note], or possibly the "Northmen" - though the last was more of a Continental usage.
>
> In Francia these Scandinavians were called 'Northmen' or 'Danes' (in translation), and in England they were called 'Danes' or 'pagans' in contemporary chronicles.
>
>
> **Brink, Stefan. "Who we... | What about [*"heathens"*](https://en.wiktionary.org/wiki/heathen#English)? It comes from Old English [hæþen](https://en.wiktionary.org/wiki/h%C3%A6%C3%BEen), and basically means pagan, which was also mentioned in other answers.
Notice this word comes most probably from a Saxon origin, *"hedhin"*, compared with pagan, ... |
42,627 | If I am living in England around 1000 and some Scandinavian raiders show up at my village to pillage our farms, which phrase would I be most likely to be saying:
* "Oh no, here come the Vikings!"
* "Oh no, here come the Northmen!"
* "Oh no, here come the Norsemen!"
* "Oh no, here come the Danes!"
* "Oh no, here come t... | 2017/12/28 | [
"https://history.stackexchange.com/questions/42627",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/4748/"
] | What about [*"heathens"*](https://en.wiktionary.org/wiki/heathen#English)? It comes from Old English [hæþen](https://en.wiktionary.org/wiki/h%C3%A6%C3%BEen), and basically means pagan, which was also mentioned in other answers.
Notice this word comes most probably from a Saxon origin, *"hedhin"*, compared with pagan, ... | As used in The Wake by Paul Kingsnorth or in Beowulf, your Englishman might use "ingenga" to mean invader or visitor. |
59,952,263 | I have a multidimensional numpy array like so:
```
np.array([("a",1,"x"),("b",2,"y"),("c",1,"z")])
```
I need to create fourth "column" to the array based on an if then of the 2nd column for example.
If `[:,2] == 1` then newcolumn = 'Wow' else 'Dud'
So that it returns something like:
```
[("a",1,"x","Wow"),("b",... | 2020/01/28 | [
"https://Stackoverflow.com/questions/59952263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3220955/"
] | Try pandas
```
>> import pandas as pd
>> df = pd.DataFrame([("a",1,"x"),("b",2,"y"),("c",1,"z")], columns=['col1', 'col2', 'col3'])
```
>
>
> ```
> df
> col1 col2 col3
> 0 a 1 x
> 1 b 2 y
> 2 c 1 z
>
> ```
>
>
create a function to operate on rows (doesn't have to be a lambda), ... | Notice dtype has to accomodate for the longest strings it will ever hold, in this case, of length 3
```
a = np.array([("a",1,"x"),("b",2,"y"),("c",1,"z")], dtype='<U3')
```
>
>
> ```
> a
> array([['a', '1', 'x'],
> ['b', '2', 'y'],
> ['c', '1', 'z']], dtype='<U1')
>
> ```
>
>
Create a placehold... |
59,952,263 | I have a multidimensional numpy array like so:
```
np.array([("a",1,"x"),("b",2,"y"),("c",1,"z")])
```
I need to create fourth "column" to the array based on an if then of the 2nd column for example.
If `[:,2] == 1` then newcolumn = 'Wow' else 'Dud'
So that it returns something like:
```
[("a",1,"x","Wow"),("b",... | 2020/01/28 | [
"https://Stackoverflow.com/questions/59952263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3220955/"
] | Try pandas
```
>> import pandas as pd
>> df = pd.DataFrame([("a",1,"x"),("b",2,"y"),("c",1,"z")], columns=['col1', 'col2', 'col3'])
```
>
>
> ```
> df
> col1 col2 col3
> 0 a 1 x
> 1 b 2 y
> 2 c 1 z
>
> ```
>
>
create a function to operate on rows (doesn't have to be a lambda), ... | Your array constructor produces a string dtype:
```
In [73]: arr = np.array([("a",1,"x"),("b",2,"y"),("c",1,"z")])
In [74]: arr
Out[74]:
array([['a', '1', 'x'],
['b', '2', 'y'],
['c', ... |
59,952,263 | I have a multidimensional numpy array like so:
```
np.array([("a",1,"x"),("b",2,"y"),("c",1,"z")])
```
I need to create fourth "column" to the array based on an if then of the 2nd column for example.
If `[:,2] == 1` then newcolumn = 'Wow' else 'Dud'
So that it returns something like:
```
[("a",1,"x","Wow"),("b",... | 2020/01/28 | [
"https://Stackoverflow.com/questions/59952263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3220955/"
] | Notice dtype has to accomodate for the longest strings it will ever hold, in this case, of length 3
```
a = np.array([("a",1,"x"),("b",2,"y"),("c",1,"z")], dtype='<U3')
```
>
>
> ```
> a
> array([['a', '1', 'x'],
> ['b', '2', 'y'],
> ['c', '1', 'z']], dtype='<U1')
>
> ```
>
>
Create a placehold... | Your array constructor produces a string dtype:
```
In [73]: arr = np.array([("a",1,"x"),("b",2,"y"),("c",1,"z")])
In [74]: arr
Out[74]:
array([['a', '1', 'x'],
['b', '2', 'y'],
['c', ... |
18,911,356 | I have a question. I tried to run my web application using Spring and Hibernate/ I have a strange error. NoSuchBeanDefinitionException. Stacktrace is:
```
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.hibernate.SessionFactory] found for dependency: expected... | 2013/09/20 | [
"https://Stackoverflow.com/questions/18911356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2114952/"
] | I would start with cleaning your configuration
This
```
<context:component-scan base-package="com.example" />
```
Includes all this
```
<context:component-scan base-package="com.example" />
<context:component-scan base-package="com.example.service" />
<context:component-scan base-package="com.example.service.impl"... | If you use @Autowired you don't need to declare like a property at the context. But it must be at the context--->NoSuchBeanDefinition--> don't find it.
```
<bean id="userService" class="com.example.service.impl.UserServiceImpl">
<property name="userDAO" ref="userDAO" />
</bean>
```
try to remove userDAO from p... |
18,911,356 | I have a question. I tried to run my web application using Spring and Hibernate/ I have a strange error. NoSuchBeanDefinitionException. Stacktrace is:
```
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.hibernate.SessionFactory] found for dependency: expected... | 2013/09/20 | [
"https://Stackoverflow.com/questions/18911356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2114952/"
] | I would start with cleaning your configuration
This
```
<context:component-scan base-package="com.example" />
```
Includes all this
```
<context:component-scan base-package="com.example" />
<context:component-scan base-package="com.example.service" />
<context:component-scan base-package="com.example.service.impl"... | Somtimes what Spring actually trying to say is:
```
There are multiple bean definitions...
```
I had this problem:
```
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'metadataGeneratorFilter' is defined
```
once where I had an xml file like this:
```
<security:custom-fi... |
41,066,667 | I'm new here, so I hope I can describe this problem right, as well as help others when I'm more into Java and stuff.
But here's why I'm here...I need to convert a given text-file, so I can use it in a program called "SUBDUE".
The format of the given graphs in the file looks like this:
```
v 2_i_6 startevent
v 2_i_7... | 2016/12/09 | [
"https://Stackoverflow.com/questions/41066667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7273798/"
] | This can be used as a starting point. Splitting the string seems to be a better approach.
```
public static void main(String[] args) {
// TODO code application logic here
String [] input = {"v 2_i_6 startevent", "", "v 2_i_7 endevent"};
for(int i = 0; i < input.length; i++)
{
System.out.printl... | your replace all logic is incorrect.
3\_i\_1 maps to 3
it also match the replaceAll case for 3\_i\_15 which is why you see it being replaced as 34, 35, 36
I had two graphs in my file.txt and I see the problem manifest with the second graph. One workaround is to append a " " space in the replace all clause to disting... |
41,066,667 | I'm new here, so I hope I can describe this problem right, as well as help others when I'm more into Java and stuff.
But here's why I'm here...I need to convert a given text-file, so I can use it in a program called "SUBDUE".
The format of the given graphs in the file looks like this:
```
v 2_i_6 startevent
v 2_i_7... | 2016/12/09 | [
"https://Stackoverflow.com/questions/41066667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7273798/"
] | I add this part to your code
```
ArrayList <String> strings = new ArrayList<>();
int counter=0;
while ((line = br.readLine()) != null) {
if (line.startsWith("%")) {//every graph starts with % and a number so i know which graph is currently in progress
i = 0;
}
if (line.startsWith("v")) ... | your replace all logic is incorrect.
3\_i\_1 maps to 3
it also match the replaceAll case for 3\_i\_15 which is why you see it being replaced as 34, 35, 36
I had two graphs in my file.txt and I see the problem manifest with the second graph. One workaround is to append a " " space in the replace all clause to disting... |
2,061,420 | The following statement works as expected:
```
os.system("curl --data-binary \@"+input_file_path+" -o "+ file_name +" localhost:30")
```
But when trying it with `subprocess.popen`:
```
Popen(['curl','--data-binary','\@'+input_file_path, '-o', file_name,'localhost:30'], stdout=PIPE).communicate()[0]
```
Curl seems... | 2010/01/14 | [
"https://Stackoverflow.com/questions/2061420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/124504/"
] | You could try using the original string in `subprocess.Popen` with the additional keyword argument to `Popen` of `shell=True`:
```
subprocess.Popen("curl --data-binary \@"+input_file_path+" -o "+ file_name +" localhost:30",
stdout=subprocess.PIPE,
shell=True)
``` | how about [using a library](http://pycurl.sourceforge.net/) instead of calling system's curl? |
2,061,420 | The following statement works as expected:
```
os.system("curl --data-binary \@"+input_file_path+" -o "+ file_name +" localhost:30")
```
But when trying it with `subprocess.popen`:
```
Popen(['curl','--data-binary','\@'+input_file_path, '-o', file_name,'localhost:30'], stdout=PIPE).communicate()[0]
```
Curl seems... | 2010/01/14 | [
"https://Stackoverflow.com/questions/2061420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/124504/"
] | You could try using the original string in `subprocess.Popen` with the additional keyword argument to `Popen` of `shell=True`:
```
subprocess.Popen("curl --data-binary \@"+input_file_path+" -o "+ file_name +" localhost:30",
stdout=subprocess.PIPE,
shell=True)
``` | How about using requests library
[Python POST binary data](https://stackoverflow.com/questions/14365027/python-post-binary-data)
Or yet another
Check out this link for binary (image file) case
[How to download image using requests](https://stackoverflow.com/questions/13137817/how-to-download-image-using-requests) |
2,061,420 | The following statement works as expected:
```
os.system("curl --data-binary \@"+input_file_path+" -o "+ file_name +" localhost:30")
```
But when trying it with `subprocess.popen`:
```
Popen(['curl','--data-binary','\@'+input_file_path, '-o', file_name,'localhost:30'], stdout=PIPE).communicate()[0]
```
Curl seems... | 2010/01/14 | [
"https://Stackoverflow.com/questions/2061420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/124504/"
] | how about [using a library](http://pycurl.sourceforge.net/) instead of calling system's curl? | How about using requests library
[Python POST binary data](https://stackoverflow.com/questions/14365027/python-post-binary-data)
Or yet another
Check out this link for binary (image file) case
[How to download image using requests](https://stackoverflow.com/questions/13137817/how-to-download-image-using-requests) |
31,847,630 | I am looking to do row deleting in R based on advanced selection logic (i.e. not just a simple subset). Here is some sample code and what I need to do
```
v1 <- c(1:11)
v2 <- c('a','a','b','b','b','b','c','c','c','c','c')
v3 <- c(3,13,14,13,14,9,14,13,14,13,14)
v4 <- c('','x','','','','x','','','','','x')
v5 <- c('','... | 2015/08/06 | [
"https://Stackoverflow.com/questions/31847630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4430556/"
] | Base `R` using `cumsum` twice:
```
posty <- function(x) cumsum(cumsum(x))<=1
test.df[with(test.df, ave(logic_flag=="y", level, FUN=posty)),]
# id level number end_flag logic_flag
#1 1 a 3
#2 2 a 13 x x
#3 3 b 14
#4 4 b 13 ... | Using `dplyr` you can do
```
library(dplyr)
test.df %>% group_by(level) %>%
filter(head(cumsum(c(F, logic_flag == 'y')) == 0, -1))
# id level number end_flag logic_flag
# 1 1 a 3
# 2 2 a 13 x x
# 3 3 b 14
# 4 4 b 13 ... |
18,463,559 | How to do 'gm composite -gravity center change\_image\_url base\_image\_url' with GM Node.js?
How to call `gm().command()` & `gm().in()` or `gm().out()` to achieve the above? | 2013/08/27 | [
"https://Stackoverflow.com/questions/18463559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2721288/"
] | After struggling for an hour, here is my solution for your question:
```
gm composite -gravity center change_image_url base_image_url
gm()
.command("composite")
.in("-gravity", "center")
.in(change_image_url)
.in(base_image_url)
.write( output_file, function (err) {
if (!err)
console.log(' hooray! ');
else
... | Why does nobody use `composite` command? (<https://github.com/aheckmann/gm>)
```
var gm = require('gm');
var bgImage = 'bg.jpg',
frontImage = 'front.jpg',
resultImage = 'result.jpg',
xy = '+100+150';
gm(bgImage)
.composite(frontImage)
.geometry(xy)
.write(resultImage, function (err) {
if (!err) ... |
18,463,559 | How to do 'gm composite -gravity center change\_image\_url base\_image\_url' with GM Node.js?
How to call `gm().command()` & `gm().in()` or `gm().out()` to achieve the above? | 2013/08/27 | [
"https://Stackoverflow.com/questions/18463559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2721288/"
] | Install gm, (make sure you already install graphicsmagick
```
npm install gm
```
following is my example code to merge two image together (use `gm.in`)
```
var gm = require('gm');
gm()
.in('-page', '+0+0')
.in('bg.jpg')
.in('-page', '+10+20') // location of smallIcon.jpg is x,y -> 10, 20
.in('smallIcon.jpg')
... | Why does nobody use `composite` command? (<https://github.com/aheckmann/gm>)
```
var gm = require('gm');
var bgImage = 'bg.jpg',
frontImage = 'front.jpg',
resultImage = 'result.jpg',
xy = '+100+150';
gm(bgImage)
.composite(frontImage)
.geometry(xy)
.write(resultImage, function (err) {
if (!err) ... |
18,463,559 | How to do 'gm composite -gravity center change\_image\_url base\_image\_url' with GM Node.js?
How to call `gm().command()` & `gm().in()` or `gm().out()` to achieve the above? | 2013/08/27 | [
"https://Stackoverflow.com/questions/18463559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2721288/"
] | Install gm, (make sure you already install graphicsmagick
```
npm install gm
```
following is my example code to merge two image together (use `gm.in`)
```
var gm = require('gm');
gm()
.in('-page', '+0+0')
.in('bg.jpg')
.in('-page', '+10+20') // location of smallIcon.jpg is x,y -> 10, 20
.in('smallIcon.jpg')
... | i am doing that this way:
```
var exec = require('child_process').exec
var command = [
'-composite',
'-watermark', '20x50',
'-gravity', 'center',
'-quality', 100,
'images/watermark.png',
'images/input.jpg', //input
'images/watermarked.png' //output
];
... |
18,463,559 | How to do 'gm composite -gravity center change\_image\_url base\_image\_url' with GM Node.js?
How to call `gm().command()` & `gm().in()` or `gm().out()` to achieve the above? | 2013/08/27 | [
"https://Stackoverflow.com/questions/18463559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2721288/"
] | i am doing that this way:
```
var exec = require('child_process').exec
var command = [
'-composite',
'-watermark', '20x50',
'-gravity', 'center',
'-quality', 100,
'images/watermark.png',
'images/input.jpg', //input
'images/watermarked.png' //output
];
... | Having the pleasure of being confined to a windows machine for the moment I solved this problem eventually by not using the "gm" module at all. For some reason, even though I have installed graphics-magick via its installer the node module refused to find it in my environment variables. But that could have something to... |
18,463,559 | How to do 'gm composite -gravity center change\_image\_url base\_image\_url' with GM Node.js?
How to call `gm().command()` & `gm().in()` or `gm().out()` to achieve the above? | 2013/08/27 | [
"https://Stackoverflow.com/questions/18463559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2721288/"
] | Why does nobody use `composite` command? (<https://github.com/aheckmann/gm>)
```
var gm = require('gm');
var bgImage = 'bg.jpg',
frontImage = 'front.jpg',
resultImage = 'result.jpg',
xy = '+100+150';
gm(bgImage)
.composite(frontImage)
.geometry(xy)
.write(resultImage, function (err) {
if (!err) ... | Having the pleasure of being confined to a windows machine for the moment I solved this problem eventually by not using the "gm" module at all. For some reason, even though I have installed graphics-magick via its installer the node module refused to find it in my environment variables. But that could have something to... |
18,463,559 | How to do 'gm composite -gravity center change\_image\_url base\_image\_url' with GM Node.js?
How to call `gm().command()` & `gm().in()` or `gm().out()` to achieve the above? | 2013/08/27 | [
"https://Stackoverflow.com/questions/18463559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2721288/"
] | After struggling for an hour, here is my solution for your question:
```
gm composite -gravity center change_image_url base_image_url
gm()
.command("composite")
.in("-gravity", "center")
.in(change_image_url)
.in(base_image_url)
.write( output_file, function (err) {
if (!err)
console.log(' hooray! ');
else
... | i am doing that this way:
```
var exec = require('child_process').exec
var command = [
'-composite',
'-watermark', '20x50',
'-gravity', 'center',
'-quality', 100,
'images/watermark.png',
'images/input.jpg', //input
'images/watermarked.png' //output
];
... |
18,463,559 | How to do 'gm composite -gravity center change\_image\_url base\_image\_url' with GM Node.js?
How to call `gm().command()` & `gm().in()` or `gm().out()` to achieve the above? | 2013/08/27 | [
"https://Stackoverflow.com/questions/18463559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2721288/"
] | Why does nobody use `composite` command? (<https://github.com/aheckmann/gm>)
```
var gm = require('gm');
var bgImage = 'bg.jpg',
frontImage = 'front.jpg',
resultImage = 'result.jpg',
xy = '+100+150';
gm(bgImage)
.composite(frontImage)
.geometry(xy)
.write(resultImage, function (err) {
if (!err) ... | If you want to resize **and** merge, you can use this:
```
gm()
.in('-geometry', '+0+0')
.in('./img/img1.png')
.in('-geometry', '300x300+100+200')
.in('./img/img2.png')
.flatten()
.write('resultGM.png', function (err) {
if (err) console.log(err);
});
``` |
18,463,559 | How to do 'gm composite -gravity center change\_image\_url base\_image\_url' with GM Node.js?
How to call `gm().command()` & `gm().in()` or `gm().out()` to achieve the above? | 2013/08/27 | [
"https://Stackoverflow.com/questions/18463559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2721288/"
] | Install gm, (make sure you already install graphicsmagick
```
npm install gm
```
following is my example code to merge two image together (use `gm.in`)
```
var gm = require('gm');
gm()
.in('-page', '+0+0')
.in('bg.jpg')
.in('-page', '+10+20') // location of smallIcon.jpg is x,y -> 10, 20
.in('smallIcon.jpg')
... | If you want to resize **and** merge, you can use this:
```
gm()
.in('-geometry', '+0+0')
.in('./img/img1.png')
.in('-geometry', '300x300+100+200')
.in('./img/img2.png')
.flatten()
.write('resultGM.png', function (err) {
if (err) console.log(err);
});
``` |
18,463,559 | How to do 'gm composite -gravity center change\_image\_url base\_image\_url' with GM Node.js?
How to call `gm().command()` & `gm().in()` or `gm().out()` to achieve the above? | 2013/08/27 | [
"https://Stackoverflow.com/questions/18463559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2721288/"
] | Install gm, (make sure you already install graphicsmagick
```
npm install gm
```
following is my example code to merge two image together (use `gm.in`)
```
var gm = require('gm');
gm()
.in('-page', '+0+0')
.in('bg.jpg')
.in('-page', '+10+20') // location of smallIcon.jpg is x,y -> 10, 20
.in('smallIcon.jpg')
... | Having the pleasure of being confined to a windows machine for the moment I solved this problem eventually by not using the "gm" module at all. For some reason, even though I have installed graphics-magick via its installer the node module refused to find it in my environment variables. But that could have something to... |
18,463,559 | How to do 'gm composite -gravity center change\_image\_url base\_image\_url' with GM Node.js?
How to call `gm().command()` & `gm().in()` or `gm().out()` to achieve the above? | 2013/08/27 | [
"https://Stackoverflow.com/questions/18463559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2721288/"
] | After struggling for an hour, here is my solution for your question:
```
gm composite -gravity center change_image_url base_image_url
gm()
.command("composite")
.in("-gravity", "center")
.in(change_image_url)
.in(base_image_url)
.write( output_file, function (err) {
if (!err)
console.log(' hooray! ');
else
... | If you want to resize **and** merge, you can use this:
```
gm()
.in('-geometry', '+0+0')
.in('./img/img1.png')
.in('-geometry', '300x300+100+200')
.in('./img/img2.png')
.flatten()
.write('resultGM.png', function (err) {
if (err) console.log(err);
});
``` |
16,444,684 | I have an array called "first" and another array called "second", both arrays are of type byte and size of 10 indexes.
I am copying the two arrays into one array called "third" of type byte too and of length 2\*first.length as follow:
```
byte[] third= new byte[2*first.length];
for(int i = 0; i<first.length;i++){
... | 2013/05/08 | [
"https://Stackoverflow.com/questions/16444684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2135363/"
] | You pass [`System.arraycopy`](http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#arraycopy%28java.lang.Object,%20int,%20java.lang.Object,%20int,%20int%29) the *array*, not the array element. By passing `first[i]` into `arraycopy` as the first argument, you're passing in a **`byte`**, which (because `arrayco... | ```
System.arraycopy(first, 0, third, 0, first.length);
System.arraycopy(second, 0, third, first.length, second.length);
``` |
16,651,001 | I get this error when I try to get to the users#login page.
my controller is
```
class UsersController < ApplicationController
# GET /users
# GET /users.json
def login
@username = User.find_by_username(params[:username])
@password = params[:password]
if(@username.password == @password)
format.json { render json: @us... | 2013/05/20 | [
"https://Stackoverflow.com/questions/16651001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1799328/"
] | To be able to read the old `status` values, you have to do both updates in a single query.
You are correct that this requires a [CASE expression](http://www.sqlite.org/lang_expr.html#case); something like this:
```
UPDATE Project
SET status = CASE
WHEN status = 'true' THEN 'false'
WHEN id = '... | ```
try {
String where = "id=? or status=?";
String[] whereArgs = new String[] { Id,"false" };
SQLiteDatabase db = this.getWritableDatabase();
ContentValues initialValues = new ContentValues();
initialValues.put("status", "true");
db.update(TABLE_PROJECT, initialValues, where, whereArgs);
... |
5,725,596 | I'm working on a website where the same instance runs across multiple domains (and not just sub-domains).
Is it possible to create a cookie thats accessible across all of these domains?
Similar to the way facebook cookies work from everywhere. | 2011/04/20 | [
"https://Stackoverflow.com/questions/5725596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/75946/"
] | Only for subdomains in the same root domain - you can use wildcard cookies by just specifying the subdomain. ex. sv1.test.com sv2.test.com all would use test.com
see:
<http://forums.asp.net/t/369569.aspx/1>
For using a single cookie cross root domain - you cannot do this. It breaks the rules of trust - otherwise my a... | Could you have .js functions on `CommonSite.com` that store and retrieve the cookies?
So you might have `commonSite.com/CookieMonster.js`
Then on :
`FirstDomain.com/MyPage.htm` you could call `commonsite.com/cookiemonster.js`'s `SaveCooke(CookieValue)`
Same on `SecondDomin.com/OtherPage.htm` |
9,657 | **After effects** noob here. I'm working on an animation where a ball falls through a hole. I created a `Shape layer` to use as the mask, but I can't get it to mask the ball layer.
I've also tried adding a mask directly to the ball layer, but it moves with the rest of the animation. Is there a way to turn the mask on ... | 2013/12/13 | [
"https://avp.stackexchange.com/questions/9657",
"https://avp.stackexchange.com",
"https://avp.stackexchange.com/users/4007/"
] | I found this post helpful: [Preventing a Mask From Animating](http://forums.adobe.com/thread/704283)
>
> 1. Create a comp size solid above your text layer.
> 2. Apply the mask to the solid.
> 3. Set the **Track Matte** setting of your text layer to `Alpha Matte`.
> 4. The text layer will now adopt the alpha channel ... | In these cases, I generally precompose the layer and apply the mask to the precomp (the layer is animating inside the precomp) |
335,064 | I want to have all DNS queries passing through tor.
**How to set my default DNS to go through tor?**
In other word I want to use the IP given by `tor-resolve google.com` instead of `dig google.com`. | 2017/01/05 | [
"https://unix.stackexchange.com/questions/335064",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/204816/"
] | There are a couple of problems with your script:
1. You need to add a second `sed` after the second pipe (`|`).
2. `sed -i` tells `sed` to edit files "in-place", but there is no file specified - `sed` is using `stdin`, coming from `cat`. You can safely remove the `-i` and your script should now work.
The fixed script... | You are using it wrong.
First, you don't need cat. `sed` can take filename to read. Like this:
```
sed 's/sole/sun/g' italian.txt
```
Second, you don't need pipe-redirection for next `sed`-expression. If you need it, it should looks like this:
```
sed 's/sole/sun/g' italian.txt | sed 's/penna/pen/g' > english.txt
... |
335,064 | I want to have all DNS queries passing through tor.
**How to set my default DNS to go through tor?**
In other word I want to use the IP given by `tor-resolve google.com` instead of `dig google.com`. | 2017/01/05 | [
"https://unix.stackexchange.com/questions/335064",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/204816/"
] | There are a couple of problems with your script:
1. You need to add a second `sed` after the second pipe (`|`).
2. `sed -i` tells `sed` to edit files "in-place", but there is no file specified - `sed` is using `stdin`, coming from `cat`. You can safely remove the `-i` and your script should now work.
The fixed script... | It's not necessary and redundant to overwrite the contents of italian.txt since the output of `sed` is being redirected to another file called english.txt and saved anyway. It's also possible to eliminate the useless use of `cat`
```
sed -e 's/sole/sun/g' -e 's/penna/pen/g' italian.txt | tee english.txt
```
* `sed... |
335,064 | I want to have all DNS queries passing through tor.
**How to set my default DNS to go through tor?**
In other word I want to use the IP given by `tor-resolve google.com` instead of `dig google.com`. | 2017/01/05 | [
"https://unix.stackexchange.com/questions/335064",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/204816/"
] | There are a couple of problems with your script:
1. You need to add a second `sed` after the second pipe (`|`).
2. `sed -i` tells `sed` to edit files "in-place", but there is no file specified - `sed` is using `stdin`, coming from `cat`. You can safely remove the `-i` and your script should now work.
The fixed script... | If you had a file with word pairs, for example
```
sole sun
penna pen
```
... and so on for many words in Italian and English (there's no practical limit other than memory), then you could create a `sed` script
```
s/\<sole\>/sun/g
s/\<penna\>/pen/g
```
... (where `\<word\>` will match only the word `word` and no... |
335,064 | I want to have all DNS queries passing through tor.
**How to set my default DNS to go through tor?**
In other word I want to use the IP given by `tor-resolve google.com` instead of `dig google.com`. | 2017/01/05 | [
"https://unix.stackexchange.com/questions/335064",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/204816/"
] | There are a couple of problems with your script:
1. You need to add a second `sed` after the second pipe (`|`).
2. `sed -i` tells `sed` to edit files "in-place", but there is no file specified - `sed` is using `stdin`, coming from `cat`. You can safely remove the `-i` and your script should now work.
The fixed script... | A variant of @Kusalanananda idea:
```
$ cat dict
sole:sun
penna:pen
$ sed -f <(sed -r 's!(.+):(.+)!s/\\<\1\\>/\2/g!' dict) it.txt >en.txt
``` |
335,064 | I want to have all DNS queries passing through tor.
**How to set my default DNS to go through tor?**
In other word I want to use the IP given by `tor-resolve google.com` instead of `dig google.com`. | 2017/01/05 | [
"https://unix.stackexchange.com/questions/335064",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/204816/"
] | You are using it wrong.
First, you don't need cat. `sed` can take filename to read. Like this:
```
sed 's/sole/sun/g' italian.txt
```
Second, you don't need pipe-redirection for next `sed`-expression. If you need it, it should looks like this:
```
sed 's/sole/sun/g' italian.txt | sed 's/penna/pen/g' > english.txt
... | It's not necessary and redundant to overwrite the contents of italian.txt since the output of `sed` is being redirected to another file called english.txt and saved anyway. It's also possible to eliminate the useless use of `cat`
```
sed -e 's/sole/sun/g' -e 's/penna/pen/g' italian.txt | tee english.txt
```
* `sed... |
335,064 | I want to have all DNS queries passing through tor.
**How to set my default DNS to go through tor?**
In other word I want to use the IP given by `tor-resolve google.com` instead of `dig google.com`. | 2017/01/05 | [
"https://unix.stackexchange.com/questions/335064",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/204816/"
] | You are using it wrong.
First, you don't need cat. `sed` can take filename to read. Like this:
```
sed 's/sole/sun/g' italian.txt
```
Second, you don't need pipe-redirection for next `sed`-expression. If you need it, it should looks like this:
```
sed 's/sole/sun/g' italian.txt | sed 's/penna/pen/g' > english.txt
... | A variant of @Kusalanananda idea:
```
$ cat dict
sole:sun
penna:pen
$ sed -f <(sed -r 's!(.+):(.+)!s/\\<\1\\>/\2/g!' dict) it.txt >en.txt
``` |
335,064 | I want to have all DNS queries passing through tor.
**How to set my default DNS to go through tor?**
In other word I want to use the IP given by `tor-resolve google.com` instead of `dig google.com`. | 2017/01/05 | [
"https://unix.stackexchange.com/questions/335064",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/204816/"
] | If you had a file with word pairs, for example
```
sole sun
penna pen
```
... and so on for many words in Italian and English (there's no practical limit other than memory), then you could create a `sed` script
```
s/\<sole\>/sun/g
s/\<penna\>/pen/g
```
... (where `\<word\>` will match only the word `word` and no... | It's not necessary and redundant to overwrite the contents of italian.txt since the output of `sed` is being redirected to another file called english.txt and saved anyway. It's also possible to eliminate the useless use of `cat`
```
sed -e 's/sole/sun/g' -e 's/penna/pen/g' italian.txt | tee english.txt
```
* `sed... |
335,064 | I want to have all DNS queries passing through tor.
**How to set my default DNS to go through tor?**
In other word I want to use the IP given by `tor-resolve google.com` instead of `dig google.com`. | 2017/01/05 | [
"https://unix.stackexchange.com/questions/335064",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/204816/"
] | It's not necessary and redundant to overwrite the contents of italian.txt since the output of `sed` is being redirected to another file called english.txt and saved anyway. It's also possible to eliminate the useless use of `cat`
```
sed -e 's/sole/sun/g' -e 's/penna/pen/g' italian.txt | tee english.txt
```
* `sed... | A variant of @Kusalanananda idea:
```
$ cat dict
sole:sun
penna:pen
$ sed -f <(sed -r 's!(.+):(.+)!s/\\<\1\\>/\2/g!' dict) it.txt >en.txt
``` |
335,064 | I want to have all DNS queries passing through tor.
**How to set my default DNS to go through tor?**
In other word I want to use the IP given by `tor-resolve google.com` instead of `dig google.com`. | 2017/01/05 | [
"https://unix.stackexchange.com/questions/335064",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/204816/"
] | If you had a file with word pairs, for example
```
sole sun
penna pen
```
... and so on for many words in Italian and English (there's no practical limit other than memory), then you could create a `sed` script
```
s/\<sole\>/sun/g
s/\<penna\>/pen/g
```
... (where `\<word\>` will match only the word `word` and no... | A variant of @Kusalanananda idea:
```
$ cat dict
sole:sun
penna:pen
$ sed -f <(sed -r 's!(.+):(.+)!s/\\<\1\\>/\2/g!' dict) it.txt >en.txt
``` |
60,614,303 | I would like to replace commas in my strings, between dynamic positions (ie. between double quotes). Note that I will not have more than 2 occurrences of double quotes in my strings if that matters.
My example:
```
'randomtext,123,"JEAN SEBASTIEN, GUY, DANIEL",sun'
```
Desired output:
```
'randomtext,123,"JEAN SE... | 2020/03/10 | [
"https://Stackoverflow.com/questions/60614303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8642243/"
] | I also had the same issue.
First I tried disabling Ivy in tsconfig.app.json, and its works fine. Which concludes that problem is with Ivy. Thanks to @user2846469
```
"angularCompilerOptions": {
"enableIvy": false
}
```
[Github Issue](https://github.com/angular/angular/issues/37102)
Clearly describes the problem ... | With me, the issue was:
I mistakenly used a slash with path as: `/teams`
```
const routes: Routes = [
{path: "", component: HomeComponent},
{path: "/teams", component: TeamsComponent}
];
```
Instead, it simply should have been as: `teams`
```
const routes: Routes = [
{path: "", component: HomeComponent},
{... |
60,614,303 | I would like to replace commas in my strings, between dynamic positions (ie. between double quotes). Note that I will not have more than 2 occurrences of double quotes in my strings if that matters.
My example:
```
'randomtext,123,"JEAN SEBASTIEN, GUY, DANIEL",sun'
```
Desired output:
```
'randomtext,123,"JEAN SE... | 2020/03/10 | [
"https://Stackoverflow.com/questions/60614303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8642243/"
] | I had the same issue, in my case it occurred after enabling strict mode. I fixed it by removing `"sideEffects": false` from `package.json` | With me, the issue was:
I mistakenly used a slash with path as: `/teams`
```
const routes: Routes = [
{path: "", component: HomeComponent},
{path: "/teams", component: TeamsComponent}
];
```
Instead, it simply should have been as: `teams`
```
const routes: Routes = [
{path: "", component: HomeComponent},
{... |
60,614,303 | I would like to replace commas in my strings, between dynamic positions (ie. between double quotes). Note that I will not have more than 2 occurrences of double quotes in my strings if that matters.
My example:
```
'randomtext,123,"JEAN SEBASTIEN, GUY, DANIEL",sun'
```
Desired output:
```
'randomtext,123,"JEAN SE... | 2020/03/10 | [
"https://Stackoverflow.com/questions/60614303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8642243/"
] | I had a similar issue but with a non-hybrid application - a completely new from scratch Angular 10 built application, so I'm documenting it here in case other devs wound up with a similar issue.
As pointed to by @viral-rathod, disabling Ivy also worked around my problem:
In `tsconfig.base.json` add to `angularCompile... | With me, the issue was:
I mistakenly used a slash with path as: `/teams`
```
const routes: Routes = [
{path: "", component: HomeComponent},
{path: "/teams", component: TeamsComponent}
];
```
Instead, it simply should have been as: `teams`
```
const routes: Routes = [
{path: "", component: HomeComponent},
{... |
29,206,571 | I'm having problems constructing regular expression from array of strings, for use in `sed` command.
Here's an example
```
#!/usr/bin/env bash
function join { local IFS="$1"; shift; echo "$*"; }
array=("foo" "bar" "baz")
regex=$(join "\|" "${array[@]}") # foo|bar|baz
echo "foo bar baz" | sed "s/${regex}/replaced/g... | 2015/03/23 | [
"https://Stackoverflow.com/questions/29206571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/726020/"
] | `|` needs to be escaped in basic regex syntax. Either use extended syntax:
```
sed -r "s/${regex}/replaced/g" # GNU sed. With BSD sed, use -E
```
Or build the regex so that it is `foo\|bar\|baz`. | You need to use:
```
regex=$(join '|' "${array[@]}")
```
Since `IFS` accepts only one character.
Then use (for BSD):
```
echo "foo bar baz" | sed -E "s/${regex}/replaced/g"
```
OR for Linux:
```
echo "foo bar baz" | sed -r "s/${regex}/replaced/g"
```
---
**EDIT:** If you want to avoid using extended regex op... |
47,026,409 | I'm trying to contain the `NavigationItem` `div` within the parent `div`. It keeps breaking out of the parent `div` in my example. I know I could just use `overflow: hidden`; but when I center items within that div it doesn't `center` right. Does anyone know what I'm doing wrong?
```css
.B2_NavigationItem {
backgro... | 2017/10/31 | [
"https://Stackoverflow.com/questions/47026409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7396554/"
] | I know this is an old question, but in case it shows up in the front page of any Google searches for anyone else (like it did for me), I figured I could chime in with something helpful.
The final layer of InceptionV3 is a Softmax function, which tries to say this is either label A *or* label B.
However, if you want t... | First, to easily understand, just think you have 2 seperate neural networks, one only identify whether cat is in image or not and the other identify dog is dog or not, surely the neurons will learn how do recognize that pretty well.
But more interesting is, those 2 networks can be combined into **single network to sha... |
68,257,807 | I need help I need to know if Java allows to create an object dynamically, using the value of a variable.
**Example**
```
// I have 2 classes:
public class Audit {
private Long idAudit
// constructors, get and set
}
publish class Example {
private Long idExample
// constructors, ge... | 2021/07/05 | [
"https://Stackoverflow.com/questions/68257807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11489433/"
] | Assuming that your individual answers are always separated by two newlines, you can
```py
# make a dictionary
answers = dict()
# split at double newlines to get individual questions
for q in data.split('\n\n'):
# split each question into lines,
# take the 1st line, 2nd line, 3rd line, and all the rest
q, ... | You can try `regex`
```py
# Assume the file content as follows
# Question1: What do you do for fun?
# Number of responses: 100
# Answers:
# A. Watching movies
# B. Doing sports
# C. Chat with friends
# Question2: What do you do for fun?
# Number of responses: 100
# Answers:
# A. Watching movies
# B. Doing sports
# C... |
53,217,612 | I see a lot of posts with the same topic (mostly with Strings) but haven't found the answer to my question. How would I remove duplicate integers from an ArrayList?
```
import java.util.*;
public class ArrayList2 {
public static ArrayList<Integer> removeAllDuplicates(ArrayList<Integer> list) {
Collections... | 2018/11/08 | [
"https://Stackoverflow.com/questions/53217612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10626314/"
] | The specific reason why your `removeAllDuplicates` function doesn't work is that you are still iterating after a successful comparison. If you iterate only when `list.get(i) != list.get(i + 1)`, you will get rid of all the duplicates.
```
public static ArrayList<Integer> removeAllDuplicates(ArrayList<Integer> list) {
... | This assumes that you cannot use a set ("Please No hashing!!!") for a reason such as homework.
Look what happens when you remove a duplicate. Let's say that the dupe you're removing is the 1st of 3 consecutive equal numbers.
```
v
-13, -6, -3, 0, 1, 1, 1, 5, 7, 9
```
Here `i` is 4 to refer to the fi... |
53,217,612 | I see a lot of posts with the same topic (mostly with Strings) but haven't found the answer to my question. How would I remove duplicate integers from an ArrayList?
```
import java.util.*;
public class ArrayList2 {
public static ArrayList<Integer> removeAllDuplicates(ArrayList<Integer> list) {
Collections... | 2018/11/08 | [
"https://Stackoverflow.com/questions/53217612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10626314/"
] | Other people have "answered" the basic issue, of the `if` statement skipping over elements because the `for-loop` is incrementing the index position, while the size of the array is shrinking.
This is just "another" possible solution. Personally, I don't like mutating `List`s in loops and prefer to use iterators, somet... | This assumes that you cannot use a set ("Please No hashing!!!") for a reason such as homework.
Look what happens when you remove a duplicate. Let's say that the dupe you're removing is the 1st of 3 consecutive equal numbers.
```
v
-13, -6, -3, 0, 1, 1, 1, 5, 7, 9
```
Here `i` is 4 to refer to the fi... |
53,217,612 | I see a lot of posts with the same topic (mostly with Strings) but haven't found the answer to my question. How would I remove duplicate integers from an ArrayList?
```
import java.util.*;
public class ArrayList2 {
public static ArrayList<Integer> removeAllDuplicates(ArrayList<Integer> list) {
Collections... | 2018/11/08 | [
"https://Stackoverflow.com/questions/53217612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10626314/"
] | The specific reason why your `removeAllDuplicates` function doesn't work is that you are still iterating after a successful comparison. If you iterate only when `list.get(i) != list.get(i + 1)`, you will get rid of all the duplicates.
```
public static ArrayList<Integer> removeAllDuplicates(ArrayList<Integer> list) {
... | You'd want to have a double for loop as you dont want to check the only the next index but all indexes. As well as remember when you remove a value you want to check that removed value again as it could of been replaced with another duplicate value. |
53,217,612 | I see a lot of posts with the same topic (mostly with Strings) but haven't found the answer to my question. How would I remove duplicate integers from an ArrayList?
```
import java.util.*;
public class ArrayList2 {
public static ArrayList<Integer> removeAllDuplicates(ArrayList<Integer> list) {
Collections... | 2018/11/08 | [
"https://Stackoverflow.com/questions/53217612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10626314/"
] | The specific reason why your `removeAllDuplicates` function doesn't work is that you are still iterating after a successful comparison. If you iterate only when `list.get(i) != list.get(i + 1)`, you will get rid of all the duplicates.
```
public static ArrayList<Integer> removeAllDuplicates(ArrayList<Integer> list) {
... | Other people have "answered" the basic issue, of the `if` statement skipping over elements because the `for-loop` is incrementing the index position, while the size of the array is shrinking.
This is just "another" possible solution. Personally, I don't like mutating `List`s in loops and prefer to use iterators, somet... |
53,217,612 | I see a lot of posts with the same topic (mostly with Strings) but haven't found the answer to my question. How would I remove duplicate integers from an ArrayList?
```
import java.util.*;
public class ArrayList2 {
public static ArrayList<Integer> removeAllDuplicates(ArrayList<Integer> list) {
Collections... | 2018/11/08 | [
"https://Stackoverflow.com/questions/53217612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10626314/"
] | Other people have "answered" the basic issue, of the `if` statement skipping over elements because the `for-loop` is incrementing the index position, while the size of the array is shrinking.
This is just "another" possible solution. Personally, I don't like mutating `List`s in loops and prefer to use iterators, somet... | You'd want to have a double for loop as you dont want to check the only the next index but all indexes. As well as remember when you remove a value you want to check that removed value again as it could of been replaced with another duplicate value. |
24,603,155 | I have requirement in my application where we need to store index on the bases of user so I am trying to change location at runtime, but index is not getting stored on new location and if I am giving same location in config file then it is getting stored
I am using following code to change location
```
LocalSession... | 2014/07/07 | [
"https://Stackoverflow.com/questions/24603155",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1047873/"
] | Try doing this : (For Hibernate 4.x)
```
Configuration cfg = localSessionFactoryBean.getConfiguration();
cfg .setProperty("hibernate.search.default.indexBase", "New_loc");
cfg.configure();
serviceRegistry = new ServiceRegistryBuilder().applySettings(
cfg.getProperties()).build();
sessionFactory = cfg.build... | I am not sure whether this dynamic changing of index base will work. Also rebuilding the factory seems dodgy. Did you have a look at index sharding - <http://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#advanced-features-dynamic-sharding>. This should allow you to split data according to let's sa... |
24,603,155 | I have requirement in my application where we need to store index on the bases of user so I am trying to change location at runtime, but index is not getting stored on new location and if I am giving same location in config file then it is getting stored
I am using following code to change location
```
LocalSession... | 2014/07/07 | [
"https://Stackoverflow.com/questions/24603155",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1047873/"
] | Try doing this : (For Hibernate 4.x)
```
Configuration cfg = localSessionFactoryBean.getConfiguration();
cfg .setProperty("hibernate.search.default.indexBase", "New_loc");
cfg.configure();
serviceRegistry = new ServiceRegistryBuilder().applySettings(
cfg.getProperties()).build();
sessionFactory = cfg.build... | After lot's of effor finally i figured out the reason for this.If i will close the sesson after each database write then only index file will get stored on new location .However this is not efficeint approach but this is how it works |
24,603,155 | I have requirement in my application where we need to store index on the bases of user so I am trying to change location at runtime, but index is not getting stored on new location and if I am giving same location in config file then it is getting stored
I am using following code to change location
```
LocalSession... | 2014/07/07 | [
"https://Stackoverflow.com/questions/24603155",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1047873/"
] | I am not sure whether this dynamic changing of index base will work. Also rebuilding the factory seems dodgy. Did you have a look at index sharding - <http://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#advanced-features-dynamic-sharding>. This should allow you to split data according to let's sa... | After lot's of effor finally i figured out the reason for this.If i will close the sesson after each database write then only index file will get stored on new location .However this is not efficeint approach but this is how it works |
13,256,662 | This functionality used to work but has suddenly stopped and I have no idea why. I've made changes before I ran the tests but, having retraced my steps I don't know what has changed. Can a fresh pair of eyes tell me why this is saving the posts but not the locations?
*Model Post.rb*
```
class Post < ActiveRecord::Bas... | 2012/11/06 | [
"https://Stackoverflow.com/questions/13256662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791381/"
] | The error message looks pretty clear to me. **Solution 0**:
1. Create the directory `/home/billy/myapps/my_server/sessions`
2. Figure what user runs Django, ie. with `ps aux` command,
3. Give [rwx permissions](http://blog.yourlabs.org/post/19240900759/survive-linux-nix-permissions) to that user on that directory.
**S... | The path '/home/billy/myapps//my\_server/sessions' must exist. And process of your application server must have corresponding rights to work with it. |
2,723,870 | Show that the sequence $s\_n = \frac{n}{n+1} $ converges to 1 in $(\mathbb{R}, \mathscr{U})$ but does not converge to 1 in $(\mathbb{R}, \mathscr{H})$
The definition I have for *converges to $x$* is let $X$ be a topological space and let $x \in X$. A sequence $s$ in $X$ is said to converge to $x$ provided that, for an... | 2018/04/05 | [
"https://math.stackexchange.com/questions/2723870",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/549300/"
] | So the first thing we observe is that $s\_n$ is increasing and bounded above. That is $s\_1<s\_2<\dots<1.$
Now let $A$ be an open neighbourhood of $1$ in the usual topology. As open intervals are a basis for this, let $(a,b)\subset A$ with $a<1<b.$ then we solve $\frac x{x+1}=a$ to get $x = \frac a{1-a},$ and by the A... | In the usual topology, any nbhd of $1$ contains an interval $(a,b)$ with $1\in (a,b)$. $\frac n{n+1}=\frac1{1+\frac1n}$ can be made arbitrarily close to $1$ for sufficiently large $n$.
It doesn't converge in the half open interval topology, because the nbhd $[1,a)$ doesn't contain a point of the sequence. Note that t... |
26,373,631 | I have a hidden div and I need to to show it smoothly with different CSS styles, all styles may be changed easily except the "display". But this property is crucial, because when it start appearing, it will move other elements on the page differently. It will depends on the "display" property of the appearing element. ... | 2014/10/15 | [
"https://Stackoverflow.com/questions/26373631",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2005680/"
] | I think it is impossible.
But there is a way to bypass this bug.
Just wrap the content of the div into another div and toggle the content wrapper, while your original div will stay visible because on the visible div you can change the display option.
here is the [jsfiddle](http://jsfiddle.net/pqrdS/155/)
```js
$(".t... | With no parameters, `$("#f").hide();` will hide the element immediately with no animation. If you want to animate it, add a duration parameter, e.g.
```
$(".toggle_h").bind("click", function(){
$("#f").hide(500);
})
``` |
26,373,631 | I have a hidden div and I need to to show it smoothly with different CSS styles, all styles may be changed easily except the "display". But this property is crucial, because when it start appearing, it will move other elements on the page differently. It will depends on the "display" property of the appearing element. ... | 2014/10/15 | [
"https://Stackoverflow.com/questions/26373631",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2005680/"
] | I think it is impossible.
But there is a way to bypass this bug.
Just wrap the content of the div into another div and toggle the content wrapper, while your original div will stay visible because on the visible div you can change the display option.
here is the [jsfiddle](http://jsfiddle.net/pqrdS/155/)
```js
$(".t... | The `display` property cannot be transitioned. Using jQuery's `show` and `hide` methods are essentially the same as just saying `display: block` and `display: none` in CSS, which, as I just mentioned, can't be transitioned. However, a property like `opacity` or `width` CAN be transitioned with CSS. You'd want to toggle... |
41,657 | Assume this question:
>
> Three events A, B, C are seen by observer O to occur in the order ABC. Another observer O$^\prime$ sees the events to occur in the order CBA. Is it possible that a third observer sees the events in the order ACB?
>
>
>
I could draw spacetime diagram for three arbitrary-ordered events for... | 2012/10/25 | [
"https://physics.stackexchange.com/questions/41657",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/14351/"
] | Provided the intervals between all events are spacelike they can appear in any order. See [this article](http://www.technologyreview.com/view/428962/special-relativity-and-the-curious-physics-of-chronology/) for a popular science level description, or [this paper](http://arxiv.org/abs/1208.3841) for the full details. | One can design a situation that obeys your conditions – both ABC and CBA ordering may be realized in some inertial systems – but the ordering ACB is impossible.
Simply imagine that A, B, C are three events in spacetime that lie on a spacelike line in the spacetime. Then B is inevitably in the middle between A, C, chro... |
1,319,302 | When I run a command with `sudo` like the following, subsequent `sudo` commands will not ask for a password anymore.
```
sudo ls
```
But this still runs `ls`. If I don't want to run any command at the beginning, but just stop subsequent `sudo` commands from asking a password later on. Is there a way to do so? | 2021/02/25 | [
"https://askubuntu.com/questions/1319302",
"https://askubuntu.com",
"https://askubuntu.com/users/228569/"
] | Use [`sudo -v`](https://www.sudo.ws/man/1.9.5/sudo.man.html#v):
>
> `-v`, `--validate`
>
> Update the user's cached credentials, authenticating the user if necessary.
>
>
> | You have to run something, but you can run a nothing command like `true`.
```
jasen@crackle:~$ sudo true
[sudo] password for jasen:
jasen@crackle:~$
jasen@crackle:~$ sudo whoami
root
jasen@crackle:~$
``` |
1,319,302 | When I run a command with `sudo` like the following, subsequent `sudo` commands will not ask for a password anymore.
```
sudo ls
```
But this still runs `ls`. If I don't want to run any command at the beginning, but just stop subsequent `sudo` commands from asking a password later on. Is there a way to do so? | 2021/02/25 | [
"https://askubuntu.com/questions/1319302",
"https://askubuntu.com",
"https://askubuntu.com/users/228569/"
] | Use [`sudo -v`](https://www.sudo.ws/man/1.9.5/sudo.man.html#v):
>
> `-v`, `--validate`
>
> Update the user's cached credentials, authenticating the user if necessary.
>
>
> | While [muru's answer](https://askubuntu.com/a/1319306/20358) does exactly what you want, there's also a more general way to "do nothing," even when `sudo` is not involved.
```
sudo true
```
will run the `true` command, which always succeeds, and has no additional side effects, like printing to the screen, etc. There... |
1,319,302 | When I run a command with `sudo` like the following, subsequent `sudo` commands will not ask for a password anymore.
```
sudo ls
```
But this still runs `ls`. If I don't want to run any command at the beginning, but just stop subsequent `sudo` commands from asking a password later on. Is there a way to do so? | 2021/02/25 | [
"https://askubuntu.com/questions/1319302",
"https://askubuntu.com",
"https://askubuntu.com/users/228569/"
] | Use [`sudo -v`](https://www.sudo.ws/man/1.9.5/sudo.man.html#v):
>
> `-v`, `--validate`
>
> Update the user's cached credentials, authenticating the user if necessary.
>
>
> | I use
```
sudo bash
```
That's simple enough! |
1,319,302 | When I run a command with `sudo` like the following, subsequent `sudo` commands will not ask for a password anymore.
```
sudo ls
```
But this still runs `ls`. If I don't want to run any command at the beginning, but just stop subsequent `sudo` commands from asking a password later on. Is there a way to do so? | 2021/02/25 | [
"https://askubuntu.com/questions/1319302",
"https://askubuntu.com",
"https://askubuntu.com/users/228569/"
] | Use [`sudo -v`](https://www.sudo.ws/man/1.9.5/sudo.man.html#v):
>
> `-v`, `--validate`
>
> Update the user's cached credentials, authenticating the user if necessary.
>
>
> | Have you considered just creating a copy of the command you want to run as root (or any other user) and setting "Special Permissions"? (either SUID or SGID)
For example:
sudo cp /bin/touch /bin/plex-touch;
sudo chown plex /bin/plex-touch;
sudo chmod 4755 /bin/plex-touch
Now, every time you run the command "plex-touc... |
1,319,302 | When I run a command with `sudo` like the following, subsequent `sudo` commands will not ask for a password anymore.
```
sudo ls
```
But this still runs `ls`. If I don't want to run any command at the beginning, but just stop subsequent `sudo` commands from asking a password later on. Is there a way to do so? | 2021/02/25 | [
"https://askubuntu.com/questions/1319302",
"https://askubuntu.com",
"https://askubuntu.com/users/228569/"
] | While [muru's answer](https://askubuntu.com/a/1319306/20358) does exactly what you want, there's also a more general way to "do nothing," even when `sudo` is not involved.
```
sudo true
```
will run the `true` command, which always succeeds, and has no additional side effects, like printing to the screen, etc. There... | You have to run something, but you can run a nothing command like `true`.
```
jasen@crackle:~$ sudo true
[sudo] password for jasen:
jasen@crackle:~$
jasen@crackle:~$ sudo whoami
root
jasen@crackle:~$
``` |
1,319,302 | When I run a command with `sudo` like the following, subsequent `sudo` commands will not ask for a password anymore.
```
sudo ls
```
But this still runs `ls`. If I don't want to run any command at the beginning, but just stop subsequent `sudo` commands from asking a password later on. Is there a way to do so? | 2021/02/25 | [
"https://askubuntu.com/questions/1319302",
"https://askubuntu.com",
"https://askubuntu.com/users/228569/"
] | You have to run something, but you can run a nothing command like `true`.
```
jasen@crackle:~$ sudo true
[sudo] password for jasen:
jasen@crackle:~$
jasen@crackle:~$ sudo whoami
root
jasen@crackle:~$
``` | I use
```
sudo bash
```
That's simple enough! |
1,319,302 | When I run a command with `sudo` like the following, subsequent `sudo` commands will not ask for a password anymore.
```
sudo ls
```
But this still runs `ls`. If I don't want to run any command at the beginning, but just stop subsequent `sudo` commands from asking a password later on. Is there a way to do so? | 2021/02/25 | [
"https://askubuntu.com/questions/1319302",
"https://askubuntu.com",
"https://askubuntu.com/users/228569/"
] | While [muru's answer](https://askubuntu.com/a/1319306/20358) does exactly what you want, there's also a more general way to "do nothing," even when `sudo` is not involved.
```
sudo true
```
will run the `true` command, which always succeeds, and has no additional side effects, like printing to the screen, etc. There... | I use
```
sudo bash
```
That's simple enough! |
1,319,302 | When I run a command with `sudo` like the following, subsequent `sudo` commands will not ask for a password anymore.
```
sudo ls
```
But this still runs `ls`. If I don't want to run any command at the beginning, but just stop subsequent `sudo` commands from asking a password later on. Is there a way to do so? | 2021/02/25 | [
"https://askubuntu.com/questions/1319302",
"https://askubuntu.com",
"https://askubuntu.com/users/228569/"
] | While [muru's answer](https://askubuntu.com/a/1319306/20358) does exactly what you want, there's also a more general way to "do nothing," even when `sudo` is not involved.
```
sudo true
```
will run the `true` command, which always succeeds, and has no additional side effects, like printing to the screen, etc. There... | Have you considered just creating a copy of the command you want to run as root (or any other user) and setting "Special Permissions"? (either SUID or SGID)
For example:
sudo cp /bin/touch /bin/plex-touch;
sudo chown plex /bin/plex-touch;
sudo chmod 4755 /bin/plex-touch
Now, every time you run the command "plex-touc... |
1,319,302 | When I run a command with `sudo` like the following, subsequent `sudo` commands will not ask for a password anymore.
```
sudo ls
```
But this still runs `ls`. If I don't want to run any command at the beginning, but just stop subsequent `sudo` commands from asking a password later on. Is there a way to do so? | 2021/02/25 | [
"https://askubuntu.com/questions/1319302",
"https://askubuntu.com",
"https://askubuntu.com/users/228569/"
] | Have you considered just creating a copy of the command you want to run as root (or any other user) and setting "Special Permissions"? (either SUID or SGID)
For example:
sudo cp /bin/touch /bin/plex-touch;
sudo chown plex /bin/plex-touch;
sudo chmod 4755 /bin/plex-touch
Now, every time you run the command "plex-touc... | I use
```
sudo bash
```
That's simple enough! |
112,294 | Is there a hook in WordPress that I can use to filter the output of a specific shortcode? Something like this:
```
add_filter('shortcode_output', 'my_filter_function', 2);
function my_filter_function ( $output, $shortcode ) {
....
}
```
Where `$shortcode` would be something like `[my_schortcode]` or even better... | 2013/08/30 | [
"https://wordpress.stackexchange.com/questions/112294",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12495/"
] | [There is no filter](http://core.trac.wordpress.org/browser/tags/3.6/wp-includes/shortcodes.php) that I know of that is meant to target individual shortcodes like you want.
You can filter attributes with [`shortcode_atts_{$shortcode}`](http://core.trac.wordpress.org/browser/tags/3.6/wp-includes/shortcodes.php#L332) t... | The only thing that you can filter is the attributes fo the shortcode:
```
apply_filters( "shortcode_atts_{$shortcode}", $out, $pairs, $atts );
```
Point is, that `$shortcode` is the *third* argument when registering a shortcode. This argument is pretty new and nearly no shortcode uses it, therefore it will fall bac... |
112,294 | Is there a hook in WordPress that I can use to filter the output of a specific shortcode? Something like this:
```
add_filter('shortcode_output', 'my_filter_function', 2);
function my_filter_function ( $output, $shortcode ) {
....
}
```
Where `$shortcode` would be something like `[my_schortcode]` or even better... | 2013/08/30 | [
"https://wordpress.stackexchange.com/questions/112294",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12495/"
] | [There is no filter](http://core.trac.wordpress.org/browser/tags/3.6/wp-includes/shortcodes.php) that I know of that is meant to target individual shortcodes like you want.
You can filter attributes with [`shortcode_atts_{$shortcode}`](http://core.trac.wordpress.org/browser/tags/3.6/wp-includes/shortcodes.php#L332) t... | While @s\_ha\_dum gave a decent answer, you *can* create a new shortcode for the purpose of filtering an existing shortcode. For example,
```
function filter_function($atts, $content) {
extract(shortcode_atts(array(
'att1' => 'val1',
'att2' => 'val2'
), $atts));
//save shortcode ou... |
112,294 | Is there a hook in WordPress that I can use to filter the output of a specific shortcode? Something like this:
```
add_filter('shortcode_output', 'my_filter_function', 2);
function my_filter_function ( $output, $shortcode ) {
....
}
```
Where `$shortcode` would be something like `[my_schortcode]` or even better... | 2013/08/30 | [
"https://wordpress.stackexchange.com/questions/112294",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12495/"
] | [There is no filter](http://core.trac.wordpress.org/browser/tags/3.6/wp-includes/shortcodes.php) that I know of that is meant to target individual shortcodes like you want.
You can filter attributes with [`shortcode_atts_{$shortcode}`](http://core.trac.wordpress.org/browser/tags/3.6/wp-includes/shortcodes.php#L332) t... | While there is no hook, there is a small workaround that makes your end-goal possible. You can create a new shortcode that, on a per-instance basis, you always wrap around any other shortcode whose output you want to filter.
Usage in a post, etc:
```
Here is some post text. Blah blah...
[filter][target_annoying_short... |
112,294 | Is there a hook in WordPress that I can use to filter the output of a specific shortcode? Something like this:
```
add_filter('shortcode_output', 'my_filter_function', 2);
function my_filter_function ( $output, $shortcode ) {
....
}
```
Where `$shortcode` would be something like `[my_schortcode]` or even better... | 2013/08/30 | [
"https://wordpress.stackexchange.com/questions/112294",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12495/"
] | WordPress 4.7 introduced a new filter, [`do_shortcode_tag`](https://core.trac.wordpress.org/ticket/32790), to do exactly this. | [There is no filter](http://core.trac.wordpress.org/browser/tags/3.6/wp-includes/shortcodes.php) that I know of that is meant to target individual shortcodes like you want.
You can filter attributes with [`shortcode_atts_{$shortcode}`](http://core.trac.wordpress.org/browser/tags/3.6/wp-includes/shortcodes.php#L332) t... |
112,294 | Is there a hook in WordPress that I can use to filter the output of a specific shortcode? Something like this:
```
add_filter('shortcode_output', 'my_filter_function', 2);
function my_filter_function ( $output, $shortcode ) {
....
}
```
Where `$shortcode` would be something like `[my_schortcode]` or even better... | 2013/08/30 | [
"https://wordpress.stackexchange.com/questions/112294",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12495/"
] | While there is no hook, there is a small workaround that makes your end-goal possible. You can create a new shortcode that, on a per-instance basis, you always wrap around any other shortcode whose output you want to filter.
Usage in a post, etc:
```
Here is some post text. Blah blah...
[filter][target_annoying_short... | The only thing that you can filter is the attributes fo the shortcode:
```
apply_filters( "shortcode_atts_{$shortcode}", $out, $pairs, $atts );
```
Point is, that `$shortcode` is the *third* argument when registering a shortcode. This argument is pretty new and nearly no shortcode uses it, therefore it will fall bac... |
112,294 | Is there a hook in WordPress that I can use to filter the output of a specific shortcode? Something like this:
```
add_filter('shortcode_output', 'my_filter_function', 2);
function my_filter_function ( $output, $shortcode ) {
....
}
```
Where `$shortcode` would be something like `[my_schortcode]` or even better... | 2013/08/30 | [
"https://wordpress.stackexchange.com/questions/112294",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12495/"
] | WordPress 4.7 introduced a new filter, [`do_shortcode_tag`](https://core.trac.wordpress.org/ticket/32790), to do exactly this. | The only thing that you can filter is the attributes fo the shortcode:
```
apply_filters( "shortcode_atts_{$shortcode}", $out, $pairs, $atts );
```
Point is, that `$shortcode` is the *third* argument when registering a shortcode. This argument is pretty new and nearly no shortcode uses it, therefore it will fall bac... |
112,294 | Is there a hook in WordPress that I can use to filter the output of a specific shortcode? Something like this:
```
add_filter('shortcode_output', 'my_filter_function', 2);
function my_filter_function ( $output, $shortcode ) {
....
}
```
Where `$shortcode` would be something like `[my_schortcode]` or even better... | 2013/08/30 | [
"https://wordpress.stackexchange.com/questions/112294",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12495/"
] | While there is no hook, there is a small workaround that makes your end-goal possible. You can create a new shortcode that, on a per-instance basis, you always wrap around any other shortcode whose output you want to filter.
Usage in a post, etc:
```
Here is some post text. Blah blah...
[filter][target_annoying_short... | While @s\_ha\_dum gave a decent answer, you *can* create a new shortcode for the purpose of filtering an existing shortcode. For example,
```
function filter_function($atts, $content) {
extract(shortcode_atts(array(
'att1' => 'val1',
'att2' => 'val2'
), $atts));
//save shortcode ou... |
112,294 | Is there a hook in WordPress that I can use to filter the output of a specific shortcode? Something like this:
```
add_filter('shortcode_output', 'my_filter_function', 2);
function my_filter_function ( $output, $shortcode ) {
....
}
```
Where `$shortcode` would be something like `[my_schortcode]` or even better... | 2013/08/30 | [
"https://wordpress.stackexchange.com/questions/112294",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12495/"
] | WordPress 4.7 introduced a new filter, [`do_shortcode_tag`](https://core.trac.wordpress.org/ticket/32790), to do exactly this. | While @s\_ha\_dum gave a decent answer, you *can* create a new shortcode for the purpose of filtering an existing shortcode. For example,
```
function filter_function($atts, $content) {
extract(shortcode_atts(array(
'att1' => 'val1',
'att2' => 'val2'
), $atts));
//save shortcode ou... |
112,294 | Is there a hook in WordPress that I can use to filter the output of a specific shortcode? Something like this:
```
add_filter('shortcode_output', 'my_filter_function', 2);
function my_filter_function ( $output, $shortcode ) {
....
}
```
Where `$shortcode` would be something like `[my_schortcode]` or even better... | 2013/08/30 | [
"https://wordpress.stackexchange.com/questions/112294",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12495/"
] | WordPress 4.7 introduced a new filter, [`do_shortcode_tag`](https://core.trac.wordpress.org/ticket/32790), to do exactly this. | While there is no hook, there is a small workaround that makes your end-goal possible. You can create a new shortcode that, on a per-instance basis, you always wrap around any other shortcode whose output you want to filter.
Usage in a post, etc:
```
Here is some post text. Blah blah...
[filter][target_annoying_short... |
206,840 | I asked [this question](https://math.stackexchange.com/questions/1261999/classifying-space-infinite-totally-ordered-set-contractible) on math.stackexchange, but no one answered.
Let $(X,\le)$ be a totally ordered set. Regarding it as a category, it has a classifying space $B(X,\le)=|N\_\bullet(X,\le)|$. This should be... | 2015/05/17 | [
"https://mathoverflow.net/questions/206840",
"https://mathoverflow.net",
"https://mathoverflow.net/users/73776/"
] | Let $P$ be any partially ordered set. For any map $x\colon P\to [0,1]$, put $\sigma(x)=\{p\in P:x(p)>0\}$. Then $BP$ can be identified with the set of maps $x$ such that $\sigma(x)$ is finite and totally ordered, and $\sum\_px(p)=1$. Now suppose that $a$ is an element of $P$ which is comparable with every other element... | I am not sure if you consider this explicit, but here you go:
Choose a point $x\_0\in X$, and let $F\colon X\to X$ be the functor that sends $x$ to itself if $x\geq x\_0$, and to $x\_0$ otherwise. There is a zig-zag of natural transformations
$$x\_0\leq F(x)\geq x$$
between the constant functor $x\_0$ and the identity... |
68,783,698 | I have model which contains:
name , group
for group i have from group 1 to 9
then in another model i create many2one from model one:
```
request_l = fields.Many2one('model.one',
string='Model Name',
required=True,
... | 2021/08/14 | [
"https://Stackoverflow.com/questions/68783698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16564856/"
] | By changing your name='stream-details' in your urls.py into name=" stream platform-detail" the problem has to be solved.
```
path('stream/<int:pk>', StreamDetailAV.as_view(), name="streamplatform-detail")
```
I hope this helps you | Step 1.
```
path('', include('testapp.api.urls', namespace="testapp")),
```
Step 2.
add in urls.py file which is in application folder.
```
app_name = 'testapp'
```
step 3.
```
class StreamPlatformSerializer(serializers.HyperlinkedModelSerializer):
watchlist_platform = WatchListSerializer(many=T... |
68,783,698 | I have model which contains:
name , group
for group i have from group 1 to 9
then in another model i create many2one from model one:
```
request_l = fields.Many2one('model.one',
string='Model Name',
required=True,
... | 2021/08/14 | [
"https://Stackoverflow.com/questions/68783698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16564856/"
] | Here are 3 solutions that will fix almost all errors related to HyperlinkedModelSerializer.
1. The recommended URL view name is `'{model_name}-detail'`.
If possible change you name to `streamplatform-detail` and it should solve the problem.
2. Make sure you have included the `request` in the serializer context.
Just p... | Step 1.
```
path('', include('testapp.api.urls', namespace="testapp")),
```
Step 2.
add in urls.py file which is in application folder.
```
app_name = 'testapp'
```
step 3.
```
class StreamPlatformSerializer(serializers.HyperlinkedModelSerializer):
watchlist_platform = WatchListSerializer(many=T... |
68,783,698 | I have model which contains:
name , group
for group i have from group 1 to 9
then in another model i create many2one from model one:
```
request_l = fields.Many2one('model.one',
string='Model Name',
required=True,
... | 2021/08/14 | [
"https://Stackoverflow.com/questions/68783698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16564856/"
] | By changing your name='stream-details' in your urls.py into name=" stream platform-detail" the problem has to be solved.
```
path('stream/<int:pk>', StreamDetailAV.as_view(), name="streamplatform-detail")
```
I hope this helps you | Here are 3 solutions that will fix almost all errors related to HyperlinkedModelSerializer.
1. The recommended URL view name is `'{model_name}-detail'`.
If possible change you name to `streamplatform-detail` and it should solve the problem.
2. Make sure you have included the `request` in the serializer context.
Just p... |
68,727,459 | ```
Create table test4(
id number,
user_1 varchar2(100),
user_2 varchar2(100),
user_3 varchar2(100),
user_4 varchar2(100)
)
Insert into test4(id,user_1,user_2,user_3,user_4) values (1,'MARK','CLARC','KING','KING');
```
How get results as:
```
user total
---------------------
MARC ... | 2021/08/10 | [
"https://Stackoverflow.com/questions/68727459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5109824/"
] | Use `UNPIVOT` (which only requires a single table-scan):
```sql
SELECT name,
COUNT(*)
FROM test4
UNPIVOT (name FOR key IN (user_1, user_2, user_3, user_4))
GROUP BY name
```
Outputs:
>
>
>
>
> | NAME | COUNT(\*) |
> | --- | --- |
> | KING | 2 |
> | MARK | 1 |
> | CLARC | 1 |
>
>
>
*db<>fiddle [here... | something like this maybe :
```sql
select user, count(*) from (
select user_1 as user from test4 union all
select user_2 as user from test4 union all
select user_3 as user from test4 union all
select user_4 as user from test4
) t
group by user
``` |
25,363,896 | I am trying to fetch data from database and I need it to be displayed in the same format as stored in the database. Please note that the data stored in the database is just by using text-area, i.e. without using ck-editor.
For example, the data stored in database is:
```
Hello,
How are you jack?
Thanking you.
```
... | 2014/08/18 | [
"https://Stackoverflow.com/questions/25363896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3164751/"
] | Use html `<pre>` tags to preserve line breaks. | This is related to php. There is no problem in php to print it as it is use `<pre>` tag in html.Your code should look like this
```
$data= "Hello,
How are you jack?
Thanking you.";
echo '<pre>$data</pre>';
```
Hope this helps you |
25,363,896 | I am trying to fetch data from database and I need it to be displayed in the same format as stored in the database. Please note that the data stored in the database is just by using text-area, i.e. without using ck-editor.
For example, the data stored in database is:
```
Hello,
How are you jack?
Thanking you.
```
... | 2014/08/18 | [
"https://Stackoverflow.com/questions/25363896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3164751/"
] | Use html `<pre>` tags to preserve line breaks. | In HTML newlines don't break lines. You can output the string wrapped in a "pre" tag, or take the text and replace newlines with "br" (break) tags.
You make no mention of which programming language you're using. With PHP, you can pass your string from the database through the nl2br() function to replace newlines with... |
25,363,896 | I am trying to fetch data from database and I need it to be displayed in the same format as stored in the database. Please note that the data stored in the database is just by using text-area, i.e. without using ck-editor.
For example, the data stored in database is:
```
Hello,
How are you jack?
Thanking you.
```
... | 2014/08/18 | [
"https://Stackoverflow.com/questions/25363896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3164751/"
] | In HTML newlines don't break lines. You can output the string wrapped in a "pre" tag, or take the text and replace newlines with "br" (break) tags.
You make no mention of which programming language you're using. With PHP, you can pass your string from the database through the nl2br() function to replace newlines with... | This is related to php. There is no problem in php to print it as it is use `<pre>` tag in html.Your code should look like this
```
$data= "Hello,
How are you jack?
Thanking you.";
echo '<pre>$data</pre>';
```
Hope this helps you |
19,566,344 | I have a parent class classA with a variable defined as `public string variable`. This variable var is initialized in the `OnActionExecuting` method defined as `protected override void OnActionExecuting(ActionExecutingContext test)` A child class inherits from this class as `public class classB : classA` However, ths c... | 2013/10/24 | [
"https://Stackoverflow.com/questions/19566344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/807223/"
] | You need to migrate your database. But since it is the tutorial, just erase your DB and start over.
Otherwise, take a look into [SOUTH](http://south.aeracode.org). | If you have changed the model class name to `Question` then you should change the lines in tutorial to try as
```
#------------------------v
from polls.models import Question, Choice
Question.objects.all()
```
Also, you will have to do `syncdb` as well. |
19,566,344 | I have a parent class classA with a variable defined as `public string variable`. This variable var is initialized in the `OnActionExecuting` method defined as `protected override void OnActionExecuting(ActionExecutingContext test)` A child class inherits from this class as `public class classB : classA` However, ths c... | 2013/10/24 | [
"https://Stackoverflow.com/questions/19566344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/807223/"
] | You changed the name of your Model but you are still accessing it using the old name. You need to access it using the new name now. You will also have to do
>
> python manage.py syncdb
>
>
>
to sync your database tables once you make changes to models.
```
from polls.models import Question, Choice
Question.ob... | If you have changed the model class name to `Question` then you should change the lines in tutorial to try as
```
#------------------------v
from polls.models import Question, Choice
Question.objects.all()
```
Also, you will have to do `syncdb` as well. |
14,658 | Here in Argentina, we have [a very fancy street called "Lanin"](http://andresrey.com.ar/galeria/calle-lanin/). All the houses and walls on that street have some kind of mosaic stuck to it, and it's very cool. It was made by a local artist [who lives on that street](http://es.wikipedia.org/wiki/Calle_Lanin#La_muestra_de... | 2011/08/07 | [
"https://photo.stackexchange.com/questions/14658",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/4039/"
] | Here is one I did by overlapping images that were shot going down the street. This was with photoshop using the measure tool and "Rotate Canvas" Arbitrary to get the verticals straight and parallel. Then the images were cropped, merged and erased the non aligning overlapping parts of the images. It is time consuming an... | I have tried several different programs that will merge photos into panoramas. The one that I use most of the time is Photoshop Elements. This is a rather cheap version of Photoshop that has most features, but not all, that Photoshop has.
You can download a 30 day trial och try out the different ways that Photoshop El... |
14,658 | Here in Argentina, we have [a very fancy street called "Lanin"](http://andresrey.com.ar/galeria/calle-lanin/). All the houses and walls on that street have some kind of mosaic stuck to it, and it's very cool. It was made by a local artist [who lives on that street](http://es.wikipedia.org/wiki/Calle_Lanin#La_muestra_de... | 2011/08/07 | [
"https://photo.stackexchange.com/questions/14658",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/4039/"
] | You can use [**mosaic mode**](http://hugin.sourceforge.net/tutorials/Mosaic-mode/en.shtml) in Hugin for these types of panos.
You have to be in Expert mode (**Interface → Expert**), but then in the preview window (GL button), under the **Move/Drag** tab, **Drag Mode** can be selected as a **Mosaic** mode.
If this is ... | I would first try and correct your photo for lens distortions using the Lightroom camera profiles.
Then you could try to create a panorama using photoshop which has an option for merging pictures without the usual corrections.
Although normally I would advise anyone to use AutoPano pro, this time it seems Photoshop's... |
14,658 | Here in Argentina, we have [a very fancy street called "Lanin"](http://andresrey.com.ar/galeria/calle-lanin/). All the houses and walls on that street have some kind of mosaic stuck to it, and it's very cool. It was made by a local artist [who lives on that street](http://es.wikipedia.org/wiki/Calle_Lanin#La_muestra_de... | 2011/08/07 | [
"https://photo.stackexchange.com/questions/14658",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/4039/"
] | **What you are trying to construct is a parallel motion panorama.** Its been on my *TODO List* to do so far a while but I have not done it myself yet.
[Microsoft ICE](http://www.neopanoramic.com/review/ms_ice) supports this. It is the only software which I know of to do automatic stitching of parallel motion panoramas... | When you shoot a panorama by only rotating the camera then you're simulating the effect of a wider field of view lens (even if you use a non-standard projection).
If you move the camera then what you're trying to produce has no equivialent in reality, i.e. its not a 2D projection of a 3D scene like most photographs, i... |
14,658 | Here in Argentina, we have [a very fancy street called "Lanin"](http://andresrey.com.ar/galeria/calle-lanin/). All the houses and walls on that street have some kind of mosaic stuck to it, and it's very cool. It was made by a local artist [who lives on that street](http://es.wikipedia.org/wiki/Calle_Lanin#La_muestra_de... | 2011/08/07 | [
"https://photo.stackexchange.com/questions/14658",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/4039/"
] | I'm not sure this is a perfect solution, but I'd give Hugin a try. One of the features I love about Hugin is the ability to define straight lines that extend across photos. This gives the software an extra clue about what should end up looking straight once the panorama is assembled.
I've never tried making a horizont... | I would first try and correct your photo for lens distortions using the Lightroom camera profiles.
Then you could try to create a panorama using photoshop which has an option for merging pictures without the usual corrections.
Although normally I would advise anyone to use AutoPano pro, this time it seems Photoshop's... |
14,658 | Here in Argentina, we have [a very fancy street called "Lanin"](http://andresrey.com.ar/galeria/calle-lanin/). All the houses and walls on that street have some kind of mosaic stuck to it, and it's very cool. It was made by a local artist [who lives on that street](http://es.wikipedia.org/wiki/Calle_Lanin#La_muestra_de... | 2011/08/07 | [
"https://photo.stackexchange.com/questions/14658",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/4039/"
] | **What you are trying to construct is a parallel motion panorama.** Its been on my *TODO List* to do so far a while but I have not done it myself yet.
[Microsoft ICE](http://www.neopanoramic.com/review/ms_ice) supports this. It is the only software which I know of to do automatic stitching of parallel motion panoramas... | I would first try and correct your photo for lens distortions using the Lightroom camera profiles.
Then you could try to create a panorama using photoshop which has an option for merging pictures without the usual corrections.
Although normally I would advise anyone to use AutoPano pro, this time it seems Photoshop's... |
14,658 | Here in Argentina, we have [a very fancy street called "Lanin"](http://andresrey.com.ar/galeria/calle-lanin/). All the houses and walls on that street have some kind of mosaic stuck to it, and it's very cool. It was made by a local artist [who lives on that street](http://es.wikipedia.org/wiki/Calle_Lanin#La_muestra_de... | 2011/08/07 | [
"https://photo.stackexchange.com/questions/14658",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/4039/"
] | I'm not sure this is a perfect solution, but I'd give Hugin a try. One of the features I love about Hugin is the ability to define straight lines that extend across photos. This gives the software an extra clue about what should end up looking straight once the panorama is assembled.
I've never tried making a horizont... | Canon's PhotoStitch has two stitching modes - Panning and Parallel. It even factors in the focal length your frames were captured with. If you shoot with a Canon, you should have the software in the Canon Utilities disk.
Whatever software you use, however, try shooting with the longest focal length to eliminate geomet... |
14,658 | Here in Argentina, we have [a very fancy street called "Lanin"](http://andresrey.com.ar/galeria/calle-lanin/). All the houses and walls on that street have some kind of mosaic stuck to it, and it's very cool. It was made by a local artist [who lives on that street](http://es.wikipedia.org/wiki/Calle_Lanin#La_muestra_de... | 2011/08/07 | [
"https://photo.stackexchange.com/questions/14658",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/4039/"
] | Canon's PhotoStitch has two stitching modes - Panning and Parallel. It even factors in the focal length your frames were captured with. If you shoot with a Canon, you should have the software in the Canon Utilities disk.
Whatever software you use, however, try shooting with the longest focal length to eliminate geomet... | I have tried several different programs that will merge photos into panoramas. The one that I use most of the time is Photoshop Elements. This is a rather cheap version of Photoshop that has most features, but not all, that Photoshop has.
You can download a 30 day trial och try out the different ways that Photoshop El... |
14,658 | Here in Argentina, we have [a very fancy street called "Lanin"](http://andresrey.com.ar/galeria/calle-lanin/). All the houses and walls on that street have some kind of mosaic stuck to it, and it's very cool. It was made by a local artist [who lives on that street](http://es.wikipedia.org/wiki/Calle_Lanin#La_muestra_de... | 2011/08/07 | [
"https://photo.stackexchange.com/questions/14658",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/4039/"
] | Canon's PhotoStitch has two stitching modes - Panning and Parallel. It even factors in the focal length your frames were captured with. If you shoot with a Canon, you should have the software in the Canon Utilities disk.
Whatever software you use, however, try shooting with the longest focal length to eliminate geomet... | I would first try and correct your photo for lens distortions using the Lightroom camera profiles.
Then you could try to create a panorama using photoshop which has an option for merging pictures without the usual corrections.
Although normally I would advise anyone to use AutoPano pro, this time it seems Photoshop's... |
14,658 | Here in Argentina, we have [a very fancy street called "Lanin"](http://andresrey.com.ar/galeria/calle-lanin/). All the houses and walls on that street have some kind of mosaic stuck to it, and it's very cool. It was made by a local artist [who lives on that street](http://es.wikipedia.org/wiki/Calle_Lanin#La_muestra_de... | 2011/08/07 | [
"https://photo.stackexchange.com/questions/14658",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/4039/"
] | **What you are trying to construct is a parallel motion panorama.** Its been on my *TODO List* to do so far a while but I have not done it myself yet.
[Microsoft ICE](http://www.neopanoramic.com/review/ms_ice) supports this. It is the only software which I know of to do automatic stitching of parallel motion panoramas... | Canon's PhotoStitch has two stitching modes - Panning and Parallel. It even factors in the focal length your frames were captured with. If you shoot with a Canon, you should have the software in the Canon Utilities disk.
Whatever software you use, however, try shooting with the longest focal length to eliminate geomet... |
14,658 | Here in Argentina, we have [a very fancy street called "Lanin"](http://andresrey.com.ar/galeria/calle-lanin/). All the houses and walls on that street have some kind of mosaic stuck to it, and it's very cool. It was made by a local artist [who lives on that street](http://es.wikipedia.org/wiki/Calle_Lanin#La_muestra_de... | 2011/08/07 | [
"https://photo.stackexchange.com/questions/14658",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/4039/"
] | You can use [**mosaic mode**](http://hugin.sourceforge.net/tutorials/Mosaic-mode/en.shtml) in Hugin for these types of panos.
You have to be in Expert mode (**Interface → Expert**), but then in the preview window (GL button), under the **Move/Drag** tab, **Drag Mode** can be selected as a **Mosaic** mode.
If this is ... | I suspect the problem is that you are not taking a Panorama. You are simply taking multiple shots that should be simply appended one to the other. I would expand the canvas in Photoshop and simply place each photo one next to the other.
The result will *look* like a panorama, but will actually simply be a very long p... |
56,307,753 | `
```
class GfG{
public String multiply(String a,String b){
String s = "0.0.0.0";
String[] str = s.split("\\.");
for(String p:str){
System.out.println(p);
}
return "";
}
}
```
`
I am splitting "0.0.0.0" and "0.0.0.0.".
In both the cases i m getting same array o... | 2019/05/25 | [
"https://Stackoverflow.com/questions/56307753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10272845/"
] | The reason that you are not receiving the empty string that you think *should* have been returned at the end is by design in `split`.
From the docs:
```
public String[] split(String regex)
```
>
> This method works as if by invoking the two-argument split method with
> the given expression and a limit argument of... | It appears that you ran the following
```
jshell> "0.0.0.0".split("\\.")
$1 ==> String[4] { "0", "0", "0", "0" }
jshell> "0.0.0.0.".split("\\.")
$2 ==> String[4] { "0", "0", "0", "0" }
```
and you are happy with the first result but you are wondering why the last result is not
```
String[4] { "0", "0", "0", "0", "... |
47,722,315 | I'm trying to do an `if` statement in jQuery, but it doesn't really work.
```
$("#button2").hide()
var score = 0;
//some code with button that is adding the score with score++ (working)
if(score >= 100) {
$("#button2").show()
}
```
The if statement is not properly working.
```
$("#grandmabutton1").hid... | 2017/12/08 | [
"https://Stackoverflow.com/questions/47722315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8101330/"
] | Here is a playground that I think implements your intended effect (minus `.edges` and `constrain` - that appear to be your own extensions).
a) used a red background instead of black with alpha (just to make the effect stand out)
b) set `maskLayer.backgroundColor` instead of `maskLayer.fillColor`
Adding the maskLaye... | Your mask Layer has no size.
Add this line `maskLayer.frame = shape`
and you don't need `background.layer.addSublayer(maskLayer)` |
6,341,477 | My client wants qr-code based application using appcelerator for android and for iphone ? is it possible using appcelerator? | 2011/06/14 | [
"https://Stackoverflow.com/questions/6341477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/504099/"
] | have you seen this google project?
<http://code.google.com/p/tibar/> | Aaron's dead on for a good [iPhone lib](http://code.google.com/p/tibar/) but you will need separate one for the [android](https://github.com/mwaylabs/titanium-barcode). |
45,924,821 | I am trying to sort an array of object by a property `title`. This the code snippet that I am running but it does not sort anything. The array is displayed as it is. P.S I looked at previous similar questions. This one for example [here](https://stackoverflow.com/questions/1129216/sort-array-of-objects-by-string-proper... | 2017/08/28 | [
"https://Stackoverflow.com/questions/45924821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8528721/"
] | Have you tried like this? It is working as expected
```
library.sort(function(a,b) {return (a.title > b.title) ? 1 : ((b.title > a.title) ? -1 : 0);} );
```
```js
var library = [
{
author: 'Bill Gates',
title: 'The Road Ahead',
libraryID: 1254
},
{
author: 'Steve Jo... | Subtraction is for numeric operations. Use [`a.title.localeCompare(b.title)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare) instead.
```js
function sortLibrary() {
console.log("inside sort");
library.sort(function(a, b) {
return a.title.localeCompare(... |
45,924,821 | I am trying to sort an array of object by a property `title`. This the code snippet that I am running but it does not sort anything. The array is displayed as it is. P.S I looked at previous similar questions. This one for example [here](https://stackoverflow.com/questions/1129216/sort-array-of-objects-by-string-proper... | 2017/08/28 | [
"https://Stackoverflow.com/questions/45924821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8528721/"
] | Subtraction is for numeric operations. Use [`a.title.localeCompare(b.title)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare) instead.
```js
function sortLibrary() {
console.log("inside sort");
library.sort(function(a, b) {
return a.title.localeCompare(... | Can you try this
FOR DESC
```
library.sort(function(a,b){return a.title < b.title;});
```
or
FOR ASC
```
library.sort(function(a,b){return a.title > b.title;});
``` |
45,924,821 | I am trying to sort an array of object by a property `title`. This the code snippet that I am running but it does not sort anything. The array is displayed as it is. P.S I looked at previous similar questions. This one for example [here](https://stackoverflow.com/questions/1129216/sort-array-of-objects-by-string-proper... | 2017/08/28 | [
"https://Stackoverflow.com/questions/45924821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8528721/"
] | Subtraction is for numeric operations. Use [`a.title.localeCompare(b.title)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare) instead.
```js
function sortLibrary() {
console.log("inside sort");
library.sort(function(a, b) {
return a.title.localeCompare(... | you can try this code from <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort>
```
library.sort(function(a, b){
var tA = a.title.toUpperCase();
var tB = b.title.toUpperCase();
if (tA < tB) {
return -1;
}
if (tA > tB) {
return 1;
}
return 0;
})
``` |
45,924,821 | I am trying to sort an array of object by a property `title`. This the code snippet that I am running but it does not sort anything. The array is displayed as it is. P.S I looked at previous similar questions. This one for example [here](https://stackoverflow.com/questions/1129216/sort-array-of-objects-by-string-proper... | 2017/08/28 | [
"https://Stackoverflow.com/questions/45924821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8528721/"
] | Have you tried like this? It is working as expected
```
library.sort(function(a,b) {return (a.title > b.title) ? 1 : ((b.title > a.title) ? -1 : 0);} );
```
```js
var library = [
{
author: 'Bill Gates',
title: 'The Road Ahead',
libraryID: 1254
},
{
author: 'Steve Jo... | Use the < or > operator when comparing strings in your compare function.
[see documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.