qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
566,720 | I have a Windows Form with a label and a picture box. To retreive an image from a web service I use a thread.
The user click on a button and first the label must be displayed and then new thread is started to retrieve the image. This is the code:
```
private void menuItem1_Click(object sender, EventArgs e)
{
etique... | 2009/02/19 | [
"https://Stackoverflow.com/questions/566720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68571/"
] | The question is unclear, but by using Invoke, you are defeating the purpose of having the image request on a separate thread. (You might notice that your interface becomes unresponsive while the request is happening)
Instead, it is better to create a new thread object, start it, and then use the Invoke to set the imag... | You shouldn't be calling this:
```
this.Invoke(new System.Threading.ThreadStart(RequestImage));
```
I assume that you are deadlocking here, as Invoke method will route the delegate to the UI thread, but you are waiting for your operation to complete.
To get the code to execute on another thread, you would do this:
... |
566,720 | I have a Windows Form with a label and a picture box. To retreive an image from a web service I use a thread.
The user click on a button and first the label must be displayed and then new thread is started to retrieve the image. This is the code:
```
private void menuItem1_Click(object sender, EventArgs e)
{
etique... | 2009/02/19 | [
"https://Stackoverflow.com/questions/566720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68571/"
] | The question is unclear, but by using Invoke, you are defeating the purpose of having the image request on a separate thread. (You might notice that your interface becomes unresponsive while the request is happening)
Instead, it is better to create a new thread object, start it, and then use the Invoke to set the imag... | You could do the following:
```
private void menuItem1_Click(object sender, EventArgs e)
{
etiquetaCargando.Visible = true;
Thread t = new Thread(new ThreadStart(RequestImage));
// NOTE THIS LINE
// Without this, if your application is closed and the thread isn't,
// it will leave your program in ... |
566,720 | I have a Windows Form with a label and a picture box. To retreive an image from a web service I use a thread.
The user click on a button and first the label must be displayed and then new thread is started to retrieve the image. This is the code:
```
private void menuItem1_Click(object sender, EventArgs e)
{
etique... | 2009/02/19 | [
"https://Stackoverflow.com/questions/566720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68571/"
] | The question is unclear, but by using Invoke, you are defeating the purpose of having the image request on a separate thread. (You might notice that your interface becomes unresponsive while the request is happening)
Instead, it is better to create a new thread object, start it, and then use the Invoke to set the imag... | As others have said, you're using the invoke backwards.
My suggestion is something like this in your original handler:
```
ThreadPool.QueueUserWorkItem(RequestImage)
```
and then use a lambda to do the Invoke from RequestImage:
```
RequestImage()
{
...
...
Invoke(() => { myControl.BackgroundImage = img; my... |
566,720 | I have a Windows Form with a label and a picture box. To retreive an image from a web service I use a thread.
The user click on a button and first the label must be displayed and then new thread is started to retrieve the image. This is the code:
```
private void menuItem1_Click(object sender, EventArgs e)
{
etique... | 2009/02/19 | [
"https://Stackoverflow.com/questions/566720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68571/"
] | You shouldn't be calling this:
```
this.Invoke(new System.Threading.ThreadStart(RequestImage));
```
I assume that you are deadlocking here, as Invoke method will route the delegate to the UI thread, but you are waiting for your operation to complete.
To get the code to execute on another thread, you would do this:
... | You could do the following:
```
private void menuItem1_Click(object sender, EventArgs e)
{
etiquetaCargando.Visible = true;
Thread t = new Thread(new ThreadStart(RequestImage));
// NOTE THIS LINE
// Without this, if your application is closed and the thread isn't,
// it will leave your program in ... |
566,720 | I have a Windows Form with a label and a picture box. To retreive an image from a web service I use a thread.
The user click on a button and first the label must be displayed and then new thread is started to retrieve the image. This is the code:
```
private void menuItem1_Click(object sender, EventArgs e)
{
etique... | 2009/02/19 | [
"https://Stackoverflow.com/questions/566720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68571/"
] | You shouldn't be calling this:
```
this.Invoke(new System.Threading.ThreadStart(RequestImage));
```
I assume that you are deadlocking here, as Invoke method will route the delegate to the UI thread, but you are waiting for your operation to complete.
To get the code to execute on another thread, you would do this:
... | As others have said, you're using the invoke backwards.
My suggestion is something like this in your original handler:
```
ThreadPool.QueueUserWorkItem(RequestImage)
```
and then use a lambda to do the Invoke from RequestImage:
```
RequestImage()
{
...
...
Invoke(() => { myControl.BackgroundImage = img; my... |
38,696,722 | I want to get data from webservices from oracle database.
But I'm looking for it unfortunately I can't anything .
Please give me some hints.I want to accesses it with username and password in pl/sql code.
How can I do it?
Thank you.. | 2016/08/01 | [
"https://Stackoverflow.com/questions/38696722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5478948/"
] | I solve it like following code.I think it will be useful .
```
declare
t_http_req utl_http.req;
t_http_resp utl_http.resp;
t_request_body varchar2(30000);
t_respond varchar2(30000);
t_start_pos integer := 1;
t_output varchar2(2000);
begin
/*Construct the information you want to sen... | You might want to look into the [UTL\_HTTP package](https://docs.oracle.com/cd/B28359_01/appdev.111/b28419/u_http.htm) |
79,863 | I'm writing a simple non-physical one-circle-to-many-rectangles collision detector/resolver.
For collision detection, I'm using [a very common algorithm](http://www.migapro.com/circle-and-rotated-rectangle-collision-detection/), and it's working pretty well.
For collision resolving, once a collision is detected, I ca... | 2014/07/07 | [
"https://gamedev.stackexchange.com/questions/79863",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/22612/"
] | Figuring out the correct solution to multiple collisions between overlapping (or perfectly aligned rectangles) is not trivial, and most solutions will have problems. I'm not even sure if there is an actual correct solution.
Reading [this question](https://gamedev.stackexchange.com/questions/25444) made me think that t... | I admit I've never successfully written a collision resolver, but I have a suggestion.
Your problem is that you have two valid contacts that resolve a collision between the circle and a rectangle. On their own, each contact will solve the collision, but when there are two contact occurring in the same cycle you will ... |
79,863 | I'm writing a simple non-physical one-circle-to-many-rectangles collision detector/resolver.
For collision detection, I'm using [a very common algorithm](http://www.migapro.com/circle-and-rotated-rectangle-collision-detection/), and it's working pretty well.
For collision resolving, once a collision is detected, I ca... | 2014/07/07 | [
"https://gamedev.stackexchange.com/questions/79863",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/22612/"
] | I admit I've never successfully written a collision resolver, but I have a suggestion.
Your problem is that you have two valid contacts that resolve a collision between the circle and a rectangle. On their own, each contact will solve the collision, but when there are two contact occurring in the same cycle you will ... | if you added a square collision bounding box, and had both a circle and a square as a bounding box, you could find that situation before it occurred.
The square would work like whiskers on a cat, and only if the circle could always fit through the opening, would it pass the collision test, and it would occur before an... |
79,863 | I'm writing a simple non-physical one-circle-to-many-rectangles collision detector/resolver.
For collision detection, I'm using [a very common algorithm](http://www.migapro.com/circle-and-rotated-rectangle-collision-detection/), and it's working pretty well.
For collision resolving, once a collision is detected, I ca... | 2014/07/07 | [
"https://gamedev.stackexchange.com/questions/79863",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/22612/"
] | Figuring out the correct solution to multiple collisions between overlapping (or perfectly aligned rectangles) is not trivial, and most solutions will have problems. I'm not even sure if there is an actual correct solution.
Reading [this question](https://gamedev.stackexchange.com/questions/25444) made me think that t... | if you added a square collision bounding box, and had both a circle and a square as a bounding box, you could find that situation before it occurred.
The square would work like whiskers on a cat, and only if the circle could always fit through the opening, would it pass the collision test, and it would occur before an... |
52,026,567 | I have overridden the order page in shopware and i want to create a total of all the orders that not yet been processed. i have wtitten this to just show the variables that i need. i want to add up all the totals of the invoice\_amount of the orders.
```
{extends file="parent:frontend/account/orders.tpl"}
{block name... | 2018/08/26 | [
"https://Stackoverflow.com/questions/52026567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6527945/"
] | Finally got what i wanted.
```
{extends file="parent:frontend/account/orders.tpl"}
{block name="frontend_account_orders_welcome"}
{$smarty.block.parent}
{$sOrderTotal = 0}
<ul>
{foreach $sOpenOrders as $sOpenOrder}
<li> Order number :{$sOpenOrder['ordernumber']}</li>
<li> User ID :... | I'm not familiar with this application either, but this should work:
```
{extends file="parent:frontend/account/orders.tpl"}
{block name="frontend_account_orders_welcome"}
{$smarty.block.parent}
{debug}
{$sOrderTotal = 0}
<ul>
{foreach $sOpenOrders as $sOpenOrder}
... |
52,026,567 | I have overridden the order page in shopware and i want to create a total of all the orders that not yet been processed. i have wtitten this to just show the variables that i need. i want to add up all the totals of the invoice\_amount of the orders.
```
{extends file="parent:frontend/account/orders.tpl"}
{block name... | 2018/08/26 | [
"https://Stackoverflow.com/questions/52026567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6527945/"
] | Finally got what i wanted.
```
{extends file="parent:frontend/account/orders.tpl"}
{block name="frontend_account_orders_welcome"}
{$smarty.block.parent}
{$sOrderTotal = 0}
<ul>
{foreach $sOpenOrders as $sOpenOrder}
<li> Order number :{$sOpenOrder['ordernumber']}</li>
<li> User ID :... | It might be easier to calculate the total amount directly in php and assign it to the view. Smarty is a template engine - even when it enables you to do calculations and much more (unsafer) stuff, you should do it in php.
Instead of including the account-view, it might be the best way to write a plugin, that assigns th... |
57,273,796 | How can I access a parameter from a Servlet into .jsp file?? I am creating a simple web application and all of the tutorials, as well as the one I'm following to build the application encourage me to use just ${parameter} in the .jsp file, but it does not work (in the output it prints ${name} ${password} instead of the... | 2019/07/30 | [
"https://Stackoverflow.com/questions/57273796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7066555/"
] | There's no point in marking parameters as `const` in a function declaration. Arguments are passed by value, so the parameter is a copy anyway. It doesn't affect how the function can be called.
However, `const char *s` does not mean `s` is `const`. What this declaration means is that `s` is a pointer to a `const char`;... | There is no need to make the first parameter `const`; the "top level" of arguments are copied, not referenced, so all `const` would do is prevent the called function from modifying its own copy of the argument.
Similarly, note that only the values being pointed to are `const` for `fputs`; the parameter isn't `const ch... |
57,273,796 | How can I access a parameter from a Servlet into .jsp file?? I am creating a simple web application and all of the tutorials, as well as the one I'm following to build the application encourage me to use just ${parameter} in the .jsp file, but it does not work (in the output it prints ${name} ${password} instead of the... | 2019/07/30 | [
"https://Stackoverflow.com/questions/57273796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7066555/"
] | The `const` modifier prevents the function from changing the input parameter.
`fputc` function uses `int c` as input which is a value type. Because parameters are passed by value, the function can only change the internal copy, it could not change the original value.
`fputs` function uses `char *s` as input which is ... | There is no need to make the first parameter `const`; the "top level" of arguments are copied, not referenced, so all `const` would do is prevent the called function from modifying its own copy of the argument.
Similarly, note that only the values being pointed to are `const` for `fputs`; the parameter isn't `const ch... |
57,273,796 | How can I access a parameter from a Servlet into .jsp file?? I am creating a simple web application and all of the tutorials, as well as the one I'm following to build the application encourage me to use just ${parameter} in the .jsp file, but it does not work (in the output it prints ${name} ${password} instead of the... | 2019/07/30 | [
"https://Stackoverflow.com/questions/57273796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7066555/"
] | There's no point in marking parameters as `const` in a function declaration. Arguments are passed by value, so the parameter is a copy anyway. It doesn't affect how the function can be called.
However, `const char *s` does not mean `s` is `const`. What this declaration means is that `s` is a pointer to a `const char`;... | `const char *s` doesn't mean that `s` must point to a constant. It means that `fputs` is not allowed to modify what is pointed to by `s`. |
57,273,796 | How can I access a parameter from a Servlet into .jsp file?? I am creating a simple web application and all of the tutorials, as well as the one I'm following to build the application encourage me to use just ${parameter} in the .jsp file, but it does not work (in the output it prints ${name} ${password} instead of the... | 2019/07/30 | [
"https://Stackoverflow.com/questions/57273796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7066555/"
] | There's no point in marking parameters as `const` in a function declaration. Arguments are passed by value, so the parameter is a copy anyway. It doesn't affect how the function can be called.
However, `const char *s` does not mean `s` is `const`. What this declaration means is that `s` is a pointer to a `const char`;... | When the compiler determines a function type then high level qualifiers of parameters are discarded.
So these two function declarations
```
int fputc(int c, FILE *stream);
int fputc( const int c, FILE *stream);
```
declare the same one function.
And these two function declarations
```
int fputs(const char *s, FIL... |
57,273,796 | How can I access a parameter from a Servlet into .jsp file?? I am creating a simple web application and all of the tutorials, as well as the one I'm following to build the application encourage me to use just ${parameter} in the .jsp file, but it does not work (in the output it prints ${name} ${password} instead of the... | 2019/07/30 | [
"https://Stackoverflow.com/questions/57273796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7066555/"
] | The `const` modifier prevents the function from changing the input parameter.
`fputc` function uses `int c` as input which is a value type. Because parameters are passed by value, the function can only change the internal copy, it could not change the original value.
`fputs` function uses `char *s` as input which is ... | `const char *s` doesn't mean that `s` must point to a constant. It means that `fputs` is not allowed to modify what is pointed to by `s`. |
57,273,796 | How can I access a parameter from a Servlet into .jsp file?? I am creating a simple web application and all of the tutorials, as well as the one I'm following to build the application encourage me to use just ${parameter} in the .jsp file, but it does not work (in the output it prints ${name} ${password} instead of the... | 2019/07/30 | [
"https://Stackoverflow.com/questions/57273796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7066555/"
] | The `const` modifier prevents the function from changing the input parameter.
`fputc` function uses `int c` as input which is a value type. Because parameters are passed by value, the function can only change the internal copy, it could not change the original value.
`fputs` function uses `char *s` as input which is ... | When the compiler determines a function type then high level qualifiers of parameters are discarded.
So these two function declarations
```
int fputc(int c, FILE *stream);
int fputc( const int c, FILE *stream);
```
declare the same one function.
And these two function declarations
```
int fputs(const char *s, FIL... |
14,278,929 | how do i can stretch my div according text
I want to stretch height of a div , with the text user posted
look at the screen shot its clear.
CSS :
```
.cmnt{ width: 570px; margin-top: 10px; margin-bottom: 10px; float: right; margin-right: 15px; clear:both; }
.cmnt .body{ width: 570px; background: #333333; min-he... | 2013/01/11 | [
"https://Stackoverflow.com/questions/14278929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1057617/"
] | You can try adding a `float: left` CSS property to your **outer** container.
```
.cmnt .body{ float: left; width: 570px; background: #333333; min-height: 90px; height: auto; }
```
**Here's a fiddle for you**
<http://jsfiddle.net/znQa8/>
Hope it helps. | it could be a possibility to add:
```
div.body
{
height: auto;
}
```
but i'm not sure it isn't killing the whole layout
In reference to My Head Hurts you need to clear your floats:
```
.cmnt .body
{
overflow: hidden;
}
``` |
14,278,929 | how do i can stretch my div according text
I want to stretch height of a div , with the text user posted
look at the screen shot its clear.
CSS :
```
.cmnt{ width: 570px; margin-top: 10px; margin-bottom: 10px; float: right; margin-right: 15px; clear:both; }
.cmnt .body{ width: 570px; background: #333333; min-he... | 2013/01/11 | [
"https://Stackoverflow.com/questions/14278929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1057617/"
] | You can try adding a `float: left` CSS property to your **outer** container.
```
.cmnt .body{ float: left; width: 570px; background: #333333; min-height: 90px; height: auto; }
```
**Here's a fiddle for you**
<http://jsfiddle.net/znQa8/>
Hope it helps. | `min-height` would be your solution. |
14,278,929 | how do i can stretch my div according text
I want to stretch height of a div , with the text user posted
look at the screen shot its clear.
CSS :
```
.cmnt{ width: 570px; margin-top: 10px; margin-bottom: 10px; float: right; margin-right: 15px; clear:both; }
.cmnt .body{ width: 570px; background: #333333; min-he... | 2013/01/11 | [
"https://Stackoverflow.com/questions/14278929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1057617/"
] | You can try adding a `float: left` CSS property to your **outer** container.
```
.cmnt .body{ float: left; width: 570px; background: #333333; min-height: 90px; height: auto; }
```
**Here's a fiddle for you**
<http://jsfiddle.net/znQa8/>
Hope it helps. | What is happening is that you have a floating container with floating children.
In this case, the floating container "ignores" the children dimensions. This is probably a side effect of the implementation of the real primary objective of float (that was to have floating images on wrapped text).
In this article you ca... |
14,278,929 | how do i can stretch my div according text
I want to stretch height of a div , with the text user posted
look at the screen shot its clear.
CSS :
```
.cmnt{ width: 570px; margin-top: 10px; margin-bottom: 10px; float: right; margin-right: 15px; clear:both; }
.cmnt .body{ width: 570px; background: #333333; min-he... | 2013/01/11 | [
"https://Stackoverflow.com/questions/14278929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1057617/"
] | The height of a container is automatically adjusted, if not specified, according to the child (not floated) elements.
Because the div (class=text) is floated, its height doesn't take into account. Whenever you used a float, systematically try to clear it after to resolve the height problem.
```
<div class="text">
...
... | it could be a possibility to add:
```
div.body
{
height: auto;
}
```
but i'm not sure it isn't killing the whole layout
In reference to My Head Hurts you need to clear your floats:
```
.cmnt .body
{
overflow: hidden;
}
``` |
14,278,929 | how do i can stretch my div according text
I want to stretch height of a div , with the text user posted
look at the screen shot its clear.
CSS :
```
.cmnt{ width: 570px; margin-top: 10px; margin-bottom: 10px; float: right; margin-right: 15px; clear:both; }
.cmnt .body{ width: 570px; background: #333333; min-he... | 2013/01/11 | [
"https://Stackoverflow.com/questions/14278929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1057617/"
] | The height of a container is automatically adjusted, if not specified, according to the child (not floated) elements.
Because the div (class=text) is floated, its height doesn't take into account. Whenever you used a float, systematically try to clear it after to resolve the height problem.
```
<div class="text">
...
... | `min-height` would be your solution. |
14,278,929 | how do i can stretch my div according text
I want to stretch height of a div , with the text user posted
look at the screen shot its clear.
CSS :
```
.cmnt{ width: 570px; margin-top: 10px; margin-bottom: 10px; float: right; margin-right: 15px; clear:both; }
.cmnt .body{ width: 570px; background: #333333; min-he... | 2013/01/11 | [
"https://Stackoverflow.com/questions/14278929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1057617/"
] | The height of a container is automatically adjusted, if not specified, according to the child (not floated) elements.
Because the div (class=text) is floated, its height doesn't take into account. Whenever you used a float, systematically try to clear it after to resolve the height problem.
```
<div class="text">
...
... | What is happening is that you have a floating container with floating children.
In this case, the floating container "ignores" the children dimensions. This is probably a side effect of the implementation of the real primary objective of float (that was to have floating images on wrapped text).
In this article you ca... |
67,334,583 | If I don't put a select, ecto returns the full struct which makes sense but then I have to convert to a map and remove the `__meta__` field.
`from x in __MODULE__` will return list of `%MODULE{__meta__: #Ecto.Schema.Metadata...,id: 1, name: "bob"}`
Is there a better solution than listing it out in the select clause l... | 2021/04/30 | [
"https://Stackoverflow.com/questions/67334583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14514705/"
] | While I don’t see any issue with calling [`Map.from_struct/1`](https://hexdocs.pm/elixir/Map.html#from_struct/1), the proper approach would be to implement `json` encoder for the structure in question. Then you’ll be able to serialize the struct itself whenever you wish.
For [`Jason`](https://hexdocs.pm/jason) it’s fa... | You can use the `@derive` module annotation with `except` options to blacklist the fields you don't want to encode to JSON.
E.g.:
```
defmodule MyStruct do
...
@derive {Jason.Encoder, except: [:__meta__, ...]}
end
```
However, bear in mind that using this annotation can break application layers, since you'll be... |
55,563,184 | I am trying to use Java Watchservice (NIO) to watch mutiple directories , I can see the create event in all directories but I cant trace back to directory where the file was created.
For eg , whenever a new file is created I can only see a filename (without path) , how to know whether the create event triggered on fax... | 2019/04/07 | [
"https://Stackoverflow.com/questions/55563184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1955151/"
] | When you register the watchService, you are given a `WatchKey` for that directory. You should remember which key goes with which directory.
```
System.out.println("START MONITORING **************");
Path faxFolder = Paths.get("E:\\activiti\\monitor\\m1");
Path faxFolder2 = Paths.get("E:\\activiti\\monitor\\m2");
Wat... | ```
Path newFile = ev.context();
Path absolutePath = newFile.toAbsolutePath();
``` |
43,370,653 | I want to get posts of the current user's friends from the the `posts` table , What I've tried is this code :
```
SELECT
`p`.id,
`p`.thetext,
`p`.time,
`p`.location
FROM
`friends` as f,
`users` as u,
`posts` as p
WHERE
`f`.frid = `u`.id
AND
`p`.publisher = `u`.username
AND
... | 2017/04/12 | [
"https://Stackoverflow.com/questions/43370653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7856690/"
] | [`print`](https://developer.apple.com/reference/swift/1541053-print) accepts a parameter named `terminator` which is `\n` by default. You can pass an empty string instead to print them out in a single line:
```
for i in 1...5 {
print(i, terminator: "")
}
print()
``` | Try this:
```
var number = ""
for i in 1...5
{
number += "\(i)"
}
print(number)
``` |
43,370,653 | I want to get posts of the current user's friends from the the `posts` table , What I've tried is this code :
```
SELECT
`p`.id,
`p`.thetext,
`p`.time,
`p`.location
FROM
`friends` as f,
`users` as u,
`posts` as p
WHERE
`f`.frid = `u`.id
AND
`p`.publisher = `u`.username
AND
... | 2017/04/12 | [
"https://Stackoverflow.com/questions/43370653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7856690/"
] | Try this:
```
var number = ""
for i in 1...5
{
number += "\(i)"
}
print(number)
``` | ```
var points: [String] = [] // Take Mutable Array
for i in 1...5
{
let value = String(i)
points.append(value) // Add value in array
}
let str = points.joined(separator: "")
print(str)
```
Out Put
```
12345
``` |
43,370,653 | I want to get posts of the current user's friends from the the `posts` table , What I've tried is this code :
```
SELECT
`p`.id,
`p`.thetext,
`p`.time,
`p`.location
FROM
`friends` as f,
`users` as u,
`posts` as p
WHERE
`f`.frid = `u`.id
AND
`p`.publisher = `u`.username
AND
... | 2017/04/12 | [
"https://Stackoverflow.com/questions/43370653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7856690/"
] | [`print`](https://developer.apple.com/reference/swift/1541053-print) accepts a parameter named `terminator` which is `\n` by default. You can pass an empty string instead to print them out in a single line:
```
for i in 1...5 {
print(i, terminator: "")
}
print()
``` | ```
var points: [String] = [] // Take Mutable Array
for i in 1...5
{
let value = String(i)
points.append(value) // Add value in array
}
let str = points.joined(separator: "")
print(str)
```
Out Put
```
12345
``` |
495,163 | I am pulling a column from database which contains date.In DB it is character value.I want to print the date in formatted way. I have used following code for printing the date in formatted manner.
where ${Po[1]} contains date value.
But above statement prining null value.
Any advice
Thanks in advance
Sas | 2009/01/30 | [
"https://Stackoverflow.com/questions/495163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Use a JSTL format tag, of course:
```
<fmt:date etc.>
```
<http://www.java2s.com/Code/Java/JSTL/JSTLFormatDate.htm>
Why your value is null is another matter. `Po[1]` isn't being set properly. How does that value get entered into the page? | Po[1] is populated by a SQL statement.When i normally print this value${Po[1]} it is printing the date properly.I want to format this date.
Thanks
Sas |
495,163 | I am pulling a column from database which contains date.In DB it is character value.I want to print the date in formatted way. I have used following code for printing the date in formatted manner.
where ${Po[1]} contains date value.
But above statement prining null value.
Any advice
Thanks in advance
Sas | 2009/01/30 | [
"https://Stackoverflow.com/questions/495163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Use a JSTL format tag, of course:
```
<fmt:date etc.>
```
<http://www.java2s.com/Code/Java/JSTL/JSTLFormatDate.htm>
Why your value is null is another matter. `Po[1]` isn't being set properly. How does that value get entered into the page? | JSTL library expects object of Date datatype (java.util.Date). You will have to parse the String data into java.util.Date using either java.sql.Date.valueOf or java.util.Date.parse function.
If you dont prefer to create an object of java.util.Date for any reason then you can use JavaScript function to format the Date ... |
30,515 | In this passage, Noah explicitly states that Japheth will have no dwelling place of his own.
>
> Genesis:9.27
>
> May God enlarge Japheth, **And may he dwell in the tents
> of Shem**;....
>
>
>
**Note: Japheth will not dwell in his own tents but will dwell in that of his brother !!**.
If such is the case, h... | 2017/11/17 | [
"https://hermeneutics.stackexchange.com/questions/30515",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/20490/"
] | >
> God shall enlarge Japheth, and he shall dwell in the tents of Shem; and Canaan shall be his servant. - Genesis 9:27
>
>
>
There is no indication that anything in this verse is mutually exclusive. That is to say: Japheth would do all of these things.
We can first establish that the descendants of Japheth [were... | There is a play on Hebrew words here. "Enlarge" is *yapht*, which sounds likes *Japheth*.
I think that the verse is not referring to Japheth personally, but rather to his progeny. Japheth is understood to be the ancestor of the Hellenic peoples who would later dominate the western world.1
---
1. See, e.g., *Oxford... |
30,515 | In this passage, Noah explicitly states that Japheth will have no dwelling place of his own.
>
> Genesis:9.27
>
> May God enlarge Japheth, **And may he dwell in the tents
> of Shem**;....
>
>
>
**Note: Japheth will not dwell in his own tents but will dwell in that of his brother !!**.
If such is the case, h... | 2017/11/17 | [
"https://hermeneutics.stackexchange.com/questions/30515",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/20490/"
] | >
> God shall enlarge Japheth, and he shall dwell in the tents of Shem; and Canaan shall be his servant. - Genesis 9:27
>
>
>
There is no indication that anything in this verse is mutually exclusive. That is to say: Japheth would do all of these things.
We can first establish that the descendants of Japheth [were... | I do not think Japheth was "confined" to the tents of Shem. It simply means they dwelt together cause Ham had the hot, Shem had North Africa. So Japheth hung around Shem, instead of freezing over the Caucuses, cause Ham's people were trifling and spiteful. Too cold to live in tents in Europe back then. |
30,515 | In this passage, Noah explicitly states that Japheth will have no dwelling place of his own.
>
> Genesis:9.27
>
> May God enlarge Japheth, **And may he dwell in the tents
> of Shem**;....
>
>
>
**Note: Japheth will not dwell in his own tents but will dwell in that of his brother !!**.
If such is the case, h... | 2017/11/17 | [
"https://hermeneutics.stackexchange.com/questions/30515",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/20490/"
] | >
> God shall enlarge Japheth, and he shall dwell in the tents of Shem; and Canaan shall be his servant. - Genesis 9:27
>
>
>
There is no indication that anything in this verse is mutually exclusive. That is to say: Japheth would do all of these things.
We can first establish that the descendants of Japheth [were... | Japheth being enlarged while dwelling under the tents of Shem means that the peoples of Japheth's line would eventually fall under the religions of Shem.
Shem leads to Abraham. The Abrahamic religions became the faith of every Japhetic line that you can name. The 'tent' is the tabernacle.
Every Japhetite fell under t... |
30,515 | In this passage, Noah explicitly states that Japheth will have no dwelling place of his own.
>
> Genesis:9.27
>
> May God enlarge Japheth, **And may he dwell in the tents
> of Shem**;....
>
>
>
**Note: Japheth will not dwell in his own tents but will dwell in that of his brother !!**.
If such is the case, h... | 2017/11/17 | [
"https://hermeneutics.stackexchange.com/questions/30515",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/20490/"
] | >
> God shall enlarge Japheth, and he shall dwell in the tents of Shem; and Canaan shall be his servant. - Genesis 9:27
>
>
>
There is no indication that anything in this verse is mutually exclusive. That is to say: Japheth would do all of these things.
We can first establish that the descendants of Japheth [were... | ‘We are all Japhethites living in the tents of Shem.’ (Franz Delitzsch 1813-
1890,\* based on Genesis 9:27). I wonder if the identity of Japhethites might be interchangeable with Gentiles? The argument for the tents of Shem being God's chosen human depository for divine revelation to all mankind seems to attract a love... |
30,515 | In this passage, Noah explicitly states that Japheth will have no dwelling place of his own.
>
> Genesis:9.27
>
> May God enlarge Japheth, **And may he dwell in the tents
> of Shem**;....
>
>
>
**Note: Japheth will not dwell in his own tents but will dwell in that of his brother !!**.
If such is the case, h... | 2017/11/17 | [
"https://hermeneutics.stackexchange.com/questions/30515",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/20490/"
] | >
> God shall enlarge Japheth, and he shall dwell in the tents of Shem; and Canaan shall be his servant. - Genesis 9:27
>
>
>
There is no indication that anything in this verse is mutually exclusive. That is to say: Japheth would do all of these things.
We can first establish that the descendants of Japheth [were... | This could mean a lot of things! It obviously refers do his (Japheth) descendants. Later they would gain influence over vast lands and peoples by means of influence, politically nd economically. Looking at the world today, it is under Western control. One could not do anything that huge with international influence wit... |
30,515 | In this passage, Noah explicitly states that Japheth will have no dwelling place of his own.
>
> Genesis:9.27
>
> May God enlarge Japheth, **And may he dwell in the tents
> of Shem**;....
>
>
>
**Note: Japheth will not dwell in his own tents but will dwell in that of his brother !!**.
If such is the case, h... | 2017/11/17 | [
"https://hermeneutics.stackexchange.com/questions/30515",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/20490/"
] | >
> God shall enlarge Japheth, and he shall dwell in the tents of Shem; and Canaan shall be his servant. - Genesis 9:27
>
>
>
There is no indication that anything in this verse is mutually exclusive. That is to say: Japheth would do all of these things.
We can first establish that the descendants of Japheth [were... | I believe that this passage refers to the current Jewish people who are occupying the land of Israel. After 1948 the Ashkenazi Jews migrated from Europe after Hitter's tyranny. Moreover the territory belongs to Gods true "chosen people" who have be scattered to the four corners of the Earth. Due to there disobedience a... |
30,515 | In this passage, Noah explicitly states that Japheth will have no dwelling place of his own.
>
> Genesis:9.27
>
> May God enlarge Japheth, **And may he dwell in the tents
> of Shem**;....
>
>
>
**Note: Japheth will not dwell in his own tents but will dwell in that of his brother !!**.
If such is the case, h... | 2017/11/17 | [
"https://hermeneutics.stackexchange.com/questions/30515",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/20490/"
] | >
> God shall enlarge Japheth, and he shall dwell in the tents of Shem; and Canaan shall be his servant. - Genesis 9:27
>
>
>
There is no indication that anything in this verse is mutually exclusive. That is to say: Japheth would do all of these things.
We can first establish that the descendants of Japheth [were... | To enlarge was intended to mean "decieve or to bluff up" Japhetic people to think they are shemmettic and are not. |
30,515 | In this passage, Noah explicitly states that Japheth will have no dwelling place of his own.
>
> Genesis:9.27
>
> May God enlarge Japheth, **And may he dwell in the tents
> of Shem**;....
>
>
>
**Note: Japheth will not dwell in his own tents but will dwell in that of his brother !!**.
If such is the case, h... | 2017/11/17 | [
"https://hermeneutics.stackexchange.com/questions/30515",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/20490/"
] | >
> God shall enlarge Japheth, and he shall dwell in the tents of Shem; and Canaan shall be his servant. - Genesis 9:27
>
>
>
There is no indication that anything in this verse is mutually exclusive. That is to say: Japheth would do all of these things.
We can first establish that the descendants of Japheth [were... | Japheth's descedents dwell in Shem's tents by being grafted as unnatural branches into the olive tree of Israel, the root of which is Jesus the Messiah, who sums up and fulfills the promises made unto the patriarchs and all the covenants of old creation. Thus can the Japhethites speak of "our fathers in the wilderness.... |
30,515 | In this passage, Noah explicitly states that Japheth will have no dwelling place of his own.
>
> Genesis:9.27
>
> May God enlarge Japheth, **And may he dwell in the tents
> of Shem**;....
>
>
>
**Note: Japheth will not dwell in his own tents but will dwell in that of his brother !!**.
If such is the case, h... | 2017/11/17 | [
"https://hermeneutics.stackexchange.com/questions/30515",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/20490/"
] | >
> God shall enlarge Japheth, and he shall dwell in the tents of Shem; and Canaan shall be his servant. - Genesis 9:27
>
>
>
There is no indication that anything in this verse is mutually exclusive. That is to say: Japheth would do all of these things.
We can first establish that the descendants of Japheth [were... | You are all dead wrong! Some of you are on to some truth, but are completely lost! People in the middle east are mostly Ham and Japeth mix. There are no Shemites in the middle east today. Noah's three sons would all be of the same race. However two of them Ham and Japeth would mix with the other nation's. The reason th... |
5,321,664 | I know that it's legal to use `dynamic_cast` to do a "cross-cast" across a class hierarchy. For example, if I have classes that look like this:
```
A B
\ /
C
```
If I have an `A*` pointer that's pointing at an object of type `C`, then I can use
```
A* aPtr = /* ... something that produces a C* ... */
B* ... | 2011/03/16 | [
"https://Stackoverflow.com/questions/5321664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/501557/"
] | It's not possible to detect this at compile-time. The class `C` that introduces the relationship could be found in a dynamically loadable library that hasn't even been written yet, and the compiler can't prove otherwise.
There may be a few exceptions though. If `A` has only private constructors (or a private destructo... | Truth is when you use `dynamic_cast` you can cast any polymorphic type pointer to any polymorphic type pointer even when classes are unrelated to each other.
If you want compile-time check you need to use other casts - `static_cast` or implicit conversions - that might not suit for some other reasons in many cases.
T... |
5,321,664 | I know that it's legal to use `dynamic_cast` to do a "cross-cast" across a class hierarchy. For example, if I have classes that look like this:
```
A B
\ /
C
```
If I have an `A*` pointer that's pointing at an object of type `C`, then I can use
```
A* aPtr = /* ... something that produces a C* ... */
B* ... | 2011/03/16 | [
"https://Stackoverflow.com/questions/5321664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/501557/"
] | That's the whole meaning of the dynamic cast: It is dynamic i.e. it is checked at the runtime not at the compilation time.
The compiler only checks if the casted classes are polymorphic. If the classes are not polymorphic then there will not be enough information to check the casting at the runtime.
And finally after... | Truth is when you use `dynamic_cast` you can cast any polymorphic type pointer to any polymorphic type pointer even when classes are unrelated to each other.
If you want compile-time check you need to use other casts - `static_cast` or implicit conversions - that might not suit for some other reasons in many cases.
T... |
5,321,664 | I know that it's legal to use `dynamic_cast` to do a "cross-cast" across a class hierarchy. For example, if I have classes that look like this:
```
A B
\ /
C
```
If I have an `A*` pointer that's pointing at an object of type `C`, then I can use
```
A* aPtr = /* ... something that produces a C* ... */
B* ... | 2011/03/16 | [
"https://Stackoverflow.com/questions/5321664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/501557/"
] | It's not possible to detect this at compile-time. The class `C` that introduces the relationship could be found in a dynamically loadable library that hasn't even been written yet, and the compiler can't prove otherwise.
There may be a few exceptions though. If `A` has only private constructors (or a private destructo... | That's the whole meaning of the dynamic cast: It is dynamic i.e. it is checked at the runtime not at the compilation time.
The compiler only checks if the casted classes are polymorphic. If the classes are not polymorphic then there will not be enough information to check the casting at the runtime.
And finally after... |
39,384,126 | I have an adapter which has an image button. And `OnClick` on `ImageButton` i want to call on the contact number i am parsing. Here its asking me to add permission check. I am getting class cast exception in this stage. Please help.
This is my code:
```
holder.call.setOnClickListener(new OnClickListener() {
... | 2016/09/08 | [
"https://Stackoverflow.com/questions/39384126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4562115/"
] | paste this code
```
if (ContextCompat.checkSelfPermission(Activity.this,
Manifest.permission.CALL_PHONE)
!= PackageManager.PERMISSION_GRANTED ) {
// Should we show an explanation?
if (ActivityCompat.shouldShowRequ... | ```
FATAL EXCEPTION: main
java.lang.ClassCastException: com.example.project.app.AppController cannot be cast to android.app.Activity
```
This means you have passed wrong value of the **context** to the Adapter. You should pass an activity context to it. |
66,359,815 | FaceID allows storage of credentials but not retrival. I'm seeing this error when inspecting via the xcode console. If I run the same code from xcode locally everything works fine.
returned Error Domain=com.apple.LocalAuthentication Code=-1004 "Caller is not running foreground."
To make it even more strange if I inst... | 2021/02/24 | [
"https://Stackoverflow.com/questions/66359815",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/584761/"
] | We've encountered this error as well in our app, but as it turned out, it was caused by having multiple apps with the same Product Name on one device.
In our case this means that we will not have this on our live app, but this came up on devices of our tester. | This error always comes up for me as -1004 so I added a check to my error handling block like this:
```
...
if let error = authError as? LAError {
if (error.code.rawValue == -1004) { //bizarre facial recognition error
completion(true, //do some code..)
}
completion(false, error)
}...
```
works on... |
55,529,315 | I want to create new Content Type which will be child of existing Content Type - Workflow Task (SharePoint 2013) using REST API.
So when I create request, I include parent Content Type Id in new Id.
I have tried following code.
```
const api = '/_api/web/contenttypes';
const requestBody = {
'__metadata': {... | 2019/04/05 | [
"https://Stackoverflow.com/questions/55529315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6952059/"
] | This is actually a bug in the REST API...
Here is a link to an issue ,filed for the PnP JS library, where adding a content type is implemented the same way as you did: <https://github.com/pnp/pnpjs/issues/457>
Patrick Rodgers also filed an issue with Microsoft to resolve it: <https://github.com/SharePoint/sp-dev-docs... | As far I know this bug still persist. I found workaround which can help somebody who cannot use CSOM or JSOM. You can use [Site script to define new site content type and specify parent content type](https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-json-schema#define-a-new-content-... |
48,235,319 | I'm getting an error, and I cannot figure out why. I know the error is telling me to cast a type but I'm not sure on what?
What part of `CASE` is the operator?
>
>
> ```
> ERROR: operator does not exist: character varying = boolean
> LINE 6: WHEN lower(foo.name) SIMILAR TO '%(foo
> ... | 2018/01/12 | [
"https://Stackoverflow.com/questions/48235319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3470746/"
] | I believe you simply want:
```
SELECT foo.name,
bar.city,
MAX(foo.total - bar.tax_amount),
(CASE WHEN lower(foo.name) SIMILAR TO '%(foo|bar|baz)%' THEN true
ELSE false
END)
....
GROUP BY foo.name, bar.city;
```
The `CASE` expression has two forms. One searches for val... | Your [`CASE` expression](https://www.postgresql.org/docs/current/static/functions-conditional.html#FUNCTIONS-CASE) had a syntax error, [like @a\_horse commented](https://stackoverflow.com/questions/48235319/no-operator-matches-the-given-name-and-argument-types-what-needs-to-be-cast/48235427#comment83453279_48235319).
... |
171,096 | It's not too easy to create a reliable and at the same time memorable password.
So, how about a number of memorable questions instead of a single password?
(This idea is related to [this one](https://security.stackexchange.com/questions/82768/asking-questions-randomly-from-a-set-of-questions-instead-of-a-password))
L... | 2017/10/11 | [
"https://security.stackexchange.com/questions/171096",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/160970/"
] | The trouble with any scheme like this is that people in general are rubbish at choosing good questions, let alone remembering the answers.
In theory there is a huge amount of entropy as there are multiple instances of essentially infinite questions and possible answers.
In practice a significant number of people wou... | There is certainly a precedent in the industry to use "Security Questions" as a fallback for "I Forgot My Password".
The question basically boils down to "one strong password vs multiple weak passwords".
Some thoughts:
* Keylogging attacks: if an attacker manages to plant a keylogger, then logging multiple passwords... |
171,096 | It's not too easy to create a reliable and at the same time memorable password.
So, how about a number of memorable questions instead of a single password?
(This idea is related to [this one](https://security.stackexchange.com/questions/82768/asking-questions-randomly-from-a-set-of-questions-instead-of-a-password))
L... | 2017/10/11 | [
"https://security.stackexchange.com/questions/171096",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/160970/"
] | The trouble with any scheme like this is that people in general are rubbish at choosing good questions, let alone remembering the answers.
In theory there is a huge amount of entropy as there are multiple instances of essentially infinite questions and possible answers.
In practice a significant number of people wou... | I'll just recapitulate to make sure I understand properly. You propose to ask the user for a number of question/answer pair, then hash these in the database with informations on the next question hidden in the previous one.
To be honest, I like that, it's very secret service-ish and everything, however it seems to boi... |
31,632 | Hoping for some help
I am fitting a new double light switch were one of the switches is a 2 way light.
The back of the light switch looks like this
```
C C
L1 L2 L1 L2
```
Now the problem I have is that I only have four wires and six connections. All of the wires are red but two of them have a extr... | 2013/09/11 | [
"https://diy.stackexchange.com/questions/31632",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/15040/"
] | This is the schematic for wiring a *pair* of 2 way light switches: That means that two switches control one light and either switch can turn the light on or off.

Typically the L1/L2 wires are both red, or one is black and the other red. In no case s... | Depending on your location, those may be 2-gang 2-way switches designed so that multiple switches can control each of two lights (e.g. switches at top & bottom of stairs and at each end of a hallway)
In which case they may have been wired up for 2-gang 1-way usage
Sleeved wires usually indicate switched live. I'd try... |
51,574,618 | I am wanting to build a production ready image for clients to use and I am wondering if there is a way to prevent access to my code within the image?
My current approach is storing my code in `/root/` and creating a "customer" user that only has a startup script in their home dir.
My Dockerfile looks like this
```
F... | 2018/07/28 | [
"https://Stackoverflow.com/questions/51574618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5121508/"
] | Anybody who has your image can always do
```
docker run -u root imagename sh
```
Anybody who can run Docker commands at all has root access to their system (or can trivially give it to themselves via `docker run -v /etc:/hostetc ...`) and so can freely poke around in `/var/lib/docker` to see what's there. It will ha... | You can protect your source-code even it can't be have a build stage or state,By removing the bash and sh in your base Image.
By this approach you can restrict the user to not enter into your docker container and Image either through these commands
>
> docker (exec or run) -it (container id) bash or sh.
>
>
>
To... |
51,574,618 | I am wanting to build a production ready image for clients to use and I am wondering if there is a way to prevent access to my code within the image?
My current approach is storing my code in `/root/` and creating a "customer" user that only has a startup script in their home dir.
My Dockerfile looks like this
```
F... | 2018/07/28 | [
"https://Stackoverflow.com/questions/51574618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5121508/"
] | Anybody who has your image can always do
```
docker run -u root imagename sh
```
Anybody who can run Docker commands at all has root access to their system (or can trivially give it to themselves via `docker run -v /etc:/hostetc ...`) and so can freely poke around in `/var/lib/docker` to see what's there. It will ha... | You can remove the users from the docker group and create sudos for the docker start and docker stop |
51,574,618 | I am wanting to build a production ready image for clients to use and I am wondering if there is a way to prevent access to my code within the image?
My current approach is storing my code in `/root/` and creating a "customer" user that only has a startup script in their home dir.
My Dockerfile looks like this
```
F... | 2018/07/28 | [
"https://Stackoverflow.com/questions/51574618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5121508/"
] | Anybody who has your image can always do
```
docker run -u root imagename sh
```
Anybody who can run Docker commands at all has root access to their system (or can trivially give it to themselves via `docker run -v /etc:/hostetc ...`) and so can freely poke around in `/var/lib/docker` to see what's there. It will ha... | Something else to consider is the use of [docker container export](https://docs.docker.com/engine/reference/commandline/container_export/). This would allow anyone to export the containers file system, and therefore have access to code files.
I believe this bypasses removing the sh/bash and any user permission changes... |
51,574,618 | I am wanting to build a production ready image for clients to use and I am wondering if there is a way to prevent access to my code within the image?
My current approach is storing my code in `/root/` and creating a "customer" user that only has a startup script in their home dir.
My Dockerfile looks like this
```
F... | 2018/07/28 | [
"https://Stackoverflow.com/questions/51574618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5121508/"
] | Something else to consider is the use of [docker container export](https://docs.docker.com/engine/reference/commandline/container_export/). This would allow anyone to export the containers file system, and therefore have access to code files.
I believe this bypasses removing the sh/bash and any user permission changes... | You can protect your source-code even it can't be have a build stage or state,By removing the bash and sh in your base Image.
By this approach you can restrict the user to not enter into your docker container and Image either through these commands
>
> docker (exec or run) -it (container id) bash or sh.
>
>
>
To... |
51,574,618 | I am wanting to build a production ready image for clients to use and I am wondering if there is a way to prevent access to my code within the image?
My current approach is storing my code in `/root/` and creating a "customer" user that only has a startup script in their home dir.
My Dockerfile looks like this
```
F... | 2018/07/28 | [
"https://Stackoverflow.com/questions/51574618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5121508/"
] | Something else to consider is the use of [docker container export](https://docs.docker.com/engine/reference/commandline/container_export/). This would allow anyone to export the containers file system, and therefore have access to code files.
I believe this bypasses removing the sh/bash and any user permission changes... | You can remove the users from the docker group and create sudos for the docker start and docker stop |
110,006 | I have just installed MATE under Ubuntu Saucy. No problems. Except I am trying to setup [Texmaker](https://en.wikipedia.org/wiki/Texmaker), the LaTeX IDE, and cannot figure out how to set the paths to the LaTeX tools (`pdflatex`, etc.) which Texmaker spawns.
Now I have used Texmaker for several years under Ubuntu Prec... | 2014/01/19 | [
"https://unix.stackexchange.com/questions/110006",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/57115/"
] | I have (eventually) answered my own question! The solution is to add the `export PATH = ...` statement to a file (`*.sh`) in `/etc/profile.d`. This is executed when both the bash shell and window session manager start. And it applies for all users, unlike the `.gnomerc` solution in my original post.
See <https://help.... | There is a generic place to add things like this: `~/.xsessionrc`.
This is on Ubuntu Trusty 14.04:
```
$ grep -rs USERXSESSIONRC /etc/
/etc/gdm/Xsession:USERXSESSIONRC=$HOME/.xsessionrc
/etc/X11/Xsession:USERXSESSIONRC=$HOME/.xsessionrc
/etc/X11/Xsession.d/40x11-common_xsessionrc:if [ -r "$USERXSESSIONRC" ]; then
/et... |
110,006 | I have just installed MATE under Ubuntu Saucy. No problems. Except I am trying to setup [Texmaker](https://en.wikipedia.org/wiki/Texmaker), the LaTeX IDE, and cannot figure out how to set the paths to the LaTeX tools (`pdflatex`, etc.) which Texmaker spawns.
Now I have used Texmaker for several years under Ubuntu Prec... | 2014/01/19 | [
"https://unix.stackexchange.com/questions/110006",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/57115/"
] | I have (eventually) answered my own question! The solution is to add the `export PATH = ...` statement to a file (`*.sh`) in `/etc/profile.d`. This is executed when both the bash shell and window session manager start. And it applies for all users, unlike the `.gnomerc` solution in my original post.
See <https://help.... | On Debian 8.7, modifying the path in `/etc/profile` does not work for Mate Desktop. The only thing I could get working, was to add this entry to `/etc/security/pam_env.conf` (in this case to add the TexLive binaries to PATH):
`PATH DEFAULT=${HOME}/bin:/usr/local/bin:/bin\
:/usr/bin:/usr/local/texlive/2016/bin/x86_64-l... |
3,905,219 | I need to get the actual html code of an element in a web page.
For example if the actual html code inside the element is `"How to fix"`
Running this JavaScript:
```js
getElementById('myE').innerHTML
```
Gives me `"How to fix"` which is the parsed HTML.
How can I get the unparsed `"How to fix"` using Ja... | 2010/10/11 | [
"https://Stackoverflow.com/questions/3905219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445326/"
] | You cannot get the *actual* HTML source of part of your web page.
When you give a web browser an HTML page, it parses the HTML into some DOM nodes that are the definitive version of your document as far as the browser is concerned. The DOM keeps the significant information from the HTML—like that you used the Unicode ... | What you have should work:
Element test:
```
<div id="myE">How to fix</div>
```
JavaScript test:
```
alert(document.getElementById("myE").innerHTML); //alerts "How to fix"
```
[You can try it out here](http://jsfiddle.net/nick_craver/gGmCa/). Make sure that wherever you're *using* the result i... |
3,905,219 | I need to get the actual html code of an element in a web page.
For example if the actual html code inside the element is `"How to fix"`
Running this JavaScript:
```js
getElementById('myE').innerHTML
```
Gives me `"How to fix"` which is the parsed HTML.
How can I get the unparsed `"How to fix"` using Ja... | 2010/10/11 | [
"https://Stackoverflow.com/questions/3905219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445326/"
] | What you have should work:
Element test:
```
<div id="myE">How to fix</div>
```
JavaScript test:
```
alert(document.getElementById("myE").innerHTML); //alerts "How to fix"
```
[You can try it out here](http://jsfiddle.net/nick_craver/gGmCa/). Make sure that wherever you're *using* the result i... | You can use a script tag instead, which will not parse the HTML. This is more relevant when there are angle brackets, like loading a lodash or underscore template.
```js
document.getElementById("asDiv").value = document.getElementById("myDiv").innerHTML;
document.getElementById("asScript").value = document.getElementB... |
3,905,219 | I need to get the actual html code of an element in a web page.
For example if the actual html code inside the element is `"How to fix"`
Running this JavaScript:
```js
getElementById('myE').innerHTML
```
Gives me `"How to fix"` which is the parsed HTML.
How can I get the unparsed `"How to fix"` using Ja... | 2010/10/11 | [
"https://Stackoverflow.com/questions/3905219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445326/"
] | You cannot get the *actual* HTML source of part of your web page.
When you give a web browser an HTML page, it parses the HTML into some DOM nodes that are the definitive version of your document as far as the browser is concerned. The DOM keeps the significant information from the HTML—like that you used the Unicode ... | You can use a script tag instead, which will not parse the HTML. This is more relevant when there are angle brackets, like loading a lodash or underscore template.
```js
document.getElementById("asDiv").value = document.getElementById("myDiv").innerHTML;
document.getElementById("asScript").value = document.getElementB... |
65,026,230 | I've a simple SpringBoot Java application. On the logging and using `LocalDateTime.now()` are shows the wrong timestamp, 1 hour more than system (Ubuntu) default.
In the logging timestamp is it:
`2020-11-26 14:46:00,584 INFO [scheduling-1]....`
And getting on print `LocalDateTime` too.
But, the system time is differe... | 2020/11/26 | [
"https://Stackoverflow.com/questions/65026230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5140756/"
] | About getting current collectionview item index by Button command, I do one sample that you can take a look:
```
<StackLayout>
<CollectionView
x:Name="SomeCollection"
ItemsLayout="VerticalList"
ItemsSource="{Binding items}">
<CollectionView.ItemTemplate>
... | Instead of using click events, I would bind the buttons to a `Command<T>`.
This way in the ViewModel where you have your ItemsSource, you can just check what the index is of the Item ViewModel you are passing into the command as parameter. So in the ViewModel add something like this:
```
public Command<ItemViewModel>... |
63,952,630 | I've recently started on <https://spring.io/guides/tutorials/react-and-spring-data-rest/> tutorial and I'm stuck on "Loading JavaScript Modules Example 8". When I add:
```
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
</plugin>
```
to pom.xml, it highlights i... | 2020/09/18 | [
"https://Stackoverflow.com/questions/63952630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11806619/"
] | Adding this to the pluging fixed the issue for me.
```
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<configuration>
<installDirectory>target</installDirectory>
</configuration>
<executions>
<execut... | I came across the same issue while working on this tutorial. After reading some other workarounds, a quick solution for me was to add this dependency:
```
<dependency>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.12.1</version>
</dependency>
... |
63,952,630 | I've recently started on <https://spring.io/guides/tutorials/react-and-spring-data-rest/> tutorial and I'm stuck on "Loading JavaScript Modules Example 8". When I add:
```
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
</plugin>
```
to pom.xml, it highlights i... | 2020/09/18 | [
"https://Stackoverflow.com/questions/63952630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11806619/"
] | You may need to include the plugin's version in your pom, as per [this](https://github.com/eirslett/frontend-maven-plugin#installation) section of their repo.
Looks like the latest version (per the repo's [tags](https://github.com/eirslett/frontend-maven-plugin/tags) and per [mvnrepository](https://mvnrepository.com/a... | I came across the same issue while working on this tutorial. After reading some other workarounds, a quick solution for me was to add this dependency:
```
<dependency>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.12.1</version>
</dependency>
... |
165,903 | I have the following command :
```
ls /some/path/*dat | xargs -n 1 -I @ sh -c "echo `basename @`"
```
with the directory `/some/path/` containing :
```
/some/path/a
/some/path/b
/some/path/c
/some/path/d
```
I want to get the output :
```
a
b
c
d
```
But I'm still getting full paths. What am I doing wrong ?
e... | 2014/11/04 | [
"https://unix.stackexchange.com/questions/165903",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/90245/"
] | ```
ls /some/path/*dat | xargs -n 1 -I @ sh -c 'echo `basename "@"`'
```
The `basename` is executed too early in your code.
If you are not sure that there are no spaces or tabs in the paths then you should use `-d \\n` (or `find ... -print0 | xargs -0 ...`) and mind the `"` around the `@`. | ```
# find all my perl file names with *.pl or *.pm ext sorted
find src/ -name '*.pm' -o -name '*.pl' \
| xargs -n 1 -I @ sh -c 'echo `basename "@"`' | sort
``` |
165,903 | I have the following command :
```
ls /some/path/*dat | xargs -n 1 -I @ sh -c "echo `basename @`"
```
with the directory `/some/path/` containing :
```
/some/path/a
/some/path/b
/some/path/c
/some/path/d
```
I want to get the output :
```
a
b
c
d
```
But I'm still getting full paths. What am I doing wrong ?
e... | 2014/11/04 | [
"https://unix.stackexchange.com/questions/165903",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/90245/"
] | The testcase can be fixed simply by changing the double quotes to single quotes, but you might like to know about GNU `parallel`.
You can do the same thing like this:
```
parallel echo {/} ::: /some/path/*dat
```
(You may need to quote the curly braces, in some shells.)
As well as having clearer syntax, `parallel`... | ```
# find all my perl file names with *.pl or *.pm ext sorted
find src/ -name '*.pm' -o -name '*.pl' \
| xargs -n 1 -I @ sh -c 'echo `basename "@"`' | sort
``` |
3,809,665 | $\textbf{Problem:}$Let $a,b,c,d,e,f$ be real numbers such that the polynomial $ p(x)=x^8-4x^7+7x^6+ax^5+bx^4+cx^3+dx^2+ex+f $
factorises into eight linear factors $x-x\_i$, with $x\_i>0$ for $i=1,2,\ldots,8$. Determine all possible values of $f$.
I noticed that if a polynomial's number of positive roots matches its de... | 2020/08/31 | [
"https://math.stackexchange.com/questions/3809665",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/767521/"
] | Assume that the roots are $x\_1,\cdots,x\_8$.
Then using vieta's formula we have,
$\sum\_{i=0}^{8}x\_i=4$ and $\sum\_{i \not =j} x\_ix\_j=7$
Then we have $\sum x\_i^2=(\sum x\_i)^2-2\sum x\_ix\_j=2$
Since all the roots are positive we can apply quadratic mean arithmatic mean inequality to get
$1/2=\sqrt{1/8 \sum x... | For any polynomial $p\_1$ with only real roots, if we take the derivative and get $p\_2$, and solve for the roots (in increasing order) $a\_1,a\_2,...,a\_n$ of $p\_2$ then the $n+1$ roots in increasing order, $b\_1,b\_2,...,b\_{n+1}$ of $p\_1$ follow the pattern $b\_1\leq a\_1\leq b\_2\leq a\_2\leq...\leq b\_n\leq a\_n... |
50,769,033 | When first trying to make this call to the PunkAPI, I was trying to append images (urls are an object returned in the JSON) with
```
append("<img src='beer[i].image_url'/>");
```
Which did not work because (from console) a request was being made to <http://projectURL.com/beer[i].image_url> instead of <http://apiURL/... | 2018/06/08 | [
"https://Stackoverflow.com/questions/50769033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4103746/"
] | The problem is that if you do not use quotes and pluses to concatenate the string, then JavaScript will not know you are trying to concatenate the variable value to use it as part of the final string and will interprete it just as a simple string.
So you need to concatenate the variable as follows:
```
append("<img s... | There's no such thing in JavaScript as variable binding inside a double quoted strings. Even there was usually a simple var could be used, but not an expression as you want to bind `beer[i].image_url` |
349,589 | Edit: The vertices are $(0,0)$, $(1, 0)$, $(1/2, \sqrt{3}/2)$. Please confirm. Confirmed. | 2013/04/02 | [
"https://math.stackexchange.com/questions/349589",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/70696/"
] | I will assume the equilateral triangle of side one with a vertex at the origin. Clearly, the $x$-centroid is $\bar{x} = 1/2$ by symmetry, so we need only find $\bar{y}$. The expression for the centroid of a region $R$ is
$$\bar{y} = \frac{\displaystyle\iint\_R dA \, y}{\displaystyle\iint\_R dA}$$
It's all about picki... | Well, if you insist to find it by integration, there is a method (though, for the beginning, the best if you draw the triangle on a paper and find the middle point right away..)
We want the *average* of all coordinates $(x,y)$ that lie within the triangle, that would give the center. The average can be calculated by i... |
3,572,736 | We are using TFS Build 2010 for Builds. We have two branches of source code (Lets say branchA and branchB).
Now as a part of the build definition we set the projects to build:

Now to employ the same build definition from branchB will mean that I create another build de... | 2010/08/26 | [
"https://Stackoverflow.com/questions/3572736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46279/"
] | You can modify the Build Process Template so it only asks you for the Items to Build. The rest of the arguments are prefilled. To get an idea how this works, see <http://www.ewaldhofman.nl/?tag=/build+2010+customization> | You can add parameters to your build definition. I did this a while back because we had two web projects in a solution that had to be deployed to different servers (via Windows shares). I added parameters to the build def so that in the build properties I could customize them depending on if it was a dev deployment, st... |
8,808,783 | I would like to find all the matches of given strings (divided by spaces) in a string.
(The way for example, iTunes search box works).
That, for example, both "*ab de*" and "*de ab*" will return true on "*abcde*" (also "*bc e a*" or any order should return true)
If I replace the white space with a wild card, "ab\*de"... | 2012/01/10 | [
"https://Stackoverflow.com/questions/8808783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196706/"
] | Returns `true` when all parts (divided by `,` or `' '`) of a `searchString` occur in text. Otherwise `false` is returned.
```
filter(text, searchString) {
const regexStr = '(?=.*' + searchString.split(/\,|\s/).join(')(?=.*') + ')';
const searchRegEx = new RegExp(regexStr, 'gi');
return text.match(searchReg... | This is script which I use - it works also with single word searchStrings
```
var what="test string with search cool word";
var searchString="search word";
var search = new RegExp(searchString, "gi"); // one-word searching
// multiple search words
if(searchString.indexOf(' ') != -1) {
search="";
var words=se... |
8,808,783 | I would like to find all the matches of given strings (divided by spaces) in a string.
(The way for example, iTunes search box works).
That, for example, both "*ab de*" and "*de ab*" will return true on "*abcde*" (also "*bc e a*" or any order should return true)
If I replace the white space with a wild card, "ab\*de"... | 2012/01/10 | [
"https://Stackoverflow.com/questions/8808783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196706/"
] | I'm pretty sure you could come up with a regex to do what you want, but it may not be the most efficient approach.
For example, the regex pattern `(?=.*bc)(?=.*e)(?=.*a)` will match any string that contains `bc`, `e`, **and** `a`.
```
var isMatch = 'abcde'.match(/(?=.*bc)(?=.*e)(?=.*a)/) != null; // equals true
var ... | I think you may be barking up the wrong tree with RegEx. What you *might* want to look at is the [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance) of two input strings.
There's a Javascript implementation [here](http://andrew.hedges.name/experiments/levenshtein/levenshtein.js) and a usage examp... |
8,808,783 | I would like to find all the matches of given strings (divided by spaces) in a string.
(The way for example, iTunes search box works).
That, for example, both "*ab de*" and "*de ab*" will return true on "*abcde*" (also "*bc e a*" or any order should return true)
If I replace the white space with a wild card, "ab\*de"... | 2012/01/10 | [
"https://Stackoverflow.com/questions/8808783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196706/"
] | Alternations are order insensitive:
```javascript
"abcde".match(/(ab|de)/g); // => ['ab', 'de']
"abcde".match(/(de|ab)/g); // => ['ab', 'de']
```
So if you have a list of words to match you can build a regex with an alternation on the fly like so:
```javascript
function regexForWordList(words) {
return new RegExp... | I assume you are matching words, or parts of words. You want space-separated search terms to limit search results, and it seems you intend to return only those entries which have all the words that the user supplies. And you intend a wildcard character `*` to stand for 0 or more characters in a matching word.
For exam... |
8,808,783 | I would like to find all the matches of given strings (divided by spaces) in a string.
(The way for example, iTunes search box works).
That, for example, both "*ab de*" and "*de ab*" will return true on "*abcde*" (also "*bc e a*" or any order should return true)
If I replace the white space with a wild card, "ab\*de"... | 2012/01/10 | [
"https://Stackoverflow.com/questions/8808783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196706/"
] | Returns `true` when all parts (divided by `,` or `' '`) of a `searchString` occur in text. Otherwise `false` is returned.
```
filter(text, searchString) {
const regexStr = '(?=.*' + searchString.split(/\,|\s/).join(')(?=.*') + ')';
const searchRegEx = new RegExp(regexStr, 'gi');
return text.match(searchReg... | I think you may be barking up the wrong tree with RegEx. What you *might* want to look at is the [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance) of two input strings.
There's a Javascript implementation [here](http://andrew.hedges.name/experiments/levenshtein/levenshtein.js) and a usage examp... |
8,808,783 | I would like to find all the matches of given strings (divided by spaces) in a string.
(The way for example, iTunes search box works).
That, for example, both "*ab de*" and "*de ab*" will return true on "*abcde*" (also "*bc e a*" or any order should return true)
If I replace the white space with a wild card, "ab\*de"... | 2012/01/10 | [
"https://Stackoverflow.com/questions/8808783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196706/"
] | I'm pretty sure you could come up with a regex to do what you want, but it may not be the most efficient approach.
For example, the regex pattern `(?=.*bc)(?=.*e)(?=.*a)` will match any string that contains `bc`, `e`, **and** `a`.
```
var isMatch = 'abcde'.match(/(?=.*bc)(?=.*e)(?=.*a)/) != null; // equals true
var ... | Try this:
```
var str = "your string";
str = str.split( " " );
for( var i = 0 ; i < str.length ; i++ ){
// your regexp match
}
``` |
8,808,783 | I would like to find all the matches of given strings (divided by spaces) in a string.
(The way for example, iTunes search box works).
That, for example, both "*ab de*" and "*de ab*" will return true on "*abcde*" (also "*bc e a*" or any order should return true)
If I replace the white space with a wild card, "ab\*de"... | 2012/01/10 | [
"https://Stackoverflow.com/questions/8808783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196706/"
] | I'm pretty sure you could come up with a regex to do what you want, but it may not be the most efficient approach.
For example, the regex pattern `(?=.*bc)(?=.*e)(?=.*a)` will match any string that contains `bc`, `e`, **and** `a`.
```
var isMatch = 'abcde'.match(/(?=.*bc)(?=.*e)(?=.*a)/) != null; // equals true
var ... | Alternations are order insensitive:
```javascript
"abcde".match(/(ab|de)/g); // => ['ab', 'de']
"abcde".match(/(de|ab)/g); // => ['ab', 'de']
```
So if you have a list of words to match you can build a regex with an alternation on the fly like so:
```javascript
function regexForWordList(words) {
return new RegExp... |
8,808,783 | I would like to find all the matches of given strings (divided by spaces) in a string.
(The way for example, iTunes search box works).
That, for example, both "*ab de*" and "*de ab*" will return true on "*abcde*" (also "*bc e a*" or any order should return true)
If I replace the white space with a wild card, "ab\*de"... | 2012/01/10 | [
"https://Stackoverflow.com/questions/8808783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196706/"
] | Alternations are order insensitive:
```javascript
"abcde".match(/(ab|de)/g); // => ['ab', 'de']
"abcde".match(/(de|ab)/g); // => ['ab', 'de']
```
So if you have a list of words to match you can build a regex with an alternation on the fly like so:
```javascript
function regexForWordList(words) {
return new RegExp... | I think you may be barking up the wrong tree with RegEx. What you *might* want to look at is the [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance) of two input strings.
There's a Javascript implementation [here](http://andrew.hedges.name/experiments/levenshtein/levenshtein.js) and a usage examp... |
8,808,783 | I would like to find all the matches of given strings (divided by spaces) in a string.
(The way for example, iTunes search box works).
That, for example, both "*ab de*" and "*de ab*" will return true on "*abcde*" (also "*bc e a*" or any order should return true)
If I replace the white space with a wild card, "ab\*de"... | 2012/01/10 | [
"https://Stackoverflow.com/questions/8808783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196706/"
] | Try this:
```
var str = "your string";
str = str.split( " " );
for( var i = 0 ; i < str.length ; i++ ){
// your regexp match
}
``` | I think you may be barking up the wrong tree with RegEx. What you *might* want to look at is the [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance) of two input strings.
There's a Javascript implementation [here](http://andrew.hedges.name/experiments/levenshtein/levenshtein.js) and a usage examp... |
8,808,783 | I would like to find all the matches of given strings (divided by spaces) in a string.
(The way for example, iTunes search box works).
That, for example, both "*ab de*" and "*de ab*" will return true on "*abcde*" (also "*bc e a*" or any order should return true)
If I replace the white space with a wild card, "ab\*de"... | 2012/01/10 | [
"https://Stackoverflow.com/questions/8808783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196706/"
] | Returns `true` when all parts (divided by `,` or `' '`) of a `searchString` occur in text. Otherwise `false` is returned.
```
filter(text, searchString) {
const regexStr = '(?=.*' + searchString.split(/\,|\s/).join(')(?=.*') + ')';
const searchRegEx = new RegExp(regexStr, 'gi');
return text.match(searchReg... | Alternations are order insensitive:
```javascript
"abcde".match(/(ab|de)/g); // => ['ab', 'de']
"abcde".match(/(de|ab)/g); // => ['ab', 'de']
```
So if you have a list of words to match you can build a regex with an alternation on the fly like so:
```javascript
function regexForWordList(words) {
return new RegExp... |
8,808,783 | I would like to find all the matches of given strings (divided by spaces) in a string.
(The way for example, iTunes search box works).
That, for example, both "*ab de*" and "*de ab*" will return true on "*abcde*" (also "*bc e a*" or any order should return true)
If I replace the white space with a wild card, "ab\*de"... | 2012/01/10 | [
"https://Stackoverflow.com/questions/8808783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196706/"
] | Returns `true` when all parts (divided by `,` or `' '`) of a `searchString` occur in text. Otherwise `false` is returned.
```
filter(text, searchString) {
const regexStr = '(?=.*' + searchString.split(/\,|\s/).join(')(?=.*') + ')';
const searchRegEx = new RegExp(regexStr, 'gi');
return text.match(searchReg... | I assume you are matching words, or parts of words. You want space-separated search terms to limit search results, and it seems you intend to return only those entries which have all the words that the user supplies. And you intend a wildcard character `*` to stand for 0 or more characters in a matching word.
For exam... |
602,932 | If i wrote something in the sky 8500-10,000 ft high 40 ft tall letters what would be the visibility radius on the ground? Or what formula would i use to come up with the answer? | 2020/12/25 | [
"https://physics.stackexchange.com/questions/602932",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/283663/"
] | Let's assume that you want to write your letters in a square large enough for a little phrase and spacing. Call $\theta$ the angle of the effective field of view (FOV) of the eye (most of our visible area is a little blurred, we have almost a 180° view but we can see clearly only a small angle). here's a little picture... | The size of the letters and their distance will be proportional to size and distance where they are to be calculated. This is arrived by calculating angle those letters subtend at eye.
Let say if their visibility radius is to be calculated at 1 ft distance then:
$$\frac{sz}{1 ft} = \frac{40 ft}{10000 ft}$$
=> $$sz = .0... |
602,932 | If i wrote something in the sky 8500-10,000 ft high 40 ft tall letters what would be the visibility radius on the ground? Or what formula would i use to come up with the answer? | 2020/12/25 | [
"https://physics.stackexchange.com/questions/602932",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/283663/"
] | Let's assume that you want to write your letters in a square large enough for a little phrase and spacing. Call $\theta$ the angle of the effective field of view (FOV) of the eye (most of our visible area is a little blurred, we have almost a 180° view but we can see clearly only a small angle). here's a little picture... | 40 ft at 10,000 feet is 15 sec. It would easily focus onto a single retinal cone cell which is about 30 sec across. |
158,794 | I use WinEdt build 20131031 (v. 8.1) - 64-bit on a Windows 7 (64 bit) machine. My active strings are not working. I tried a lot, e.g., "Load Script" in the Options Interface (under Delimiters, Active Strings, Abbreviations... -> Active Strings).
For example, I would like to have the typical `\ref{}` active string (suc... | 2014/02/05 | [
"https://tex.stackexchange.com/questions/158794",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/45508/"
] | If you want to add your own active strings, you have to add the line
```
%INCLUDE="ConfigEx\myActiveStrings.ini"
```
in the file `ActiveStrings.ini` just before the line
```
[END]
```
as you did, but the structure of `myActiveStrings.ini` has to be the following one:
```
// ======================================... | I have solved the problem. Indeed, it was my own ini-file which made WinEdt's active strings no more working. I used the following code in `myActiveStrings.ini`:
```
// ===============================================================================
// -*- DATA:INI:EDT -*-
//
// My WinEdt Active Strings
//
// =========... |
62,838,481 | Seems like a pretty common error as I was able to find out other questions similar to this one, but can't pinpoint where the issue is.
So I have this Entity
```
@Entity(tableName = "story_id")
data class StoryIdEntity(
@PrimaryKey
@ColumnInfo(name = "type")
val type: String,
@ColumnInfo(name = "ids")
... | 2020/07/10 | [
"https://Stackoverflow.com/questions/62838481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2356570/"
] | Create a wrapper class for the list of ids, for example:
```
data class StoryIds (
val ids: List<Int>
)
```
Then modify your query to return an instance of the wrapper class:
```
@Query("SELECT ids FROM story_id where type = :type")
suspend fun getStories(type: String): StoryIds
``` | add this to your data class to fix "must have usable public constructor"
```
constructor():this("", ArrayList<Int>())
``` |
26,774,416 | I have a [Pivot](http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.controls.pivot.aspx) control with two [PivotItems](http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.controls.pivotitem.aspx). The XAML markup looks like this:
```
<Pivot x:Name="myPivot">
<PivotItem ... | 2014/11/06 | [
"https://Stackoverflow.com/questions/26774416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4065368/"
] | There is something wrong with your project or you have that Pivot inside another container. A Pivot should be the Top Container. It does not work well if is part of another top style container. You also might want to check the Constructor it should look like this
```C#
public MainPage()
{
this.InitializeComponent(... | I think that your second PivotItem is not yet loaded and control is not available. Add Loaded event to the pivot and try this code:
```
private void appPivot_LoadedPivotItem(object sender, PivotItemEventArgs e)
{
if ( e.Item.Name.CompareTo( "pivot_item1" ) == 0 )
{
StackPanel sp1 = StackPanel1;
}
... |
53,461,303 | I have made for this question an easier example of two arrays: The `labelArray` is a 1D-array has labels at indices which corresponds to the same indices of the nD-array `someValuesArray`. I get all indices where label 2 occurs and want to retrieve the values in `someValuesArray`.
```
labelArray = [2,0,1,2]
someValue... | 2018/11/24 | [
"https://Stackoverflow.com/questions/53461303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7793789/"
] | As mentioned in the comments, `someValuesArray` is a **list** of 2d numpy arrays.
I've converted that to an `np.array`.
The code sample in your question attempts to index a python list with a numpy array, which causes the error message you receive.
```
In [111]: a=np.array(someValuesArray) # Convert to a numpy array
... | I can reproduce your error message with:
List index with a scalar array:
```
In [7]: [1,2,3,4][np.array(1)]
Out[7]: 2
```
List index with an (1,) shape array; one element but not a scalar array:
```
In [8]: [1,2,3,4][np.array([1])]
---------------------------------------------------------------------------
TypeErr... |
7,324,689 | I was wondering how to detect whether the button was hidden or not, and how much alpha was applied to it. Then, when viewDidLoad is called, these values can be applied to make the buttons the same state they were left in when the application closed.
How can I code this?
Thanks,
James | 2011/09/06 | [
"https://Stackoverflow.com/questions/7324689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/834166/"
] | If, as your title suggests, you want to use `NSUserDefaults`, then you can set them like this:
```
-(void)saveButtonState:(UIButton*)button {
NSUserDefaults defaults = [NSUserDefaults standardUserDefaults];
[defaults setBool:button.hidden forKey:@"isHidden"];
[defaults setFloat:button.alpha forKey:@"alpha"... | To check out the button state, check this post: [Xcode: Check if UIButton is hidden, using NSUserDefaults](https://stackoverflow.com/questions/7322442/xcode-check-if-uibutton-is-hidden-using-nsuserdefaults)
Regarding the Alpha, try to ask for the return value of: self.button.alpha;
you can update the state (value) o... |
20,485,836 | I am making a code where I need an ArrayList of 5 Arrays, 4 of String type and 1 of boolean type.
So... could you help me making just getter and setter of this?
It's all I need, I would thank you a lot
I'm using Input and Output Files and Streams (I'm starting using Java 'cause I'm a student, so I know just a couple... | 2013/12/10 | [
"https://Stackoverflow.com/questions/20485836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2180785/"
] | You could use non generic array list.
```
ArrayList arr =new ArrayList()
``` | ```
public static void main(String []args)
{
ArrayList arr=new ArrayList();
String str[]=new String[20];
Integer in[]=new Integer[20];
arr.add(in);
arr.add(str);
```
}
ArrayList of type object means its Generic type can accept any type of object.
But when reading the arraylist we need to typecast to ... |
56,720,453 | I'm running a function on an interval. I need to get element by class name, use the id of each and pass it into a function as a variable.
I've tried looping through each class name and passing the id to php but it passes an array (i think) or maybe an html index which i cant separate.
```
$(".eachUnread").each(functi... | 2019/06/23 | [
"https://Stackoverflow.com/questions/56720453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11686735/"
] | So just take a data structure as like as set which stores the data orderly.
like if you store 4 2 6 on the set it will store as 2 4 6.
So what will be the algorithm:
Let,
Array = [12,8,10,11,4,5]
window size =4
first window= [12,8,10,11]
set =[8,10,11,12]
How to get the second highest:
- Remove the last elemen... | There is a relatively simple dunamic programming `O(n^2)` solution:
Build the classic pyramid structure for aggregate value over a subset (the one where you combine the values from the pairs below to make each step above), where you track the largest 2 values (and their position), then simply keep the largest 2 values ... |
56,720,453 | I'm running a function on an interval. I need to get element by class name, use the id of each and pass it into a function as a variable.
I've tried looping through each class name and passing the id to php but it passes an array (i think) or maybe an html index which i cant separate.
```
$(".eachUnread").each(functi... | 2019/06/23 | [
"https://Stackoverflow.com/questions/56720453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11686735/"
] | We can use a double ended queue for an O(n) solution. The front of the queue will have larger (and earlier seen) elements:
```
0 1 2 3 4 5
{12, 8,10,11, 4, 5}
window size: 3
i queue (stores indexes)
- -----
0 0
1 1,0
2 2,0 (pop 1, then insert 2)
output 10
remove 0 (remove indexes not in
the next w... | There is a relatively simple dunamic programming `O(n^2)` solution:
Build the classic pyramid structure for aggregate value over a subset (the one where you combine the values from the pairs below to make each step above), where you track the largest 2 values (and their position), then simply keep the largest 2 values ... |
56,720,453 | I'm running a function on an interval. I need to get element by class name, use the id of each and pass it into a function as a variable.
I've tried looping through each class name and passing the id to php but it passes an array (i think) or maybe an html index which i cant separate.
```
$(".eachUnread").each(functi... | 2019/06/23 | [
"https://Stackoverflow.com/questions/56720453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11686735/"
] | There are many ways that you can solve this problem. Here are a couple of options. In what follows, I'm going to let n denote the number of elements in the input array and w be the window size.
Option 1: A simple, O(n log w)-time algorithm
=============================================
One option would be to maintain ... | There is a relatively simple dunamic programming `O(n^2)` solution:
Build the classic pyramid structure for aggregate value over a subset (the one where you combine the values from the pairs below to make each step above), where you track the largest 2 values (and their position), then simply keep the largest 2 values ... |
56,720,453 | I'm running a function on an interval. I need to get element by class name, use the id of each and pass it into a function as a variable.
I've tried looping through each class name and passing the id to php but it passes an array (i think) or maybe an html index which i cant separate.
```
$(".eachUnread").each(functi... | 2019/06/23 | [
"https://Stackoverflow.com/questions/56720453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11686735/"
] | There are many ways that you can solve this problem. Here are a couple of options. In what follows, I'm going to let n denote the number of elements in the input array and w be the window size.
Option 1: A simple, O(n log w)-time algorithm
=============================================
One option would be to maintain ... | So just take a data structure as like as set which stores the data orderly.
like if you store 4 2 6 on the set it will store as 2 4 6.
So what will be the algorithm:
Let,
Array = [12,8,10,11,4,5]
window size =4
first window= [12,8,10,11]
set =[8,10,11,12]
How to get the second highest:
- Remove the last elemen... |
56,720,453 | I'm running a function on an interval. I need to get element by class name, use the id of each and pass it into a function as a variable.
I've tried looping through each class name and passing the id to php but it passes an array (i think) or maybe an html index which i cant separate.
```
$(".eachUnread").each(functi... | 2019/06/23 | [
"https://Stackoverflow.com/questions/56720453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11686735/"
] | There are many ways that you can solve this problem. Here are a couple of options. In what follows, I'm going to let n denote the number of elements in the input array and w be the window size.
Option 1: A simple, O(n log w)-time algorithm
=============================================
One option would be to maintain ... | We can use a double ended queue for an O(n) solution. The front of the queue will have larger (and earlier seen) elements:
```
0 1 2 3 4 5
{12, 8,10,11, 4, 5}
window size: 3
i queue (stores indexes)
- -----
0 0
1 1,0
2 2,0 (pop 1, then insert 2)
output 10
remove 0 (remove indexes not in
the next w... |
39,796,493 | I have a spark application that reads a file with 100 million lines (each line has a code, such as `US1.234.567B1`) and gets some patterns out of it, as follows:
```
val codes = sc.textFile("/data/codes.txt")
def getPattern(code: String) = code.replaceAll("\\d", "d")
val patterns: RDD[(String, Int)] = codes
... | 2016/09/30 | [
"https://Stackoverflow.com/questions/39796493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/280393/"
] | Long short you're trying to use Spark anti-pattern:
```
.groupBy(getPattern)
.mapValues(_.size)
```
that can be easily expressed for example as:
```
codes.keyBy(getPattern).mapValues(_ => 1L).reduceByKey(_ + _).sortBy(_._2, false)
```
>
> I thought that Spark can handle any size of input.
>
>
>
It usually c... | Yes spark can process very large files, but the unit of parallelism is the executor. 'Out of memory error' is because the spark executor memory or the spark driver memory is insufficient. Please try increasing spark.executor.memory and spark.driver.memory and also tune the number of executors before you submit the job.... |
43,621,987 | I have a combobox in which the items are Objects, the string value of which can be lengthy. Rather than making the box longer I'd like the full text to appear with mouse float over. How can I do that? | 2017/04/25 | [
"https://Stackoverflow.com/questions/43621987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2158840/"
] | Since your conditions are quite simple, you can express them with a simple `filter()` operator.
```
Observable<Integer> scrollStateObs = RxViewPager.pageScrollStateChanges(mPlaceImageViewPager)
.filter(scrollState -> scrollState == ViewPager.SCROLL_STATE_IDLE);
```
In order to only react on `scrollState` ch... | Well 'the most efficient way' depends on your requirment and how you define most efficient. Is it time, is it resources?
I took your code and added a rate-limited-window of 50 msec, that bursty events would not call onNext too often.
In the MAP-opreator you would add some matching to the enum, because -1 and 1 are no... |
26,921,412 | After spending two straight days chasing the answer, I have to fall back and just ask:
Is it possible to perform Sqlite sync via Azure Mobile Services completely within Xamarin Forms iOS PCL project?
Any examples I have looked at (including those that claim that their emphasis is on PCL) all end up instantiating the ... | 2014/11/14 | [
"https://Stackoverflow.com/questions/26921412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518012/"
] | Yes, you can do so. Check out the book - <http://aka.ms/zumobook> - particularly Chapter 3. In addition, check out the underlying repo (link in the book) - there are several example setups of Xamarin Forms with Offline Sync in SQLite in there. The Chapter3 sample is a good place to start. | I'm able to use them with my project with removing Silverlight optins from my PCL project because of some System.Web methods are not available with it.

**On PCL:**
* Microsoft.IdentityModel.Clients.ActiveDirectory
* Newtonsoft.Json
* SQLite.Net
* SQLite.Net.Asyn... |
100,076 | I am going to UK to attend an official meeting and have UK visit visa. Can I go to UK through Switzerland or Amsterdam. I have an official passport of Pakistan but I do not have a Schengen visa. | 2017/08/13 | [
"https://travel.stackexchange.com/questions/100076",
"https://travel.stackexchange.com",
"https://travel.stackexchange.com/users/66510/"
] | At least I found it, it is [mytravelmap.xyz](http://www.mytravelmap.xyz/) (I am not affiliated with it). | Mapchart (not afflicted) at <https://mapchart.net> has the ability to do this to an extent. You will though have to select the country or region first in order together get more detailed choices for your map, if you select one of the world view types you'll only be able to fill in by country. |
100,076 | I am going to UK to attend an official meeting and have UK visit visa. Can I go to UK through Switzerland or Amsterdam. I have an official passport of Pakistan but I do not have a Schengen visa. | 2017/08/13 | [
"https://travel.stackexchange.com/questions/100076",
"https://travel.stackexchange.com",
"https://travel.stackexchange.com/users/66510/"
] | Mapchart (not afflicted) at <https://mapchart.net> has the ability to do this to an extent. You will though have to select the country or region first in order together get more detailed choices for your map, if you select one of the world view types you'll only be able to fill in by country. | I don't about any app but I have recieved one of these scratch maps on my birthday. I think it is more exciting to delete a place after you have visited on a map on your wall! <https://www.luckies.co.uk/product/scratch-map-personalised-world-map-poster/> |
100,076 | I am going to UK to attend an official meeting and have UK visit visa. Can I go to UK through Switzerland or Amsterdam. I have an official passport of Pakistan but I do not have a Schengen visa. | 2017/08/13 | [
"https://travel.stackexchange.com/questions/100076",
"https://travel.stackexchange.com",
"https://travel.stackexchange.com/users/66510/"
] | At least I found it, it is [mytravelmap.xyz](http://www.mytravelmap.xyz/) (I am not affiliated with it). | I don't about any app but I have recieved one of these scratch maps on my birthday. I think it is more exciting to delete a place after you have visited on a map on your wall! <https://www.luckies.co.uk/product/scratch-map-personalised-world-map-poster/> |
2,191,749 | I need to focus out from the textbox when it focus in.
I try to set focus for outer div and its working fine in IE but not in mozilla.
How do I do this?
This is my current code:
```
<div id="outer"> <input type = "textbox" /></div> Onfocus: document.getElementById("outer").focus()
``` | 2010/02/03 | [
"https://Stackoverflow.com/questions/2191749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/171365/"
] | I wonder what's the purpose of using a textbox in this case if the user can never write anything inside. Just add a `disabled="disabled"` attribute or `readonly="readonly"` (in case you want to post the value). | Where is the point in that? JS would be (didn't test it):
```
$('#textbox').focusin(function() {
$(this).focusout();
});
``` |
2,191,749 | I need to focus out from the textbox when it focus in.
I try to set focus for outer div and its working fine in IE but not in mozilla.
How do I do this?
This is my current code:
```
<div id="outer"> <input type = "textbox" /></div> Onfocus: document.getElementById("outer").focus()
``` | 2010/02/03 | [
"https://Stackoverflow.com/questions/2191749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/171365/"
] | I wonder what's the purpose of using a textbox in this case if the user can never write anything inside. Just add a `disabled="disabled"` attribute or `readonly="readonly"` (in case you want to post the value). | ```
/*for textarea*/
$(document).ready(function() {
$('textarea[type="text"]').addClass("idleField");
$('textarea[type="text"]').focus(function() {
$(this).removeClass("idleField").addClass("focusField");
if (this.value == this.defaultValue){
this.value = '';
}
if(this.value != this.defaultValue... |
2,191,749 | I need to focus out from the textbox when it focus in.
I try to set focus for outer div and its working fine in IE but not in mozilla.
How do I do this?
This is my current code:
```
<div id="outer"> <input type = "textbox" /></div> Onfocus: document.getElementById("outer").focus()
``` | 2010/02/03 | [
"https://Stackoverflow.com/questions/2191749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/171365/"
] | In HTML:
```
<input type="text" onfocus="this.blur();" />
```
In JS:
```
document.getElementById("input1").onfocus = function () { this.blur(); }
```
Some elements cannot accept focus without being editable. | Where is the point in that? JS would be (didn't test it):
```
$('#textbox').focusin(function() {
$(this).focusout();
});
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.