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 |
|---|---|---|---|---|---|
3,947,304 | I have a `UIView` - which I am using as a makeshift toolbar. It contains several `UIButton`s. (Six, I think) in a horizontal row.
The *fifth* button over will only respond to [`TouchUpInside`] events when I click the *left half* of it - whereas all the other buttons work correctly.
I have gone crazy making sure there... | 2010/10/16 | [
"https://Stackoverflow.com/questions/3947304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/221768/"
] | The problem was as follows:
The "sixth" button was a "Info Light" type button. For some odd reason - even though the bounds of this button were clearly outside of the bounds of the offending "fifth" button - the "info light" button seems to acquire touches a bit outside it's bounding box.
When I either:
1. Moved the... | I noticed that upon selecting the infoLight type, the button could no longer be interacted with. By checking the checkbox "User Interaction Enabled" I solved the problem. |
3,947,304 | I have a `UIView` - which I am using as a makeshift toolbar. It contains several `UIButton`s. (Six, I think) in a horizontal row.
The *fifth* button over will only respond to [`TouchUpInside`] events when I click the *left half* of it - whereas all the other buttons work correctly.
I have gone crazy making sure there... | 2010/10/16 | [
"https://Stackoverflow.com/questions/3947304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/221768/"
] | The problem was as follows:
The "sixth" button was a "Info Light" type button. For some odd reason - even though the bounds of this button were clearly outside of the bounds of the offending "fifth" button - the "info light" button seems to acquire touches a bit outside it's bounding box.
When I either:
1. Moved the... | Well you could try to use this technique with NSLog() to log events and get a sense of what might be happening. I'm not sure if there's a better way to log events:
[Observing pinch multi-touch gestures in a UITableView](https://stackoverflow.com/questions/2003201/observing-pinch-multi-touch-gestures-in-a-uitableview/2... |
3,947,304 | I have a `UIView` - which I am using as a makeshift toolbar. It contains several `UIButton`s. (Six, I think) in a horizontal row.
The *fifth* button over will only respond to [`TouchUpInside`] events when I click the *left half* of it - whereas all the other buttons work correctly.
I have gone crazy making sure there... | 2010/10/16 | [
"https://Stackoverflow.com/questions/3947304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/221768/"
] | Most likely, the other half is covered by a transparent view that obstructs it. See the frames of all sibling views of the button:
```
for (UIView *v in myButton.superview.subviews){
NSLog(NSStringFromCGRect(v.frame);
}
```
And see if any of the frames above the button (the array is ordered from bottom to top) o... | Just ran into this strange problem as well and after struggling with understanding the nature of the problem, ran across this post. Thanks for the helpful tip! I know it's an old question but this is how I was able to work around it in two ways. The first was to initially create the system info light button and simply ... |
3,947,304 | I have a `UIView` - which I am using as a makeshift toolbar. It contains several `UIButton`s. (Six, I think) in a horizontal row.
The *fifth* button over will only respond to [`TouchUpInside`] events when I click the *left half* of it - whereas all the other buttons work correctly.
I have gone crazy making sure there... | 2010/10/16 | [
"https://Stackoverflow.com/questions/3947304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/221768/"
] | Most likely, the other half is covered by a transparent view that obstructs it. See the frames of all sibling views of the button:
```
for (UIView *v in myButton.superview.subviews){
NSLog(NSStringFromCGRect(v.frame);
}
```
And see if any of the frames above the button (the array is ordered from bottom to top) o... | Well you could try to use this technique with NSLog() to log events and get a sense of what might be happening. I'm not sure if there's a better way to log events:
[Observing pinch multi-touch gestures in a UITableView](https://stackoverflow.com/questions/2003201/observing-pinch-multi-touch-gestures-in-a-uitableview/2... |
3,947,304 | I have a `UIView` - which I am using as a makeshift toolbar. It contains several `UIButton`s. (Six, I think) in a horizontal row.
The *fifth* button over will only respond to [`TouchUpInside`] events when I click the *left half* of it - whereas all the other buttons work correctly.
I have gone crazy making sure there... | 2010/10/16 | [
"https://Stackoverflow.com/questions/3947304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/221768/"
] | The problem was as follows:
The "sixth" button was a "Info Light" type button. For some odd reason - even though the bounds of this button were clearly outside of the bounds of the offending "fifth" button - the "info light" button seems to acquire touches a bit outside it's bounding box.
When I either:
1. Moved the... | I guess your superview bounds might be a bit too small? Try to change your superview background color to red or some vivid color and check its bounds. |
3,947,304 | I have a `UIView` - which I am using as a makeshift toolbar. It contains several `UIButton`s. (Six, I think) in a horizontal row.
The *fifth* button over will only respond to [`TouchUpInside`] events when I click the *left half* of it - whereas all the other buttons work correctly.
I have gone crazy making sure there... | 2010/10/16 | [
"https://Stackoverflow.com/questions/3947304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/221768/"
] | I guess your superview bounds might be a bit too small? Try to change your superview background color to red or some vivid color and check its bounds. | Well you could try to use this technique with NSLog() to log events and get a sense of what might be happening. I'm not sure if there's a better way to log events:
[Observing pinch multi-touch gestures in a UITableView](https://stackoverflow.com/questions/2003201/observing-pinch-multi-touch-gestures-in-a-uitableview/2... |
3,947,304 | I have a `UIView` - which I am using as a makeshift toolbar. It contains several `UIButton`s. (Six, I think) in a horizontal row.
The *fifth* button over will only respond to [`TouchUpInside`] events when I click the *left half* of it - whereas all the other buttons work correctly.
I have gone crazy making sure there... | 2010/10/16 | [
"https://Stackoverflow.com/questions/3947304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/221768/"
] | I guess your superview bounds might be a bit too small? Try to change your superview background color to red or some vivid color and check its bounds. | I noticed that upon selecting the infoLight type, the button could no longer be interacted with. By checking the checkbox "User Interaction Enabled" I solved the problem. |
3,947,304 | I have a `UIView` - which I am using as a makeshift toolbar. It contains several `UIButton`s. (Six, I think) in a horizontal row.
The *fifth* button over will only respond to [`TouchUpInside`] events when I click the *left half* of it - whereas all the other buttons work correctly.
I have gone crazy making sure there... | 2010/10/16 | [
"https://Stackoverflow.com/questions/3947304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/221768/"
] | The problem was as follows:
The "sixth" button was a "Info Light" type button. For some odd reason - even though the bounds of this button were clearly outside of the bounds of the offending "fifth" button - the "info light" button seems to acquire touches a bit outside it's bounding box.
When I either:
1. Moved the... | Just ran into this strange problem as well and after struggling with understanding the nature of the problem, ran across this post. Thanks for the helpful tip! I know it's an old question but this is how I was able to work around it in two ways. The first was to initially create the system info light button and simply ... |
3,947,304 | I have a `UIView` - which I am using as a makeshift toolbar. It contains several `UIButton`s. (Six, I think) in a horizontal row.
The *fifth* button over will only respond to [`TouchUpInside`] events when I click the *left half* of it - whereas all the other buttons work correctly.
I have gone crazy making sure there... | 2010/10/16 | [
"https://Stackoverflow.com/questions/3947304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/221768/"
] | The problem was as follows:
The "sixth" button was a "Info Light" type button. For some odd reason - even though the bounds of this button were clearly outside of the bounds of the offending "fifth" button - the "info light" button seems to acquire touches a bit outside it's bounding box.
When I either:
1. Moved the... | Most likely, the other half is covered by a transparent view that obstructs it. See the frames of all sibling views of the button:
```
for (UIView *v in myButton.superview.subviews){
NSLog(NSStringFromCGRect(v.frame);
}
```
And see if any of the frames above the button (the array is ordered from bottom to top) o... |
10,094,861 | I have a view and I want to use a layout page. In the layout page I want to have a conditional banner which some of the view will turn on/off. Just wondering how I can do this?
I have this in the \_Layout.cshtml page...
```
@if (ShowBanner){
<h1>banner</h1>
}
```
I'm wondering how I can turn this on/off from m... | 2012/04/10 | [
"https://Stackoverflow.com/questions/10094861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/223863/"
] | I'm with you, Exitos: I avoid using `ViewBag` too. Aside from the silly name, I dislike the weak typing that comes along with it. There is a solution, but it's kind of involved, so bear with me.
First, create a class to store the "display hints" that are to be passed to the layout. I creatively call this class "Displa... | Having a model for your layout is not a good idea as it will force all views to use that model. However, you could put that type of information into the ViewBag and have the value populated in the constructor of one of your controller bases. |
10,094,861 | I have a view and I want to use a layout page. In the layout page I want to have a conditional banner which some of the view will turn on/off. Just wondering how I can do this?
I have this in the \_Layout.cshtml page...
```
@if (ShowBanner){
<h1>banner</h1>
}
```
I'm wondering how I can turn this on/off from m... | 2012/04/10 | [
"https://Stackoverflow.com/questions/10094861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/223863/"
] | I'm with you, Exitos: I avoid using `ViewBag` too. Aside from the silly name, I dislike the weak typing that comes along with it. There is a solution, but it's kind of involved, so bear with me.
First, create a class to store the "display hints" that are to be passed to the layout. I creatively call this class "Displa... | You can define a SECTION in your Layout, and then if your View is responsible to "fill" that section... your view can place the HTML in that section.
Here you can see a detailed step by step tutorial on using SECTIONS:
<http://weblogs.asp.net/scottgu/archive/2010/12/30/asp-net-mvc-3-layouts-and-sections-with-razor.as... |
37,361,331 | I have a list of items and I need to loop through it so that every n (eg. 3) items are first collected and then processed at once at the n'th item.
I'm doing the following:
```
List<MyObject> smallList = new List<MyObject>();
for (int i = 0; i < largeList.Count; i++)
{
smallList.Add(largeList[i]);
if (i % 3... | 2016/05/21 | [
"https://Stackoverflow.com/questions/37361331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/524861/"
] | You can also do this with LINQ:
```
var largeList = new List<int>(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
for (int i = 0; i < largeList.Count; i += 3)
{
var items = largeList.Skip(i).Take(3).ToList();
// do stuff with your 3 (or less items)
}
``` | I suggest using nested loops. Not as pretty as LinQ, but certainly faster.
```
const int n = 3;
var small = new List();
for(var i=0; i<large.Count; i+=n)
{
small.Clear();
for(var j=i; j < n && j<large.Count; j++)
small.Add(large[j]);
// Do stuff with small
}
```
However quite similar to what you ... |
37,361,331 | I have a list of items and I need to loop through it so that every n (eg. 3) items are first collected and then processed at once at the n'th item.
I'm doing the following:
```
List<MyObject> smallList = new List<MyObject>();
for (int i = 0; i < largeList.Count; i++)
{
smallList.Add(largeList[i]);
if (i % 3... | 2016/05/21 | [
"https://Stackoverflow.com/questions/37361331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/524861/"
] | You can also do this with LINQ:
```
var largeList = new List<int>(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
for (int i = 0; i < largeList.Count; i += 3)
{
var items = largeList.Skip(i).Take(3).ToList();
// do stuff with your 3 (or less items)
}
``` | You can do it with LINQ.
First, "attach" an index to each item:
```
var indexedItems = largeList.Select((item, index) => new {index, item});
```
Now group them by their index, while selecting the collection (`IEnumerable`) of items for each group member:
```
var groupedItems = indexedItems.GroupBy(indexedItem => i... |
37,361,331 | I have a list of items and I need to loop through it so that every n (eg. 3) items are first collected and then processed at once at the n'th item.
I'm doing the following:
```
List<MyObject> smallList = new List<MyObject>();
for (int i = 0; i < largeList.Count; i++)
{
smallList.Add(largeList[i]);
if (i % 3... | 2016/05/21 | [
"https://Stackoverflow.com/questions/37361331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/524861/"
] | You can also do this with LINQ:
```
var largeList = new List<int>(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
for (int i = 0; i < largeList.Count; i += 3)
{
var items = largeList.Skip(i).Take(3).ToList();
// do stuff with your 3 (or less items)
}
``` | you can use this code:
```
var MyObjectList = new List<MyObject>();
MyObjectList.Where(a => MyObjectList.IndexOf(a) % 3 == 0).ToList().ForEach(a =>
{
// do your things!
});
``` |
37,361,331 | I have a list of items and I need to loop through it so that every n (eg. 3) items are first collected and then processed at once at the n'th item.
I'm doing the following:
```
List<MyObject> smallList = new List<MyObject>();
for (int i = 0; i < largeList.Count; i++)
{
smallList.Add(largeList[i]);
if (i % 3... | 2016/05/21 | [
"https://Stackoverflow.com/questions/37361331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/524861/"
] | You can do it with LINQ.
First, "attach" an index to each item:
```
var indexedItems = largeList.Select((item, index) => new {index, item});
```
Now group them by their index, while selecting the collection (`IEnumerable`) of items for each group member:
```
var groupedItems = indexedItems.GroupBy(indexedItem => i... | I suggest using nested loops. Not as pretty as LinQ, but certainly faster.
```
const int n = 3;
var small = new List();
for(var i=0; i<large.Count; i+=n)
{
small.Clear();
for(var j=i; j < n && j<large.Count; j++)
small.Add(large[j]);
// Do stuff with small
}
```
However quite similar to what you ... |
37,361,331 | I have a list of items and I need to loop through it so that every n (eg. 3) items are first collected and then processed at once at the n'th item.
I'm doing the following:
```
List<MyObject> smallList = new List<MyObject>();
for (int i = 0; i < largeList.Count; i++)
{
smallList.Add(largeList[i]);
if (i % 3... | 2016/05/21 | [
"https://Stackoverflow.com/questions/37361331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/524861/"
] | I suggest using nested loops. Not as pretty as LinQ, but certainly faster.
```
const int n = 3;
var small = new List();
for(var i=0; i<large.Count; i+=n)
{
small.Clear();
for(var j=i; j < n && j<large.Count; j++)
small.Add(large[j]);
// Do stuff with small
}
```
However quite similar to what you ... | you can use this code:
```
var MyObjectList = new List<MyObject>();
MyObjectList.Where(a => MyObjectList.IndexOf(a) % 3 == 0).ToList().ForEach(a =>
{
// do your things!
});
``` |
37,361,331 | I have a list of items and I need to loop through it so that every n (eg. 3) items are first collected and then processed at once at the n'th item.
I'm doing the following:
```
List<MyObject> smallList = new List<MyObject>();
for (int i = 0; i < largeList.Count; i++)
{
smallList.Add(largeList[i]);
if (i % 3... | 2016/05/21 | [
"https://Stackoverflow.com/questions/37361331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/524861/"
] | You can do it with LINQ.
First, "attach" an index to each item:
```
var indexedItems = largeList.Select((item, index) => new {index, item});
```
Now group them by their index, while selecting the collection (`IEnumerable`) of items for each group member:
```
var groupedItems = indexedItems.GroupBy(indexedItem => i... | you can use this code:
```
var MyObjectList = new List<MyObject>();
MyObjectList.Where(a => MyObjectList.IndexOf(a) % 3 == 0).ToList().ForEach(a =>
{
// do your things!
});
``` |
38,239,994 | I'm trying get the best performance for an Elasticsearch query.
I need something similar to this MySQL query:
```
SELECT * FROM table WHERE field_a IN ('value1', 'value2') AND field_b = value
```
The number of values for `field_a` may be between 1 and let's say 20.
All fields require an exact match.
Right now ... | 2016/07/07 | [
"https://Stackoverflow.com/questions/38239994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1184782/"
] | If you have a list of values you want `field_a` to compare against, you can use the following query:
```
{
"query" : {
"constant_score" : {
"filter" : {
"bool" : {
"should" : [
{ "terms" : {"field_a" : ["value1", "value2", "etc..."]}}
],
... | Indexes must be created for field\_a and field\_b. Do not use \* in query - it reduces performance. Instead \* - write the fields you need. |
29,526,178 | **Problem**
I am trying to adapt this [javascript](http://codepen.io/phantomesse/pen/WbJYam) (not my own) to be more dynamic for razor. However, it is becoming more clear to me that Razor was designed for being embedded in HTML and not javascript.
I want to be able to use razor to put variables into javascript so I ... | 2015/04/08 | [
"https://Stackoverflow.com/questions/29526178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4005362/"
] | Easiest approach is to stop creating the table in javascript and let razor do it for you, and modify the javascript to handle interacting with the HTML that razor renders. If all you care about it resizing the grid, then you can pass the columns and rows in via a model or viewbag if you prefer.
`var columns = ['Column... | You can fix it by removing
```
@model Application.Models.Shelf
```
But the problem is best fixed by identifying what is being passed to the view and fixing it there.
It says you're passing a string, but it is expecting a Application.Models.Shelf object |
54,232,769 | I have a problem with my little game which I have programmed, with the help of a c++ book.
So first I have a class called PlayerObject, and a array with all game objects stored in.
When the game starts, I loop through all the objects inside the array.
```
while (true) {
for (auto i = 0; i < 100; i++) {
auto obj... | 2019/01/17 | [
"https://Stackoverflow.com/questions/54232769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8883288/"
] | One way is to use `group_by`:
```
jq -n --slurpfile file1 file1.json --slurpfile file2 file2.json -f merge.jq
```
where merge.jq contains:
```
def sigma(f): reduce f as $x (null; . + $x);
$file1 + $file2
| group_by(.inst_id)[]
| {tag_id: sigma(.[].tag_id), inst_id: .[0].inst_id }
``` | The following approach is very efficient in that:
(a) it takes advantage of the fact that file1.json and file2.json are streams of objects, thus avoiding the memory required to store these objects as arrays;
(b) it avoids sorting (as entailed, for example, by `group_by`)
The key concept is the keywise-addition of ob... |
54,232,769 | I have a problem with my little game which I have programmed, with the help of a c++ book.
So first I have a class called PlayerObject, and a array with all game objects stored in.
When the game starts, I loop through all the objects inside the array.
```
while (true) {
for (auto i = 0; i < 100; i++) {
auto obj... | 2019/01/17 | [
"https://Stackoverflow.com/questions/54232769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8883288/"
] | Here's a join-like approach. It assumes your jq has `INDEX/2` and supports the `--slurpfile` command-line option. If your jq does not have these, now would be a good time to upgrade, though there are easy workarounds.
Invocation
----------
```
jq -n --slurpfile file1 file1.json -f join.jq file2.json
```
join.jq
---... | The following approach is very efficient in that:
(a) it takes advantage of the fact that file1.json and file2.json are streams of objects, thus avoiding the memory required to store these objects as arrays;
(b) it avoids sorting (as entailed, for example, by `group_by`)
The key concept is the keywise-addition of ob... |
57,733,285 | There are many stackoverflow issues when trying to use transform as an inline style in jsx, but the solutions use jquery (which I don't yet know how to use), or aren't inline where I can access javascript Date(). I am trying to rotate an image depending on the time of day on a 24 hour clock.
I would love if transform ... | 2019/08/30 | [
"https://Stackoverflow.com/questions/57733285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11711280/"
] | The [*Catalan numbers* [wiki]](https://en.wikipedia.org/wiki/Catalan_number#Properties) can be defined inductively with:
*C0 = 1* and *Cn+1=(4n+2)×Cn/(n+2)*.
So we can implement this as:
```
catalan :: Integral i => [i]
catalan = xs
where xs = 1 : zipWith f [0..] xs
f n cn = div ((4*n+2) * cn) (n+2)
``... | I'm guessing you're looking for a lazy, infinite, self-referential list of all the Catalan numbers using one of the basic recurrence relations. That's a common thing to do with the Fibonacci numbers after all. But it would help to specify the recurrence relation you mean, if you want answers to your specific question. ... |
57,733,285 | There are many stackoverflow issues when trying to use transform as an inline style in jsx, but the solutions use jquery (which I don't yet know how to use), or aren't inline where I can access javascript Date(). I am trying to rotate an image depending on the time of day on a 24 hour clock.
I would love if transform ... | 2019/08/30 | [
"https://Stackoverflow.com/questions/57733285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11711280/"
] | The [*Catalan numbers* [wiki]](https://en.wikipedia.org/wiki/Catalan_number#Properties) can be defined inductively with:
*C0 = 1* and *Cn+1=(4n+2)×Cn/(n+2)*.
So we can implement this as:
```
catalan :: Integral i => [i]
catalan = xs
where xs = 1 : zipWith f [0..] xs
f n cn = div ((4*n+2) * cn) (n+2)
``... | [Apparently](https://stackoverflow.com/a/57734376/849891), what you wanted is
```
> cats = 1 : unfoldr (\ fx -> let x = sum $ zipWith (*) fx cats in Just (x, x:fx)) [1]
> take 10 cats
[1,1,2,5,14,42,132,429,1430,4862]
```
This avoids the repeated reversing of the prefixes (as in the linked answer), by unfolding wit... |
57,733,285 | There are many stackoverflow issues when trying to use transform as an inline style in jsx, but the solutions use jquery (which I don't yet know how to use), or aren't inline where I can access javascript Date(). I am trying to rotate an image depending on the time of day on a 24 hour clock.
I would love if transform ... | 2019/08/30 | [
"https://Stackoverflow.com/questions/57733285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11711280/"
] | The [*Catalan numbers* [wiki]](https://en.wikipedia.org/wiki/Catalan_number#Properties) can be defined inductively with:
*C0 = 1* and *Cn+1=(4n+2)×Cn/(n+2)*.
So we can implement this as:
```
catalan :: Integral i => [i]
catalan = xs
where xs = 1 : zipWith f [0..] xs
f n cn = div ((4*n+2) * cn) (n+2)
``... | The Catalan numbers are best understood by their generating function, which satisfies the relation
*f(t) = 1 + t f(t)^2*
This can be expressed in Haskell as
```
f :: [Int]
f = 1 : convolve f f
```
for a suitable definition of `convolve`. It is helpful to factor out `convolve`, for many other counting problems take... |
57,733,285 | There are many stackoverflow issues when trying to use transform as an inline style in jsx, but the solutions use jquery (which I don't yet know how to use), or aren't inline where I can access javascript Date(). I am trying to rotate an image depending on the time of day on a 24 hour clock.
I would love if transform ... | 2019/08/30 | [
"https://Stackoverflow.com/questions/57733285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11711280/"
] | I'm guessing you're looking for a lazy, infinite, self-referential list of all the Catalan numbers using one of the basic recurrence relations. That's a common thing to do with the Fibonacci numbers after all. But it would help to specify the recurrence relation you mean, if you want answers to your specific question. ... | The Catalan numbers are best understood by their generating function, which satisfies the relation
*f(t) = 1 + t f(t)^2*
This can be expressed in Haskell as
```
f :: [Int]
f = 1 : convolve f f
```
for a suitable definition of `convolve`. It is helpful to factor out `convolve`, for many other counting problems take... |
57,733,285 | There are many stackoverflow issues when trying to use transform as an inline style in jsx, but the solutions use jquery (which I don't yet know how to use), or aren't inline where I can access javascript Date(). I am trying to rotate an image depending on the time of day on a 24 hour clock.
I would love if transform ... | 2019/08/30 | [
"https://Stackoverflow.com/questions/57733285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11711280/"
] | [Apparently](https://stackoverflow.com/a/57734376/849891), what you wanted is
```
> cats = 1 : unfoldr (\ fx -> let x = sum $ zipWith (*) fx cats in Just (x, x:fx)) [1]
> take 10 cats
[1,1,2,5,14,42,132,429,1430,4862]
```
This avoids the repeated reversing of the prefixes (as in the linked answer), by unfolding wit... | The Catalan numbers are best understood by their generating function, which satisfies the relation
*f(t) = 1 + t f(t)^2*
This can be expressed in Haskell as
```
f :: [Int]
f = 1 : convolve f f
```
for a suitable definition of `convolve`. It is helpful to factor out `convolve`, for many other counting problems take... |
36,997 | On the show *Tyrant*, Jamal kills
>
> his Norwegian girlfriend.
>
>
>
Why? | 2015/07/23 | [
"https://movies.stackexchange.com/questions/36997",
"https://movies.stackexchange.com",
"https://movies.stackexchange.com/users/23267/"
] | Jamal essentially accepted the fact that the Sheik would survive and expose him as the culprit, losing all esteem, power and ultimately solidifying his notoriety as a bad person. Jamal used this pending loss as a means to escape his reality (leaving to the maldives), essentially a moment of weakness for someone so powe... | >
> Distressed, he invites Katerina to come with him instead and she agrees. However Bassam calls and informs him he did kill the Sheikh, and Jamal, **to cover up any evidence he was thinking of giving up the Presidency, kills Katerina**.
>
>
>
<http://tyrantfx.wikia.com/wiki/Jamal_Al-Fayeed>
Final paragraph. |
7,611 | Many psychics claim to be able to see auras. Many healing methods like reiki are based on them.
Psychics claim that if you look at someone with soft eyes, you can see a hazy field around them, white at first, which with practice becomes colourful and more detailed. They claim this is the aura.
Is there any proof of a... | 2012/01/19 | [
"https://skeptics.stackexchange.com/questions/7611",
"https://skeptics.stackexchange.com",
"https://skeptics.stackexchange.com/users/5795/"
] | As far as I am aware there have been no empirical studies that give even the slightest indication that auras exist.
Pyshcics who claims to be able to detect auras have been tested somewhat informally, never doing better than chance and sometimes doing worse. One notable example may be when James Randi [tested a person... | >
> Many psychics claim to be able to see auras. Many healing methods like reiki are based on them.
>
>
>
I don't think Reiki is based on the concept of auras. As far as I know, orthodox Reiki doesn't use the term "aura". I searched a [few](http://www.aetw.org/pdf/Usui_Memorial.zip) [Reiki](http://www.aetw.org/pdf... |
2,343,084 | >
> Without directly evaluting, show that
> $det \left[
> \begin{array}{ccc}
> b + c & c + a & b + a \\
> a & b & c \\
> 1 & 1 & 1
> \end{array}
> \right]
> =0$
>
>
>
I am stuck on this one. I can only do this by evuating.
Things that I know:
1) Square matrix $A$ with two proportional rows or columns... | 2017/07/01 | [
"https://math.stackexchange.com/questions/2343084",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/448042/"
] | The row vectors are linearly dependent.
Specifically, denoting the row vectors as $$\vec r\_1=(b+c,a+c,a+b)\quad \vec r\_2=(a,b,c)\quad \vec r\_3=(1,1,1)$$ then we have $$\vec r\_1+\vec r\_2=(a+b+c)\,\vec r\_3$$ | Here's one possibility: For a fixed value of $a,b$, $\det(A)$ is a degree two polynomial in $c$. It is obviously $0$ for $c=0,a,b$, and hence the polynomial is identically $0$. (Unless $a=b$, $a=0$, etc, but then you can use the same reasoning with the other variables). |
10,762,024 | My question is about hosting small personal websites which doesn't have a heavy traffic.
The biggest reasons why we (standard PC users) are paying for web hosting services are (please correct me if I'm wrong):
1. We don't keep our PCs turned on all the time.
2. Some/most of us don't have static IP addresses.
However... | 2012/05/25 | [
"https://Stackoverflow.com/questions/10762024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245376/"
] | The web server [already exists](http://code.google.com/p/i-jetty/). I'm not even going to look up a DNS server because that's not really significant & the latency, combined with the extreme unlikelyhood of a cell provider giving you a static IP, the likelyhood of you jumping on and off wifi changing IPs & the high prob... | as far as I know you can't directly connect to a cellphone web server given all the reasons that Sean listed above. There were a Nokia app that I used to use in my old N95 which provided access to SMS, photos music, camera, etc. Without caring for you being behind a router, firewall or using WiFi or cell signal. But yo... |
10,762,024 | My question is about hosting small personal websites which doesn't have a heavy traffic.
The biggest reasons why we (standard PC users) are paying for web hosting services are (please correct me if I'm wrong):
1. We don't keep our PCs turned on all the time.
2. Some/most of us don't have static IP addresses.
However... | 2012/05/25 | [
"https://Stackoverflow.com/questions/10762024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245376/"
] | You can already get a web server which runs on your SIM card called the Smartcard Web Server (SCWS) if you have a GSM phone. It runs in a part called the SIM application Toolkit which is a really cool area of your SIM card for running services. The web server is part of the OMA (Open Mobile Alliance) [specifications](h... | The web server [already exists](http://code.google.com/p/i-jetty/). I'm not even going to look up a DNS server because that's not really significant & the latency, combined with the extreme unlikelyhood of a cell provider giving you a static IP, the likelyhood of you jumping on and off wifi changing IPs & the high prob... |
10,762,024 | My question is about hosting small personal websites which doesn't have a heavy traffic.
The biggest reasons why we (standard PC users) are paying for web hosting services are (please correct me if I'm wrong):
1. We don't keep our PCs turned on all the time.
2. Some/most of us don't have static IP addresses.
However... | 2012/05/25 | [
"https://Stackoverflow.com/questions/10762024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245376/"
] | The web server [already exists](http://code.google.com/p/i-jetty/). I'm not even going to look up a DNS server because that's not really significant & the latency, combined with the extreme unlikelyhood of a cell provider giving you a static IP, the likelyhood of you jumping on and off wifi changing IPs & the high prob... | I am currently working in the same field for my PhD. So I think I can give you useful tips, though it is quiet long time since you ask the question.
It is very easy and low cost to have a mobile web server which can receive HTTP request, and reply accordingly. You can use Paw, KSWEB, i-jetty and many more for iOS and... |
10,762,024 | My question is about hosting small personal websites which doesn't have a heavy traffic.
The biggest reasons why we (standard PC users) are paying for web hosting services are (please correct me if I'm wrong):
1. We don't keep our PCs turned on all the time.
2. Some/most of us don't have static IP addresses.
However... | 2012/05/25 | [
"https://Stackoverflow.com/questions/10762024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245376/"
] | You can already get a web server which runs on your SIM card called the Smartcard Web Server (SCWS) if you have a GSM phone. It runs in a part called the SIM application Toolkit which is a really cool area of your SIM card for running services. The web server is part of the OMA (Open Mobile Alliance) [specifications](h... | as far as I know you can't directly connect to a cellphone web server given all the reasons that Sean listed above. There were a Nokia app that I used to use in my old N95 which provided access to SMS, photos music, camera, etc. Without caring for you being behind a router, firewall or using WiFi or cell signal. But yo... |
10,762,024 | My question is about hosting small personal websites which doesn't have a heavy traffic.
The biggest reasons why we (standard PC users) are paying for web hosting services are (please correct me if I'm wrong):
1. We don't keep our PCs turned on all the time.
2. Some/most of us don't have static IP addresses.
However... | 2012/05/25 | [
"https://Stackoverflow.com/questions/10762024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245376/"
] | You can already get a web server which runs on your SIM card called the Smartcard Web Server (SCWS) if you have a GSM phone. It runs in a part called the SIM application Toolkit which is a really cool area of your SIM card for running services. The web server is part of the OMA (Open Mobile Alliance) [specifications](h... | I am currently working in the same field for my PhD. So I think I can give you useful tips, though it is quiet long time since you ask the question.
It is very easy and low cost to have a mobile web server which can receive HTTP request, and reply accordingly. You can use Paw, KSWEB, i-jetty and many more for iOS and... |
36,223,686 | I'm using [Angular-Filter](https://github.com/a8m/angular-filter)'s [groupBy](https://github.com/a8m/angular-filter#groupby) filter.
**Example from GitHub**:
```
$scope.players = [
{name: 'Gene', team: 'alpha'},
{name: 'George', team: 'beta'},
{name: 'Steve', team: 'gamma'},
{name: 'Paula', team: 'beta'},
... | 2016/03/25 | [
"https://Stackoverflow.com/questions/36223686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2419808/"
] | Follow the example of multiple fields
```js
angular.module('app',['angular.filter'])
.controller('MainController', function($scope) {
$scope.players = [
{name: 'Gene', team: 'alpha', age: 19},
{name: 'George', team: 'beta', age: 19},
{name: 'Steve', team: 'gamma', age: 23},
{name: ... | try the following i am assuming you want groups to be created using multiple values as criteria
```
ng-repeat="(key, value) in players | groupBy: '[team,age]'"
``` |
12,701,082 | I installed Sija's fork of `garb` and am having some issues. The documentation appears to be a bit outdated as some things have been deprecated.
I have the following code (ignore the fact that it's horribly unsecure):
```
extend Garb::Model
metrics :pageviews
dimensions :page_path
Garb::Session.login('XXXXXX@gmail.c... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12701082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/642128/"
] | I guess you should try railsinstaller for windows that includes rubygems. Then `gem install tiny_tds` in the command prompt. | You need to download the Ruby installer depending on you systems settings (32 or 64 bit) and the ruby development kit in order to run command lines. Here is a link to the installer and a simple guide for installing the DevKit for ruby on windows (this one is to make jekyll run on windows, jekyll is other ruby gem):
Ru... |
35,366 | I am attempting to prove this result but I found a case where I can easily disprove this statement.
>
> Suppose $G$ is a graph with two nodes u, v and an edge (u,v) and respective self edges, then removing the edge u,v results in two nodes left, therefore leaving the resulting graph disconnected.
>
>
>
![enter im... | 2014/12/16 | [
"https://cs.stackexchange.com/questions/35366",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/23030/"
] | Suppose to the contrary that removing any vertex of a finite graph $G$ would disconnect it. Then $G$ could not contain any cycles (else we'd have an immediate contradiction) and so $G$ would have to be a tree. However, removing a leaf vertex of $G$ wouldn't disconnect it, contrary again to our assumption. | The question asks you to remove a *vertex* rather than an edge. Also, undirected graphs usually don't have self-loops, and in the context of undirected graphs, undirected edges are usually not thought of as consisting of two directed edges, but rather as being indivisible.
In your example, removing either A or B resul... |
9,788,130 | I would like to be able to plot the profile deviance for a parameter estimate fitted using the function `glm()` in R. The profile Deviance is the deviance function for different values of the parameter estimate in question, after estimating all other parameters. I need to plot the deviance for several values around the... | 2012/03/20 | [
"https://Stackoverflow.com/questions/9788130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1168126/"
] | See the [**profileModel** package](http://cran.r-project.org/web/packages/profileModel/index.html) by Ioannis Kosmidis. He had a paper in the R Journal (R News it would appear) illustrating the package:
Ioannis Kosmidis. The profilemodel R package: Profiling objectives for models with linear predictors. R News, 8(2):1... | See `?profile.glm` (and `example("profile.glm")`) in the `MASS` package -- I think it will do everything you want (this is not loaded by default, but it is mentioned in `?profile`, which might have been the first place you looked ...) (Note that the profiles are generally plotted on a signed-square-root scale, so that ... |
9,788,130 | I would like to be able to plot the profile deviance for a parameter estimate fitted using the function `glm()` in R. The profile Deviance is the deviance function for different values of the parameter estimate in question, after estimating all other parameters. I need to plot the deviance for several values around the... | 2012/03/20 | [
"https://Stackoverflow.com/questions/9788130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1168126/"
] | See `?profile.glm` (and `example("profile.glm")`) in the `MASS` package -- I think it will do everything you want (this is not loaded by default, but it is mentioned in `?profile`, which might have been the first place you looked ...) (Note that the profiles are generally plotted on a signed-square-root scale, so that ... | The way I found to do this involves using the offset() function (as detailed in Pawitan, Y. (2001) 'In All Likelihood' p172).
The answers given by @BenBolker and @GavinSimpson are better than this, in that they referenced packages which will do everything this does and a lot more.
I'm posting this because its another w... |
9,788,130 | I would like to be able to plot the profile deviance for a parameter estimate fitted using the function `glm()` in R. The profile Deviance is the deviance function for different values of the parameter estimate in question, after estimating all other parameters. I need to plot the deviance for several values around the... | 2012/03/20 | [
"https://Stackoverflow.com/questions/9788130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1168126/"
] | See the [**profileModel** package](http://cran.r-project.org/web/packages/profileModel/index.html) by Ioannis Kosmidis. He had a paper in the R Journal (R News it would appear) illustrating the package:
Ioannis Kosmidis. The profilemodel R package: Profiling objectives for models with linear predictors. R News, 8(2):1... | The way I found to do this involves using the offset() function (as detailed in Pawitan, Y. (2001) 'In All Likelihood' p172).
The answers given by @BenBolker and @GavinSimpson are better than this, in that they referenced packages which will do everything this does and a lot more.
I'm posting this because its another w... |
52,631,921 | Basically I have a vector of strings separated by commas. I'm looking to one-hot encode using the unique values of the strings. I believe I have to first find the unique values (separated by commas) to use as the columns before one-hot encoding, but I'm not sure. For instance, say I have the following character vector:... | 2018/10/03 | [
"https://Stackoverflow.com/questions/52631921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8673370/"
] | ```
people_names = c("Bob,Megan,Mike,Sarah",
"Mike,Sarah",
"Megan,Sarah",
"Bob")
library(tidyverse)
data.frame(people_names) %>% # create a dataframe
mutate(id = row_number(), # add row id (useful for reshaping)
value = 1) %>... | As an alternative, there is a helper function in the `splitstackshape` package that you might find useful. The output is a matrix
```
splitstackshape:::charMat(strsplit(people_names, ","), fill = 0L)
# Bob Megan Mike Sarah
#[1,] 1 1 1 1
#[2,] 0 0 1 1
#[3,] 0 1 0 1
#[4,] 1 ... |
42,024,619 | We have a maven build that runs in jenkins in amazon ec2 instances.
The total build takes 20-30min and roughly every other run it fails because it cant download artifacts from maven central. This is the failing part of the log:
```
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, ... | 2017/02/03 | [
"https://Stackoverflow.com/questions/42024619",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3782858/"
] | Few Pointers,
1) This looks to be EC2 network setting problem. It's not a maven http wagon problem.
2) Look at this similar [problem](https://forums.aws.amazon.com/thread.jspa?threadID=222925). More specifically [this](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html#nat-gateway-troubleshoo... | We have a similar issue in Azure VM. I posted this question here as well: [Maven build download artefacts connection slow/reset when running inside a Docker Container on Azure](https://stackoverflow.com/questions/56269584/maven-build-download-artefacts-connection-slow-reset-when-running-inside-a-docke)
Our setup is a ... |
42,024,619 | We have a maven build that runs in jenkins in amazon ec2 instances.
The total build takes 20-30min and roughly every other run it fails because it cant download artifacts from maven central. This is the failing part of the log:
```
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, ... | 2017/02/03 | [
"https://Stackoverflow.com/questions/42024619",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3782858/"
] | **TL;DR**
Try upgrading to Maven 3.6.1. It has a new version of Wagon HTTP with improved retry behavior. This fixed the problem for us.
**Background**
Our builds ran fine for months (in ec2). Then one day they started sporadically failing downloading Maven artifacts (from Maven central) with Connection reset. We nev... | Few Pointers,
1) This looks to be EC2 network setting problem. It's not a maven http wagon problem.
2) Look at this similar [problem](https://forums.aws.amazon.com/thread.jspa?threadID=222925). More specifically [this](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html#nat-gateway-troubleshoo... |
42,024,619 | We have a maven build that runs in jenkins in amazon ec2 instances.
The total build takes 20-30min and roughly every other run it fails because it cant download artifacts from maven central. This is the failing part of the log:
```
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, ... | 2017/02/03 | [
"https://Stackoverflow.com/questions/42024619",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3782858/"
] | **TL;DR**
Try upgrading to Maven 3.6.1. It has a new version of Wagon HTTP with improved retry behavior. This fixed the problem for us.
**Background**
Our builds ran fine for months (in ec2). Then one day they started sporadically failing downloading Maven artifacts (from Maven central) with Connection reset. We nev... | We have a similar issue in Azure VM. I posted this question here as well: [Maven build download artefacts connection slow/reset when running inside a Docker Container on Azure](https://stackoverflow.com/questions/56269584/maven-build-download-artefacts-connection-slow-reset-when-running-inside-a-docke)
Our setup is a ... |
38,747,466 | I am new to Protractor. I have the test data stored in excel in multiple rows. I would like to run the same spec multiple times for each row in excel. Is it possible?
```
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
baseUrl: 'https:somewebsite.com',
capabilities: {
'brows... | 2016/08/03 | [
"https://Stackoverflow.com/questions/38747466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6456313/"
] | Testing same functionality with multiple sets of data is nothing but ***Data Driven*** approach. For that we have ***jasmine-data-provider*** package, which will helps you in doing data driven testing with Protractor.
```
Code Snippet:
var using = require(‘jasmine-data-provider);
var loginData = require('../example/T... | Looks like you are already using `protractor-cucumber-framework`. Cucumber provides you ways to run same test on multiple data. You don't need to add complexity of reading data from excel. Reuse the capabilities provided by the framework. For example, in your .feature file you can do something like below. So this scena... |
69,857 | How can Linux run on different microprocessors? Is the Linux kernel being compiled at installation each time? | 2009/09/29 | [
"https://serverfault.com/questions/69857",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | Each compiled/installed kernel image is built for one specific microprocessor (or microprocessor family usually).
The source code is partly hardware-independent (= many drivers, schedulers, ...) and partly platform specific (= low-level interaction with hardware, ...), but the resulting binary is *always* specific for... | It is normally compiled before installing. But yes it's compiled for each platform separately. |
69,857 | How can Linux run on different microprocessors? Is the Linux kernel being compiled at installation each time? | 2009/09/29 | [
"https://serverfault.com/questions/69857",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | **Linux kernel is**, as each compiled program, **platform dependent**.
Kernel hackers are very skilled coders, so a huge part of the kernel code is written in a platform-aware way (by the use ho pre-processor macro for example), the remaining part has to be architecture dependent either for performance issues or becau... | It is normally compiled before installing. But yes it's compiled for each platform separately. |
69,857 | How can Linux run on different microprocessors? Is the Linux kernel being compiled at installation each time? | 2009/09/29 | [
"https://serverfault.com/questions/69857",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | Usual steps to get linux working on particular platform:
* Download kernel sources
* Download specific platform patches (for example, for Atmel's AT91RM9200 ARM CPU)
* Apply official/non-official/your patches
* Download crosstool-ng or similar tool & build your crosscompiler/libraries
* Build your kernel
* Assembly/up... | It is normally compiled before installing. But yes it's compiled for each platform separately. |
69,857 | How can Linux run on different microprocessors? Is the Linux kernel being compiled at installation each time? | 2009/09/29 | [
"https://serverfault.com/questions/69857",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | Each compiled/installed kernel image is built for one specific microprocessor (or microprocessor family usually).
The source code is partly hardware-independent (= many drivers, schedulers, ...) and partly platform specific (= low-level interaction with hardware, ...), but the resulting binary is *always* specific for... | **Linux kernel is**, as each compiled program, **platform dependent**.
Kernel hackers are very skilled coders, so a huge part of the kernel code is written in a platform-aware way (by the use ho pre-processor macro for example), the remaining part has to be architecture dependent either for performance issues or becau... |
69,857 | How can Linux run on different microprocessors? Is the Linux kernel being compiled at installation each time? | 2009/09/29 | [
"https://serverfault.com/questions/69857",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | Each compiled/installed kernel image is built for one specific microprocessor (or microprocessor family usually).
The source code is partly hardware-independent (= many drivers, schedulers, ...) and partly platform specific (= low-level interaction with hardware, ...), but the resulting binary is *always* specific for... | Usual steps to get linux working on particular platform:
* Download kernel sources
* Download specific platform patches (for example, for Atmel's AT91RM9200 ARM CPU)
* Apply official/non-official/your patches
* Download crosstool-ng or similar tool & build your crosscompiler/libraries
* Build your kernel
* Assembly/up... |
69,857 | How can Linux run on different microprocessors? Is the Linux kernel being compiled at installation each time? | 2009/09/29 | [
"https://serverfault.com/questions/69857",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | **Linux kernel is**, as each compiled program, **platform dependent**.
Kernel hackers are very skilled coders, so a huge part of the kernel code is written in a platform-aware way (by the use ho pre-processor macro for example), the remaining part has to be architecture dependent either for performance issues or becau... | Usual steps to get linux working on particular platform:
* Download kernel sources
* Download specific platform patches (for example, for Atmel's AT91RM9200 ARM CPU)
* Apply official/non-official/your patches
* Download crosstool-ng or similar tool & build your crosscompiler/libraries
* Build your kernel
* Assembly/up... |
178,251 | Do the laws of physics permit any chance for a [Type III civilization](https://en.wikipedia.org/wiki/Kardashev_scale) on the Kardashev scale to halt or even reverse the expansion of the universe, or bring the galaxies back closer together, assuming they had a few billion years to accomplish it? Would it have to be a Ty... | 2020/06/09 | [
"https://worldbuilding.stackexchange.com/questions/178251",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/66665/"
] | This is certainly a question that's been thought about a lot. [Hooper (2018)](https://arxiv.org/abs/1806.05203) suggested that a Type III civilization could quickly travel outwards from their home and build Dyson spheres around stars in other galaxy clusters. The ideal range is stars of $0.2M\_{\odot}<M<1M\_{\odot}$, a... | General relativity posits that the expansion of the universe is driven by a cosmological constant, a uniform distribution of energy everywhere in the universe; I have no idea how a civilization might attempt to influence this energy density, nor does anyone else. Dragging a few galaxies into mutual gravitational influe... |
30,520,893 | H-i, I want to display a force directed graph using in D3. I'm trying to model it with Neo4j.
The requirements are to decorate "Topics" and "Edges" with "Attachments". Topics and Edges display in the D3 graph. Attachments in a detail view of a Topic or Edge.
This is the conceptual model (Topics and Edges graphed in D... | 2015/05/29 | [
"https://Stackoverflow.com/questions/30520893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1483977/"
] | [UPDATED]
Original answer
===============
*For historical interest, and as a comparison to the final solution, below, here is my original answer.*
Since you cannot have a relationship connected directly to another relationship, you can reify `Edge` as a node. For example, here is a possible model:
```
(:Attachment)... | What about this kind of graph structure:
```
(topic_attachment_1)--(topic1)--(edge_attachment_1_2)--(topic2)--(topic_attachment_2)
| |
(topic3) topic(4)
```
Basically the idea is that attachments are modeled as no... |
31,597,523 | I am trying to find out what the safest way to store data for use when the user clicks on a button.
I know that you can store data in attributes(either the value attribute or a data- attribute) of the button tag like so:
```
<button type="button" value="1" data-value="1">Click me!</button>
```
But the problem with... | 2015/07/23 | [
"https://Stackoverflow.com/questions/31597523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/574923/"
] | The user can always manipulate data. Nothing stops an advanced user to access object properties or call a `jquery.data()` on their own.
Something you could do in vanilla js would be:
```js
var div = document.getElementById("test");
div.something = "hidden value";
div.addEventListener("click", function(... | If you are logging button clicks, the safest way to keep track is to save and validate on the server side.
For example, when you click a like button on Soundcloud, it makes an HTTP request to Soundcloud's server, records that you clicked the button, and marks it as a favorite. This way, if the same user clicks the but... |
31,597,523 | I am trying to find out what the safest way to store data for use when the user clicks on a button.
I know that you can store data in attributes(either the value attribute or a data- attribute) of the button tag like so:
```
<button type="button" value="1" data-value="1">Click me!</button>
```
But the problem with... | 2015/07/23 | [
"https://Stackoverflow.com/questions/31597523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/574923/"
] | Consider this function:
```
function setupPrivateData(element) {
var private = 1;
element.setPrivate = function ( d ) { private = d; }
element.getPrivate = function ( ) { return private; }
}
```
When called with some DOM element it will add two methods to it: `.setPrivate(val)` and `.getPrivate()`.
These are... | If you are logging button clicks, the safest way to keep track is to save and validate on the server side.
For example, when you click a like button on Soundcloud, it makes an HTTP request to Soundcloud's server, records that you clicked the button, and marks it as a favorite. This way, if the same user clicks the but... |
31,597,523 | I am trying to find out what the safest way to store data for use when the user clicks on a button.
I know that you can store data in attributes(either the value attribute or a data- attribute) of the button tag like so:
```
<button type="button" value="1" data-value="1">Click me!</button>
```
But the problem with... | 2015/07/23 | [
"https://Stackoverflow.com/questions/31597523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/574923/"
] | You can obfuscate your javascript but the only validation has to be done on your server. For example, I tried to get the weather from [theweathernetwork](http://www.theweathernetwork.com/). They have hidden their API call using multiple files and callbacks. In my opinion, it's just more challenging (funnier) if you wan... | If you are logging button clicks, the safest way to keep track is to save and validate on the server side.
For example, when you click a like button on Soundcloud, it makes an HTTP request to Soundcloud's server, records that you clicked the button, and marks it as a favorite. This way, if the same user clicks the but... |
31,597,523 | I am trying to find out what the safest way to store data for use when the user clicks on a button.
I know that you can store data in attributes(either the value attribute or a data- attribute) of the button tag like so:
```
<button type="button" value="1" data-value="1">Click me!</button>
```
But the problem with... | 2015/07/23 | [
"https://Stackoverflow.com/questions/31597523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/574923/"
] | The user can always manipulate data. Nothing stops an advanced user to access object properties or call a `jquery.data()` on their own.
Something you could do in vanilla js would be:
```js
var div = document.getElementById("test");
div.something = "hidden value";
div.addEventListener("click", function(... | This is a huge topic, and you have a lot to learn, far too much for a comment here. Anything "stored" in an attribute in the HTML source is absolutely not secure, it can be changed very very easily.
The most common way of dealing with this would be to use a cookie, but even with some effort these can be manipulated.
... |
31,597,523 | I am trying to find out what the safest way to store data for use when the user clicks on a button.
I know that you can store data in attributes(either the value attribute or a data- attribute) of the button tag like so:
```
<button type="button" value="1" data-value="1">Click me!</button>
```
But the problem with... | 2015/07/23 | [
"https://Stackoverflow.com/questions/31597523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/574923/"
] | Consider this function:
```
function setupPrivateData(element) {
var private = 1;
element.setPrivate = function ( d ) { private = d; }
element.getPrivate = function ( ) { return private; }
}
```
When called with some DOM element it will add two methods to it: `.setPrivate(val)` and `.getPrivate()`.
These are... | This is a huge topic, and you have a lot to learn, far too much for a comment here. Anything "stored" in an attribute in the HTML source is absolutely not secure, it can be changed very very easily.
The most common way of dealing with this would be to use a cookie, but even with some effort these can be manipulated.
... |
31,597,523 | I am trying to find out what the safest way to store data for use when the user clicks on a button.
I know that you can store data in attributes(either the value attribute or a data- attribute) of the button tag like so:
```
<button type="button" value="1" data-value="1">Click me!</button>
```
But the problem with... | 2015/07/23 | [
"https://Stackoverflow.com/questions/31597523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/574923/"
] | You can obfuscate your javascript but the only validation has to be done on your server. For example, I tried to get the weather from [theweathernetwork](http://www.theweathernetwork.com/). They have hidden their API call using multiple files and callbacks. In my opinion, it's just more challenging (funnier) if you wan... | This is a huge topic, and you have a lot to learn, far too much for a comment here. Anything "stored" in an attribute in the HTML source is absolutely not secure, it can be changed very very easily.
The most common way of dealing with this would be to use a cookie, but even with some effort these can be manipulated.
... |
31,597,523 | I am trying to find out what the safest way to store data for use when the user clicks on a button.
I know that you can store data in attributes(either the value attribute or a data- attribute) of the button tag like so:
```
<button type="button" value="1" data-value="1">Click me!</button>
```
But the problem with... | 2015/07/23 | [
"https://Stackoverflow.com/questions/31597523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/574923/"
] | Consider this function:
```
function setupPrivateData(element) {
var private = 1;
element.setPrivate = function ( d ) { private = d; }
element.getPrivate = function ( ) { return private; }
}
```
When called with some DOM element it will add two methods to it: `.setPrivate(val)` and `.getPrivate()`.
These are... | The user can always manipulate data. Nothing stops an advanced user to access object properties or call a `jquery.data()` on their own.
Something you could do in vanilla js would be:
```js
var div = document.getElementById("test");
div.something = "hidden value";
div.addEventListener("click", function(... |
31,597,523 | I am trying to find out what the safest way to store data for use when the user clicks on a button.
I know that you can store data in attributes(either the value attribute or a data- attribute) of the button tag like so:
```
<button type="button" value="1" data-value="1">Click me!</button>
```
But the problem with... | 2015/07/23 | [
"https://Stackoverflow.com/questions/31597523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/574923/"
] | Consider this function:
```
function setupPrivateData(element) {
var private = 1;
element.setPrivate = function ( d ) { private = d; }
element.getPrivate = function ( ) { return private; }
}
```
When called with some DOM element it will add two methods to it: `.setPrivate(val)` and `.getPrivate()`.
These are... | You can obfuscate your javascript but the only validation has to be done on your server. For example, I tried to get the weather from [theweathernetwork](http://www.theweathernetwork.com/). They have hidden their API call using multiple files and callbacks. In my opinion, it's just more challenging (funnier) if you wan... |
4,091,221 | Good evening, I was wondering how to prove easily this inequality:
\begin{equation}
py^{p-1}(x-y)\leq x^p-y^p\leq px^{p-1}(x-y)
\end{equation}
for all $x,y\geq0$ and $p\in[1,+\infty)$.
I tried to study both the functions $\frac{x^p-y^p}{y^{p-1}(x-y)}$ and $\frac{x^p-y^p}{x^{p-1}(x-y)}$, but I'm not getting anywhere. | 2021/04/06 | [
"https://math.stackexchange.com/questions/4091221",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/756026/"
] | For $x \geq y$ this follows immediately from MVT applied to the function $f(x)=x^{p}$ since $py^{p-1} \leq pt^{p-1} \leq px^{p-1}$ when $t \in [x,y]$. For $x<y$ just switch $x$ and $y$ and multiply the inequalities by $-1$. | A purely algebraic proof when $p$ is an integer, using high school algebra: we have the factorisation
$$x^p-y^p=(x-y)(\underbrace{x^{p-1}+x^{p-2}y+\dots+xy^{p-2}+y^{p-1})}\_{p\,\text{ terms}},$$
so that the second factor is $\le px^{p-1}\:$ and $\ge py^{p-1}\:$ if $\:0\le y\le x$. Multiplying by $x-y$ which is $\ge 0$ ... |
517,203 | I have done a small web development project using eclipse. It runs well when I try running it on browser with url `localhost:8080/myproject/home.html`. But if I want to access it on another machine (laptop, mobile, etc. using the same wifi) it is not possible; it is not able to connect.
After Googling for a while fou... | 2012/12/09 | [
"https://superuser.com/questions/517203",
"https://superuser.com",
"https://superuser.com/users/179181/"
] | Maybe you should bind your server to 0.0.0.0 not 127.0.0.1 | The local tomcat server running from eclipse binds to localhost (127.0.0.1) by default, which means *it will only accept requests at that address*.
When you try accessing it from the machine's IP address, it is rejected because the request is for 10.0.0.4, which the server is not bound to. This explains why you cannot... |
12,887,714 | I am trying to find some rates in a table using Regular Expressions that I am reading into a string from HTML. Here is an example:
```
<td>Euro</td>
<td class='rtRates'><a href='/graph/?from=USD&to=EUR'>0.772199</a></td>
<td class='rtRates'><a href='/graph/?from=EUR&to=USD'>1.295003</a></td>
```
I am trying ... | 2012/10/14 | [
"https://Stackoverflow.com/questions/12887714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1745719/"
] | You can use this expression for quick and dirty searches:
```
EUR'>([^<]*)<
```
This is not ideal, though: using an HTML or an XHTML parser is a much better solution, because it is much more powerful and robust than any regex-based solution. | To match just numbers, use positive lookarounds:
```
(?<=EUR'>)\\d+(?:\\.\\d*)?(?=<)
(?<=USD'>)\\d+(?:\\.\\d*)?(?=<)
``` |
12,887,714 | I am trying to find some rates in a table using Regular Expressions that I am reading into a string from HTML. Here is an example:
```
<td>Euro</td>
<td class='rtRates'><a href='/graph/?from=USD&to=EUR'>0.772199</a></td>
<td class='rtRates'><a href='/graph/?from=EUR&to=USD'>1.295003</a></td>
```
I am trying ... | 2012/10/14 | [
"https://Stackoverflow.com/questions/12887714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1745719/"
] | You can use this expression for quick and dirty searches:
```
EUR'>([^<]*)<
```
This is not ideal, though: using an HTML or an XHTML parser is a much better solution, because it is much more powerful and robust than any regex-based solution. | OK, not what you asked for, but I wanted to point out that when both sides of the string you are looking for are fixed like that, you can use the substring() and indexOf() methods which can often be simpler to debug:
```
public class substring_not_regex {
public static void main(String args[])
{
String te... |
10,235,150 | What i have is a array of items from my mySQL database and each item has a checkbox. i am trying to make it so when you click on the checkbox it will submit the information to the database for the item that got checked or unchecked. have i have it is unchecked = 1 and checked = 0. this is for where i want to display th... | 2012/04/19 | [
"https://Stackoverflow.com/questions/10235150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1007633/"
] | Would an Ajax solution like this work?
```
$('ch').click(function() {
//this is what goes into $_POST
var data = 'id='+ $(this).attr('name') +'&checked=' + $(this).is(':checked');
$.ajax({
//This would be the url that would handle updating the MySQL Record
url: my_mysql_handler.php,
... | You should try `document.getElementById('form1').submit()` in the `onchange` method of your checkbox |
67,867,978 | I'm trying to fetch field inside json data
Input json
```
{
"data": {
"file": [{
"id": "0001",
"name": "harsha"
},
{
"id": "0002",
"name": "manohar"
}
]
}
}
```
XSLT style sheet
```
<xsl:styl... | 2021/06/07 | [
"https://Stackoverflow.com/questions/67867978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15519638/"
] | The ".." looks wrong to me - why would you want the parent of the `array` element?
I would do this without conversion to/from XML. Something along the lines:
```
<xsl:variable name="input-as-map" select="parse-json($input)" as="map(*)"/>
<xsl:variable name="transformed-map" as="map(*)*">
<xsl:for-ea... | It is also not clear to me what you want, perhaps
```
<xsl:for-each select="$input-as-xml/map/map[@key = 'data']/array[@key='file']">
<map>
<string key="date">{.//string[@key='name']}</string>
</map>
</xsl:for-each>
```
gives you a value you can work with. |
684,688 | Let's say it again, *we all make mistakes*, and I have just made one.
A brief history: I was doing some stuff on a VPS (Debian) I'm renting, when I noticed some strange behaviour. Using the `netstat` command I saw an non-authorized connection through SSH. I didn't know what to do, so I decided to close his connection ... | 2015/04/22 | [
"https://serverfault.com/questions/684688",
"https://serverfault.com",
"https://serverfault.com/users/283111/"
] | There are several alternatives:
* See if they have IPMI / "KVM" / console access to the server which lets you control it as if you had a physical keyboard plugged into it.
* If they don't offer that, see if you can boot the VM to a recovery linux CD (some providers offer this) and then correct the firewall rules that ... | This is what human-staffed help lines are for. Call the service provider, and have one of their operators remove the rule for you. |
684,688 | Let's say it again, *we all make mistakes*, and I have just made one.
A brief history: I was doing some stuff on a VPS (Debian) I'm renting, when I noticed some strange behaviour. Using the `netstat` command I saw an non-authorized connection through SSH. I didn't know what to do, so I decided to close his connection ... | 2015/04/22 | [
"https://serverfault.com/questions/684688",
"https://serverfault.com",
"https://serverfault.com/users/283111/"
] | There are several alternatives:
* See if they have IPMI / "KVM" / console access to the server which lets you control it as if you had a physical keyboard plugged into it.
* If they don't offer that, see if you can boot the VM to a recovery linux CD (some providers offer this) and then correct the firewall rules that ... | A general way to fix a broken instance is to shut it down and attach the root volume to a working instance. You can then mount the volume there and view logs or edit configuration files. You can then detach the volume and start it up in its own instance. |
684,688 | Let's say it again, *we all make mistakes*, and I have just made one.
A brief history: I was doing some stuff on a VPS (Debian) I'm renting, when I noticed some strange behaviour. Using the `netstat` command I saw an non-authorized connection through SSH. I didn't know what to do, so I decided to close his connection ... | 2015/04/22 | [
"https://serverfault.com/questions/684688",
"https://serverfault.com",
"https://serverfault.com/users/283111/"
] | There are several alternatives:
* See if they have IPMI / "KVM" / console access to the server which lets you control it as if you had a physical keyboard plugged into it.
* If they don't offer that, see if you can boot the VM to a recovery linux CD (some providers offer this) and then correct the firewall rules that ... | Formal answer: go to VPS management panel, get local access (virtual KVM) somehow or call them.
Explanation of steps/rules to prevent falling for it again:
1. There are ip, routing and firewall rule changes that may go bad and block your access.
2. and it applies to dedicated network device configuration too, not to ... |
684,688 | Let's say it again, *we all make mistakes*, and I have just made one.
A brief history: I was doing some stuff on a VPS (Debian) I'm renting, when I noticed some strange behaviour. Using the `netstat` command I saw an non-authorized connection through SSH. I didn't know what to do, so I decided to close his connection ... | 2015/04/22 | [
"https://serverfault.com/questions/684688",
"https://serverfault.com",
"https://serverfault.com/users/283111/"
] | If you have not yet saved the IPtables rule, you can **reboot server on VPS** (if available) and the rule should disappear. | This is what human-staffed help lines are for. Call the service provider, and have one of their operators remove the rule for you. |
684,688 | Let's say it again, *we all make mistakes*, and I have just made one.
A brief history: I was doing some stuff on a VPS (Debian) I'm renting, when I noticed some strange behaviour. Using the `netstat` command I saw an non-authorized connection through SSH. I didn't know what to do, so I decided to close his connection ... | 2015/04/22 | [
"https://serverfault.com/questions/684688",
"https://serverfault.com",
"https://serverfault.com/users/283111/"
] | If you have not yet saved the IPtables rule, you can **reboot server on VPS** (if available) and the rule should disappear. | A general way to fix a broken instance is to shut it down and attach the root volume to a working instance. You can then mount the volume there and view logs or edit configuration files. You can then detach the volume and start it up in its own instance. |
684,688 | Let's say it again, *we all make mistakes*, and I have just made one.
A brief history: I was doing some stuff on a VPS (Debian) I'm renting, when I noticed some strange behaviour. Using the `netstat` command I saw an non-authorized connection through SSH. I didn't know what to do, so I decided to close his connection ... | 2015/04/22 | [
"https://serverfault.com/questions/684688",
"https://serverfault.com",
"https://serverfault.com/users/283111/"
] | If you have not yet saved the IPtables rule, you can **reboot server on VPS** (if available) and the rule should disappear. | Formal answer: go to VPS management panel, get local access (virtual KVM) somehow or call them.
Explanation of steps/rules to prevent falling for it again:
1. There are ip, routing and firewall rule changes that may go bad and block your access.
2. and it applies to dedicated network device configuration too, not to ... |
684,688 | Let's say it again, *we all make mistakes*, and I have just made one.
A brief history: I was doing some stuff on a VPS (Debian) I'm renting, when I noticed some strange behaviour. Using the `netstat` command I saw an non-authorized connection through SSH. I didn't know what to do, so I decided to close his connection ... | 2015/04/22 | [
"https://serverfault.com/questions/684688",
"https://serverfault.com",
"https://serverfault.com/users/283111/"
] | This is what human-staffed help lines are for. Call the service provider, and have one of their operators remove the rule for you. | A general way to fix a broken instance is to shut it down and attach the root volume to a working instance. You can then mount the volume there and view logs or edit configuration files. You can then detach the volume and start it up in its own instance. |
684,688 | Let's say it again, *we all make mistakes*, and I have just made one.
A brief history: I was doing some stuff on a VPS (Debian) I'm renting, when I noticed some strange behaviour. Using the `netstat` command I saw an non-authorized connection through SSH. I didn't know what to do, so I decided to close his connection ... | 2015/04/22 | [
"https://serverfault.com/questions/684688",
"https://serverfault.com",
"https://serverfault.com/users/283111/"
] | This is what human-staffed help lines are for. Call the service provider, and have one of their operators remove the rule for you. | Formal answer: go to VPS management panel, get local access (virtual KVM) somehow or call them.
Explanation of steps/rules to prevent falling for it again:
1. There are ip, routing and firewall rule changes that may go bad and block your access.
2. and it applies to dedicated network device configuration too, not to ... |
14,711,132 | >
> **Possible Duplicate:**
>
> [What is the difference between #include <filename> and #include “filename”?](https://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename)
>
>
>
What is the meaning of include "abc.h" and how it is different from include ? | 2013/02/05 | [
"https://Stackoverflow.com/questions/14711132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1888941/"
] | My interpretation of the question
=================================
I hope I understand your question correctly. Here is what I understood:
1. For each row you compute which 5% percentile it belongs to
2. Whenever that percentile changes, you start a new bucket
3. All rows from the same bucket result in a single resu... | I am not sure to understand but here an attempt. My idea is to group data by centiles than do calculation on each group using `by`
1. To group data I create a new variable split
```
##dat$split <- cut(dat$a,seq(0, 1, 0.05),include.lowest=T)
dat$split <- c(0,cumsum(diff(dat$a) > 0.05))
```
2. Using by, I can perform... |
196,134 | For example: Why is $\sqrt{\dfrac{1}{2}} = \dfrac{1}{2}\sqrt{2}$ ?
How do you solve (simple) roots of fractions? I'm having trouble because I need this for my upcoming trig test but I haven't done algebra in a long, long time.. | 2012/09/15 | [
"https://math.stackexchange.com/questions/196134",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/40365/"
] | There are three things to remember here:
1. $$\displaystyle\large\sqrt{\frac{a}{b}}=\frac{\sqrt{a}}{\sqrt{b}}$$
2. $$\displaystyle\large\frac{a}{b} = \frac{1}{b}\times a$$
3. It's convention to simplify fractions with a radical denominator by multiplying the fraction by the denominator.
$$\displaystyle\large\frac{a}{... | Start with $\sqrt{\dfrac{1}{2}}$
This is the same as ${\dfrac{\sqrt{1}}{\sqrt{2}}} = {\dfrac{{1}}{\sqrt{2}}}$
Now multiply both both the numerator and denominator of ${\dfrac{{1}}{\sqrt{2}}}$ by $\sqrt{2}$ to get:
${\dfrac{{\sqrt{2}}}{\sqrt{2}\sqrt{2}}} = {\dfrac{{\sqrt{2}}}{\sqrt{4}}} = {\dfrac{{\sqrt{2}}}... |
196,134 | For example: Why is $\sqrt{\dfrac{1}{2}} = \dfrac{1}{2}\sqrt{2}$ ?
How do you solve (simple) roots of fractions? I'm having trouble because I need this for my upcoming trig test but I haven't done algebra in a long, long time.. | 2012/09/15 | [
"https://math.stackexchange.com/questions/196134",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/40365/"
] | There are three things to remember here:
1. $$\displaystyle\large\sqrt{\frac{a}{b}}=\frac{\sqrt{a}}{\sqrt{b}}$$
2. $$\displaystyle\large\frac{a}{b} = \frac{1}{b}\times a$$
3. It's convention to simplify fractions with a radical denominator by multiplying the fraction by the denominator.
$$\displaystyle\large\frac{a}{... | In general, $\sqrt{\dfrac{a}{b}} = \dfrac{\sqrt{a}}{\sqrt{b}}$ if $a\ge0$ and $b>0$. But notice that, by multiplying both the numerator and denominator of the fraction by $\sqrt{b}$, we get
$$\dfrac{1}{\sqrt{b}} = \dfrac{\sqrt{b}}{\sqrt{b} \cdot \sqrt{b}} = \dfrac{1}{b}\sqrt{b}$$
and so
$$\sqrt{\dfrac{a}{b}} = \dfrac{1... |
53,831,530 | I am processing two mono wav files and I want to save them as stereo file.
Each mono is streamed and subscribed as follows.
The mono data can have different length.
I used zip operator to process pairs.
The problem is that I have to call:
```
fileWriter.stopRecord();
```
when processing both data is completed.
So I ... | 2018/12/18 | [
"https://Stackoverflow.com/questions/53831530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7599197/"
] | Every rule in CSS has a different default value. Many might have `none` or `auto` as default. Check [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference) for Reference. Search for 'Initial value'
### Example
<https://developer.mozilla.org/en-US/docs/Web/CSS/width>
Initial value: auto
### Edit
You can... | I encourage you to read about CSS specificity here in the docs:
[CSS Specificity: Mozilla Developers](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity) and check my answer down below.
There are several ways to overwrite CSS properties from external libraries.
**Case 1:** if you're using Bootstrap or Zur... |
19,317,962 | i want to get the value of textbox on the basis of its class and id. this what i have done but it is not working for me.
although i can set the value of textbox by doing this.Please help me out
```
<script>
....
var count=1;
var check=$(".AssVal,#"+count).val();
....
<script>
<input type="text" value="0" class="AssVal... | 2013/10/11 | [
"https://Stackoverflow.com/questions/19317962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2473612/"
] | Since an ID attribute is **unique**, you can just use the ID on it's own:
```
// Get value
var check=$("#"+count).val();
// Set value
$("#"+count).val(123);
```
But the problem with your selector is that jQuery is trying to find all `.AssVal` elements **and** all elements with `id=1` as a comma in a selector denotes... | **use class selector . is used for selecting classes and # for ID**
```
var testvalue = $(".AssVal").val()
```
or
```
var testvalue = $("#1").val() // try not using no's as id
``` |
19,317,962 | i want to get the value of textbox on the basis of its class and id. this what i have done but it is not working for me.
although i can set the value of textbox by doing this.Please help me out
```
<script>
....
var count=1;
var check=$(".AssVal,#"+count).val();
....
<script>
<input type="text" value="0" class="AssVal... | 2013/10/11 | [
"https://Stackoverflow.com/questions/19317962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2473612/"
] | Since an ID attribute is **unique**, you can just use the ID on it's own:
```
// Get value
var check=$("#"+count).val();
// Set value
$("#"+count).val(123);
```
But the problem with your selector is that jQuery is trying to find all `.AssVal` elements **and** all elements with `id=1` as a comma in a selector denotes... | Using jQuery, you can get the value simply by not passing any arguments to the `val()` function you've already used. This would look like:
`var myValue = $(".AssVal,#"+count).val();` |
19,317,962 | i want to get the value of textbox on the basis of its class and id. this what i have done but it is not working for me.
although i can set the value of textbox by doing this.Please help me out
```
<script>
....
var count=1;
var check=$(".AssVal,#"+count).val();
....
<script>
<input type="text" value="0" class="AssVal... | 2013/10/11 | [
"https://Stackoverflow.com/questions/19317962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2473612/"
] | Since an ID attribute is **unique**, you can just use the ID on it's own:
```
// Get value
var check=$("#"+count).val();
// Set value
$("#"+count).val(123);
```
But the problem with your selector is that jQuery is trying to find all `.AssVal` elements **and** all elements with `id=1` as a comma in a selector denotes... | You can set the value using class as below
```
$(".AssVal").val("123");
```
By ID as
```
$("#1").val("123");
```
For getting
```
alert($("#1").val());
alert($(".AssVal").val());
```
And for dynamic
```
alert($("#"+count).val());
``` |
68,896,535 | I'm new to Web Scraping. I would like to extract the values from the table into Pandas. The Table is an image, i.e one cannot right click and copy and paste the data by selecting it. How do i go about it? I'm unable to "identify" the table image and a simple `ctrl+f` of the console output seems to not return any of the... | 2021/08/23 | [
"https://Stackoverflow.com/questions/68896535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14473868/"
] | I don't think that exact function signature would be possible, because you're not allowed to return references to data owned by the current function, which it would be because the vec was passed by value. But you could do it if you can pass the vec by reference to the conversion function instead ([playground](https://p... | You almost got it, simply replace `into_iter` for `iter`:
```rust
let strings = vec![(String::from("Foo"), String::from("Bar"))]
let strings_refs: Vec<(&String, &String)> = strings.iter().map(|(a, b)| (a, b)).collect();
```
[Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=abe4a8c4... |
58,949,862 | I tried to get all the data from a table which rows were added dynamically. But on the controller, I only get only one row (the first row).
```html
<tbody>
<tr>
<td colspan="2"> <input type="text" placeholder="Enter Description" class="form-control" name="desc[]"> </td>
<td> <input type="number" placeholder="... | 2019/11/20 | [
"https://Stackoverflow.com/questions/58949862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5271534/"
] | You are overwriting array every time inside the loop.
```
$data2 = array(
'description' => $request->desc[$key],
'amount' => $request->txtAmt[$key]
);
```
You need to change as below:
```
$data2[] = array(
'description' => $request... | I already fixed this. Thanks
I just fixed the position of opening tag of
>
> form
>
>
>
and the closing
>
> /form
>
>
> |
20,709,549 | I want to block unwanted Bots from accessing sites on the server.
Can nginx drop / kill the connection right away when a certain Bot is detected?
```
if ($http_user_agent ~ (agent1|agent2) ) {
**KILL CONNECTION**;
}
```
Something like example above. | 2013/12/20 | [
"https://Stackoverflow.com/questions/20709549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2464723/"
] | Use return 444; [This non-standard status code of 444 causes nginx to simply close the connection without responding to it](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return).
```
if ($http_user_agent ~ (agent1|agent2) ) {
return 444;
}
```
* [Reference documentation](http://nginx.org/en/docs/htt... | Yes, it can. See the question below - this redirects based on an agent string, but you can really do whatever you want (error page or whatever).
[Nginx proxy or rewrite depending on user agent](https://stackoverflow.com/questions/10627596/nginx-proxy-or-rewrite-depending-on-user-agent)
However, please note - that a d... |
20,709,549 | I want to block unwanted Bots from accessing sites on the server.
Can nginx drop / kill the connection right away when a certain Bot is detected?
```
if ($http_user_agent ~ (agent1|agent2) ) {
**KILL CONNECTION**;
}
```
Something like example above. | 2013/12/20 | [
"https://Stackoverflow.com/questions/20709549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2464723/"
] | Yes, it can. See the question below - this redirects based on an agent string, but you can really do whatever you want (error page or whatever).
[Nginx proxy or rewrite depending on user agent](https://stackoverflow.com/questions/10627596/nginx-proxy-or-rewrite-depending-on-user-agent)
However, please note - that a d... | ```
server {
listen 8443 default ssl;
error_page 404 403 = 444; #disconnect if 404 or 403
root /srv/empty; #Empty forder
...
...
location /summary_report{
root /srv/www;
index index.html index.htm;
}
}
```
<https://127.0.0.1/> Disconnect.
<https://127.0.... |
20,709,549 | I want to block unwanted Bots from accessing sites on the server.
Can nginx drop / kill the connection right away when a certain Bot is detected?
```
if ($http_user_agent ~ (agent1|agent2) ) {
**KILL CONNECTION**;
}
```
Something like example above. | 2013/12/20 | [
"https://Stackoverflow.com/questions/20709549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2464723/"
] | Use return 444; [This non-standard status code of 444 causes nginx to simply close the connection without responding to it](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return).
```
if ($http_user_agent ~ (agent1|agent2) ) {
return 444;
}
```
* [Reference documentation](http://nginx.org/en/docs/htt... | ```
server {
listen 8443 default ssl;
error_page 404 403 = 444; #disconnect if 404 or 403
root /srv/empty; #Empty forder
...
...
location /summary_report{
root /srv/www;
index index.html index.htm;
}
}
```
<https://127.0.0.1/> Disconnect.
<https://127.0.... |
43,357,507 | I am trying to reduce the dimensionality of a very large matrix using PCA in Sklearn, but it produces a memory error (RAM required exceeds 128GB). I have already set copy=False and I'm using the less computationally expensive randomised PCA.
Is there a workaround? If not, what other dim reduction techniques could I u... | 2017/04/11 | [
"https://Stackoverflow.com/questions/43357507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4013781/"
] | In the end, I used TruncatedSVD instead of PCA, which is capable of handling large matrices without memory issues:
```
from sklearn import decomposition
n_comp = 250
svd = decomposition.TruncatedSVD(n_components=n_comp, algorithm='arpack')
svd.fit(train_features)
print(svd.explained_variance_ratio_.sum())
train_feat... | You Could use `IncrementalPCA` available in SK learn. `from sklearn.decomposition import IncrementalPCA`. Rest of the interface is same as `PCA`. You need to pass an extra argument `batch_size`, which needs to <= #components.
However, in case there is a need to apply a non linear version like `KernelPCA` there does n... |
43,357,507 | I am trying to reduce the dimensionality of a very large matrix using PCA in Sklearn, but it produces a memory error (RAM required exceeds 128GB). I have already set copy=False and I'm using the less computationally expensive randomised PCA.
Is there a workaround? If not, what other dim reduction techniques could I u... | 2017/04/11 | [
"https://Stackoverflow.com/questions/43357507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4013781/"
] | In the end, I used TruncatedSVD instead of PCA, which is capable of handling large matrices without memory issues:
```
from sklearn import decomposition
n_comp = 250
svd = decomposition.TruncatedSVD(n_components=n_comp, algorithm='arpack')
svd.fit(train_features)
print(svd.explained_variance_ratio_.sum())
train_feat... | ```
import numpy as np
from sklearn.datasets import fetch_openml
mnist = fetch_openml('mnist_784', version=1)
mnist.target = mnist.target.astype(np.uint8)
# Split data into training and test
X, y = mnist["data"], mnist["target"]
X_train, X_test, y_train, y_test = X[:60000], X[60000:], y[:60000], y[60000:]
del mnist
#... |
43,357,507 | I am trying to reduce the dimensionality of a very large matrix using PCA in Sklearn, but it produces a memory error (RAM required exceeds 128GB). I have already set copy=False and I'm using the less computationally expensive randomised PCA.
Is there a workaround? If not, what other dim reduction techniques could I u... | 2017/04/11 | [
"https://Stackoverflow.com/questions/43357507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4013781/"
] | You Could use `IncrementalPCA` available in SK learn. `from sklearn.decomposition import IncrementalPCA`. Rest of the interface is same as `PCA`. You need to pass an extra argument `batch_size`, which needs to <= #components.
However, in case there is a need to apply a non linear version like `KernelPCA` there does n... | ```
import numpy as np
from sklearn.datasets import fetch_openml
mnist = fetch_openml('mnist_784', version=1)
mnist.target = mnist.target.astype(np.uint8)
# Split data into training and test
X, y = mnist["data"], mnist["target"]
X_train, X_test, y_train, y_test = X[:60000], X[60000:], y[:60000], y[60000:]
del mnist
#... |
8,359,931 | 1. I have this bug in Obj-C that is caused because the program is trying to access a non-existing NSArray key.
2. Typically in my PHP programs I verify that a key exists before using it using array\_key\_exists(NEEDLE, HAYSTACK).
3. Is there an equivalent in Cocoa / Obj-C for these two functions, and if not, how would ... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8359931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/467453/"
] | In an NSArray, keys can only be integers. So you can simply check whether the index you are trying to access is less than the number of items in the array. You can check the number of items via the count method:
```
NSArray *array = ... some array ...
NSUInteger index = ... some index ...
if (index < [array count]) ... | You should probably look at the "Finding Objects in an Array" section of the [NSArray Class Reference](http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html).
`-indexOfObject:` or `-indexOfObjectIdenticalTo:` might be what you're looking for. |
8,359,931 | 1. I have this bug in Obj-C that is caused because the program is trying to access a non-existing NSArray key.
2. Typically in my PHP programs I verify that a key exists before using it using array\_key\_exists(NEEDLE, HAYSTACK).
3. Is there an equivalent in Cocoa / Obj-C for these two functions, and if not, how would ... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8359931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/467453/"
] | PHP “arrays” and Cocoa “arrays” are not the same thing.
In Cocoa, an “array” is a flat, ordered collection of values. Each value's position in the array is called its index. This is the same sense as a C “array”.
In PHP, an “array” is an associative array, mapping keys to values. Another term for this is *dictionary*... | You should probably look at the "Finding Objects in an Array" section of the [NSArray Class Reference](http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html).
`-indexOfObject:` or `-indexOfObjectIdenticalTo:` might be what you're looking for. |
8,359,931 | 1. I have this bug in Obj-C that is caused because the program is trying to access a non-existing NSArray key.
2. Typically in my PHP programs I verify that a key exists before using it using array\_key\_exists(NEEDLE, HAYSTACK).
3. Is there an equivalent in Cocoa / Obj-C for these two functions, and if not, how would ... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8359931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/467453/"
] | In php, array\_key\_exists is for "associative" arrays or hashes, or as Objective-C calls them "Dictionaries". So you should use:
>
> NSDictionary
> or
> NSMutableDictionary
>
>
>
So you could do something like this:
```
NSMutableDictionary *dItems = [NSMutableDictionary alloc] init] [[NSMutableDictionary allo... | You should probably look at the "Finding Objects in an Array" section of the [NSArray Class Reference](http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html).
`-indexOfObject:` or `-indexOfObjectIdenticalTo:` might be what you're looking for. |
8,359,931 | 1. I have this bug in Obj-C that is caused because the program is trying to access a non-existing NSArray key.
2. Typically in my PHP programs I verify that a key exists before using it using array\_key\_exists(NEEDLE, HAYSTACK).
3. Is there an equivalent in Cocoa / Obj-C for these two functions, and if not, how would ... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8359931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/467453/"
] | In an NSArray, keys can only be integers. So you can simply check whether the index you are trying to access is less than the number of items in the array. You can check the number of items via the count method:
```
NSArray *array = ... some array ...
NSUInteger index = ... some index ...
if (index < [array count]) ... | Have you tried
`- (BOOL)containsObject:(id)anObject`
More details [here](http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html#//apple_ref/occ/instm/NSArray/containsObject%3a) |
8,359,931 | 1. I have this bug in Obj-C that is caused because the program is trying to access a non-existing NSArray key.
2. Typically in my PHP programs I verify that a key exists before using it using array\_key\_exists(NEEDLE, HAYSTACK).
3. Is there an equivalent in Cocoa / Obj-C for these two functions, and if not, how would ... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8359931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/467453/"
] | In an NSArray, keys can only be integers. So you can simply check whether the index you are trying to access is less than the number of items in the array. You can check the number of items via the count method:
```
NSArray *array = ... some array ...
NSUInteger index = ... some index ...
if (index < [array count]) ... | PHP “arrays” and Cocoa “arrays” are not the same thing.
In Cocoa, an “array” is a flat, ordered collection of values. Each value's position in the array is called its index. This is the same sense as a C “array”.
In PHP, an “array” is an associative array, mapping keys to values. Another term for this is *dictionary*... |
8,359,931 | 1. I have this bug in Obj-C that is caused because the program is trying to access a non-existing NSArray key.
2. Typically in my PHP programs I verify that a key exists before using it using array\_key\_exists(NEEDLE, HAYSTACK).
3. Is there an equivalent in Cocoa / Obj-C for these two functions, and if not, how would ... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8359931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/467453/"
] | In an NSArray, keys can only be integers. So you can simply check whether the index you are trying to access is less than the number of items in the array. You can check the number of items via the count method:
```
NSArray *array = ... some array ...
NSUInteger index = ... some index ...
if (index < [array count]) ... | In php, array\_key\_exists is for "associative" arrays or hashes, or as Objective-C calls them "Dictionaries". So you should use:
>
> NSDictionary
> or
> NSMutableDictionary
>
>
>
So you could do something like this:
```
NSMutableDictionary *dItems = [NSMutableDictionary alloc] init] [[NSMutableDictionary allo... |
8,359,931 | 1. I have this bug in Obj-C that is caused because the program is trying to access a non-existing NSArray key.
2. Typically in my PHP programs I verify that a key exists before using it using array\_key\_exists(NEEDLE, HAYSTACK).
3. Is there an equivalent in Cocoa / Obj-C for these two functions, and if not, how would ... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8359931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/467453/"
] | PHP “arrays” and Cocoa “arrays” are not the same thing.
In Cocoa, an “array” is a flat, ordered collection of values. Each value's position in the array is called its index. This is the same sense as a C “array”.
In PHP, an “array” is an associative array, mapping keys to values. Another term for this is *dictionary*... | Have you tried
`- (BOOL)containsObject:(id)anObject`
More details [here](http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html#//apple_ref/occ/instm/NSArray/containsObject%3a) |
8,359,931 | 1. I have this bug in Obj-C that is caused because the program is trying to access a non-existing NSArray key.
2. Typically in my PHP programs I verify that a key exists before using it using array\_key\_exists(NEEDLE, HAYSTACK).
3. Is there an equivalent in Cocoa / Obj-C for these two functions, and if not, how would ... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8359931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/467453/"
] | In php, array\_key\_exists is for "associative" arrays or hashes, or as Objective-C calls them "Dictionaries". So you should use:
>
> NSDictionary
> or
> NSMutableDictionary
>
>
>
So you could do something like this:
```
NSMutableDictionary *dItems = [NSMutableDictionary alloc] init] [[NSMutableDictionary allo... | Have you tried
`- (BOOL)containsObject:(id)anObject`
More details [here](http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html#//apple_ref/occ/instm/NSArray/containsObject%3a) |
5,200,950 | I have serbian-english words in .rtf format and I need to extract it from this document and put them into some datastructure.
I know to work with databases but I don't know if it is suitable for this situation. For example i have italic words and don't know how to put this into database (maybe to put inside tags?). Is... | 2011/03/05 | [
"https://Stackoverflow.com/questions/5200950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/507018/"
] | Also I recommend you read this article: <http://eclipse.dzone.com/news/who-needs-online-ide>
It links and describes a lot of them, even more then those mentioned by others here.
edit: most of the ones describe in that article are dead.
Instead check out:
Full fledge IDEs:
* [ShiftEdit](http://shiftedit.net/)
* [Cl... | You missed...
* [jsbin.com](http://jsbin.com)
* [ideone.com](http://ideone.com)
* [codepad.org](http://codepad.org)
* [pastebin for PHP](http://codepad.viper-7.com/) (good for testing PHP 5.3) |
5,200,950 | I have serbian-english words in .rtf format and I need to extract it from this document and put them into some datastructure.
I know to work with databases but I don't know if it is suitable for this situation. For example i have italic words and don't know how to put this into database (maybe to put inside tags?). Is... | 2011/03/05 | [
"https://Stackoverflow.com/questions/5200950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/507018/"
] | You missed...
* [jsbin.com](http://jsbin.com)
* [ideone.com](http://ideone.com)
* [codepad.org](http://codepad.org)
* [pastebin for PHP](http://codepad.viper-7.com/) (good for testing PHP 5.3) | I've been working on one for a while that you might find interesting if you are looking for something you can install on your own server.
<http://abstractionbuilder.com>
It's free to use and it currently features some file management on your server, as well as real-time document editing with a nice preview. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.