qid int64 10 74.7M | question stringlengths 15 26.2k | date stringlengths 10 10 | metadata list | response_j stringlengths 27 28.1k | response_k stringlengths 23 26.8k |
|---|---|---|---|---|---|
418,651 | I want to redirect specific page to another page. This means that requests for any other page on foo.com will function like normal, but if bar.html is requested =, it redirects to bar.com/foo.html.
This is pretty much the same problem as here [Redirect specific url requests to local site](https://superuser.com/questio... | 2012/04/30 | [
"https://superuser.com/questions/418651",
"https://superuser.com",
"https://superuser.com/users/22902/"
] | What you're looking for is a proxy server that will rewrite the url. [Fiddler](http://www.fiddler2.com/fiddler2/) is the only one I can think of at the moment. | The simplest solution that does not even require server configuration, is to include the 'meta' HTML tag in the first page's header. And set the url attribute of the second page like so:
```
bar.html :
...
<head>
<meta http-equiv="Refresh" content="0;url=http://bar.com/foo.html" />
</head>
...
``` |
580,202 | I am currently looking to make my own collection, which would be just like a regular list, except that it would only hold 10 items. If an item was added when there were already 10 items in the list, then the first item would be removed before the new item was appended.
What I want to do is create a class that extends ... | 2009/02/24 | [
"https://Stackoverflow.com/questions/580202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68512/"
] | Your description of your requirement sounds like a [Circular Buffer](http://en.wikipedia.org/wiki/Circular_buffer).
I implemented my own - similar to [this implementation on CodePlex](http://circularbuffer.codeplex.com/releases/view/27751#DownloadId=69221) except that mine implements `IList<T>`.
Some of the other ans... | You could take a look at the C5 collection library. They have an ArrayList<T> that implements IList<T> and have a virtual Add method. The C5 collection library is an awesome collection of lists, queues, stacks etc... You can find the C5 library here:
<http://www.itu.dk/research/c5/> |
14,972,964 | I have a class Event and a subclass ServerEvent, however the Event class is only an interface for ServerEvent to extend/inherit from. When I run make an Event.o isn't generated and I get an error that it doesn't exist.
What's the right way to compile this interface and what to add in the makefile?
Also, the reason I h... | 2013/02/20 | [
"https://Stackoverflow.com/questions/14972964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2089851/"
] | 1. This is a concrete base class, it has data members so it is not an 'interface'. An 'interface' class refers to a class with no data member and all member functions are pure virtual in a sense.
2. You #include the .h in a .cpp file and compile that .cpp file (but I don't see why you are going to do that, you must #in... | As far as I know, you do not need the constructor. You need a virtual destructor, and any methods you need to implement need to be equal to 0 and virtual.
Look here: [How do you declare an interface in C++?](https://stackoverflow.com/questions/318064/how-do-you-declare-an-interface-in-c "How do you declare an interfa... |
356,528 | I've read all the questions with similar titles but I couldn't find an answer.
Suppose I'm rotating with my arms extended on a frictionless surface. I have angular momentum and energy:
\begin{equation}
L\_0=I\_0\ \omega\_0
\end{equation}
\begin{equation}
E\_0=\frac{1}{2}I\_0\ \omega\_0^{2}
\end{equation}
Where $I\_0... | 2017/09/10 | [
"https://physics.stackexchange.com/questions/356528",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/130091/"
] | You do work on your arms as you pull them in, thus your energy has increased. The correct conserved quantity is angular momentum, as you deduce. The amount of work done on your arms can either be computed directly (force times distance type approach) or by using the solution from angular momentum (final energy minus in... | ]You stand in a bus or train. You Don't hold any handle or grab bar. The train starts smoothly and accelerates. You accelerate too. Your velocity increases and so does your KE. What force did the work responsible for the change in your KE? Don't bother to include muscle forces. Same thing happens to your suitcase sitti... |
2,093,908 | I have the following array
```
[0] => Array
(
[id] => 229
[val] => 2
)
[3] => Array
(
[id] => 237
[val] => 1
)
[4] => Array
(
[id] => 238
[val] => 6
)
```
I need to sort this array according to the val values in the array, and do not know how ... | 2010/01/19 | [
"https://Stackoverflow.com/questions/2093908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/131637/"
] | [array\_multisort](http://www.php.net/array_multisort) can help with this, example 3 presents a similar problem and solution. | This would help - <http://www.informit.com/articles/article.aspx?p=341245&seqNum=7> |
22,419,467 | Having trouble testing out the legacy basic auth api...
I want to mature this into nodejs or php, for a blog interface, but I can't seem to get the cURL working properly.
I believe I am following their [docs](https://developer.bigcommerce.com/api/stores/v2/blog/posts)... but who knows.
```
curl --request POST \
... | 2014/03/15 | [
"https://Stackoverflow.com/questions/22419467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1842294/"
] | I believe you are doing this from windows and where single quote makes the problem. Change your `-d` values.
```
-d "{title\": \"title\", \"content\": \"content\"}"
```
Also add the `-v` parameter to see what is curl sending when you perform the request. | Try the same request with something like Advanced REST client (Chrome app)
<https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo>
If you are still getting the same error most likely it's a Bigcommerce API side issue.
 offers a great look at the numbers for the S&P.
[](https://i.stack.imgur.com/1C6rz.jpg)
You can enter a date as early as 1871 and any ending date you wish. The last 100 ... | First, your question is what a mathematician would call "ill-posed." Second, it doesn't matter unless it is for historical curiosity since you should be concerned with future returns rather than historical ones.
It is ill-posed because investments include land, where returns are locally determined rather than national... |
28,849,353 | Need help to put some jquery function inside if statement . I want to hide my div when data from database is empty . I've done like this , and nothing happened.
```
<?php if(empty($all_data)){ ?>
<script>
$(document).ready(function () {
... | 2015/03/04 | [
"https://Stackoverflow.com/questions/28849353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4258293/"
] | Nothing ever calls `hiding()`. So you conditionally *define* that function in PHP, but you never actually invoke it. If you want the contents of that function to execute in the `if` block then don't declare the `hiding()` function, just execute the code:
```
<?php if(empty($all_data)){
echo "<script>
... | Well,delete the `function hiding(){}`.It's better to do this with php,like
```
<?php if(!empty($all_data)){ ?>
<div class="table-wrapper">
<?php foreach($all_data->result() as $data){ ?>
<tr>
<td><?php echo $data->id_history;?></td... |
21,322,007 | I'm trying to write a shell script to parse values from grepped lines of a log:
```
<WhereIsTheCar - the car with id number 'Sys Generated. VARIABLESTRING 1111' is driving to: Canada>
<WhereIsTheCar - the car with id number 'Sys Generated. VARIABLESTRING 2222' is driving to: Mexico>
<WhereIsTheCar - no car could be... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21322007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/899166/"
] | Another possibility is just to use `BASH_REMATCH` in bash rather than `awk` or `sed`
```
BASH_REMATCH
An array variable whose members are assigned by the =~ binary
operator to the [[ conditional command. The element with index
0 is the portion of the string matching the enti... | awk would make it easier:
```
awk -F"('|driving to: |>)" '{printf "%s\n\t%s\n\n", NF==5?$4:"Not Found",$2;next}' file
```
test with your data:
```
kent$ cat f
<WhereIsTheCar - the car with id number 'Sys Generated. VARIABLESTRING 1111' is driving to: Canada>
<WhereIsTheCar - the car with id number 'Sys Generated. ... |
28,347,728 | I have implemented a single page application with `AngularJS`. The page consists of a content area in the middle and sections assembled around the center that show additional info and provide means to manipulate the center.

Each section (called `Sid... | 2015/02/05 | [
"https://Stackoverflow.com/questions/28347728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3955724/"
] | This is really interesting. Pub/Sub should be a right solution here.
You could add extra order to your project by using Angular services **as your MVC's model**, and update this model for each change. The issue here is that you should implement an observable pattern inside your service and register to them, in order ... | You can use
```
$rootScope.$emit('some:event') ;
```
because it goes upwards and rootscope ist the top level
use
```
var myListener = $rootScope.$on('some:event', function (event, data) { });
$scope.$on('$destroy', myListener);
```
to catch the event
Then you have a communication on the same level the rootscop... |
98,345 | Despite the fact that $\forall n, n^3 + 2n \equiv 0 \pmod 3$, I understand that $n^3 + 2n$ (considered as a polynomial with coefficients in $\mathbb Z/3\mathbb Z$) is *not* equal to the zero polynomial.
What is the value of defining polynomials in this (strange) way? What situations does it make things simpler?
I ask... | 2012/01/12 | [
"https://math.stackexchange.com/questions/98345",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | I’m astonished someone (namely, @Qiaochu Yuan) remembered about field extensions, but nobody did mention that field extensions **rely** on irreducible polynomials, defined in the sense discussed. Namely, the quotient ring $k[x]/\langle P(x)\rangle$, where $P$ is irreducible, is a field and gives an extension of $k$, no... | I would mean the opposite: since there is no injection $k[X\_1,\dots,X\_n]\to \operatorname{Func}(k^n,k)$, formal polynomials is something different than functions. |
19,806,452 | I have a problem with Android-x86 and VirtualBox.
I had never worked with Linux before, so I don't understand what's happening. After creating a new virtual machine and choosing "Install Android-x86", I get this:

My settings:
](https://i.stack.imgur.com/RVxou.png)
**Make Sure Graphics Controller: VBoxSVGA** |
24,173,837 | I'm basicallly following the guide on <https://github.com/amplab/shark/wiki/Running-Shark-Locally>. I downloaded scala I'm using ec2 amazon linux
my shark/shark-0.8.0/conf/shark-env.sh configuration file look like this
```
export SPARK_MEM=1g
export SHARK_MASTER_MEM=1g
export SCALA_HOME="/home/user2/scala/"
export HI... | 2014/06/11 | [
"https://Stackoverflow.com/questions/24173837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2773013/"
] | You can go:
```
std::string(clean, clean + 30);
```
It would be better if you store the string in an array (or a `#define`), then you can check its length programmatically, e.g.
```
char const raw[] = "text1\0\0text2\0\0\0text3\0more text";
std::string(raw, raw + sizeof raw - 1);
``` | This is the expected behavior. The "\0" is being understood as end of string. If you try to pritnf you raw variable with "%s" format you will get the same output - "text1". If you want the whole string this is what you should do:
```
const char * raw = "text1\\0\\0text2\\0\\0\\0text3\\0more text";
```
So, before pas... |
81,166 | I am traveling to New Jersey on the 4th of November, but unfortunately my air ticket is booked via JFK. There were no direct flights to EWR from where I live.
Which is the best possible way to travel to either Hoboken or Harrington Park on a student's budget? | 2016/10/21 | [
"https://travel.stackexchange.com/questions/81166",
"https://travel.stackexchange.com",
"https://travel.stackexchange.com/users/52778/"
] | While the train option outlined by mazeem is probably the best balance of time and cost for most people, there is a less expensive option for those who have more time. Namely, you can take the MTA subway from Jamaica to the World Trade Center (or from Howard Beach to Fulton Street), and then take the PATH to Hoboken. T... | [First go to Manhattan by the routes mentioned on this previous question](https://travel.stackexchange.com/questions/7623/getting-from-new-york-jfk-airport-to-manhattan-without-the-sneaky-airtrain-exit?rq=1). That way, no need to pay for the sky train. The total cost $2 or $3.
Then follow the advice of @phoog [above t... |
51,363,935 | I am trying to build an old project using Android studio but the process fails. The error message I get is this:
*Error:Failed to read native JSON data
Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $*
I get a more detailed error message in the Build tab:[![enter image description h... | 2018/07/16 | [
"https://Stackoverflow.com/questions/51363935",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4941288/"
] | Solution 1:
===========
Finally I solved my problem which is not related to the json lenient mode, something wrong with my POST response (there some other non json output before the json data).
Here is the response from JakeWharton regarding how to set Gson lenient mode:
make sure that you have:`compile 'com.google.... | An errore in Line 1 and Column 1 usually means that the JSON is not a real JSON. Maybe the Server is sending the JSON as HTML or something else or the format is not well readable (UTF-8 and ASCII are well supported, but other encoders may not). Try to print Server's response as byte[] and see which is the first char. |
13,841,880 | I am binding an `enum` to a property grid like this:
```
public enum myEnum
{
Ethernet,
Wireless,
Bluetooth
}
public class MyClass
{
public MyClass()
{
MyProperty = MyEnum.Wireless;
}
[DefaultValue(MyEnum.Wireless)]
public MyEnum MyProperty { get; set; }
}
public Form1()
{
... | 2012/12/12 | [
"https://Stackoverflow.com/questions/13841880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/705654/"
] | If your source data is not something entirely reliable, you may want to consider converting only the items that can actually be parsed, using `TryParse()` and `IsDefined()`.
Getting an array of myEnums from an array of strings can be performed by the following code:
```
myEnum [] myEnums = myArray
.Where(c => Enu... | Use `Enum.Parse` in the loop for each element in the array. |
20,916,339 | I am wanting to route the main site and exclude paths with digits in them (like the account id).
So for example, I want to constraint a url like domain.com/about\_us or domain.com/signup/plan/1
BUT exclude all paths that start with a integer, like domain.com/1234573/user/3 or domain.com/123456
I have the following co... | 2014/01/04 | [
"https://Stackoverflow.com/questions/20916339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1002361/"
] | Here is one way to do it:
* Convert it to `String`
* Take the substring without the first "digit"
* Convert it to `int`
---
**Code:**
```
public static void main(String[] args)
{
int x = 123456789;
String x_str = Integer.toString(x);
int new_x = Integer.parseInt(x_str.substring(1));
System.out.pr... | I think I remember the string-free version of this … although I totally agree with @Christian as how I would do it…
NOTE: as @Darren Gilroy pointed out, one must consider negatives and zero spocially, and my function fails to do so.
Of course `%` is a better solution also.
```
public static void main (String [] arg... |
27,612,165 | That seems too tricky for me since `ImmutableSet` instances are only built with `ImmutableSet.Builder` instances, which don't implement `Collection` so you can't just use `Collectors.toCollection(ImmutableSet::new)` or `Collectors.toCollection(ImmutableSet.Builder::new)`. | 2014/12/22 | [
"https://Stackoverflow.com/questions/27612165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1542343/"
] | This is built into guava now,
[ImmutableSet#toImmutableSet](https://google.github.io/guava/releases/22.0/api/docs/com/google/common/collect/ImmutableSet.html#toImmutableSet--)
Use like,
```
something.stream().collect(ImmutableSet.toImmutableSet())
``` | This is the closest that I found:
```
Set<String> set = list.stream().collect(ImmutableSet.Builder<String>::new, ImmutableSet.Builder<String>::add, (builder1, builder2) -> builder1.addAll(builder2.build())).build();
```
There is no method that takes append the elements of one builder into another builder, only an It... |
24,766 | Suppose we have 2 strategies :
* **strategy A** : every $N$ days, we short a call option with a time-to-maturity of $N$ days;
* **strategy B** : every day, we short $\frac{1}{N}$ of a call option with a time-to-maturity of $N$ days.
When would strategy B be considered better than strategy A ? | 2016/03/09 | [
"https://quant.stackexchange.com/questions/24766",
"https://quant.stackexchange.com",
"https://quant.stackexchange.com/users/19693/"
] | Draw a picture. For each scenario, there are obvious circumstances that the payoff for each would be better.
For the N day option, the payoff would be better if there was a slow gradual decline in price and a slow gradual increase over the same period, such that the final difference in the price of the underlying was... | Given the information provided in the question, expected value of A and B is the same. Simple example: consider this binomial model with stock paths on the left, and call option prices on the right.
[](https://i.stack.imgur.com/ZBMG1.png)
What you ca... |
1,587,496 | I'm writing an application to parse certain network packets. A packet field contains the protocol version number in an octet, so that 4 high bits are the 'major' and low 4 are the 'minor' version. Currently I am parsing them as follows, but am wondering if there is a prettier or more 'pythonic' way of doing it:
```
... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1587496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/180174/"
] | Well named functions are always a good way to hide ugliness and irrelevant complexity. This way the bit-fiddling is confined to small and easily proven correct functions while the higher level code can refer to the purpose of the fiddling.
```
def high_nibble(byte):
"""Get 4 high order bits from a byte."""
ret... | It would be neater to use literals instead of calling `int`. You can use binary literals or hex, for example:
```
major = (v & 0xf0) >> 4
minor = (v & 0x0f)
```
Binary literals only work for Python 2.6 or later and are of the form `0b11110000`. If you are using Python 2.6 or later then you might want to look at the ... |
46,882 | [Feeblemind](https://www.dndbeyond.com/spells/feeblemind) requires an Int save: on a fail, the target's Intelligence and Charisma are set to 1. This pretty much destroys any Int or Cha-based caster, but the fact that the latter have low Int (and are not proficient with Intelligence saving throws) makes them especially ... | 2014/08/28 | [
"https://rpg.stackexchange.com/questions/46882",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/15680/"
] | ### The 8th level spell [*mind blank*](https://www.dndbeyond.com/spells/mind-blank) grants outright immunity to the spell [*feeblemind*](https://www.dndbeyond.com/spells/feeblemind).
*Mind blank* says,
>
> Until the spell ends, one willing creature you touch is immune to psychic damage, any effect that would sense i... | Get a *headband of intellect*
-----------------------------
Magical items always require cooperation by your DM who controls access, but you are asking also for magical items that can help.
A [headband of intellect](https://www.dndbeyond.com/magic-items/4652-headband-of-intellect) will set your intelligence to 19, im... |
26,967,682 | I'm trying to make this persistant cart that lets you add products to cart without redirecting to a new page. It works perfectly, but the only problem is that it can not be closed when you click on the exit button in the corner. [Live version here by clicking on cart](http://eldeskin.com/products/gel-cleanser). Make su... | 2014/11/17 | [
"https://Stackoverflow.com/questions/26967682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/964012/"
] | The class `.cart-show` is adding to your `[X]` element later, so you should use event delegation:
```
$(document).ready(function() {
$('body').on('click', '.cart-show', function (e) {
$("#cart").hide();
});
});
``` | 1.) You should use event delegation,
2.) If you have id for element you should use id as selector
```
$(document).ready(function() {
$('body').on('click', '#exit', function () {
$("#cart").hide();
});
});
``` |
9,496 | Have a suite of web-drivers tests that run in chrome and IE 10, but will not run in IE 11.
The tests fail in IE-11 when clicking a button as the following action (a form popup) does not occur. I cannot repeat this manually and this only seems to happen in IE-11. No exceptions are thrown when finding the button or clic... | 2014/08/20 | [
"https://sqa.stackexchange.com/questions/9496",
"https://sqa.stackexchange.com",
"https://sqa.stackexchange.com/users/5216/"
] | For Selenium 3.0.1, I setup as follow and it works for IE 11.
```
InternetExplorerOptions caps = new InternetExplorerOptions();
caps.IgnoreZoomLevel = true;
caps.EnableNativeEvents = false;
caps.InitialBrowserUrl = "http://localhost";
caps.UnexpectedAlertBehavior = InternetExplorerUnexpectedAlertBehavior.Accept;
caps.... | Try next steps:
1. Open Display settings in Windows (right click on desktop, choose Display Settings)
2. Set option "Change the size of text, apps, and other items" to 100%.
After this steps, Click() method should work.
This solved my problem with Click() method. |
10,627,650 | I have 2 double quotes that need to be replaced by a single double quote.
I am using this method:
```
private static void ReplaceTextInFile(string originalFile, string outputFile, string searchTerm, string replaceTerm)
{
string tempLineValue;
using (FileStream inputStream = File.OpenRead(originalFile))
{
... | 2012/05/16 | [
"https://Stackoverflow.com/questions/10627650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/117700/"
] | I'd use `ReplaceTextInFile(file, file + "new", "\"\"", "\"");` | The function expects four `string`s. You pass two `string`s, and then an `int`, and then a `char`.
Adding two `char`s results in an `int`. You can't concatenate chars, it makes no sense as a `char` represents an *individual* character, so the result is an `int`.
The last one is a straight cast to `char` where a `str... |
1,361,468 | The expected number of coin flips to get one heads is $2$. What is wrong with this argument?
>
> There is a $1/2$ chance of getting $H$, $1/4$ chance of getting $TH$,
> $1/8$ chance of getting $TTH$, etc. so the expected value of flips is
>
>
> $$\frac{1}{2} + \frac{2}{4} + \frac{3}{8} + ...\approx \ ?$$
>
>
>... | 2015/07/15 | [
"https://math.stackexchange.com/questions/1361468",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/122489/"
] | you need to consider the event $A\_k$ ={Head shows up in the $k$ flip}
$$P(A\_k) = P(T(k-1 \text{times} ) H) = 2^{-k}$$
The expected value of $X = \sum\_k k \chi\_{A\_k}$ which thakes the value $k$ when $A\_k$ occurs is
\begin{align}\Bbb{E}[X] = \sum\_k k2^{-k} &= \frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \ldots & = ... | I think I get what you're trying to do, although the proof is much easier to show from a more direct definition.
The probability of having one coin flip result in heads is $1/2$. The probability of it taking two flips is $1/4$. In general the probability of it taking n flips is $2^{-n}$. So we automatically know you'l... |
3,918,612 | I have a menu coded in html here, but i need a dotted line to span between the Names and Prices, How would i go about doing that here? I'm kinda lost haha.
You can see it here.
<http://mystycs.com/menu/menuiframe.htm>
I know i can use css to do it, but how would i get to it span between those two.
Thanks =) | 2010/10/12 | [
"https://Stackoverflow.com/questions/3918612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/330396/"
] | ```
<style type="text/css">
.menugroup{
width:100%;
}
.itemlist{
list-style-type: none;
}
.separator{
margin: 5px;
width:50%;
border-bottom: 1px dotted #000
}
</style>
<div class="menugroup">
<ul class="itemlist">
<li>item name<span class="separator"></span>... | ```
<style>
table th, td{
border-bottom: 1px dotted #CCCCCC;
}
```
HTML code block:
```
<h3>Current House Trends</h3>
<table class="table" border="0">
<tbody>
<tr>
<th>Price</th>
<td>$500,000</td>
</tr>
<tr>
<th>Market</th>
<td>78</td>
```
If you want to put '-' in between you can add a... |
9,588,960 | I found this example of how to use ViewPager and it's pretty simple to follow along. Now I'm wondering, can the ViewPager can show multiple views at the same time? If I have 10 items in the PagerAdapter can I have it show views 1, 2, and 3 first then when you swipe it moves over to 2,3,4; then 3,4,5; etc... | 2012/03/06 | [
"https://Stackoverflow.com/questions/9588960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/862495/"
] | `Map` is an interface; `HashMap` is a particular implementation of that interface.
HashMap uses a collection of hashed key values to do its lookup. TreeMap will use a red-black tree as its underlying data store. | `HashMap` is an implementation of `Map`. [Map](http://docs.oracle.com/javase/6/docs/api/java/util/Map.html) is just an interface for any type of map. |
87,070 | Suppose a finite-dimensional Lie group $G$ is given. Does there exist a connected manifold $M$ and a Riemannian metric $g$, such that $G$ is the **full** isometry group of $(M,g)$?
For example if I try to do this for a connected $G$, then I often get a bigger group as the full isometry group, which includes e.g. the o... | 2012/01/30 | [
"https://mathoverflow.net/questions/87070",
"https://mathoverflow.net",
"https://mathoverflow.net/users/20999/"
] | The group $\mathbb R$ can be realized as full isometry group of $(\mathbb R\times\mathbb S^1 ,g)$.
Choose a generic periodic one parameter family of quadratic forms $h(t)$ on $\mathbb R^2$.
Consider metric $g(x,y)=h(y)$ on $\mathbb R\times\mathbb S^1$.
**Why:** Note that each fiber $\mathbb R\times u$ maps to it-self.... | Maybe this is the same as the idea of Anton, but I thought I post it anyway for its visualization.
I think something like this will have *full* isometry group $=\Bbb R$:
a periodically winding "rope" with a generic surface structure.
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/9Vv5n.png
In ... |
6,561,771 | I am trying to generate a key for encryption:
```
public static final String ENCYT_ALGORITHM = "AES/ECB/PKCS7Padding";
public static final String KEY_ALGORITHM = "PBEWITHSHA256AND256BITAES-CBC-BC" ;
//BENCYT_ALGORITHMSE64Encoder encod = new BENCYT_ALGORITHMSE64Encoder();
//BENCYT_ALGORITHMSE64Decoder decod = new BENCY... | 2011/07/03 | [
"https://Stackoverflow.com/questions/6561771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/594131/"
] | You have not installed the unlimited strength crypto files, (the default JDK install allows 128 bit keys as documented in <http://download.oracle.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#AppC>).
Download unlimited strength crypto package [here](https://cds.sun.com/is-bin/INTERSHOP.enfinity/W... | I can't see where `keyGenerator` is being called. If it is not called, then `secret` is not being initialized. That could be the cause of the root exception. (It is hard to tell, because you've left out the declaration of `secret`.) |
43,999,809 | When i add long text to my `TextView` in linear layout it takes up all the space, and other views get squeezed. I set `layout_width="0"` to every view but it did not help. I should also add that this layout is used in `RecyclerView`.
Here is my code:
```
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.wid... | 2017/05/16 | [
"https://Stackoverflow.com/questions/43999809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7988178/"
] | yes you can but it is recommended to use click event for clean code
if you dont use event and you can do this with
```
if(IsPostBack)
{
//do something
}
```
bu if you have multiple buttons you will add a condition for each button
```
if (IsPostBack)
{
string target = Request.Params["__EVENTTARGET"]... | page\_load is a part of page life cycle you cannot exclude its execution you can only add checking for IsPostBack
```
if(!IsPostBack)
{
//Add Your Page Load Code Here
}
``` |
67,050,552 | There is an empty space to the left of the image and I don't know the reason.
This is my HTML code for this section
```css
#features{
background-color: #f9f6f7;
}
.featuresimg{
width: 40%;
float: left;
}
```
```html
<section id="features">
<img class="featuresimg" src="https://via.placeholder.com/1920x1080.j... | 2021/04/11 | [
"https://Stackoverflow.com/questions/67050552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15584299/"
] | You could use a dictionary lookup:
```py
def evaluate(a: int, b: int, operation: str):
oper = {
"+": a+b, "-": a-b, "*": a*b, "/": a/b, "%": a%b, "//": a//b
}
return oper.get(operation)
```
With a few test runs:
```py
>>> evaluate(2, 5, "+")
7
>>> evaluate(2, 5, "-")
-3
>>> evaluate(2, 5, "*")
1... | Here is an option:
```
operator = input('Enter an operator: ')
operators = '+-**/'
if operator in operators:
executable = f'print(2{operator}3)'
exec(executable)
```
The program will ask for user input and then check if the input is in operators and if it is it will print out whatever result from using 2 a... |
68,664,807 | I am trying to learn Spring Cloud Config. So first I setup a Server, where I can fetch the properties using `http://localhost:9090/config/default/master/app.static.properties` on the browser. It has about 5 or 6 properties. I am trying to get just one for now.
I wrote my classes like:
```
package com.gcp.logicalprovi... | 2021/08/05 | [
"https://Stackoverflow.com/questions/68664807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1047226/"
] | Please note that Spring Cloud Config Server client will build the full path to your application's profile specific configuration for you. Therefore, you should only provide the base URL in `bootstrap.properties`. In your case this would be probable some like this:
```
spring.cloud.config.uri=http://localhost:9090/
``... | Yes, as suggested by Gregor Zurowski you can use Native profile and provide appropriate naming for the properties/yaml file containing the properties.
Note: the Spring Cloud Config Server should provide "spring.cloud.config.server.native.search-locations" if you are using native based profile. |
7,069,565 | Here is [a sample from Allegro5 tutorial:](http://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Events) (to see the original sample, follow the link, I've simplified it a bit for illustratory purposes.
```
#include <allegro5/allegro.h>
int main(int argc, char **argv)
{
ALLEGRO_DISPLAY *display = NULL;
ALLE... | 2011/08/15 | [
"https://Stackoverflow.com/questions/7069565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/469935/"
] | Disclaimer: I don't know Allegro.
Minimizing a window at the most basic level only involves work from the process that deals with the windows (the Window Manager), not the process itself.
Terminating a program, usually requires files to be closed or memory to be freed or something else that only the process itself can... | The biggest reason that you must handle it yourself via an event is that closing (destroying) a window invalidates the `ALLEGRO_DISPLAY *` pointer. The request to terminate the window comes from a different thread, so it would be unsafe to destroy it immediately. Allowing you to process it yourself on your own time is ... |
23,034,752 | I get the following error when pulling a image
```
docker pull ubuntu
Pulling repository ubuntu
c0fe63f9a4c1: Error pulling image (latest) from ubuntu, read tcp 162.159.253.251:443: connection reset by peer
e20bcab99567: Error pulling image (lucid) from ubuntu, unexpected EOF
f697cdc2ef19: Error pulling image (qua... | 2014/04/12 | [
"https://Stackoverflow.com/questions/23034752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/355634/"
] | How fast is your internet connection? I got the same error and believe it to be associated with a timeout because of slow internet. Multiple attempts worked... | Try running it as root. I am getting the same error when running the command as a non-privileged user. When I ran it as root, it worked fine.
```
sudo docker pull ubuntu
``` |
40,112,681 | When using Fetch to download a url from Teamcity I get a Fetch failed! error. But the download of the file actually works.
They have recently changed permissions of our Teamcity server so i've to use a username and password when obtaining the URL of the file to download. I'm just wondering if this is causing an issue... | 2016/10/18 | [
"https://Stackoverflow.com/questions/40112681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2413767/"
] | The format argument belongs in the `date` function, not in `strtotime`. And you need to eliminate the single quotes around `$traveltime`, or you'll just be evaluating the literal string '$traveltime'. Also, the `%` characters shouldn't be used in the format string. Those are used for `printf`, etc. and aren't required ... | Its show error because date function first parameter must date format
but you given strtotime function
for correct result please follow below code
```
$traveltime = "11:00 PM";
$contraveltime = date('H:i',strtotime($traveltime));
echo $contraveltime;
```
and out put will be like below code
```
23:00
```
now you... |
2,936 | Is it possible to test whether a token register is empty without expanding it? | 2010/09/09 | [
"https://tex.stackexchange.com/questions/2936",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/175/"
] | At time of writing the other TeX based answers on this page are flawed in that they hide a conditional `\ifx` inside a macro but still use `\else`/`\fi` at the "top" level. This will mean that things break unexpectedly when used inside other conditionals.
The LaTeX3 programming language expl3 contains a module for do... | Ulrich Diez regularly posts on `comp.text.tex` some code along the following lines (slightly modified by me for toks):
```
\newcommand\@ifempty@toks[1]{%
\ifcat\relax\detokenize\expandafter{\the#1}\relax
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
}
```
Or, without using e-TeX,
```
\n... |
126,739 | For some reason our office linux box is being assigned an ip address via dhcp and I don't know why. What is confusing to me is that when I check system-config-network it shows that my eth0 is setup to be a static ip address. And /etc/sysconfig/network-scripts/ifcfg-eth0 also shows it is setup to be a static ip, yet it ... | 2010/03/26 | [
"https://serverfault.com/questions/126739",
"https://serverfault.com",
"https://serverfault.com/users/38919/"
] | Here's a list of parameters that I would like to have you amend:
1. *BOOTPROTO=static*
2. Remove the NM\_Controlled parameter, or at least comment it out.
Execute 'service network restart' or '/etc/init.d/network restart' and it should work. Otherwise, you may have to reboot the system and check the relevant log files... | ```
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
#NM_CONTROLLED=no (delete)
NETMASK=255.255.255.0
IPADDR=10.42.1.50
GATEWAY=10.42.1.1
service network restart
chkconfig network on
chkconfig dhcpd off
``` |
9,448,145 | I guess there is problem with the relation of malloc and goto. Or, I guess there is some wastage of memory or corruption of memory happening out here. Hope, someone can point to me the exact error.
When I compile its not giving me any error, but, my senior is insisting that I have a mistake.
```
#define FINISH() goto ... | 2012/02/25 | [
"https://Stackoverflow.com/questions/9448145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/963182/"
] | Here are the problems I spotted in the code
* When `err != ERROR_SUCCESS` this function will leak memory. It will jump over the `free` call.
* You are storing the return of `malloc` into a 32 bit location. This is not a portable solution. On 64 bit platforms this will wreak havoc on your program as you'd be truncating... | Whatever you do, you are not compiling that code. It has a syntax error.
```
if(foo)
bar;;
else
baz
```
Check your build system. |
67,596,745 | This is the input I am using for logstash.
```
ItemId,AssetId,ItemName,Comment
11111,07,ABCDa,XYZa
11112,07,ABCDb,XYZb
11113,07,ABCDc,XYZc
11114,07,ABCDd,XYZd
11115,07,ABCDe,XYZe
11116,07,ABCDf,XYZf
11117,07,ABCDg,XYZg
Date,Time,Mill Sec,rows,columns
19-05-2020,13:03:46,534,2,2
19-05-2020,13:03:46,539,2,2
19-05-2020,1... | 2021/05/19 | [
"https://Stackoverflow.com/questions/67596745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15967440/"
] | You could do this using the file input and then read it line by line using grok to make sure it has the right amount of fields comma separated and ignore the header one
Your input will look like this:
```
input {
file {
path => "/path/to/my.csv"
start_position => beginning
}
}
```
This will read each l... | You should do this before the file gets to Logstash. There *are* ways to do it within Logstash, for example by using a `mutliline` code then doing exotic `grok` matches to remove the first N lines (or removing lines until a particular regex), then doing a `split` followed by a plain ol' `csv` filter. You need to be eve... |
32,122,794 | I'm just starting with Meteor. In an app which is to be localized, I want to set the document title.
I am following the [advice given by Bernát](https://stackoverflow.com/a/19010848/1927589)
In my barebones version, I have just 2 documents:
head.html
```
<head>
<meta charset="utf-8">
<title>{{localizedTitle}}</... | 2015/08/20 | [
"https://Stackoverflow.com/questions/32122794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1927589/"
] | Following Bernát's answer, your global helper should not be called in the head's `<title>` tag, but within the `<template>` tag of the template where you wish to have a given title. In Meteor, `<head>` does not count as a template, therefore you cannot use Spacebars notation in it: it will just be considered as simple ... | I think a more elegant solution is to make the title reactive and set it via a Session variable (other reactive data sources are of course also OK). Like that:
```
Template.body.onRendered(function() {
this.autorun(function() {
document.title = Session.get('documentTitle');
});
});
```
Now every time you set... |
24,928 | It is an age old question.
How can I ensure that the chocolate in a s'more is properly melted. Even when assembling them quickly the marshmallow just doesn't have enough heat to melt the chunk of chocolate.
Any solutions are welcome but I would especially like to know how to do it with no special tools- just a campfi... | 2012/07/09 | [
"https://cooking.stackexchange.com/questions/24928",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/2001/"
] | Microwave the chocolate **first** in a microwaveable bowl, *then* heat the 'mellows and the crackers, before putting it all together. It's what I call "indoor s'mores". | I think Hershey changed something in their recipe to keep chocolate from melting too quickly in the sun/heat. Back in 1970 the chocolates melted just fine in Girl Scouts. |
117,005 | Related: [If I cast Banishment on myself while in a demiplane, where exactly do I exit?](https://rpg.stackexchange.com/questions/116960/if-i-cast-banishment-on-myself-while-in-a-demiplane-where-exactly-do-i-exit)
If I am trapped in the extradimensional space of a [bag of holding](https://www.dndbeyond.com/magic-items/... | 2018/03/08 | [
"https://rpg.stackexchange.com/questions/117005",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/30877/"
] | Yes, Banishment will let you escape
===================================
Demiplanes are discussed in the DMG in the chapter on planes, under the “Other Planes” heading — a demiplane is absolutely a plane in its own right. And “extradimensional space” and “demiplane” mean the same thing, per that section (DMG, p. 68):
... | It works...
-----------
It doesn't matter if it is a demiplane or not. Spells do what they say. The spell *[banishment](https://www.dndbeyond.com/spells/banishment)* doesn't say you have to be on a plane or demiplane for it work, it just says:
>
> If the target is native to a different plane of existence that the on... |
46,939,059 | I have below scenario.
```
list1=['10/22/2017 10:00','10/22/2017 10:00','10/22/2017 10:00',
'10/22/2017 11:00','10/22/2017 11:00','10/22/2017 11:00',
'10/22/2017 12:00','10/22/2017 12:00','10/22/2017 12:00',
....
]
list2 = [1,2,5,4,5,3,3,5,6,......] #(list2 size will be equal to no. of uniq... | 2017/10/25 | [
"https://Stackoverflow.com/questions/46939059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6870043/"
] | My take using an OrderedDict:
```
>>> from collections import OrderedDict
>>> list1 = ['a', 'a', 'b', 'b', 'c', 'c']
>>> list2 = [1, 2, 3]
>>> dictionary = dict(zip(OrderedDict(zip(list1, list1)), list2))
>>> [dictionary[k] for k in list1]
[1, 1, 2, 2, 3, 3]
```
This has the advantage of keeping a dictionary of the ... | I did a quick attempt using the idea of a counter that increments when the next element is different from the previous (I'm assuming the list is in order).
It works for the values you put in, you'd need to double check on a full data set though:
```
list1=['10/22/2017 10:00','10/22/2017 10:00','10/22/2017 10:00',
... |
41,018,053 | for a single dimensional array normally I would use a for loop like the one below but I can't think of a way to do this that doesn't involve lots of loops.
```
for (int i = 0; i < myArray.length; ++i)
{
myArray[i] = rnd.Next(1, 500);
}
``` | 2016/12/07 | [
"https://Stackoverflow.com/questions/41018053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4151152/"
] | You can try *low level* [Buffer.BlockCopy](https://msdn.microsoft.com/en-us/library/system.buffer.blockcopy(v=vs.90).aspx) to conceal the loop(s):
```
// N-D array (whatever dimensions)
int[,,] array = new int[3, 5, 11];
Buffer.BlockCopy(
Enumerable
.Range(0, array.Length)
.Select(x => rand.Nex... | Use more than one loop:
```
for (int i = 0; i < myArray.Length; ++i)
{
for (int j = 0; j < myArray[i].Length; ++j)
{
myArray[i][j] = rand.Next(0, 500);
}
}
``` |
4,876,308 | I have various important variables that I need transfering from PHP to JS on the same page load. I am currently storing these variables in DOM element attributes and using jQuery to grab them out.
This works fine, although as some of the information is quite important I would rather this wasn't publicly visible in th... | 2011/02/02 | [
"https://Stackoverflow.com/questions/4876308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/516629/"
] | use an ajax request on page load. Here is a shell for jQuery:
```
$(function()
{
$.ajax("http://yoursite.com/phpscript.php",
{
method: "post",
dataType: "json",
success: function(data)
{
// do what you will with the data here
... | If the data is sensitive, there is no way to hand it over for client-side processing while keeping it secure. That simply isn't how the web works. Everything you hand over to the client must necessarily be readable by the client. You can use technologies like SSL to protect data from being intercepted, but the intended... |
20,089,470 | I have a basic Hibernate code,
I have set the property "hibernate.hbm2ddl.auto" as update still it is not auto-creating the table in the Database.
These are the required files:
employee.hbm.xml
```
<hibernate-mapping>
<class name="contacts.employee" table="contacts">
<meta attribute="class-description"></m... | 2013/11/20 | [
"https://Stackoverflow.com/questions/20089470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1787314/"
] | I had the same issue, but for me the solution was:
```
<property name="hibernate.hbm2ddl.auto">create-drop</property>
```
instead of
```
<property name="hibernate.hbm2ddl">create-drop</property>
``` | Adding this in *application.properties* works for me
```
spring.jpa.generate-ddl=true
``` |
104,790 | Did Rashi issue any halachic rulings? (Examples?) Or did he simply provide useful and succinct explanations, drawn from the Sources, for those studying Torah? | 2019/06/13 | [
"https://judaism.stackexchange.com/questions/104790",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/15154/"
] | This answer regards the Commentary of Rashi.
The Shem hagedolim writes:
>
> מצאתי בספר כתב יד ישן נושן וזה לשונו ראש לכל החיבירים שנתחברו דרך פירוש הם פירושי הרב רבינו שלמה בר יצחק. ואם רבו הלוחמים עליו, כלי סיימו עליו ותשובתו מתוך דבריו כולם נכוחים למבין, אין מעלתו ניכרת רק ליחידים כי במילה אחת יכלול לפעמים תירוצים... | This [Halachipedia article](https://www.halachipedia.com/index.php?title=Rashi) notes that there are two halacha seforim by Rashi: one ("**Sefer HaPardes**") was written by him and the other ("**Sefer Likutei Pardes**") was his halachik rulings compiled by his talmidim.
1) **Sefer HaPardes**
---------------------
([h... |
73,526,599 | I am building a system that recommends a book from a dataset based on what is best for the user. The problem is that not only 1 book is returned to me, but a lot of them come out. How can I solve?
The code is this:
```
from sklearn.neighbors._classification import KNeighborsClassifier
import pandas as pd
class Sugge... | 2022/08/29 | [
"https://Stackoverflow.com/questions/73526599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19865911/"
] | You have multiple lines in your dataframe, the [`.predict()`](https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html#sklearn.neighbors.KNeighborsClassifier.predict) function will run for every line of your dataset.
So `len(predictionDataframe) == len(dataframe)` | I solved. The solution was simpler than expected. I thank everyone for trying to help me.
The problem was that at the beginning when I do `def_init`, in the parameters I passed `book` instead of `insertedbook`.
It is the same when I create the dataframe |
949,425 | Find the number of integer solutions to the equation $x\_1 + x\_2 + x\_3 = 28$, where $ 3 \leq x\_1 \leq 9$, $0 \leq x\_2 \leq 8$, and $7 \leq x\_3 \leq 17$
I'm having problems with this question.
1) I first tried reducing the range of the variables to $ 0 \leq x\_1 \leq 6$,$0 \leq x\_2 \leq 8$ and $0 \leq x\_3 \le... | 2014/09/28 | [
"https://math.stackexchange.com/questions/949425",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/48907/"
] | The equation
$$x\_1 + x\_2 + x\_3 = 28$$
with the restrictions $3 \leq x\_1 \leq 9$, $0 \leq x\_2 \leq 8$, and $7 \leq x\_3 \leq 17$ is equivalent to the equation
$$y\_1 + y\_2 + y\_3 = 18$$
where $y\_1 = x\_1 - 3$, $y\_2 = x\_2$, and $y\_3 = x\_3 - 7$ with the restrictions $0 \leq y\_1 \leq 6$, $0 \leq y\_2 \leq ... | Break it down into 7 cases, starting with $x\_1'=0$ Then you only have one choice for the other two numbers, as they need to be maximal, so you have 1 choice. Each time $x\_1'$ goes up by 1, you get one more potential choice for $x\_2',x\_3'$, so you get $1+2+3+4+5+6+7=28$ possibilities |
19,867,389 | How can I combine $regex with $in in PyMongo?
I want to search for either `/*.heavy.*/` or `/*.metal.*/`.
I tried in python without success:
```
db.col.find({'music_description' : { '$in' : [ {'$regex':'/*.heavy.*/'} ]} })
```
The equivalent in Mongo shell is:
```
db.inventory.find( { music_description: { $in: [ ... | 2013/11/08 | [
"https://Stackoverflow.com/questions/19867389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1447885/"
] | Use python regular expressions.
```
import re
db.col.find({'music_description': {'$in': [ re.compile('.*heavy.*'), re.compile('.*metal.*')]}})
``` | Why even bother using an $in?
You're wasting processing by evaluating the field for each value within the list, and since each value is a regex it has its own performance considerations,
Depending on how long your query strings get, it might be prudent just to wrap them up in one regex and avoid the $in query all toget... |
14,650,411 | In my windows phone 8 app I need to have a few UserControl which all of them have same functions (only the header not the body). I am wondered if i can have some thing like interface so i can inherit from that? (i could do it in ios with UIViewController) | 2013/02/01 | [
"https://Stackoverflow.com/questions/14650411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/989027/"
] | If you're extending the same basic idea you may be best to look at creating a Custom Control and then adding what your body as Content inside it the control. You can then re-skin your custom control as you need in each case (and learn more about how controls work as a side-effect).
It's a bit more work than creating a... | ```
public abstract class MasterUserControl : UserControl
{
[...]
}
public class MyUserControl : MasterUserControl
{
}
```
Something like that? |
34,587,282 | I'm using VSTS as a build server, and while building I want to copy the bin folder contents to the root of the target, and also custom files from another folder to this target. [MSDN](https://msdn.microsoft.com/Library/vs/alm/Build/steps/build/publish-build-artifacts) suggests I use a minimatch pattern, but it's copyin... | 2016/01/04 | [
"https://Stackoverflow.com/questions/34587282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1661966/"
] | For those who would like to have a PowerShell script to use in your build server, here is a working (at least, on my build server ;)) sample:
```
param
(
[string] $buildConfiguration = "Debug",
[string] $outputFolder = $PSScriptRoot + "\[BuildOutput]\"
)
Write-Output "Copying all build output to folder '$outp... | Make artifacts of each file you want to copy. Then create a 'copy file' task of each file of these artifacts. Then it doesn't copy the source tree structure. |
26,880,914 | I tried to customize spinner as follows where image is a 9 patch image.
```
<Spinner
android:layout_width="fill_parent"
android:layout_height="50dp"
android:id="@+id/spinner"
android:textSize="20sp"
android:background="@drawable/image"
/>
```
The result is this: [Spinner screenshot](https://drive.google.com/file/d/... | 2014/11/12 | [
"https://Stackoverflow.com/questions/26880914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3459908/"
] | There is really nothing wrong in setting the spinner background directly as I have done. Of course you cannot have different "states" of the spinner then. The text was not visible because the 9 patch image was corrupted for some unknown reason. I recreated the image and I can see the text on the spinner now. One more t... | You need to set background of spinner as follows:
In your layout xml :
```
<Spinner
android:id="@+id/spinner1"
style="@style/spinner_style"
android:layout_width="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center_ver... |
17,244,745 | So I want to be able to hide all the options and then show only the ones that don't include `hello_` in their value. This includes `hello_bye`, `hello_hello` etc. Anything that starts with `hello_`
This is what I have so far:
```
jQuery(document).ready(function(){
jQuery("#metakeyselect > option").hide();
jQu... | 2013/06/21 | [
"https://Stackoverflow.com/questions/17244745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1555312/"
] | You can "hide" the ones whose value start with `hello_` using the [*attribute-starts-with* selector](https://stackoverflow.com/users/2464706/alex-morrise).
As [Alex](https://stackoverflow.com/users/2464706/alex-morrise) pointed out correctly, not all browsers let you hide option elements though (see also [How to hide... | You can use:
```
$(document).ready(function(){
var options = $('#metakeyselect > option');
var contains = "hello_";
options.each(function() {
if($(this).val().indexOf(contains) != -1){
$(this).remove();
}
});
});
```
OR
```
$(document).ready(function(){
$("#metakeyse... |
21,251,435 | let me start by saying that I have no idea how to formulate this question, I have spend the last two days looking for some ways to to the following.
I send some information encoded using base64 as follow....
Values are:
**Lóms Gruñes**
this values came from an input box
beacuse of that I do this
**$na... | 2014/01/21 | [
"https://Stackoverflow.com/questions/21251435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2293454/"
] | **In send\_message.php**
Put both messages in the same object. I don't know why you call it `price`, but try like this:
```
$message = array('message' => $message,
'extra' => $data
);
```
**In GCM.php**
```
$fields = array(
'registration_ids' => $registatoin_ids,
'data' => $message,
);
``... | you can write a JSON response that contain a multiple messages
and the you get the JSON in android , parse it and get your multiple Messages . |
4,172,336 | Old way
-------
When I used to load page asynchronously in projects that required the content to be indexed by search engines I used a really simple technique, that is
```
<a href="page.html" id="example">Page</a>
<script type="text/javascript">
$('#example').click(function(){
$.ajax({
url: 'a... | 2010/11/13 | [
"https://Stackoverflow.com/questions/4172336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/462707/"
] | The advantage is not really applicable for you, because you are using progressive enhancement. The new Google feature is for applications written entirely in Javascript, which therefore can't be read by the crawler. I don't think you need to do anything here. | The idea behind it is that Javascript users can bookmark pages too, I think. If you take a look at your 'old' method, it's just replacing content on the page; there is no way to copy the URL to show the page in current state to other people.
So, if you've implemented the new `#!` method, you have to make sure that the... |
3,911,060 | Is there a library function available in Haskell to compose a function with itself *n* times?
For example I have this function:
```
func :: a -> a
```
and I want to do this:
```
func . func . func . func . func . func , ...
```
(up to *n* times, where *n* is only known at runtime).
Note that the iterate functi... | 2010/10/12 | [
"https://Stackoverflow.com/questions/3911060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13271/"
] | The `iterate` solution is fine, or you might like this one: the composition of `n` copies of `f` is `foldr (.) id (replicate n f)`. | ```
\n -> appEndo . foldMap Endo . replicate n
``` |
10,557 | How do you require a password to be entered when restoring from sleep or screen saver? | 2009/07/22 | [
"https://superuser.com/questions/10557",
"https://superuser.com",
"https://superuser.com/users/1978/"
] | 1. Click the Apple icon at the top left of the screen on the menu bar.
2. Click "System Preferences...".
3. Click to Open "Security".
Check "Require password to wake this computer from sleep or screen saver" | System Preferences -> Security -> Check "Require password to take this computer from sleep or screen saver" |
63,207,664 | I'm trying to insert data to a collection I created in Atlas MongoDB. The data is following:
```js
[
{ id: 1, performer: 'John Doe', genre: 'Rock', price: 25, day: 1, image: '/img/uploads/1fsd324fsdg.jpg' },
{ id: 2, performer: 'Rebekah Parker', genre: 'R&B', price: 25, day: 1, image: '/img/uploads/2f342s4fsdg.jpg... | 2020/08/01 | [
"https://Stackoverflow.com/questions/63207664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13235849/"
] | This is reslved now, formatting was the problem. | It's better that you use MongoDB Compass and connect to it with a connection string:
1. click on the connection
2. click on the connection using mongodb compass
3. then get the compass downloaded from MongoDB according to required OS
4. but use connection string of connection to MongoDB application
Once you connect t... |
2,752 | Besides the initial time investment of downloading & learning how to use a new tool ... what are some more reasons for a rational not to switch to P2Pool?
(Some reasons to switch is a slightly higher payoff in P2Pool due to bonus donations, and the overall contribution to a more distributed Bitcoin network).
Is runni... | 2012/01/26 | [
"https://bitcoin.stackexchange.com/questions/2752",
"https://bitcoin.stackexchange.com",
"https://bitcoin.stackexchange.com/users/78/"
] | 1. Variance. Raw connection to p2pool will always have variance for a typical miner - if the pool is small there will be large pool-based variance, if it is large the share difficulty will be high and there will be large share-based variance.
2. Running a Bitcoin node is already nontrivial and going forward will become... | Time investment is not to be discounted so lightly. In addition to that, inertia and lack of awareness probably have a role. There's also the need for extra computer resources (ram mostly) to run the bitcoind and p2pool daemons. There's a bit of a higher variance as well, since the pool is relatively small.
If you do ... |
73,398,235 | I need to repeat the query if the field of the returned object has the value 'INPROGRESS' with a delay so as not to clog up the server.
If another field value is returned, the loop stops and I perform some action in `subscribe()` with its response.
My attempts so far have ended up with this code, where unfortunately t... | 2022/08/18 | [
"https://Stackoverflow.com/questions/73398235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18634016/"
] | with a recursie function, something like this should do the job:
```js
private myFunc(){
this.myRecursiveFunc(1).subscribe(response => console.log(response));
}
private myRecursiveFunc(id: number, response?:any):Observable<any>{
if(response && response.Status !== 'INPROGRESS'){
return of(response);
... | * **RxJS 6.x**
```
this.service.query(id: number).pipe(
repeatWhen(delay(1000)),
skipWhile((response) => response.Status === 'INPROGRESS'),
take(1),
).subscribe(...)
```
<https://stackblitz.com/edit/rxjs-cc1ekf>
* **RxJS 7.5.x**
```
this.service.query(id: number).pipe(
repeat({ delay: 1000 }),
skipWhile(... |
24,003,100 | [This link here](https://stackoverflow.com/a/21362171/1751090) lists model class and view class properties to change in order to prompt the user for **email** and password log in, rather than the default **username** and password required by Asp.NET Identity Authentication. However, it does not demonstrate how to remov... | 2014/06/02 | [
"https://Stackoverflow.com/questions/24003100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1751090/"
] | You have to set it to an anonymous function:
```
myList[i].onclick = (function() {
var currentI = i;
return function() {
getMyTitle(myTitle[currentI]);
}
})();
```
(taken from [here](https://stackoverflow.com/a/3495722/436282)) | You need to use:
```
window.onload = myPageIsReady;
```
instead of
```
window.onload = myPageIsReady();
```
The following is my solution, it creates one function getMyTitle and assigns it to onclick.
Here is an example link of the code: <http://jsfiddle.net/3Xg3s/6/>
```
window.onload = myPageIsReady;
function... |
5,846,562 | ```
string[] words = System.IO.File.ReadAllLines("word.txt");
var query = from word in words
where word.Length > "abe".Length && word.StartsWith("abe")
select word;
foreach (var w in query.AsParallel())
{
Console.WriteLine(w);
}
```
Basically the word.txt contains 170000 English words. Is ... | 2011/05/01 | [
"https://Stackoverflow.com/questions/5846562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1024089/"
] | If you need to do search once there is nothing better than linear search - array is perfectly fine for it.
If you need to perform repeated searches you can consider soring the array (n Log n) and search by any prefix will be fast (long n). Depending on type of search using dictionary of string lists indexed by prefix ... | If you search much often than you change a file with words. You can sort words in file every time you change list. After this you can use bisectional search. So you will have to make up to 20 comparisons to find any word witch match with your key and some additional comparisons of neighborhood. |
18,977,350 | In my project, there is a datagridview if there are no data and click on the UPDATE button, I should get error message. Here if I click directly on update button I am getting error message, but if I click on the datagridview ( even though there is no data in the datagridview ) and click on update, I am getting message ... | 2013/09/24 | [
"https://Stackoverflow.com/questions/18977350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1494174/"
] | You can create a private property:
```
@property (strong, nonatomic) NSString *searchedText;
```
and use it to check for equality:
```
-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)newText{
if(![self.searchedText isEqualToString:newText]){
self.searchedText = [[NSString alloc] ini... | I have the same issue, I solved it by creating a ivar... This worked for me because I reload my table after calling this and I reset `textDidClear = NO;` in my reloadTable method.
```
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
if (([searchText isEqualToString:@""]) && (textDi... |
8,970,213 | Previously i have used restful wcf webservices to get the data from server.But now i have to access PHP webservices.Using WCF restful webservices I used to get data as :
```
{
1,books, //0th index
2,toys, //1st index . . .
}
```
but wen i am getting data from php webservice it is coming as a single array sim... | 2012/01/23 | [
"https://Stackoverflow.com/questions/8970213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/948041/"
] | Have a look at the PhoneGap discussion group: <https://groups.google.com/forum/?fromgroups#!searchin/phonegap/navigator.network.connection.type/phonegap/oAggxryQzrw/hE8uhwN3ONgJ>
If you're using 1.6.0, you need to update res/xml/plugins.xml from
```
<plugin name="Network Status" value="org.apache.cordova.NetworkManag... | There is another change when going from pre 2.3.0 to post 2.3.0.
>
> Before Cordova 2.3.0, the Connection object existed at:
> navigator.network.connection.
>
>
> To match the spec, this was changed to navigator.connection in 2.3.0.
>
>
> navigator.network.connection still exists, but is now deprecated and
> wi... |
192,006 | I wish to set up a Kali Linux box on a cloud provider in order to perform same day penetration tests.
The issue I am having is finding a cloud provider such as AWS, Azure etc. for this.
For AWS they require an application to be filled for each penetration test which can take up to 2 days for a reply (which may be to ... | 2018/08/21 | [
"https://security.stackexchange.com/questions/192006",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/184738/"
] | Azure is fine with Pen Tests as long as their infrastructure is not unlawfully used to access or disrupt other systems on Azure (or without) which you cannot prove that you have the authorization to modify or access. Expect to provide a detailed specification of the kind of tests you wish to conduct including times whe... | If you google "remote server rental" you find many sites with less restrictive rules. Server hosting that is offshore often have very loose rules for the usage of the device. You'll just have to search pricing and the different rules/SLA agreements.
I guess this doesn't technically qualify as "cloud" in the sense of i... |
8,991 | Looking at the increasing [NoSQL](http://pt.wikipedia.org/wiki/NoSQL) movement and considering that databases like [MongoDB](http://www.mongodb.org/) offers a new perspective in flexible data storage for GIS. What is the best way to store lines and polygons in JSON documents to take advantage of [2d indexes](http://www... | 2011/04/26 | [
"https://gis.stackexchange.com/questions/8991",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/1315/"
] | [GeoJSON](http://geojson.org/) here are the [SPECs](http://geojson.org/geojson-spec.html).
Here's an example of a line and a polygon:
```js
{ "type": "FeatureCollection",
"features": [
{ "type": "Feature",
"geometry": {"type": "Point", "coordinates": [102.0, 0.5]},
"properties": {"prop0": "value0"}
... | This is simply not true,
*"to take advantage of spatial indexes in Mongo, you'd need a spatially indexed collection holding nothing but a record for each of the polygon's points, with an additional value for the record ID of your spatial record living in another collection, then use a bounding box query to get record... |
28,496,332 | I get this Error when i run
>
> ionic build android
>
>
>
Error screenshot

```
C:\Users\Ahmed\IonicProjects\first\firstIonicApp>ionic build android
Running command: "C:\Program Files\nodejs\node.exe" C:\Users\Ahmed\IonicProjects
\first\fi... | 2015/02/13 | [
"https://Stackoverflow.com/questions/28496332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2442918/"
] | based on this [link](https://blogs.oracle.com/rajeshthekkadath/entry/installing_ant_on_windows), you need to the perform the following:
1. Download and install [Ant](https://ant.apache.org/bindownload.cgi)
2. Set the ANT\_HOME environment variable to the location where Ant was installed (Right Click >> Properties >> ... | It looks like you dont have apache ant installed.go to: <http://ant.apache.org/> and installed apache ant then create a ANT\_HOME varriable in your system varriables and add your ant location to your PATH varriable |
249,468 | I'm looking at stdint.h and given that it has uint16\_t and uint\_fast16\_t, what is the use for uint\_least16\_t what might you want that couldn't be done equally well with one of the other two? | 2008/10/30 | [
"https://Stackoverflow.com/questions/249468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10471/"
] | Say you're working on a compiler with:
* `unsigned char` is 8 bits
* `unsigned short` is 32 bits
* `unsigned int` is 64 bits
And unsigned int is the 'fastest'. On that platform:
* `uint16_t` would *not* be available
* `uint_least16_t` would be a 32 bit value
* `uint_fast16_t` would be a 64 bit value
A bit arcane, b... | Ah, the link Patrick posted includes this "The typedef name uint\_leastN\_t designates an unsigned integer type with a width of at least N, such that no unsigned integer type with lesser size has at least the specified width."
So my current understanding is:
uint\_least16\_t the smallest thing that is capable of hold... |
58,818,833 | This is a typescript and html problem. Let me describe the situation.
There is a input box and a button. when I type in the input box it atomically shows the character by a paragraph which i typed in the input box. When I click the button a function `onClickAllow()` works. the function basically check a random value ne... | 2019/11/12 | [
"https://Stackoverflow.com/questions/58818833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12359788/"
] | *Component: typescript Templete: html*
```js
array = [];
status = '';
onClickButton(){
this.status = Math.random() > 0.5 ? 'negative' : 'positive';
this.array.push({name: 'name', type: this.status});
}
```
```html
<button (click)="onClickButton()">Button</button>
<div *ngFor="let item of array; let i = index">... | as far I understand you just want a color base of element position in the ngFor items list , this can be solve by get the index of each item and get color base of index.
*componnet*
```
public getColor(index :number) : string {
switch( index) {
case 0 : return "#f00"
case 1 : return "#0f0"
ca... |
5,166,094 | A lot of my pages have amll bits of jquery.
Im thinking of putting them into one external file with one `$(document).ready(function() {`
and everything in there.
is this a good/bad idea?
will each page be slower overall if there is more code to execute even if its not relevant to the page? i imagine each line of co... | 2011/03/02 | [
"https://Stackoverflow.com/questions/5166094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66975/"
] | >
> will each page be slower overall if there is more code to execute even if its not relvamnt to the page?
>
>
>
The external script file may have some overheads for loading, but if you use the script on any number of pages more than one, external is a good idea; it'll be cached and be instant.
>
> i imagine ea... | If you put all your bits of JS into one page - without calling them as functions- then, yes, they will get executed everytime you include them. It would be better to put the common functions into an external scripts and keep it there. This will increase your code reuse as well as speed up page load because your JS will... |
7,273,498 | This is my code:
```
$myDiv = $('<div>1</div>');
$myDiv.each(function () {
console.log(this.html());
});
```
It produces an error because `this` should be `$(this)`. But wait. Isn't `$myDiv` a jQuery object in the first place, so that `this` must also be a jQuery object. If so, why should I wrap `this` inside o... | 2011/09/01 | [
"https://Stackoverflow.com/questions/7273498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/707381/"
] | In that case `this` actually refers to the node.
```
$myDiv = $('<div>1</div>');
$myDiv.each(function () {
console.log(this.innerHTML);
});
// outputs 1
``` | According to the jquery documentation this is the expected behavior for the `$(selector).each()`
They even give you an example for the case where "you want to have the jQuery object instead of the regular DOM element": <http://api.jquery.com/each/#example-1> |
57,517,096 | Computer gives me wrong result when choosing the largest number of three given numbers.
I'm not sure if this is possible way to code this program. I'm new to C, but when we learned about Pascal in school, this is roughly how we made the program choose the largest number (by introducing another variable, in my case X).
... | 2019/08/15 | [
"https://Stackoverflow.com/questions/57517096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11881542/"
] | In C it is like in Pascal: the target of an assignment is on the left of the assignment operator ('=' in C, ':=' in Pascal) and the expression to assign is on the right.
Just swap both sides and it works. | Other comments and answers have indicated why the OPs posted code did not result in the correct answer.
The following direct approach is simple, quick, but does not scale well when there are a lot of numbers to choose from.
```
int max(int num1, int num2, int num3)
{
int X = num1;
if( num2 > X )
X = ... |
46,247 | I have view that uses url args: parent term id and term id/ids, so the url structure is like page/%/%
Title pattern for this view is: %1(%2)
However I have few pages with multi tids as second argument, so generated title is strange (very long). I am trying to change this title programmatically:
```
function bip_titl... | 2012/10/10 | [
"https://drupal.stackexchange.com/questions/46247",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/1178/"
] | I always use a [`hook_views_pre_view()`](http://drupalcontrib.org/api/drupal/contributions%21views%21docs%21views.api.php/function/hook_views_pre_view/7):
```
function mymodule_views_pre_view(&$view, &$display_id, &$args) {
if ($view->name == "foo" && $view->current_display == "bar") {
$view->display[$view->curr... | I would use [hook\_views\_pre\_render](http://api.drupal.org/api/views/views.api.php/function/hook_views_pre_render/7) and alter the views display title.
Refer to <http://drupal.org/node/438370> as well. |
29,316,735 | I am working with SQL Server 2008. I have a table which does not contain any unique columns; how to get alternate rows from it?
SQL Server table:
```
+-----+--------+
| id | name |
|-----+--------|
| 1 | abc |
| 2 | pqr |
| 2 | pqr |
| 3 | xyz |
| 4 | lmn |
| 5 | efg |
| 5 | efg ... | 2015/03/28 | [
"https://Stackoverflow.com/questions/29316735",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3682162/"
] | I'm taking student as a table name.
Here is my answer ->
1. **For Even Row Number** -
`> SELECT id from (SELECT rowno, id from student) where mod(rowno,2)=0`
2. **For Odd Row Number** -
`> SELECT id from (SELECT rowno, id from student) where mod(rowno,2)=1` | ```
declare @t table
(
id int,
name nvarchar(20)
)
insert into @t
Select 1, 'abc'
union all
Select 2, 'pqr'
union all
Select 2, 'pqr'
union all
Select 3, 'xyz'
union all
Select 4, 'lmn'
union all
Select 5, 'efg'
union all
Select 2, 'efg'
... |
22,179,645 | I am struggling to get an HTML5 video to play when arriving at the page via an AJAX request.
If you refresh the page, or land directly on the page, it works fine. But when navigating to the page via AJAX it does not play.
The code is:
```
<video id="video" autoplay="autoplay" loop="loop" muted="muted" poster="http:/... | 2014/03/04 | [
"https://Stackoverflow.com/questions/22179645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3380291/"
] | For anyone struggling with the same issue, I found that after the ajax call the video had the property 'paused: true' even thought autoplay was set and I was calling video.play() on 'loadeddata'.
The solution was to trigger video.play() when pause is detected. I also found that it worked smoother not having the 'auto... | Potentially it's a syntax error, because you seem to have some PHP leaking into the HTML in the form of `'; ?>` at the end of the `poster` and `src` attributes. |
65,302 | The title says it all - how can you tell what folder a report is in using SOQL? | 2015/02/04 | [
"https://salesforce.stackexchange.com/questions/65302",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/-1/"
] | The field OwnerID is actually the folder ID for the Report object. I don't think you can get the folder using relationships, but you can query for reports in a particular folder:
```
select Name from Report where OwnerId in (select ID from Folder where DeveloperName = 'FolderName')
``` | As of API 35, the [Report](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_report.htm) object has **FolderName** field.
>
> SELECT id, name, ownerId, folderName FROM Report
>
>
>
The `OwnerId` is the ID field from the **Folder** object, which is the Report Folder the report lives... |
57,215,858 | ```
#include <initializer_list>
struct Obj {
int i;
};
Obj a, b;
int main() {
for(Obj& obj : {a, b}) {
obj.i = 123;
}
}
```
This code does not compile because the values from the `initializer_list` `{a, b}` are taken as `const Obj&`, and cannot be bound to the non-const reference `obj`.
Is ... | 2019/07/26 | [
"https://Stackoverflow.com/questions/57215858",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4108376/"
] | It does not work because in `{a,b}` you are making a copy of `a` and `b`. One possible solution would be to make the loop variable a pointer, taking the addresses of `a` and `b`:
```
#include <initializer_list>
struct Obj {
int i;
};
Obj a, b;
int main() {
for(auto obj : {&a, &b}) {
obj->i = 123; ... | A wee bit ugly but you can do this, since C++17:
```
#define APPLY_TUPLE(func, t) std::apply( [](auto&&... e) { ( func(e), ...); }, (t))
static void f(Obj& x)
{
x.i = 123;
}
int main()
{
APPLY_TUPLE(f, std::tie(a, b));
}
```
It even would work if the objects are not all of the same type, by making `f` an ... |
4,583,292 | Reopening this question:
[Does there exist a positive, decreasing, twice differentiable convex function such that $\int\_1^{\infty}\frac{(f'(x))^2}{f(x)}dx=\infty$?](https://math.stackexchange.com/questions/4579990/does-there-exist-a-positive-decreasing-twice-differentiable-convex-function-su?noredirect=1#comment96464... | 2022/11/23 | [
"https://math.stackexchange.com/questions/4583292",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/89516/"
] | The idea of the following construction is to find functions $h$ such that the solution of the initial value problem
$$
f'(x) = -h(f(x)) \, , \, f(0) = 1
$$
is defined for all $x \ge 0$ and has the desired properties.
---
Let $h:(0, 1] \to \Bbb R$ be a function with the following properties:
1. $h$ is differentiable... | I don't see any mistakes in your reasoning. There is such $g$, but given required properties I doubt there is any nice expression of it from elementary functions.
Given that we want integral of $\sqrt{g(x)}$ to converge and integral of $g(x)$ to diverge, we need $g(x)$ to take large values (otherwise we would just hav... |
59,884,525 | After spending the whole day with that problem... i need help.
Node v12.14.1
mongoose v5.8.9
mongoDB v4.2.1
So everything is up to date.
I tried many ways, but this is how it should work:
```
model.updateOne({_id:model_id},{$pull: {videos: {_id:video_id},{multi:true})
```
but then i get
```
{ n: 1, nModified: 0,... | 2020/01/23 | [
"https://Stackoverflow.com/questions/59884525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9016853/"
] | I'm sure someone will have a pure `plotly` solution for you, but here is a work around where we make `ggplot` objects, then convert to `plotly`
```
library(plotly)
library(tidyverse)
set.seed(0)
x <- seq(from=0, to=9, by=1)
y1 <- rnorm(10)
y2 <- rnorm(10)
y3 <- rnorm(10)
y4 <- rnorm(10)
p1 <-
{ggplot(tibble(x, y1... | Set shareX and shareY = FALSE to preserve borders.
N.B. if you set shareX or shareY = TRUE also in the code provided by SEAnalyst you will see that some borders are not preserved as well. |
55,982 | The backstory: I've purchased a DVD via online download (from EZTakes.com). The files appear in this kind of directory tree:
```
DVD Name
+-- VIDEO_TS/
| +-- (various video files)
+-- cover/
| +-- (a couple of .jpgs of the DVD cover art)
+-- content.info
```
I'm trying (on a Mac using Disk Utility) to burn this ... | 2009/10/15 | [
"https://superuser.com/questions/55982",
"https://superuser.com",
"https://superuser.com/users/4997/"
] | In a technical sense, the VIDEO\_TS folder already contains the video data in DVD format. A Video DVD is the contents of this VIDEO\_TS folder burned onto a DVD+/-R disc in a hybrid ISO9660+UDF filesystem. As Steve Rowe has mentioned, Video DVDs use UDF v1.02.
See Doom9's [DVD Structure article](http://www.doom9.org/i... | The format of the disc for a DVD is [UDF](http://en.wikipedia.org/wiki/Universal_Disk_Format). When playing back a DVD on a computer, this is what is used to access the files. However, older consumer disc players don't use this structure to read the disc. Instead they use the alternate ISO-9660 file structure. Make sur... |
3,836,999 | Warning: I have no clue about how to work with XML.
I have a simple application whose only purpose is to persist ten properties about an object (a log, if you will). I wrote it rapidly and it writes the properties by appending them to a plain text file. Problem solved.
Now, I read that for simple applications like th... | 2010/10/01 | [
"https://Stackoverflow.com/questions/3836999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/104427/"
] | If I **really** had to do this, I'd structure the XML so that it took look entries as children of the root element, open the file, readbackwards until I was at the start of the closing tag for the root element, write the new elements, and then write the root element again.
Mostly though, I just wouldn't do it. XML is ... | It really depends on the language that you are using for writing your application, but most modern languages have a library, either in their base framework or as an external, called an XML parser.
It's a library used to read and write XML files. What is important to see is that XML is a very hierarchical data structur... |
11,582 | So we've all probably had this situation: you debug some problem, only to realize it was caused by a config change you made six months ago, and you can't remember why you did it. So you undo it and fix the problem, and now some other problem comes back. Oh yeah, NOW I remember! Then you fix it properly.
It's because y... | 2009/05/23 | [
"https://serverfault.com/questions/11582",
"https://serverfault.com",
"https://serverfault.com/users/1920/"
] | I have been at 4 or 5 companies now I don't really remember.
We all had this problem. None of us have solved it 100 percent, but at the company I am at now we have what I think is the best strategy to date.
Sharepoint/Wiki/Evernote/PINs
* Sharepoint
+ moan all you want...it has some very nice list features.
+ IP a... | If all you want to do is *track* changes and not manage the whole process (i.e., via Chef or Puppet), just `rsync` your `etc` directory (wherever that might be) into a local git repo.
```
for HOST in alpha bravo charlie delta ...; do
rsync -avz --exclude-from=exclusions -e ssh admin@$HOST:/opt/local/etc/ ./$HOST
... |
72,148,751 | Im trying to follow a larval tutorial and make a controller. This is what I have so far and it works for the guy in the video but mine says controller not found. I don't know what to do to fix it. Thank you!
**web.php file:**
```
Route::get('/', [PagesController::class, 'home']);
```
**PagesController.php file:**
... | 2022/05/07 | [
"https://Stackoverflow.com/questions/72148751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19057852/"
] | I think somethings it happens due to cache of routes you added before
```
php artisan optimize:clear
```
Command to clear all cache
And then check does this get('/') route is binded to home() method on conrtoller using
```
php artisan route:list
```
I hope its resolve your issue.. | why did you use this in PagesController.php :
`use App\Http\Controllers\PagesController;`
This is wrong. you must remove this line of code in PagesController.php |
58,709,724 | I have a table with several columns where some of them are arrays of the same length. I would like to unnest them to get a result with values from arrays in separate rows.
So having table like this one:
[](https://i.stack.imgur.com/zXvMd.png)
I would like to get to:... | 2019/11/05 | [
"https://Stackoverflow.com/questions/58709724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3249293/"
] | Below is for BigQuery Standard SQL
```
#standardSQL
SELECT id, a1, a2
FROM data, UNNEST(array_1) AS a1 WITH OFFSET
JOIN UNNEST(array_2) AS a2 WITH OFFSET
USING(OFFSET)
``` | You can use `with offset` and a `join`:
```
WITH data AS
(
SELECT 1001 as id, ['a', 'b', 'c'] as array_1, [1, 2, 3] as array_2
UNION ALL
SELECT 1002 as id, ['d', 'e', 'f', 'g'] as array_1, [4, 5, 6, 7] as array_2
UNION ALL
SELECT 1003 as id, ['h', 'i'] as array_1, [8, 9] as array_2
)
SELECT id, a1, a2
FROM d... |
12,138,433 | Let's suppose I have a C file with no external dependency, and only const data section. I would like to compile this file, and then get a binary blob I can load in another program, where the function would be used through a function pointer.
Let's take an example, here is a fictionnal binary module, f1.c
```
static c... | 2012/08/27 | [
"https://Stackoverflow.com/questions/12138433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11589/"
] | You should consider building a shared library (**.dll** for windows, or **.so** for linux).
Build the lib like this :
```
gcc -c -fPIC test.c
gcc -shared test.o -o libtest.so
```
If you want to load the library dynamically from your code, have a look at the functions **dlopen(3)** and **dlsym(3)**.
**Or** if you w... | Use a cast function pointer.
Here's an example:
```
#include <stdio.h>
int main()
{
unsigned char *dst, *src;
int len;
void (*f1)(unsigned char *, unsigned char *, int);
*(void **)(&f1) = 0x..........;
f1(src,dst,len);
return 0;
}
```
To do any more, you'd really need a linker and a dynamic... |
56,451,814 | I have some images containing single or multiple faces, but I want to select only one face if image have multiple faces inside. I used OpenCV python to detect face with haar-cascade which is do perfectly, but I cannot select specific face from images with multiple face detector. My code is as bellow:
```
cascPath = "P... | 2019/06/04 | [
"https://Stackoverflow.com/questions/56451814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10597829/"
] | When defining a variable of a specific type, this type has to be "known" to the compiler at this point.
If the types you want to use are all defined in the same file, just make sure that you define each type before you use it the first time for a variable/parameter definition.
If the types are defined in different fi... | You should add the header file of teacher to the other class.
If you have teacher.h file, the add the following line of code to your other class:
`#include "teacher.h"`
That should probably fix your problem.
You can read more about how you divide classes here: <https://www.learncpp.com/cpp-tutorial/89-class-code-an... |
66,376,670 | Git beginner here...
I use it with Visual Studio exclusively. I've made 18 commits since the last push to the remote server and commit number 5 has a large file in it that I did not intent to be in there. Because it is over 100MB, I cannot push to the remote server.
How do I edit that old commit and remove that file? | 2021/02/25 | [
"https://Stackoverflow.com/questions/66376670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8250234/"
] | If you can use the command-line git tool, it's easy. Assuming your remote tracking branch is `origin/master`:
`git rebase -i origin/master`
This will bring up an editor containing a list of your unpushed commits. Find the commit you want to edit, change the word `pick` to `edit`, save and exit.
You should see a mess... | Well, you can delete commit number 5 from commit history.
`git log` -to see the various commit, with their hash values
and use `git reset hash value`- to uncommit that from history and also remove form staging area and then you can delete that file and commit again |
18,481 | I have had a paper accepted for a conference this summer, which presents the preliminary results of my PhD research. However, I'd like to present my final results at another conference in the fall, the deadline for which is in a few weeks, and which requires a full paper submission. My question is: would it be unethica... | 2014/03/24 | [
"https://academia.stackexchange.com/questions/18481",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/13392/"
] | >
> "May I submit a paper to another conference that is essentially the same as a paper that is already published or accepted for publication?"
>
>
>
**NO** \*
>
> "May I substantially change the content of an accepted conference paper after peer review?"
>
>
>
**NO** \*
\* Unless it is disclosed to, and p... | To add to @ff524's absolutely correct answer, you can still submit to that second conference. All you need to do is cite your first paper, state that this paper only adds results A,B,C. It is possible that the modest additions to your first paper are enough to merit publication on their own; however you must be honest ... |
7,386,612 | I am having a Java application and a .NET application both residing in two different machines and need to design a communication layer between these two applications. Any inputs or ideas would be really helpful. Below mentioned is the nature of interaction between these two applications.
* Java applications sends larg... | 2011/09/12 | [
"https://Stackoverflow.com/questions/7386612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/939940/"
] | The easyest way .Net and Java can talk is using Web-Services - we have done in my company with much success (using apache's cxf and standard code on the .Net side).
But if latency and size are the main requirements, you should use Sockets - both platforms offer a pretty extensive socketing frameworks and it would giv... | We have had good experiences with providing web services with JAX-WS (part of standard runtime in Java 6). They explicitly list .NET compatibility as a goal and is well supported in IDE's.
The Endpoint.publish() mechanism allow for small, simple deployments. |
5,392,470 | I am using jquery templates on both the server-side and client-side. I'm using the jqtpl and express modules on Node.js for the server, and I have jquery and its template plugin for the client.
Wherever possible the client recieves JSON instead of html, and builds the template itself, using the HTML5 history api to ch... | 2011/03/22 | [
"https://Stackoverflow.com/questions/5392470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/671229/"
] | Given the way that XML serialization works, I do not believe the structure you are looking for will be possible from a straight Object -> XML structure as in your example you have more than one root node.
If you had something where there was a container node, then individual ImageData elements within them, or a single... | The structure you're showing is not valid XML because is containing more then one root node, so you can forget about XmlSerializer. If you want to handle easily with such a xml similar structures I suggest [Html Agility Pack](http://htmlagilitypack.codeplex.com/) |
18,735,462 | Is there an equivalent `min()` for the keys in an array?
Given the array:
```
$arr = array(300 => 'foo', 200 => 'bar');
```
How can I return the minimum key (`200`)?
Here's one approach, but I have to imagine there's an easier way.
```
function minKey($arr) {
$minKey = key($arr);
foreach ($arr as $k => $v... | 2013/09/11 | [
"https://Stackoverflow.com/questions/18735462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/834525/"
] | This also would be helpful for others,
```
<?php
//$arr = array(300 => 'foo', 200 => 'bar');
$arr = array("0"=>array('price'=>100),"1"=>array('price'=>50));
//here price = column name
echo minOfKey($arr, 'price');
function minOfKey($array, $key) {
if (!is_array($array) || count($array) == 0) return false;
$... | ```
$arr = array(
300 => 'foo', 200 => 'bar'
);
$arr2=array_search($arr , min($arr ));
echo $arr2;
``` |
9,699,292 | how to stop all running worker threads in an android application without stoping the main thread?
Any example for this? | 2012/03/14 | [
"https://Stackoverflow.com/questions/9699292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1268608/"
] | **in java, dont supply the method to stop thread.**
you can only `interrupt` thread, but the thread must in the state which can be interrupt, like `sleep`, `wait`, etc...
**or you can using some tricks to make the thread throw exception**, such as:
>
> 1.if the thread is connect the network, you want to stop threa... | There are **two ways** to do it.
**Make the threads interrupted**
```
Thread.interrupt()
```
Does it solve the problem? No it doesn't.The thread will only be interrupted only if they are in blocking/waiting state. Calling thread.interrupted doesn't stop a thread. Then how does it help? The code that you are trying... |
49,172,110 | When i create a new div on the same document body, lets say a stack of divs, i loose the references to the .ts funtions on the previous div, i've tryed to emulate this with a button, so i have the div with:
```
<div id="foo">
<button type="button" id="btn1" (click)="clickButton()">Click Me</button>
</div>
```
This w... | 2018/03/08 | [
"https://Stackoverflow.com/questions/49172110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5270397/"
] | without a stack trace and some code, a specific anser will be hard to find, so here is a general method for these things:
### Part 1 "what was running before":
recreate your old environment, by digging through the logs, reverting to a backup etc. then run:
```
lein deps :tree 2>&1 > old-lein-dependencies
```
the `... | So I could not compare the previous setup as it was on a machine that was wiped clean.
I found that an error had crept into one of the math formulas executed by the tool which basically called itself repeatedly resulting in the stack overflow error. |
52,628,185 | In my rails project I called 'bundle install' in the terminal to add a gem but received the following error message:
>
> Traceback (most recent call last):
> 3: from /Users/usr/.rvm/gems/ruby-2.5.1/bin/ruby\_executable\_hooks:24:in `<main>'
> 2: from /Users/usr/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in`e... | 2018/10/03 | [
"https://Stackoverflow.com/questions/52628185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7938133/"
] | Use DOMDocument to do that:
```
$dom = new DOMDocument;
$dom->loadHTML($yourstring);
$xp = new DOMXPath($dom);
foreach($xp->query('//text()') as $textNode) {
echo $textNode->nodeValue, PHP_EOL;
}
``` | There is an `strip_tags()` function that does it without further configurations
```
<?php
$input = '<html><head><title>Nice page</title></head><body>Hello World <a href=http://cyan.com title="un lien">Ceci est un lien</a><a>sdfaf</a><br /><a href=http://www.riven.com> Et ca aussi <img src=wrong.image title="et encore ... |
29,583,048 | Here is the exact error message:
```
Exception in thread "main" java.lang.NullPointerException
at Application.main(Application.java:22)
```
I've tried to fix it with what I know... what am I doing wrong?
My code:
```
public class Application {
private String guitarMaker;
public void setMaker(String maker) ... | 2015/04/11 | [
"https://Stackoverflow.com/questions/29583048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4778083/"
] | I did your layout and while explaining it will take some time, better a **[fiddle](https://jsfiddle.net/alvaromenendez/t8e01cou/1/)** so you can check it out.
And, as I need to input code, this is the simple css involved:
```
* {
box-sizing: border-box;
}
.container {
width:100%;
max-width:600px;
bord... | What might be a better solution, long term, would be to use the bootstrap framework (developed by twitter), which is very simple to use and has a lot of perks:
>
> Bootstrap includes a responsive, mobile first fluid grid system that appropriately scales up to 12 columns as the device or viewport size increases. It in... |
22,517,616 | I am trying to run this program with the command
./box2 5
```
/*
* box2.c
*
* Created on: Mar 19, 2014
* Author: Ian
*/
#include <stdio.h>
void printchars(char c, int n);
int main( int argc, char*argv)
{
int n = argv[1];
printchars('*', n);
return 0;
}
void printchars(char c, int n)
{
... | 2014/03/19 | [
"https://Stackoverflow.com/questions/22517616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3015970/"
] | This is wrong:
```
int main( int argc, char*argv)
```
since `argv` must be declared as a ptr-to-ptr-to-char. Likewise, this:
```
int n = argv[1];
```
can't work. You need something like
```
int main(int argc, char **argv)
...
int n = atoi(argv[1]);
``` | Change `int main( int argc, char*argv)` to `int main( int argc, char**argv)`. |
42,160,544 | ```
[09.02.2017 - 10:40:06][NOTICE] - Start looping through invoices from Teamleader..
[08.02.2017 - 10:24:26][NOTICE] - Start looping through invoices from Teamleader..
[08.02.2017 - 10:29:24][NOTICE] - Start looping through invoices from Teamleader..
```
This is the code for producing the above output:
```
var da... | 2017/02/10 | [
"https://Stackoverflow.com/questions/42160544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5501950/"
] | You can sort the array as you want with the sort function in which you can specify on which base it should be sorted:
Here an example that will fit your needs:
```js
var data = [
"[09.02.2017 - 10:40:06][NOTICE] - Start looping through invoices from Teamleader]",
"[08.02.2017 - 10:24:26][NOTICE] - Start looping thr... | You can use the function `sort()` on your array with a comparaison function to compare the date. I don't know what you are trying to compare but here is a simple example.
```
[/*...*/].sort(function(a, b){
//here a and b stand for your dates. you will need to adjuste your code to make it works since we have very... |
7,660,944 | I ran my website through a web tool that evaluates SEO weight of elements and in the report it says that certain parts, like Description and other meta tags are missing... Also as a thumbnail of my site it shows a default server page. At the same time it shows the list of other pages that are linked from index page.
... | 2011/10/05 | [
"https://Stackoverflow.com/questions/7660944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/434218/"
] | [`Date.toString();`](http://download.oracle.com/javase/1.4.2/docs/api/java/util/Date.html#toString%28%29) does **always** format your String that way. You should a SimpleDateFormat to format the `Date` object to the String you want.
The JavaDoc of the [`Date.toString();`](http://download.oracle.com/javase/1.4.2/docs/a... | Read below document :-
<http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html>
hope help u above link. |
73,641,045 | I am trying to find a string occurring before my grep result.
```
before = text1234
foo = 1234
bar = 1234
var = words
before = text2345
foo = 2345
bar = 2345
etc = 2345
var = words
```
I am using grep `grep -n var *` to get the results of var. But I am trying to find the first occurrence of `before` before the grep... | 2022/09/07 | [
"https://Stackoverflow.com/questions/73641045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19944265/"
] | One option using `awk` is to match `before =` at the start of the string and then store the line.
Then when you encounter `var =` at the start of the string, check if there is a stored value for `before =` and then print that value.
```
awk '
/^before =/ {b=$0; next}
/^var =/ && b {print b; b=""}
' file
```
Output
... | Another `awk` approach that works with shown example data:
```bash
awk '/^before /,/^var /{if ($1 == "before") print}' file
before = text1234
before = text2345
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.