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 |
|---|---|---|---|---|---|
18,722,722 | Good Morning DBA's,
I need a function to pulls an int DocumentID column and returns the lowest thousand int. The limitation is our result must have 8 chars and the leading characters need to be 0's.
* **Example 1**: 1234 (int contained in DocumentID column) Result: 00001000
(generated by function in result set)
* **... | 2013/09/10 | [
"https://Stackoverflow.com/questions/18722722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2765558/"
] | ```
var a = "Message:_27265. Task:U_AW_GEN_M";
var msg = a.split(":")[1].split(".")[0];
var task = a.split(":")[2];
console.log(msg+"---"+task);
``` | One solution is to use the `split()` method of javascript. This can be done without using jQuery, but since you have tagged the question with jQuery, I have used it within my solution.
You did not specify where the text would be coming from. So I assumed that it would be within a webpage body. Of course you can change... |
18,722,722 | Good Morning DBA's,
I need a function to pulls an int DocumentID column and returns the lowest thousand int. The limitation is our result must have 8 chars and the leading characters need to be 0's.
* **Example 1**: 1234 (int contained in DocumentID column) Result: 00001000
(generated by function in result set)
* **... | 2013/09/10 | [
"https://Stackoverflow.com/questions/18722722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2765558/"
] | You could use a regex replace callback like so:
```
var codes = [];
var message = $("#userMessage").html();//however you're fetching the message
message.replace(/(\w+:)(\w+)/g,function(a,b,c) {
codes.push(c);
});
console.log(codes);//["_27265", "U_AW_GEN_M"]
```
This particular bit of code works with any sets of... | ```
var a = "Message:_27265. Task:U_AW_GEN_M";
var msg = a.split(":")[1].split(".")[0];
var task = a.split(":")[2];
console.log(msg+"---"+task);
``` |
18,722,722 | Good Morning DBA's,
I need a function to pulls an int DocumentID column and returns the lowest thousand int. The limitation is our result must have 8 chars and the leading characters need to be 0's.
* **Example 1**: 1234 (int contained in DocumentID column) Result: 00001000
(generated by function in result set)
* **... | 2013/09/10 | [
"https://Stackoverflow.com/questions/18722722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2765558/"
] | You could use a regex replace callback like so:
```
var codes = [];
var message = $("#userMessage").html();//however you're fetching the message
message.replace(/(\w+:)(\w+)/g,function(a,b,c) {
codes.push(c);
});
console.log(codes);//["_27265", "U_AW_GEN_M"]
```
This particular bit of code works with any sets of... | One solution is to use the `split()` method of javascript. This can be done without using jQuery, but since you have tagged the question with jQuery, I have used it within my solution.
You did not specify where the text would be coming from. So I assumed that it would be within a webpage body. Of course you can change... |
39,177,072 | I have one version image\_magic installed and I need to install another one with a slightly different configuration. I want to install it in a different location so there'll be in conflict and the 2nd one won't overwrite the 1st one. How can I do that? Does it have to do with "make" and "build"? Or only with "image\_ma... | 2016/08/27 | [
"https://Stackoverflow.com/questions/39177072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6756007/"
] | To address the problem of having multiple installations of ImageMagick conflicting with each other, you can use the "--program-prefix" configuration setting, for example (after downloading and extracting the source tarball),
```
configure --with-quantum-depth=8 --prefix=$HOME \
--exec-prefix=$HOME --program-... | The text below is from their site [see installation section](https://www.imagemagick.org/script/download.php):
Instead of using rpm or deb packages to install imageMagick, you can download archive and extract them in a right location in your filesystem. After that you can set environment variable as the site says:
Ex... |
14,401,559 | Example:
I have a tab "books" with "id" (int autoincrement) as primary key,
name, author, price etc...(not important). There's 5 books and I delete the book with id=3.
When I add other books the autoincrement value will start from 6 and there's a missed 3 in the id sequence (1 2 4 5 6). So multiple delete/add can crea... | 2013/01/18 | [
"https://Stackoverflow.com/questions/14401559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1845162/"
] | You don't need to worry about performance with missing auto-increment values.
Just make sure you choose the proper [data type](http://dev.mysql.com/doc/refman/5.5/en/numeric-types.html#integer-types) for the auto-increment column so you do not run out of values. | Thats okay with auto-increment. A normal integer field would do the job for a very big amount of data. You could use "unsigned" option to increase this amount. |
137,757 | * I always have doubts about sentences such as:
>
> The subway is not so far **from the restaurant and from the hotel** where I decided to stay for a couple of days.
>
>
>
* Is it feasible to write instead:
>
> The subway is not so far **from the restaurant and the hotel** where I decided to stay for a couple o... | 2013/11/15 | [
"https://english.stackexchange.com/questions/137757",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/-1/"
] | Grammatically, you can do this. With one exception: you cannot drop the article "the" from both words. A single "the" will distribute over both:
>
> The subway is not so far from (((*the* (restaurant and hotel)) where I decided to stay) for a couple of days).
>
>
>
Don't put in the parentheses: they are my annota... | **The subway is not too from either the restaurant or the hotel, that I stayed at for a couple of days.**
Not so sure about brevity, but this makes it a little less ambiguous and better structured. |
31,189,662 | I was writing factorial using tail recursion and I have a question here. My original function looks like this
**Code snippet A**
```
#include <stdio.h>
int main(void)
{
int n = 0;
printf("Enter number to find factorial of : ");
scanf("%d",&n);
printf("fact == %d\n",fun(n,1));
return 0;
}
int fun(int n, int ... | 2015/07/02 | [
"https://Stackoverflow.com/questions/31189662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3969791/"
] | Not returning a value from a fuction which should return a value is [undefined behavior](https://stackoverflow.com/a/9936084/121747).
If it works by any luck then it's not an optimization but just a coincidence given by how and where these automatic allocated values are stored. | It works because the return value is almost always stored in a specific CPU register (`eax` for x86). This means that is you don't explicitly return a value, the return register will not be explicitly set. Because of that, its value can be anything, but it is often the return value of the last called function. Thus, en... |
31,189,662 | I was writing factorial using tail recursion and I have a question here. My original function looks like this
**Code snippet A**
```
#include <stdio.h>
int main(void)
{
int n = 0;
printf("Enter number to find factorial of : ");
scanf("%d",&n);
printf("fact == %d\n",fun(n,1));
return 0;
}
int fun(int n, int ... | 2015/07/02 | [
"https://Stackoverflow.com/questions/31189662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3969791/"
] | Not returning a value from a fuction which should return a value is [undefined behavior](https://stackoverflow.com/a/9936084/121747).
If it works by any luck then it's not an optimization but just a coincidence given by how and where these automatic allocated values are stored. | The reason why it seems to work in B is because the return value is most likely passed in a register on your architecture. So returning through all the layers of recursion (or if the compiler optimized the whole thing into iteration) nothing touches that register and your code appears to work.
A different compiler mig... |
31,189,662 | I was writing factorial using tail recursion and I have a question here. My original function looks like this
**Code snippet A**
```
#include <stdio.h>
int main(void)
{
int n = 0;
printf("Enter number to find factorial of : ");
scanf("%d",&n);
printf("fact == %d\n",fun(n,1));
return 0;
}
int fun(int n, int ... | 2015/07/02 | [
"https://Stackoverflow.com/questions/31189662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3969791/"
] | Not returning a value from a fuction which should return a value is [undefined behavior](https://stackoverflow.com/a/9936084/121747).
If it works by any luck then it's not an optimization but just a coincidence given by how and where these automatic allocated values are stored. | Here is the reason 'something' is calculated.
the call to printf() has a returned value (very rarely used) of the number of characters printed (including tabs, newlines, etc)
in the 'C' code snippet, printf() is returning 23.
'int' returned values are always returned in the same register.
The printf() set that regi... |
31,189,662 | I was writing factorial using tail recursion and I have a question here. My original function looks like this
**Code snippet A**
```
#include <stdio.h>
int main(void)
{
int n = 0;
printf("Enter number to find factorial of : ");
scanf("%d",&n);
printf("fact == %d\n",fun(n,1));
return 0;
}
int fun(int n, int ... | 2015/07/02 | [
"https://Stackoverflow.com/questions/31189662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3969791/"
] | One could speculate about the reason why this works, but there is no way to give a definitive answer: reaching the end of a value-returning function without the `return` statement and using the return value is undefined behavior, with or without optimization.
The reason this "works" in your compiler is that the return... | It works because the return value is almost always stored in a specific CPU register (`eax` for x86). This means that is you don't explicitly return a value, the return register will not be explicitly set. Because of that, its value can be anything, but it is often the return value of the last called function. Thus, en... |
31,189,662 | I was writing factorial using tail recursion and I have a question here. My original function looks like this
**Code snippet A**
```
#include <stdio.h>
int main(void)
{
int n = 0;
printf("Enter number to find factorial of : ");
scanf("%d",&n);
printf("fact == %d\n",fun(n,1));
return 0;
}
int fun(int n, int ... | 2015/07/02 | [
"https://Stackoverflow.com/questions/31189662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3969791/"
] | One could speculate about the reason why this works, but there is no way to give a definitive answer: reaching the end of a value-returning function without the `return` statement and using the return value is undefined behavior, with or without optimization.
The reason this "works" in your compiler is that the return... | The reason why it seems to work in B is because the return value is most likely passed in a register on your architecture. So returning through all the layers of recursion (or if the compiler optimized the whole thing into iteration) nothing touches that register and your code appears to work.
A different compiler mig... |
31,189,662 | I was writing factorial using tail recursion and I have a question here. My original function looks like this
**Code snippet A**
```
#include <stdio.h>
int main(void)
{
int n = 0;
printf("Enter number to find factorial of : ");
scanf("%d",&n);
printf("fact == %d\n",fun(n,1));
return 0;
}
int fun(int n, int ... | 2015/07/02 | [
"https://Stackoverflow.com/questions/31189662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3969791/"
] | One could speculate about the reason why this works, but there is no way to give a definitive answer: reaching the end of a value-returning function without the `return` statement and using the return value is undefined behavior, with or without optimization.
The reason this "works" in your compiler is that the return... | Here is the reason 'something' is calculated.
the call to printf() has a returned value (very rarely used) of the number of characters printed (including tabs, newlines, etc)
in the 'C' code snippet, printf() is returning 23.
'int' returned values are always returned in the same register.
The printf() set that regi... |
31,189,662 | I was writing factorial using tail recursion and I have a question here. My original function looks like this
**Code snippet A**
```
#include <stdio.h>
int main(void)
{
int n = 0;
printf("Enter number to find factorial of : ");
scanf("%d",&n);
printf("fact == %d\n",fun(n,1));
return 0;
}
int fun(int n, int ... | 2015/07/02 | [
"https://Stackoverflow.com/questions/31189662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3969791/"
] | It works because the return value is almost always stored in a specific CPU register (`eax` for x86). This means that is you don't explicitly return a value, the return register will not be explicitly set. Because of that, its value can be anything, but it is often the return value of the last called function. Thus, en... | The reason why it seems to work in B is because the return value is most likely passed in a register on your architecture. So returning through all the layers of recursion (or if the compiler optimized the whole thing into iteration) nothing touches that register and your code appears to work.
A different compiler mig... |
31,189,662 | I was writing factorial using tail recursion and I have a question here. My original function looks like this
**Code snippet A**
```
#include <stdio.h>
int main(void)
{
int n = 0;
printf("Enter number to find factorial of : ");
scanf("%d",&n);
printf("fact == %d\n",fun(n,1));
return 0;
}
int fun(int n, int ... | 2015/07/02 | [
"https://Stackoverflow.com/questions/31189662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3969791/"
] | Here is the reason 'something' is calculated.
the call to printf() has a returned value (very rarely used) of the number of characters printed (including tabs, newlines, etc)
in the 'C' code snippet, printf() is returning 23.
'int' returned values are always returned in the same register.
The printf() set that regi... | The reason why it seems to work in B is because the return value is most likely passed in a register on your architecture. So returning through all the layers of recursion (or if the compiler optimized the whole thing into iteration) nothing touches that register and your code appears to work.
A different compiler mig... |
35,807,653 | Use case is:
I type a long command and then I realize I need to run something else first.
I usually run it then CTRL C immediately.
I guess I could also do `echo "command" >> $HISTFILE`, but that won't work with quotes. | 2016/03/04 | [
"https://Stackoverflow.com/questions/35807653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6020600/"
] | Just use `history -s arg`.
>
> -s The args are added to the end of the history list as a single entry.
>
>
>
<http://ss64.com/bash/history.html> | You can edit the `~/.bash_history` file. |
35,807,653 | Use case is:
I type a long command and then I realize I need to run something else first.
I usually run it then CTRL C immediately.
I guess I could also do `echo "command" >> $HISTFILE`, but that won't work with quotes. | 2016/03/04 | [
"https://Stackoverflow.com/questions/35807653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6020600/"
] | As an alternative to editing the history you could use `Ctrl-U` to cut the line (note that this cuts backward from the cursor, so it should be at the end), and `Ctrl-Y` to paste it back later. `Meta-Y` used after `Ctrl-Y` will cycle through the different cut values so you can get back to previous ones as well. | You can edit the `~/.bash_history` file. |
35,807,653 | Use case is:
I type a long command and then I realize I need to run something else first.
I usually run it then CTRL C immediately.
I guess I could also do `echo "command" >> $HISTFILE`, but that won't work with quotes. | 2016/03/04 | [
"https://Stackoverflow.com/questions/35807653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6020600/"
] | Another alternative is to put a hash at the front of the line:
```
# echo this command will not execute, but it will be in the history.
``` | You can edit the `~/.bash_history` file. |
35,807,653 | Use case is:
I type a long command and then I realize I need to run something else first.
I usually run it then CTRL C immediately.
I guess I could also do `echo "command" >> $HISTFILE`, but that won't work with quotes. | 2016/03/04 | [
"https://Stackoverflow.com/questions/35807653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6020600/"
] | You can edit the `~/.bash_history` file. | This might work for you:
```
Alt-# or insert-comment will change the command into a comment and store it in command history.
```
If the command is retrieved from the history using Ctr-p then:
```
Alt--1 Alt-# will remove the comment and execute the command.
``` |
35,807,653 | Use case is:
I type a long command and then I realize I need to run something else first.
I usually run it then CTRL C immediately.
I guess I could also do `echo "command" >> $HISTFILE`, but that won't work with quotes. | 2016/03/04 | [
"https://Stackoverflow.com/questions/35807653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6020600/"
] | As an alternative to editing the history you could use `Ctrl-U` to cut the line (note that this cuts backward from the cursor, so it should be at the end), and `Ctrl-Y` to paste it back later. `Meta-Y` used after `Ctrl-Y` will cycle through the different cut values so you can get back to previous ones as well. | Just use `history -s arg`.
>
> -s The args are added to the end of the history list as a single entry.
>
>
>
<http://ss64.com/bash/history.html> |
35,807,653 | Use case is:
I type a long command and then I realize I need to run something else first.
I usually run it then CTRL C immediately.
I guess I could also do `echo "command" >> $HISTFILE`, but that won't work with quotes. | 2016/03/04 | [
"https://Stackoverflow.com/questions/35807653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6020600/"
] | Just use `history -s arg`.
>
> -s The args are added to the end of the history list as a single entry.
>
>
>
<http://ss64.com/bash/history.html> | Another alternative is to put a hash at the front of the line:
```
# echo this command will not execute, but it will be in the history.
``` |
35,807,653 | Use case is:
I type a long command and then I realize I need to run something else first.
I usually run it then CTRL C immediately.
I guess I could also do `echo "command" >> $HISTFILE`, but that won't work with quotes. | 2016/03/04 | [
"https://Stackoverflow.com/questions/35807653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6020600/"
] | Just use `history -s arg`.
>
> -s The args are added to the end of the history list as a single entry.
>
>
>
<http://ss64.com/bash/history.html> | This might work for you:
```
Alt-# or insert-comment will change the command into a comment and store it in command history.
```
If the command is retrieved from the history using Ctr-p then:
```
Alt--1 Alt-# will remove the comment and execute the command.
``` |
35,807,653 | Use case is:
I type a long command and then I realize I need to run something else first.
I usually run it then CTRL C immediately.
I guess I could also do `echo "command" >> $HISTFILE`, but that won't work with quotes. | 2016/03/04 | [
"https://Stackoverflow.com/questions/35807653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6020600/"
] | As an alternative to editing the history you could use `Ctrl-U` to cut the line (note that this cuts backward from the cursor, so it should be at the end), and `Ctrl-Y` to paste it back later. `Meta-Y` used after `Ctrl-Y` will cycle through the different cut values so you can get back to previous ones as well. | Another alternative is to put a hash at the front of the line:
```
# echo this command will not execute, but it will be in the history.
``` |
35,807,653 | Use case is:
I type a long command and then I realize I need to run something else first.
I usually run it then CTRL C immediately.
I guess I could also do `echo "command" >> $HISTFILE`, but that won't work with quotes. | 2016/03/04 | [
"https://Stackoverflow.com/questions/35807653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6020600/"
] | As an alternative to editing the history you could use `Ctrl-U` to cut the line (note that this cuts backward from the cursor, so it should be at the end), and `Ctrl-Y` to paste it back later. `Meta-Y` used after `Ctrl-Y` will cycle through the different cut values so you can get back to previous ones as well. | This might work for you:
```
Alt-# or insert-comment will change the command into a comment and store it in command history.
```
If the command is retrieved from the history using Ctr-p then:
```
Alt--1 Alt-# will remove the comment and execute the command.
``` |
35,807,653 | Use case is:
I type a long command and then I realize I need to run something else first.
I usually run it then CTRL C immediately.
I guess I could also do `echo "command" >> $HISTFILE`, but that won't work with quotes. | 2016/03/04 | [
"https://Stackoverflow.com/questions/35807653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6020600/"
] | Another alternative is to put a hash at the front of the line:
```
# echo this command will not execute, but it will be in the history.
``` | This might work for you:
```
Alt-# or insert-comment will change the command into a comment and store it in command history.
```
If the command is retrieved from the history using Ctr-p then:
```
Alt--1 Alt-# will remove the comment and execute the command.
``` |
3,035,776 | I am facing issue with the global variable, when i run in the django development server it works fine, but in apache it doesn't work
here is the code below:
```
red= "/project3/test/"
def showAddRecipe(request):
#global objc
if "userid" in request.session:
objc["ErrorMsgURL"]= ""
try:
... | 2010/06/14 | [
"https://Stackoverflow.com/questions/3035776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/317179/"
] | I would guess that you use Apache's CGI capabilities. That means that with each request the script is started anew. Which means that the global variable is initialized with each call.
Apart from that it isn't really a good idea to use globals to store what is in essence session data (with a session, and thus state, pe... | As you have been told before, using global objects is a recipe for disaster in a multi-process environment like a live Apache site. You will have multiple users all accessing each others' variables, and this will never work as you want.
extraneon is correct that you should use sessions for this - that is what they are... |
3,035,776 | I am facing issue with the global variable, when i run in the django development server it works fine, but in apache it doesn't work
here is the code below:
```
red= "/project3/test/"
def showAddRecipe(request):
#global objc
if "userid" in request.session:
objc["ErrorMsgURL"]= ""
try:
... | 2010/06/14 | [
"https://Stackoverflow.com/questions/3035776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/317179/"
] | I would guess that you use Apache's CGI capabilities. That means that with each request the script is started anew. Which means that the global variable is initialized with each call.
Apart from that it isn't really a good idea to use globals to store what is in essence session data (with a session, and thus state, pe... | Hey guys thanks for the help, yes i know using global variables is an incorrect way of doing it, but i was not able to get it work, but now its working, here's the code below:
```
def showAddRecipe(request):
#global objc
if "userid" in request.session:
objc["ErrorMsgURL"]= ""
try:
u... |
13,305,814 | I wonder when do I need to use barrier? Do I need it before/after a scatter/gather for example? Or should OMPI ensure all processes have reached that point before scatter/gather-ing? Similarly, after a broadcast can I expect all processes to already receive the message? | 2012/11/09 | [
"https://Stackoverflow.com/questions/13305814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/292291/"
] | All collective operations in MPI before MPI-3.0 are blocking, which means that it is safe to use all buffers passed to them after they return. In particular, this means that all data was received when one of these functions returns. (However, it does not imply that all data was sent!)
So MPI\_Barrier is not necessary (... | One use of `MPI_Barrier` is for example to control access to an external resource such as the filesystem, which is not accessed using MPI. For example, if you want each process to write stuff to a file in sequence, you could do it like this:
```
int rank, size;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_C... |
13,305,814 | I wonder when do I need to use barrier? Do I need it before/after a scatter/gather for example? Or should OMPI ensure all processes have reached that point before scatter/gather-ing? Similarly, after a broadcast can I expect all processes to already receive the message? | 2012/11/09 | [
"https://Stackoverflow.com/questions/13305814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/292291/"
] | All collective operations in MPI before MPI-3.0 are blocking, which means that it is safe to use all buffers passed to them after they return. In particular, this means that all data was received when one of these functions returns. (However, it does not imply that all data was sent!)
So MPI\_Barrier is not necessary (... | May MPI\_Barrier() is not often used, but it is useful.
In fact, even if you were use the synchronous communication, the MPI\_Send/Recv() can only make sure the two processes is synchronized.
In my project, a cuda+MPI project, all i used is asynchronous communication.
I found that in some cases if i dont use the MPI\_B... |
13,305,814 | I wonder when do I need to use barrier? Do I need it before/after a scatter/gather for example? Or should OMPI ensure all processes have reached that point before scatter/gather-ing? Similarly, after a broadcast can I expect all processes to already receive the message? | 2012/11/09 | [
"https://Stackoverflow.com/questions/13305814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/292291/"
] | One use of `MPI_Barrier` is for example to control access to an external resource such as the filesystem, which is not accessed using MPI. For example, if you want each process to write stuff to a file in sequence, you could do it like this:
```
int rank, size;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_C... | May MPI\_Barrier() is not often used, but it is useful.
In fact, even if you were use the synchronous communication, the MPI\_Send/Recv() can only make sure the two processes is synchronized.
In my project, a cuda+MPI project, all i used is asynchronous communication.
I found that in some cases if i dont use the MPI\_B... |
56,257,772 | I have an array with shape: `(1, 100)`, which is:
```
[[1. 2. 3. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.... | 2019/05/22 | [
"https://Stackoverflow.com/questions/56257772",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239879/"
] | You can do this with `roll`.
```
a = np.zeros((1,10))
#roll and replace
a[0] = np.roll(a[0],-1)
a[0][-1] = new_value
``` | *Append* the scalar as a list in a list so that it *has the same number of dimensions*:
```
>>> a = np.array([[0,1,2,3]])
>>> a
array([[0, 1, 2, 3]])
>>> q = 123
>>> np.append(a[:,1:],[[q]], axis=1)
array([[ 1, 2, 3, 123]])
>>>
```
Or
```
>>> b = np.array([[q]])
>>> np.concatenate([a[:,1:],b], 1)
array([[ 1, ... |
56,257,772 | I have an array with shape: `(1, 100)`, which is:
```
[[1. 2. 3. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.... | 2019/05/22 | [
"https://Stackoverflow.com/questions/56257772",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239879/"
] | ```
import numpy as np
x_pred = np.zeros((1,100))
x_pred = np.insert(x_pred, x_pred.size, 123, 1)
x_pred = np.delete(x_pred, 0, axis=1)
```
x\_pred prints:
```
array([[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
... | *Append* the scalar as a list in a list so that it *has the same number of dimensions*:
```
>>> a = np.array([[0,1,2,3]])
>>> a
array([[0, 1, 2, 3]])
>>> q = 123
>>> np.append(a[:,1:],[[q]], axis=1)
array([[ 1, 2, 3, 123]])
>>>
```
Or
```
>>> b = np.array([[q]])
>>> np.concatenate([a[:,1:],b], 1)
array([[ 1, ... |
70,161,831 | I created few `Box2D` rope joints in `libGDX`. The ropes feel a bit too floppy. How can you make the ropes more stiff? The main `Box2D project` shows an option for stiffness in their testbed demo:
[](https://i.stack.imgur.com/Om1Ry.png)
The rope on the... | 2021/11/29 | [
"https://Stackoverflow.com/questions/70161831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4565322/"
] | Oh, I get it. The joints (RopeJoint/RevoluteJoint) will not provide you with the desired effect, since they do not restrict the rotation of bodies around each other. Use WeldJoint with adjusted parameters frequency and damping ratio.
setDampingRatio(float ratio);
setFrequency(float hz);
It is difficult to say which p... | If I understood you correctly, you do not like that your rope behaves like rubber or a spring. This has to do with how box2d constraint solver works. For each connection it tries to correct the position of the bodies. Overall, it works out well. But when there are many of connections, it takes time for the solver to pu... |
885,835 | I have a major headache trying to get an image that is contained within a div to appear to float outside of its containing element.
While I'm pretty sure this just isn't possible, I want to be sure I've exhausted all avenues before telling designer and client that they're just not going to get it to look exactly as ou... | 2009/05/20 | [
"https://Stackoverflow.com/questions/885835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15609/"
] | How about doing relative positioning to the image?
```
position: relative;
top: -Xpx;
z-index: 99;
```
Where `-X` is however much it takes to get it to peek out of the DIV.
If that doesn't work I have a few other ideas, but I'd definitely like to see your HTML so I can play around with it on Firebug easily.
**EDIT... | using a negative top margin can sometimes work, depending on your HTML. |
885,835 | I have a major headache trying to get an image that is contained within a div to appear to float outside of its containing element.
While I'm pretty sure this just isn't possible, I want to be sure I've exhausted all avenues before telling designer and client that they're just not going to get it to look exactly as ou... | 2009/05/20 | [
"https://Stackoverflow.com/questions/885835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15609/"
] | How about doing relative positioning to the image?
```
position: relative;
top: -Xpx;
z-index: 99;
```
Where `-X` is however much it takes to get it to peek out of the DIV.
If that doesn't work I have a few other ideas, but I'd definitely like to see your HTML so I can play around with it on Firebug easily.
**EDIT... | ```
.icon
{
margin-top:-24px; /*icon height / 2*/
}
``` |
885,835 | I have a major headache trying to get an image that is contained within a div to appear to float outside of its containing element.
While I'm pretty sure this just isn't possible, I want to be sure I've exhausted all avenues before telling designer and client that they're just not going to get it to look exactly as ou... | 2009/05/20 | [
"https://Stackoverflow.com/questions/885835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15609/"
] | How about doing relative positioning to the image?
```
position: relative;
top: -Xpx;
z-index: 99;
```
Where `-X` is however much it takes to get it to peek out of the DIV.
If that doesn't work I have a few other ideas, but I'd definitely like to see your HTML so I can play around with it on Firebug easily.
**EDIT... | The reason your image is getting cut off is because one of the parent elements is referencing the class of "col-last", which has overflow set to "hidden". Your page is telling the browser to cut-off the image.
If you can remove that overflow attribute, or modify it to "visible", it will allow the image to overflow.
I... |
885,835 | I have a major headache trying to get an image that is contained within a div to appear to float outside of its containing element.
While I'm pretty sure this just isn't possible, I want to be sure I've exhausted all avenues before telling designer and client that they're just not going to get it to look exactly as ou... | 2009/05/20 | [
"https://Stackoverflow.com/questions/885835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15609/"
] | How about doing relative positioning to the image?
```
position: relative;
top: -Xpx;
z-index: 99;
```
Where `-X` is however much it takes to get it to peek out of the DIV.
If that doesn't work I have a few other ideas, but I'd definitely like to see your HTML so I can play around with it on Firebug easily.
**EDIT... | Try `overflow:visible` on the parent (containing) element. |
885,835 | I have a major headache trying to get an image that is contained within a div to appear to float outside of its containing element.
While I'm pretty sure this just isn't possible, I want to be sure I've exhausted all avenues before telling designer and client that they're just not going to get it to look exactly as ou... | 2009/05/20 | [
"https://Stackoverflow.com/questions/885835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15609/"
] | using a negative top margin can sometimes work, depending on your HTML. | ```
.icon
{
margin-top:-24px; /*icon height / 2*/
}
``` |
885,835 | I have a major headache trying to get an image that is contained within a div to appear to float outside of its containing element.
While I'm pretty sure this just isn't possible, I want to be sure I've exhausted all avenues before telling designer and client that they're just not going to get it to look exactly as ou... | 2009/05/20 | [
"https://Stackoverflow.com/questions/885835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15609/"
] | The reason your image is getting cut off is because one of the parent elements is referencing the class of "col-last", which has overflow set to "hidden". Your page is telling the browser to cut-off the image.
If you can remove that overflow attribute, or modify it to "visible", it will allow the image to overflow.
I... | using a negative top margin can sometimes work, depending on your HTML. |
885,835 | I have a major headache trying to get an image that is contained within a div to appear to float outside of its containing element.
While I'm pretty sure this just isn't possible, I want to be sure I've exhausted all avenues before telling designer and client that they're just not going to get it to look exactly as ou... | 2009/05/20 | [
"https://Stackoverflow.com/questions/885835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15609/"
] | Try `overflow:visible` on the parent (containing) element. | using a negative top margin can sometimes work, depending on your HTML. |
885,835 | I have a major headache trying to get an image that is contained within a div to appear to float outside of its containing element.
While I'm pretty sure this just isn't possible, I want to be sure I've exhausted all avenues before telling designer and client that they're just not going to get it to look exactly as ou... | 2009/05/20 | [
"https://Stackoverflow.com/questions/885835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15609/"
] | The reason your image is getting cut off is because one of the parent elements is referencing the class of "col-last", which has overflow set to "hidden". Your page is telling the browser to cut-off the image.
If you can remove that overflow attribute, or modify it to "visible", it will allow the image to overflow.
I... | ```
.icon
{
margin-top:-24px; /*icon height / 2*/
}
``` |
885,835 | I have a major headache trying to get an image that is contained within a div to appear to float outside of its containing element.
While I'm pretty sure this just isn't possible, I want to be sure I've exhausted all avenues before telling designer and client that they're just not going to get it to look exactly as ou... | 2009/05/20 | [
"https://Stackoverflow.com/questions/885835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15609/"
] | Try `overflow:visible` on the parent (containing) element. | ```
.icon
{
margin-top:-24px; /*icon height / 2*/
}
``` |
26,612,404 | I have method in my REST controller that contains a lot of parameters. For example:
```
@RequestMapping(value = "/getItem", method = RequestMethod.GET)
public ServiceRequest<List<SomeModel>> getClaimStatuses(
@RequestParam(value = "param1", required = true) List<String> param1,
@RequestParam(value = "p... | 2014/10/28 | [
"https://Stackoverflow.com/questions/26612404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1001120/"
] | Possible and easy, make sure that your bean has proper accessors for the fields. You can add proper validation per property, just make sure that you have the proper jars in place. In terms of code it would be something like
```
import javax.validation.constraints.NotNull;
public class RequestParamsModel {
public... | Are you trying to do
```
@RequestMapping(value = "/getItem", method = RequestMethod.GET)
public ServiceRequest<List<SomeModel>> getClaimStatuses(@ModelAttribute RequestParamsModel requestParamModel) {
...
}
``` |
29,126,441 | I want to see the java code warnings when I build my project from the command line using maven.
Currently, when I use eclipse, the IDE highlights the warns for me. So I want to have that behavior when I build my project using maven.
Thanks in advance. Juan | 2015/03/18 | [
"https://Stackoverflow.com/questions/29126441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2359543/"
] | IDE-like level of warnings cannot be achieved with javac compiler thus you have to go with a non-javac one. Below is a POM snippet:
```
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<compilerId>eclipse</compilerId>
<source>1.7</source>
... | You just need to add `<showWarnings>true</showWarnings>` to maven compiler plug-in in your pom.xml.
Please have a look at the maven compiler documentation [here](http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#showWarnings). |
32,836,768 | >
> Parse error: syntax error, unexpected '(', expecting identifier (T\_STRING) or variable (T\_VARIABLE) or '{' or '$' in C:\xampp\htdocs\code\application\controllers\user.php on line 14
>
>
>
```
<?php
class User extends CI_Controller
{
public function __construct()
{
parent:: __construct();
... | 2015/09/29 | [
"https://Stackoverflow.com/questions/32836768",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5387379/"
] | Assuming `user_model` be a function, it should be
```
$this->user_model(2);
```
Or be the **model**, you are missing the function name. Should be -
```
$this->user_model->your_function(2);
``` | This line
```
$this->user_model->(2);
```
should be
```
$this->user_model->your_method_name();
```
and inside `()` you can ***pass parameters*** as well
**Example :**
**In controller**
```
$name = $_POST['name'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$this->user_model->your_method_name($... |
430,869 | Есть такое предложение:
Карибское море, пляжи на любой вкус, простота местных, неиссякаемый позитив и немного магии.
Нашелся человек, который считает, что перед "и" должна быть запятая. | 2017/03/23 | [
"https://rus.stackexchange.com/questions/430869",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/185810/"
] | Это **односоставные (назывные) предложения,** которые практически **приравниваются к однородным членам**, поэтому запятая между ними при наличии одиночных союзов И, ДА, ИЛИ, ЛИБО также не ставится:
Шум и хохот. Мороз и солнце. Глухая ночь и вьюга. Ночь, лес и снег. Дождь или мокрый снег. | Запятая при перечислениях ставится только в особых случаях, например, при повторяющихся союзах "и". Здесь ничего особенного нет, и запятая не нужна. При простом перечислении запятая в этом месте может ставиться в американском английском ("оксфордская запятая" - по рекомендации одного из издательств) - не американец ли ... |
430,869 | Есть такое предложение:
Карибское море, пляжи на любой вкус, простота местных, неиссякаемый позитив и немного магии.
Нашелся человек, который считает, что перед "и" должна быть запятая. | 2017/03/23 | [
"https://rus.stackexchange.com/questions/430869",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/185810/"
] | Мне понятно, что хотел Ваш "человек" - паузу перед "и немного магии", потому что в конкретном и реальном ряду перечислений возникает неожиданное, нетипичное.
И очень хорошо, что он чувствует паузу, только вместо запятой для воплощения замысла следует поставить многоточие:
*Карибское море, пляжи на любой вкус, простот... | Запятая при перечислениях ставится только в особых случаях, например, при повторяющихся союзах "и". Здесь ничего особенного нет, и запятая не нужна. При простом перечислении запятая в этом месте может ставиться в американском английском ("оксфордская запятая" - по рекомендации одного из издательств) - не американец ли ... |
430,869 | Есть такое предложение:
Карибское море, пляжи на любой вкус, простота местных, неиссякаемый позитив и немного магии.
Нашелся человек, который считает, что перед "и" должна быть запятая. | 2017/03/23 | [
"https://rus.stackexchange.com/questions/430869",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/185810/"
] | Мне понятно, что хотел Ваш "человек" - паузу перед "и немного магии", потому что в конкретном и реальном ряду перечислений возникает неожиданное, нетипичное.
И очень хорошо, что он чувствует паузу, только вместо запятой для воплощения замысла следует поставить многоточие:
*Карибское море, пляжи на любой вкус, простот... | Это **односоставные (назывные) предложения,** которые практически **приравниваются к однородным членам**, поэтому запятая между ними при наличии одиночных союзов И, ДА, ИЛИ, ЛИБО также не ставится:
Шум и хохот. Мороз и солнце. Глухая ночь и вьюга. Ночь, лес и снег. Дождь или мокрый снег. |
47,668,991 | i am getting this error when **`build`** this is the full source of the file........................ below
this is a plug in for react native
full error as below
local/Android/src/main/java/com/kmlidc/RNShareLocal/RNShareLocalManager.java:51: error: RNShareLocalManager.RNShareLocalActivityEventListener is not abstract... | 2017/12/06 | [
"https://Stackoverflow.com/questions/47668991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3811034/"
] | You need to overrride the methods that are essential i.e onNewIntent i.e they are overriden methods of that class
Point on error that a small bulb will appear after clicking that you can implement methods needed. | Please implement onNewIntent()
```
private class RNShareLocalActivityEventListener implements ActivityEventListener {
public void onActivityResult(Activity activity, final int requestCode, final int resultCode, final Intent intent) {
if (requestCode == SHARE_REQUEST) {
callback.invoke("success... |
69,052,775 | ```js
class Calculator {
constructor(previousOperandTextElement, currentOperandTextElement) {
this.previousOperandTextElement = previousOperandTextElement
this.currentOperandTextElement = currentOperandTextElement
this.clear()
}
clear() {
this.previousOperandTextElement = ''
this.currentOpera... | 2021/09/04 | [
"https://Stackoverflow.com/questions/69052775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16827818/"
] | `TThread` has its own parameter-less `Create()` constructor. You should declare yours as `reintroduce` to hide the existing one, eg:
```pascal
type
TThreadManager = class(TThread)
public
constructor Create; reintroduce;
end;
```
A better option would be to call `Setup()` inside of `Create()` itself, and se... | I have found the problem in **my code** after I use suggestion 2 from remy.
After creating the method as suggested (adding TIB\_SESSION as parameter) I have found that the method is not usable because is declared in the **protected** section not public.
After putting in the correct section all is fine.
Many tk... |
55,347,558 | I want the for loop to update `<li>` items along the iteration and not. after it.
Here is the complete code:
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
... | 2019/03/25 | [
"https://Stackoverflow.com/questions/55347558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9168899/"
] | The "problem" which arises here, is that ECMAscript is a single-threaded process. In most cases, ECMAscript code runs within the such called "UI Thread". As you already might have guessed by the name, other processes, like updating and visualising DOM components (including CSS changes), are also running in this very pr... | although 100000 is a high number such for/loop doesn't take longer den some milliseconds. And due to better performance and user experience, browsers optimize refresh rate for such changes. If you want to have a visible time difference between each append, you may add timeout like this:
```
const parentUL = document.q... |
74,417,779 | Assume that we have a string like:XYYX. I want to get YXXY.How do I do that in python?
couldnt think of anything | 2022/11/13 | [
"https://Stackoverflow.com/questions/74417779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20489565/"
] | Future dates are supported by datetime.strptime. Here, you're trying to convert a date with 16 months which is leading to the error. I'm guessing you're looking for
```
datetime.strptime("2022-11-16", "%Y-%m-%d")
``` | ```
datetime.strptime("2022-11-16", "%Y-%d-%m")
```
That format string is year-day-month, but you're passing a date string of year-month-day. So it tried to interpret 16 as the month.
Your second example happened to work because it had 12 for the month. |
74,417,779 | Assume that we have a string like:XYYX. I want to get YXXY.How do I do that in python?
couldnt think of anything | 2022/11/13 | [
"https://Stackoverflow.com/questions/74417779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20489565/"
] | Future dates are supported by datetime.strptime. Here, you're trying to convert a date with 16 months which is leading to the error. I'm guessing you're looking for
```
datetime.strptime("2022-11-16", "%Y-%m-%d")
``` | Datetime strptime supports future date.
We only have 12 Months but you are asking for 16th Month which doesn't exist.
```
datetime.strptime("2022-16-11", "%Y-%d-%m")
``` |
43,715,891 | I'm adding WooCommerce custom checkout fields in a Storefront child theme **`functions.php`** file.
They have a "required" attribute.
The aim is to have these fields appear at the top of the page, before the billing fields.
when clicking the submit button to proceed to payment, I'm getting the required custom ... | 2017/05/01 | [
"https://Stackoverflow.com/questions/43715891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1067745/"
] | As you can read in **`woocommerce_before_checkout_form`** hook, it's before checkout form (so outside the checkout form). **For this reason this custom field can't work in this hook**.
You can use instead **`woocommerce_checkout_update_order_meta`** action hook, making some little changes in your code as there is no $... | You try this code. Tested Ok
```
add_action( 'woocommerce_billing_fields', 'my_custom_checkout_fields' );
function my_custom_checkout_fields( $fields ) {
$fields['billing_developer_name'] = array(
'label' => __('Developer name', 'woocommerce'),
'placeholder' => _x('Developer name', 'plac... |
43,715,891 | I'm adding WooCommerce custom checkout fields in a Storefront child theme **`functions.php`** file.
They have a "required" attribute.
The aim is to have these fields appear at the top of the page, before the billing fields.
when clicking the submit button to proceed to payment, I'm getting the required custom ... | 2017/05/01 | [
"https://Stackoverflow.com/questions/43715891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1067745/"
] | As you can read in **`woocommerce_before_checkout_form`** hook, it's before checkout form (so outside the checkout form). **For this reason this custom field can't work in this hook**.
You can use instead **`woocommerce_checkout_update_order_meta`** action hook, making some little changes in your code as there is no $... | ```
**/* If You Have Created Your Custom Field at the checkout page */**
add_action( 'woocommerce_after_checkout_validation', 'shipping_time_optionss', 9999, 2);
function shipping_time_optionss( $fields, $errors ){
// if any validation errors
if ( empty( $_POST['woo_shipping_time'] ) ) {
$errors->add( ... |
640,657 | I'm new to physics and I've been trying to solve a few high school olympiad questions. I've figured that I approach the questions by analyzing the forces acting on objects and trying to induce something from there, but it gets complicated, and I mean it (whole pages covered in equations). Then I've analytically checked... | 2021/06/01 | [
"https://physics.stackexchange.com/questions/640657",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/298720/"
] | I really wish they would teach some very basic calculus as an introduction to physics.
Anyway, we you need to realize is that the displacement of an object is mathematically equivalent to the area under the velocity vs. time curve.

So the kinematic relationship is just th... | (This supplements the graphical answer by @JAlex, which implicitly assumes constant acceleration.)
In general, the *physics-textbook definition for average-velocity* is,
$$\Delta x \stackrel{textbook\ def}{=} v\_{avg} \Delta t.$$
For simplicity, set $t\_i=0$, and let $s=\Delta x$.
Then $$s=v\_{avg} t\_f.$$
When the ... |
13,521,824 | Python 2.7.3
```
>>> print '%2.2f' % 0.1
0.10
```
The documentation I have says that type % should be the same as type f except that the input is multiplied by 100.
```
>>> print '%2.2%' % 0.1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: not all arguments converted during stri... | 2012/11/23 | [
"https://Stackoverflow.com/questions/13521824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401226/"
] | use the new format expression, which has the formatter you are referring to
```
print "{:%}".format(0.1)
#10.000000%
```
if you just want the integer part you can use the precision specification
```
print "{:.0%}".format(0.1)
#10%
```
see the doc at
<http://docs.python.org/2/library/string#formatspec>
To expan... | ```
print '%2.2%' % 0.1
```
Tells it that there are 2 placeholders in format string (%), so you have a complain |
13,521,824 | Python 2.7.3
```
>>> print '%2.2f' % 0.1
0.10
```
The documentation I have says that type % should be the same as type f except that the input is multiplied by 100.
```
>>> print '%2.2%' % 0.1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: not all arguments converted during stri... | 2012/11/23 | [
"https://Stackoverflow.com/questions/13521824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401226/"
] | use the new format expression, which has the formatter you are referring to
```
print "{:%}".format(0.1)
#10.000000%
```
if you just want the integer part you can use the precision specification
```
print "{:.0%}".format(0.1)
#10%
```
see the doc at
<http://docs.python.org/2/library/string#formatspec>
To expan... | Came across this question. In Python 3 you can simply use fstrings (thus avoiding the `.format`) in a similar way as described above. The format is:
```
print(f"{your_number:.n_decimals%}")
```
Eg.
```
>>> print(f"{0.0350:.2%}")
3.50%
``` |
13,521,824 | Python 2.7.3
```
>>> print '%2.2f' % 0.1
0.10
```
The documentation I have says that type % should be the same as type f except that the input is multiplied by 100.
```
>>> print '%2.2%' % 0.1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: not all arguments converted during stri... | 2012/11/23 | [
"https://Stackoverflow.com/questions/13521824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401226/"
] | Came across this question. In Python 3 you can simply use fstrings (thus avoiding the `.format`) in a similar way as described above. The format is:
```
print(f"{your_number:.n_decimals%}")
```
Eg.
```
>>> print(f"{0.0350:.2%}")
3.50%
``` | ```
print '%2.2%' % 0.1
```
Tells it that there are 2 placeholders in format string (%), so you have a complain |
71,848,955 | I want to reset the default styles of CSS, I'm following the guide: [A Modern CSS Reset](https://piccalil.li/blog/a-modern-css-reset/)
The guide suggest:
```css
body,
h1,
h2,
h3,
h4,
p,
li,
figure,
figcaption,
blockquote,
dl,
dd {
margin: 0;
}
```
Isn't it the same as this?
```css
*{
margin: 0;
}
```
Why sho... | 2022/04/12 | [
"https://Stackoverflow.com/questions/71848955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17142728/"
] | With `* {...}` you reset / modify all possible tags. With `div, p { ... }` you will reset / modify only div, p tags. | Because they aren't the same.
The list of elements in the above CSS snippet aren't *all* the HTML tags. For starters, the `video` tag isn't added, so it's not equivalent to `*`, which would encompass *all* of the (visual) HTML elements.
Here is a [resource that shows all the tags](https://www.w3schools.com/TAGs/?mscl... |
71,848,955 | I want to reset the default styles of CSS, I'm following the guide: [A Modern CSS Reset](https://piccalil.li/blog/a-modern-css-reset/)
The guide suggest:
```css
body,
h1,
h2,
h3,
h4,
p,
li,
figure,
figcaption,
blockquote,
dl,
dd {
margin: 0;
}
```
Isn't it the same as this?
```css
*{
margin: 0;
}
```
Why sho... | 2022/04/12 | [
"https://Stackoverflow.com/questions/71848955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17142728/"
] | Generally removing all default styles from all elements is not what you want. Some default styles just works fine and it's easier to let them be there :) | Because they aren't the same.
The list of elements in the above CSS snippet aren't *all* the HTML tags. For starters, the `video` tag isn't added, so it's not equivalent to `*`, which would encompass *all* of the (visual) HTML elements.
Here is a [resource that shows all the tags](https://www.w3schools.com/TAGs/?mscl... |
71,848,955 | I want to reset the default styles of CSS, I'm following the guide: [A Modern CSS Reset](https://piccalil.li/blog/a-modern-css-reset/)
The guide suggest:
```css
body,
h1,
h2,
h3,
h4,
p,
li,
figure,
figcaption,
blockquote,
dl,
dd {
margin: 0;
}
```
Isn't it the same as this?
```css
*{
margin: 0;
}
```
Why sho... | 2022/04/12 | [
"https://Stackoverflow.com/questions/71848955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17142728/"
] | It's not the same. Let me try to explain.
The linked guide suggests resetting elements. The author wants to define their own margins on each of the elements.
**Example 1:**
```
*,
*::before,
*::after {
box-sizing: border-box;
}
```
This removes the box-sizing from the defined elements, meaning all elements and a... | Because they aren't the same.
The list of elements in the above CSS snippet aren't *all* the HTML tags. For starters, the `video` tag isn't added, so it's not equivalent to `*`, which would encompass *all* of the (visual) HTML elements.
Here is a [resource that shows all the tags](https://www.w3schools.com/TAGs/?mscl... |
16,846,292 | I am starting to write a command line converter and the only concern I have is user input (rest wont be hard). The program will have few commands like (convert 2 m to km), so when the user enters that, the program will output the converted value. My question is, what is the best way to parse user input and determine th... | 2013/05/30 | [
"https://Stackoverflow.com/questions/16846292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1527217/"
] | If you only have a few commands, it will be best to just `strtok(input, ' ')`, which just splits up a string into an array of words in the command (assuming your command words are all separated by spaces). Then you can do some simple if/switch checks to see which command the user entered. For a larger number of command... | An array of structures will be fine. The structure may be like this:
```
struct cmd
{
char **usrcmd;
void (*fc)();
};
```
Then you just have to iterate the array and compare the user input and the usrcmd[0] field (I assume the command is the first word).
However this solution is not the best way to go if yo... |
16,846,292 | I am starting to write a command line converter and the only concern I have is user input (rest wont be hard). The program will have few commands like (convert 2 m to km), so when the user enters that, the program will output the converted value. My question is, what is the best way to parse user input and determine th... | 2013/05/30 | [
"https://Stackoverflow.com/questions/16846292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1527217/"
] | I have written a few types of "simple parsers" (and several more advanced ones). From what you describe, if the commands are "convert 2 m to km", then you would simply need to split things on spaces.
Of course, if you allow "convert2mtokm" and "convert 2m to km" it gets a bit more difficult to deal with. Sticking to ... | An array of structures will be fine. The structure may be like this:
```
struct cmd
{
char **usrcmd;
void (*fc)();
};
```
Then you just have to iterate the array and compare the user input and the usrcmd[0] field (I assume the command is the first word).
However this solution is not the best way to go if yo... |
16,846,292 | I am starting to write a command line converter and the only concern I have is user input (rest wont be hard). The program will have few commands like (convert 2 m to km), so when the user enters that, the program will output the converted value. My question is, what is the best way to parse user input and determine th... | 2013/05/30 | [
"https://Stackoverflow.com/questions/16846292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1527217/"
] | I have written a few types of "simple parsers" (and several more advanced ones). From what you describe, if the commands are "convert 2 m to km", then you would simply need to split things on spaces.
Of course, if you allow "convert2mtokm" and "convert 2m to km" it gets a bit more difficult to deal with. Sticking to ... | If you only have a few commands, it will be best to just `strtok(input, ' ')`, which just splits up a string into an array of words in the command (assuming your command words are all separated by spaces). Then you can do some simple if/switch checks to see which command the user entered. For a larger number of command... |
18,437,449 | Can any one tell me the regular expression for textfield which should not allow following characters and can accept other special characters,alphabets,numbers and so on :
```
+ - && || ! ( ) { } [ ] ^ " ~ * ? : \ @ &
``` | 2013/08/26 | [
"https://Stackoverflow.com/questions/18437449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1268130/"
] | this will not allow string that contains any of the characters in any part of the string mentioned above.
```
^(?!.*[+\-&|!(){}[\]^"~*?:@&]+).*$
```
* [See Here](https://dl.dropboxusercontent.com/u/29622718/regex1.JPG)
Brief Explanation
* Assert position at the beginning of a line (at beginning of the string or af... | Its usually better to whitelist characters you allow, rather than to blacklist characters you don't allow. both from a security standpoint, and from an ease of implementation standpoint.
If you do go down the blacklist route, here is an example, but be warned, the syntax is not simple.
<http://groups.google.com/group... |
18,437,449 | Can any one tell me the regular expression for textfield which should not allow following characters and can accept other special characters,alphabets,numbers and so on :
```
+ - && || ! ( ) { } [ ] ^ " ~ * ? : \ @ &
``` | 2013/08/26 | [
"https://Stackoverflow.com/questions/18437449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1268130/"
] | this will not allow string that contains any of the characters in any part of the string mentioned above.
```
^(?!.*[+\-&|!(){}[\]^"~*?:@&]+).*$
```
* [See Here](https://dl.dropboxusercontent.com/u/29622718/regex1.JPG)
Brief Explanation
* Assert position at the beginning of a line (at beginning of the string or af... | I recognize those as the characters which need to be escaped for Solr. If this is the case, and if you are coding in PHP, then you should use my [PHP utility functions](https://github.com/dotancohen/utility-functions) from Github. Here is one of the Solr functions from there:
```
/**
* Escape values destined for Solr
... |
21,569,039 | I make a tweak that works in backboardd, if I just respring after install it, it doesn't work, I have to restart the my iPhone entirely. Are there any other better ways need not restarting device? | 2014/02/05 | [
"https://Stackoverflow.com/questions/21569039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/385127/"
] | You can execute this in your postinst script if you are installing your tweak as debian package (\*.deb)
```
launchctl stop com.apple.backboardd
```
Backboard will restart automatically and cydia-substrate should be able to inject your tweak in it. | Note: since you say that you're using iOSOpenDev to create your tweaks, there's another option, altho the `postinst` file works fine, too.
Add another post-install command to the custom build script that iOSOpenDev will have created for your project.
You should already see this under the **Target**->**Build Phases**... |
6,112,777 | `
Hi,
I have requirement of using my own background and blue light for toggle button.
However, using this i am not able to custom position light of toggle button which is always placed to the bottom of button.
I want to move it above and just below center of button.
I tried with paddingBottom but that did not hel... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6112777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/612465/"
] | That light is part of the nine-patch png. If you create new backgrounds, you need to add your own "on" and "off" circles to the file. You then use the border lines of the nine-patch to prevent stretching of the circle.
<http://developer.android.com/guide/developing/tools/draw9patch.html>
Read also my answer here for ... | Use a relativeLayout and do android:layout\_Below, if I understand your question correctly |
6,112,777 | `
Hi,
I have requirement of using my own background and blue light for toggle button.
However, using this i am not able to custom position light of toggle button which is always placed to the bottom of button.
I want to move it above and just below center of button.
I tried with paddingBottom but that did not hel... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6112777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/612465/"
] | Use a LayerList and position the graphic on the toggle button by enclosing the drawable in a bitmap tag, and set its gravity to 'center' - see [LayerList here](http://developer.android.com/guide/topics/resources/drawable-resource.html#LayerList) | Use a relativeLayout and do android:layout\_Below, if I understand your question correctly |
11,924,484 | Can I create a class with a default return value? Lets say if I create an object of this class I get always a specific value, without calling the properties or something else. Example:
```
int i = new MyIntClass(/*something*/); //will return an int
```
Actually I would like to use a default function for returning so... | 2012/08/12 | [
"https://Stackoverflow.com/questions/11924484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1500828/"
] | You can do an implicit cast.
Example (add to class):
```
public static implicit operator double(MyCalculator c)
{
return c.DoMath();
}
``` | If I follow you, you want a `MyCalculator` to have a `double` it can be treated as. You can do this with an implicit cast operator overload. Put this in the definition of `MyCalculator`:
```
public static implicit operator double(MyCalculator m)
{
return m.DoMath();
}
```
However, it somewhat hides what's going on... |
58,989,392 | I have a story board file as the launch screen. I have set image in button background Image. In that image, I have an image set for light and dark mode. but when I switch to dark mode, it always shows light mode image. | 2019/11/22 | [
"https://Stackoverflow.com/questions/58989392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm not sure if you still need an answer to this, but I recently had the same issue.
For me, what fixed this was to uncheck the box 'Preserve Vector Data' within the image set properties. This means resizing won't work on the vector image, but you will see the image change with light/dark mode toggled within the storyb... | Make sure you have enabled Appearance to Any, Dark. And check that you have added images for dark mode appearance.
[](https://i.stack.imgur.com/q73Uy.png) |
33,408,869 | i want to create Customer diary on the base of customerID that present in customer table[](https://i.stack.imgur.com/NRIPG.png).
In customerID field i want dropdown list having list of CustomerId's that are present in database
How can i do that ? can someone help me... | 2015/10/29 | [
"https://Stackoverflow.com/questions/33408869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5501839/"
] | ```
var _objAllCustomerIds = null;
using (AdventureWorksEntities context = new AdventureWorksEntities())
{
_objAllCustomerIds = context.MyCustomers.Select(customer => customer.Id).ToList();
}
```
>
> //where AdventureWorksEntities is your DBcontent containing all your entities
> //MyCustomers is the enti... | if this is in your .aspx file
then in your .aspx.cs file (assuming you're using code behind) you'd get the list of customer IDs and then bind that list to this dropdown.
Does this answer from another question help?
[How to bind the selected value of a DropDownList](https://stackoverflow.com/questions/604186/how-to-bi... |
66,286 | I can establish a connection to my university VPN (Cisco IPSec). In addition I have to set a proxy, in this case I have the URL of a .pac file.
When I set this in the VPN-settings, the proxy is not used by Safari or Chrome. How can I set proxy settings for my VPN? I don't want to put this in the main network settings ... | 2012/10/04 | [
"https://apple.stackexchange.com/questions/66286",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/5278/"
] | Under Mavericks this should work fine. Once you have all the security details set in your VPN connection click on `Advanced` and then `Proxies`.
Make sure you select `Automatic Proxy Configuration` and put the complete URL provided by your IT staff into the URL field. This will almost certainly be different to the pro... | Setting it in the VPN connection settings works as expected for me.
Make sure you check the Web Proxy (HTTP) checkbox (or other types of proxies if required) and fill out the correct proxy server details. You probably also need to enable "Send all traffic over VPN connection" in the VPN's advanced configuration.
Afte... |
26,005,684 | I'm having an issue sending our certificate (client) to another server during a web service call.
We're expected to return the certificate with the CN:
```
b2b-test
```
however whenever we receive the servers certificate and attempt to send our own, we're getting:
```
Unable to find valid certificate path to requ... | 2014/09/23 | [
"https://Stackoverflow.com/questions/26005684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1978714/"
] | Assuming you've already got the entered words, you can do something like this:
```
public static void main(String[] args)
{
String[] enteredWords = {"here", "there", "everywhere"};
List<String> randomWords = Arrays.asList(enteredWords);
Collections.shuffle(randomWords);
System.out.println(randomWords);... | Put the strings in an array and then randomly access the index of the array. |
26,005,684 | I'm having an issue sending our certificate (client) to another server during a web service call.
We're expected to return the certificate with the CN:
```
b2b-test
```
however whenever we receive the servers certificate and attempt to send our own, we're getting:
```
Unable to find valid certificate path to requ... | 2014/09/23 | [
"https://Stackoverflow.com/questions/26005684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1978714/"
] | Assuming you've already got the entered words, you can do something like this:
```
public static void main(String[] args)
{
String[] enteredWords = {"here", "there", "everywhere"};
List<String> randomWords = Arrays.asList(enteredWords);
Collections.shuffle(randomWords);
System.out.println(randomWords);... | You can also use the Scanner class to use your custom inputs to be sorted out
```
Scanner scan=new Scanner(System.in);
for(int i=0;i<5;i++)
{
System.out.println("Enter a character");
String someValue[i]=scan.nextLine();
}
```
Iterate the process using loops and store it in an array until you have given all th... |
45,740,394 | I'm attempting to capture a PayPal transaction that has been authorized using the PayPal button. I'm trying to use CyberSource Simple Order API to do this. I have the only 3 pieces of information that seem to come back from the PayPal button are: `payerID`, `paymentID` and `paymentToken`. I've tried a few ways of handi... | 2017/08/17 | [
"https://Stackoverflow.com/questions/45740394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/727857/"
] | Have you tried setting up your request like this? Pay no attention to the values I used, but I am looking at the example in the docs [(Example 21 Request for payPalDoCaptureService).](http://apps.cybersource.com/library/documentation/dev_guides/PayPal_Express_SO/PayPal_Express_SO_API.pdf) You'll need to ctrl+f to find ... | As the error says you have git invalid data, please check the reply fields **invalidField\_0 through invalidField\_N** for
the invalid fields.
I hope these [Requesting the Authorization Service](http://apps.cybersource.com/library/documentation/dev_guides/apple_payments/SCMP_API/html/wwhelp/wwhimpl/common/html/wwhelp.... |
45,740,394 | I'm attempting to capture a PayPal transaction that has been authorized using the PayPal button. I'm trying to use CyberSource Simple Order API to do this. I have the only 3 pieces of information that seem to come back from the PayPal button are: `payerID`, `paymentID` and `paymentToken`. I've tried a few ways of handi... | 2017/08/17 | [
"https://Stackoverflow.com/questions/45740394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/727857/"
] | I did end up solving this problem. My question involving whether I needed to employ CyberSource from end-to-end was the correct path. Eventually I figured out - after talking for days with CyberSource support - that I needed to use their "Set Service" in a WebApi method to generate the PayPal "token" and give that to t... | As the error says you have git invalid data, please check the reply fields **invalidField\_0 through invalidField\_N** for
the invalid fields.
I hope these [Requesting the Authorization Service](http://apps.cybersource.com/library/documentation/dev_guides/apple_payments/SCMP_API/html/wwhelp/wwhimpl/common/html/wwhelp.... |
45,740,394 | I'm attempting to capture a PayPal transaction that has been authorized using the PayPal button. I'm trying to use CyberSource Simple Order API to do this. I have the only 3 pieces of information that seem to come back from the PayPal button are: `payerID`, `paymentID` and `paymentToken`. I've tried a few ways of handi... | 2017/08/17 | [
"https://Stackoverflow.com/questions/45740394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/727857/"
] | I did end up solving this problem. My question involving whether I needed to employ CyberSource from end-to-end was the correct path. Eventually I figured out - after talking for days with CyberSource support - that I needed to use their "Set Service" in a WebApi method to generate the PayPal "token" and give that to t... | Have you tried setting up your request like this? Pay no attention to the values I used, but I am looking at the example in the docs [(Example 21 Request for payPalDoCaptureService).](http://apps.cybersource.com/library/documentation/dev_guides/PayPal_Express_SO/PayPal_Express_SO_API.pdf) You'll need to ctrl+f to find ... |
19,383,767 | I have an array:
```
char array[4][4][2];
```
What i want is a table 4x4, that allocate a string of two characters on each position. But, when i initialize the array like that:
```
char array[4][4][2] = {{"AA", "BB"," ", " "}, {"CC", "DD", " ", " "}, {"EE","FF"," "," "}};
```
And make:
```
printf("%s\n", a... | 2013/10/15 | [
"https://Stackoverflow.com/questions/19383767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2153687/"
] | A string in C requires a terminator, `'\0'`. So a 2-character array is too small for a string with two visible characters.
It's a feature of C's string array initialization that you don't get a warning or error for doing what you do; as often in C it's assumed that you know what you're doing.
If you do:
```
char foo... | Indeed it is correct initialization of `char` array. but you can't use `%s` as your array is not NUL (`\0`) terminated. According to your declaration you can write:
```
printf("%c%c\n", array[0][0][0], array[0][0][1]);
```
Or correct array dimension so that it accommodates a string of length 2, followed by the `'\0... |
19,383,767 | I have an array:
```
char array[4][4][2];
```
What i want is a table 4x4, that allocate a string of two characters on each position. But, when i initialize the array like that:
```
char array[4][4][2] = {{"AA", "BB"," ", " "}, {"CC", "DD", " ", " "}, {"EE","FF"," "," "}};
```
And make:
```
printf("%s\n", a... | 2013/10/15 | [
"https://Stackoverflow.com/questions/19383767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2153687/"
] | A string in C requires a terminator, `'\0'`. So a 2-character array is too small for a string with two visible characters.
It's a feature of C's string array initialization that you don't get a warning or error for doing what you do; as often in C it's assumed that you know what you're doing.
If you do:
```
char foo... | Try the following:
```
int ii, jj;
const char *array[2][2] = {{"hello", "world"},{"these are", "strings"}};
for (ii=0; ii<2; ii++) {
for (jj=0; jj<2; jj++) {
printf("%s\n", array[ii][jj]);
}
}
```
This shows you how to properly allocate a 2D array of strings - you don't determine the size of each string, it ... |
30,308,485 | Simple utility to get a file for use.
Using openfiledialog I am trying to get the full path EG: File = text1.txt and it is located in c:\temp. So the full path is C:\temp\text1.txt.
But all I can get is the file name. I've searched I've hunted, I'e tried for a couple of hours and nothing works.
Here is code with com... | 2015/05/18 | [
"https://Stackoverflow.com/questions/30308485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1292107/"
] | The MSDN documentation and numerous posts all over the place say all you need is openfiledialog.FileName. However this did not work for me, can't tell you why. What DID work is to use this:
```
TB_ReplacementFile.Text = System.IO.Path.GetFullPath(openFileDialog1.FileName)
```
This works great, I get what I need. I ... | The [FileName Property](https://msdn.microsoft.com/en-us/library/system.windows.forms.filedialog.filename(v=vs.110).aspx) returns the full path.
>
> The file name includes both the file path and the extension. If no files are selected, this method returns an empty string ("").
>
>
>
```
If (openFileDialog1.ShowDi... |
30,308,485 | Simple utility to get a file for use.
Using openfiledialog I am trying to get the full path EG: File = text1.txt and it is located in c:\temp. So the full path is C:\temp\text1.txt.
But all I can get is the file name. I've searched I've hunted, I'e tried for a couple of hours and nothing works.
Here is code with com... | 2015/05/18 | [
"https://Stackoverflow.com/questions/30308485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1292107/"
] | The [FileName Property](https://msdn.microsoft.com/en-us/library/system.windows.forms.filedialog.filename(v=vs.110).aspx) returns the full path.
>
> The file name includes both the file path and the extension. If no files are selected, this method returns an empty string ("").
>
>
>
```
If (openFileDialog1.ShowDi... | Not 100% sure if this would resolve the issue you're having, or if it's simply just another way to handle it, but I prefer to check the DialogResult. I.E:
```
Dim openFileDialog1 As New OpenFileDialog()
openFileDialog1.InitialDirectory = "Z:\"
openFileDialog1.RestoreDirectory = True
If openFileDialog1.ShowDialog = ... |
30,308,485 | Simple utility to get a file for use.
Using openfiledialog I am trying to get the full path EG: File = text1.txt and it is located in c:\temp. So the full path is C:\temp\text1.txt.
But all I can get is the file name. I've searched I've hunted, I'e tried for a couple of hours and nothing works.
Here is code with com... | 2015/05/18 | [
"https://Stackoverflow.com/questions/30308485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1292107/"
] | The [FileName Property](https://msdn.microsoft.com/en-us/library/system.windows.forms.filedialog.filename(v=vs.110).aspx) returns the full path.
>
> The file name includes both the file path and the extension. If no files are selected, this method returns an empty string ("").
>
>
>
```
If (openFileDialog1.ShowDi... | this worked to get the directory or path
dim sDir as String = System.IO.Path.**GetDirectoryName**(openfiledialog1.FileName.ToString) |
30,308,485 | Simple utility to get a file for use.
Using openfiledialog I am trying to get the full path EG: File = text1.txt and it is located in c:\temp. So the full path is C:\temp\text1.txt.
But all I can get is the file name. I've searched I've hunted, I'e tried for a couple of hours and nothing works.
Here is code with com... | 2015/05/18 | [
"https://Stackoverflow.com/questions/30308485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1292107/"
] | The MSDN documentation and numerous posts all over the place say all you need is openfiledialog.FileName. However this did not work for me, can't tell you why. What DID work is to use this:
```
TB_ReplacementFile.Text = System.IO.Path.GetFullPath(openFileDialog1.FileName)
```
This works great, I get what I need. I ... | Not 100% sure if this would resolve the issue you're having, or if it's simply just another way to handle it, but I prefer to check the DialogResult. I.E:
```
Dim openFileDialog1 As New OpenFileDialog()
openFileDialog1.InitialDirectory = "Z:\"
openFileDialog1.RestoreDirectory = True
If openFileDialog1.ShowDialog = ... |
30,308,485 | Simple utility to get a file for use.
Using openfiledialog I am trying to get the full path EG: File = text1.txt and it is located in c:\temp. So the full path is C:\temp\text1.txt.
But all I can get is the file name. I've searched I've hunted, I'e tried for a couple of hours and nothing works.
Here is code with com... | 2015/05/18 | [
"https://Stackoverflow.com/questions/30308485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1292107/"
] | The MSDN documentation and numerous posts all over the place say all you need is openfiledialog.FileName. However this did not work for me, can't tell you why. What DID work is to use this:
```
TB_ReplacementFile.Text = System.IO.Path.GetFullPath(openFileDialog1.FileName)
```
This works great, I get what I need. I ... | this worked to get the directory or path
dim sDir as String = System.IO.Path.**GetDirectoryName**(openfiledialog1.FileName.ToString) |
71,278,688 | I'm training a custom dataset in yolor. I successfully run its once but after some time, I cant manage to do it very well.
The first error I noticed is in the training part:
```
Traceback (most recent call last): File "train.py", line 537, in <module>
train(hyp, opt, device, tb_writer, wandb) File "train.py",... | 2022/02/26 | [
"https://Stackoverflow.com/questions/71278688",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18317623/"
] | To compare two strings in `C` use the `strcmp(str1, str2)`, it compares two strings character by character. If the strings are equal, the function returns 0.
Instead of this `Guess != Password` use this `strcmp(Guess , Password) == 0`. | You cannot compare strings with `==` and `!=` operators in C. For that purpose use `strcmp()` function which is defined in `string.h` header file.
That was the reason integers were working but string weren't. You can say that you cannot compare arrays with those equality operators.
Also, you are using `scanf()` funct... |
4,237,488 | Is there any way in Java so that I can obtain all the Unicode characters of a particular language (for example Bengali or Arabic)? | 2010/11/21 | [
"https://Stackoverflow.com/questions/4237488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/298160/"
] | The java.lang.Character class has a inner static class called UnicodeBlock. You can, for example, get the Arabic Unicode Block thusly:
```
Character.UnicodeBlock block = Character.UnicodeBlock.ARABIC;
```
By iterating over all characters (or more precisely, Unicode code points) it is possible to check each to find i... | Until 1.7, Java has no support for scripts in Unicode. Java has very sketchy Unicode property support, though. It is basically stuck at antemillennial incarnations of Unicode. This is a real problem. They claim they’ll catch up to Unicode 6 with JDK7, but I haven’t seen any evidence yet that they will have proper prope... |
49,660,166 | In my use case (Angular 5 app embedded in a greater website), I am using hash location strategy
```
@NgModule({
imports: [RouterModule.forRoot(routes, {useHash: true})]
})
```
So my application paths are like `website.com/#/home` and `website.com/#/profile`
App works ok, but I run into one problem in Internet Exp... | 2018/04/04 | [
"https://Stackoverflow.com/questions/49660166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3977061/"
] | After @DiabolicWords got me to understand that the issue was strictly an Internet Explorer caching issue (IE 11 caches XHR Get responses), I settled on sending a unique query param value with each XHR Get request.
I used [an HttpInterceptor](https://angular.io/guide/http#intercepting-requests-and-responses)
```
@Inje... | Here is an example how to set the timestamp
```
private requestOptions: RequestOptionsArgs = {};
private requestUrlSearchParams = new URLSearchParams();
setSearchParamsTimeStamp() {
this.requestUrlSearchParams.set('timestamp', (new Date()).getTime().toString());
this.requestOptions.search = this.requestUrlSea... |
820,763 | We had some DNS issues this morning and after they were fixed we were asked to apply
```
ipconfig /flushdns
```
To refresh our local caches.
Some people got the changes automatically while others had to apply this. That got me wondering as where in Windows 10 this setting is controlled. Is it server controlled or ... | 2016/12/14 | [
"https://serverfault.com/questions/820763",
"https://serverfault.com",
"https://serverfault.com/users/4053/"
] | I concur with Joeqwerty but would like to add you can check the length of the TTL of DNS records by running the command **ipconfig /displaydns**. This will show all the dns records your machine has cached and how long it will keep it for. If your machine has a lot of cached entries you can pipe the command to a txt fil... | DNS records cached in the local DNS cache are governed by the TTL of those records. The TTL is defined for those records in the DNS zone itself on the DNS server. |
6,084,140 | Apple clearly has this automated in some way, I would like to have access to a version of the system they're using.
Barring that, I'm interested in knowing if anyone out there has implemented a this on their own. I sometimes work in a team where the lesser experienced developers may unknowingly use a non-public API *... | 2011/05/21 | [
"https://Stackoverflow.com/questions/6084140",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/230571/"
] | there's this one, App Scanner <http://www.chimpstudios.com/appscanner/> | If you're calling an API that isn't in one of Apple's public headers, you'll get compiler warnings like "selector not recognized". It should be quite rare that you would accidentally use private APIs.
Now, it's possible to suppress the compiler warnings if you take specific steps to do so— creating your own interface ... |
44,039,539 | Hi I am beginner in node js mongodb. I want to insert data in mongodb. First I check user exist in users collection then data insert and after complete process then callback. Please give suggestion
```
exports.contactSync = function contactSync(data, userId, callback) {
var Promise = require('promise');
Mo... | 2017/05/18 | [
"https://Stackoverflow.com/questions/44039539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1523152/"
] | First, you seem to suggest that the main purpose of C header files is mutual recursion. I do not agree with that. Rather I see C header files as an attempt at interface/implementation separation. In that sense, OCaml does not lack anything when compared to C.
Now for mutual recursion itself: It is not supported across... | Ocaml has module interface files `.mli` which play a role equivalent of header files `.h` in C and C++. Read the [§2.5 Modules and Separate Compilation](https://caml.inria.fr/pub/docs/manual-ocaml/moduleexamples.html#sec22) chapter of the Ocaml documentation. Actually what is important is the `.cmi` compiled form of th... |
44,039,539 | Hi I am beginner in node js mongodb. I want to insert data in mongodb. First I check user exist in users collection then data insert and after complete process then callback. Please give suggestion
```
exports.contactSync = function contactSync(data, userId, callback) {
var Promise = require('promise');
Mo... | 2017/05/18 | [
"https://Stackoverflow.com/questions/44039539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1523152/"
] | In fact, this is not about headers, as they are just pieces of code, that are copy-pasted into files using the preprocessor. The root of your question is why we need a full definition of an external value, in order to compile a unit. For example, in C, you can freely use any external function, given that you provided t... | First, you seem to suggest that the main purpose of C header files is mutual recursion. I do not agree with that. Rather I see C header files as an attempt at interface/implementation separation. In that sense, OCaml does not lack anything when compared to C.
Now for mutual recursion itself: It is not supported across... |
44,039,539 | Hi I am beginner in node js mongodb. I want to insert data in mongodb. First I check user exist in users collection then data insert and after complete process then callback. Please give suggestion
```
exports.contactSync = function contactSync(data, userId, callback) {
var Promise = require('promise');
Mo... | 2017/05/18 | [
"https://Stackoverflow.com/questions/44039539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1523152/"
] | In fact, this is not about headers, as they are just pieces of code, that are copy-pasted into files using the preprocessor. The root of your question is why we need a full definition of an external value, in order to compile a unit. For example, in C, you can freely use any external function, given that you provided t... | Ocaml has module interface files `.mli` which play a role equivalent of header files `.h` in C and C++. Read the [§2.5 Modules and Separate Compilation](https://caml.inria.fr/pub/docs/manual-ocaml/moduleexamples.html#sec22) chapter of the Ocaml documentation. Actually what is important is the `.cmi` compiled form of th... |
68,058,578 | I have a table that looks like
| UserId | Source | HeartRate | BreathRate |
| --- | --- | --- | --- |
| uuid | 100 | 67 | 20 |
| uuid | 200 | 67 | 24 |
| uuid | 100 | 67 | 21 |
| uuid | 200 | 67 | 19 |
| uuid | 100 | 69 | 25 |
| uuid | 200 | 69 | 22 |
| uuid | 200 | 69 | 23 |
```
(select
"UserId",
"Source",
... | 2021/06/20 | [
"https://Stackoverflow.com/questions/68058578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/733213/"
] | Something like 3 boxview + 1 Frame (shape will also work, but haven't try):
[Click for Big image](https://i.stack.imgur.com/f0qdQ.png)
[](https://i.stack.imgur.com/f0qdQm.png)
MainPage.xaml
-------------
```
<?xml version="1.0" encoding="utf-8" ?>... | To customize the Item appearance, refer answer - <https://stackoverflow.com/a/68066760/12790619>
Also, you can use **DataTemplateSelector** to achieve this requirement without using additional properties to customize the item. Please find the code snippets for more reference,
```
<ContentPage.Resources>
<Resource... |
46,613,863 | I have a booking table with the following columns:
id, start\_date, end\_date
I want to know which days have had the most bookings over my dataset.
I can use dayofweek() on the start date and group by this also and use a count(\*). But I also want to include the days between the start of booking and end.
An example... | 2017/10/06 | [
"https://Stackoverflow.com/questions/46613863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3779076/"
] | ok now I solved this error simply by creating a method and creating and initializing FragmentManager and FragmentTrasaction there and it works great for me. May be error was due to the fact that we can commit FragmentTransaction only for once for multiple commit we need to declare it again and again btw thnks. here's m... | You need a brand new transaction for your each click but you are beginning only once in your `onCreate()` and try to `commit()` multiple times. You can update your code as follows to get rid of the problem:
```
// Remove following two lines...
// FragmentManager fragmentManager;
// FragmentTransaction fragmentTransact... |
15,984,535 | My scenario is about cross-compiling to a Arduino Due (ARM target), but I guess it's a generic C weak symbol problem.
I want to break my firmware into 3 parts:
1. The hardware library (CMSIS, Middleware) -> libHardware.a
2. Realtime OS library -> libOS.a
3. Application code -> Output.elf linked to above.
the refer... | 2013/04/13 | [
"https://Stackoverflow.com/questions/15984535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/78025/"
] | When you define the `SysTick_Handler` in **cortex\_handlers.c** it defines the normal entry point. But it will overwrite the weak symbol only when the linker gets a request to link the specific object file (from libOS.a).
The libHardware.a usually defines the Interrupt vector table where the `SysTick_Handler` is refer... | Thanks to the above answer by harper, I was able to discover that Arduino solved this problem on the Due by moving all the weak definitions from startup\_sam3xa.c to their cortex\_handlers.c file so that the weak defs belonged to the "OS" instead of the hardware (using the language of the OP). |
15,984,535 | My scenario is about cross-compiling to a Arduino Due (ARM target), but I guess it's a generic C weak symbol problem.
I want to break my firmware into 3 parts:
1. The hardware library (CMSIS, Middleware) -> libHardware.a
2. Realtime OS library -> libOS.a
3. Application code -> Output.elf linked to above.
the refer... | 2013/04/13 | [
"https://Stackoverflow.com/questions/15984535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/78025/"
] | When you define the `SysTick_Handler` in **cortex\_handlers.c** it defines the normal entry point. But it will overwrite the weak symbol only when the linker gets a request to link the specific object file (from libOS.a).
The libHardware.a usually defines the Interrupt vector table where the `SysTick_Handler` is refer... | Another solution is to keep the source for your handler (or whatever) separate, but #include it into a source file that must always be referenced when using the library (if your library has such a thing and is not all optional.) Using different words than another answer, the linker when examining a library .a works in ... |
37,799 | In the [מטה אשר](http://hebrewbooks.org/pdfpager.aspx?req=35269&st=&pgnum=12) (commentary to שמלה חדשה), it is recorded that it was the custom of Jews in "מדינות מלכות רוסיא וגאלציא וגם במדינת הגר בקהילת היראים" to use the sefer שמלה חדשה to learn the halachos of shechita. So I figured out (big deal) that רוסיא is Russ... | 2014/05/05 | [
"https://judaism.stackexchange.com/questions/37799",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/5323/"
] | Hungary.
See this matzeva from Sighet, Hungary
<http://books.google.com/books?id=MF8LAAAAIAAJ&pg=PP11&lpg=PP11&dq=%22%D7%9E%D7%93%D7%99%D7%A0%D7%AA+%D7%94%D7%92%D7%A8%22&source=bl&ots=XTrztOSUE_&sig=99MotorIcpDDGH2q2_SjH6ao6Zo&hl=en&sa=X&ei=rSdnU7jhKbK0sQS15IHQCw&ved=0CC0Q6AEwBDgK> | Yoni beat me to it, but I found a source if you'd like one: the Targum on Tehillim 83:7 translated "הגרים" as "הונגראי".
The term is used so often all over Jewish literature to refer to Hungary though that a source isn't really needed. (In fact, the translation offered by Targum there is highly unlikely to be correct... |
68,844,853 | When i generate the final PDF the version is being displayed.
Is there any way to hide this information ?
I looked into the package documentation but i could not find anything.
[](https://i.stack.imgur.com/ZTP5T.png)
This is information I do not wan... | 2021/08/19 | [
"https://Stackoverflow.com/questions/68844853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11356919/"
] | TCPDF seems to have to methods that might help you:
```
$tcpdf->SetCreator('My PDF-Generator tool');
$tcpdf->SetAuthor('Your name');
```
I haven't tried it by myself. I just had a look at the examples of the TCPDF documentation. | Well, if you use a free lib it's quite normal that you can't change that. It would be the same case with other products.
But if you search with a tool such as *ripgrep* in the source code, you'll see that this string is defined in `include/tcpdf_static.php` at line 127 and is called by `tcpdf.php` at two places:
```s... |
27,738,407 | I read a good post [here](http://www.binpress.com/tutorial/using-android-media-style-notifications-with-media-session-controls/165) on how to use notification buttons to interact with a mediaplayer service to play, pause, skip etc.
The [android doc](http://developer.android.com/reference/android/media/session/MediaSes... | 2015/01/02 | [
"https://Stackoverflow.com/questions/27738407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4411645/"
] | This is the best answer I've found so far: <https://stackoverflow.com/a/26474423/785716>
It seems that the two methods aren't really backwards compatible at all. | An updated version of [MediaSessionCompat](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.html) was recently released that uses RemoteControlClient for APIs levels 14-20. Unfortunately, there is no Compat version of MediaSessionManager at this time. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.