qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
308,621 | Just for learning purposes, I'm trying to create a function using PLPGSQL and make an SQL injection on it. I recently learned about `format`, `USING` and `quote_literal` and `quote_indent`, so I'm good about avoiding an SQL injection. What I'm trying to do is create a function that allows an SQL injection (i.e. a `drop... | 2022/03/11 | [
"https://dba.stackexchange.com/questions/308621",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/185621/"
] | You need the `REPLACE` option that is provided in the `WITH` section of the `RESTORE DATABASE...` command.
>
> **REPLACE**
>
> Supported by: RESTORE
>
> Specifies that SQL Server should create the specified database and its related files **even if another database already exists with the same name**. In such a ... | Use T-SQL directly instead of the GUI to do the restore. You can script the RESTORE command from the GUI. If you add that RESTORE command to your post, we have something to go on.
Anyhow, the error message suggests that the database name you try to restore into already exists, and a type of safety check by MSSQL steps... |
308,621 | Just for learning purposes, I'm trying to create a function using PLPGSQL and make an SQL injection on it. I recently learned about `format`, `USING` and `quote_literal` and `quote_indent`, so I'm good about avoiding an SQL injection. What I'm trying to do is create a function that allows an SQL injection (i.e. a `drop... | 2022/03/11 | [
"https://dba.stackexchange.com/questions/308621",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/185621/"
] | You need the `REPLACE` option that is provided in the `WITH` section of the `RESTORE DATABASE...` command.
>
> **REPLACE**
>
> Supported by: RESTORE
>
> Specifies that SQL Server should create the specified database and its related files **even if another database already exists with the same name**. In such a ... | A colleague has provided me with a solution: simply create another SQL-server server. I don't know the exact tool he used for doing that, but the result in the Microsoft SQL-server Management Studio looks as follows:
[](https://i.stack.imgur.com/2dDG6... |
308,621 | Just for learning purposes, I'm trying to create a function using PLPGSQL and make an SQL injection on it. I recently learned about `format`, `USING` and `quote_literal` and `quote_indent`, so I'm good about avoiding an SQL injection. What I'm trying to do is create a function that allows an SQL injection (i.e. a `drop... | 2022/03/11 | [
"https://dba.stackexchange.com/questions/308621",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/185621/"
] | Use T-SQL directly instead of the GUI to do the restore. You can script the RESTORE command from the GUI. If you add that RESTORE command to your post, we have something to go on.
Anyhow, the error message suggests that the database name you try to restore into already exists, and a type of safety check by MSSQL steps... | A colleague has provided me with a solution: simply create another SQL-server server. I don't know the exact tool he used for doing that, but the result in the Microsoft SQL-server Management Studio looks as follows:
[](https://i.stack.imgur.com/2dDG6... |
582,901 | Is it possible to code a new command, which use the path of 2 figures with `\includegraphics`, and positions them next to each other and generates a box around them? One figure should be titled as "False" and the other one as "Correct". I'm using these to improve my script at university and would like to automate this ... | 2021/02/11 | [
"https://tex.stackexchange.com/questions/582901",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/226900/"
] | There are many ways of doing it, and many ways to interpret your specification. The following solution should at least help to say more precisely what you want to have differently.
[](https://i.stack.imgur.com/Q0J0V.png)
```
\documentclass{article}
\... | I'd like to use `minipage` environment to handle this.
```latex
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\newcommand{\TFfigures}[2]{
\fbox{
\begin{minipage}{.45\textwidth}
\includegraphics[width=\textwidth]{#1}
\captionof{figure}{False}
\end{minipage}
\begi... |
3,508,067 | I am trying to learn mysql and having some problem with updating/adding data to the table
this is my code and after running this page when I go to phpmyadmin to see if the new data showed up, i dont see it there.
```
<?php
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(!$conn) { die("Could not connect"); ... | 2010/08/18 | [
"https://Stackoverflow.com/questions/3508067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/325499/"
] | Be sure to do error checking to see if the mysql connection is having trouble too:
```
if(!mysql_select_db($dbname, $conn)) {
echo mysql_error($conn);
}else {
if(!mysql_query("INSERT INTO 'test'.'table1' ('A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8') VALUES ('test1', 'test2', 'test3', 'test4', 'test5', 'te... | First of all, make sure that database was selected fine:
```
mysql_select_db($dbname, $conn) or die('Could not select the database');
```
There are chances that there is some error in your query, a reason why data is not added, try adding `or die(mysql_error())` after this `mysql_query` function to see the possible ... |
3,508,067 | I am trying to learn mysql and having some problem with updating/adding data to the table
this is my code and after running this page when I go to phpmyadmin to see if the new data showed up, i dont see it there.
```
<?php
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(!$conn) { die("Could not connect"); ... | 2010/08/18 | [
"https://Stackoverflow.com/questions/3508067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/325499/"
] | The problem is the quotes around the field names. MySQL doesn't allow single-quoted field names. They either have to be bare (A1), or within backticks (`A1`), so your query should be rewritten as:
```
INSERT INTO table1 (A1, A2, A3, A4, A5, A6, A7, A8)
VALUES ('test1', 'test2', 'test3', 'test4', etc.....);
``` | First of all, make sure that database was selected fine:
```
mysql_select_db($dbname, $conn) or die('Could not select the database');
```
There are chances that there is some error in your query, a reason why data is not added, try adding `or die(mysql_error())` after this `mysql_query` function to see the possible ... |
3,508,067 | I am trying to learn mysql and having some problem with updating/adding data to the table
this is my code and after running this page when I go to phpmyadmin to see if the new data showed up, i dont see it there.
```
<?php
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(!$conn) { die("Could not connect"); ... | 2010/08/18 | [
"https://Stackoverflow.com/questions/3508067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/325499/"
] | Be sure to do error checking to see if the mysql connection is having trouble too:
```
if(!mysql_select_db($dbname, $conn)) {
echo mysql_error($conn);
}else {
if(!mysql_query("INSERT INTO 'test'.'table1' ('A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8') VALUES ('test1', 'test2', 'test3', 'test4', 'test5', 'te... | Here is a tip for you in general when working with MYSQL (Or any SQL DB). If you don't know how to do something, or you are getting things wrong. Use the GUI tools provided for you to do the job, then check the resulting code.
Enter PHPMyAdmin, Do an insert, and then copy and paste the code to see what you are doing ... |
3,508,067 | I am trying to learn mysql and having some problem with updating/adding data to the table
this is my code and after running this page when I go to phpmyadmin to see if the new data showed up, i dont see it there.
```
<?php
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(!$conn) { die("Could not connect"); ... | 2010/08/18 | [
"https://Stackoverflow.com/questions/3508067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/325499/"
] | The problem is the quotes around the field names. MySQL doesn't allow single-quoted field names. They either have to be bare (A1), or within backticks (`A1`), so your query should be rewritten as:
```
INSERT INTO table1 (A1, A2, A3, A4, A5, A6, A7, A8)
VALUES ('test1', 'test2', 'test3', 'test4', etc.....);
``` | Here is a tip for you in general when working with MYSQL (Or any SQL DB). If you don't know how to do something, or you are getting things wrong. Use the GUI tools provided for you to do the job, then check the resulting code.
Enter PHPMyAdmin, Do an insert, and then copy and paste the code to see what you are doing ... |
3,508,067 | I am trying to learn mysql and having some problem with updating/adding data to the table
this is my code and after running this page when I go to phpmyadmin to see if the new data showed up, i dont see it there.
```
<?php
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(!$conn) { die("Could not connect"); ... | 2010/08/18 | [
"https://Stackoverflow.com/questions/3508067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/325499/"
] | The problem is the quotes around the field names. MySQL doesn't allow single-quoted field names. They either have to be bare (A1), or within backticks (`A1`), so your query should be rewritten as:
```
INSERT INTO table1 (A1, A2, A3, A4, A5, A6, A7, A8)
VALUES ('test1', 'test2', 'test3', 'test4', etc.....);
``` | Be sure to do error checking to see if the mysql connection is having trouble too:
```
if(!mysql_select_db($dbname, $conn)) {
echo mysql_error($conn);
}else {
if(!mysql_query("INSERT INTO 'test'.'table1' ('A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8') VALUES ('test1', 'test2', 'test3', 'test4', 'test5', 'te... |
26,290,878 | I'm having a problem with my switch statement, sorry if this is trivial, I'm very new! At the switch statement I'm getting the error :
>
> Syntax error on tokens, Label expected instead.
>
>
>
At each of the cases I'm getting the error :
>
> Syntax error on token "case", assert expected
>
>
>
Both `productN... | 2014/10/10 | [
"https://Stackoverflow.com/questions/26290878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4127676/"
] | You should use `ifelse`:
```
transform(data1,
mutation = ifelse (genotype == "B3", "wt",
ifelse (genotype %in% c("ein9","ein194"),
"phyB", "hy2")))
# internode_length treatment genotype mutation
# 1 98.165 sun B3 wt
# 2 116.633 sun... | A data.table alternative.
toy data
```
# internode_length treatment genotype
# 98.165 sun B3
# 116.633 sun B3
# 103.474 sun B3
# 120.683 sun B3
# 109.128 sun B3
# 129.076 sun B3
# ... |
26,290,878 | I'm having a problem with my switch statement, sorry if this is trivial, I'm very new! At the switch statement I'm getting the error :
>
> Syntax error on tokens, Label expected instead.
>
>
>
At each of the cases I'm getting the error :
>
> Syntax error on token "case", assert expected
>
>
>
Both `productN... | 2014/10/10 | [
"https://Stackoverflow.com/questions/26290878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4127676/"
] | You should use `ifelse`:
```
transform(data1,
mutation = ifelse (genotype == "B3", "wt",
ifelse (genotype %in% c("ein9","ein194"),
"phyB", "hy2")))
# internode_length treatment genotype mutation
# 1 98.165 sun B3 wt
# 2 116.633 sun... | You could also do this without using `ifelse`
```
v1 <- factor(df$genotype)
v1
#[1] B3 B3 ein9 B3 ein194 A2
#Levels: A2 B3 ein194 ein9
```
Change the levels to the one you wanted. Here `ein194` and `ein9` should be `phyB`.
```
levels(v1) <- c("hy2", "wt", "phyB", "phyB")
df$new_column... |
13,629,534 | I'm creating an API that encapsulates [JPA](https://stackoverflow.com/tags/jpa/info) objects with additional properties and helpers. I do not want the users to access the database, because I have to provide certain querying functionality for the consumers of the API.
I have the following:
```
Node1(w/ attributes) -- ... | 2012/11/29 | [
"https://Stackoverflow.com/questions/13629534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/483616/"
] | Personally, I like the idea of the visitor pattern, however it might turn out to expensive to visit all nodes.
**Query Interface**: If users / other developers are using it, I would use a builder style interface, with readable method names:
```
Visitor v = QueryBuilder
.selectNodes(ConditionFa... | It sounds like you have all the pieces except some syntactic sugar.
How about an immutable style where you create the whole list above like
```
Visitor v = Visitor.empty
.hasMass(2.5)
.edge()
.node()
.hasNoAttributes();
```
You can create any kind of linear query pattern using this style; and if you... |
38,608,335 | I'd like to use a `Google Map` inside a `ScrollView` but it seems harder than I thought. The first time I created everything and ran the app on a tablet. On the tablet, the UI looks good the map's size and the place is perfect. When I tried it a smaller device I realized that 80% size of the map is invisible. I can scr... | 2016/07/27 | [
"https://Stackoverflow.com/questions/38608335",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6547060/"
] | Try like this
```
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff0000"
android:id="@+id/relativeinfo1">
<View
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_above="@+id/titlein... | I think it`s because of your layout\_height setting for fragment.That cause some measure error.
Try set layout\_height to a certain dp.
such as:
```
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:la... |
38,608,335 | I'd like to use a `Google Map` inside a `ScrollView` but it seems harder than I thought. The first time I created everything and ran the app on a tablet. On the tablet, the UI looks good the map's size and the place is perfect. When I tried it a smaller device I realized that 80% size of the map is invisible. I can scr... | 2016/07/27 | [
"https://Stackoverflow.com/questions/38608335",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6547060/"
] | This was the solution:
```
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:id="@+id/scrollView">
<R... | I think it`s because of your layout\_height setting for fragment.That cause some measure error.
Try set layout\_height to a certain dp.
such as:
```
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:la... |
72,576,712 | I'm having a curve (parabol) from 0 to 1 on both axes as follows:
[](https://i.stack.imgur.com/O3td2.png)
I generate another curve by moving the original curve along the x-axis and combine both to get the following graph:
[![enter image description ... | 2022/06/10 | [
"https://Stackoverflow.com/questions/72576712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11422689/"
] | First off, I would have two different parabola functions such that:
```
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-1, 1, 100)
y1 = np.add(x, 0.3)**2 # Parabola centered at -0.3
y2 = np.add(x, -0.3)**2 # Parabola centered at 0.3
```
You can choose your own offsets for y1 and y2 depending on ... | This involves curve fitting. You need to find the intersection part before you drop the values. Since the values of x and y have been normalized, we would have to determine exactly where the two datasets meet. We can see that they meet when x[i] >x[i+1]. Using your cobined `xx` and `yy` from the data provided, We there... |
46,142,289 | Trying to use `async` and `await` to do http request in nodejs, but got error. Any ideas? Thx
```
got response:
undefined
/home/tom/learn/node/node_modules/node-rest-client/lib/node-rest-client.js:539
callback(parsedData,res);
^
TypeError: callback is not a function
at /home/tom/learn/nod... | 2017/09/10 | [
"https://Stackoverflow.com/questions/46142289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3337677/"
] | `async/await` don't just magically work with functions that expect callbacks. If client.get() is expecting a callback as an argument, you HAVE to pass a callback if you're going to use it. `async/await` work with asynchronous operations that return promises and they operate on those promises. They do not magically let ... | **await** requires its argument to return a promise. And the reason you are getting this error is that client.get("<http://localhost/tmp.txt>"); doesn't return a promise.
So, There are 2 ways you can resolve this issue.
1. Explicitly return a promise
2. Use other libraries that return promises. Example : <https://www... |
46,142,289 | Trying to use `async` and `await` to do http request in nodejs, but got error. Any ideas? Thx
```
got response:
undefined
/home/tom/learn/node/node_modules/node-rest-client/lib/node-rest-client.js:539
callback(parsedData,res);
^
TypeError: callback is not a function
at /home/tom/learn/nod... | 2017/09/10 | [
"https://Stackoverflow.com/questions/46142289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3337677/"
] | `async/await` don't just magically work with functions that expect callbacks. If client.get() is expecting a callback as an argument, you HAVE to pass a callback if you're going to use it. `async/await` work with asynchronous operations that return promises and they operate on those promises. They do not magically let ... | ```
function clientRest(args) {
return new Promise(resolve => {
client.post("url", args, (data,response)=> {
resolve(data)
})
})
}
let data_image = await clientRest(args)
``` |
31,237,365 | To elaborate my question, I have shopping cart website. Also I have textboxes like username, address, contact etc. All of those has the required field validator. However I also do have the "view profile" and "log out" link button on the page. When I try to clike those links, its not letting me because the required fiel... | 2015/07/06 | [
"https://Stackoverflow.com/questions/31237365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4980525/"
] | For those link button on which you want to run validation add validationgroup attribute. For Example
```
<asp:button id="Button2"
text="Validate"
causesvalidation="true"
validationgroup="LocationInfoGroup"
runat="Server" />
```
Also add validationgroup attribute in RequiredFieldValidator
```
<asp:Require... | here is the link on how i managed to solve it. <https://msdn.microsoft.com/en-us/library/ms227424(v=vs.140).aspx>. credit to @Tonny |
31,527,914 | I want to do this as a transaction because this key will serve as a "lock" for later actions. What if this happens:
1. Check it exists
2. Establish it doesn't exist
3. Someone else checks it exists whilst I am establishing it doesn't exist
4. Set it because it doesn't exist and then do my actions
5. Second person sets... | 2015/07/20 | [
"https://Stackoverflow.com/questions/31527914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/964634/"
] | Well, if you wanted to know about the nature of redis transactions:
<http://redis.io/topics/transactions>
In particular, this part:
>
> "All the commands in a transaction are serialized and executed
> sequentially. It can never happen that a request issued by another
> client is served in the middle of the execut... | Use the `NX` flag of the [SET](http://redis.io/commands/set) command.
As the docs suggests:
>
> The command `SET resource-name anystring NX EX max-lock-time` is a simple way to implement a locking system with Redis.
>
>
> |
35,763,227 | I am trying to bind the ng-model parameter which was initially set in a controller back to the controller
I have something like this
```
<div ng-app="myApp" ng-controller="personCtrl">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
... | 2016/03/03 | [
"https://Stackoverflow.com/questions/35763227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1363169/"
] | It should be:
```
$scope.UpdateProfile = function()
{
$scope.newFirstName = $scope.firstName;
}
});
``` | You already Pre-defined Scopes by filling Some values .Scope recognizes the Updated values it self .
Update your Code just like the Following :-
```
$scope.newFirstName = $scope.firstName;
$scope.newLastName = $scope.lastName;
```
<https://plnkr.co/edit/NsoxahPcGUBtTYTlruBJ?p=preview>
<https://docs.angularjs.org... |
35,763,227 | I am trying to bind the ng-model parameter which was initially set in a controller back to the controller
I have something like this
```
<div ng-app="myApp" ng-controller="personCtrl">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
... | 2016/03/03 | [
"https://Stackoverflow.com/questions/35763227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1363169/"
] | It should be:
```
$scope.UpdateProfile = function()
{
$scope.newFirstName = $scope.firstName;
}
});
``` | Your Code - you have attached firstName to the $scope variable which is an object internally and and firstName is its property.
For example if I create a sample testApp module with testController and attach a property test1 to it and console log the $scope variable.
then i can see whole $scope object in console.
// Co... |
35,763,227 | I am trying to bind the ng-model parameter which was initially set in a controller back to the controller
I have something like this
```
<div ng-app="myApp" ng-controller="personCtrl">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
... | 2016/03/03 | [
"https://Stackoverflow.com/questions/35763227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1363169/"
] | It should be:
```
$scope.UpdateProfile = function()
{
$scope.newFirstName = $scope.firstName;
}
});
``` | Alternatively you can make some changes to get your own version functioning..
**In controller:**
```
$scope.UpdateProfile = function(firstName)
{
$scope.newFirstName = firstName
}
```
**In HTML:**
```
<button ng-click="UpdateProfile(firstName)"> Update </button>
``` |
35,763,227 | I am trying to bind the ng-model parameter which was initially set in a controller back to the controller
I have something like this
```
<div ng-app="myApp" ng-controller="personCtrl">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
... | 2016/03/03 | [
"https://Stackoverflow.com/questions/35763227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1363169/"
] | Alternatively you can make some changes to get your own version functioning..
**In controller:**
```
$scope.UpdateProfile = function(firstName)
{
$scope.newFirstName = firstName
}
```
**In HTML:**
```
<button ng-click="UpdateProfile(firstName)"> Update </button>
``` | You already Pre-defined Scopes by filling Some values .Scope recognizes the Updated values it self .
Update your Code just like the Following :-
```
$scope.newFirstName = $scope.firstName;
$scope.newLastName = $scope.lastName;
```
<https://plnkr.co/edit/NsoxahPcGUBtTYTlruBJ?p=preview>
<https://docs.angularjs.org... |
35,763,227 | I am trying to bind the ng-model parameter which was initially set in a controller back to the controller
I have something like this
```
<div ng-app="myApp" ng-controller="personCtrl">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
... | 2016/03/03 | [
"https://Stackoverflow.com/questions/35763227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1363169/"
] | Alternatively you can make some changes to get your own version functioning..
**In controller:**
```
$scope.UpdateProfile = function(firstName)
{
$scope.newFirstName = firstName
}
```
**In HTML:**
```
<button ng-click="UpdateProfile(firstName)"> Update </button>
``` | Your Code - you have attached firstName to the $scope variable which is an object internally and and firstName is its property.
For example if I create a sample testApp module with testController and attach a property test1 to it and console log the $scope variable.
then i can see whole $scope object in console.
// Co... |
11,731,628 | ive been trying to do an import in my java project but i keep getting the following error.
```
The import org.jdom cannot be resolved
```
i have created a lib folder under my project and have put the jar files from <http://www.jdom.org/downloads/index.html>
into there.
there were a total of 8 different jar files w... | 2012/07/31 | [
"https://Stackoverflow.com/questions/11731628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1357195/"
] | I opened the jar file at the link you gave using 7zip. It looks like you will need to use the import statements: (Note the addition of the '2') "import org.jdom2.Document;" | **It depends from the library version!!**
If you downloaded the **version 1** you MUST write:
```
import org.jdom.*
```
If you downloaded the **version 2** you MUST write:
```
import org.jdom2.*
``` |
11,731,628 | ive been trying to do an import in my java project but i keep getting the following error.
```
The import org.jdom cannot be resolved
```
i have created a lib folder under my project and have put the jar files from <http://www.jdom.org/downloads/index.html>
into there.
there were a total of 8 different jar files w... | 2012/07/31 | [
"https://Stackoverflow.com/questions/11731628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1357195/"
] | I opened the jar file at the link you gave using 7zip. It looks like you will need to use the import statements: (Note the addition of the '2') "import org.jdom2.Document;" | You should import **[jdom-1.1.3](http://www.jdom.org/dist/binary/archive/jdom-1.1.3.zip)** which is stable and work for me. |
11,731,628 | ive been trying to do an import in my java project but i keep getting the following error.
```
The import org.jdom cannot be resolved
```
i have created a lib folder under my project and have put the jar files from <http://www.jdom.org/downloads/index.html>
into there.
there were a total of 8 different jar files w... | 2012/07/31 | [
"https://Stackoverflow.com/questions/11731628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1357195/"
] | I opened the jar file at the link you gave using 7zip. It looks like you will need to use the import statements: (Note the addition of the '2') "import org.jdom2.Document;" | Could be because of the package rename in later versions. The later version shows the package name as dom2 instead of dom. |
11,731,628 | ive been trying to do an import in my java project but i keep getting the following error.
```
The import org.jdom cannot be resolved
```
i have created a lib folder under my project and have put the jar files from <http://www.jdom.org/downloads/index.html>
into there.
there were a total of 8 different jar files w... | 2012/07/31 | [
"https://Stackoverflow.com/questions/11731628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1357195/"
] | **It depends from the library version!!**
If you downloaded the **version 1** you MUST write:
```
import org.jdom.*
```
If you downloaded the **version 2** you MUST write:
```
import org.jdom2.*
``` | You should import **[jdom-1.1.3](http://www.jdom.org/dist/binary/archive/jdom-1.1.3.zip)** which is stable and work for me. |
11,731,628 | ive been trying to do an import in my java project but i keep getting the following error.
```
The import org.jdom cannot be resolved
```
i have created a lib folder under my project and have put the jar files from <http://www.jdom.org/downloads/index.html>
into there.
there were a total of 8 different jar files w... | 2012/07/31 | [
"https://Stackoverflow.com/questions/11731628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1357195/"
] | **It depends from the library version!!**
If you downloaded the **version 1** you MUST write:
```
import org.jdom.*
```
If you downloaded the **version 2** you MUST write:
```
import org.jdom2.*
``` | Could be because of the package rename in later versions. The later version shows the package name as dom2 instead of dom. |
11,731,628 | ive been trying to do an import in my java project but i keep getting the following error.
```
The import org.jdom cannot be resolved
```
i have created a lib folder under my project and have put the jar files from <http://www.jdom.org/downloads/index.html>
into there.
there were a total of 8 different jar files w... | 2012/07/31 | [
"https://Stackoverflow.com/questions/11731628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1357195/"
] | You should import **[jdom-1.1.3](http://www.jdom.org/dist/binary/archive/jdom-1.1.3.zip)** which is stable and work for me. | Could be because of the package rename in later versions. The later version shows the package name as dom2 instead of dom. |
20,294,078 | Let's say I have an input file where each line contains the path from the root (A) to a leaf
```
echo "A\tB\tC\nA\tB\tD\nA\tE" > lines.txt
A B C
A B D
A E
```
How can I easily generate the resulting tree?: `(A(B(C,D),E))`
I'd like to use GNU tools (awk, sed, etc.) because they tend to work better with la... | 2013/11/29 | [
"https://Stackoverflow.com/questions/20294078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/355567/"
] | In Perl:
```
#!/usr/bin/env perl
use strict;
my $t = {};
while (<>) {
my @a = split;
my $t1 = $t;
while (my $a = shift @a) {
$t1->{$a} = {} if not exists $t1->{$a};
$t1 = $t1->{$a};
}
}
print &p($t)."\n";
sub p {
my ($t) = @_;
return
unless keys %$t;
return '('
... | Okay, so I think I got it:
```
# input
lines <- c(list(c("A", "B", "C")), list(c("A", "B", "D")), list(c("A","E")))
# generate children
generate_children <- function(lines){
children <- list()
for (line in lines) {
for (index in 1:(length(line)-1)){
parent <- line[index]
next_c... |
20,294,078 | Let's say I have an input file where each line contains the path from the root (A) to a leaf
```
echo "A\tB\tC\nA\tB\tD\nA\tE" > lines.txt
A B C
A B D
A E
```
How can I easily generate the resulting tree?: `(A(B(C,D),E))`
I'd like to use GNU tools (awk, sed, etc.) because they tend to work better with la... | 2013/11/29 | [
"https://Stackoverflow.com/questions/20294078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/355567/"
] | Why do it the easy way, if you can use Bourne Shell script instead? Note, this is not even Bash, this is plain old Bourne shell, without arrays...
```
#!/bin/sh
#
# A B C
# A B D
# A E
#
# "" vs "A B C" -> 0->3, ident 0 -> -0+3 -> "(A(B(C"
# "A B C" vs "A B D" -> 3->3, ident 2 -> -1+1 -> ",D"
... | Okay, so I think I got it:
```
# input
lines <- c(list(c("A", "B", "C")), list(c("A", "B", "D")), list(c("A","E")))
# generate children
generate_children <- function(lines){
children <- list()
for (line in lines) {
for (index in 1:(length(line)-1)){
parent <- line[index]
next_c... |
20,294,078 | Let's say I have an input file where each line contains the path from the root (A) to a leaf
```
echo "A\tB\tC\nA\tB\tD\nA\tE" > lines.txt
A B C
A B D
A E
```
How can I easily generate the resulting tree?: `(A(B(C,D),E))`
I'd like to use GNU tools (awk, sed, etc.) because they tend to work better with la... | 2013/11/29 | [
"https://Stackoverflow.com/questions/20294078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/355567/"
] | In Perl:
```
#!/usr/bin/env perl
use strict;
my $t = {};
while (<>) {
my @a = split;
my $t1 = $t;
while (my $a = shift @a) {
$t1->{$a} = {} if not exists $t1->{$a};
$t1 = $t1->{$a};
}
}
print &p($t)."\n";
sub p {
my ($t) = @_;
return
unless keys %$t;
return '('
... | Why do it the easy way, if you can use Bourne Shell script instead? Note, this is not even Bash, this is plain old Bourne shell, without arrays...
```
#!/bin/sh
#
# A B C
# A B D
# A E
#
# "" vs "A B C" -> 0->3, ident 0 -> -0+3 -> "(A(B(C"
# "A B C" vs "A B D" -> 3->3, ident 2 -> -1+1 -> ",D"
... |
515,398 | I have low to medium tech skills;however, I can follow directions flawless and am easily teachable. Had a Dell xp e510 motherboard that went bad. Bought a new destop with internal drive and hooked the old xp drive up via usb and external sata dock. The new windows 7 system immediately recognized the xp drive however mo... | 2012/12/06 | [
"https://superuser.com/questions/515398",
"https://superuser.com",
"https://superuser.com/users/178346/"
] | Most user documents in Windows XP will be in a folder called "Documents and Settings" and in that folder there are folders for each of the user accounts on that machine. Inside those folders, you should see "Desktop" "'s Documents" etc. Your files "should" be in there somewhere.
When opening the folder, Windows 7 will... | Like Mike said, all of your files should be in "Documents and Settings," but you will probably have to change the permissions on these files to be able to see them in Windows 7. To do this,
1. Right-click on the Documents and Settings folder and select `Properties` and click the `Security` tab.
2. Click `Advanced` an... |
15,503,825 | So I've built hundreds of forms before, all with no issues, but for some reason unknown to me this one doesn't seem to be working. This form is in its infancy to later be plugged into a larger web application. I've checked my code over and over again, checked if PHP is functioning properly, etc, yet I've had no luck fi... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15503825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1832987/"
] | You left out the "NAME" attribute for the input fields....
The ID attribute does not replace the name attribute | Woops, you missed the `name='count'` in the `<input type='hidden'>` :)
Happens to the best of us |
15,503,825 | So I've built hundreds of forms before, all with no issues, but for some reason unknown to me this one doesn't seem to be working. This form is in its infancy to later be plugged into a larger web application. I've checked my code over and over again, checked if PHP is functioning properly, etc, yet I've had no luck fi... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15503825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1832987/"
] | Well, this works for me after making few changes like -
```
<td><input type="text" value="Content1" id="cnt1" name="some[]" /></td>
```
added `name` to be an array since they are added dynamically.
And from script I changed following line -
```
var newData = '<tr style="display:none" id="cnt' + counter + '"><td... | Woops, you missed the `name='count'` in the `<input type='hidden'>` :)
Happens to the best of us |
15,503,825 | So I've built hundreds of forms before, all with no issues, but for some reason unknown to me this one doesn't seem to be working. This form is in its infancy to later be plugged into a larger web application. I've checked my code over and over again, checked if PHP is functioning properly, etc, yet I've had no luck fi... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15503825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1832987/"
] | You left out the "NAME" attribute for the input fields....
The ID attribute does not replace the name attribute | Well, this works for me after making few changes like -
```
<td><input type="text" value="Content1" id="cnt1" name="some[]" /></td>
```
added `name` to be an array since they are added dynamically.
And from script I changed following line -
```
var newData = '<tr style="display:none" id="cnt' + counter + '"><td... |
67,673,589 | Here's the scenario.
* I'm storing users as a key/value pair. The keys are the user Id's
{
'111': USER\_OBJECT,
'222': USER\_OBJECT
}
I would like to remove the first item ('111') and pass the rest of the items to my store.
Here's what works.
```
const value = The example user object;
delete value['111']
// Outcom... | 2021/05/24 | [
"https://Stackoverflow.com/questions/67673589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2404112/"
] | (Note that this is all JavaScript, and only has to do with TypeScript to the extent that you're using the TypeScript compiler for [downleveling](https://www.typescriptlang.org/docs/handbook/2/basic-types.html#downleveling), but such would equally well apply to [Babel](https://babeljs.io/) or any other JavaScript downle... | I assume your user data is stored as a dictionary, like this:
```
let userData = {'111': {...}, '222': {...}, ...};
```
If you want to filter a specific ID, you can use:
```
Object.keys(userData)
.filter(id => id !== '111')
.reduce((acc, cur) => ({...acc, [cur]: userData[cur]}), {})
```
First, we filter o... |
2,085,430 | I have a question related to some guidances to solve a problem. I have with me an xml file, I have to populate it into a database system (whatever, it might be sqlite, mysql) using scripting language: Python.
Does anyone have any idea on how to proceed?
* Which technologies I need to read further?
* Which environment... | 2010/01/18 | [
"https://Stackoverflow.com/questions/2085430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247646/"
] | I recommend you study on [ElementTree](http://effbot.org/zone/element-index.htm) for parsing your XML file into memory (parse it all, then emit it all to a SQL DB, is probably easier, but element-tree also allows incremental operation if your file is huge) -- it's part of the standard Python library as module [xml.etre... | If you are accustomed to DOM (tree) access to xml from other language, you may find useful these standard library modules (and their respective docs):
* xml.dom
* xml.dom.minidom
To save tha data to DB, you can use standard module sqlite3 or look for binding to mysql. Or you may wish to use something more abstract, l... |
2,085,430 | I have a question related to some guidances to solve a problem. I have with me an xml file, I have to populate it into a database system (whatever, it might be sqlite, mysql) using scripting language: Python.
Does anyone have any idea on how to proceed?
* Which technologies I need to read further?
* Which environment... | 2010/01/18 | [
"https://Stackoverflow.com/questions/2085430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247646/"
] | You can do it all by hand with `sqlite3` and `xmlstarlet`.
* convert xml to csv
* import csv to db.
(Maybe it's not your want. but it's handy)
```
# content of xml file
$ cat artist.xml
<results><artist><id>Ae2300d8b0232c06c</id><name>莎拉 布莱曼(Sarah Brightman)</name><hotSongs><!--freemusic/song/result/Sa3f6b810d7f98... | If you are accustomed to DOM (tree) access to xml from other language, you may find useful these standard library modules (and their respective docs):
* xml.dom
* xml.dom.minidom
To save tha data to DB, you can use standard module sqlite3 or look for binding to mysql. Or you may wish to use something more abstract, l... |
2,085,430 | I have a question related to some guidances to solve a problem. I have with me an xml file, I have to populate it into a database system (whatever, it might be sqlite, mysql) using scripting language: Python.
Does anyone have any idea on how to proceed?
* Which technologies I need to read further?
* Which environment... | 2010/01/18 | [
"https://Stackoverflow.com/questions/2085430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247646/"
] | If you are accustomed to DOM (tree) access to xml from other language, you may find useful these standard library modules (and their respective docs):
* xml.dom
* xml.dom.minidom
To save tha data to DB, you can use standard module sqlite3 or look for binding to mysql. Or you may wish to use something more abstract, l... | I know it's an old post, but I think it's worth noting for reference to future visitors who need one-time solution: The simplest way I found was to use **Libre Office Calc**, particularly `Data` --> `XML source` feature.
<https://help.libreoffice.org/latest/lo/text/scalc/01/xml_source.html>
Once imported into ODS, on... |
2,085,430 | I have a question related to some guidances to solve a problem. I have with me an xml file, I have to populate it into a database system (whatever, it might be sqlite, mysql) using scripting language: Python.
Does anyone have any idea on how to proceed?
* Which technologies I need to read further?
* Which environment... | 2010/01/18 | [
"https://Stackoverflow.com/questions/2085430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247646/"
] | I recommend you study on [ElementTree](http://effbot.org/zone/element-index.htm) for parsing your XML file into memory (parse it all, then emit it all to a SQL DB, is probably easier, but element-tree also allows incremental operation if your file is huge) -- it's part of the standard Python library as module [xml.etre... | You can do it all by hand with `sqlite3` and `xmlstarlet`.
* convert xml to csv
* import csv to db.
(Maybe it's not your want. but it's handy)
```
# content of xml file
$ cat artist.xml
<results><artist><id>Ae2300d8b0232c06c</id><name>莎拉 布莱曼(Sarah Brightman)</name><hotSongs><!--freemusic/song/result/Sa3f6b810d7f98... |
2,085,430 | I have a question related to some guidances to solve a problem. I have with me an xml file, I have to populate it into a database system (whatever, it might be sqlite, mysql) using scripting language: Python.
Does anyone have any idea on how to proceed?
* Which technologies I need to read further?
* Which environment... | 2010/01/18 | [
"https://Stackoverflow.com/questions/2085430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247646/"
] | I recommend you study on [ElementTree](http://effbot.org/zone/element-index.htm) for parsing your XML file into memory (parse it all, then emit it all to a SQL DB, is probably easier, but element-tree also allows incremental operation if your file is huge) -- it's part of the standard Python library as module [xml.etre... | I know it's an old post, but I think it's worth noting for reference to future visitors who need one-time solution: The simplest way I found was to use **Libre Office Calc**, particularly `Data` --> `XML source` feature.
<https://help.libreoffice.org/latest/lo/text/scalc/01/xml_source.html>
Once imported into ODS, on... |
2,085,430 | I have a question related to some guidances to solve a problem. I have with me an xml file, I have to populate it into a database system (whatever, it might be sqlite, mysql) using scripting language: Python.
Does anyone have any idea on how to proceed?
* Which technologies I need to read further?
* Which environment... | 2010/01/18 | [
"https://Stackoverflow.com/questions/2085430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247646/"
] | You can do it all by hand with `sqlite3` and `xmlstarlet`.
* convert xml to csv
* import csv to db.
(Maybe it's not your want. but it's handy)
```
# content of xml file
$ cat artist.xml
<results><artist><id>Ae2300d8b0232c06c</id><name>莎拉 布莱曼(Sarah Brightman)</name><hotSongs><!--freemusic/song/result/Sa3f6b810d7f98... | I know it's an old post, but I think it's worth noting for reference to future visitors who need one-time solution: The simplest way I found was to use **Libre Office Calc**, particularly `Data` --> `XML source` feature.
<https://help.libreoffice.org/latest/lo/text/scalc/01/xml_source.html>
Once imported into ODS, on... |
12,691 | In the deleted scene where the 10th Doctor leaves Rose and the Human-Doctor on the alternate universe, the Doctor gives the meta-crisis Doctor a piece of the TARDIS to grow a new one.
BUT
---
In `The Doctor's Wife`, the Doctor and Idris **build** a TARDIS console "without a proper shell"
How is this possible if as s... | 2012/03/07 | [
"https://scifi.stackexchange.com/questions/12691",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/3383/"
] | Think Frankenstein's Monster vs. cloning. With cloning, you take a chunk of a living thing, and use it to grow a copy of that original living thing. This is similar to what the meta-crisis Doctor will do with the piece of the TARDIS.
With Frankenstein's Monster, Dr. Frankenstein put together the pieces of a human bein... | I don't think there is a contradiction here.
In The Doctor's Wife, they *assemble* a partial TARDIS from bits and pieces of other broken ones that are lying around. They don't build anything from scratch. It's not at all inconsistent to say that the important parts have to be grown, but that you still need to fit the... |
12,691 | In the deleted scene where the 10th Doctor leaves Rose and the Human-Doctor on the alternate universe, the Doctor gives the meta-crisis Doctor a piece of the TARDIS to grow a new one.
BUT
---
In `The Doctor's Wife`, the Doctor and Idris **build** a TARDIS console "without a proper shell"
How is this possible if as s... | 2012/03/07 | [
"https://scifi.stackexchange.com/questions/12691",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/3383/"
] | Think Frankenstein's Monster vs. cloning. With cloning, you take a chunk of a living thing, and use it to grow a copy of that original living thing. This is similar to what the meta-crisis Doctor will do with the piece of the TARDIS.
With Frankenstein's Monster, Dr. Frankenstein put together the pieces of a human bein... | The basic flight systems of the TARDIS are Dynamorphic generators (wich allow traveling trough the vortex), Dematerialization Circuit, a power source, a Time Rotor (that "conduct" the energy of the power source to the Dynamorphic Generators) and a console to control the travel. A standart TARDIS incorpore more than thi... |
12,691 | In the deleted scene where the 10th Doctor leaves Rose and the Human-Doctor on the alternate universe, the Doctor gives the meta-crisis Doctor a piece of the TARDIS to grow a new one.
BUT
---
In `The Doctor's Wife`, the Doctor and Idris **build** a TARDIS console "without a proper shell"
How is this possible if as s... | 2012/03/07 | [
"https://scifi.stackexchange.com/questions/12691",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/3383/"
] | I don't think there is a contradiction here.
In The Doctor's Wife, they *assemble* a partial TARDIS from bits and pieces of other broken ones that are lying around. They don't build anything from scratch. It's not at all inconsistent to say that the important parts have to be grown, but that you still need to fit the... | The basic flight systems of the TARDIS are Dynamorphic generators (wich allow traveling trough the vortex), Dematerialization Circuit, a power source, a Time Rotor (that "conduct" the energy of the power source to the Dynamorphic Generators) and a console to control the travel. A standart TARDIS incorpore more than thi... |
27,565,572 | Consider the following interface:
```
package hf;
public interface BadInterface
{
void meth() throws Exception;
}
```
Which is implemented by the following class:
```
package hf;
public class apples implements BadInterface
{
public static void main(String[] args)
{
new apples().meth();
}
... | 2014/12/19 | [
"https://Stackoverflow.com/questions/27565572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3760100/"
] | When you implement an interface method, you are allowed to declare that you throw *fewer* exceptions than listed in the interface.
When you call `new apples().meth()`, you are invoking `meth()` on an `apples` instance. The compiler knows this doesn't throw anything, so you are fine.
Had you done:
```
BadInterface ... | According to JLS [Requirements in Overriding and Hiding](http://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.4.8.3):
>
> B is a class or interface, and A is a superclass or superinterface of B, and a method declaration m2 in B overrides or hides a method declaration m1 in A. Then:
>
>
> For every chec... |
41,347,124 | If I have the following model:
```
[Table("Person")]
public class PersonDao
{
public Guid Id { get; set; }
public ICollection<Address> { get; set; }
// other properties
}
[Table("Address")]
public class AddressDao
{
public Guid Id { get; set; }
public PersonDao Person { get; set; }
// other pr... | 2016/12/27 | [
"https://Stackoverflow.com/questions/41347124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/943102/"
] | Use attributes just like you did to have different names for the table and class:
```
[Table("Address")]
public class AddressDao
{
public Guid Id { get; set; }
[ForeignKey("Person_Id")]
public PersonDao Person { get; set; }
// other properties
}
```
If you don't want to use the default convention y... | If you want make your own name of column in database, you can use [Fluent API](https://msdn.microsoft.com/en-us/library/jj591617(v=vs.113).aspx) in `protected override void OnModelCreating(DbModelBuilder modelBuilder)` method in your database context. Add to your DAO class properties with column name.
```
[Table("Pers... |
32,504,570 | I'm writing a couple of classes for an exercise on copy control members in the C++ primer book.
I put the classes definitions in their respective header files,and implementation in code files. I seem to have done all things like they should be done, but I get an error at link time I can't understand (and I already spe... | 2015/09/10 | [
"https://Stackoverflow.com/questions/32504570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4729407/"
] | You are including the header file `message.h` in both `message.cpp` and `main.cpp`. Since you have:
```
void swap(message &m1,message &m2)
{
swap(m1.text,m2.text);
swap(m1.folders,m2.folders);
}
```
In `message.h` you now have the swap function declared in both the `main.cpp` translation unit and the `message.cp... | Did you remember to put include guards in your header files?
```
#ifndef __MY_HEADER__
#define __MY_HEADER__
...
#endif
```
or if you're comfortable using features outside the C++ standard:
```
#pragma once
...
``` |
32,504,570 | I'm writing a couple of classes for an exercise on copy control members in the C++ primer book.
I put the classes definitions in their respective header files,and implementation in code files. I seem to have done all things like they should be done, but I get an error at link time I can't understand (and I already spe... | 2015/09/10 | [
"https://Stackoverflow.com/questions/32504570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4729407/"
] | Did you remember to put include guards in your header files?
```
#ifndef __MY_HEADER__
#define __MY_HEADER__
...
#endif
```
or if you're comfortable using features outside the C++ standard:
```
#pragma once
...
``` | The solution to your problem is very simple: you have declared void swap( data1, data2 ) as a friend function in your message class then you define it at the bottom of your \*.h file. Take the implementation out of the \*.h file and place it into your message.cpp file before any of your classes functions. Make sure you... |
32,504,570 | I'm writing a couple of classes for an exercise on copy control members in the C++ primer book.
I put the classes definitions in their respective header files,and implementation in code files. I seem to have done all things like they should be done, but I get an error at link time I can't understand (and I already spe... | 2015/09/10 | [
"https://Stackoverflow.com/questions/32504570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4729407/"
] | You are including the header file `message.h` in both `message.cpp` and `main.cpp`. Since you have:
```
void swap(message &m1,message &m2)
{
swap(m1.text,m2.text);
swap(m1.folders,m2.folders);
}
```
In `message.h` you now have the swap function declared in both the `main.cpp` translation unit and the `message.cp... | The solution to your problem is very simple: you have declared void swap( data1, data2 ) as a friend function in your message class then you define it at the bottom of your \*.h file. Take the implementation out of the \*.h file and place it into your message.cpp file before any of your classes functions. Make sure you... |
52,588,873 | I would like to use a universal reference with vector.
```
template<typename T>
void foo(T&& v)
{
for(typename T::iterator i = v.begin(); i != v.end(); i++)
{
std::cout << *i << std::endl;
}
}
int main()
{
std::vector v = {0,5,4,3};
foo(std::move(v));
foo(v)... | 2018/10/01 | [
"https://Stackoverflow.com/questions/52588873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10440409/"
] | When you pass an *lvalue* to `foo`, `T` is deduced as an *lvalue reference* due to special perfect forwarding rules:
>
> From [[temp.deduct.call]](http://eel.is/c++draft/temp.deduct.call#def:forwarding_reference) (12.9.2.1 par 3):
>
>
>
> >
> > A forwarding reference is an rvalue reference to a cv-unqualified tem... | The issue is the explicit loop:
```
for(typename T::iterator i = v.begin(); i != v.end(); i++)
```
where `T` is replaced by type the template is instantiated with. For an rvalue reference, this is `T` (and the function argument is an rvalue reference), for an lvalue-reference, it is `T&` (and due to reference collap... |
14,972,332 | I'm still learning to code in Python
I want to generate a string based on pattern, the only way I know is by using for loop.
In example code below, I create a loop for "vcvcv" pattern. c=consonant, v=vowel
How to create a dynamic loop, based on pattern that I provide to the script?
eg. if pattern is "cvcvc" the loo... | 2013/02/20 | [
"https://Stackoverflow.com/questions/14972332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/776988/"
] | Something like this should work:
```
import itertools
mapping = {
'v': 'aeiou',
'c': 'bcdfghjklmnpqrstvwxyz'
}
pattern = 'vcvcv'
for thing in itertools.product(*map(mapping.get, pattern)):
print ''.join(thing)
```
Here's roughly how it works:
* `map(mapping.get, pattern)` just converts `'vcv'` to `['... | If you're just getting into programming and want to see a more general solution than the itertools one listed above, then recursion is your best bet, allowing you to arbitrarily nest loops.
There is a slight complication here, which you could use [Python generators](http://wiki.python.org/moin/Generators) for, or else... |
14,972,332 | I'm still learning to code in Python
I want to generate a string based on pattern, the only way I know is by using for loop.
In example code below, I create a loop for "vcvcv" pattern. c=consonant, v=vowel
How to create a dynamic loop, based on pattern that I provide to the script?
eg. if pattern is "cvcvc" the loo... | 2013/02/20 | [
"https://Stackoverflow.com/questions/14972332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/776988/"
] | Something like this should work:
```
import itertools
mapping = {
'v': 'aeiou',
'c': 'bcdfghjklmnpqrstvwxyz'
}
pattern = 'vcvcv'
for thing in itertools.product(*map(mapping.get, pattern)):
print ''.join(thing)
```
Here's roughly how it works:
* `map(mapping.get, pattern)` just converts `'vcv'` to `['... | A somewhat more elaborate but easily customizable version for the first n permutations is given below,
```
def gen_pattern( seq, op = "" ):
vowel="aeiou"
consonant="bcdfghjklmnpqrstvwxyz"
lvowel=list(vowel)
lconsonant=list(consonant)
if ( not seq ):
print op
retur... |
14,972,332 | I'm still learning to code in Python
I want to generate a string based on pattern, the only way I know is by using for loop.
In example code below, I create a loop for "vcvcv" pattern. c=consonant, v=vowel
How to create a dynamic loop, based on pattern that I provide to the script?
eg. if pattern is "cvcvc" the loo... | 2013/02/20 | [
"https://Stackoverflow.com/questions/14972332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/776988/"
] | If you're just getting into programming and want to see a more general solution than the itertools one listed above, then recursion is your best bet, allowing you to arbitrarily nest loops.
There is a slight complication here, which you could use [Python generators](http://wiki.python.org/moin/Generators) for, or else... | A somewhat more elaborate but easily customizable version for the first n permutations is given below,
```
def gen_pattern( seq, op = "" ):
vowel="aeiou"
consonant="bcdfghjklmnpqrstvwxyz"
lvowel=list(vowel)
lconsonant=list(consonant)
if ( not seq ):
print op
retur... |
144,317 | >
> Please be advised that the clerks Intake Specialist Unit is in receipt of the complaint you filed against Maple Lee alleging harassment, and retaliation, which has now been assigned Intake #123425.
>
>
>
My question is, should there be a comma before *and* in "alleging harassment, and retaliation"? | 2014/01/02 | [
"https://english.stackexchange.com/questions/144317",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/61179/"
] | No. It adds nothing. No punctuation should be used unless it serves a purpose. | No, not in this case. The common is only needed before "and" if the list is three or more items. |
24,159 | The card Clerical Error has the text:
>
> Choose a player. Collect any noble of your choice from that player's
> score pile. That player then chooses any other noble from your score
> pile and collects it.
>
>
>
The noble Robespierre has the text:
>
> The day ends after you collect this noble. Discard any noble... | 2015/05/14 | [
"https://boardgames.stackexchange.com/questions/24159",
"https://boardgames.stackexchange.com",
"https://boardgames.stackexchange.com/users/9999/"
] | A common Uno variant allows the recipient of a draw 2 to avoid drawing (and being skipped) by playing their own draw 2. The next player either needs to skip their turn and draw 4 cards, or play their own draw 2. If they play their own, the next player must either draw 6 cards or continue the sequence. Some variants all... | You can play a Wild card on top of *anything*, so long as it's your turn to play. Your friend is crazy.
For the Wild Draw 4, you should ideally be unable to match the color - it is possible to challenge a Wild Draw 4, and if the person who played it could have played a card to match the color instead (not the number)... |
24,159 | The card Clerical Error has the text:
>
> Choose a player. Collect any noble of your choice from that player's
> score pile. That player then chooses any other noble from your score
> pile and collects it.
>
>
>
The noble Robespierre has the text:
>
> The day ends after you collect this noble. Discard any noble... | 2015/05/14 | [
"https://boardgames.stackexchange.com/questions/24159",
"https://boardgames.stackexchange.com",
"https://boardgames.stackexchange.com/users/9999/"
] | You can play a Wild card on top of *anything*, so long as it's your turn to play. Your friend is crazy.
For the Wild Draw 4, you should ideally be unable to match the color - it is possible to challenge a Wild Draw 4, and if the person who played it could have played a card to match the color instead (not the number)... | According to this link (<http://www.qcsalon.net/en/uno>), a +4 can't be played on top of +2 or vice-versa. There are other rules too, regarding playing of a +4 card, you can choose to follow. |
24,159 | The card Clerical Error has the text:
>
> Choose a player. Collect any noble of your choice from that player's
> score pile. That player then chooses any other noble from your score
> pile and collects it.
>
>
>
The noble Robespierre has the text:
>
> The day ends after you collect this noble. Discard any noble... | 2015/05/14 | [
"https://boardgames.stackexchange.com/questions/24159",
"https://boardgames.stackexchange.com",
"https://boardgames.stackexchange.com/users/9999/"
] | You can play a Wild card on top of *anything*, so long as it's your turn to play. Your friend is crazy.
For the Wild Draw 4, you should ideally be unable to match the color - it is possible to challenge a Wild Draw 4, and if the person who played it could have played a card to match the color instead (not the number)... | Yes you can me and my family had the same problem it comes in the uno manual |
24,159 | The card Clerical Error has the text:
>
> Choose a player. Collect any noble of your choice from that player's
> score pile. That player then chooses any other noble from your score
> pile and collects it.
>
>
>
The noble Robespierre has the text:
>
> The day ends after you collect this noble. Discard any noble... | 2015/05/14 | [
"https://boardgames.stackexchange.com/questions/24159",
"https://boardgames.stackexchange.com",
"https://boardgames.stackexchange.com/users/9999/"
] | You can play a Wild card on top of *anything*, so long as it's your turn to play. Your friend is crazy.
For the Wild Draw 4, you should ideally be unable to match the color - it is possible to challenge a Wild Draw 4, and if the person who played it could have played a card to match the color instead (not the number)... | My family has never put a draw 4 ontop of a draw 2 we will only do that if it is agreed on and that is the rules of uno but you can play however you want to play |
24,159 | The card Clerical Error has the text:
>
> Choose a player. Collect any noble of your choice from that player's
> score pile. That player then chooses any other noble from your score
> pile and collects it.
>
>
>
The noble Robespierre has the text:
>
> The day ends after you collect this noble. Discard any noble... | 2015/05/14 | [
"https://boardgames.stackexchange.com/questions/24159",
"https://boardgames.stackexchange.com",
"https://boardgames.stackexchange.com/users/9999/"
] | A common Uno variant allows the recipient of a draw 2 to avoid drawing (and being skipped) by playing their own draw 2. The next player either needs to skip their turn and draw 4 cards, or play their own draw 2. If they play their own, the next player must either draw 6 cards or continue the sequence. Some variants all... | According to this link (<http://www.qcsalon.net/en/uno>), a +4 can't be played on top of +2 or vice-versa. There are other rules too, regarding playing of a +4 card, you can choose to follow. |
24,159 | The card Clerical Error has the text:
>
> Choose a player. Collect any noble of your choice from that player's
> score pile. That player then chooses any other noble from your score
> pile and collects it.
>
>
>
The noble Robespierre has the text:
>
> The day ends after you collect this noble. Discard any noble... | 2015/05/14 | [
"https://boardgames.stackexchange.com/questions/24159",
"https://boardgames.stackexchange.com",
"https://boardgames.stackexchange.com/users/9999/"
] | A common Uno variant allows the recipient of a draw 2 to avoid drawing (and being skipped) by playing their own draw 2. The next player either needs to skip their turn and draw 4 cards, or play their own draw 2. If they play their own, the next player must either draw 6 cards or continue the sequence. Some variants all... | Yes you can me and my family had the same problem it comes in the uno manual |
24,159 | The card Clerical Error has the text:
>
> Choose a player. Collect any noble of your choice from that player's
> score pile. That player then chooses any other noble from your score
> pile and collects it.
>
>
>
The noble Robespierre has the text:
>
> The day ends after you collect this noble. Discard any noble... | 2015/05/14 | [
"https://boardgames.stackexchange.com/questions/24159",
"https://boardgames.stackexchange.com",
"https://boardgames.stackexchange.com/users/9999/"
] | A common Uno variant allows the recipient of a draw 2 to avoid drawing (and being skipped) by playing their own draw 2. The next player either needs to skip their turn and draw 4 cards, or play their own draw 2. If they play their own, the next player must either draw 6 cards or continue the sequence. Some variants all... | My family has never put a draw 4 ontop of a draw 2 we will only do that if it is agreed on and that is the rules of uno but you can play however you want to play |
841,759 | I just installed Ubuntu 16.10 on my Dell Vostro 5568 laptop.
Everything was working fine (good sound from the speakers). Then I
plugged my headphones (Koss) in the headset connector.
[](https://i.stack.imgur.com/3OVaS.png)
The audio controller on th... | 2016/10/25 | [
"https://askubuntu.com/questions/841759",
"https://askubuntu.com",
"https://askubuntu.com/users/156688/"
] | From Google chrome download page:
>
> **Note:** Installing Google Chrome will **add the Google repository** so your
> system will automatically keep Google Chrome up to date. If you don’t
> want Google's repository, do “`sudo touch /etc/default/google-chrome`”
> before installing the package.
>
>
>
So to fix i... | Google Chrome fails to install entry in /sources.list.d/ after install / upgrade to 16.10.
SEE: <https://bugs.chromium.org/p/chromium/issues/detail?id=660145>
AND: <https://github.com/keybase/client/commit/7894c1f57f3ca5ecb3b5fc87e4496769103b7fd4>
for possible **\* WORK-AROUNDS \*** till fixed by upstream. |
841,759 | I just installed Ubuntu 16.10 on my Dell Vostro 5568 laptop.
Everything was working fine (good sound from the speakers). Then I
plugged my headphones (Koss) in the headset connector.
[](https://i.stack.imgur.com/3OVaS.png)
The audio controller on th... | 2016/10/25 | [
"https://askubuntu.com/questions/841759",
"https://askubuntu.com",
"https://askubuntu.com/users/156688/"
] | From Google chrome download page:
>
> **Note:** Installing Google Chrome will **add the Google repository** so your
> system will automatically keep Google Chrome up to date. If you don’t
> want Google's repository, do “`sudo touch /etc/default/google-chrome`”
> before installing the package.
>
>
>
So to fix i... | The bug report for this can be found at <https://bugs.chromium.org/p/chromium/issues/detail?id=663069> and the cause is:
>
> In prior versions of Ubuntu/Debian the Dir::Etc apt-config variable
> contained a trailing slash by default. The cronjob at
> /etc/cron.daily/google-chrome was concatenating that variable int... |
841,759 | I just installed Ubuntu 16.10 on my Dell Vostro 5568 laptop.
Everything was working fine (good sound from the speakers). Then I
plugged my headphones (Koss) in the headset connector.
[](https://i.stack.imgur.com/3OVaS.png)
The audio controller on th... | 2016/10/25 | [
"https://askubuntu.com/questions/841759",
"https://askubuntu.com",
"https://askubuntu.com/users/156688/"
] | The bug report for this can be found at <https://bugs.chromium.org/p/chromium/issues/detail?id=663069> and the cause is:
>
> In prior versions of Ubuntu/Debian the Dir::Etc apt-config variable
> contained a trailing slash by default. The cronjob at
> /etc/cron.daily/google-chrome was concatenating that variable int... | Google Chrome fails to install entry in /sources.list.d/ after install / upgrade to 16.10.
SEE: <https://bugs.chromium.org/p/chromium/issues/detail?id=660145>
AND: <https://github.com/keybase/client/commit/7894c1f57f3ca5ecb3b5fc87e4496769103b7fd4>
for possible **\* WORK-AROUNDS \*** till fixed by upstream. |
2,883,301 | I have a QuestionControl.ascx and a QuestionControl.ascx.cs code behind file I copied to a new project. When I build the project any references in the code behind file to controls declared in the ascx gives me this error:
>
> 'QuestionControl' does not contain a
> definition for 'rdbtnlstQuestion1' and
> no extensi... | 2010/05/21 | [
"https://Stackoverflow.com/questions/2883301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84206/"
] | Try deleting your designer file. VS.NET should recreate it for you when you open the ascx file. I've had problems like this in the past where the designer gets out-of-sync for some reason, and deleting it usually fixes the problem. | Another solution is to:
* open your .ascx page in **design view**
* right click anywhere on the page and select **Refresh**
(.ascx.designer.cs file may need to to be closed while doing refresh for this to work) |
2,883,301 | I have a QuestionControl.ascx and a QuestionControl.ascx.cs code behind file I copied to a new project. When I build the project any references in the code behind file to controls declared in the ascx gives me this error:
>
> 'QuestionControl' does not contain a
> definition for 'rdbtnlstQuestion1' and
> no extensi... | 2010/05/21 | [
"https://Stackoverflow.com/questions/2883301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84206/"
] | Try deleting your designer file. VS.NET should recreate it for you when you open the ascx file. I've had problems like this in the past where the designer gets out-of-sync for some reason, and deleting it usually fixes the problem. | I had problems for example creating a dropdownlist inside a gridview. What I did is creating the ddl outside of the gv until the desinger.cs recognized it and afterwards moved the control inside the gv... hope this helps |
2,883,301 | I have a QuestionControl.ascx and a QuestionControl.ascx.cs code behind file I copied to a new project. When I build the project any references in the code behind file to controls declared in the ascx gives me this error:
>
> 'QuestionControl' does not contain a
> definition for 'rdbtnlstQuestion1' and
> no extensi... | 2010/05/21 | [
"https://Stackoverflow.com/questions/2883301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84206/"
] | In VS2017 there is no option 'Convert to Web Application' in the context menu of the .ascx file. Instead you need to select to .ascx file then click on 'Project' in the upper menu and select 'Convert to Web Application' (which is all the way down in the Project menu. | I had problems for example creating a dropdownlist inside a gridview. What I did is creating the ddl outside of the gv until the desinger.cs recognized it and afterwards moved the control inside the gv... hope this helps |
2,883,301 | I have a QuestionControl.ascx and a QuestionControl.ascx.cs code behind file I copied to a new project. When I build the project any references in the code behind file to controls declared in the ascx gives me this error:
>
> 'QuestionControl' does not contain a
> definition for 'rdbtnlstQuestion1' and
> no extensi... | 2010/05/21 | [
"https://Stackoverflow.com/questions/2883301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84206/"
] | Try deleting your designer file. VS.NET should recreate it for you when you open the ascx file. I've had problems like this in the past where the designer gets out-of-sync for some reason, and deleting it usually fixes the problem. | In VS2017 there is no option 'Convert to Web Application' in the context menu of the .ascx file. Instead you need to select to .ascx file then click on 'Project' in the upper menu and select 'Convert to Web Application' (which is all the way down in the Project menu. |
2,883,301 | I have a QuestionControl.ascx and a QuestionControl.ascx.cs code behind file I copied to a new project. When I build the project any references in the code behind file to controls declared in the ascx gives me this error:
>
> 'QuestionControl' does not contain a
> definition for 'rdbtnlstQuestion1' and
> no extensi... | 2010/05/21 | [
"https://Stackoverflow.com/questions/2883301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84206/"
] | In VS2017 there is no option 'Convert to Web Application' in the context menu of the .ascx file. Instead you need to select to .ascx file then click on 'Project' in the upper menu and select 'Convert to Web Application' (which is all the way down in the Project menu. | What worked form me was listed on another SO answer and I can't find it so I'm repeating it here.
Try deleting your "ReflectedSchemas" folder in
C:\Users\YOURUSENAME\AppData\Roaming\Microsoft\VisualStudio\15.0\_079f391b\ReflectedSchemas
This worked for me. Sometimes I get the "unrecognized" errors, and I delete thi... |
2,883,301 | I have a QuestionControl.ascx and a QuestionControl.ascx.cs code behind file I copied to a new project. When I build the project any references in the code behind file to controls declared in the ascx gives me this error:
>
> 'QuestionControl' does not contain a
> definition for 'rdbtnlstQuestion1' and
> no extensi... | 2010/05/21 | [
"https://Stackoverflow.com/questions/2883301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84206/"
] | In VS2017 there is no option 'Convert to Web Application' in the context menu of the .ascx file. Instead you need to select to .ascx file then click on 'Project' in the upper menu and select 'Convert to Web Application' (which is all the way down in the Project menu. | I was having the same issue, the code-behind didn't recognize the controls on the .aspx page. I'm using VS 2012. I right-clicked the project; clicked on Convert to Web Application; and it added all the designer files that weren't there at all before. I rebuilt everything and it's good now. |
2,883,301 | I have a QuestionControl.ascx and a QuestionControl.ascx.cs code behind file I copied to a new project. When I build the project any references in the code behind file to controls declared in the ascx gives me this error:
>
> 'QuestionControl' does not contain a
> definition for 'rdbtnlstQuestion1' and
> no extensi... | 2010/05/21 | [
"https://Stackoverflow.com/questions/2883301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84206/"
] | Another solution is to:
* open your .ascx page in **design view**
* right click anywhere on the page and select **Refresh**
(.ascx.designer.cs file may need to to be closed while doing refresh for this to work) | What worked form me was listed on another SO answer and I can't find it so I'm repeating it here.
Try deleting your "ReflectedSchemas" folder in
C:\Users\YOURUSENAME\AppData\Roaming\Microsoft\VisualStudio\15.0\_079f391b\ReflectedSchemas
This worked for me. Sometimes I get the "unrecognized" errors, and I delete thi... |
2,883,301 | I have a QuestionControl.ascx and a QuestionControl.ascx.cs code behind file I copied to a new project. When I build the project any references in the code behind file to controls declared in the ascx gives me this error:
>
> 'QuestionControl' does not contain a
> definition for 'rdbtnlstQuestion1' and
> no extensi... | 2010/05/21 | [
"https://Stackoverflow.com/questions/2883301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84206/"
] | What worked form me was listed on another SO answer and I can't find it so I'm repeating it here.
Try deleting your "ReflectedSchemas" folder in
C:\Users\YOURUSENAME\AppData\Roaming\Microsoft\VisualStudio\15.0\_079f391b\ReflectedSchemas
This worked for me. Sometimes I get the "unrecognized" errors, and I delete thi... | I was having the same issue, the code-behind didn't recognize the controls on the .aspx page. I'm using VS 2012. I right-clicked the project; clicked on Convert to Web Application; and it added all the designer files that weren't there at all before. I rebuilt everything and it's good now. |
2,883,301 | I have a QuestionControl.ascx and a QuestionControl.ascx.cs code behind file I copied to a new project. When I build the project any references in the code behind file to controls declared in the ascx gives me this error:
>
> 'QuestionControl' does not contain a
> definition for 'rdbtnlstQuestion1' and
> no extensi... | 2010/05/21 | [
"https://Stackoverflow.com/questions/2883301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84206/"
] | Another solution is to:
* open your .ascx page in **design view**
* right click anywhere on the page and select **Refresh**
(.ascx.designer.cs file may need to to be closed while doing refresh for this to work) | I was having the same issue, the code-behind didn't recognize the controls on the .aspx page. I'm using VS 2012. I right-clicked the project; clicked on Convert to Web Application; and it added all the designer files that weren't there at all before. I rebuilt everything and it's good now. |
2,883,301 | I have a QuestionControl.ascx and a QuestionControl.ascx.cs code behind file I copied to a new project. When I build the project any references in the code behind file to controls declared in the ascx gives me this error:
>
> 'QuestionControl' does not contain a
> definition for 'rdbtnlstQuestion1' and
> no extensi... | 2010/05/21 | [
"https://Stackoverflow.com/questions/2883301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84206/"
] | Try deleting your designer file. VS.NET should recreate it for you when you open the ascx file. I've had problems like this in the past where the designer gets out-of-sync for some reason, and deleting it usually fixes the problem. | What worked form me was listed on another SO answer and I can't find it so I'm repeating it here.
Try deleting your "ReflectedSchemas" folder in
C:\Users\YOURUSENAME\AppData\Roaming\Microsoft\VisualStudio\15.0\_079f391b\ReflectedSchemas
This worked for me. Sometimes I get the "unrecognized" errors, and I delete thi... |
3,007,652 | Rather than displaying a PNG in the browser window, I'd like the action result to trigger the file download dialogue box (you know the open, save as, etc). I can get this to work with the code below using an unknown content type, but the user then has to type in .png at the end of the file name. How can I accomplish th... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3007652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55747/"
] | I believe you can control this with the content-disposition header.
```
Response.AddHeader(
"Content-Disposition", "attachment; filename=\"filenamehere.png\"");
``` | I actually came here because I was looking for the opposite effect.
```
public ActionResult ViewFile()
{
string contentType = "Image/jpeg";
byte[] data = this.FileServer("FileLocation");
if (data == null)
{
return this.Content("No picture for this program.");
... |
3,007,652 | Rather than displaying a PNG in the browser window, I'd like the action result to trigger the file download dialogue box (you know the open, save as, etc). I can get this to work with the code below using an unknown content type, but the user then has to type in .png at the end of the file name. How can I accomplish th... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3007652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55747/"
] | You need to set the following headers on the response:
* `Content-Disposition: attachment; filename="myfile.png"`
* `Content-Type: application/force-download` | The correct way to download file in your case is to use `FileResult` class.
```
public FileResult DownloadFile(string id)
{
try
{
byte[] imageBytes = ANY IMAGE SOURCE (PNG)
MemoryStream ms = new MemoryStream(imageBytes);
var image = System.Drawing.Image.FromStream(ms);
image.Save(ms, System.Drawing.I... |
3,007,652 | Rather than displaying a PNG in the browser window, I'd like the action result to trigger the file download dialogue box (you know the open, save as, etc). I can get this to work with the code below using an unknown content type, but the user then has to type in .png at the end of the file name. How can I accomplish th... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3007652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55747/"
] | You need to set the following headers on the response:
* `Content-Disposition: attachment; filename="myfile.png"`
* `Content-Type: application/force-download` | With MVC I use a [FileResult](http://msdn.microsoft.com/en-us/library/system.web.mvc.fileresult%28v=vs.108%29.aspx) and return a [FilePathResult](http://msdn.microsoft.com/en-us/library/system.web.mvc.filepathresult%28v=vs.108%29.aspx)
```
public FileResult ImageDownload(int id)
{
var image = context.Image... |
3,007,652 | Rather than displaying a PNG in the browser window, I'd like the action result to trigger the file download dialogue box (you know the open, save as, etc). I can get this to work with the code below using an unknown content type, but the user then has to type in .png at the end of the file name. How can I accomplish th... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3007652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55747/"
] | You need to set the following headers on the response:
* `Content-Disposition: attachment; filename="myfile.png"`
* `Content-Type: application/force-download` | This I actually @7072k3
```
var result = File(path, mimeType, fileName);
Response.ContentType = mimeType;
Response.AddHeader("Content-Disposition", "inline");
return result;
```
Copied that from my working code.
This still uses the standard ActionResult return type. |
3,007,652 | Rather than displaying a PNG in the browser window, I'd like the action result to trigger the file download dialogue box (you know the open, save as, etc). I can get this to work with the code below using an unknown content type, but the user then has to type in .png at the end of the file name. How can I accomplish th... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3007652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55747/"
] | I believe you can control this with the content-disposition header.
```
Response.AddHeader(
"Content-Disposition", "attachment; filename=\"filenamehere.png\"");
``` | With MVC I use a [FileResult](http://msdn.microsoft.com/en-us/library/system.web.mvc.fileresult%28v=vs.108%29.aspx) and return a [FilePathResult](http://msdn.microsoft.com/en-us/library/system.web.mvc.filepathresult%28v=vs.108%29.aspx)
```
public FileResult ImageDownload(int id)
{
var image = context.Image... |
3,007,652 | Rather than displaying a PNG in the browser window, I'd like the action result to trigger the file download dialogue box (you know the open, save as, etc). I can get this to work with the code below using an unknown content type, but the user then has to type in .png at the end of the file name. How can I accomplish th... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3007652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55747/"
] | I actually came here because I was looking for the opposite effect.
```
public ActionResult ViewFile()
{
string contentType = "Image/jpeg";
byte[] data = this.FileServer("FileLocation");
if (data == null)
{
return this.Content("No picture for this program.");
... | The correct way to download file in your case is to use `FileResult` class.
```
public FileResult DownloadFile(string id)
{
try
{
byte[] imageBytes = ANY IMAGE SOURCE (PNG)
MemoryStream ms = new MemoryStream(imageBytes);
var image = System.Drawing.Image.FromStream(ms);
image.Save(ms, System.Drawing.I... |
3,007,652 | Rather than displaying a PNG in the browser window, I'd like the action result to trigger the file download dialogue box (you know the open, save as, etc). I can get this to work with the code below using an unknown content type, but the user then has to type in .png at the end of the file name. How can I accomplish th... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3007652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55747/"
] | I actually came here because I was looking for the opposite effect.
```
public ActionResult ViewFile()
{
string contentType = "Image/jpeg";
byte[] data = this.FileServer("FileLocation");
if (data == null)
{
return this.Content("No picture for this program.");
... | With MVC I use a [FileResult](http://msdn.microsoft.com/en-us/library/system.web.mvc.fileresult%28v=vs.108%29.aspx) and return a [FilePathResult](http://msdn.microsoft.com/en-us/library/system.web.mvc.filepathresult%28v=vs.108%29.aspx)
```
public FileResult ImageDownload(int id)
{
var image = context.Image... |
3,007,652 | Rather than displaying a PNG in the browser window, I'd like the action result to trigger the file download dialogue box (you know the open, save as, etc). I can get this to work with the code below using an unknown content type, but the user then has to type in .png at the end of the file name. How can I accomplish th... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3007652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55747/"
] | With MVC I use a [FileResult](http://msdn.microsoft.com/en-us/library/system.web.mvc.fileresult%28v=vs.108%29.aspx) and return a [FilePathResult](http://msdn.microsoft.com/en-us/library/system.web.mvc.filepathresult%28v=vs.108%29.aspx)
```
public FileResult ImageDownload(int id)
{
var image = context.Image... | This I actually @7072k3
```
var result = File(path, mimeType, fileName);
Response.ContentType = mimeType;
Response.AddHeader("Content-Disposition", "inline");
return result;
```
Copied that from my working code.
This still uses the standard ActionResult return type. |
3,007,652 | Rather than displaying a PNG in the browser window, I'd like the action result to trigger the file download dialogue box (you know the open, save as, etc). I can get this to work with the code below using an unknown content type, but the user then has to type in .png at the end of the file name. How can I accomplish th... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3007652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55747/"
] | I actually came here because I was looking for the opposite effect.
```
public ActionResult ViewFile()
{
string contentType = "Image/jpeg";
byte[] data = this.FileServer("FileLocation");
if (data == null)
{
return this.Content("No picture for this program.");
... | This I actually @7072k3
```
var result = File(path, mimeType, fileName);
Response.ContentType = mimeType;
Response.AddHeader("Content-Disposition", "inline");
return result;
```
Copied that from my working code.
This still uses the standard ActionResult return type. |
3,007,652 | Rather than displaying a PNG in the browser window, I'd like the action result to trigger the file download dialogue box (you know the open, save as, etc). I can get this to work with the code below using an unknown content type, but the user then has to type in .png at the end of the file name. How can I accomplish th... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3007652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55747/"
] | I believe you can control this with the content-disposition header.
```
Response.AddHeader(
"Content-Disposition", "attachment; filename=\"filenamehere.png\"");
``` | You need to set the following headers on the response:
* `Content-Disposition: attachment; filename="myfile.png"`
* `Content-Type: application/force-download` |
47,735,675 | I have a problem whereby my VirtualHost is overriding another VirtualHost on the same domain.
httpd.conf
```
IncludeOptional conf.d/*.conf
```
example.conf
```
<VirtualHost *:80>
DocumentRoot /var/www/html/example/
ServerName www.example.com
ServerAlias www.example.com
Redirect permanen... | 2017/12/10 | [
"https://Stackoverflow.com/questions/47735675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1416628/"
] | Found out that I need to include the non-www for the VirtualHost as well. It works if I entered `www.example.com` but not `example.com`.
```
<VirtualHost *:80>
ServerName example.com
Redirect permanent / http://www.example.com/
</VirtualHost>
``` | Try to change the order of `ServerName` and `ServerAlias` to your get.example.conf:
```
<VirtualHost *:80>
ServerName get.example.com
ServerAlias get.example.com
DocumentRoot /var/www/html/get.example/
</VirtualHost>
``` |
47,735,675 | I have a problem whereby my VirtualHost is overriding another VirtualHost on the same domain.
httpd.conf
```
IncludeOptional conf.d/*.conf
```
example.conf
```
<VirtualHost *:80>
DocumentRoot /var/www/html/example/
ServerName www.example.com
ServerAlias www.example.com
Redirect permanen... | 2017/12/10 | [
"https://Stackoverflow.com/questions/47735675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1416628/"
] | You just have to set up de ServerAlias.
In your example, it should be enough to do as follow:
```
<VirtualHost *:80>
DocumentRoot /var/www/html/example/
ServerName example.com
ServerAlias www.example.com
Redirect permanent / https://www.example.com/
</VirtualHost>
```
Note that **ServerNa... | Try to change the order of `ServerName` and `ServerAlias` to your get.example.conf:
```
<VirtualHost *:80>
ServerName get.example.com
ServerAlias get.example.com
DocumentRoot /var/www/html/get.example/
</VirtualHost>
``` |
52,679,764 | I want to have 3 View Controllers; A, B, and C. View Controller A will be where the final value gets displayed, or the Main View Controller. View Controller B and View Controller C will have simple Text Fields as inputs. The values you put into the Text Fields in View Controller B and C will be added together and shown... | 2018/10/06 | [
"https://Stackoverflow.com/questions/52679764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10465810/"
] | You can achieve that in two ways.
1. You can set controlsList="nodownload" on the video tag to no show the download button
or You can use css to hide the the button. If you post the live video url then it would be easy to debug | I think it would help you Please put it in you Inframe tag.
```
<iframe class="embed-responsive-item" src="{{ asset("/tes.mp4") }}" controlsList="nodownload">
```
Usually It uses within `<video controls controlsList="nodownload nofullscreen">` tag, I think that would work as well!
Cheer you! |
29,447,914 | Here's what I have so far...
```
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="main.css"/>
<title>Tommay's Super Secret Database</title>
</head>
<body>
<p id="q">Establishing connection</p>
<p id="w">Checking the time</p>
<p id="e">Doing other stuff</p>
<p id="r">Locating cows</p>
... | 2015/04/04 | [
"https://Stackoverflow.com/questions/29447914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4292461/"
] | I went in a different direction in solving this.
I suggest using only one element and filling and emptying it with javascript.
HTML:
```
<html>
<head>
<title>Tommay's Super Secret Database</title>
</head>
<body>
<p id="loader"></p>
</body>
</html>
```
I left your CSS alone, only difference is that I change... | What I've done here is actually adding a style to your element (you didn't had one).
Also I've corrected a typo in your CSS. You've written "dsplay" instead of "display".
However, this should work:
```js
var q = document.getElementById("q");
var qdisplay = q.style.display;
window.onload = active();
function act... |
6,297,671 | In c++, is it *possible* to declare inner class (CInner) such that it has outer class (COuter) as its base class ?
This question is about c++ technicalities. Not question of programming style or personal preferences. | 2011/06/09 | [
"https://Stackoverflow.com/questions/6297671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564524/"
] | Yes. This compiles:
```
class COuter
{
class CInner;
};
class COuter::CInner : public COuter
{
};
```
The reason this is required is that a derived class requires that the entire definition be present for its own definition. So you just need to make sure that the outer class is completely defined before the inn... | The following code compiles and runs fine:
```
#include <iostream>
using namespace std;
class COuter
{
public:
COuter ()
{
cout << "COuter() called" << endl;
}
class CInner;
};
class COuter::CInner : public COuter
{
public:
CInner()
{
cout << "COuter::CInner() called" << endl;
}
}... |
6,297,671 | In c++, is it *possible* to declare inner class (CInner) such that it has outer class (COuter) as its base class ?
This question is about c++ technicalities. Not question of programming style or personal preferences. | 2011/06/09 | [
"https://Stackoverflow.com/questions/6297671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564524/"
] | Yes. This compiles:
```
class COuter
{
class CInner;
};
class COuter::CInner : public COuter
{
};
```
The reason this is required is that a derived class requires that the entire definition be present for its own definition. So you just need to make sure that the outer class is completely defined before the inn... | It's possible to declare inner/nested class derived from enclosing class. but you can't define your nested class at the same time. for example, if you try to compile this code, it'll throw invalid use of incomplete type COuter.
```
class COuter
{
class CInnner : COuter
{
}
}
```
but if you just declar... |
6,297,671 | In c++, is it *possible* to declare inner class (CInner) such that it has outer class (COuter) as its base class ?
This question is about c++ technicalities. Not question of programming style or personal preferences. | 2011/06/09 | [
"https://Stackoverflow.com/questions/6297671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564524/"
] | It's possible to declare inner/nested class derived from enclosing class. but you can't define your nested class at the same time. for example, if you try to compile this code, it'll throw invalid use of incomplete type COuter.
```
class COuter
{
class CInnner : COuter
{
}
}
```
but if you just declar... | The following code compiles and runs fine:
```
#include <iostream>
using namespace std;
class COuter
{
public:
COuter ()
{
cout << "COuter() called" << endl;
}
class CInner;
};
class COuter::CInner : public COuter
{
public:
CInner()
{
cout << "COuter::CInner() called" << endl;
}
}... |
54,934,610 | I'm having trouble using Django's `update_or_create` method on the model below. I get this error:
>
> ValueError: invalid literal for int() with base 10: ' '
>
>
>
The error seems to always throw on the last line of the `update_or_create`, because when I added `verified=False` (which has a default value of False)... | 2019/02/28 | [
"https://Stackoverflow.com/questions/54934610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10746224/"
] | Address.customer is an object, not a mere id. In order to populate it, you need to retrieve it from the database. Therefore:
```
Customer.objects.get(customer_id)
```
Hope that helps. | Thanks to @hd1, I was able to figure this out. I had 3 things wrong with the `Addresses.objects.update_or_create`
* I was passing in a customer primary key instead of a customer object (hd1's answer)
* I wasn't setting a value for the required `zip` field
* The phone number column exceeded the max length for its value... |
39,694,706 | I have an array which is returned from server and displays the items by using \*ngFor in a table. After I process the selected item then I will delete it from the array. The view does not removed the deleted item automatically. However, if click on the sort function from the table header, the deleted item will be remov... | 2016/09/26 | [
"https://Stackoverflow.com/questions/39694706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6865513/"
] | The view needs to be notified the changes in the array. To do that we could use ChangeDetectorRef and ChangeDetectorRef.markForCheck().
Thanks for Marj Rajcok mentioned about detechChanges() in his answers on Angular 2 -View not updating after model changes [Angular 2 - View not updating after model changes](https://st... | if providers:[] is used, make sure you are not using providers[] in each component. If same instance is needed across the components give providers[] only in parent component. |
278,749 | I'm trying to update all my packages, so I ran:
`emerge -aUDU --with-bdeps=y --verbose-conflicts @world`
and I found a few package conflicts. Interestingly enough though, is that it has scheduled two different versions of the `dev-lang/perl` package to install:
```
dev-lang/perl:0
(dev-lang/perl-5.22.1:0/5.22::ge... | 2016/04/24 | [
"https://unix.stackexchange.com/questions/278749",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/141848/"
] | Using
`EIX_LIMIT=0 emerge -1auvDNt -j2 --verbose-conflicts =dev-lang/perl-5.22* $(eix '-I#' virtual/perl-*)`
I was able to update Perl from 5.20 to 5.22 on my system.
Source: <https://forums.gentoo.org/viewtopic-p-7593286.html#7593286> | This is what worked for me, nothing else worked:
```
#!/bin/bash
# unmerge perl virtuals
emerge --unmerge $(qlist --installed virtual/perl)
# print perl blockers and quit
if emerge -pq dev-lang/perl:0 2>/dev/null | grep blocks
then
echo
echo "unmerge packages blocking perl upgrade"
exit 1
el... |
79,891 | I want to make a link that goes to wp-login.php for whatever domain I'm at now. Something like:
```
<a href="http://<script>document.write(document.domain);</script>/wp-login.php">Login</a>
```
But I don't know how to write / format that properly. | 2013/01/09 | [
"https://wordpress.stackexchange.com/questions/79891",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/24421/"
] | Write a small plugin, use the follow example source to add a item in the list of the left sidebar in the media manager inside the overlay popup.
Result of the source below:

```
add_action( 'admin_footer-post-new.php', 'wpse_78881_script' );
add_acti... | Thomas Griffin created a plugin example, [New Media Image Uploader](https://github.com/thomasgriffin/New-Media-Image-Uploader), on how to work with the new media manager.
>
> *This plugin provides a solid example for integrating the new media manager workflow into your plugins/themes by showing you how to upload/inse... |
79,891 | I want to make a link that goes to wp-login.php for whatever domain I'm at now. Something like:
```
<a href="http://<script>document.write(document.domain);</script>/wp-login.php">Login</a>
```
But I don't know how to write / format that properly. | 2013/01/09 | [
"https://wordpress.stackexchange.com/questions/79891",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/24421/"
] | This block of code will add a button right next to the "Insert into post" one. When clicked, it will send selected images to WP editor, each wrapped inside your template HTML:
```
var wpMediaFramePost = wp.media.view.MediaFrame.Post;
wp.media.view.MediaFrame.Post = wpMediaFramePost.extend(
{
mainInsertToolbar: fun... | Thomas Griffin created a plugin example, [New Media Image Uploader](https://github.com/thomasgriffin/New-Media-Image-Uploader), on how to work with the new media manager.
>
> *This plugin provides a solid example for integrating the new media manager workflow into your plugins/themes by showing you how to upload/inse... |
79,891 | I want to make a link that goes to wp-login.php for whatever domain I'm at now. Something like:
```
<a href="http://<script>document.write(document.domain);</script>/wp-login.php">Login</a>
```
But I don't know how to write / format that properly. | 2013/01/09 | [
"https://wordpress.stackexchange.com/questions/79891",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/24421/"
] | Write a small plugin, use the follow example source to add a item in the list of the left sidebar in the media manager inside the overlay popup.
Result of the source below:

```
add_action( 'admin_footer-post-new.php', 'wpse_78881_script' );
add_acti... | I do not have a full answer to your question, but here is a good start.
To customize the new Media Manager, you should study the javascript Backbone code in `wp-includes/js/media-views.js`.
For exemple, here is a small plugin that adds a "Select All" button to the "Insert from URL" Toolbar :
`custom.php`:
```
add_ac... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.