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 |
|---|---|---|---|---|---|
41,786,278 | I've tried adding JAVA\_HOME with the directory - C:\Program Files\Java\jdk1.8.0\_121 to my system variables, and then adding %JAVA\_HOME%/bin to Path variable and this didn't work and I receive
>
> 'java' is not recognized as an internal or external command, operable
> program or batch file.
>
>
>
So I've trie... | 2017/01/22 | [
"https://Stackoverflow.com/questions/41786278",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6321773/"
] | Did you try closing that command prompt and reopening it? | In the command line, run the following:
`set PATH=%PATH%:C:\Program Files\Java\jdk1.8.0_121\bin`
Without exiting the shell, run your java commands
E.g.
`java -version`
This will surely work. |
37,516,491 | I am running git commands remotely through the SSH protocol as the server doesn't accept HTTPS. I am running it through a bash script and would prefer if I could pass in a username and password as variables.
More specifically, I am doing a migrate of repositories and am having issues when running
```
git remote add ... | 2016/05/30 | [
"https://Stackoverflow.com/questions/37516491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4727710/"
] | Assuming you're using a recent version of Git, you can use the `GIT_SSH_COMMAND` environment variable:
>
>
> ```
> GIT_SSH, GIT_SSH_COMMAND
>
> If either of these environment variables is set then git fetch
> and git push will use the specified command instead of ssh when
> they need to connect ... | 1. Another way would be to use the credentials binding plugin. This plugin allows credentials to be bound to environment variables to use from miscellaneous build steps.
2. You could always just login to the remote box and add the Github credentials manually
Cheers |
1,201,312 | $D: \begin{bmatrix}1&4.19\\2&3.40\\3&2.80\\4&2.30\\5&1.99\\6&1.70\\7&1.51\\8&1.34\\9&1.21\\10&1.09\end{bmatrix}$
In this table of data the first column is representing time (in minutes), and the second column is the mass of some element.
* The element consists of two types of isotopes that decay rapidly.
* The first... | 2015/03/22 | [
"https://math.stackexchange.com/questions/1201312",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/174557/"
] | **Hint 1:** $t \mapsto (1-x)/(1+x)$
>
> $$\begin{equation}\displaystyle\int\frac{x-1}{(x+1)\sqrt{x+x^2+x^3}}\,\mathrm{d}x = 2\arccos\left(\frac{\sqrt{x}} {x+1}\right) + \mathcal{C}\end{equation}$$
>
>
>
**Hint 2:** One can show that $t = (1-x)/(1+x)$ is it's own inverse. In other words $x = (1-t)/(1+t)$. Hence t... | $\bf{My\; Solution::}$ Given $$\displaystyle \int \frac{1-x}{(1+x)\sqrt{x+x^2+x^3}}dx = -\int\frac{(x^2-1)}{(x+1)^2\sqrt{x+x^2+x^3}}dx$$
We can Write it as $$\displaystyle -\int\frac{\left(1-\frac{1}{x^2}\right)}{\left(x+\frac{1}{x}+2\right)\sqrt{x+\frac{1}{x}+1}}dx$$
Now Let $$\displaystyle \left(x+\frac{1}{x}+1\rig... |
68,486,025 | I'm trying to add validation to my route in a fastapi server, followed the instructions [here](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/) and managed to have added validation on my int path parameters like so:
```
route1 = router.get("/start={start:int}/end={end:int}")(route1_func)
```
a... | 2021/07/22 | [
"https://Stackoverflow.com/questions/68486025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14952079/"
] | You can put path params & query params in a Pydantic class, and add the whole class as a function argument with `= Depends()` after it. The FastAPI docs barely mention this functionality, but it does work.
Then, once you have your args in a Pydantic class, you can easily use Pydantic validators for custom validation.
... | You can use your validator function as dependency. The function parameters must be the same as in the path
```
def check(start: int, end: int):
print(start, end)
if start > end:
raise HTTPException(status_code=400, detail='error message')
@router.get('/{start}/{end}', dependencies=[Depends(check)])
as... |
42,088,715 | I'm using word2vec model to build a classifier on training data set and wonder what are technics to deal with unseen terms (words) in the test data.
Removing new terms doesn't seem like a best approach.
My current thought is to recalculate word2vec on combined data set (training + test) and replace new terms with near... | 2017/02/07 | [
"https://Stackoverflow.com/questions/42088715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6077279/"
] | To get document without having name is N3 of properties use [$ne](https://docs.mongodb.com/v3.2/reference/operator/query/ne/#ne) (*not equal*) operator
```
db.collectionName.find( { "properties.name": { $ne: "N3" } } )
```
**Updated:**
You need to use aggregate query to get all record with properties only discard ... | Try to use the [`$ne`](https://docs.mongodb.com/v3.2/reference/operator/query/ne/) operator. You should be able to formulate a query using this keyword. |
92,711 | I've read on a Twitter support page that when we block a user that user will be notified that he/she has been blocked. My question is: when I block a user, that user will still be able to see my profile? Is there a way to prevent users from viewing my profile permanently? | 2016/05/11 | [
"https://webapps.stackexchange.com/questions/92711",
"https://webapps.stackexchange.com",
"https://webapps.stackexchange.com/users/123448/"
] | >
> How to change comma to dot?
>
>
>
Use Edit, Find and Replace...
[](https://i.stack.imgur.com/OzrSP.jpg)
However the result is a text string, so you might need to substitute dot with comma if to calculate with the result. | Go to "File" > "Spreadsheet settings" and modify the "Locale". |
117,945 | I need to put a letter under the min symbol in the equation below but i couldn't do it,It now looks like this:

and I need it to look like this:

```
\begin{document}
\begin{equatio... | 2013/06/06 | [
"https://tex.stackexchange.com/questions/117945",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/28377/"
] | ```
\begin{document}
\begin{equation}
\min_A\sum^{N}_{i=1}\sum^{N}_{j=1}|y_i - y_j|^2 W_{ij}
\label{eqn4}
\end{equation}
\end{document}
``` | To add to Przemysław Scherwent's answer, in the case you want to use an operator that is not already defined, you can use `\operatorname{}` or `\operatorname*{}` from the `amsmath` package.
The former displays its argument like an operator -- like `sin`, for example --, and the latter does the same, but the followin... |
27,351,064 | I have a class that makes car objects. It has two instance variables: Make and Color. I am having an issue calling this method within the workspace (noted below)
Class Method -Constructor
```
make: aMake color: aColor
"Creates a new car object, sets its instance variables by the arguments"
|car|
car := se... | 2014/12/08 | [
"https://Stackoverflow.com/questions/27351064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2249815/"
] | Everything looks alright. The likely gotcha would be that your "constructor" (which would more likely be called an "instance creation message" in Smalltalk) needs to be implemented on the class side, and you may have done so on the instance side. Conversely, your set... must be on the instance side. Which message is no... | I notice two additional issues with your code:
* in smalltalk we don't use 'set' for setters
* the instance variables have a lowercase initial.
So the initializer would be
```
make: aMake color: aColor
"sets the instance variables"
make := aMake.
color := aColor.
``` |
27,351,064 | I have a class that makes car objects. It has two instance variables: Make and Color. I am having an issue calling this method within the workspace (noted below)
Class Method -Constructor
```
make: aMake color: aColor
"Creates a new car object, sets its instance variables by the arguments"
|car|
car := se... | 2014/12/08 | [
"https://Stackoverflow.com/questions/27351064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2249815/"
] | Everything looks alright. The likely gotcha would be that your "constructor" (which would more likely be called an "instance creation message" in Smalltalk) needs to be implemented on the class side, and you may have done so on the instance side. Conversely, your set... must be on the instance side. Which message is no... | The reference book for doing all of these things right is:
[http://www.amazon.com/Smalltalk-Best-Practice-Patterns-Kent/dp/013476904X](https://rads.stackoverflow.com/amzn/click/com/013476904X)
Click on the "Look Inside" picture and you'll be able to get to the table of contents and the constructor method receipe.
I ... |
41,601,636 | When I try to run this Python script, the following happens:
```
$ python mlp_training.py
Loading training data...
(0, 38400)
(0, 4)
Loading image duration: 0.000199834
Training MLP ...
Traceback (most recent call last):
File "mlp_training.py", line 49, in <module>
num_iter = model.train((train, ( train_labels )... | 2017/01/11 | [
"https://Stackoverflow.com/questions/41601636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7405626/"
] | See code from [mlp\_training.py](https://github.com/hamuchiwa/AutoRCCar/blob/master/computer/mlp_training.py)
```
num_iter = model.train(train, train_labels, None, params = params)
```
It runs `train()` with 4 arguments but you run with only one - tuple
```
model.train( (train, ( train_labels ), ( params )) )
... | You are passing the arguments to `model.train` as a tuple. It therefore sees only one argument, but checks for 2 or more. Instead try
```
num_iter = model.train(train, train_labels, params=params)
``` |
11,906,219 | I have a question on my mind. Let's assume that I have two parameters passed to JVM:
-Xms256mb -Xmx1024mb
At the beginning of the program 256MB is allocated. Next, some objects are created and JVM process tries to allocate more memory. Let's say that JVM needs to allocate 800MB. Xmx attribute allows that but the memory... | 2012/08/10 | [
"https://Stackoverflow.com/questions/11906219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275053/"
] | Allocation depends on the used OS.
If you allocate too much memory, maybe you could end up having loaded portions into swap, which is slow.
If the your program runs fater os slower depends on how VM handle the memory.
I would not specify a heap that's not so big to make sure it don't occupy all the memory preventing ... | Concerning your first question:
Actually if the machine can not allocate the `1024` MB that you asked as max heap size it will not even start the JVM.
I know this because I noticed it often trying to open eclipse with large heap size and the OS could not allocate the larger heap space the JVM failed to load. You ... |
11,906,219 | I have a question on my mind. Let's assume that I have two parameters passed to JVM:
-Xms256mb -Xmx1024mb
At the beginning of the program 256MB is allocated. Next, some objects are created and JVM process tries to allocate more memory. Let's say that JVM needs to allocate 800MB. Xmx attribute allows that but the memory... | 2012/08/10 | [
"https://Stackoverflow.com/questions/11906219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275053/"
] | The quality of the GC (barring a buggy GC) does not affect memory leaks, as memory leaks are an artifact of the application -- GC can't collect what isn't actual garbage.
If a JVM needs more memory, it will take it from the system. If the system can swap, it will swap (like any other process). If the system can not sw... | Concerning your first question:
Actually if the machine can not allocate the `1024` MB that you asked as max heap size it will not even start the JVM.
I know this because I noticed it often trying to open eclipse with large heap size and the OS could not allocate the larger heap space the JVM failed to load. You ... |
11,906,219 | I have a question on my mind. Let's assume that I have two parameters passed to JVM:
-Xms256mb -Xmx1024mb
At the beginning of the program 256MB is allocated. Next, some objects are created and JVM process tries to allocate more memory. Let's say that JVM needs to allocate 800MB. Xmx attribute allows that but the memory... | 2012/08/10 | [
"https://Stackoverflow.com/questions/11906219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275053/"
] | "Memory" and "RAM" aren't the same thing. Memory includes virtual memory (swap), so you can allocate a total of free RAM+ free swap before you get the OutOfMemoryError. | Concerning your first question:
Actually if the machine can not allocate the `1024` MB that you asked as max heap size it will not even start the JVM.
I know this because I noticed it often trying to open eclipse with large heap size and the OS could not allocate the larger heap space the JVM failed to load. You ... |
11,906,219 | I have a question on my mind. Let's assume that I have two parameters passed to JVM:
-Xms256mb -Xmx1024mb
At the beginning of the program 256MB is allocated. Next, some objects are created and JVM process tries to allocate more memory. Let's say that JVM needs to allocate 800MB. Xmx attribute allows that but the memory... | 2012/08/10 | [
"https://Stackoverflow.com/questions/11906219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275053/"
] | The quality of the GC (barring a buggy GC) does not affect memory leaks, as memory leaks are an artifact of the application -- GC can't collect what isn't actual garbage.
If a JVM needs more memory, it will take it from the system. If the system can swap, it will swap (like any other process). If the system can not sw... | Allocation depends on the used OS.
If you allocate too much memory, maybe you could end up having loaded portions into swap, which is slow.
If the your program runs fater os slower depends on how VM handle the memory.
I would not specify a heap that's not so big to make sure it don't occupy all the memory preventing ... |
11,906,219 | I have a question on my mind. Let's assume that I have two parameters passed to JVM:
-Xms256mb -Xmx1024mb
At the beginning of the program 256MB is allocated. Next, some objects are created and JVM process tries to allocate more memory. Let's say that JVM needs to allocate 800MB. Xmx attribute allows that but the memory... | 2012/08/10 | [
"https://Stackoverflow.com/questions/11906219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275053/"
] | "Memory" and "RAM" aren't the same thing. Memory includes virtual memory (swap), so you can allocate a total of free RAM+ free swap before you get the OutOfMemoryError. | Allocation depends on the used OS.
If you allocate too much memory, maybe you could end up having loaded portions into swap, which is slow.
If the your program runs fater os slower depends on how VM handle the memory.
I would not specify a heap that's not so big to make sure it don't occupy all the memory preventing ... |
7,475,837 | This is the code (corona SDK btw), it is calling a physicsdata (unimportant).
```
r = math.random(1,5)
local scaleFactor = 1.0
local physicsData = (require "retro").physicsData(scaleFactor)
physics.addBody( enemy, physicsData:get(r) )
```
The r in
```
physicsData:get(r) )
```
has to be inside speech marks to ... | 2011/09/19 | [
"https://Stackoverflow.com/questions/7475837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If you need a string,
```
tostring(r)
```
For example,
```
physics.addBody( enemy, physicsData:get(tostring(r)) )
```
If you really need quotes in the string (I doubt you do):
```
physics.addBody( enemy, physicsData:get('"' .. tostring(r) .. '"') )
``` | What you want is to [concatenate](http://en.wikipedia.org/wiki/Concatenation) the strings. In Lua the concatenate operator is .. so you need to write something like:
```
"The value of the variable is "..var
``` |
64,654,855 | So I have the following 3 tables:
```
Table: Products
Columns: id, name, description, price, currency
Table: Orders
Columns: id, firstName, lastName, phoneNumber
Table: Order_Products
Columns: orderId, productId, quantity
```
Now I'm trying to figure out where to put the total price of the order and I have 2 ideas... | 2020/11/02 | [
"https://Stackoverflow.com/questions/64654855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8618818/"
] | I would recommend that you store the order total in the `orders` table.
Why? Basically, order totals are not necessarily the same as the sum of all the prices on the items:
* The prices might change over time.
* The order itself might have discounts.
In addition, the order might have additional charges:
* Discounts... | I woulnd't recommend storing this. This is derived information, that can be computed on the fly whenever needed. If you are going to do the computation often, you can use a view:
```
create view orders_view as
select o.*, sum(p.price * op.quantity) total_price
from orders o
inner join order_products op on op.orderid =... |
42,008,449 | I am trying to see if an array contains each element of another array. Plus I want to account for the duplicates. For example:
```
array = [1, 2, 3, 3, "abc", "de", "f"]
```
array contains [1, 2, 3, 3] but does not contain [2, 2, "abc"] - too many 2's
I have tried the below but obviously doesn't take into account t... | 2017/02/02 | [
"https://Stackoverflow.com/questions/42008449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6449679/"
] | This method iterates once over both arrays.
For each array, it creates a hash with the number of occurences of each element.
It then checks that for every unique element in `subset`, there are at least as many elements in `superset`.
```
class Array
def count_by
each_with_object(Hash.new(0)) { |e, h| h[e] += 1 ... | You could first create a useful instance method for the class `Array`:
```
class Array
def difference(other)
h = other.each_with_object(Hash.new(0)) { |e,h| h[e] += 1 }
reject { |e| h[e] > 0 && h[e] -= 1 }
end
end
```
Then all elements of an array `a` are contained in array `b` if the following method re... |
29,144,832 | I want to sequentially read each line of an input unsorted file into consecutive elements of the array until there are no more records in
the file or until the input size is reached, whichever occurs first. but i can't think of a way to check the next line if its the end of the file?
This is my code:
```
Scanner cin... | 2015/03/19 | [
"https://Stackoverflow.com/questions/29144832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4532762/"
] | Please refer this [Number of lines in a file in Java](https://stackoverflow.com/questions/453018/number-of-lines-in-a-file-in-java) and modify your for loop to take whatever is the least out of the entered max value or the no.of lines in the file. | ```
int i=0;
for(; i<max; i++){ //to do:check for empty record
String line=br.readLine();
if(line==null){
break;
}
input[i] = line;
}
//i will contain the count of lines read. indexes 0...(i-1) represent the data.
``` |
29,144,832 | I want to sequentially read each line of an input unsorted file into consecutive elements of the array until there are no more records in
the file or until the input size is reached, whichever occurs first. but i can't think of a way to check the next line if its the end of the file?
This is my code:
```
Scanner cin... | 2015/03/19 | [
"https://Stackoverflow.com/questions/29144832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4532762/"
] | Try :
```
for(int i=0; i<max; i++){ //to do:check for empty record
if(br.readLine()!=null)
input[i] = br.readLine();
else
break;
}
``` | ```
int i=0;
for(; i<max; i++){ //to do:check for empty record
String line=br.readLine();
if(line==null){
break;
}
input[i] = line;
}
//i will contain the count of lines read. indexes 0...(i-1) represent the data.
``` |
29,144,832 | I want to sequentially read each line of an input unsorted file into consecutive elements of the array until there are no more records in
the file or until the input size is reached, whichever occurs first. but i can't think of a way to check the next line if its the end of the file?
This is my code:
```
Scanner cin... | 2015/03/19 | [
"https://Stackoverflow.com/questions/29144832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4532762/"
] | From [the docs](http://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html):
>
> public String readLine()
>
>
> Returns: A String containing the contents of the line, not including
> any line-termination characters, or null if the end of the stream has
> been reached
>
>
>
In other words, you shou... | ```
int i=0;
for(; i<max; i++){ //to do:check for empty record
String line=br.readLine();
if(line==null){
break;
}
input[i] = line;
}
//i will contain the count of lines read. indexes 0...(i-1) represent the data.
``` |
29,144,832 | I want to sequentially read each line of an input unsorted file into consecutive elements of the array until there are no more records in
the file or until the input size is reached, whichever occurs first. but i can't think of a way to check the next line if its the end of the file?
This is my code:
```
Scanner cin... | 2015/03/19 | [
"https://Stackoverflow.com/questions/29144832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4532762/"
] | Use `List<String>`
```
List<String> lines = new ArrayList<>(); // Growing array.
try (BufferedReader br = new BufferedReader(new FileReader("src/ioc.txt"))) {
for(;;) {
String line = br.readLine();
if (line == null) {
break;
}
lines.add(line);
}
} catch (IOException ... | ```
int i=0;
for(; i<max; i++){ //to do:check for empty record
String line=br.readLine();
if(line==null){
break;
}
input[i] = line;
}
//i will contain the count of lines read. indexes 0...(i-1) represent the data.
``` |
29,144,832 | I want to sequentially read each line of an input unsorted file into consecutive elements of the array until there are no more records in
the file or until the input size is reached, whichever occurs first. but i can't think of a way to check the next line if its the end of the file?
This is my code:
```
Scanner cin... | 2015/03/19 | [
"https://Stackoverflow.com/questions/29144832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4532762/"
] | You could do a null check in your first for-loop like:
```
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
System.out.print("Max number of items: ");
int max = cin.nextInt();
BufferedReader br = new BufferedReader(new FileReader("src/ioc.txt"));
List<String> input = ... | ```
int i=0;
for(; i<max; i++){ //to do:check for empty record
String line=br.readLine();
if(line==null){
break;
}
input[i] = line;
}
//i will contain the count of lines read. indexes 0...(i-1) represent the data.
``` |
29,144,832 | I want to sequentially read each line of an input unsorted file into consecutive elements of the array until there are no more records in
the file or until the input size is reached, whichever occurs first. but i can't think of a way to check the next line if its the end of the file?
This is my code:
```
Scanner cin... | 2015/03/19 | [
"https://Stackoverflow.com/questions/29144832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4532762/"
] | From [the docs](http://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html):
>
> public String readLine()
>
>
> Returns: A String containing the contents of the line, not including
> any line-termination characters, or null if the end of the stream has
> been reached
>
>
>
In other words, you shou... | Please refer this [Number of lines in a file in Java](https://stackoverflow.com/questions/453018/number-of-lines-in-a-file-in-java) and modify your for loop to take whatever is the least out of the entered max value or the no.of lines in the file. |
29,144,832 | I want to sequentially read each line of an input unsorted file into consecutive elements of the array until there are no more records in
the file or until the input size is reached, whichever occurs first. but i can't think of a way to check the next line if its the end of the file?
This is my code:
```
Scanner cin... | 2015/03/19 | [
"https://Stackoverflow.com/questions/29144832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4532762/"
] | From [the docs](http://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html):
>
> public String readLine()
>
>
> Returns: A String containing the contents of the line, not including
> any line-termination characters, or null if the end of the stream has
> been reached
>
>
>
In other words, you shou... | Try :
```
for(int i=0; i<max; i++){ //to do:check for empty record
if(br.readLine()!=null)
input[i] = br.readLine();
else
break;
}
``` |
29,144,832 | I want to sequentially read each line of an input unsorted file into consecutive elements of the array until there are no more records in
the file or until the input size is reached, whichever occurs first. but i can't think of a way to check the next line if its the end of the file?
This is my code:
```
Scanner cin... | 2015/03/19 | [
"https://Stackoverflow.com/questions/29144832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4532762/"
] | From [the docs](http://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html):
>
> public String readLine()
>
>
> Returns: A String containing the contents of the line, not including
> any line-termination characters, or null if the end of the stream has
> been reached
>
>
>
In other words, you shou... | Use `List<String>`
```
List<String> lines = new ArrayList<>(); // Growing array.
try (BufferedReader br = new BufferedReader(new FileReader("src/ioc.txt"))) {
for(;;) {
String line = br.readLine();
if (line == null) {
break;
}
lines.add(line);
}
} catch (IOException ... |
29,144,832 | I want to sequentially read each line of an input unsorted file into consecutive elements of the array until there are no more records in
the file or until the input size is reached, whichever occurs first. but i can't think of a way to check the next line if its the end of the file?
This is my code:
```
Scanner cin... | 2015/03/19 | [
"https://Stackoverflow.com/questions/29144832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4532762/"
] | From [the docs](http://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html):
>
> public String readLine()
>
>
> Returns: A String containing the contents of the line, not including
> any line-termination characters, or null if the end of the stream has
> been reached
>
>
>
In other words, you shou... | You could do a null check in your first for-loop like:
```
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
System.out.print("Max number of items: ");
int max = cin.nextInt();
BufferedReader br = new BufferedReader(new FileReader("src/ioc.txt"));
List<String> input = ... |
49,707 | I was rewatching Stargate-SG1 and noticed something while I was watching "[Menace](http://stargate.wikia.com/wiki/Menace)" where we learn that the android Reese created the Replicators and sent them out in to the galaxy.
We know that the Replicators integrate technology they consume to their own and lastly we know of ... | 2014/02/08 | [
"https://scifi.stackexchange.com/questions/49707",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/22619/"
] | Officially there is not explanation about how they are even connected let alone how they left the Milk Way for the Ida galaxy and why the Asgardians didn't knew about them before. For the most part everything about the Milk Way Replicators are just but pure speculation by fans. Only the Asurans had a background explain... | One of the anicent warships in orbit of the replicator planet in Pegasus gets a hitchhiker just a few Nanites nothing that would show up on the scanners the ship leaves orbit and sets course for the Milky Way and arrives at Reeses planet where the cells having been exposed to the vacuume of space thaw as the ship enter... |
49,707 | I was rewatching Stargate-SG1 and noticed something while I was watching "[Menace](http://stargate.wikia.com/wiki/Menace)" where we learn that the android Reese created the Replicators and sent them out in to the galaxy.
We know that the Replicators integrate technology they consume to their own and lastly we know of ... | 2014/02/08 | [
"https://scifi.stackexchange.com/questions/49707",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/22619/"
] | reese's planet was an ancient outpost for a small civilisation living in Ida, thus explaining the lack of other ancient tech. The people tried to evacuate home to The Ida Galaxy, but the replicators followed them and killed them anyway consuming all the ancient tech they could, the ancients tried to destroy what they c... | One of the anicent warships in orbit of the replicator planet in Pegasus gets a hitchhiker just a few Nanites nothing that would show up on the scanners the ship leaves orbit and sets course for the Milky Way and arrives at Reeses planet where the cells having been exposed to the vacuume of space thaw as the ship enter... |
49,707 | I was rewatching Stargate-SG1 and noticed something while I was watching "[Menace](http://stargate.wikia.com/wiki/Menace)" where we learn that the android Reese created the Replicators and sent them out in to the galaxy.
We know that the Replicators integrate technology they consume to their own and lastly we know of ... | 2014/02/08 | [
"https://scifi.stackexchange.com/questions/49707",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/22619/"
] | The short answer is that it's not explained in canon. Although the Asgard have had a presence in the Milky Way Galaxy for a very long time (and hence it would be logical to assume they encountered the Replicators there) Thor [explictly states](http://stargate-sg1-solutions.com/wiki/3.22_%22Nemesis_Part_1%22_Transcript#... | The answers are not in any single episode or any single show. You really have to watch Stargate-SG1 and Stargate-SGA (Atlantis) in their entirety to come to the conclusion.
The Ida Galaxy is the Asgard designation for the Pegasus Galaxy which is the Terran designation for the next closest galaxy in our local cluster.
... |
49,707 | I was rewatching Stargate-SG1 and noticed something while I was watching "[Menace](http://stargate.wikia.com/wiki/Menace)" where we learn that the android Reese created the Replicators and sent them out in to the galaxy.
We know that the Replicators integrate technology they consume to their own and lastly we know of ... | 2014/02/08 | [
"https://scifi.stackexchange.com/questions/49707",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/22619/"
] | The short answer is that it's not explained in canon. Although the Asgard have had a presence in the Milky Way Galaxy for a very long time (and hence it would be logical to assume they encountered the Replicators there) Thor [explictly states](http://stargate-sg1-solutions.com/wiki/3.22_%22Nemesis_Part_1%22_Transcript#... | One of the anicent warships in orbit of the replicator planet in Pegasus gets a hitchhiker just a few Nanites nothing that would show up on the scanners the ship leaves orbit and sets course for the Milky Way and arrives at Reeses planet where the cells having been exposed to the vacuume of space thaw as the ship enter... |
49,707 | I was rewatching Stargate-SG1 and noticed something while I was watching "[Menace](http://stargate.wikia.com/wiki/Menace)" where we learn that the android Reese created the Replicators and sent them out in to the galaxy.
We know that the Replicators integrate technology they consume to their own and lastly we know of ... | 2014/02/08 | [
"https://scifi.stackexchange.com/questions/49707",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/22619/"
] | reese's planet was an ancient outpost for a small civilisation living in Ida, thus explaining the lack of other ancient tech. The people tried to evacuate home to The Ida Galaxy, but the replicators followed them and killed them anyway consuming all the ancient tech they could, the ancients tried to destroy what they c... | Expanding on one of Richard's comment above, an alternate, and bleak, explanation surfaces:
After lotusing Reese's planet, the replicators set out to search for food elsewhere.
At this point they encounter the Ancients, and integrate their technology and philosophy (to some extent) into their own.
Recognizing that A... |
49,707 | I was rewatching Stargate-SG1 and noticed something while I was watching "[Menace](http://stargate.wikia.com/wiki/Menace)" where we learn that the android Reese created the Replicators and sent them out in to the galaxy.
We know that the Replicators integrate technology they consume to their own and lastly we know of ... | 2014/02/08 | [
"https://scifi.stackexchange.com/questions/49707",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/22619/"
] | reese's planet was an ancient outpost for a small civilisation living in Ida, thus explaining the lack of other ancient tech. The people tried to evacuate home to The Ida Galaxy, but the replicators followed them and killed them anyway consuming all the ancient tech they could, the ancients tried to destroy what they c... | The answers are not in any single episode or any single show. You really have to watch Stargate-SG1 and Stargate-SGA (Atlantis) in their entirety to come to the conclusion.
The Ida Galaxy is the Asgard designation for the Pegasus Galaxy which is the Terran designation for the next closest galaxy in our local cluster.
... |
49,707 | I was rewatching Stargate-SG1 and noticed something while I was watching "[Menace](http://stargate.wikia.com/wiki/Menace)" where we learn that the android Reese created the Replicators and sent them out in to the galaxy.
We know that the Replicators integrate technology they consume to their own and lastly we know of ... | 2014/02/08 | [
"https://scifi.stackexchange.com/questions/49707",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/22619/"
] | The short answer is that it's not explained in canon. Although the Asgard have had a presence in the Milky Way Galaxy for a very long time (and hence it would be logical to assume they encountered the Replicators there) Thor [explictly states](http://stargate-sg1-solutions.com/wiki/3.22_%22Nemesis_Part_1%22_Transcript#... | Officially there is not explanation about how they are even connected let alone how they left the Milk Way for the Ida galaxy and why the Asgardians didn't knew about them before. For the most part everything about the Milk Way Replicators are just but pure speculation by fans. Only the Asurans had a background explain... |
49,707 | I was rewatching Stargate-SG1 and noticed something while I was watching "[Menace](http://stargate.wikia.com/wiki/Menace)" where we learn that the android Reese created the Replicators and sent them out in to the galaxy.
We know that the Replicators integrate technology they consume to their own and lastly we know of ... | 2014/02/08 | [
"https://scifi.stackexchange.com/questions/49707",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/22619/"
] | Officially there is not explanation about how they are even connected let alone how they left the Milk Way for the Ida galaxy and why the Asgardians didn't knew about them before. For the most part everything about the Milk Way Replicators are just but pure speculation by fans. Only the Asurans had a background explain... | Expanding on one of Richard's comment above, an alternate, and bleak, explanation surfaces:
After lotusing Reese's planet, the replicators set out to search for food elsewhere.
At this point they encounter the Ancients, and integrate their technology and philosophy (to some extent) into their own.
Recognizing that A... |
49,707 | I was rewatching Stargate-SG1 and noticed something while I was watching "[Menace](http://stargate.wikia.com/wiki/Menace)" where we learn that the android Reese created the Replicators and sent them out in to the galaxy.
We know that the Replicators integrate technology they consume to their own and lastly we know of ... | 2014/02/08 | [
"https://scifi.stackexchange.com/questions/49707",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/22619/"
] | The short answer is that it's not explained in canon. Although the Asgard have had a presence in the Milky Way Galaxy for a very long time (and hence it would be logical to assume they encountered the Replicators there) Thor [explictly states](http://stargate-sg1-solutions.com/wiki/3.22_%22Nemesis_Part_1%22_Transcript#... | reese's planet was an ancient outpost for a small civilisation living in Ida, thus explaining the lack of other ancient tech. The people tried to evacuate home to The Ida Galaxy, but the replicators followed them and killed them anyway consuming all the ancient tech they could, the ancients tried to destroy what they c... |
49,707 | I was rewatching Stargate-SG1 and noticed something while I was watching "[Menace](http://stargate.wikia.com/wiki/Menace)" where we learn that the android Reese created the Replicators and sent them out in to the galaxy.
We know that the Replicators integrate technology they consume to their own and lastly we know of ... | 2014/02/08 | [
"https://scifi.stackexchange.com/questions/49707",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/22619/"
] | Officially there is not explanation about how they are even connected let alone how they left the Milk Way for the Ida galaxy and why the Asgardians didn't knew about them before. For the most part everything about the Milk Way Replicators are just but pure speculation by fans. Only the Asurans had a background explain... | reese's planet was an ancient outpost for a small civilisation living in Ida, thus explaining the lack of other ancient tech. The people tried to evacuate home to The Ida Galaxy, but the replicators followed them and killed them anyway consuming all the ancient tech they could, the ancients tried to destroy what they c... |
338,952 | On top of [an answer](https://meta.stackexchange.com/a/63791/399694) describing a meme about pluralization bugs, there was a deprecation notice posted (from August 2018):
>
> This meme is officially deprecated.
>
>
> Please do not use this meme. It remains here while links to it are
> still quite 'out in the wild'... | 2019/11/24 | [
"https://meta.stackexchange.com/questions/338952",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/38765/"
] | It is possible that your post may be on-topic at the [Information Security](https://security.stackexchange.com) Stack Exchange site. They have quite a few questions and a lot of them do cover Internet censorship by governments. | >
> How is it possible bypass Internet restriction in Iran to get access to some simple sites like Google.
>
>
>
When out of country access is permitted there's an answer on [SuperUser.SE](https://superuser.com/q/429358/419485) where user [Paul](https://superuser.com/a/429387/419485) suggests [Openvpn-ALS](http://... |
5,303,118 | i have a relative layout and i have two buttons in it with texts "hello" and "world" respectively. i want these two buttons to lie adjacent to each other and equally occupy the whole horizontal space available.
i tried the following but didnt get expected output
```
<RelativeLayout xmlns:android="http://schemas.and... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5303118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41432/"
] | ```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_a... | ```
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int height = metrics.heightPixels;
int width = metrics.widthPixels;
```
in relative layout you can achieve this dynamically.
```
Button1.setWidth(width / 2);
Button2.setWidth(width / 2);
``` |
5,303,118 | i have a relative layout and i have two buttons in it with texts "hello" and "world" respectively. i want these two buttons to lie adjacent to each other and equally occupy the whole horizontal space available.
i tried the following but didnt get expected output
```
<RelativeLayout xmlns:android="http://schemas.and... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5303118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41432/"
] | ```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_a... | You may try implementing LinearLayout(horizontal) and then set android:layout\_weight="1" for both buttons. |
5,303,118 | i have a relative layout and i have two buttons in it with texts "hello" and "world" respectively. i want these two buttons to lie adjacent to each other and equally occupy the whole horizontal space available.
i tried the following but didnt get expected output
```
<RelativeLayout xmlns:android="http://schemas.and... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5303118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41432/"
] | You can't do this with `RelativeLayout`. Try `LinearLayout` and the `layout_weight` attribute. | You may try implementing LinearLayout(horizontal) and then set android:layout\_weight="1" for both buttons. |
5,303,118 | i have a relative layout and i have two buttons in it with texts "hello" and "world" respectively. i want these two buttons to lie adjacent to each other and equally occupy the whole horizontal space available.
i tried the following but didnt get expected output
```
<RelativeLayout xmlns:android="http://schemas.and... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5303118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41432/"
] | You can't do this with `RelativeLayout`. Try `LinearLayout` and the `layout_weight` attribute. | Take a Button align it in center with `1dp` `width` and `height`. Now place your Button1 with the property `android:layout_width = fill parent` `to left of center`, again with respect to center button put Button2 to the `right of center` with the property `android:layout_width = fill parent`. |
5,303,118 | i have a relative layout and i have two buttons in it with texts "hello" and "world" respectively. i want these two buttons to lie adjacent to each other and equally occupy the whole horizontal space available.
i tried the following but didnt get expected output
```
<RelativeLayout xmlns:android="http://schemas.and... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5303118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41432/"
] | ```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_a... | Take a Button align it in center with `1dp` `width` and `height`. Now place your Button1 with the property `android:layout_width = fill parent` `to left of center`, again with respect to center button put Button2 to the `right of center` with the property `android:layout_width = fill parent`. |
5,303,118 | i have a relative layout and i have two buttons in it with texts "hello" and "world" respectively. i want these two buttons to lie adjacent to each other and equally occupy the whole horizontal space available.
i tried the following but didnt get expected output
```
<RelativeLayout xmlns:android="http://schemas.and... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5303118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41432/"
] | ```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_a... | You can't do this with `RelativeLayout`. Try `LinearLayout` and the `layout_weight` attribute. |
5,303,118 | i have a relative layout and i have two buttons in it with texts "hello" and "world" respectively. i want these two buttons to lie adjacent to each other and equally occupy the whole horizontal space available.
i tried the following but didnt get expected output
```
<RelativeLayout xmlns:android="http://schemas.and... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5303118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41432/"
] | You can't do this with `RelativeLayout`. Try `LinearLayout` and the `layout_weight` attribute. | I know that is a old request, but maybe it's can be useful for somebody.
In your case the right solution is using Linear Layout. But for reply your request and suppose that you have an other widget in your layout:
```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="ma... |
5,303,118 | i have a relative layout and i have two buttons in it with texts "hello" and "world" respectively. i want these two buttons to lie adjacent to each other and equally occupy the whole horizontal space available.
i tried the following but didnt get expected output
```
<RelativeLayout xmlns:android="http://schemas.and... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5303118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41432/"
] | I know that is a old request, but maybe it's can be useful for somebody.
In your case the right solution is using Linear Layout. But for reply your request and suppose that you have an other widget in your layout:
```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="ma... | You may try implementing LinearLayout(horizontal) and then set android:layout\_weight="1" for both buttons. |
5,303,118 | i have a relative layout and i have two buttons in it with texts "hello" and "world" respectively. i want these two buttons to lie adjacent to each other and equally occupy the whole horizontal space available.
i tried the following but didnt get expected output
```
<RelativeLayout xmlns:android="http://schemas.and... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5303118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41432/"
] | ```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_a... | I know that is a old request, but maybe it's can be useful for somebody.
In your case the right solution is using Linear Layout. But for reply your request and suppose that you have an other widget in your layout:
```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="ma... |
5,303,118 | i have a relative layout and i have two buttons in it with texts "hello" and "world" respectively. i want these two buttons to lie adjacent to each other and equally occupy the whole horizontal space available.
i tried the following but didnt get expected output
```
<RelativeLayout xmlns:android="http://schemas.and... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5303118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41432/"
] | You may try implementing LinearLayout(horizontal) and then set android:layout\_weight="1" for both buttons. | Take a Button align it in center with `1dp` `width` and `height`. Now place your Button1 with the property `android:layout_width = fill parent` `to left of center`, again with respect to center button put Button2 to the `right of center` with the property `android:layout_width = fill parent`. |
51,620,422 | In Postgres, I have a table with many columns (e.g. t1(a, b, c, ..., z)). I need to obtain its subset through a select-from-where statement into a new table (e.g. t2), but this new table must have a `serial` attribute. So, t2 would like t2(id, a, b, c, ..., z), where id the `serial` attribute. In Postgres, this works:
... | 2018/07/31 | [
"https://Stackoverflow.com/questions/51620422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1959766/"
] | As suggested by people in the comment section, **your best bet for this type of task is using list comprehension** like so,
```
['file_Path ' + i for i in List]
```
Now, I wanted to add an answer because I wanted to add that `List` is definitely not a good choice of naming for you `list` object.
**I would go with ... | I think this will be the better way as i always use this
```
oldList = ['test1','test2','test3']
newList = list(map(lambda a:"file path "+a,oldList))
```
It looks functional |
51,620,422 | In Postgres, I have a table with many columns (e.g. t1(a, b, c, ..., z)). I need to obtain its subset through a select-from-where statement into a new table (e.g. t2), but this new table must have a `serial` attribute. So, t2 would like t2(id, a, b, c, ..., z), where id the `serial` attribute. In Postgres, this works:
... | 2018/07/31 | [
"https://Stackoverflow.com/questions/51620422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1959766/"
] | As suggested by people in the comment section, **your best bet for this type of task is using list comprehension** like so,
```
['file_Path ' + i for i in List]
```
Now, I wanted to add an answer because I wanted to add that `List` is definitely not a good choice of naming for you `list` object.
**I would go with ... | ```
list = ['test1', 'test2', 'test3']
for i in range(len(list)):
list[i] = 'file_path ' + list[i]
```
Or using list comprehension:
```
list = ['test1', 'test2', 'test3']
new_list = ['file_path ' + item for item in list]
``` |
51,620,422 | In Postgres, I have a table with many columns (e.g. t1(a, b, c, ..., z)). I need to obtain its subset through a select-from-where statement into a new table (e.g. t2), but this new table must have a `serial` attribute. So, t2 would like t2(id, a, b, c, ..., z), where id the `serial` attribute. In Postgres, this works:
... | 2018/07/31 | [
"https://Stackoverflow.com/questions/51620422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1959766/"
] | As suggested by people in the comment section, **your best bet for this type of task is using list comprehension** like so,
```
['file_Path ' + i for i in List]
```
Now, I wanted to add an answer because I wanted to add that `List` is definitely not a good choice of naming for you `list` object.
**I would go with ... | You can use list comprehension to perform this task -
```
List = ['test1', 'test2', 'test3']
file_path = 'your/file/path'
newList = [file_path+SheetName for SheetName in List]
```
Or you could use the map+lambda combination -
```
newList = list(map(lambda x: file_path+x , List))
``` |
51,620,422 | In Postgres, I have a table with many columns (e.g. t1(a, b, c, ..., z)). I need to obtain its subset through a select-from-where statement into a new table (e.g. t2), but this new table must have a `serial` attribute. So, t2 would like t2(id, a, b, c, ..., z), where id the `serial` attribute. In Postgres, this works:
... | 2018/07/31 | [
"https://Stackoverflow.com/questions/51620422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1959766/"
] | As suggested by people in the comment section, **your best bet for this type of task is using list comprehension** like so,
```
['file_Path ' + i for i in List]
```
Now, I wanted to add an answer because I wanted to add that `List` is definitely not a good choice of naming for you `list` object.
**I would go with ... | Just use list comprehension:
```
List = ['test1', 'test2', 'test3']
file_paths = ['file_path: %s' % (fp,) for fp in List]
``` |
51,620,422 | In Postgres, I have a table with many columns (e.g. t1(a, b, c, ..., z)). I need to obtain its subset through a select-from-where statement into a new table (e.g. t2), but this new table must have a `serial` attribute. So, t2 would like t2(id, a, b, c, ..., z), where id the `serial` attribute. In Postgres, this works:
... | 2018/07/31 | [
"https://Stackoverflow.com/questions/51620422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1959766/"
] | As suggested by people in the comment section, **your best bet for this type of task is using list comprehension** like so,
```
['file_Path ' + i for i in List]
```
Now, I wanted to add an answer because I wanted to add that `List` is definitely not a good choice of naming for you `list` object.
**I would go with ... | You may try the combination of `map` and `add` which adds two lists element wise.
```
from operator import add
test = ['test1', 'test2', 'test3']
path = ['file_Path '] * len(test)
list(map(add, path, test))
```
**Output**
```
['file_Path test1', 'file_Path test2', 'file_Path test3']
``` |
39,233,962 | I want to submit a score to my leaderboard. Sometimes it works but sometimes i get the error:
```
Error Code 6: STATUS_NETWORK_ERROR_OPERATION_FAILED
```
I am connected to the internet and enabled multiplayer in the developer console. Any ideas?
Here is my code:
MainActivity:
```
if(isSignedIn()){
Games... | 2016/08/30 | [
"https://Stackoverflow.com/questions/39233962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4835496/"
] | You can use this lazy regex:
```
(.*?) \((.*)\)[^()]*$
```
[RegEx Demo](https://regex101.com/r/yQ8xI8/1)
Examples:
```
>>> reg = r'(.*?) \((.*)\)[^()]*$'
>>> s = 'Bell St/Oriel Rd (Bellfield (3081))'
>>> re.findall(reg, s)
[('Bell St/Oriel Rd', 'Bellfield (3081)')]
>>> s = 'Stud Rd/(after) Ferntree Gully Rd (Sco... | I would use this scheme, given `t` being your text:
```
last = re.findall('\([^())]+\)', t)[-1]
```
The regex searches for an opening parenthesis, then take everything that is neither opening nor closing parenthesis, and then matches the closing parenthesis. Since there could be more than one like this, I use `finda... |
39,233,962 | I want to submit a score to my leaderboard. Sometimes it works but sometimes i get the error:
```
Error Code 6: STATUS_NETWORK_ERROR_OPERATION_FAILED
```
I am connected to the internet and enabled multiplayer in the developer console. Any ideas?
Here is my code:
MainActivity:
```
if(isSignedIn()){
Games... | 2016/08/30 | [
"https://Stackoverflow.com/questions/39233962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4835496/"
] | Change your regex pattern and work with **match** object(returned by `search` function) in proper way:
```
import re
str = 'Bell St/Oriel Rd (Bellfield (3081))'
result = re.search(r'^(.*?) \((.*?)\)$', str)
print(result.group(1,2)) # ('Bell St/Oriel Rd', 'Bellfield (3081)')
``` | I would use this scheme, given `t` being your text:
```
last = re.findall('\([^())]+\)', t)[-1]
```
The regex searches for an opening parenthesis, then take everything that is neither opening nor closing parenthesis, and then matches the closing parenthesis. Since there could be more than one like this, I use `finda... |
39,233,962 | I want to submit a score to my leaderboard. Sometimes it works but sometimes i get the error:
```
Error Code 6: STATUS_NETWORK_ERROR_OPERATION_FAILED
```
I am connected to the internet and enabled multiplayer in the developer console. Any ideas?
Here is my code:
MainActivity:
```
if(isSignedIn()){
Games... | 2016/08/30 | [
"https://Stackoverflow.com/questions/39233962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4835496/"
] | You can use this lazy regex:
```
(.*?) \((.*)\)[^()]*$
```
[RegEx Demo](https://regex101.com/r/yQ8xI8/1)
Examples:
```
>>> reg = r'(.*?) \((.*)\)[^()]*$'
>>> s = 'Bell St/Oriel Rd (Bellfield (3081))'
>>> re.findall(reg, s)
[('Bell St/Oriel Rd', 'Bellfield (3081)')]
>>> s = 'Stud Rd/(after) Ferntree Gully Rd (Sco... | This works assuming you don't have any parenthesis prior to the last chunk.
```
var = 'Bell St/Oriel Rd', 'Bellfield (3081)'.split('(')
var[-1] = var[-1][:-1]
``` |
39,233,962 | I want to submit a score to my leaderboard. Sometimes it works but sometimes i get the error:
```
Error Code 6: STATUS_NETWORK_ERROR_OPERATION_FAILED
```
I am connected to the internet and enabled multiplayer in the developer console. Any ideas?
Here is my code:
MainActivity:
```
if(isSignedIn()){
Games... | 2016/08/30 | [
"https://Stackoverflow.com/questions/39233962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4835496/"
] | Change your regex pattern and work with **match** object(returned by `search` function) in proper way:
```
import re
str = 'Bell St/Oriel Rd (Bellfield (3081))'
result = re.search(r'^(.*?) \((.*?)\)$', str)
print(result.group(1,2)) # ('Bell St/Oriel Rd', 'Bellfield (3081)')
``` | This works assuming you don't have any parenthesis prior to the last chunk.
```
var = 'Bell St/Oriel Rd', 'Bellfield (3081)'.split('(')
var[-1] = var[-1][:-1]
``` |
39,233,962 | I want to submit a score to my leaderboard. Sometimes it works but sometimes i get the error:
```
Error Code 6: STATUS_NETWORK_ERROR_OPERATION_FAILED
```
I am connected to the internet and enabled multiplayer in the developer console. Any ideas?
Here is my code:
MainActivity:
```
if(isSignedIn()){
Games... | 2016/08/30 | [
"https://Stackoverflow.com/questions/39233962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4835496/"
] | You can use this lazy regex:
```
(.*?) \((.*)\)[^()]*$
```
[RegEx Demo](https://regex101.com/r/yQ8xI8/1)
Examples:
```
>>> reg = r'(.*?) \((.*)\)[^()]*$'
>>> s = 'Bell St/Oriel Rd (Bellfield (3081))'
>>> re.findall(reg, s)
[('Bell St/Oriel Rd', 'Bellfield (3081)')]
>>> s = 'Stud Rd/(after) Ferntree Gully Rd (Sco... | Change your regex pattern and work with **match** object(returned by `search` function) in proper way:
```
import re
str = 'Bell St/Oriel Rd (Bellfield (3081))'
result = re.search(r'^(.*?) \((.*?)\)$', str)
print(result.group(1,2)) # ('Bell St/Oriel Rd', 'Bellfield (3081)')
``` |
23,577,146 | Haskell does not have loops like many other languages. I understand the reasoning behind it and some of the different approaches used to solve problems without them. However, when a loop structure is necessary, I am not sure if the way I'm creating the loop is correct/good.
For example (trivial function):
```
dumdum ... | 2014/05/10 | [
"https://Stackoverflow.com/questions/23577146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1993391/"
] | For general iteration, having a recursive function call itself is definitely the way to go. If your calls are in [tail position](https://en.wikipedia.org/wiki/Tail_call), they don't use any extra stack space and behave more like `goto`1. For example, here is a function to sum the first n integers using constant stack s... | >
> I know there are other options for creating loops such as `Control.Monad.LoopWhile` and `Control.Monad.forever` -- should I be using those instead? (I am still very new to Haskell and do not understand monads yet.)
>
>
>
Yes, you should. You'll find that in "real" Haskell code, explicit recursion (i.e. calling... |
31,494,001 | I want to change this url from:
```
https://lh3.googleusercontent.com/-5EoWQXUJMiA/VZ86O7eskeI/AAAAAAADHGs/ej6F-va__Ig/s1600/i2Fun.com-helpful-dogs-015.gif
```
to this:
```
http://3.bp.blogspot.com/-5EoWQXUJMiA/VZ86O7eskeI/AAAAAAADHGs/ej6F-va__Ig/s1600/i2Fun.com-helpful-dogs-015.gif
```
This is my code, but it's ... | 2015/07/18 | [
"https://Stackoverflow.com/questions/31494001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1201672/"
] | It's a simple string replace.
Search for `"https://lh3.googleusercontent.com/"`. Replace with `"http://3.bp.blogspot.com/"`.
`str_replace()` will do this. Am I missing something? | ```
$s = "https://lh3.googleusercontent.com/-5EoWQXUJMiA/VZ86O7eskeI/AAAAAAADHGs/ej6F-va__Ig/s1600/i2Fun.com-helpful-dogs-015.gif";
$path = parse_url($s);
echo 'http://3.bp.blogspot.com' . $path['path'];
```
**UPDATE** You can don't receive all the parts of an url, but take only the needed part
```
echo 'http://3.... |
758,758 | I am learning about radians in my current class and am totally confused.
How does $\sin(x+\frac\pi 2)=\cos(x)$ when $\frac\pi 2<x$ < $\pi$.
I drew the triangles and I got
$\sin(x+\frac\pi 2)=\frac{-\mathrm{opposite}}{-\mathrm{hypotenuse}}=\frac{\mathrm{opp}}{\mathrm{hyp}}$
$\cos(x)=\frac{\mathrm{adjacent}}{\mathrm{... | 2014/04/18 | [
"https://math.stackexchange.com/questions/758758",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/90108/"
] | Your expression for $\sin(x)$ is correct. But recall that the cosine is the abscissa divided by the radius of the circle. So in your drawing, $\cos(x)=\frac a b$.
 | It's just how it is, if you look at a graph of sine and overlay cosine on top of it, then this would be readily apparent. |
58,648,255 | `str_getcsv ()` has some odd behaviour. It removes **all** characters that match the enclosing character, instead of **just the enclosing ones**. I'm trying to parse a CSV string (contents of an uploaded file) in two steps:
1. split the CSV string into an array of lines
2. split each line into an array of fields
with... | 2019/10/31 | [
"https://Stackoverflow.com/questions/58648255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11036459/"
] | Create a branch at **exactly** the revision where the person who worked separately started working from. Then remove every single file from it (use `git rm` for removing).... then put there whatever the user code is.... then add all of that and commit (use `--author="batman forever"` with the name of the developer so t... | The problem here is that work has been done in the master branch on the server since you committed. So that work must be merged into your local copy of the master branch before you can push additional changes to master.
You've already committed the 3rd party's (let's call that dev John Doe) changes to your master bran... |
10,578,960 | I am using ckeditor in order to edit the text seen in the screen. The information is taken from database and written to the screen in a div element and it is possible to edit the information by double clicking. However, after edited i couldn't get the edited information. Here is my code, i tried to add a form which inc... | 2012/05/14 | [
"https://Stackoverflow.com/questions/10578960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1343936/"
] | For save form's data you need store information in input/select/textarea. Div and other not form's element not will be stored.
You have to store your data in hidden fields:
```
<form method="post">
<p>
Double-click any of the following <code><div></code> elements to transform them into
edit... | Generically adds `<input type="hidden">` to any `<div>` with the attribute `addToForm`, copies content into them (see notes below):
```
<form method="post" id="f">
<div id="txt" addToForm="1" contenteditable spellcheck="true" style="height:100px;width:300px;font-family:arial,sans serif;border:1px solid black;font-weig... |
13,880,230 | I have multiple ~50MB Access 2000-2003 databases (MDB files) that only contain tables with data. The *data-databases* are located on a server in my enterprise that can take ~1-2 second to respond (and about 10 seconds to actually open the 50 MDB file manually while browsing in the file explorer). I have other databases... | 2012/12/14 | [
"https://Stackoverflow.com/questions/13880230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1689179/"
] | Something like this?
```
var points = File.ReadLines("c:\filepath")
.Skip(1) //Ignore the 1st line
.Select(line => line.Split(' ')) //Chop the string into x & y
.Select(split => new Point(double.Parse(split[0]), double.Parse(split[1])); //create a point from the array
``` | ```
var coordinates = File.ReadLines(fileName).Skip(1)
.Select(line => line.Split())
.Select(x=>new PointF(float.Parse(x[0]),float.Parse(x[1])))
.ToList();
``` |
73,439,041 | Cheers,
I have the bellow React code, where i need to send an HTTP Request to check if my actual user have permission or not to access my page.
For that, im using useEffect hook to check his permission every page entry.
But my actual code does not wait for `authorize()` conclusion. Leading for `/Unauthorized` page ev... | 2022/08/21 | [
"https://Stackoverflow.com/questions/73439041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11573910/"
] | replace your container with this code:
```
Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: (hisseResult?.result[index].rate ?? 0) > 0
? Colors.green
: Colors.red),
width: 75... | Flutter allows **conditions when giving values to widgets atributes.**
Just use a ternary operator which is very clean visual and suits this perfectly:
```
color: hisseResult?.result[index].rate > 0 ? Colors.green : Colors.red,
```
Selamlar :) |
24,546,513 | I had to write a csv sorting code for which I used the following code :
```
foreach(@files){
if(/\.csv$/i) { # if the filename has .csv at the end
push(@csvfiles,$_);
}
}
foreach(@csvfiles) {
$csvfile=$_;
open(hanr, "D:\\stock\\".$csvfile)or die"error $!\n"; # read handler
open(hanw , ">D:... | 2014/07/03 | [
"https://Stackoverflow.com/questions/24546513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3249348/"
] | You have `my $row;` which leaves `$row` undefined, and pushing into `@$row` (or `@{$row}`) automatically creates new array due [`autovivification`](http://en.wikipedia.org/wiki/Autovivification) perl feature.
In case of
```
sort {
$a->[0] cmp $b->[0] ||
$a->[1] cmp $b->[1]
}
@$sheet2
```
`@$sheet2` is array of... | `@$row` dereferences an array reference.
`sort {$a->[0] cmp $b->[0] || $a->[1] cmp $b->[1]}` This will compare the first entry in both arrays and if these are equals the second entry will be compared.
Hope this helps. |
5,969 | I am re-asking this question for Photoshop Elements 10 :
[How can I resize an image without anti-aliasing?](https://graphicdesign.stackexchange.com/questions/5519/how-can-i-resize-an-image-without-anti-aliasing)
I want the same result as the user got here- the ability to change a layer's angle and scale without having... | 2012/02/14 | [
"https://graphicdesign.stackexchange.com/questions/5969",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/3722/"
] | I guess you could copy the part of the image you want to resize into a new image; resize that image using "Nearest Neighbor" interpolation; then copy it back into your original image.
But that doesn't help if you need to rotate. This might just be one of the features that Elements leaves out... | One way that might work better is to convert the item that you want to resize and rotate to a smart object. If you do not want to leave the item as a smart object, then you could re-rasterize it once you are finished with the transformations.
The results will vary depending on the type and complexity of your image. Th... |
17,040,671 | Goal:
If finding the word "Total" in a cell, the current row with word "Total" as a start point (with letter D in the column) and all the way to the letter H shall have a light grey background color. If not having "Total", the background shall be default.
Problem:
How should I do it by using VBA?
![enter image... | 2013/06/11 | [
"https://Stackoverflow.com/questions/17040671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/484390/"
] | You could try it with conditional formatting.
Just select the cell and go to "Format" -> "Conditional formatting" (well that's the path in Excel 2003, don't know 2007 or later)
But you can do it with a macro if you want to.
Here is an example how to do it:
```
Sub RowsToGrey()
Dim r As Long, i As Long
r = Cells(Rows.... | See [Debra's site](http://www.contextures.com/xlCondFormat01.html) for conditional formatting background. The actual approach to highlight only the active row with pure conditional formatting was actually quite tough - I got 99.9% there but I still needed a *damn* calculate event to refresh the formulas to make this wo... |
200,123 | Is there any framework or method that will allow to use browser to run a 2D game made in python with pygame graphical library? | 2022/03/31 | [
"https://gamedev.stackexchange.com/questions/200123",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/145066/"
] | Since mid-2022, pygame has partial support for WebAssembly as upcoming python3.11 and allows for running the same pygame code on desktops and mobile/web.
You can publish your game on itch.io or github pages as some people have already done.
use pygbag from <https://pypi.org/project/pygbag> , some documentation is ava... | use replit [https://replit.com/~](https://replit.com/%7E). if you want to make your own website with your game iframe a replit in html |
4,307,222 | I am working on the Glen Bredon's ``topology and geometry''. In its proposition 6.10, the degree of a mapping $(x\_0, \dots, x\_n) \mapsto (-x\_0, \dots, x\_n)$ from $\mathbb{S}^n \to \mathbb{S}^n$ is introduced. The statement of that proposition is following.
For $\mathbb{S}^n \subseteq \mathbb{R}^{n + 1}$ with coord... | 2021/11/15 | [
"https://math.stackexchange.com/questions/4307222",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/399707/"
] | You consider an arbitrary homology theory $H\_\*$ satsyfing all Eilenberg-Steenrod axioms including the dimension axiom. Thus you should not use the notation $\tilde{H}\_n(\mathbb{S}^n ; \mathbb{Z})$ because that suggests that the functors $H\_n$ have a second variable (the coefficient group). But such a concept is not... | There is only a single map from a point to a point, the identity map. Any homology theory satisfying the Eilenberg-Steenrod axioms is a family of functors $H\_i: \mathcal{Top}\to \mathcal{Ab}$. And a functor, by definition, takes the identity morphism to the identity morphism. |
18,074,221 | I'm facing an issue with chrome 28.
I build an application that use the webcam to take picture.
I had no problem with it, but since I upgrade to chrome 28, my application is not working anymore (I'm getting an error with the getUserMedia function).
Here is the message : `{"constraintName":"","message":"","name":"PER... | 2013/08/06 | [
"https://Stackoverflow.com/questions/18074221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2655718/"
] | Try like this:
```
public class TempContext : DbContext
{
public DbSet<Shop> Shops { get; set; }
public DbSet<Certificate> Certificates { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Shop>().HasRequired(x => x.Certificate);
}
}
``` | You could use the `Required` attribute to mark a property as required.
[MSDN](http://msdn.microsoft.com/de-de/library/system.componentmodel.dataannotations.requiredattribute.aspx)
Here is your example:
```
public class Shop
{
int Id { get; set; }
string Name { get; set;
[Required]
Certificate Certif... |
18,074,221 | I'm facing an issue with chrome 28.
I build an application that use the webcam to take picture.
I had no problem with it, but since I upgrade to chrome 28, my application is not working anymore (I'm getting an error with the getUserMedia function).
Here is the message : `{"constraintName":"","message":"","name":"PER... | 2013/08/06 | [
"https://Stackoverflow.com/questions/18074221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2655718/"
] | You could use the `Required` attribute to mark a property as required.
[MSDN](http://msdn.microsoft.com/de-de/library/system.componentmodel.dataannotations.requiredattribute.aspx)
Here is your example:
```
public class Shop
{
int Id { get; set; }
string Name { get; set;
[Required]
Certificate Certif... | Try this:
```
public class Shop
{
int Id { get; set; }
string Name { get; set; }
[Required]
int CertId { get; set; }
// Navigation Property.
[ForeignKey("CertId")]
Certificate Certificate { get; set; } // ******
}
public class Certificate
{
int Id { get; set; }
string Descrip { g... |
18,074,221 | I'm facing an issue with chrome 28.
I build an application that use the webcam to take picture.
I had no problem with it, but since I upgrade to chrome 28, my application is not working anymore (I'm getting an error with the getUserMedia function).
Here is the message : `{"constraintName":"","message":"","name":"PER... | 2013/08/06 | [
"https://Stackoverflow.com/questions/18074221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2655718/"
] | Try like this:
```
public class TempContext : DbContext
{
public DbSet<Shop> Shops { get; set; }
public DbSet<Certificate> Certificates { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Shop>().HasRequired(x => x.Certificate);
}
}
``` | Try this:
```
public class Shop
{
int Id { get; set; }
string Name { get; set; }
[Required]
int CertId { get; set; }
// Navigation Property.
[ForeignKey("CertId")]
Certificate Certificate { get; set; } // ******
}
public class Certificate
{
int Id { get; set; }
string Descrip { g... |
72,904,850 | I am struggling to create a new variable named "edu\_category" to indicate whether each person experiences Female Hypergamy (wive's education level < husband's), Female Homogamy (wive's education level == husband's), or Female Hypogamy (wive's education level > husband's).
My data looks like this (Female == 1 indicate... | 2022/07/07 | [
"https://Stackoverflow.com/questions/72904850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19455550/"
] | You can do this in a report visualisation with a few measures, to calculate number of sales, percentage of sales, product rank by sales (then product name), and cumulative sales percentage:
##### # Sales:
```
# Sales = COUNT ( Sales[ID SALE] )
```
##### % Sales:
```
% Sales =
DIVIDE (
[# Sales],
... | A big, but simple measure that doesn't need to be commented. You can use it in your visual and as a base for your further calculations. The result is not sorted but you can do it as you like in the visual and it will not affect values.
```
VAR tbl =
ADDCOLUMNS(
VALUES('dataset'[PRODUCT])
,"subtota... |
72,904,850 | I am struggling to create a new variable named "edu\_category" to indicate whether each person experiences Female Hypergamy (wive's education level < husband's), Female Homogamy (wive's education level == husband's), or Female Hypogamy (wive's education level > husband's).
My data looks like this (Female == 1 indicate... | 2022/07/07 | [
"https://Stackoverflow.com/questions/72904850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19455550/"
] | You could also accomplish this in the Query editor (Home=>Transform Data).
In the Advanced Editor, paste the code below except for the first few lines that will be there reading in your existing data and perhaps setting the data type.
Then examine the code comments and explore the Applied Steps window (after closing ... | A big, but simple measure that doesn't need to be commented. You can use it in your visual and as a base for your further calculations. The result is not sorted but you can do it as you like in the visual and it will not affect values.
```
VAR tbl =
ADDCOLUMNS(
VALUES('dataset'[PRODUCT])
,"subtota... |
72,904,850 | I am struggling to create a new variable named "edu\_category" to indicate whether each person experiences Female Hypergamy (wive's education level < husband's), Female Homogamy (wive's education level == husband's), or Female Hypogamy (wive's education level > husband's).
My data looks like this (Female == 1 indicate... | 2022/07/07 | [
"https://Stackoverflow.com/questions/72904850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19455550/"
] | You can do this in a report visualisation with a few measures, to calculate number of sales, percentage of sales, product rank by sales (then product name), and cumulative sales percentage:
##### # Sales:
```
# Sales = COUNT ( Sales[ID SALE] )
```
##### % Sales:
```
% Sales =
DIVIDE (
[# Sales],
... | You could also accomplish this in the Query editor (Home=>Transform Data).
In the Advanced Editor, paste the code below except for the first few lines that will be there reading in your existing data and perhaps setting the data type.
Then examine the code comments and explore the Applied Steps window (after closing ... |
453,030 | How can I create a product key for my C# Application?
I need to create a product (or license) key that I update annually. Additionally I need to create one for trial versions.
>
> Related:
>
>
> * [How do I best obfuscate my C# product license verification code?](https://stackoverflow.com/questions/501988)
> * [Ho... | 2009/01/17 | [
"https://Stackoverflow.com/questions/453030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53605/"
] | I have to admit I'd do something rather insane.
1. Find a CPU bottleneck and extract it to a [P/Invokeable](http://en.wikipedia.org/wiki/Platform_Invocation_Services) DLL file.
2. As a post build action, encrypt part of the DLL file with an XOR
encryption key.
3. Select a public/private key scheme, include public key ... | You can check [LicenseSpot](http://www.licensespot.com). It provides:
* Free Licensing Component
* Online Activation
* API to integrate your app and online store
* Serial number generation
* Revoke licenses
* Subscription Management |
453,030 | How can I create a product key for my C# Application?
I need to create a product (or license) key that I update annually. Additionally I need to create one for trial versions.
>
> Related:
>
>
> * [How do I best obfuscate my C# product license verification code?](https://stackoverflow.com/questions/501988)
> * [Ho... | 2009/01/17 | [
"https://Stackoverflow.com/questions/453030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53605/"
] | If you are asking about the keys that you can type in, like Windows product keys, then they are based on some checks. If you are talking about the keys that you have to copy paste, then they are based on a digitial signature (private key encryption).
A simple product key logic could be to start with saying that the pr... | You can check [LicenseSpot](http://www.licensespot.com). It provides:
* Free Licensing Component
* Online Activation
* API to integrate your app and online store
* Serial number generation
* Revoke licenses
* Subscription Management |
453,030 | How can I create a product key for my C# Application?
I need to create a product (or license) key that I update annually. Additionally I need to create one for trial versions.
>
> Related:
>
>
> * [How do I best obfuscate my C# product license verification code?](https://stackoverflow.com/questions/501988)
> * [Ho... | 2009/01/17 | [
"https://Stackoverflow.com/questions/453030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53605/"
] | Whether it's trivial or hard to crack, I'm not sure that it really makes much of a difference.
The likelihood of your app being cracked is far more proportional to its usefulness rather than the strength of the product key handling.
Personally, I think there are two classes of user. Those who pay. Those who don't. ... | Another good inexpensive tool for product keys and activations is a product called InstallKey. Take a look at [www.lomacons.com](http://www.lomacons.com) |
453,030 | How can I create a product key for my C# Application?
I need to create a product (or license) key that I update annually. Additionally I need to create one for trial versions.
>
> Related:
>
>
> * [How do I best obfuscate my C# product license verification code?](https://stackoverflow.com/questions/501988)
> * [Ho... | 2009/01/17 | [
"https://Stackoverflow.com/questions/453030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53605/"
] | If you want a simple solution just to create and verify serial numbers, try [Ellipter](http://ellipter.com). It uses elliptic curves cryptography and has an "Expiration Date" feature so you can create trial verisons or time-limited registration keys. | One simple method is using a [Globally Unique Identifier](http://en.wikipedia.org/wiki/Globally_unique_identifier) (GUID). GUIDs are usually stored as 128-bit values and are commonly displayed as 32 hexadecimal digits with groups separated by hyphens, such as `{21EC2020-3AEA-4069-A2DD-08002B30309D}`.
Use the following... |
453,030 | How can I create a product key for my C# Application?
I need to create a product (or license) key that I update annually. Additionally I need to create one for trial versions.
>
> Related:
>
>
> * [How do I best obfuscate my C# product license verification code?](https://stackoverflow.com/questions/501988)
> * [Ho... | 2009/01/17 | [
"https://Stackoverflow.com/questions/453030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53605/"
] | If you are asking about the keys that you can type in, like Windows product keys, then they are based on some checks. If you are talking about the keys that you have to copy paste, then they are based on a digitial signature (private key encryption).
A simple product key logic could be to start with saying that the pr... | There are some tools and API's available for it. However, I do not think you'll find one for free ;)
There is for instance the OLicense suite:
<http://www.olicense.de/index.php?lang=en> |
453,030 | How can I create a product key for my C# Application?
I need to create a product (or license) key that I update annually. Additionally I need to create one for trial versions.
>
> Related:
>
>
> * [How do I best obfuscate my C# product license verification code?](https://stackoverflow.com/questions/501988)
> * [Ho... | 2009/01/17 | [
"https://Stackoverflow.com/questions/453030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53605/"
] | The trick is to have an algorithm that only you know (such that it could be decoded at the other end).
There are simple things like, "Pick a prime number and add a magic number to it"
More convoluted options such as using asymmetric encryption of a set of binary data (that could include a unique identifier, version ... | You can check [LicenseSpot](http://www.licensespot.com). It provides:
* Free Licensing Component
* Online Activation
* API to integrate your app and online store
* Serial number generation
* Revoke licenses
* Subscription Management |
453,030 | How can I create a product key for my C# Application?
I need to create a product (or license) key that I update annually. Additionally I need to create one for trial versions.
>
> Related:
>
>
> * [How do I best obfuscate my C# product license verification code?](https://stackoverflow.com/questions/501988)
> * [Ho... | 2009/01/17 | [
"https://Stackoverflow.com/questions/453030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53605/"
] | I have to admit I'd do something rather insane.
1. Find a CPU bottleneck and extract it to a [P/Invokeable](http://en.wikipedia.org/wiki/Platform_Invocation_Services) DLL file.
2. As a post build action, encrypt part of the DLL file with an XOR
encryption key.
3. Select a public/private key scheme, include public key ... | The trick is to have an algorithm that only you know (such that it could be decoded at the other end).
There are simple things like, "Pick a prime number and add a magic number to it"
More convoluted options such as using asymmetric encryption of a set of binary data (that could include a unique identifier, version ... |
453,030 | How can I create a product key for my C# Application?
I need to create a product (or license) key that I update annually. Additionally I need to create one for trial versions.
>
> Related:
>
>
> * [How do I best obfuscate my C# product license verification code?](https://stackoverflow.com/questions/501988)
> * [Ho... | 2009/01/17 | [
"https://Stackoverflow.com/questions/453030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53605/"
] | If you are asking about the keys that you can type in, like Windows product keys, then they are based on some checks. If you are talking about the keys that you have to copy paste, then they are based on a digitial signature (private key encryption).
A simple product key logic could be to start with saying that the pr... | The trick is to have an algorithm that only you know (such that it could be decoded at the other end).
There are simple things like, "Pick a prime number and add a magic number to it"
More convoluted options such as using asymmetric encryption of a set of binary data (that could include a unique identifier, version ... |
453,030 | How can I create a product key for my C# Application?
I need to create a product (or license) key that I update annually. Additionally I need to create one for trial versions.
>
> Related:
>
>
> * [How do I best obfuscate my C# product license verification code?](https://stackoverflow.com/questions/501988)
> * [Ho... | 2009/01/17 | [
"https://Stackoverflow.com/questions/453030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53605/"
] | There is the option [Microsoft Software Licensing and Protection](http://www.microsoft.com/slps/) (SLP) Services as well. After reading about it I really wish I could use it.
I really like the idea of blocking parts of code based on the license. Hot stuff, and the most secure for .NET. Interesting read even if you don... | Another good inexpensive tool for product keys and activations is a product called InstallKey. Take a look at [www.lomacons.com](http://www.lomacons.com) |
453,030 | How can I create a product key for my C# Application?
I need to create a product (or license) key that I update annually. Additionally I need to create one for trial versions.
>
> Related:
>
>
> * [How do I best obfuscate my C# product license verification code?](https://stackoverflow.com/questions/501988)
> * [Ho... | 2009/01/17 | [
"https://Stackoverflow.com/questions/453030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53605/"
] | You can do something like create a record which contains the data you want to authenticate to the application. This could include anything you want - e.g. program features to enable, expiry date, name of the user (if you want to bind it to a user). Then encrypt that using some crypto algorithm with a fixed key or hash ... | Another good inexpensive tool for product keys and activations is a product called InstallKey. Take a look at [www.lomacons.com](http://www.lomacons.com) |
22,213,229 | I have this set of number `a=[1 2 3]`. And I want to put this number randomly into matrix 7 x 1, and number 1 must have 2 times, number 2 must have 3 times and number 3 must have 2 times.
The sequence is not necessary. The answer look like.
`b=[1 2 2 2 1 3 3]'` | 2014/03/06 | [
"https://Stackoverflow.com/questions/22213229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3386135/"
] | Try [`randperm`](http://www.mathworks.com/help/matlab/ref/randperm.html):
```
a=[1 2 3];
samps = [1 1 2 2 2 3 3]; % specify your desired repeats
samps = samps(randperm(numel(samps))); % shuffle them
b = a(samps)
```
Or, instead of specifying `samps` explicitly, you can specify the number of repetitions for each elem... | ```
%how often each value should occure
quantity=[2,2,3]
%values
a=[1,2,3]
l=[]
%get list of all values
for idx=1:numel(a)
l=[l,ones(1,quantity(idx))*v(idx)]
end
%shuffle l
l=l(randperm(numel(l)))
``` |
73,214,339 | Put the entire code into a question, thank you to all that have replied but this issue is super annoying either way help is appreciated!
Context: This code is meant to go onto the top reddit post of the day/week, then screenshot it and once that's done it goes to the comments and screenshots the top comments of said p... | 2022/08/02 | [
"https://Stackoverflow.com/questions/73214339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13668926/"
] | There is a potential conflict between the class you created `gui.FlowLayout` and `java.awt.FlowLayout`, the layout you have to give to your frame.
The error is due to the fact the `JFrame.setLayout()` method expects a `java.awt.FlowLayout` and not a `gui.FlowLayout` which is the only FlowLayout available in your code.... | Just add the library: ***import java.awt.FlowLayout*** |
24,696 | **The Challenge**
Using only lands and Goblins, your goal is to build a Magic: the Gathering deck that can win the game as quickly as possible, against an opponent who does nothing. You may assume that your deck is stacked, so that you will always draw exactly the cards you want.
**Scoring**
The winning answer ... | 2015/12/19 | [
"https://puzzling.stackexchange.com/questions/24696",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/7459/"
] | Got it down to turn 1 on the draw if we allow Mons's Goblin Waiters!
**Turn 1 - infinite damage on the draw (16 cards used)**
>
> Turn 0:
>
>
>
> Gemstone Caverns, exiling Mons's Goblin Raiders for irony (1 card "used")
>
>
>
>
>
> Turn 1:
>
>
>
> City of Traitors, tap both lands for 2... | I haven't touched a Magic card for about 6 years, but I'll take a shot at setting a base. Choose to play.
>
> 1. Play a mountain and cast [Goblin Lackey](http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=382959)
> 2. Play a mountain and cast [Goblin Piledriver](http://gatherer.wizards.com/Pages/Card/De... |
24,696 | **The Challenge**
Using only lands and Goblins, your goal is to build a Magic: the Gathering deck that can win the game as quickly as possible, against an opponent who does nothing. You may assume that your deck is stacked, so that you will always draw exactly the cards you want.
**Scoring**
The winning answer ... | 2015/12/19 | [
"https://puzzling.stackexchange.com/questions/24696",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/7459/"
] | Got it down to turn 1 on the draw if we allow Mons's Goblin Waiters!
**Turn 1 - infinite damage on the draw (16 cards used)**
>
> Turn 0:
>
>
>
> Gemstone Caverns, exiling Mons's Goblin Raiders for irony (1 card "used")
>
>
>
>
>
> Turn 1:
>
>
>
> City of Traitors, tap both lands for 2... | I'm assuming I can use any land I want, since it doesn't say I can only use Mountains or basics.
Choose to be on the play.
**Turn 1**: Mountain, [Goblin Lackey](http://magiccards.info/us/en/190.html)
**Turn 2**: [Ancient Tomb](http://magiccards.info/tp/en/305.html), [Goblin Rabblemaster](http://magiccards.info/m15/e... |
63,948,882 | After calculation I would like to pop up a windows displaying a message and the results. In the following example I would like to display in the pop up windows the value of x. The function winDialog seems to not be able to perform it.
```
library(sp)
library(svDialogs)
library(rgdal)
x <- runif(1, 1, 10)
if(x <= 5){
... | 2020/09/18 | [
"https://Stackoverflow.com/questions/63948882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11501898/"
] | You can use `paste()` to combine the value of your variable `x` and the text you want to print. Note that the `winDialog()` function only works under windows and not under other OS.
```
x <- runif(1, 1, 10)
winDialog("ok", paste(x, ifelse(x <= 5, "is OK", "is too big")))
```
[
tolerance <- 13
X <- 62
Y <- 250.6587
Z <- 7
winDialog("ok", paste("Total number of points:", X, "
Total surface (inch):", format(Y, digit=3),"
Number of po... |
663,821 | After choosing between "Express" or "Custom" update it keeps loading forever.


That's how it looks like.
I have been waiting for more than 24 hours, but no success.
**SYSTEM & ... | 2013/10/22 | [
"https://superuser.com/questions/663821",
"https://superuser.com",
"https://superuser.com/users/229162/"
] | I did have exactly the same problem as stated by RaphaelVidal.
In my case the solution was actually simple.
Cause of the problem looks to be a cancelled download or install of an earlier update. I could see that in the update history (see left side in Microsoft Update) that an earlier update was cancelled.
In that hi... | If anyone gets here from the future (well, the past is a bit unlikely), and can't get Microsoft Update to work, with it constantly Checking for Updates but never finishing, along with svchost.exe high CPU usage:
Try disabling Microsoft Update, at the bottom of the Settings page, linked to on the left in Windows Update... |
4,820,591 | I would like to have the SQL Server PowerShell extensions available to me whenever I start PowerShell by loading the snap-ins in my profile.ps1 script. I found an article [here](http://blogs.msdn.com/b/mwories/archive/2008/06/14/sql2008_5f00_powershell.aspx) with a script example that shows how to do this, and this wor... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4820591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241023/"
] | I've used this script without issue on x64 machines. The problem with the x86 invocation is that the script looks for registry keys which on an x64 instance are only accessible from x64 PowerShell. For the x64 invocation you could try registering the snapins since that is the error message you're receiving. Run as admi... | It's possible the snapin assemblies are compiled for x86 only due to dependencies on native 32bit SMO COM objects. If it was possible to run them in a 64bit shell, I'm pretty sure MS would have shipped both x86 and x64 management shells. |
4,820,591 | I would like to have the SQL Server PowerShell extensions available to me whenever I start PowerShell by loading the snap-ins in my profile.ps1 script. I found an article [here](http://blogs.msdn.com/b/mwories/archive/2008/06/14/sql2008_5f00_powershell.aspx) with a script example that shows how to do this, and this wor... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4820591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241023/"
] | I realise this is a bit of an older question but with a stock standard Windows and SQL Server 2012 install you can just directly use the command *Invoke-Sqlcmd* without loading anything beforehand as it will auto import the sqlps module. However letting it do that will often cause issues so import the module yourself w... | It's possible the snapin assemblies are compiled for x86 only due to dependencies on native 32bit SMO COM objects. If it was possible to run them in a 64bit shell, I'm pretty sure MS would have shipped both x86 and x64 management shells. |
4,820,591 | I would like to have the SQL Server PowerShell extensions available to me whenever I start PowerShell by loading the snap-ins in my profile.ps1 script. I found an article [here](http://blogs.msdn.com/b/mwories/archive/2008/06/14/sql2008_5f00_powershell.aspx) with a script example that shows how to do this, and this wor... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4820591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241023/"
] | I've used this script without issue on x64 machines. The problem with the x86 invocation is that the script looks for registry keys which on an x64 instance are only accessible from x64 PowerShell. For the x64 invocation you could try registering the snapins since that is the error message you're receiving. Run as admi... | I realise this is a bit of an older question but with a stock standard Windows and SQL Server 2012 install you can just directly use the command *Invoke-Sqlcmd* without loading anything beforehand as it will auto import the sqlps module. However letting it do that will often cause issues so import the module yourself w... |
5,637,650 | Test.java
```
package a;
import b.B;
public class Test {
public static void main(String[] v) {
new A().test();
new B().test();
}
}
```
A.java:
```
package a;
public class A {
protected void test() { }
}
```
B.java:
```
package b;
public class B extends a.A {
protected void test() ... | 2011/04/12 | [
"https://Stackoverflow.com/questions/5637650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371623/"
] | Here you go JLS on `protected` keyword:
[JLS protected description](http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.6.2) and [JLS protected example](http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.6.2).
Basically a `protected` modifier means that you can access field / method / ..... | This is just not how inheritance works in Java.
If a method is overridden, and the overridden method is not visible, it's a compile-time error to try and call it.
You seem to expect that Java would automatically fall back to the method in the super class, but that does not happen.
*I'll try and dig out the JLS later... |
5,637,650 | Test.java
```
package a;
import b.B;
public class Test {
public static void main(String[] v) {
new A().test();
new B().test();
}
}
```
A.java:
```
package a;
public class A {
protected void test() { }
}
```
B.java:
```
package b;
public class B extends a.A {
protected void test() ... | 2011/04/12 | [
"https://Stackoverflow.com/questions/5637650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371623/"
] | Here you go JLS on `protected` keyword:
[JLS protected description](http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.6.2) and [JLS protected example](http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.6.2).
Basically a `protected` modifier means that you can access field / method / ..... | The problem is that at compile time you are telling Java that you want to access a protected member of a class when you do not have such access.
If you did this instead;
```
A a = new B();
a.test();
```
Then it would work and the overridden method will run because at compile time Java checks that you have acces... |
5,637,650 | Test.java
```
package a;
import b.B;
public class Test {
public static void main(String[] v) {
new A().test();
new B().test();
}
}
```
A.java:
```
package a;
public class A {
protected void test() { }
}
```
B.java:
```
package b;
public class B extends a.A {
protected void test() ... | 2011/04/12 | [
"https://Stackoverflow.com/questions/5637650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371623/"
] | Here you go JLS on `protected` keyword:
[JLS protected description](http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.6.2) and [JLS protected example](http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.6.2).
Basically a `protected` modifier means that you can access field / method / ..... | Yes, overriding the protected method is possible.
```
class A{
protected void f(){
SOP("A");
}}
class B extends A{
protected void f(){
SOP("B");
}
public static void main(String...args)
{
B b=new B();
b.f();
}
}
```
Output: B |
5,637,650 | Test.java
```
package a;
import b.B;
public class Test {
public static void main(String[] v) {
new A().test();
new B().test();
}
}
```
A.java:
```
package a;
public class A {
protected void test() { }
}
```
B.java:
```
package b;
public class B extends a.A {
protected void test() ... | 2011/04/12 | [
"https://Stackoverflow.com/questions/5637650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371623/"
] | This is just not how inheritance works in Java.
If a method is overridden, and the overridden method is not visible, it's a compile-time error to try and call it.
You seem to expect that Java would automatically fall back to the method in the super class, but that does not happen.
*I'll try and dig out the JLS later... | Yes, overriding the protected method is possible.
```
class A{
protected void f(){
SOP("A");
}}
class B extends A{
protected void f(){
SOP("B");
}
public static void main(String...args)
{
B b=new B();
b.f();
}
}
```
Output: B |
5,637,650 | Test.java
```
package a;
import b.B;
public class Test {
public static void main(String[] v) {
new A().test();
new B().test();
}
}
```
A.java:
```
package a;
public class A {
protected void test() { }
}
```
B.java:
```
package b;
public class B extends a.A {
protected void test() ... | 2011/04/12 | [
"https://Stackoverflow.com/questions/5637650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371623/"
] | The problem is that at compile time you are telling Java that you want to access a protected member of a class when you do not have such access.
If you did this instead;
```
A a = new B();
a.test();
```
Then it would work and the overridden method will run because at compile time Java checks that you have acces... | Yes, overriding the protected method is possible.
```
class A{
protected void f(){
SOP("A");
}}
class B extends A{
protected void f(){
SOP("B");
}
public static void main(String...args)
{
B b=new B();
b.f();
}
}
```
Output: B |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.