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 |
|---|---|---|---|---|---|
21,852,471 | I'm trying calling the `/auth/logout` url to get redirected after session is deleted:
```
app.config(['$routeProvider',function($routeProvider) {
$routeProvider
.when('/auth/logout',{
controller:'AuthLogout'
//templateUrl: not needed
})
})
.controller('AuthLogout', ['$window','$location', ... | 2014/02/18 | [
"https://Stackoverflow.com/questions/21852471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/895174/"
] | You could do :
```
.when('/auth/logout', {
controller: function(){
//do staff
}
})
```
btw may be there is something wrong in your code
because template works and you could exploit it in
the same way
[http://docs.angularjs.org/api/ngRoute/provider/$routeProvider](http://docs.angularjs.org/api/ngRou... | use `redirectTo`
```
app.config(['$routeProvider',function($routeProvider) {
$routeProvider
.when('/auth/logout',{
redirectTo:'/'
})
});
```
Hope this will work for you :) |
21,852,471 | I'm trying calling the `/auth/logout` url to get redirected after session is deleted:
```
app.config(['$routeProvider',function($routeProvider) {
$routeProvider
.when('/auth/logout',{
controller:'AuthLogout'
//templateUrl: not needed
})
})
.controller('AuthLogout', ['$window','$location', ... | 2014/02/18 | [
"https://Stackoverflow.com/questions/21852471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/895174/"
] | You can use a resolve handler according to the post <https://github.com/angular/angular.js/issues/1838>
Checkout this quick example and notice the alert statement in resolve.
<http://jsfiddle.net/Wk7WD/34/>
```
.when('/detail/:id/', {
resolve: {
load: function ($route, dataService) {
alert("h... | use `redirectTo`
```
app.config(['$routeProvider',function($routeProvider) {
$routeProvider
.when('/auth/logout',{
redirectTo:'/'
})
});
```
Hope this will work for you :) |
21,852,471 | I'm trying calling the `/auth/logout` url to get redirected after session is deleted:
```
app.config(['$routeProvider',function($routeProvider) {
$routeProvider
.when('/auth/logout',{
controller:'AuthLogout'
//templateUrl: not needed
})
})
.controller('AuthLogout', ['$window','$location', ... | 2014/02/18 | [
"https://Stackoverflow.com/questions/21852471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/895174/"
] | You could do :
```
.when('/auth/logout', {
controller: function(){
//do staff
}
})
```
btw may be there is something wrong in your code
because template works and you could exploit it in
the same way
[http://docs.angularjs.org/api/ngRoute/provider/$routeProvider](http://docs.angularjs.org/api/ngRou... | You can use a resolve handler according to the post <https://github.com/angular/angular.js/issues/1838>
Checkout this quick example and notice the alert statement in resolve.
<http://jsfiddle.net/Wk7WD/34/>
```
.when('/detail/:id/', {
resolve: {
load: function ($route, dataService) {
alert("h... |
240,504 | I have a desktop computer in my home network with SSH server running on it. Using another computer in my private and local network (class C IP addresses: e.g., 192.168.0.2, etc) I sometimes use SSH to enter into the desktop PC with command `ssh <user_name>@192.168.0.2` and work remotely.
I am wondering if someone from... | 2020/11/06 | [
"https://security.stackexchange.com/questions/240504",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/241489/"
] | SSH is a professional grade protocol, and most server and client SSH software have been intensively scrutinized for possible flaws, so *if you use it in a conformant way* it is secure.
Simply best practices recommend to have more than one defense line. If you want a professional grade security, you must behave as a pr... | Connections from the Internet to a private address aren't possible per se, but there are some more indirect attack vectors to consider:
1. Vulnerabilities in the router or in its configuration. There could e.g. be a *port forwarding* from the external IP address to the private network address, enabling connectivity fr... |
34,875,904 | I want to make collapsible top boxes. but somehow I was not successful. I want to make objects such as cards on the links page materialize. but also bootstrap
card subject at this link: materializecss.com/cards.html


```css
.card3 {
... | 2016/01/19 | [
"https://Stackoverflow.com/questions/34875904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5799160/"
] | You can write JavaScript expression inside ng-class. You don't need more braces `{{}}`:
```
<label class="item item-input item-floating-label"
ng-class="{'has-errors':(loginForm.$submitted && loginForm['AccountLoginForm[username]'].$invalid) || (loginForm.$submitted && loginForm['AccountLoginForm[usernam... | The code that you have posted will work once you remove the `curly braces {{}}`. Logical operators are allowed within ng-class. But the better way would be to create a function and make that function return either true or false on the number on conditions that you want to test and then call that function from ng-class.... |
34,875,904 | I want to make collapsible top boxes. but somehow I was not successful. I want to make objects such as cards on the links page materialize. but also bootstrap
card subject at this link: materializecss.com/cards.html


```css
.card3 {
... | 2016/01/19 | [
"https://Stackoverflow.com/questions/34875904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5799160/"
] | You can write JavaScript expression inside ng-class. You don't need more braces `{{}}`:
```
<label class="item item-input item-floating-label"
ng-class="{'has-errors':(loginForm.$submitted && loginForm['AccountLoginForm[username]'].$invalid) || (loginForm.$submitted && loginForm['AccountLoginForm[usernam... | As you can see in [documentation](https://docs.angularjs.org/api/ng/directive/ngClass) ng-class already expect expression:
`<ANY ng-class="expression">`
You don't have to use '{{expression}}' syntax inside it. Try:
```
<label class="item item-input item-floating-label"
ng-class="{'has-errors': (loginForm.$sub... |
34,875,904 | I want to make collapsible top boxes. but somehow I was not successful. I want to make objects such as cards on the links page materialize. but also bootstrap
card subject at this link: materializecss.com/cards.html


```css
.card3 {
... | 2016/01/19 | [
"https://Stackoverflow.com/questions/34875904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5799160/"
] | The code that you have posted will work once you remove the `curly braces {{}}`. Logical operators are allowed within ng-class. But the better way would be to create a function and make that function return either true or false on the number on conditions that you want to test and then call that function from ng-class.... | As you can see in [documentation](https://docs.angularjs.org/api/ng/directive/ngClass) ng-class already expect expression:
`<ANY ng-class="expression">`
You don't have to use '{{expression}}' syntax inside it. Try:
```
<label class="item item-input item-floating-label"
ng-class="{'has-errors': (loginForm.$sub... |
24,021 | Every year, during December, our cousin site, [Advent of Code](https://adventofcode.com/) goes live, hosting a coding challenge every day from the 1st of December to the 24th of December. There have been [various](https://codegolf.stackexchange.com/q/216024/66833) [attempts](https://codegolf.stackexchange.com/q/149660/... | 2021/11/09 | [
"https://codegolf.meta.stackexchange.com/questions/24021",
"https://codegolf.meta.stackexchange.com",
"https://codegolf.meta.stackexchange.com/users/66833/"
] | This could totally work
=======================
The sandbox has thousands of challenges, many of which are good, and many of which will never see the light of day. Cleaning up 25 of these and adding some winter theming on top shouldn't take too much work, especially since we can work on the later ones throughout early... | I'm fully in support of such an event, but...
=============================================
... maybe it's too late to build such an event for this year, I guess?
The main issue is about coming up with the challenges in the first place, obviously. [Eric Wastl](https://adventofcode.com/2021/about), the host of AoC, is... |
13,690,564 | I have an antlr grammer with subtrees like this:
```
^(type ID)
```
that I want to convert to:
```
^(type DUMMY ID)
```
where type is 'a'|'b'.
Note: what I really want to do is convert anonymous instantiations to explicit by generating dummy names.
I've narrowed it down to the grammars below, but I'm getting ... | 2012/12/03 | [
"https://Stackoverflow.com/questions/13690564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23630/"
] | There are two small problems to address to get the rewrite to work, one problem in `Rewrite` and the other in `Pattern`.
The `Rewrite` grammar produces `^(type ID)` as root elements in the output AST, as shown in the output `(a bar) (b bar)`. A root element can't be transformed because transforming is actually a form ... | I don't have much experience with tree-patterns, with or without rewrites. But when using rewrite rules in them, I believe your options should also include `rewrite=true;`. The Definitive ANTLR Reference doesn't handle them, so I'm not entirely sure (have a look at the [ANTLR wiki](http://www.antlr.org/wiki) for more i... |
42,137,404 | I want to save data in MySQL. I am using php and my codes:
```
<?php
header('Content-Type: text/html; charset=UTF-8');
//Connect to Database
include "Connect.php";
//getting values
$name = $_POST['name'];
$email = $_POST['email'];
//query
$q="INSERT INTO users (name, email) VALUES ($name,$email)";
if (mysqli_query... | 2017/02/09 | [
"https://Stackoverflow.com/questions/42137404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6791631/"
] | Without considering **SQL Injection** attacks, I think the problem in SQL is the single quotes are missed for values. Improvement:
```
$q="INSERT INTO users (name, email) VALUES (\'$name\',\'$email\')";
``` | Use this and check for column name and type
```
INSERT INTO users (name, email) VALUES('abcd', 'abcd@mail.com')
``` |
64,788,305 | I am trying to loop through an array of objects, which depending on their type property, will create a different class and append it to an array. The problem is that the output is always just a list of duplicates of the last class created.
```
// Create Elements from Content
// The id's are created by UUIDV4 and are a... | 2020/11/11 | [
"https://Stackoverflow.com/questions/64788305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14579196/"
] | Allow me to demonstrate a counterexample to your claim. You code seems to work correctly and the problem is elsewhere, most likely your `Paragraph` class.
By just changing the supporting framework (consisting of `self` and its `content`, `page_data` etc.) and the `Paragraph` class) I can demonstrate that your code (wh... | Try just using a new variable declared inside the scope of the loop
```
// Create Elements from Content
// The id's are created by UUIDV4 and are all different.
self._elements = new Array
self.content.page_data.forEach(cont => {
switch (cont.type) {
case 'paragraph':
var e = new Paragraph()
... |
64,788,305 | I am trying to loop through an array of objects, which depending on their type property, will create a different class and append it to an array. The problem is that the output is always just a list of duplicates of the last class created.
```
// Create Elements from Content
// The id's are created by UUIDV4 and are a... | 2020/11/11 | [
"https://Stackoverflow.com/questions/64788305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14579196/"
] | The keyword is `this` in JavaScript. Not `self` (that's a Python thing.) Since `self` is *not* a keyword in JavaScript, some people use it [by convention](https://stackoverflow.com/q/16875767/1563833) as a normal variable name by manually assigning `var self = this;` somewhere. But really, I think you just want to say ... | Try just using a new variable declared inside the scope of the loop
```
// Create Elements from Content
// The id's are created by UUIDV4 and are all different.
self._elements = new Array
self.content.page_data.forEach(cont => {
switch (cont.type) {
case 'paragraph':
var e = new Paragraph()
... |
64,788,305 | I am trying to loop through an array of objects, which depending on their type property, will create a different class and append it to an array. The problem is that the output is always just a list of duplicates of the last class created.
```
// Create Elements from Content
// The id's are created by UUIDV4 and are a... | 2020/11/11 | [
"https://Stackoverflow.com/questions/64788305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14579196/"
] | The keyword is `this` in JavaScript. Not `self` (that's a Python thing.) Since `self` is *not* a keyword in JavaScript, some people use it [by convention](https://stackoverflow.com/q/16875767/1563833) as a normal variable name by manually assigning `var self = this;` somewhere. But really, I think you just want to say ... | Allow me to demonstrate a counterexample to your claim. You code seems to work correctly and the problem is elsewhere, most likely your `Paragraph` class.
By just changing the supporting framework (consisting of `self` and its `content`, `page_data` etc.) and the `Paragraph` class) I can demonstrate that your code (wh... |
77,629 | I have been programming python and web apps awhile now but never delved very deep into OOP. I use classes all the time but I am pretty sure i am not fully getting what I could get from OOP. So today I popped open Learn Python (mark lutz) which i had read awhile ago, flipped through the oop section in about 5 minutes an... | 2011/05/19 | [
"https://softwareengineering.stackexchange.com/questions/77629",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/25221/"
] | Have you tried googling OOP????? It returns a pretty good result for WHAT OOP is in the first place :P "Classes" is just the tip of the iceberg. You need to know the 3 concepts -Inheritance,Encapsulation and Polymorphism theoretically before getting started with implementation..in anyyy language,let alone Python. | I read this [book](http://rads.stackoverflow.com/amzn/click/0136150314) awhile back when I thought about taking a Python gig. It was pretty good!
If you want a deeper understanding of OO in general there are a lot of resources on the web about [it](http://www.google.com/search?aq=0&oq=Object%20oriented%20&sourceid=chr... |
31,215,304 | I have the following example set of data:
```
Example<-data.frame(A=10*1:9,B=10*10:18)
rownames(Example)<-paste("Sample",1:9)
> Example
A B
Sample 1 10 100
Sample 2 20 110
Sample 3 30 120
Sample 4 40 130
Sample 5 50 140
Sample 6 60 150
Sample 7 70 160
Sample 8 80 170
Sample 9 90 180
```
I am trying to d... | 2015/07/03 | [
"https://Stackoverflow.com/questions/31215304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4931026/"
] | `data.table` solution:
```
sum.cols = c("A", "B")
library(data.table)
setDT(Example, keep.rownames = TRUE)
Example[ , (sum.cols) := lapply(.SD, function(x) x/sum(x)), .SDcols = sum.cols]
```
Or perhaps more direct in your case:
```
Example[ , c("A", "B") := .(A/sum(A), B/sum(B))]
```
Which give:
```
Example
# ... | Is this what you're after?
```
id <- paste("sample", c(1:9))
A <- seq(10, 90, 10)
B <- seq(100, 180, 10)
Example <- data.frame(id, A, B)
Example$A2 <- with(Example, A/sum(A))
Example$B2 <- with(Example, B/sum(B))
```
Note: new columns A2 and B2.
```
id A B A2 B2
sample 1 10 100 0.022222... |
31,215,304 | I have the following example set of data:
```
Example<-data.frame(A=10*1:9,B=10*10:18)
rownames(Example)<-paste("Sample",1:9)
> Example
A B
Sample 1 10 100
Sample 2 20 110
Sample 3 30 120
Sample 4 40 130
Sample 5 50 140
Sample 6 60 150
Sample 7 70 160
Sample 8 80 170
Sample 9 90 180
```
I am trying to d... | 2015/07/03 | [
"https://Stackoverflow.com/questions/31215304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4931026/"
] | Is this what you're after?
```
id <- paste("sample", c(1:9))
A <- seq(10, 90, 10)
B <- seq(100, 180, 10)
Example <- data.frame(id, A, B)
Example$A2 <- with(Example, A/sum(A))
Example$B2 <- with(Example, B/sum(B))
```
Note: new columns A2 and B2.
```
id A B A2 B2
sample 1 10 100 0.022222... | You could simply do:
```
library(dplyr)
dat %>% mutate_each(funs(. / sum(.)))
```
Which gives:
```
# A B
#1 0.02222222 0.07936508
#2 0.04444444 0.08730159
#3 0.06666667 0.09523810
#4 0.08888889 0.10317460
#5 0.11111111 0.11111111
#6 0.13333333 0.11904762
#7 0.15555556 0.12698413
#8 0.17777778 0.1... |
31,215,304 | I have the following example set of data:
```
Example<-data.frame(A=10*1:9,B=10*10:18)
rownames(Example)<-paste("Sample",1:9)
> Example
A B
Sample 1 10 100
Sample 2 20 110
Sample 3 30 120
Sample 4 40 130
Sample 5 50 140
Sample 6 60 150
Sample 7 70 160
Sample 8 80 170
Sample 9 90 180
```
I am trying to d... | 2015/07/03 | [
"https://Stackoverflow.com/questions/31215304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4931026/"
] | `data.table` solution:
```
sum.cols = c("A", "B")
library(data.table)
setDT(Example, keep.rownames = TRUE)
Example[ , (sum.cols) := lapply(.SD, function(x) x/sum(x)), .SDcols = sum.cols]
```
Or perhaps more direct in your case:
```
Example[ , c("A", "B") := .(A/sum(A), B/sum(B))]
```
Which give:
```
Example
# ... | You can get column sums with `colSums` and `paste` to make new column names derived from the previous. `colSums` returns a vector of the column sums, but to do column-wise division you need to use a little trickery. The best way looks to be the one mentioned @user20650.
```
## Make new columns: proportions of column s... |
31,215,304 | I have the following example set of data:
```
Example<-data.frame(A=10*1:9,B=10*10:18)
rownames(Example)<-paste("Sample",1:9)
> Example
A B
Sample 1 10 100
Sample 2 20 110
Sample 3 30 120
Sample 4 40 130
Sample 5 50 140
Sample 6 60 150
Sample 7 70 160
Sample 8 80 170
Sample 9 90 180
```
I am trying to d... | 2015/07/03 | [
"https://Stackoverflow.com/questions/31215304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4931026/"
] | You can get column sums with `colSums` and `paste` to make new column names derived from the previous. `colSums` returns a vector of the column sums, but to do column-wise division you need to use a little trickery. The best way looks to be the one mentioned @user20650.
```
## Make new columns: proportions of column s... | You could simply do:
```
library(dplyr)
dat %>% mutate_each(funs(. / sum(.)))
```
Which gives:
```
# A B
#1 0.02222222 0.07936508
#2 0.04444444 0.08730159
#3 0.06666667 0.09523810
#4 0.08888889 0.10317460
#5 0.11111111 0.11111111
#6 0.13333333 0.11904762
#7 0.15555556 0.12698413
#8 0.17777778 0.1... |
31,215,304 | I have the following example set of data:
```
Example<-data.frame(A=10*1:9,B=10*10:18)
rownames(Example)<-paste("Sample",1:9)
> Example
A B
Sample 1 10 100
Sample 2 20 110
Sample 3 30 120
Sample 4 40 130
Sample 5 50 140
Sample 6 60 150
Sample 7 70 160
Sample 8 80 170
Sample 9 90 180
```
I am trying to d... | 2015/07/03 | [
"https://Stackoverflow.com/questions/31215304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4931026/"
] | `data.table` solution:
```
sum.cols = c("A", "B")
library(data.table)
setDT(Example, keep.rownames = TRUE)
Example[ , (sum.cols) := lapply(.SD, function(x) x/sum(x)), .SDcols = sum.cols]
```
Or perhaps more direct in your case:
```
Example[ , c("A", "B") := .(A/sum(A), B/sum(B))]
```
Which give:
```
Example
# ... | What about just a `apply`:
```
apply(dat, 2, function(x) x / sum(x))
A B
Sample1 0.02222222 0.07936508
Sample2 0.04444444 0.08730159
Sample3 0.06666667 0.09523810
Sample4 0.08888889 0.10317460
Sample5 0.11111111 0.11111111
Sample6 0.13333333 0.11904762
Sample7 0.15555556 0.12698413
Sample8 0... |
31,215,304 | I have the following example set of data:
```
Example<-data.frame(A=10*1:9,B=10*10:18)
rownames(Example)<-paste("Sample",1:9)
> Example
A B
Sample 1 10 100
Sample 2 20 110
Sample 3 30 120
Sample 4 40 130
Sample 5 50 140
Sample 6 60 150
Sample 7 70 160
Sample 8 80 170
Sample 9 90 180
```
I am trying to d... | 2015/07/03 | [
"https://Stackoverflow.com/questions/31215304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4931026/"
] | What about just a `apply`:
```
apply(dat, 2, function(x) x / sum(x))
A B
Sample1 0.02222222 0.07936508
Sample2 0.04444444 0.08730159
Sample3 0.06666667 0.09523810
Sample4 0.08888889 0.10317460
Sample5 0.11111111 0.11111111
Sample6 0.13333333 0.11904762
Sample7 0.15555556 0.12698413
Sample8 0... | You could simply do:
```
library(dplyr)
dat %>% mutate_each(funs(. / sum(.)))
```
Which gives:
```
# A B
#1 0.02222222 0.07936508
#2 0.04444444 0.08730159
#3 0.06666667 0.09523810
#4 0.08888889 0.10317460
#5 0.11111111 0.11111111
#6 0.13333333 0.11904762
#7 0.15555556 0.12698413
#8 0.17777778 0.1... |
31,215,304 | I have the following example set of data:
```
Example<-data.frame(A=10*1:9,B=10*10:18)
rownames(Example)<-paste("Sample",1:9)
> Example
A B
Sample 1 10 100
Sample 2 20 110
Sample 3 30 120
Sample 4 40 130
Sample 5 50 140
Sample 6 60 150
Sample 7 70 160
Sample 8 80 170
Sample 9 90 180
```
I am trying to d... | 2015/07/03 | [
"https://Stackoverflow.com/questions/31215304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4931026/"
] | `data.table` solution:
```
sum.cols = c("A", "B")
library(data.table)
setDT(Example, keep.rownames = TRUE)
Example[ , (sum.cols) := lapply(.SD, function(x) x/sum(x)), .SDcols = sum.cols]
```
Or perhaps more direct in your case:
```
Example[ , c("A", "B") := .(A/sum(A), B/sum(B))]
```
Which give:
```
Example
# ... | You could simply do:
```
library(dplyr)
dat %>% mutate_each(funs(. / sum(.)))
```
Which gives:
```
# A B
#1 0.02222222 0.07936508
#2 0.04444444 0.08730159
#3 0.06666667 0.09523810
#4 0.08888889 0.10317460
#5 0.11111111 0.11111111
#6 0.13333333 0.11904762
#7 0.15555556 0.12698413
#8 0.17777778 0.1... |
26,605,151 | I Am not able to read Properties File using Java.It Means In this Properties File Backward Slash is not working.It is showing like ,this destination :C:Usersxxx.a
```
String filename="D://Desktop//xxx.properties";
is = new FileInputStream(filename);
Properties prop=new Properties();
prop.load(is);
System.out.println("... | 2014/10/28 | [
"https://Stackoverflow.com/questions/26605151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3940240/"
] | `\` is an Escape character.
forward slash `/` is used as path separator in Unix environment.
Back slash `\` is used as path separator in Windows environment.
So, You need to use `\\` or `/` as path separator. You can not directly use `\` in java. Since, it is an escape character.
So,You need to make changes in ... | You need to add two slashes to your properties file like this:
`destination=C:\\Users\\xxx.a\\`
The other way is to swap the slashes in the properties file:
`destination=C:/Users/xxx.a/`
A `\` is an escape character so it is removed. Adding two slashes escapes the first so only one is left. |
26,605,151 | I Am not able to read Properties File using Java.It Means In this Properties File Backward Slash is not working.It is showing like ,this destination :C:Usersxxx.a
```
String filename="D://Desktop//xxx.properties";
is = new FileInputStream(filename);
Properties prop=new Properties();
prop.load(is);
System.out.println("... | 2014/10/28 | [
"https://Stackoverflow.com/questions/26605151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3940240/"
] | `\` is an Escape character.
forward slash `/` is used as path separator in Unix environment.
Back slash `\` is used as path separator in Windows environment.
So, You need to use `\\` or `/` as path separator. You can not directly use `\` in java. Since, it is an escape character.
So,You need to make changes in ... | The `\` character is used as an "escape character" in many programming languages. It gives a special meaning to the next character in the text. For example, `\n` encodes the special character "new-line".
Use `\\` instead of `\`. This indicates to the parser that you mean the actual symbol, not an escape character. For... |
26,605,151 | I Am not able to read Properties File using Java.It Means In this Properties File Backward Slash is not working.It is showing like ,this destination :C:Usersxxx.a
```
String filename="D://Desktop//xxx.properties";
is = new FileInputStream(filename);
Properties prop=new Properties();
prop.load(is);
System.out.println("... | 2014/10/28 | [
"https://Stackoverflow.com/questions/26605151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3940240/"
] | `\` is an Escape character.
forward slash `/` is used as path separator in Unix environment.
Back slash `\` is used as path separator in Windows environment.
So, You need to use `\\` or `/` as path separator. You can not directly use `\` in java. Since, it is an escape character.
So,You need to make changes in ... | You can store it in D:/Desktop/xxx.properties as
```
destination=C:/Users/xxx.a/
```
and show it with a single backslash
```
String fileName = prop.getProperty("destination");
System.out.println("destination: " + fileName); // shows: C:/Users/xxx.a/
System.out.println("destination: " + Paths.get(fileName)); // show... |
5,724,433 | Please, can you suggest me a better way to accomplish this:
```
@infos = @activity.infos
@infos.each do |info|
@activity.name = info.title if info.language_id == 1
end
```
**EDIT**
In my Rails app contents can be inserted in many languages, but are displayed only in one of them. Other languages are used only as X... | 2011/04/20 | [
"https://Stackoverflow.com/questions/5724433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/396133/"
] | You can do something like this.
```
info = @activity.infos.select{|info| info.language_id == 1}.last
@activity.name = info.title
``` | Well, you could lose the iteration...
```
@activity.name = @activity.infos.find(:first, :conditions => { :language_id => 1 }).title
```
but that doesn't guarantee you'll get a result (in the real world). So:
```
info = @activity.infos.find(:first, :conditions => { :language_id => 1 })
@activity.name = info.title u... |
5,724,433 | Please, can you suggest me a better way to accomplish this:
```
@infos = @activity.infos
@infos.each do |info|
@activity.name = info.title if info.language_id == 1
end
```
**EDIT**
In my Rails app contents can be inserted in many languages, but are displayed only in one of them. Other languages are used only as X... | 2011/04/20 | [
"https://Stackoverflow.com/questions/5724433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/396133/"
] | You can do something like this.
```
info = @activity.infos.select{|info| info.language_id == 1}.last
@activity.name = info.title
``` | Same as the others but using the ARrel syntax that's available in rails 3.
```
@activity.name = @activity.infos.where(:language_id => 1).first.title
```
As the others mentioned ... you might want rethink your design. If you provide more detail on why you are trying to do this we may be able to help with the underlyi... |
46,092,099 | I have a dataframe that contains fields with strings, such as "fish, birds, animals", etc. I have collapsed them into a list, and iterate over them in order to create logical fields within same dataframe. **Update:** The question is now updated with a more elaborate example.
However, this is slow and does not feel opt... | 2017/09/07 | [
"https://Stackoverflow.com/questions/46092099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1603472/"
] | This will be fairly fast
```
f1 = function(df, column_name) {
## pre-process words
words = strsplit(df[[column_name]], ",")
uwords = unlist(words)
colnames = unique(uwords)
## pre-allocate result matrix of 'FALSE' values
m = matrix(FALSE, nrow(df), length(colnames), dimnames = list(NULL, colna... | Here's a step by step solution; Uwe's is probably much faster but I hope this is easier to understand:
```
categories_per_row <- strsplit(df$items, split=",")
categories <- unique(unlist(strsplit(df$items, ",")))
categoryM <- t(sapply(categories_per_row, function(y) categories %in% y))
colnames(categoryM) <- categorie... |
59,479,802 | First-time post here! I am trying to build a rails app but I am having a ton of difficulty getting started. I have installed Rails, and Ruby but every time I go to make the app (Miless-MBP:railstest miles$ rails new tester2) I get a multitude of errors. The full log is below, but I have listed the 4 here.
Thank you a... | 2019/12/25 | [
"https://Stackoverflow.com/questions/59479802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12596187/"
] | I had the same issue. You need to completely clean out the `msgpack` gem using:
```
gem uninstall msgpack
```
Then reinstall it, so that the libraries are built against the version of ruby you're now using.
You could also try:
```
bundle install --redownload
```
which should reinstall the gems and rebuild the li... | FWIW, I just spend several hours on a very similar error, after upgrading a Ruby app from ruby 2.4 to 2.6. I'm using rbenv and bundler on MacOS Mojave.
I can't pinpoint how I fixed it, but after trying lots of updates/rehash/install approaches with little success, I uninstalled about a dozen old versions of ruby and s... |
19,524,876 | I have a C# .NET Windows Form with text fields. The user enters data into this form and once they submit I need to generate a PDF file with their data arranged neatly. What is the best way to do this? Should I move the data into a database or can I directly export to PDF? | 2013/10/22 | [
"https://Stackoverflow.com/questions/19524876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1387815/"
] | There is no need to add it to a database if you don't want to persist the data for later use. There are tons of libraries out there for pdf creation in c#.
Here's a [**post**](https://stackoverflow.com/questions/1630708/what-is-the-best-way-to-generate-pdf-from-c) made not long ago with some great references. It also ... | you want to export directly to pdf. are you have any specific format, how it should Looks.
otherwise create a **crystal report**. Design a format.After that write this code
```
Crystalreportobject.ExportToDisk(ExportFormatType.PortableDocFormat, name + ".pdf");
```
**ExportToDiskMethod** can Export direc... |
493,402 | Good Morning,
I would like to know what is the best arrangement for setting up 24 computers at a facility. We do not want these computers to join our domain because of security concerns. We plan on having these public computers connect to our wifi network. If anyone knows of the best way to approach this, that would b... | 2012/10/26 | [
"https://superuser.com/questions/493402",
"https://superuser.com",
"https://superuser.com/users/-1/"
] | Where I work we just leave them in their default work groups when we don't want them on the domain, then you can delegate network resources (such as printers, shared drives, whatever else you might have) manually. | You can configure a guest network in your wifi router (I don't know whether your router supports guest network facility or not.) and connect those computers to that network. Not only computers you can add printer's or any other devices to this network. Based on your wifi router check for other options. If your's is cis... |
2,440,393 | I am trying to call a view via presentModalViewController from a UIAlertView button. The code is below, the NSlog is displayed in the console so I know that code execution is indeed reaching that point. Also, there are no errors or anything displayed:
```
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex... | 2010/03/13 | [
"https://Stackoverflow.com/questions/2440393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/185224/"
] | You have to port your code to *some* way of controlling the terminal as slightly better than a teletype -- e.g. with the [curses](http://docs.python.org/library/curses.html?highlight=curses#module-curses) module in Python's standard library, or other ways to move the cursor away before emitting output, then move it bac... | You could defer writing output until just after you receive some input. For anything more advanced you'll have to use Alex's answer
```
import threading, time
output=[]
class MyThread( threading.Thread ):
running = False
def run(self):
self.running = True
i = 0
while self.running:
... |
41,341,299 | I was working on a Java Swing project and I want a `JMenuBar` on the top of the page with `JMenu`s, and when I select a `JMenu` I want that the `JFrame` be filled with some input fields. I tried to add panels that constitute the frame to the `JMenu` and when I press each `JMenu` the `JFrame` is filled by different comp... | 2016/12/27 | [
"https://Stackoverflow.com/questions/41341299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7312687/"
] | >
> * Will fragment's onDestroyView result in clearing out all the listeners
> from those inner RecyclerViews?
> * Since I am creating the instance of the listener inside the outer RecyclerView's ViewHolder, so will it get automatically destroyed when its Fragment is destroyed?
>
>
>
I don't think it will, instead... | Yes you can take benefit of `onDestroyView` and send callBack to your outer `RecyclerView` parent component only, so that will be only responsible to set listener of inner `RecyclerView` which can be either null. |
41,341,299 | I was working on a Java Swing project and I want a `JMenuBar` on the top of the page with `JMenu`s, and when I select a `JMenu` I want that the `JFrame` be filled with some input fields. I tried to add panels that constitute the frame to the `JMenu` and when I press each `JMenu` the `JFrame` is filled by different comp... | 2016/12/27 | [
"https://Stackoverflow.com/questions/41341299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7312687/"
] | I created a custom `RecyclerView` (inner) and override it's `onScrollStateChanged` method and have implemented scroll-changed the logic there.
I also had to set some custom dataset to the listener, which I am setting while setting the adapter for the `RecyclerView`. | >
> * Will fragment's onDestroyView result in clearing out all the listeners
> from those inner RecyclerViews?
> * Since I am creating the instance of the listener inside the outer RecyclerView's ViewHolder, so will it get automatically destroyed when its Fragment is destroyed?
>
>
>
I don't think it will, instead... |
41,341,299 | I was working on a Java Swing project and I want a `JMenuBar` on the top of the page with `JMenu`s, and when I select a `JMenu` I want that the `JFrame` be filled with some input fields. I tried to add panels that constitute the frame to the `JMenu` and when I press each `JMenu` the `JFrame` is filled by different comp... | 2016/12/27 | [
"https://Stackoverflow.com/questions/41341299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7312687/"
] | I created a custom `RecyclerView` (inner) and override it's `onScrollStateChanged` method and have implemented scroll-changed the logic there.
I also had to set some custom dataset to the listener, which I am setting while setting the adapter for the `RecyclerView`. | Yes you can take benefit of `onDestroyView` and send callBack to your outer `RecyclerView` parent component only, so that will be only responsible to set listener of inner `RecyclerView` which can be either null. |
483,651 | I've been teaching myself electronics and a current approach I am taking, is to be able to describe the purpose of every element in the standard TTL NOT gate:
[Circuit lab TTL NOT Gate](https://www.circuitlab.com/editor/aqt56exr3pqn/)

At this point I understand th... | 2020/02/28 | [
"https://electronics.stackexchange.com/questions/483651",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/239929/"
] | The first thing you need to do is realize that this is an "equivalent circuit", and not necessarily a manufacturing schematic. With that in mind, some things are pretty straightforward.
R1 limits the current which will be required to pull the input to ground. At this point, the base current will be about 1 mA. ((5 - 0... | Note the timing uncertainty caused by thermal noise, when the input goes high.
The pullup on base of Q1 is 4K oohm, or about 1mA.
That current will eventually flow into base of Q2, and start to turn on Q2.
As Q2 turns off, its collector starts to drop down from +5. There will be some Miller effect, where a small cha... |
501,796 | I've been trying to install packages using terminal but I keep getting errors and it turns out my sources.list file is really messed up.
So I found [this webstite that generates a sources.list file for you](http://repogen.simplylinux.ch/)
I know my country and my release but I have no idea what other boxes are suppos... | 2014/07/23 | [
"https://askubuntu.com/questions/501796",
"https://askubuntu.com",
"https://askubuntu.com/users/308525/"
] | Since what you want is, essentially, simple, the sane thing to do is just revert all your changes instead of using third parties which can be too complicated. Just copy the `/usr/share/doc/apt/examples/sources.list` file to `/etc/apt/` and remove the files in your `/etc/apt/sources.list.d` directory. Or, in simple comm... | The most basic system will just have the:
* Main
* Updates
* Security Updates
repositories, but I recommend following the "normal" route below.
---
### just a working system..
If you just want to get back to a working system then check:
* Main
* Restricted
* Universe
* Multiverse
* Security (under the "Ubuntu U... |
501,796 | I've been trying to install packages using terminal but I keep getting errors and it turns out my sources.list file is really messed up.
So I found [this webstite that generates a sources.list file for you](http://repogen.simplylinux.ch/)
I know my country and my release but I have no idea what other boxes are suppos... | 2014/07/23 | [
"https://askubuntu.com/questions/501796",
"https://askubuntu.com",
"https://askubuntu.com/users/308525/"
] | The most basic system will just have the:
* Main
* Updates
* Security Updates
repositories, but I recommend following the "normal" route below.
---
### just a working system..
If you just want to get back to a working system then check:
* Main
* Restricted
* Universe
* Multiverse
* Security (under the "Ubuntu U... | If you have a private mirror, you can use
<https://gist.github.com/JonasGroeger/6dc444411301ca467cc2> |
501,796 | I've been trying to install packages using terminal but I keep getting errors and it turns out my sources.list file is really messed up.
So I found [this webstite that generates a sources.list file for you](http://repogen.simplylinux.ch/)
I know my country and my release but I have no idea what other boxes are suppos... | 2014/07/23 | [
"https://askubuntu.com/questions/501796",
"https://askubuntu.com",
"https://askubuntu.com/users/308525/"
] | Since what you want is, essentially, simple, the sane thing to do is just revert all your changes instead of using third parties which can be too complicated. Just copy the `/usr/share/doc/apt/examples/sources.list` file to `/etc/apt/` and remove the files in your `/etc/apt/sources.list.d` directory. Or, in simple comm... | If you have a private mirror, you can use
<https://gist.github.com/JonasGroeger/6dc444411301ca467cc2> |
15,472,383 | I want some code to run in the background continuously. I don't want to do it in a service. Is there any other way possible?
I have tried calling the `Thread` class in my `Activity` but my `Activity` remains in the background for sometime and then it stops. The `Thread` class also stops working.
```
class testThread... | 2013/03/18 | [
"https://Stackoverflow.com/questions/15472383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2082987/"
] | Remember Running Background, Running continuously is two different tasks.
For long-term background processes, Threads aren't optimal with Android. However, here's the code, and do it at your own risk.
To approach it in the right way, you need to Start Service First, Inside the service, you need to start the Thread/As... | Today I was looking for this and Mr Brandon Rude gave an [excellent answer](https://stackoverflow.com/a/31549559/9053942). Unfortunately, `AsyncTask` is now [deprecated](https://developer.android.com/reference/android/os/AsyncTask). You can still use it, but it gives you a warning, which is very annoying. So an alterna... |
15,472,383 | I want some code to run in the background continuously. I don't want to do it in a service. Is there any other way possible?
I have tried calling the `Thread` class in my `Activity` but my `Activity` remains in the background for sometime and then it stops. The `Thread` class also stops working.
```
class testThread... | 2013/03/18 | [
"https://Stackoverflow.com/questions/15472383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2082987/"
] | IF you need to:
1. execute code on a background Thread
2. execute code that DOES NOT touch/update the UI
3. execute (short) code which will take at most a few seconds to complete
THEN use the following clean and efficient pattern which uses AsyncTask:
```
AsyncTask.execute(new Runnable() {
@Override
public vo... | Today I was looking for this and Mr Brandon Rude gave an [excellent answer](https://stackoverflow.com/a/31549559/9053942). Unfortunately, `AsyncTask` is now [deprecated](https://developer.android.com/reference/android/os/AsyncTask). You can still use it, but it gives you a warning, which is very annoying. So an alterna... |
15,472,383 | I want some code to run in the background continuously. I don't want to do it in a service. Is there any other way possible?
I have tried calling the `Thread` class in my `Activity` but my `Activity` remains in the background for sometime and then it stops. The `Thread` class also stops working.
```
class testThread... | 2013/03/18 | [
"https://Stackoverflow.com/questions/15472383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2082987/"
] | An Alternative to AsyncTask is robospice. <https://github.com/octo-online/robospice>.
Some of the features of robospice.
1.executes asynchronously (in a background AndroidService) network requests (ex: REST requests using Spring Android).notify you app, on the UI thread, when result is ready.
2.is strongly typed ! Y... | //Works accurately for me
```
new Thread( () -> {
//run code on background thread
activity.runOnUiThread(()->{
//update the UI on main thread
});
//here activity is the reference of activity
}).start();
```
//OR
```
new Thread(new Runnable() {
@Override
... |
15,472,383 | I want some code to run in the background continuously. I don't want to do it in a service. Is there any other way possible?
I have tried calling the `Thread` class in my `Activity` but my `Activity` remains in the background for sometime and then it stops. The `Thread` class also stops working.
```
class testThread... | 2013/03/18 | [
"https://Stackoverflow.com/questions/15472383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2082987/"
] | An Alternative to AsyncTask is robospice. <https://github.com/octo-online/robospice>.
Some of the features of robospice.
1.executes asynchronously (in a background AndroidService) network requests (ex: REST requests using Spring Android).notify you app, on the UI thread, when result is ready.
2.is strongly typed ! Y... | If you need run thread predioticly with different codes here is example:
Listener:
```
public interface ESLThreadListener {
public List onBackground();
public void onPostExecute(List list);
}
```
Thread Class
```
public class ESLThread extends AsyncTask<Void, Void, List> {
private ESLThreadListener... |
15,472,383 | I want some code to run in the background continuously. I don't want to do it in a service. Is there any other way possible?
I have tried calling the `Thread` class in my `Activity` but my `Activity` remains in the background for sometime and then it stops. The `Thread` class also stops working.
```
class testThread... | 2013/03/18 | [
"https://Stackoverflow.com/questions/15472383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2082987/"
] | Remember Running Background, Running continuously is two different tasks.
For long-term background processes, Threads aren't optimal with Android. However, here's the code, and do it at your own risk.
To approach it in the right way, you need to Start Service First, Inside the service, you need to start the Thread/As... | An Alternative to AsyncTask is robospice. <https://github.com/octo-online/robospice>.
Some of the features of robospice.
1.executes asynchronously (in a background AndroidService) network requests (ex: REST requests using Spring Android).notify you app, on the UI thread, when result is ready.
2.is strongly typed ! Y... |
15,472,383 | I want some code to run in the background continuously. I don't want to do it in a service. Is there any other way possible?
I have tried calling the `Thread` class in my `Activity` but my `Activity` remains in the background for sometime and then it stops. The `Thread` class also stops working.
```
class testThread... | 2013/03/18 | [
"https://Stackoverflow.com/questions/15472383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2082987/"
] | ```
class Background implements Runnable {
private CountDownLatch latch = new CountDownLatch(1);
private Handler handler;
Background() {
Thread thread = new Thread(this);
thread.start();
try {
latch.await();
} catch (InterruptedException e) {
/// e.pr... | If you need run thread predioticly with different codes here is example:
Listener:
```
public interface ESLThreadListener {
public List onBackground();
public void onPostExecute(List list);
}
```
Thread Class
```
public class ESLThread extends AsyncTask<Void, Void, List> {
private ESLThreadListener... |
15,472,383 | I want some code to run in the background continuously. I don't want to do it in a service. Is there any other way possible?
I have tried calling the `Thread` class in my `Activity` but my `Activity` remains in the background for sometime and then it stops. The `Thread` class also stops working.
```
class testThread... | 2013/03/18 | [
"https://Stackoverflow.com/questions/15472383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2082987/"
] | IF you need to:
1. execute code on a background Thread
2. execute code that DOES NOT touch/update the UI
3. execute (short) code which will take at most a few seconds to complete
THEN use the following clean and efficient pattern which uses AsyncTask:
```
AsyncTask.execute(new Runnable() {
@Override
public vo... | ### Simple 3-Liner
A simple way of doing this that I found as a comment by [@awardak](https://stackoverflow.com/users/3312163/awardak) in [Brandon Rude's answer](https://stackoverflow.com/a/31549559/293280):
```
new Thread( new Runnable() { @Override public void run() {
// Run whatever background code you want her... |
15,472,383 | I want some code to run in the background continuously. I don't want to do it in a service. Is there any other way possible?
I have tried calling the `Thread` class in my `Activity` but my `Activity` remains in the background for sometime and then it stops. The `Thread` class also stops working.
```
class testThread... | 2013/03/18 | [
"https://Stackoverflow.com/questions/15472383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2082987/"
] | ### Simple 3-Liner
A simple way of doing this that I found as a comment by [@awardak](https://stackoverflow.com/users/3312163/awardak) in [Brandon Rude's answer](https://stackoverflow.com/a/31549559/293280):
```
new Thread( new Runnable() { @Override public void run() {
// Run whatever background code you want her... | Today I was looking for this and Mr Brandon Rude gave an [excellent answer](https://stackoverflow.com/a/31549559/9053942). Unfortunately, `AsyncTask` is now [deprecated](https://developer.android.com/reference/android/os/AsyncTask). You can still use it, but it gives you a warning, which is very annoying. So an alterna... |
15,472,383 | I want some code to run in the background continuously. I don't want to do it in a service. Is there any other way possible?
I have tried calling the `Thread` class in my `Activity` but my `Activity` remains in the background for sometime and then it stops. The `Thread` class also stops working.
```
class testThread... | 2013/03/18 | [
"https://Stackoverflow.com/questions/15472383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2082987/"
] | ### Simple 3-Liner
A simple way of doing this that I found as a comment by [@awardak](https://stackoverflow.com/users/3312163/awardak) in [Brandon Rude's answer](https://stackoverflow.com/a/31549559/293280):
```
new Thread( new Runnable() { @Override public void run() {
// Run whatever background code you want her... | ```
class Background implements Runnable {
private CountDownLatch latch = new CountDownLatch(1);
private Handler handler;
Background() {
Thread thread = new Thread(this);
thread.start();
try {
latch.await();
} catch (InterruptedException e) {
/// e.pr... |
15,472,383 | I want some code to run in the background continuously. I don't want to do it in a service. Is there any other way possible?
I have tried calling the `Thread` class in my `Activity` but my `Activity` remains in the background for sometime and then it stops. The `Thread` class also stops working.
```
class testThread... | 2013/03/18 | [
"https://Stackoverflow.com/questions/15472383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2082987/"
] | >
> I want some code to run in the background continuously. I don't want
> to do it in a service. Is there any other way possible?
>
>
>
Most likely mechanizm that you are looking for is [`AsyncTask`](http://developer.android.com/reference/android/os/AsyncTask.html). It directly designated for performing backgrou... | Today I was looking for this and Mr Brandon Rude gave an [excellent answer](https://stackoverflow.com/a/31549559/9053942). Unfortunately, `AsyncTask` is now [deprecated](https://developer.android.com/reference/android/os/AsyncTask). You can still use it, but it gives you a warning, which is very annoying. So an alterna... |
24,280,999 | It might be a question already asked, but I have not found a satisfactory answer yet out there. In particular because this conversion has always been done in c or C++.
Btw, how do you convert an hexadecimal file (200MB) into its UINT32 Big-endian representation in Java?
This an example of what I am trying to achieve:... | 2014/06/18 | [
"https://Stackoverflow.com/questions/24280999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2511306/"
] | The following code should hopefully suffice. It uses `long` values to ensure we can fully represent the range of positive values that four bytes can represent.
Note: this code assumes the hex input is four bytes. You may want to add some more checks and measures in production code.
```
private static long toLong(Stri... | You need to switch the byte order within the 4 bytes that form an int. The conversion is symetric, so when the input is little endian, output becomes big endian and vice versa.
```
Big Endian: 12 34 56 78
Little Endian: 78 56 34 12
```
So if you were doing that while processing an InputStream, read *four* bytes, ... |
28,996,161 | Would not `make_unique` be more useful if it was designed like:
```
template< typename T, typename U=T, typename ...ArgT>
unique_ptr<T> make_unique( ArgT ...args )
{
return unique_ptr<T>( new U(args...) );
// maybe parameters should be forwarded, not really important for this question
}
```
So that you could... | 2015/03/11 | [
"https://Stackoverflow.com/questions/28996161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3202093/"
] | Because there's no point, you can just do the conversion after calling it anyway.
```
std::unique_ptr<T> p = std::make_unique<U>(args);
```
So if there's a function that takes `std::unique_ptr<T>` you can still do
```
func(std::make_unique<U>(args));
```
For your live example, you can just do:
```
the_list.push_... | You will find that std::unique\_ptr can move from derived's to base's, if you look into its definition. Refer to <https://stackoverflow.com/a/57797286/3758879> |
22,555,568 | I am unable to get why appcompat\_v7 is created automatically... finding it very irritating.. please someone help to get rid off this problem.
I tried to create new project and found like this for every newly created project. | 2014/03/21 | [
"https://Stackoverflow.com/questions/22555568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3282461/"
] | When creating new Android Project, remove the check in front of "Create activity". By doing this, Eclipse will not automatically import the library project "appcompat\_v7".
Then you manually have to create main activity. Be careful what imports you use if you have stuff like `Fragment` or `ActionBar`.
[This](https://s... | When you create your application, give API 14:Android 4.0 or an upper version as the minimum SDK version. |
22,555,568 | I am unable to get why appcompat\_v7 is created automatically... finding it very irritating.. please someone help to get rid off this problem.
I tried to create new project and found like this for every newly created project. | 2014/03/21 | [
"https://Stackoverflow.com/questions/22555568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3282461/"
] | When creating new Android Project, remove the check in front of "Create activity". By doing this, Eclipse will not automatically import the library project "appcompat\_v7".
Then you manually have to create main activity. Be careful what imports you use if you have stuff like `Fragment` or `ActionBar`.
[This](https://s... | the reason why Eclipse does this is because there is a lot of fragmentation in different vendors and versions of android and the same reflects in the API's too..!! So in order keep everything going smooth Android suggests adding external libraries to the project and Eclipse abides to the same.
You can get rid of it if... |
22,555,568 | I am unable to get why appcompat\_v7 is created automatically... finding it very irritating.. please someone help to get rid off this problem.
I tried to create new project and found like this for every newly created project. | 2014/03/21 | [
"https://Stackoverflow.com/questions/22555568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3282461/"
] | When you create your application, give API 14:Android 4.0 or an upper version as the minimum SDK version. | the reason why Eclipse does this is because there is a lot of fragmentation in different vendors and versions of android and the same reflects in the API's too..!! So in order keep everything going smooth Android suggests adding external libraries to the project and Eclipse abides to the same.
You can get rid of it if... |
28,447,452 | I have a soap test Project in SoapUI. I have added all the requests as test steps in a test suite.
I need that the WSDL definition gets updated and requests get recreated (while keeping existing values) every-time i start the test.
I need help to do this process automatically with help of a groovy script that can be ... | 2015/02/11 | [
"https://Stackoverflow.com/questions/28447452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4544946/"
] | Got it working now..
Here is the complete code..
```
import static com.eviware.soapui.impl.wsdl.actions.iface.UpdateInterfaceAction.recreateRequests
import static com.eviware.soapui.impl.wsdl.actions.iface.UpdateInterfaceAction.recreateTestRequests
project = testRunner.testCase.testSuite.project; //get the project re... | If you have an updated wsdl file in hand, then you use [*UpdateWSDLDefinition.groovy*](https://github.com/nmrao/soapUIGroovyScripts/blob/master/groovy/UpdateWSDLDefinition.groovy) script to update the *service interface* & *test requests* of test case of the project. .
```groovy
/**
*This script automatically update ... |
28,447,452 | I have a soap test Project in SoapUI. I have added all the requests as test steps in a test suite.
I need that the WSDL definition gets updated and requests get recreated (while keeping existing values) every-time i start the test.
I need help to do this process automatically with help of a groovy script that can be ... | 2015/02/11 | [
"https://Stackoverflow.com/questions/28447452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4544946/"
] | Got it working now..
Here is the complete code..
```
import static com.eviware.soapui.impl.wsdl.actions.iface.UpdateInterfaceAction.recreateRequests
import static com.eviware.soapui.impl.wsdl.actions.iface.UpdateInterfaceAction.recreateTestRequests
project = testRunner.testCase.testSuite.project; //get the project re... | I got way to update definition through goovy script.
The below script will update the wsdl definition.
Now i need a script to recreate all my request based on the updated schema.
```
import com.eviware.soapui.impl.wsdl.WsdlInterface
myInterface=(WsdlInterface) testRunner.testCase.testSuite.project.getInterfaceByName... |
30,216,295 | I have 3 links which are the names of students.On clicking a link first time or odd number time,another div which contains the details of that student appears.On clicking the same link on second time or even number time, I need to hide the student div.Its working perfectly for me using `data()` event of jquery.
My req... | 2015/05/13 | [
"https://Stackoverflow.com/questions/30216295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1770199/"
] | You can use the following code:
```
$("#sections").on('click', '.student_link', function () {
var prevClickedId = $('#sections').data('prevId');
if (prevClickedId != $(this).attr('id')) {
// This was not the previous clicked element
} else {
// This was the previous clicked element
}
... | Why don't just use jquery `toggle()` method? it hides element when it's visible, and shows when it's hidden. |
30,216,295 | I have 3 links which are the names of students.On clicking a link first time or odd number time,another div which contains the details of that student appears.On clicking the same link on second time or even number time, I need to hide the student div.Its working perfectly for me using `data()` event of jquery.
My req... | 2015/05/13 | [
"https://Stackoverflow.com/questions/30216295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1770199/"
] | You can use the following code:
```
$("#sections").on('click', '.student_link', function () {
var prevClickedId = $('#sections').data('prevId');
if (prevClickedId != $(this).attr('id')) {
// This was not the previous clicked element
} else {
// This was the previous clicked element
}
... | You can so something similar to this:
```
$("#sections").on('click', '.student_link', function(){
if( $("#div_students").data('viewing') == $(this).attr('id') ) {
$("#div_students").hide().data('viewing', '');
}
else {
$("#div_students").show().text($(this).attr('id'));
$("#div_stud... |
30,216,295 | I have 3 links which are the names of students.On clicking a link first time or odd number time,another div which contains the details of that student appears.On clicking the same link on second time or even number time, I need to hide the student div.Its working perfectly for me using `data()` event of jquery.
My req... | 2015/05/13 | [
"https://Stackoverflow.com/questions/30216295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1770199/"
] | You can so something similar to this:
```
$("#sections").on('click', '.student_link', function(){
if( $("#div_students").data('viewing') == $(this).attr('id') ) {
$("#div_students").hide().data('viewing', '');
}
else {
$("#div_students").show().text($(this).attr('id'));
$("#div_stud... | Why don't just use jquery `toggle()` method? it hides element when it's visible, and shows when it's hidden. |
1,402,402 | How do I find the percentage of numbers $n$ in the list $1^4, 2^4, ... 1000^4$ such that $n \pmod{16} \equiv 1$? I know that for any $x$, if $x \pmod{16} \equiv 1$, then $x^n \pmod{16} \equiv 1$, so I know for sure that there are at least around $\lfloor \frac{1000}{16} \rfloor = 62$ values of $n$ such that $n \pmod{16... | 2015/08/19 | [
"https://math.stackexchange.com/questions/1402402",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/258480/"
] | For an integer $n$, the possible values of $n \mod{16}$ are $0,1,\cdots,15$. Try seeing what happens to these values when they are raised to the fourth power modulo $16$...
Spoiler:
>
> The map $x \mapsto x^4 \mod{16}$ sends the set $\{0,1,\cdots,15\}$ to the set... $\{0,1\}$. Furthermore, exactly half of the eleme... | We have
$$
\begin{align}
(2n)^4
&=16n^4\\
&\equiv0&\pmod{16}
\end{align}
$$
and
$$
\begin{align}
(2n+1)^4
&=16n^4+32n^3+24n^2+8n+1\\
&\equiv16\frac{n(n+1)}2+1&\pmod{16}\\
&\equiv1&\pmod{16}
\end{align}
$$
Therefore, $8$ out of $16$ equivalence classes mod $16$ satisfy $n^4\equiv1\pmod{16}$. So, I'd say $50\%$ of the eq... |
411,184 | When I pull up `http://localhost` in a web browser on my computer (Windows 7, IIS 7.5) I get the IIS 7 welcome image. I have a different website that is set up in IIS that I'd prefer to be the default web site. Can I change that setting somewhere in IIS?
UPDATE: Apparently I have my terminology wrong. What I have is o... | 2012/07/25 | [
"https://serverfault.com/questions/411184",
"https://serverfault.com",
"https://serverfault.com/users/66848/"
] | If you just want a single web site and need to change the folder path for that site then edit the basic settings on the site, changing the physical path to the folder of the other site.
If you mean you've already added a completely new web site in IIS then you need to edit the bindings in your sites.
For web, you'll ... | I found to resolve the issue of looping redirect bug the fix for the root site web.config is:
```
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="true" destination="/ApplicationToRedirectTo/" exactDestination="false" childOnly="true" httpResponseStatus="Perm... |
411,184 | When I pull up `http://localhost` in a web browser on my computer (Windows 7, IIS 7.5) I get the IIS 7 welcome image. I have a different website that is set up in IIS that I'd prefer to be the default web site. Can I change that setting somewhere in IIS?
UPDATE: Apparently I have my terminology wrong. What I have is o... | 2012/07/25 | [
"https://serverfault.com/questions/411184",
"https://serverfault.com",
"https://serverfault.com/users/66848/"
] | Turns out you can edit the physical path of the Default Web Site (right click, Manage Web Site, Advanced Settings). Change that to the physical path of the app you want to be default, make sure other settings match (in my case the App Pool had to be changed), and there you go. | I found to resolve the issue of looping redirect bug the fix for the root site web.config is:
```
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="true" destination="/ApplicationToRedirectTo/" exactDestination="false" childOnly="true" httpResponseStatus="Perm... |
44,236,308 | There is a stored procedure `sp_select_from_persons` in MySql. And there are 3 parameters inside this procedure. `age, class, group`. These parameter values can be -1 or another value. And these parameters will be used in `where` clause.
Now I want to write where clause like that, if any value of these parameter is ... | 2017/05/29 | [
"https://Stackoverflow.com/questions/44236308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/591826/"
] | This is a single line query.... Try This
```
SELECT * FROM persons p
WHERE p.age = case when age = -1 then p.age else age end
and p.class = case when class = -1 then p.class else class end
and p.group = case when group = -1 then p.group else group end
``` | You can use the logical `or` operator to crate this behavior in a single statement:
```
SELECT *
FROM persons p
WHERE (age < 0 OR p.age = age) AND
(class < 0 OR p.class = class) AND
(group < 0 OR p.group = group);
``` |
44,236,308 | There is a stored procedure `sp_select_from_persons` in MySql. And there are 3 parameters inside this procedure. `age, class, group`. These parameter values can be -1 or another value. And these parameters will be used in `where` clause.
Now I want to write where clause like that, if any value of these parameter is ... | 2017/05/29 | [
"https://Stackoverflow.com/questions/44236308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/591826/"
] | Something like this also worked for me:
```
create procedure sp_my_proc(in p1 varchar(10), in p2 int)
begin
SELECT col1, col2 from my_table
where if(p1 is null or length(trim(p1)) = 0, true, col1 = p1)
and if(p2 = 0, true, col2 = p2);
end
```
My requirement is that the stored proc... | You can use the logical `or` operator to crate this behavior in a single statement:
```
SELECT *
FROM persons p
WHERE (age < 0 OR p.age = age) AND
(class < 0 OR p.class = class) AND
(group < 0 OR p.group = group);
``` |
44,236,308 | There is a stored procedure `sp_select_from_persons` in MySql. And there are 3 parameters inside this procedure. `age, class, group`. These parameter values can be -1 or another value. And these parameters will be used in `where` clause.
Now I want to write where clause like that, if any value of these parameter is ... | 2017/05/29 | [
"https://Stackoverflow.com/questions/44236308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/591826/"
] | This is a single line query.... Try This
```
SELECT * FROM persons p
WHERE p.age = case when age = -1 then p.age else age end
and p.class = case when class = -1 then p.class else class end
and p.group = case when group = -1 then p.group else group end
``` | Something like this also worked for me:
```
create procedure sp_my_proc(in p1 varchar(10), in p2 int)
begin
SELECT col1, col2 from my_table
where if(p1 is null or length(trim(p1)) = 0, true, col1 = p1)
and if(p2 = 0, true, col2 = p2);
end
```
My requirement is that the stored proc... |
43,044,680 | I am trying to insert data to a table from another where data is not already exists
The table I am inserting the data into
```
CREATE TABLE #T(Name VARCHAR(10),Unit INT, Id INT)
INSERT INTO #T
VALUES('AAA',10,100),('AAB',11,102),('AAC',12,130)
```
The table I am selecting the data from
```
CREATE TABLE #T1(Nam... | 2017/03/27 | [
"https://Stackoverflow.com/questions/43044680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6519593/"
] | You have to somehow correlate the two tables:
```
SELECT *
FROM #T1
WHERE NOT EXISTS(SELECT *
FROM #T
WHERE #T1.Name = #T.Name AND #T1.ID = #T.ID)
```
The above query essentially says: get me those records of table `#T1` which do not have a related record in `#T` having the *same*... | Your best bet is probably to use a insert statement with a subquery. Something like this:
[SQL Insert Into w/Subquery - Checking If Not Exists](https://stackoverflow.com/questions/23786101/sql-insert-into-w-subquery-checking-if-not-exists)
Edit: If you're still stuck, try this--
```
INSERT INTO #T (Name, Unit, Id)
S... |
27,467,282 | I have a simple html code with this form:
```
<form id="check-user" class="ui-body ui-body-a ui-corner-all" data-ajax="false" method="post" action="./second.php">
<fieldset>
<div data-role="fieldcontain">
<label for="username">Enter your username:</label>
... | 2014/12/14 | [
"https://Stackoverflow.com/questions/27467282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2201394/"
] | I think you may find that forms are not recommended to be embedded in to emails. Most web-based email platforms do not support form functionality. You're best to provide an external link to your form. | Thanks for your response, I've ended using an external link using mailto.
I've also have to say that the reason I was getting a GET response is because the apps in a mobile phone are know as hybrid, they are not fully html, so they have security policies when one calls to another app (which is this case).
In my php i ... |
9,098,747 | I have a project up on github, which an organization on github has forked. Can i push my code downstream to the organization's fork? I tried doing it, but was not able to.
**I would like to know if i can send a pull request downstream?** | 2012/02/01 | [
"https://Stackoverflow.com/questions/9098747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/818314/"
] | GitHub does allow this, and it's actually pretty easy to do, although I didn't find it very clearly-documented.
The short of it, is that when you navigate on Pull Requests > New Pull Request from the GitHub UI, you get taken to the "Compare" page. In the drop down to the left you can select your own branches, OR you c... | You can fork their fork of your repository and add that in as another remote on your repo. Then you can send a pull request to them.h You may need to add another user and add a different .ssh/config entry to provide a different public key. Sounds cool! :) |
7,965,611 | It seems to me django only supports plain text messages for password reset emails out of the box. How can I use html templates for this purpose? | 2011/11/01 | [
"https://Stackoverflow.com/questions/7965611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135829/"
] | Here is the simple approach worked for me. Add our custom template path in such a way worked for me.
`path('users/password/reset/', password_reset, {'html_email_template_name': 'registration/password_reset_email.html'},name='password_reset'),` | Based on Cem Kozinoglu solution I would suggest to change the form and overload send\_mail instead of save method in the following way:
```
class CustomPasswordResetForm(PasswordResetForm):
def send_mail(self, subject_template_name, email_template_name,
context, from_email, to_email, html_email_... |
7,965,611 | It seems to me django only supports plain text messages for password reset emails out of the box. How can I use html templates for this purpose? | 2011/11/01 | [
"https://Stackoverflow.com/questions/7965611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135829/"
] | HTML Password Reset Email with Images in Django 3.0+
====================================================
Overview
--------
1. Create three templates:
* `password_reset_email.html`
* `password_reset_email.txt`
* `password_reset_subject.txt`
2. Override `django.contrib.auth.forms.PasswordResetForm` by creating a su... | After overwriting the **PasswordResetForm** and adding this line of code after email\_message initialization I solve my problem:
```
email_message.attach_alternative(body, 'text/html')
``` |
7,965,611 | It seems to me django only supports plain text messages for password reset emails out of the box. How can I use html templates for this purpose? | 2011/11/01 | [
"https://Stackoverflow.com/questions/7965611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135829/"
] | You can override `save` method of `django.contrib.auth.forms.PasswordResetForm` and pass new form as an argument to `password_reset` view. | After some amount of trial and error, I discovered a much, much more terse way to supply a custom templated password reset email in the latest version of Django (1.8).
In your `project/urls.py`, add these imports:
```
from django.contrib.auth import views as auth_views
from django.core.urlresolvers import reverse_la... |
7,965,611 | It seems to me django only supports plain text messages for password reset emails out of the box. How can I use html templates for this purpose? | 2011/11/01 | [
"https://Stackoverflow.com/questions/7965611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135829/"
] | You can override `save` method of `django.contrib.auth.forms.PasswordResetForm` and pass new form as an argument to `password_reset` view. | You can use PasswordResetSerializer
<http://django-rest-auth.readthedocs.io/en/latest/configuration.html>
Then you can override all the form options:
domain\_override
subject\_template\_name
email\_template\_name
use\_https
token\_generator
from\_email
request
html\_email\_template\_name
extra\_email\_context
in my ... |
7,965,611 | It seems to me django only supports plain text messages for password reset emails out of the box. How can I use html templates for this purpose? | 2011/11/01 | [
"https://Stackoverflow.com/questions/7965611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135829/"
] | You can override `save` method of `django.contrib.auth.forms.PasswordResetForm` and pass new form as an argument to `password_reset` view. | Here is the simple approach worked for me. Add our custom template path in such a way worked for me.
`path('users/password/reset/', password_reset, {'html_email_template_name': 'registration/password_reset_email.html'},name='password_reset'),` |
7,965,611 | It seems to me django only supports plain text messages for password reset emails out of the box. How can I use html templates for this purpose? | 2011/11/01 | [
"https://Stackoverflow.com/questions/7965611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135829/"
] | You can use PasswordResetSerializer
<http://django-rest-auth.readthedocs.io/en/latest/configuration.html>
Then you can override all the form options:
domain\_override
subject\_template\_name
email\_template\_name
use\_https
token\_generator
from\_email
request
html\_email\_template\_name
extra\_email\_context
in my ... | After overwriting the **PasswordResetForm** and adding this line of code after email\_message initialization I solve my problem:
```
email_message.attach_alternative(body, 'text/html')
``` |
7,965,611 | It seems to me django only supports plain text messages for password reset emails out of the box. How can I use html templates for this purpose? | 2011/11/01 | [
"https://Stackoverflow.com/questions/7965611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135829/"
] | HTML Password Reset Email with Images in Django 3.0+
====================================================
Overview
--------
1. Create three templates:
* `password_reset_email.html`
* `password_reset_email.txt`
* `password_reset_subject.txt`
2. Override `django.contrib.auth.forms.PasswordResetForm` by creating a su... | Here is the simple approach worked for me. Add our custom template path in such a way worked for me.
`path('users/password/reset/', password_reset, {'html_email_template_name': 'registration/password_reset_email.html'},name='password_reset'),` |
7,965,611 | It seems to me django only supports plain text messages for password reset emails out of the box. How can I use html templates for this purpose? | 2011/11/01 | [
"https://Stackoverflow.com/questions/7965611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135829/"
] | Here is how you can do the override:
====================================
urls.py
```
url(r'^user/password/reset/$',
'YOUR_APP.views.password_reset',
{'post_reset_redirect' : '/#/login?resetemail=true'},
name="password_reset"),
```
views.py
```
from django.contrib.auth.views import password_reset as ... | For me the research was time consuming but the solution rather trivial. **No overrides no fiddling with forms or anything like that**
am using Django==1.8.6 but should work from at least django 1.7 onward. To enable support for html formatted emails in password\_reset all I had to do is change the email template key na... |
7,965,611 | It seems to me django only supports plain text messages for password reset emails out of the box. How can I use html templates for this purpose? | 2011/11/01 | [
"https://Stackoverflow.com/questions/7965611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135829/"
] | Here is how you can do the override:
====================================
urls.py
```
url(r'^user/password/reset/$',
'YOUR_APP.views.password_reset',
{'post_reset_redirect' : '/#/login?resetemail=true'},
name="password_reset"),
```
views.py
```
from django.contrib.auth.views import password_reset as ... | Based on Cem Kozinoglu solution I would suggest to change the form and overload send\_mail instead of save method in the following way:
```
class CustomPasswordResetForm(PasswordResetForm):
def send_mail(self, subject_template_name, email_template_name,
context, from_email, to_email, html_email_... |
7,965,611 | It seems to me django only supports plain text messages for password reset emails out of the box. How can I use html templates for this purpose? | 2011/11/01 | [
"https://Stackoverflow.com/questions/7965611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135829/"
] | Here is how you can do the override:
====================================
urls.py
```
url(r'^user/password/reset/$',
'YOUR_APP.views.password_reset',
{'post_reset_redirect' : '/#/login?resetemail=true'},
name="password_reset"),
```
views.py
```
from django.contrib.auth.views import password_reset as ... | You can use PasswordResetSerializer
<http://django-rest-auth.readthedocs.io/en/latest/configuration.html>
Then you can override all the form options:
domain\_override
subject\_template\_name
email\_template\_name
use\_https
token\_generator
from\_email
request
html\_email\_template\_name
extra\_email\_context
in my ... |
962,245 | Let $U$ be an open sub-set of $\mathbb{R}^2$, and let $f$ be a continuous function $f:U\rightarrow \mathbb{R}^2$.
I'd like to show that $f$ is an open map, given that for each $u\in U$ exists an open set $V\_u$ in $U$ ($V\_u\subseteq U$) such that $f\uparrow\_{V\_u}$ is one-to-one.
I'm not quite sure on where to sta... | 2014/10/07 | [
"https://math.stackexchange.com/questions/962245",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/180648/"
] | Let $ V $ be an open subset of $U$. Write $ V $ as a union of open sets $\{V\_i\}\_{i\in I}$ on which $f$ is 1:1. Apply the [Invariance of Domain](https://en.wikipedia.org/wiki/Invariance_of_domain) theorem to each open set $V\_i$. Then recall that the union of open sets is open.
Also note that a map like $f$ isn't a... | I don't know yet how to prove your thing, but regarding your final question the answer is no. Indeed, you should have to suppose that $f$ is globally one-to-one.
You could consider this example : consider $U = \mathbb{R}^2 \setminus \{0\}$, and $f : (\rho, \theta) \mapsto (\rho, 2\theta)$ in polar coordinates.
Then cl... |
962,245 | Let $U$ be an open sub-set of $\mathbb{R}^2$, and let $f$ be a continuous function $f:U\rightarrow \mathbb{R}^2$.
I'd like to show that $f$ is an open map, given that for each $u\in U$ exists an open set $V\_u$ in $U$ ($V\_u\subseteq U$) such that $f\uparrow\_{V\_u}$ is one-to-one.
I'm not quite sure on where to sta... | 2014/10/07 | [
"https://math.stackexchange.com/questions/962245",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/180648/"
] | I don't know yet how to prove your thing, but regarding your final question the answer is no. Indeed, you should have to suppose that $f$ is globally one-to-one.
You could consider this example : consider $U = \mathbb{R}^2 \setminus \{0\}$, and $f : (\rho, \theta) \mapsto (\rho, 2\theta)$ in polar coordinates.
Then cl... | There is something wrong here!
$f$ open means that: the image by $f$ of any open in $U$ is open.
@Eric: You assume that $f$ is a local bijection: any $x\in U$ admits an open neighborhood $V\_x\subset U$ such that $f(V\_x)$ is one-to-one. (a constant map is continuous but not a local bijection).
From this **assumptio... |
962,245 | Let $U$ be an open sub-set of $\mathbb{R}^2$, and let $f$ be a continuous function $f:U\rightarrow \mathbb{R}^2$.
I'd like to show that $f$ is an open map, given that for each $u\in U$ exists an open set $V\_u$ in $U$ ($V\_u\subseteq U$) such that $f\uparrow\_{V\_u}$ is one-to-one.
I'm not quite sure on where to sta... | 2014/10/07 | [
"https://math.stackexchange.com/questions/962245",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/180648/"
] | Let $ V $ be an open subset of $U$. Write $ V $ as a union of open sets $\{V\_i\}\_{i\in I}$ on which $f$ is 1:1. Apply the [Invariance of Domain](https://en.wikipedia.org/wiki/Invariance_of_domain) theorem to each open set $V\_i$. Then recall that the union of open sets is open.
Also note that a map like $f$ isn't a... | There is something wrong here!
$f$ open means that: the image by $f$ of any open in $U$ is open.
@Eric: You assume that $f$ is a local bijection: any $x\in U$ admits an open neighborhood $V\_x\subset U$ such that $f(V\_x)$ is one-to-one. (a constant map is continuous but not a local bijection).
From this **assumptio... |
48,851,828 | I am having an application where in, I set some session variables and later when I try to retrieve them, they don't exist. The solution I found on similar cases was to make the session save folder writable. In my case, the folder is actually writable, I have checked it with the following code:
```
if (!is_writable(ses... | 2018/02/18 | [
"https://Stackoverflow.com/questions/48851828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7893912/"
] | The problem is in your configuration. Specifically this line
```
$config['sess_save_path'] = NULL;
```
Because you are using the 'files' `sess_driver` a value must be provided for `sess_save_path`.
From the [CI documentation](https://www.codeigniter.com/user_guide/libraries/sessions.html#files-driver), the session... | Try to set the session as follows.
```
$session_data = array('user_id' => $user_id);
$this->session->set_userdata('logged_in', $session_data);
```
Hope this helps you. |
48,851,828 | I am having an application where in, I set some session variables and later when I try to retrieve them, they don't exist. The solution I found on similar cases was to make the session save folder writable. In my case, the folder is actually writable, I have checked it with the following code:
```
if (!is_writable(ses... | 2018/02/18 | [
"https://Stackoverflow.com/questions/48851828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7893912/"
] | The problem is in your configuration. Specifically this line
```
$config['sess_save_path'] = NULL;
```
Because you are using the 'files' `sess_driver` a value must be provided for `sess_save_path`.
From the [CI documentation](https://www.codeigniter.com/user_guide/libraries/sessions.html#files-driver), the session... | Try setting base\_url in application/config.php, to '<http://localhost/ciappfolder>' |
43,538,513 | I am trying to parse an XML text. It is stored in a table t\_testxml, in column xml\_data which is CLOB type.
The xml looks like:
```
<?xml version="1.0" encoding="UTF-8"?>
<defaultmpftest:defaultmpftest xmlns:defaultmpftest="http://test.com"
test_id = "1231"
test_name = "name_test">
</mpftestdata:additionalLinkUrl... | 2017/04/21 | [
"https://Stackoverflow.com/questions/43538513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3616808/"
] | The XML shown in the question is invalid, and would cause an "LPX-00231: invalid character" error if you passed it in to XMLType. So that isn't the string you're actually using. I'm assuming is a typo when posting the question, and you are actually getting the "LPX-00601: Invalid token" error you claimed. So I'll base ... | The XML is not well-formed, try
`<mpftestdata:additionalLinkUrl xmlns:mpftestdata="http://test2.com" />`
or
`<mpftestdata:additionalLinkUrl xmlns:mpftestdata="http://test2.com"></mpftestdata>` |
43,538,513 | I am trying to parse an XML text. It is stored in a table t\_testxml, in column xml\_data which is CLOB type.
The xml looks like:
```
<?xml version="1.0" encoding="UTF-8"?>
<defaultmpftest:defaultmpftest xmlns:defaultmpftest="http://test.com"
test_id = "1231"
test_name = "name_test">
</mpftestdata:additionalLinkUrl... | 2017/04/21 | [
"https://Stackoverflow.com/questions/43538513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3616808/"
] | The XML shown in the question is invalid, and would cause an "LPX-00231: invalid character" error if you passed it in to XMLType. So that isn't the string you're actually using. I'm assuming is a typo when posting the question, and you are actually getting the "LPX-00601: Invalid token" error you claimed. So I'll base ... | As Wernfried Domscheit correctly stated: Your XML is not well-formed. And for non-well-formed XMLs there's no way to extract information thereof in regular ways. Simply because regular ways are for XML; and your "XML" is not really an XML.
Let's try non-regular ways then...
```
with t_testxml as (
select q'{<?xml... |
1,364,039 | ```
Mobo: Gigabyte 7TESM
OS: Win 10 Pro
CPU: Dual Xeon X5650s
```
I’ve been dealing with this problem across two different motherboards. I understand it is an astronomically small possibility this happened back to back and am open to hear ideas.
At POST, I need to press F2 to enter BIOS. The system does not respond... | 2018/10/05 | [
"https://superuser.com/questions/1364039",
"https://superuser.com",
"https://superuser.com/users/950879/"
] | ```
iptables --list|grep "spt:\|dpt:\|dports\|sports"
```
spt: and dpt cover individual port rules
sports and dports cover multiport command
Now all rules that mention ports should be listed.
```
iptables --list|grep "spt:\|dpt:\|dports\|sports"|grep http
```
Once you do this you realize that iptables uses the... | One thing to remember, you are looking at 80 because you want web traffic. I don't know exactly what you are doing, but just in-case this helps, remember 80 is primary http, but 8080 is also configured in some web servers as a secondary, as well as 443 is secure web protocol (HTTPS via SSL).
This isn't supposed to be ... |
6,363,728 | This problem is very simple, but I just can't figure it out
added to my urlpatterns
```
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/home/user/www/site/static'})
```
where my main.css is : /home/user/www/site/static/css/main.css
when I access <http://localhost:8000/static/>
I get... | 2011/06/15 | [
"https://Stackoverflow.com/questions/6363728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/749477/"
] | If you are using the built-in development webserver (i.e. run it with `manage.py runserver`), Django will take care of static files while in development.
Please note that `STATIC_ROOT` is the path where Django collects static files in, rather than the path that it serves files from. You should not maintain `STATIC_ROO... | You should set up STATIC\_URL in settings.py
In your case it have to be
```
STATIC_URL = '/static/'
``` |
6,363,728 | This problem is very simple, but I just can't figure it out
added to my urlpatterns
```
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/home/user/www/site/static'})
```
where my main.css is : /home/user/www/site/static/css/main.css
when I access <http://localhost:8000/static/>
I get... | 2011/06/15 | [
"https://Stackoverflow.com/questions/6363728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/749477/"
] | mainly two step:
1. check STATIC\_ROOT path:
Does the file exist? /home/user/www/site/static/css/main.css
if not, you shoud run "python manage.py collectstatic" to copy static file to STATIC\_ROOT path
if "collectstatic" can't copy css files to STATIC\_ROOT path, then shoud check source css path in "STATICFILES\_DI... | You should set up STATIC\_URL in settings.py
In your case it have to be
```
STATIC_URL = '/static/'
``` |
6,363,728 | This problem is very simple, but I just can't figure it out
added to my urlpatterns
```
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/home/user/www/site/static'})
```
where my main.css is : /home/user/www/site/static/css/main.css
when I access <http://localhost:8000/static/>
I get... | 2011/06/15 | [
"https://Stackoverflow.com/questions/6363728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/749477/"
] | If you are using the built-in development webserver (i.e. run it with `manage.py runserver`), Django will take care of static files while in development.
Please note that `STATIC_ROOT` is the path where Django collects static files in, rather than the path that it serves files from. You should not maintain `STATIC_ROO... | mainly two step:
1. check STATIC\_ROOT path:
Does the file exist? /home/user/www/site/static/css/main.css
if not, you shoud run "python manage.py collectstatic" to copy static file to STATIC\_ROOT path
if "collectstatic" can't copy css files to STATIC\_ROOT path, then shoud check source css path in "STATICFILES\_DI... |
3,940,204 | How can I find all available path for each Vertices which won't cause a cycle? What algorithm to use? Please be brief and provide links if possible, and ask questions if something is not clear from the wonderful diagram below :)

I am not looking for a shortest path or anyt... | 2010/10/15 | [
"https://Stackoverflow.com/questions/3940204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247184/"
] | Look the Ford Algorithm
<http://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm>
Enjoy', | Following is not the answer but just a way to think for this problem.
You can think for the problem from the opposite side. Find all the paths that have exactly one edge missing to form a cycle(I havn't think of it, how). Then those missing edges are not the edges you are looking. Accept everything other than that. |
3,940,204 | How can I find all available path for each Vertices which won't cause a cycle? What algorithm to use? Please be brief and provide links if possible, and ask questions if something is not clear from the wonderful diagram below :)

I am not looking for a shortest path or anyt... | 2010/10/15 | [
"https://Stackoverflow.com/questions/3940204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247184/"
] | A shortest-path algorithm like Bellman-Ford or Dijkstra has the side effect of telling you which nodes you can reach from a given node "A" -- which is exactly the list of nodes from which edges **to** "A" would form a loop.
I suspect there is a way to modify Bellman-Ford to generate all these lists in one go, instead ... | Following is not the answer but just a way to think for this problem.
You can think for the problem from the opposite side. Find all the paths that have exactly one edge missing to form a cycle(I havn't think of it, how). Then those missing edges are not the edges you are looking. Accept everything other than that. |
11,031,866 | I am using Thunderbird 12.0.1. at my Win7. Is there any addon for Thunderbird as like gmail notifier that will alert me with a pop-up at bottom-right screen. If I close Thunderbird I want it to work at system tray and warn me at new messages with a summary? | 2012/06/14 | [
"https://Stackoverflow.com/questions/11031866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/453596/"
] | [This](http://kb.mozillazine.org/Minimize_to_system_tray_%28Thunderbird%29) is what I use, works fine... (Mimize to system tray add-on).
Edit: This should really be in SU, as it has nothing at all to do with programming. | As far as I know Thunderbird has already built-in new message notification feature.
A new message alert appears on my Win7 with the subject and mail body.
If you mean 'When I close Thunderbird' by completely exiting the application, I don't think it is possible to keep receiving notifications when the app is not runni... |
42,206,959 | I have a problem. I tried every kind of solution that I found on Stackoverflow.
I have this Java part of code:
```
Map<String, ArchitetturaUnitaModel> map = new HashMap<String, ArchitetturaUnitaModel>();
if(!CollectionUtils.isEmpty(searchPageData.getResults())){
for(ProductData result:searchPageDat... | 2017/02/13 | [
"https://Stackoverflow.com/questions/42206959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1353274/"
] | There is really no need to assign variable of map to the same name variable
I believe you can access map values just using ${map[key]}.
Are you sure Architectural.... have getter with name getNome() and getLine...()?
What are errors? If there are none, maybe variable is just empty
Sorry for ..., names are just too... | I solved this problem in this way:
```
<c:set value="${mappa}" var="mappa"/>
<c:set value="${product.code}" var="pcode"/>
<b><spring:theme code="text.titolounita" />: </b><c:out value="${mappa[pcode].name}"/> <br>
<b><spring:theme code="text.documento" />: </b>${product.name} <br>
<b><spring:theme code="text.lineafer... |
1,369,027 | What Linux commands would you use successively, for a bunch of files, to count the number of lines in a file and output to an output file with part of the corresponding input file as part of the output line. So for example we were looking at file `LOG_Yellow` and it had 28 lines, the the output file would have a line l... | 2009/09/02 | [
"https://Stackoverflow.com/questions/1369027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150842/"
] | ```
wc -l [filenames] | grep -v " total$" | sed s/[prefix]//
```
The wc -l generates the output in almost the right format; grep -v removes the "total" line that wc generates for you; sed strips the junk you don't want from the filenames. | ```
wc -l * | head --lines=-1 > output.txt
```
produces output like this:
```
linecount1 filename1
linecount2 filename2
```
I think you should be able to work from here to extend to your needs.
**edit**: since I haven't seen the rules for you name extraction, I still leave the full name. However, unlike other ans... |
1,369,027 | What Linux commands would you use successively, for a bunch of files, to count the number of lines in a file and output to an output file with part of the corresponding input file as part of the output line. So for example we were looking at file `LOG_Yellow` and it had 28 lines, the the output file would have a line l... | 2009/09/02 | [
"https://Stackoverflow.com/questions/1369027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150842/"
] | ```
wc -l * | head --lines=-1 > output.txt
```
produces output like this:
```
linecount1 filename1
linecount2 filename2
```
I think you should be able to work from here to extend to your needs.
**edit**: since I haven't seen the rules for you name extraction, I still leave the full name. However, unlike other ans... | Short of writing the script for you:
* 'for' for looping through your files.
* 'echo -n' for printing the current file
* 'wc -l' for finding out the line count
* And dont forget to redirect
('>' or '>>') your results to your
output file |
1,369,027 | What Linux commands would you use successively, for a bunch of files, to count the number of lines in a file and output to an output file with part of the corresponding input file as part of the output line. So for example we were looking at file `LOG_Yellow` and it had 28 lines, the the output file would have a line l... | 2009/09/02 | [
"https://Stackoverflow.com/questions/1369027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150842/"
] | ```
wc -l [filenames] | grep -v " total$" | sed s/[prefix]//
```
The wc -l generates the output in almost the right format; grep -v removes the "total" line that wc generates for you; sed strips the junk you don't want from the filenames. | `wc -l *| grep -v " total"`
send
*28 Yellow*
You can reverse it if you want (awk, if you don't have space in file names)
`wc -l *| egrep -v " total$" | sed s/[prefix]//
| awk '{print $2 " " $1}'` |
1,369,027 | What Linux commands would you use successively, for a bunch of files, to count the number of lines in a file and output to an output file with part of the corresponding input file as part of the output line. So for example we were looking at file `LOG_Yellow` and it had 28 lines, the the output file would have a line l... | 2009/09/02 | [
"https://Stackoverflow.com/questions/1369027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150842/"
] | `wc -l *| grep -v " total"`
send
*28 Yellow*
You can reverse it if you want (awk, if you don't have space in file names)
`wc -l *| egrep -v " total$" | sed s/[prefix]//
| awk '{print $2 " " $1}'` | Short of writing the script for you:
* 'for' for looping through your files.
* 'echo -n' for printing the current file
* 'wc -l' for finding out the line count
* And dont forget to redirect
('>' or '>>') your results to your
output file |
1,369,027 | What Linux commands would you use successively, for a bunch of files, to count the number of lines in a file and output to an output file with part of the corresponding input file as part of the output line. So for example we were looking at file `LOG_Yellow` and it had 28 lines, the the output file would have a line l... | 2009/09/02 | [
"https://Stackoverflow.com/questions/1369027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150842/"
] | ```
wc -l [filenames] | grep -v " total$" | sed s/[prefix]//
```
The wc -l generates the output in almost the right format; grep -v removes the "total" line that wc generates for you; sed strips the junk you don't want from the filenames. | Short of writing the script for you:
* 'for' for looping through your files.
* 'echo -n' for printing the current file
* 'wc -l' for finding out the line count
* And dont forget to redirect
('>' or '>>') your results to your
output file |
8,736,065 | I am trying to save unix timestamp to core data using the following code:
>
>
> ```
> NSManagedObject *managedPostObject = [NSEntityDescription insertNewObjectForEntityForName:@"CDPost" inManagedObjectContext:moc];
> [managedPostObject setValue:[structureDictionary objectForKey:@"timestamp"] forKey:@"timestamp"];
> ... | 2012/01/05 | [
"https://Stackoverflow.com/questions/8736065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127036/"
] | You don't provide `operator<` for `MyClass`. It is required by `std::map`. You have two options: provide a comparator as the third template argument to `map` OR implement the operator in `MyClass`. | This has nothing to do with "dynamic binding" (which is not what is meant here anyway). Your class needs to have an order to be put into a map. It needs operator<. |
8,736,065 | I am trying to save unix timestamp to core data using the following code:
>
>
> ```
> NSManagedObject *managedPostObject = [NSEntityDescription insertNewObjectForEntityForName:@"CDPost" inManagedObjectContext:moc];
> [managedPostObject setValue:[structureDictionary objectForKey:@"timestamp"] forKey:@"timestamp"];
> ... | 2012/01/05 | [
"https://Stackoverflow.com/questions/8736065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127036/"
] | That compile error means you have no `operator <` defined for `Instance`. `map` needs to be able to sort keys and needs this function. If you'd rather not define `operator <`, you need to provide a comparison function as a third template parameter for `map`, i.e. `std::map<Instance, float, compare_instances>`.
... Com... | You don't provide `operator<` for `MyClass`. It is required by `std::map`. You have two options: provide a comparator as the third template argument to `map` OR implement the operator in `MyClass`. |
8,736,065 | I am trying to save unix timestamp to core data using the following code:
>
>
> ```
> NSManagedObject *managedPostObject = [NSEntityDescription insertNewObjectForEntityForName:@"CDPost" inManagedObjectContext:moc];
> [managedPostObject setValue:[structureDictionary objectForKey:@"timestamp"] forKey:@"timestamp"];
> ... | 2012/01/05 | [
"https://Stackoverflow.com/questions/8736065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127036/"
] | That compile error means you have no `operator <` defined for `Instance`. `map` needs to be able to sort keys and needs this function. If you'd rather not define `operator <`, you need to provide a comparison function as a third template parameter for `map`, i.e. `std::map<Instance, float, compare_instances>`.
... Com... | This has nothing to do with "dynamic binding" (which is not what is meant here anyway). Your class needs to have an order to be put into a map. It needs operator<. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.