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 |
|---|---|---|---|---|---|
20,709,711 | I have a play application that needs to upload files to S3. We are developing in scala and using the Java AWS SDK.
I'm having trouble trying to upload files, I keep getting 403 SignatureDoesNotMatch when using presigned urls. The url is being genereated using AWS Java SDK by the following code:
```
def generatePresig... | 2013/12/20 | [
"https://Stackoverflow.com/questions/20709711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1694832/"
] | I just encountered this problem using the NodeJs AWS SDK.
It was due to using credentials that were valid, *but without sufficient permissions.*
Changing to my admin key fixed this with no code changes! | If your access keys and secret keys are good but it is saying "SignatureDoesNotMAtch", check your secret key, it probably has any of some special charaters, e.g +/ - / \*
Go to aws and generate another access key, where the the secret key does not have those. Then try again :) |
9,935 | A big part of my daily job is developing software for use on machines with different versions of the same software, like `bash`, `find`, and `grep`. When encountering a feature which would be useful for example to simplify code, it is important to know whether this feature is available in the oldest installed tools. Fo... | 2011/03/23 | [
"https://unix.stackexchange.com/questions/9935",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/3645/"
] | On **Debian** and Debian-derived platforms such as **Ubuntu**:
```
sudo apt-get changelog coreutils > changelog.txt
```
provides the GNU Core Utilities' changelog all the way back to version `4.5.1-1`.
Not sure if there are similarly convenient solutions on other platforms. | Check the [coreutils NEWS](http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob_plain;f=NEWS;hb=HEAD) file from its [git repo](http://git.savannah.gnu.org/gitweb/?p=coreutils.git). |
18,125,785 | so i have a string that can look like this:
```
UPDATE 12.7543.81 ParmA="dk.asterix.org" [Denmark] (9.1) ParmB="de.asterix.org" [Germany] (1.0) Called=49xxxxxxx (GBH) Calling=45xxxxxxxx (LOA) Internal=0 State=2
UPDATE 12.7543.81 ParmB="de.asterix.org" [Germany] (1.0) ParmA="dk.asterix.org" [Denmark] (9.1) Called=49xx... | 2013/08/08 | [
"https://Stackoverflow.com/questions/18125785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2490998/"
] | Following code should work:
```
String s = "UPDATE 12.7543.81 ParmA=\"dk.asterix.org\" [Denmark] (9.1) ParmB=\"de.asterix.org\" [Germany] (1.0) Called=49xxxxxxx (GBH) Calling=45xxxxxxxx (LOA) Internal=0 State=2";
Pattern p = Pattern.compile("([^\\s]+)\\s+([^\\s]+)\\s+");
Pattern p1 = Pattern.compile("([^\\s]+)\\s*=\\s... | Don't use regex for this. You'll get far more maintainable code just by splitting and looping. |
12,234,545 | How do I maintain the $post value when a page is refreshed; In other words how do I refresh the page without losing the Post value | 2012/09/02 | [
"https://Stackoverflow.com/questions/12234545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1218638/"
] | You can't do this. POST variables may not be re-sent, if they are, the browser usually does this when the user refreshes the page.
The POST variable will never be re-set if the user clicks a link to another page instead of refreshing.
If `$post` is a normal variable, then it will never be saved.
If you need to save ... | You can use the same value that you got in the `POST` inside the form, this way, when you submit it - it'll stay there.
An little example:
```
<?php
$var = mysql_real_escape_string($_POST['var']);
?>
<form id="1" name="1" action="/" method="post">
<input type="text" value="<?php print $var;?>"/>
<input type="submit... |
48,180,098 | It's my understanding that the default behavior of Rails, when storing a session e.g. `session[:id] = 1`, is that it will save the id to a cookie, which will expire when the user closes the browser window. However, in my app, when I close (exit out) the browser and restart it, the browser still 'remembers' me as being ... | 2018/01/10 | [
"https://Stackoverflow.com/questions/48180098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2217750/"
] | You can use user defined function such as
```
def isprime(n):
if n < 2:
return False
for i in range(2,(n**0.5)+1):
if n % i == 0:
return False
return True
```
it will return boolean values. You can use this function for verifying prime factors.
OR
you can continuously divide the number by 2 first
... | First calculate the sqrt of your number as you've done.
```
number = 600851475143
number_sqrt = (number**0.5)+1
```
Then in your outermost loop only search for the prime numbers with a value less than the sqrt root of your number. You will not need any prime number greater than that. (You can infer any greater based... |
1,590,491 | Evaluate $\int \sin^{13}x\,dx$.
My solution so far:
$$\int\sin^{13}x\,dx=\int\sin x\sin^{12}x\,dx=\int\sin x(\sin^{2}x)^6\,dx$$
Let $t=\cos x$, then $dt=-\sin x\,dx$.
Now we have: $$\int\sin^{13}x\,dx=-\int(1-t^2)^6,\ dt$$.
How do I proceed from here? I need detailed answer. | 2015/12/27 | [
"https://math.stackexchange.com/questions/1590491",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/271941/"
] | An alternative approach is given by De Moivre's formula and the binomial theorem. Since
$$\begin{eqnarray\*} \sin^{13}(x) &=& -\frac{i}{2^{13}}\left(e^{ix}-e^{-ix}\right)^{13}\\&=&-\frac{i}{2^{13}}\left(2i\sin(13x)-26i\sin(11 x)+156i\sin(9x)-572i\sin(7x)+1430i\sin(5x)-2574i\sin(3x)+3432i\sin(x)\right)\end{eqnarray\*}$... | Apply Integral Reduction:$$\quad \int \:\sin ^n\left(x\right)dx=-\frac{\cos \left(x\right)\sin ^{n-1}\left(x\right)}{n}+\frac{n-1}{n}\int \sin ^{n-2}\left(x\right)dx$$
$$\color{red}{\int \sin ^{13}\left(x\right)dx=-\frac{\cos \left(x\right)\sin ^{12}\left(x\right)}{13}+\frac{12}{13}\int \sin ^{11}\left(x\right)dx}$$ |
21,869,969 | ```
class SuperClass{
static int x = 15;
public void setX(int x){
this.x = x;
}
public int getX(){
System.out.println(x);
return x;
}
}
public class StaticVariableExample {
/**
* @param args
*/
public static void ma... | 2014/02/19 | [
"https://Stackoverflow.com/questions/21869969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3326121/"
] | Static members (variables and methods ) are allowed to be accessed by objects.
`this` refers to the current object and hence using current object reference, java allows to access static variable. | Well, it's working specifically because the static field isn't `final`. If it were, then you couldn't assign anything to it again once it had been already assigned (as evidenced by `setX()`).
`this` always refers to the current object - and since `x` is in the current object, `this` knows where to reference it. |
22,196,141 | I have a string coming in as
```
FirstName LastLast (WorkerId)
```
so for example:
```
"Joe Thompson (234DerX)"
```
and i want to parse this out into this person object
```
class Person
{
public string Name; //Joe Thompson
public string WorkerId; //234DerX
}
```
what is the best way to parse... | 2014/03/05 | [
"https://Stackoverflow.com/questions/22196141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653/"
] | If you use regex, the following regex should do what you want:
```
@" *(?<name>.*) \((?<id>.*)\)"
```
The `Name` is stored in capturing group `name` and `WorkerId` is stored in capturing group `id`.
This assumes that worker ID is in the last pairs of parentheses.
The solution should work even if the name contains ... | If I understand correctly, then you can simply split the string on intervals, then take the last resulting string, trim it from brackets front and back and you will have the id.
As for the name, since you do not know exactly how many names there are, it will be harder if you want to put only some of them in the string... |
30,959,141 | The Android app I'm working on has a single MainActivity and each screen of the app is implemented as a Fragment. Each fragment is instantiated like this in the MainActivity as a private class variable:
```
public class MainActivity extends Activity implements MainStateListener {
private FragmentManager fm = getFr... | 2015/06/20 | [
"https://Stackoverflow.com/questions/30959141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3381843/"
] | I notice you're basically caching fragments due to code of:
```
public class MainActivity extends Activity implements MainStateListener {
private FragmentManager fm = getFragmentManager();
private BrowseFragment browseFragment = BrowseFragment.newInstance();
```
But implementing this may be tricky. Either you ... | What I think may be happening is that your activity's browseFragment may be different that the BrowseFragment that is being shown by the fragment manager (which seems to work fine as you said if you click a button in that fragment).
On rotation, the activity will create a NEW BrowseFragment instance for your browseFra... |
9,923,062 | I disabled the click event of image using unbind method. But I don't know how to recover the click event again.
Here is the code,
`<img src="testimg.jpg" id="sub_form">`
disabled the click event of above image using the code
```
$('#sub_form').unbind('click');
```
How do i recover the click event? I tried with th... | 2012/03/29 | [
"https://Stackoverflow.com/questions/9923062",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1101208/"
] | If you saved the handler, you can just invoke it again:
```
var handler = function() {
alert('click');
};
$('#sub_form').click(handler);
// disabling:
$('#sub_form').unbind('click', handler);
// reenabling:
$('#sub_form').click(handler);
```
If you don’t know what handlers that are bound, you can find and sav... | You can specify a `function reference` when calling `.unbind()`:
For instance:
```
function myHandler( event ) {
}
// bind the click handler
$('#sub_form').bind('click', myHandler);
// remove only this exact click handler
$('#sub_form').unbind('click', myHandler);
// bind it again
$('#sub_form').bind('click', myHa... |
1,659,296 | Prove $\sqrt{60}$ is irrational. I'm trying to base this off a proof that $\sqrt{6}$ is irrational, which I found [here](http://mathcentral.uregina.ca/QQ/database/QQ.09.06/sylvia1.html).
I followed the exact same steps and ended up with $c^2$ = $15b^2$. This was at the point where the example had $2c^2$ = $3b^2$, but ... | 2016/02/17 | [
"https://math.stackexchange.com/questions/1659296",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/307092/"
] | $\sqrt{60}=2\sqrt{15}$, so we just need to prove $\sqrt 15$ is irrational. Suppose not; $\sqrt{15}=a/b$. Then $15b^2=a^2$. But the factor $3$ appears an odd number of times on the left and must appear an even number of times on the right (the same is true of $5$), so this equality is impossible. | Just a more tricky strategy using [Continued Fractions](https://en.wikipedia.org/wiki/Continued_fraction):
it is not hard to show that a real number is rational iff it has a continued fraction representation which has all $0$'s starting from a certain point like this: $[a\_0;a\_1,\cdots a\_n,0,0,0,\cdots]$ with $a\_0 ... |
34,197,669 | I have no idea what I am doing. I thought I had everything going well with html, then I had to add some simple javascript.
I am just trying to change the background color when the user clicks a button.
This is what I have so far:
CSS
```
body {
background-color:grey;
}
```
Javascript
```
function changeBackg... | 2015/12/10 | [
"https://Stackoverflow.com/questions/34197669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5663236/"
] | Your `if` clause is wrong (you are assigning instead of testing the background color):
```
function changeBackground() {
if (document.body.style.backgroundColor == 'grey'){
document.body.style.backgroundColor = 'black';
} else {
document.body.style.backgroundColor = 'grey';
}
}
``` | Try:
```
$("button").click(function(){
$("body").css("background-color", "blue");
});
``` |
65,886,635 | I'm new to NoSQL and I'm trying to figure out the best way to model my database. I'll be using ArangoDB in the project but I think this question also stands if using MongoDB.
The database will store 12 categories of products. Each category is expected to hold hundreds or thousands of products. Products will also be ad... | 2021/01/25 | [
"https://Stackoverflow.com/questions/65886635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14781777/"
] | As you mentioned, you need to play with your data and use-case. You will have better picture.
Some decisions required as below.
1. Decide the number of documents you will have in near future. If you will have 1m documents in an year, then try with at least 3m data
2. Decide the number of indices required.
3. Decide t... | To SQL or to NoSQL?
===================
I think that before you implement this in NoSQL, you should ask yourself why you are doing that. I quite like NoSQL but some data is definitely a better fit to that model than others.
The data you are describing is a classic case for a relational SQL DB. That's fine if it's a h... |
16,585,528 | After upgrading to Android ADT version 22 and cleaning my project, the R.java files went missing. I can't use setViewContent(R.layout.activity\_main) because the activity cannot reference to the xml layout (due to the missing R.java). Also, when using the (ctrl + space) to get suggestions for setContentView, the code i... | 2013/05/16 | [
"https://Stackoverflow.com/questions/16585528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2371061/"
] | I had the same problem just solved it.
check:[Java/Eclipse - No more R file ever](https://stackoverflow.com/questions/16584015/java-eclipse-no-more-r-file-ever/16584243#16584243)
More info:<https://groups.google.com/forum/?fromgroups=#!topic/android-developers/rCaeT3qckoE%5B1-25-false%5D> | The solution for this is, open "Android SDK Manager". Download "Android SDK build tools". Then for safety, restart your eclipse. That's it. Back to normal. All apps start building. |
18,500,811 | How to do this in Scala way: return the first element as `Some[String]` from `Option[Seq[String]]`, if it's `Some[Seq[String]]` and has least one string, otherwise return `None` | 2013/08/29 | [
"https://Stackoverflow.com/questions/18500811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1138245/"
] | `headOption` does what you want on the `Seq`, and `flatMap` on the `Option` can do the rest:
```
def first[A](maybe: Option[Seq[A]]): Option[A] = maybe.flatMap(_.headOption)
```
This is essentially the same as the following, but more concise and idiomatic:
```
def first[A](maybe: Option[Seq[A]]): Option[A] = maybe ... | ```
def getHead(strings: Option[Seq[String]]): Option[String] = {
strings.collectFirst {
case seq if seq.nonEmpty => seq.head
}
}
``` |
1,203,237 | Here's an example:
```
from django import forms
class ArticleForm(forms.Form):
title = forms.CharField()
pub_date = forms.DateField()
from django.forms.formsets import formset_factory
ArticleFormSet = formset_factory(ArticleForm)
formset = ArticleFormSet(initial=my_data)
```
So 'my\_data' in the example ... | 2009/07/29 | [
"https://Stackoverflow.com/questions/1203237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13009/"
] | ASP.Net CssClass is an abstract wrapper around the css "class" specifier.
Essentially, for most intents and purposes, they are the same thing. When you set the `CssClass` property to some string like "someclass", the html that the WebControl will render will be `class = "someclass"`.
---
EDIT: The CSS selectors you ... | When you use the `CssClass` attribute on an ASP.NET server control, it will render out as `class` in the HTML.
For example, if I were to use a label tag in my mark up:
```
<asp:label runat="server" CssClass="myStyle" AssociatedControlID="txtTitle" />
```
would render to:
```
<label class="myStyle" for="txtTitle" /... |
308,735 | This is a Sony EVO-9500A (old 8mm tape player/recorder).
[](https://i.stack.imgur.com/Vfehe.jpg)
What is the cartridge fuse style component? It is 1/4" by 1 1/8" about the same size as a 3AG fuse. It has a scale... | 2017/06/02 | [
"https://electronics.stackexchange.com/questions/308735",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/94416/"
] | The text beside the mounting clips says "X 200 Hour", so I'd guess that it records operating time of the tape player. | These were common on Japanese professional video recorders from the 1980s. I believe it's a a capillary tube of mercury and was told back then that they can be reversed. The helical scan heads typically had a life of around 300 hours and various pullies and belts also needed periodic replacement. The counter was non-re... |
405,183 | I've been assigned to a code base responsible for millions of dollars of transactions, per quarter, and has been in use for over a decade. Sifting through the solution, I see **doubles** used everywhere to represent money and arithmetic is done on these variables; on the rare occasion is a **decimal** type used.
What ... | 2020/02/14 | [
"https://softwareengineering.stackexchange.com/questions/405183",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/218080/"
] | You're right in being concerned about the use of floats for monetary amounts. Unless they are just used to calculate something which is then properly represented as a rounded scaled decimal (or an integral number of cents, which is equivalent,) they shouldn't be used to represent money.
However, the damage that could ... | Floating point numbers are simply not suitable for storing exact but arbitrary numeric values; every floating point number is just an approximation of a numeric value. Sure, some numbers can be represented exactly as a floating point value but many cannot and then you will have an error that can vary a lot, so it's bet... |
14,781,281 | I have two django template pages, one of them is "base.html", with basic html tags setup as a base template. Now I have a page "child.html" that extends it, with something like `{% extends "base.html" %}` in it. Now I have to change `<body>` background color for this particular page, so in the css of "child.html" I wro... | 2013/02/08 | [
"https://Stackoverflow.com/questions/14781281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/636625/"
] | To do this add a block in base.html in the head that allow you to inset another css AFTER the one in base.html
```
<head>
.... other head tags ....
<link rel="stylesheet" type="text/css" href="/site-media/css/template_conf.css"/>
{% block extra_css %}{% endblock %}
</head>
```
This allows you to overri... | if you see the new css loaded in the firebug or other browser debugger,
please try:
```
body {
background-color: #000000 !important;
/* some other css here */
```
} |
199,480 | I tried several times but without success to get the trimmer changing the output voltage of the LM317T . I tired to link the Pin 1 and 2 then all goes to ADJ pin of the LM317T and pin 3 to ground or 2 and 3 to ADJ and pin 1 to ground or using only 2 pins as shown below but nothing worked . Nothing wokred means the volt... | 2015/11/06 | [
"https://electronics.stackexchange.com/questions/199480",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/91060/"
] | There are lots of application notes on this.
Google for "Tantalum vs ceramic capacitors".
Ceramic capacitors are best for its ESR & ESL. So that they can handle huge ripple currents at less temperature rise in power supplies. Same way, they don't disturb signal quality in High-speed systems (AC coupling capacitors).
B... | The only place where I've seen them [personally] in a mass-market product this century was in the VCO [for the wireless] of a Uniden cordless phone.
Since you made me curious about this, I've done a bit of googling (for tantalum and VCO) and found [MAX2572EVKIT](https://datasheets.maximintegrated.com/en/ds/MAX2560EVKI... |
39,148,759 | I got a data.table base.
I got a term column in this data.table
```
class(base$term)
[1] character
length(base$term)
[1] 27486
```
I'm able to remove accents from a string.
I'm able to remove accents from a vector of string.
```
iconv("Millésime",to="ASCII//TRANSLIT")
[1] "Millesime"
iconv(c("Millésime","boulangère... | 2016/08/25 | [
"https://Stackoverflow.com/questions/39148759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4383566/"
] | It might be easier to use the [stringi](/questions/tagged/stringi "show questions tagged 'stringi'") package. This way, you don't need to check the encoding beforehand. Furthermore [stringi](/questions/tagged/stringi "show questions tagged 'stringi'") is consistent across operating systems and `iconv` is not.
```
libr... | Three ways to remove accents - shown and compared to each other below.
The data to play with:
```
dtCases <- fread("https://raw.githubusercontent.com/ccodwg/Covid19Canada/master/retired_datasets/individual_level/cases_2021_1.csv", stringsAsFactors = F )
dim(dtCases) # 751526 16
```
Bench-marking:
```
> syst... |
25,675,223 | I'm doing ex13 from Learn Python The Hard Way
I'm trying to pass:
```
python ex13.py raw_input() raw_input() raw_input()
```
my code is below:
```
from sys import argv
script, first, second, third = argv
print "The script is called:", script
print "Your first variable is:", first
print "Your second variable is:... | 2014/09/04 | [
"https://Stackoverflow.com/questions/25675223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4009605/"
] | If you are trying to complete the Exercise 13 study drill from Learn Python the Hard Way, then you are trying to combine argv and raw\_input(). The author suggests you use raw\_input() to get more input from the user.
With help from this thread I came up with this:
```
from sys import argv
ScriptName, first, second,... | Yes you can do that, but it's a bit tricky and the author didn't mention it in previous exercises.
argv is actually a list[] (or data array), so you can address its individual elements within the script.
Here is my example:
```
from sys import argv
script, first, second, third = argv # one way to unpack the argument... |
55,181 | Challenge
---------
Write a program to factor this set of 10 numbers:
```
15683499351193564659087946928346254200387478295674004601169717908835380854917
24336606644769176324903078146386725856136578588745270315310278603961263491677
39755798612593330363515033768510977798534810965257249856505320177501370210341
4595600740... | 2015/08/23 | [
"https://codegolf.stackexchange.com/questions/55181",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/29806/"
] | J, 2 bytes
----------
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") now, so I assume efficiency doesn't actually matter, which means:
```
q:
```
(J's "factor prime" function) will return the right answer (in the form of a neatly formatted `2x10` array!) if you pass it an array... | Pyth, 15 13 12 bytes
====================
```
jbmS{iLd.Q.Q
```
Expects the list of primes seperated by newlines on stdin. Outputs in the following format:
```
[1, 123830525223423718982054269884856893727, 126652934104061135988638942588043498971, 15683499351193564659087946928346254200387478295674004601169717908835380... |
25,796,156 | I needed to display different text based on the day of the week and successfully created the following code snippet using if/else. Now my client wants forward/back arrows to simulate going forwards and backwards from the current day of the week. Is there a way to enhance this script to \_get a value in the URL and +1 o... | 2014/09/11 | [
"https://Stackoverflow.com/questions/25796156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1090213/"
] | This is a working tested example
```
if (array_key_exists('day', $_GET)) {
$add_day = $_GET['day'];
} else {
$add_day = 0;
}
$yesterday = $add_day - 1;
$tomorrow = $add_day + 1;
$link_yesterday = $_SERVER['PHP_SELF'] . '?day=' . $yesterday ;
$link_tomorrow = $_SERVER['PHP_SELF'] . '?day=' . $tomorrow ;
$di... | Using a hyperlink you can do:
```
echo "<a href=\"page.php?today=".$today-1."\">Back</a>";
```
And then to retrieve the today variable:
```
$today=$_GET["today"];
``` |
26,225,191 | Working on building JavaScript sourcemaps into my workflow and I've been looking for some documentation on a particular part of debugging source maps. In the picture below I'm running compressed Javascript code, but through the magic of source maps Chrome debugger was able to reconstruct the seemingly uncompressed code... | 2014/10/06 | [
"https://Stackoverflow.com/questions/26225191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1506980/"
] | Using `Watch Expressions` on the right hand side, *usually* solves this.
Expand the menu, and use the plus button to add your variables.
You can use `someNumber` and `someOtherNumber`, and even `someNumber + someOtherNumber`. | There's still no solution to mapping variable names in Javascript source maps, but there's a solution for Babel 6. As we've adopted ES2015, the mangled import names became a major pain point during development. So I created an alternative to the CommonJS module transform that does not change the import names called [ba... |
21,272,732 | I have something similar to the following situation:
```
<div id="block">
<span data-type="a">a</span>
<span data-type="b">b</span>
<span data-type="c">c</span>
</div>
```
when clicking on one of the spans, I'd like to return back the data-type. I tried doing:
```
$('#block').on('click', function(event)... | 2014/01/22 | [
"https://Stackoverflow.com/questions/21272732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1417998/"
] | It's because your div `#block` doesn;t have the `data-type` tag but `span` does. So, handle the click event on span.
```
$('#block span').on('click', function(event) {
var text = $(this).data('type');
console.log(text);
});
``` | ```
$('#block > span').on('click', function(event) {
var text = $(this).attr('data-type');
return text;
});
``` |
29,173,782 | If i have an array that I've used to create 50 random numbers, I then sort them numerically. Now lets say I wanted to print out the 10 biggest number (elements 40 to 50) I could say:
`print($array[40]) print($array[41]) print($array[42])` etc etc.
But is there a neater way to it? Hope I'm making myself clear.
Cheers | 2015/03/20 | [
"https://Stackoverflow.com/questions/29173782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4432758/"
] | You could loop over the indexes.
```
say $array[$_] for 40..49;
```
Offsets from the end make more sense here.
```
say $array[$_] for -10..-1;
```
You could also use an array slice.
```
say for @array[-10..-1];
```
To print them on one line, you can use `join`.
```
say join ', ', @array[-10..-1];
``` | Try this :
```
print join ',',@array[-10..-1] ,"\n";
``` |
45,911 | I am wondering what would be the right set up to record the sound of a pipe organ in a cathedral/church.
If this is the church:
```
+
|
-----------------------|
/ \
/ () \
| ()() |
| ()()=* ... | 2019/06/14 | [
"https://sound.stackexchange.com/questions/45911",
"https://sound.stackexchange.com",
"https://sound.stackexchange.com/users/25354/"
] | Distance is your key. Do not record too close to the organ or it will sound very weak. The larger/louder the instrument, the further away you would want to place the mic array. You want to balance the distance so that you are getting an even balance of reverberant sound and direct sound from the organ.
Of course, if y... | You say you "have a studio micro microphone". Does the microphone call itself a studio microphone, possibly using the attribute "professional"? Or does it have (documented) equivalent noise levels and frequency/directional characteristics that give some credence to its claim? The distance (if any) with which the microp... |
19,307,877 | I'm a C noob, but have experience in Java and Python.
I'm currently doing an assignment on bit operations and found a guide that showed me how to do it, problem is that I don't quite understand.
```
c=(c&(1<<n))>>n;
```
c = an unsigned char
n = integer, represents the nth bit of a c.
I understand that & = the AND ... | 2013/10/10 | [
"https://Stackoverflow.com/questions/19307877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1692517/"
] | Also took me a second to figure it out (I'm used to do this another way), but here it is:
Let's start with the first thing the snippet does (because of the brackets).
```
1<<n
```
1 is written in binary like this 00000001 and to shift it to the left n steps, basically just shifts the 1, e.g. 2 steps would result in... | `c&(1<<n)` this is testing to see if the nth bit is a one or zero.
after this operation you will have either all zeros, or `n-1` zero followed by a one.
then applying `>>n` get the nth bit from the previous operation to be the LSB.
and you assign that to the variable. |
1,635,333 | I want to learn .NET and I have 2 weeks time of this. I have sound knowledge of CLR, Assemblies and certain basics. I have a copy of "CLR via C#". But I need to learn advanced C# concepts like delegates, reflection, generics and so on. And then I need to quickly jump into coding. Remember, I have 2 weeks time.
I suppos... | 2009/10/28 | [
"https://Stackoverflow.com/questions/1635333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175624/"
] | I recommend [C# 2005: The Base Class Library](http://www.dotnet2themax.com/blogs/fbalena/PermaLink,guid,6d4703fa-edb4-441d-ae2a-dd9bc1303689.aspx) by Francesco Balena. Its a bit of an older book, but I found it to be an amazing read. I learnt a ton with it. | Refer this link,
<http://sharpertutorials.com/tutorials/>
This site having hands on guides for programming areas includes
**1. Introduction to C#**
**2. Intermediate C# Tutorials,**
**3. Advanced C# Tutorials**
**4. Object Orientation**
**5. Real World Object Orientated Programming**
**6. Testing and De... |
956,498 | I'd like to tinker with the auto-generated columns in a gridview a bit. What event would I want to override to modify them just after they are generated but before the control is rendered? | 2009/06/05 | [
"https://Stackoverflow.com/questions/956498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116645/"
] | The columns are added to the GridView when the DataBind() method is called | Those two links are for the Datagrid not Gridview. |
61,740,925 | We use an asp.net application using web forms and viewing the page source there is a field generated as below
```
input type="hidden" name="__VIEWSTATE_KEY" id="__VIEWSTATE_KEY" value="VIEWSTATE_xxooxx...."
```
Our company recently had a security scan run against our application with a flag raised for `Cross-Site ... | 2020/05/11 | [
"https://Stackoverflow.com/questions/61740925",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4118953/"
] | Your pattern matches if a `0` is either followed by or preceded by a `1` but there's no restriction that it must be only one of them. You can add a negative Lookbehind and a negative Lookahead to achieve that.
Try something like following:
```
(?<!1)0(?=1)|(?<=1)0(?!1)
```
**[Demo](https://regex101.com/r/cHzsmK/1)*... | The following regular expression addresses a generalization of the question. It matches every character in a string that: 1) is followed by the same character and not preceded by the same character; or 2) is preceded by the same character and not followed by the same character.
```
^(.)(?=\1)|(?<=(.))(?=\2).$|(?<=(.)... |
34,842,582 | What's wrong with this piece of code?
```
if key == 'w' then
if charastate == neutral then
charamov = up
end
elseif charastate == lr then
charastate = neutral then
charamov = up
end
end
```
Error is :
>
> "unexpected symbol near 'then'"
>
>
>
Also it doesn't matte... | 2016/01/17 | [
"https://Stackoverflow.com/questions/34842582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5802390/"
] | The error message is telling you to omit the last `then` because it is not paired off with an `if`.
Indenting the code properly will help you see it. | Try this code. You are using "then" two times in else if statement.
```
if key == 'w' then
if charastate == neutral then
charamov = up
elseif charastate == lr then
charastate = neutral
charamov = up
end
end
``` |
57,246,369 | This video covers an implementation of the min coins to make change.
<https://en.wikipedia.org/wiki/Change-making_problem>
The place I'm not clear on is where the interviewer goes into the details of optimization, starting from here.
<https://youtu.be/HWW-jA6YjHk?t=1875>
He suggests that to make the min number of... | 2019/07/29 | [
"https://Stackoverflow.com/questions/57246369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1792945/"
] | I'm posting this answer here since this question is the first Google result for the problem I had:
When referencing the `usdz` file exactly like Apple's documentation proposes, the AR button is rendered on top of the teaser image. When clicking the linked image, Safari opens the Quick Look screen, but the message "Obj... | Embed a link to USDZ Files for direct AR-scenes usage.
**Here's a code for multiple usdz files**:
```
<html>
<head>
<meta charset="utf-8">
<title>Augmented Reality</title>
</head>
<body>
<div>
<a href="yourDirectory/ar_pixar_file_01.usdz" rel="ar">
<img... |
18,059,124 | What I'm trying to do is create a list of swatches that, upon mouseover, show a preview of the color that is being hovered on. I'm using a CSS sprite to deliver both the swatches and the previews. I have it working, but I feel there is a far more efficient way to deliver the associated jQuery. I'm seeking help to find ... | 2013/08/05 | [
"https://Stackoverflow.com/questions/18059124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2653224/"
] | Try this:
```
var xPosition = -195;
$(".style-swatches li").each(function(){
$(this).hover(function(){
$(this).parents().find('.chip-preview').css("background-position", (xPosition - ($(this).index() * 195)) + "px 0");
});
});
```
[Fiddle](http://jsfiddle.net/zPtr6/3/) | Try
```
$('.c1, .c2, .c3').hover(function () {
var $this = $(this), pos = $this.attr('class').match(/\bc(\d+)\b/)[1];
$(this).parents().find('.chip-preview').css('background-position','-' + (pos * 195) + 'px 0');
});
``` |
28,483 | Trying to design a circuit that can reliably detect a situation where a child wets their bed. The 3 key requirements are --
1. Reliability of the approach
2. Ease of use, i.e. a no-fuss approach
3. Child's safety (from harm) due to electronics
Can the soil moisture detection technique be used ?
How can I make this ea... | 2012/03/21 | [
"https://electronics.stackexchange.com/questions/28483",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/6406/"
] | I like @DavidKessner's solution, but a PCB on the mattress seems ... uncomfortable to me. I would sew in [conductive thread](http://www.conductivethread.ca/) (google for other suppliers) into several bedtime underwear, creating several lines across the area that gets wet. Connect every other line together so you now ha... | You could use a relative humidity sensor, [this kind of thing](http://www.sparkfun.com/products/10167). |
48,359,636 | I'm trying to split a cell on the 2nd space character. Is this possible? Or is it just possible to split on a space character?
```
LeBron James SF ORL @ CLEThu 7:00pm
LeBron James SF ORL @ CLEThu 7:00pm
``` | 2018/01/20 | [
"https://Stackoverflow.com/questions/48359636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9216039/"
] | Please try regular expression:
`=REGEXEXTRACT(A1,"^([^ ]+ [^ ]+) (.*)")`
* `(...) (...)` is to find 2 groups on a string
* `^` at the beginning means to look at the start of a string
* `[^ ]+` means 1+ no space char.
* `.*` means any number of chars
References:
1. [RegexExtract](https://support.google.com/docs/answ... | A simple way is to [SUBSTITUTE](https://support.google.com/docs/answer/3094215) the second instance of a space with a character not otherwise in service (I chose `£`), then [SPLIT](https://support.google.com/docs/answer/3094136) on that character:
```
=split(substitute(A1," ","£",2),"£")
``` |
49,316,282 | How can I plot 2 density plots in one output. Here are my codes for the density plot.
```
#Density Plot
d <- density(dataS)
plot(d, main= "Density plots of Revenue")
o <- density(RemoveOutlier)
plot(o, main= "Density plots of Revenue excluding outliers")
```
So basically I want to see both plots on one output. And ... | 2018/03/16 | [
"https://Stackoverflow.com/questions/49316282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Or instead of the second "plot()" function call, use "lines()", then you get two overlapping density plots. | If the support of your PDFs is quite spread apart, using `lines` will not suffice. You'll need to control the range of the calculated values to the density.
Here's an example:
```
x1 = rnorm(1e5)
x2 = rnorm(1e5, mean = 4)
#looks bad because the support has little overlap
plot(density(x1))
lines(density(x2))
```
To... |
53,743,329 | I need to get an input from a file. This input is any binary number of any length where the digits are separated by a semicolon like this:
>
> 0; 1; 1; 0; 1; 0;
>
>
>
What I would do is pass the file to a variable like
```
if (myfile.is_open())
{
while ( getline (myfile,line) )
{
File = line;
... | 2018/12/12 | [
"https://Stackoverflow.com/questions/53743329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10745795/"
] | We can use `ave` grouped by `A` and remove the groups that has `all` `NA`s
```
df[!with(df, ave(is.na(B), A, FUN = all)), ]
# A B
#2 2 NA
#3 3 77
#5 2 81
```
---
Using the same logic with `dplyr`
```
library(dplyr)
df %>%
group_by(A) %>%
filter(!all(is.na(B)))
``` | We can use `data.table`
```
library(data.table)
setDT(df1)[, .SD[any(!is.na(B))], A]
# A B
#1: 2 NA
#2: 2 81
#3: 3 77
```
### data
```
df1 <- structure(list(A = c(1L, 2L, 3L, 1L, 2L), B = c(NA, NA, 77L,
NA, 81L)), class = "data.frame", row.names = c(NA, -5L))
``` |
655,797 | I have the following definition:
Let ($X$,$\mathcal{T}$) and ($X'$, $\mathcal{T'}$) be topological spaces. A surjection $q: X \longrightarrow X'$ is a quotient mapping if $$U'\in \mathcal{T'} \Longleftrightarrow q^{-1}\left( U'\right) \in \mathcal{T} \quad \text{i.e. if } \mathcal{T'}=\{ U' \subset X' : q^{-1}\left( ... | 2014/01/29 | [
"https://math.stackexchange.com/questions/655797",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/122136/"
] | Here is a "visual" example:
Wrap the unit interval $[0,1]$ around the unit circle $S^1$ by identifying $0$ and $1$. The interval $[0,1/2) $ is open in $[0,1]$, but its image in $S^1$ is not open. | Partition $X=ℝ$ (under the usual topology) into two equivalence classes $(-\infty, 0]$ and $(0,\infty)$ to get a two-point quotient space $X'$ (called the [Sierpiński space](https://en.wikipedia.org/wiki/Sierpi%C5%84ski_space)) and let $q:X\to X'$ be the canonical projection mapping that takes each element of $ℝ$ to it... |
2,075 | My bathroom walls were a mix of plaster and drywall with various layers of paint, primer, and skim coating. I attempted to skim coat the walls myself to prepare for priming and painting, but I wasn't happy with the results so I hired someone to do it right. The walls are smooth now but not quite flat. For example, if y... | 2010/10/06 | [
"https://diy.stackexchange.com/questions/2075",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/697/"
] | I had to have my walls skim coated and I waited until I was completely done with everything before putting the baseboards on. I didn't want to take any chances scuffing them up or getting paint on them. My vote is do them absolutely last. | I agree with baseboard last. The drywall guy can hold a board up to the wall for a straight edge. If the baseboard fit isn't perfect (hardly ever is) when you go to install it, then you can run a bead of calk down the top after you put it on. Then paint the calc either the wall o the baseboard color or split it. |
60,641,472 | I receive one of these errors when attempting to open up a session.
>
> selenium.common.exceptions.SessionNotCreatedException: Message: session not created
> from chrome not reachable
> (Session info: chrome=80.0.3987.132)
>
>
> selenium.common.exceptions.SessionNotCreatedException: Message: session not created
>... | 2020/03/11 | [
"https://Stackoverflow.com/questions/60641472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8814286/"
] | I solved the issue using a workaround for my initial intend by passing a css style property to the template of the parent vue-component:
```
<template>
<div>
<span v-for="(line, index) in paragraph.lines" :key="index">
<p v-if="line.length">
<span v-for="(lineFragment, index) in line" :key="index">... | Vue component templates should have root element that exists in DOM. Commonly `div` or `span` wrapper elements are used. This is rarely a a problem because root element can be styled to fit the layout.
There's [vue-fragment](https://github.com/y-nk/vue-fragment) plugin that provides the functionality of `React.Fragmen... |
2,890,229 | first time at stack overflow.
I'm looking into using some of the metaprogramming features provided by Ruby or Python, but first I need to know the extent to which they will allow me to extend the language. The main thing I need to be able to do is to rewrite the concept of *Class*. This doesn't mean that I want to rew... | 2010/05/23 | [
"https://Stackoverflow.com/questions/2890229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/348056/"
] | I agree with Samir that it just sounds like duck typing. You don't need to care what 'type' an object really 'is' you only need bother with what an object can 'do'. This is true in both Ruby and Python.
However if you really are checking the types of classes and you really do need to have a `Poodle` object optionally ... | In Python you can change the inheritence of a class at runtime, but at every given time a class is not a subclass of another one unless declared otherwise. There is no "may or may not" - that would need ternary logic which Python doesn't support. But of course you can write your own "Is-a" and "Has-a" functions to map ... |
52,407,951 | I am trying to pass parameter to URL. For which I am using Angular HttpParams. How do I set date param only if date is not null or undefined?
Code:
```
let params = new HttpParams()
.set('Id', Id)
.set('name', name)
if (startDate !== null) {
params.set('startDate', startDate.toDateString());
}
if (endDate... | 2018/09/19 | [
"https://Stackoverflow.com/questions/52407951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6341455/"
] | `set` does not mutate the object on which it is working - it returns a *new object* with the new value set. You can use something like this:
```
let params = new HttpParams()
.set('Id', Id)
.set('name', name)
if (startDate != null) {
params = params.set('startDate', startDate.toDateString());
}
if (endDate... | Instead of using the HttpParams object you can define and mutate your own object and pass it within the http call.
```
let requestData = {
Id: Id,
name: name
}
if (startDate) {
//I am assuming you are using typescript and using dot notation will throw errors
//unless you default the values
requestData['startDat... |
4,362,831 | I find that my C++ *header files* are quite hard to read (and really tedious to type) with all the fully-qualified types (which goes as deep as 4 nested namespaces). This is the question (all the answers give messy alternatives to implementing it, but that's *not* the question): ***Is there a strong reason against intr... | 2010/12/06 | [
"https://Stackoverflow.com/questions/4362831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/383306/"
] | Given that `using` declarations at class scope are not inherited, this could work. The name would only be valid inside that class declaration, or inside the declarations of nested classes. But I think it's sort of overloading the concept of a class with an idea that should be larger.
In Java and Python individual file... | Maybe namespace alias?
```
namespace MyScope = System::Network::Win32::Sockets;
``` |
19,952,520 | I have a string which is a simple `<a>` element.
```
var str = '<a href="somewhere.com">Link</a>'
```
Which I want to turn into:
```
Link
```
I can remove the `</a>` part easily with `str.replace("</a>", "")`but how would I remove the opening tag `<a href="somewhere.com>`? | 2013/11/13 | [
"https://Stackoverflow.com/questions/19952520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/703569/"
] | Use `unwrap` like
```
$('a').contents().unwrap();
```
But it work with the elements that are related to DOM.For your **Better** solution try like
```
str = ($(str).text());
```
See this [**FIDDLE**](http://jsfiddle.net/NATnr/43/) | Since you are using jQuery, you can do it on the fly as follows
```
$('<a href="somewhere.com">Link</a>').text()
``` |
24,982,476 | I have been trying to delete certain rows from the database using a few checkboxes. So far I've managed to echo out the content of the MySQL table but deleting rows through the checkboxes doesn't seem to work.
```
<table class="ts">
<tr>
<th class="tg-031e" style='width:1px'>ID</th>
<t... | 2014/07/27 | [
"https://Stackoverflow.com/questions/24982476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3849409/"
] | Here, it's tested and working while using `mysqli_` instead of `mysql_`
Replace with your own credentials.
A few things, your checkbox did need square brackets around the named element as I mentioned in my comment(s), i.e. `name='checkbox[]'`
otherwise you would receive an invalid `foreach` argument error.
Sidenote... | You should do something similar to this (semi pseudo):
```
<form method="post">
/begin loop/
echo '<input type="checkbox" name="row[' . $row['ID'] . ']" />';
/end loop/
<input type="submit" />
</form>
```
Then try to put this on the processor page, on top of it:
```
if ( !empty( $_POST ) )
{
... |
343,732 | In our app, we currently live with the legacy of a decision to store all engineering data in our database in SI.
I worry that we may run the risk of not having sufficient precision and accuracy in our database or in .NET numeric types. I am also worried that we may see artifacts of floating-point maths (although that ... | 2008/12/05 | [
"https://Stackoverflow.com/questions/343732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5351/"
] | Keep *significant figures* in mind -- the accuracy of the measurement. If the PSI is known to only whole pounds, then after conversion to Pa there are 15 decimals, there is still only one significant figure.
Precision is different from accuracy, and performing floating point operations on engineering units need to tak... | Well, it depends on how exact you want to be. Remember than when talking about engineering, it isn't enough to just store the number 3.20, because 3.2 isn't the same as 3.20 when it comes to engineering. 3.20 implies higher accuracy than 3.2, which could be *3.15 <= x < 3.25*. |
974,031 | We've Drupal multi-site (with different domain per site) running with single Drupal 8 code base and Nginx as web-server. Now we wanted to setup Drupal Milti-site with sub-directory for few websites in following format, and "subdirectory" should be case in-sensitive (i.e. site should be accessible with both "subdirector... | 2019/07/05 | [
"https://serverfault.com/questions/974031",
"https://serverfault.com",
"https://serverfault.com/users/172416/"
] | Answer: there are two parts to this.
1) `private/{process_name}` actually references `/var/spool/postfix/private/{process_name}` which you can check to see if it's there. I discovered this from <https://www.howtoforge.com/postfix-dovecot-warning-sasl-connect-to-private-auth-failed-no-such-file-or-directory> and extrap... | I had the same problem about transport private/dovecot and I solved it. I didn't change /etc/dovecot.conf nor /etc/postfix/main.cf. I did the following actions:
First, execute vi /etc/postfix/master.cf, then:
```
1) Uncomment:
1.1) submission inet n line with -o lines
2.2) smtps inet n - n - ... |
21,726,948 | Would the following code cause any issues?:
```
var a = 1;
var a = 2;
```
My understanding is that javascript variables are declared at the start of the scope. For example:
```
var foo = 'a';
foo = 'b';
var bar = 'c';
```
Is processed as:
```
var foo;
var bar;
foo = 'a';
foo = 'b';
bar = 'c';
```
Therefore wou... | 2014/02/12 | [
"https://Stackoverflow.com/questions/21726948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/370103/"
] | As you said, by twice of more the same var, JavaScript moves that declaration to the top of the scope and then your code would become like this:
```
var a;
a = 1;
a = 2;
```
Therefore, it doesn't give us any error.
This same behaviour occurs to `for` loops (they doesn't have a local scope in their headers), so the ... | If you initialize the same variable twice, there will be no error on the console but if you are working on some application (like guess my number) and want to reset all the elements to the initial state.
All the elements will be set to the initial state but the variable that was initialized twice will stick to its modi... |
6,778,143 | I'm looking for a constant or variable that will provide a public path to my application root.
I have got so far as `FULL_BASE_URL` which gives me `http://www.example.com` but I have the added problem of my application being in a sub directory (e.g. `http://www.example.com/myapp/`).
Is there any way to get the path l... | 2011/07/21 | [
"https://Stackoverflow.com/questions/6778143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/851885/"
] | ```
$this->base;
```
<http://api.cakephp.org/class/dispatcher> | ```
<?php
...
$this->redirect( Router::url( "/", true ));
...
?>
```
Router is the static class used by the HtmlHelper::link, Controller::redirect etc. the Router::url method takes a string, or array and matches it to a route. Then it returns the url that matched the route info as a string.
If you pass "... |
19,424 | In looking at European-designed fighters of the 4th and 4.5th generation, I keep seeing a common design feature; a box-like structure built into the tail, often in the top half or third. Some examples:
**Saab Gripen**
[](https://i.stack.imgur.com/foB... | 2015/08/28 | [
"https://aviation.stackexchange.com/questions/19424",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/7629/"
] | You're right. It's the ECM/EW antenna/equipment (fairing) in all the aircrafts except Typhoon.
This photo shows the details of EW/ECM suite in Gripen.
[](https://i.stack.imgur.com/lQvy5.jpg)
Source: www.w54.biz
In Typhoon, it is the engine bleed air heat exchanger. The... | On the tornado the box at the top of the fin is the RHWR basically to warn the A/C if there is a radar locking on to them. The lower protuberance like the typhoon is an intercooler intake. |
42,224,845 | I want to insert external JavaScript placed in the folder in WordPress.
if I include using script tag it shows "<" expected error
below is my code
```
global $wpdb;
include("/asset/php/chart4php/inc/chartphp_dist.php");
$p = new chartphp();
$p->data_sql = $wpdb->get_results("select t2.name, count(t1.id) as scor... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42224845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6146203/"
] | Gone through same problem, and here's one firm solution to this.
I am assuming you have generated an angular cli project and this is what you have ran into once you've started to code.
Solution
--------
So what happens is at times angular fails to install all the required dependencies, and does not even update on np... | I too faced this issue, delete the node modules folder and then clean the cache using >npm cache clean --force.
Install the node modules again globally using
npm install --save @ng-bootstrap/ng-bootstrap
npm install --legacy-peer-deps
it will work |
3,428 | I am planning to live with Buddhist monks. But I am hesitant. I am not sure whether I shall be able to live with them without leaving my current religion.
I think, if Buddhism is a religion, I am bound to face hard times. Because, it will clash with my current religion.
If it is a philosophy, then I dare to attempt.... | 2012/08/05 | [
"https://philosophy.stackexchange.com/questions/3428",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/-1/"
] | There are two aspects to this question, a theoretical one and a practical one. I shall attempt to address each of these in turn.
The theoretical question regards whether Buddhism is to be considered a philosophy or a religion. This is a definitional question; it assumes that we already have rigorous delimitations of t... | One of the epithets of the Buddha is 'teacher of the devas'. There are various accounts of Buddha teaching devas or gods, even Brahman the supreme being/ultimate reality. <https://www.accesstoinsight.org/lib/authors/jootla/wheel414.html> This is a very different dynamic to Western thought, it is not arguing ontic prior... |
16,922 | In the Book of Job, after Job has went through his first test from Satan there is another gathering in Heaven and, once again, Satan is there ([Job 2:1-3](https://www.biblegateway.com/passage/?search=Job%202%3A1-3&version=NIV)). The result of this gathering is that Job will have to endure another test. This is explaine... | 2015/03/02 | [
"https://hermeneutics.stackexchange.com/questions/16922",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/2572/"
] | The first test to which Job is submitted takes everything from Job that is his property. This is the initial challenge posed by Satan: that Job only loves God because of the intelligence and wealth that God has provided Job. After God allows Satan to take Job's property, Job humbly accepts this in stating that God both... | Seems to me that while surely skin means skin (hides and pelts) skin is his heart. We have all felt a darkened heart, then it becomes white as we purify ourselves once again by being faithful through the challenge. |
9,027 | I'm quite familiar with the theory behind VC-Dimension, but I'm now looking at the recent (last 10 years) advances in statistical learning theory: (local) Rademacher averages, Massart's Finite Class Lemma, Covering Numbers, Chaining, Dudley's Theorem, Pseudodimension, Fat Shattering Dimension, Packing Numbers, Rademach... | 2011/11/19 | [
"https://cstheory.stackexchange.com/questions/9027",
"https://cstheory.stackexchange.com",
"https://cstheory.stackexchange.com/users/4828/"
] | This was a recently taught course. <http://www.cs.huji.ac.il/~shais/Handouts.pdf>. I haven't carefully read through it, but chapter 7 has material on Rademacher Complexities. Hope it helps. | The book by [Cesa-Bianchi and Lugosi](http://rads.stackoverflow.com/amzn/click/0521841089) has much of the modern aspects of generalization bounds and learning theory. |
330,024 | This is a quick question. When people write $f:I\to J$ for instance, does $J$ need to be the range of $f$ or can it be any set containing the range of $f?$ For example, is $g(x)=\pi$ an $\mathbb{R}\to\mathbb{R}$ function? | 2013/03/14 | [
"https://math.stackexchange.com/questions/330024",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/64804/"
] | $f:X\to\Bbb R$ simply means that all of our function values are real. It **doesn't** mean that all real values are obtained by our function. ($\Bbb R$ in this case is called a *[codomain](http://en.wikipedia.org/wiki/Codomain)* for our function $f$.) Your example $g$ is indeed an $\Bbb R\to\Bbb R$ function (so long as ... | condensed from comments received :
$$f:X \to Y \equiv \forall x \in X \quad \exists y \in Y \text{ such that } f(x)=y$$
$$f:X \to Y \land f\_\text{ onto/surjective} \equiv \forall y \in Y, \, \exists x \in X \text{ such that } f(x)=y$$
$$f:X \to Y \land f\_\text{ 1-1/bijective} \equiv \forall x \in X \quad !\exists y ... |
73,253,209 | I have two dataframes, like below
**rows\_df**
```
Id Location Age
0 0 30
1 1 US 20
2 2
```
**requiredCols\_df**
```
RequiredColumn
0 Location
```
`requiredCols_df` specifies which column is required in `rows_df`.
In this example, `Location` is required, `Age` is optional in ... | 2022/08/05 | [
"https://Stackoverflow.com/questions/73253209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/665335/"
] | If you correct those to be true nans...
```
req_cols = requiredCols_df.RequiredColumn
rows_df[req_cols] = rows_df[req_cols].replace([r'^\s*$', '', None], np.nan, regex=True)
Id Location Age
0 0 NaN 30
1 1 US 20
2 2 NaN
```
Then this is simple:
```
matched = rows_df.dropna(subset=req_cols)
no... | Assuming you don't have a *tremendous* count of columns are there, this seems like a task for a loop
```py
df_result = rows_df
for column in requiredCols_df["RequiredColumn"]:
df_result = df_result[df_result[column].notnull()]
``` |
6,446,132 | Quite simply: I'm using Smarty and the `|capitalize` modifier. It works fine, but when I pass any word with `l` in it, it capitalizes it, even if it's not at the beginning of the word.
What why?
**EDIT**: Same happens with `p`.
Test:
```
{"abcdefghijklmnopqrstuvwxyz"|capitalize}
{"aaal aala alaa laaa"|capitalize}
... | 2011/06/22 | [
"https://Stackoverflow.com/questions/6446132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/154502/"
] | You could also use PHP's [ucfirst](http://de.php.net/manual/en/function.ucfirst.php) function
```
{"aaal aala alaa laaa"|@ucfirst}
```
This will result in
>
> Aaal aala alaa laaa
>
>
> | Smarty primarily relies on [`ucfirst()`](http://us2.php.net/manual/en/function.ucfirst.php) which is affected by the current locale set in PHP. I have been unable to find information on exactly how this affects the capitalization functions (ucfirst, strtolower, strtoupper, etc), but you can try setting your locale to `... |
26,290,117 | How do I interrupt Socket.Select in c#?
In C I used the "self pipe" trick or "signals".
In C# I know I could create a socket pair and interrupt the select, but it doesn't seem very clean.
Is there anything better I could do to interrupt a select call in c#. | 2014/10/10 | [
"https://Stackoverflow.com/questions/26290117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3263867/"
] | To solve this myself, I am just calling `Socket.Close()` on the sockets I listed in my `Socket.Select()` call. This interrupts the select with an exception.
I would use the socket pair trick, but I can’t find the equivalent to `pipe()` in .net. I have a feeling that I read somewhere that the way to do this on Windows ... | I was having the same problem. The best option is run select on different thread.
This helped me get rid of the exception error. |
3,158,942 | so I'm new to using WPF and can't figure out how to make an easy way to have multiple columns of controls that can be added / subtracted easily and still have it scrollable. So for example (my situation), I have two text boxes and a button that need to be added for however many "items" there are. I would want these tog... | 2010/07/01 | [
"https://Stackoverflow.com/questions/3158942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241116/"
] | ```
<ScrollViewer ...>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" ...>
...
</StackPanel>
<StackPanel Grid.Column="1" ...>
...
</StackPanel>
<StackPan... | Have you tried putting all three StackPanels into a `ScrollViewer`? |
25,589,113 | In my MongoDB, I have a student collection with 10 records having fields `name` and `roll`. One record of this collection is:
```
{
"_id" : ObjectId("53d9feff55d6b4dd1171dd9e"),
"name" : "Swati",
"roll" : "80",
}
```
I want to retrieve the field `roll` only for all 10 records in the collection as we wou... | 2014/08/31 | [
"https://Stackoverflow.com/questions/25589113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2560301/"
] | Try the following query:
```
db.student.find({}, {roll: 1, _id: 0});
```
And if you are using console you can add pretty() for making it easy to read.
```
db.student.find({}, {roll: 1, _id: 0}).pretty();
```
Hope this helps!! | Not sure this answers the question but I believe it's worth mentioning here.
There is one more way for selecting single field (and not multiple) using `db.collection_name.distinct();`
e.g.,`db.student.distinct('roll',{});`
Or, 2nd way: Using `db.collection_name.find().forEach();` (multiple fields can be selected her... |
29,794,897 | I am new to angular js. I have two ng-controller in two Html page. I want to share data from one controller into another controller.
Here is the service i have created:
```
app.service('sharedProperties', function() {
var stringValue = 'test string value';
var objectValue = {
data: 'test object value'... | 2015/04/22 | [
"https://Stackoverflow.com/questions/29794897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2040589/"
] | I've created [jsfiddle](https://jsfiddle.net/kiyanov/5tnc8aod/1/) and it works fine.
```
app.controller('FirstCtrl',function($scope,sharedProperties){
$scope.set = function(){
sharedProperties.setString("Hi");
}
});
app.controller('SeccondCtrl',function($scope,sharedProperties){
$scope.get = f... | **Service have this reference you write your service method as per below**
```
app.service('sharedProperties', function() {
var stringValue = 'test string value';
var objectValue = {
data: 'test object value'
};
this.getString: function() {
return stringValu... |
20,834,648 | Suppose I have a chain of local git branches, like this:
```
master branch1 branch2
| | |
o----o----o----A----B----C----D
```
I pull in an upstream change onto the master branch:
```
branch1 branch2
| |
A----B----C----D
... | 2013/12/30 | [
"https://Stackoverflow.com/questions/20834648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7193/"
] | This question is a subset of [Modify base branch and rebase all children at once](https://stackoverflow.com/questions/42181045/modify-base-branch-and-rebase-all-children-at-once/58864618#58864618)
I recently started using [git-chain](https://github.com/Shopify/git-chain) which is a tool to solve this problem.
Basical... | Git 2.38 has a new flag `--update-refs` to solve this exact problem. In your example:
```
git rebase --update-refs master
```
Example:
```
$ git checkout branch2
$ git log --decorate --all --oneline --graph
* 5b08e54 (master) 4
* 6790fdc 3
| * ee84471 (HEAD -> branch2) branch commit 4
| * 9da7c93 branch commit 3
| ... |
5,599,874 | How can I check for duplicates before inserting into a table when inserting by select:
```
insert into table1
select col1, col2
from table2
```
I need to check if table1 already has a row with table1.col1.value = table2.col1.value, and if yes, then exclude that row from the insert. | 2011/04/08 | [
"https://Stackoverflow.com/questions/5599874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/406322/"
] | ```
INSERT INTO table1
SELECT t2.col1,
t2.col2
FROM table2 t2
LEFT JOIN table1 t1
ON t2.col1 = t1.col1
AND t2.col2 = t1.col2
WHERE t1.col1 IS NULL
```
**Alternative using except**
```
INSERT INTO @table2
SELECT col1,
col2
FROM table1
EXCEPT
SELECT t1.col1, ... | You can simply add IGNORE into your insert statement.
e.g
```
INSERT IGNORE INTO table1
SELECT col1, col2
FROM table2
```
This is discussed [here](https://stackoverflow.com/questions/1361340/how-to-insert-if-not-exists-in-mysql) |
134,167 | While solving the electrostatic field for a dielectric in an electric field, we take the potential at origin to not blow and thus, we eliminate the inverse powers of r in the expression for general potential for azimuthal symmetry. Why is that valid :- we can have bound charge inside the sphere at r = 0 and which can c... | 2014/09/06 | [
"https://physics.stackexchange.com/questions/134167",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/-1/"
] | The validity of setting the electrostatic potential to a certain value at a certain point comes from the fact that the electrostatic potential, like the potential, is defined up to a constant. The numerical value of this constant does not change the physics, but can sometimes make expressions nicer.
The potential shou... | When you have a uniformly charged dielectric sphere, there is no finite charge at the origin. Instead, you have uniform charge *density*, so the total charge inside of a sphere of radius $r$ is
$$q = \frac43 \pi r^3 \rho$$
where $\rho$ is the volumetric charge density, $\rho = \frac{Q}{V}$ where $Q$ is total charge a... |
49,146 | I am asking this question to see if mid-air collisions of drones can be prevented using simple analog sensors. Can an ultrasonic sensor mounted on a drone pick up another drone strongly enough to sense and avoid it?
I know that the sensor is range limited so the aircraft cannot be flying towards each other very fast,... | 2018/03/03 | [
"https://aviation.stackexchange.com/questions/49146",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/11161/"
] | There is no hard-and-fast rule for what to do in an emergency, including a medical emergency involving a passenger.
The decision also is not an instantaneous one; while the flight crew evaluates and works on the medical emergency, the plane is constantly getting closer to the destination.
I suspect that when 3 hours ... | Just as a supplement to @abelenky's good answer, there are some things to be taken into account that haven't yet been mentioned.
First, if you've been flying with a tailwind for 3.0 hours and the winds would be roughly the same, it's going to take you more than 3.0 hours to fly back along the same route, possibly a lo... |
36,979,259 | This is the code:
```
#!/usr/bin/env python
#Import the datetime
from datetime import datetime
import re
#Create two datetime object for limit 1 and limit 2 as dt1 and dt2 respectively
dt1 = datetime.strptime("01:00:00","%H:%M:%S").time()
dt2 = datetime.strptime("04:59:59","%H:%M:%S").time()
#Create a compiler fo... | 2016/05/02 | [
"https://Stackoverflow.com/questions/36979259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6255840/"
] | Sometimes you just have to call it and find a different solution. I couldnt understand why it wouldn't appear, (so indeed, it may have not been in that bootstrap version) so instead, i wrote my own tooltip with a bit of simple css. It's not the solution I wanted, but it solved my problem in the end.
Intrested?
```
... | Try using `data-original-title` instead of `title` |
6,489,750 | i'm need that mysql auto increment field data is start with alpha charecters and continue..
For ex id starts with 1 means i want to start that AB1, AB2, AB3, | 2011/06/27 | [
"https://Stackoverflow.com/questions/6489750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816908/"
] | Yes, you can run PHP on IIS.
<http://php.iis.net/> | I put a test application PHP with MS Access database on an ASP.net hosting. i treated it like a classic ASP application, it worked just fine. you just need to add "index.php" as a default document.
update (1)
i tested it locally on a vm, you may need to disable impersonation and add the following to web.config
```
<c... |
74,605,940 | For the last week I have been trying to get cx\_oracle installed and working.
I started with an Oracle 19 appliance which is on Oracle Linux 7.
I used the official oracle site to install cx\_oracle as listed below.
The install seems to have worked fine, but when I try to import the module, it is not found.
I checked al... | 2022/11/28 | [
"https://Stackoverflow.com/questions/74605940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/233309/"
] | You now seem to have multiple cx\_Oracle packages installed, which isn't helping untangle your problems (and not something I want to replicate).
To start from scratch with a clean OL7 image, follow the "Installing Python 3 from the Oracle Linux 7 Latest Repository" section of <https://yum.oracle.com/oracle-linux-pytho... | The name of the module is `cx_Oracle`, not `cx_oracle`. Note the case! |
33,015,751 | I use the following line to generate Poisson random numbers:
```
Application.Run("Random", "", 1, 100, 5, , 34)
```
this produces 100 random numbers with Lambda (34) in an excel sheet. I would like to save the output into a variable instead of sheet. I tried
```
X=Application.Run("Random", "", 1, NSim, 5, , 34)
... | 2015/10/08 | [
"https://Stackoverflow.com/questions/33015751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5423086/"
] | What actually seems to happen is the real [stack overflow](https://en.wikipedia.org/wiki/Stack_overflow). You have a recursive function and it goes into infinite recursion, so at some time moment it runs out of stack. | The better question is *what do you expect to happen with this code?*
You've got an infinitely recursive function that continually adds to the standard output stream. Of course you're getting an error- you're continually allocating "WORK" strings onto your stack, which is going to overflow. I'm not sure that happens w... |
10,385,278 | Hello I have this code to conditionally render components in my page:
```
<h:commandButton action="#{Bean.method()}" value="Submit">
<f:ajax execute="something" render="one two" />
</h:commandButton>
<p><h:outputFormat rendered="#{Bean.answer=='one'}" id="one" value="#{messages.one}"/></p>
<p><h:outputFormat rend... | 2012/04/30 | [
"https://Stackoverflow.com/questions/10385278",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1272859/"
] | The JSF component's `rendered` attribute is a server-side setting which controls whether JSF should generate the desired HTML or not.
The `<f:ajax>` tag's `render` attribute should point to a (relative) client ID of the JSF-generated HTML element which JavaScript can grab by `document.getElementById()` from HTML DOM t... | ```
style="visibility: #{questionchoose.show==false ? 'hidden' : 'visible'}"
``` |
25,950,620 | i get error "$digest already in progress" when set the restrict attribut to 'E'.
here the directive code:
```
mainApp.directive('scoreDisplay',[
function() {
return {
scope: {
goal_1: 0,
goal_2: 0,
goal_3: 0,
goal_4: 0,
... | 2014/09/20 | [
"https://Stackoverflow.com/questions/25950620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4055724/"
] | This portion will throw an error:
```
scope: {
goal_1: 0,
goal_2: 0,
goal_3: 0,
goal_4: 0,
goal_5: 0,
goal_6: 0,
goal_7: 0
},
```
The `scope` property of the directive is meant to declare how attributes on the element... | The `scope` property of the directive can only accept `@`,`=`and `&` like @m59 said. You can't set the values there as the scope doesnt exist yet.
```
mainApp.directive('scoreDisplay', function() {
return {
scope: {},
restrict: 'E',
templateUrl:'templates/directive-score-display-template.ht... |
385,293 | I am using UBuntu 12.04 LTS and I am using SAKIS 3G script to connect to my 3g wireless modem, i want to use google DNS by default , i don't know, how to use google DNS in sakis3g script.
In native Network manager,there is a box to change these values.
Tell me, how to configure this in sakis 3g script.
If this can ... | 2013/12/03 | [
"https://askubuntu.com/questions/385293",
"https://askubuntu.com",
"https://askubuntu.com/users/175850/"
] | `Ctrl`+`Shift`+`f` worked for me. | I run Ubuntu on VirtualBox and tried the above tricks and it didn't worked out on windows 8.1.
What I did to exit command line full screen was :
1. **Right click** on the terminal
2. select **Leave Full Screen**
And I got the normal screen again. |
65,213,388 | I have a folder where I will take text files (200-500mb -not very big, but its big text file) and I want to process this file in parallel.
the file will have
```
"ComnanyTestIsert", "Firs Comment", "LA 132", "222-33-22", 1
"ComnanyTestIsert1", "Seconds Comment", "LA 132", "222-33-22", 1
```
for example, I use 2 such... | 2020/12/09 | [
"https://Stackoverflow.com/questions/65213388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12947311/"
] | Parallel.For automatically adjusts the number of threads used but it can be specified in the [parallelOptions](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.paralleloptions?view=net-5.0) Parameter.
Do you have any reason to believe that doing this in parallel would improve performance? Multithrea... | The slow part of your process is the reading of the data in the file. Regularly your program would have to wait idly for the "hard disk" to provide a chunk of data. Instead of waiting idly, your program could already do some processing of the already fetched items.
Whenever you have a program where your process has to... |
234,788 | I am building a project which requires a very fine servo resolution (<=.1 degree). I understand there is a lot that goes into servo resolution like digital v analog, dead-band, # of poles, etcetera. However, all other things being equal, is there any reason to think that a micro servo would not be as precise as a stand... | 2016/05/17 | [
"https://electronics.stackexchange.com/questions/234788",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/82974/"
] | You can do this with an IC multiplier, however it will not be cheap. Also, note the bipolar supplies.
[](https://i.stack.imgur.com/YcZwp.png)
I suggest reducing the input resistor (to get gain on \$E\$) and using another op-amp (maybe half of a dual... | Use subtractor circuit to get voltage across AB and use a micro-controller like pic with internal ADC to monitor the voltage internally, and since you can operate a pic at about 20MHz, you can keep close watch on the parameter.
Just an idea. |
61,179,062 | I don't understand what is the actual need of having FabricTLSCA if we have PKI in place for secure communication. My assumption is that TLSCA is required for secure communication between different components. For example cert for my domain \*.abc.com can be used using PKI than why Fabric TLSCA is required to give cert... | 2020/04/12 | [
"https://Stackoverflow.com/questions/61179062",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6839994/"
] | The schema is case sensitive. If you wish to fix:
Goto:
./node\_modules/@angular/cli/lib/config/schema.json
At around line 27 you should find:
```
"projects": {
"type": "object",
"patternProperties": {
"^(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$": {
"$ref": "#/definitions... | There are 2 solutions which works for me 100% to overcome from the problem of "Property not allowed" in angular.json file.
1. Use the command in VS code cmd
Ctrl+C
choose option Y
or
2. Restart the VS code after editing in angular.json file
Hope it will helpful. |
74,577,836 | I want to update a series if it is missing a key, but my code is generating an error.
This is my code:
```
for item in list:
if item not in my_series.keys():
my_series = my_series[item] = 0
```
Where my\_series is a series of dtype int64. It's actually a value count.
My code above is generating the fol... | 2022/11/25 | [
"https://Stackoverflow.com/questions/74577836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2738545/"
] | You can multiply by a logical vector to get a conditional sum:
```
library(dplyr)
df %>%
group_by(subs_id) %>%
summarize(
ttl_amount = sum(amount),
amount = sum(amount * (flag == "taker"))
)
```
```
# A tibble: 3 × 3
subs_id ttl_amount amount
<dbl> <dbl> <dbl>
1 1 25 1... | Here's how I would do it:
```
library(dplyr)
subs_id <- c(1, 1, 2, 3, 3)
amount <- c(15, 10, 30, 20, 10)
flag <- c("target", "taker", "target", "taker", "target")
data <- data.frame(subs_id, amount, flag)
data_new <- data %>% group_by(subs_id) %>%
mutate(column_summary = sum(amount))
data_new$column_id <- ifel... |
29,994,123 | Hey guys I have two simple JavaScript page. One holds the function that returns the object. The other read the returned object.
Unfortunately I am unable to read the returned object.
main.js
```
var userObj = getUserInfo('2');
console.log(userObj); //undefined
console.log(userObj.name); //undefined
```
globals.js
... | 2015/05/01 | [
"https://Stackoverflow.com/questions/29994123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/522768/"
] | You don't return anything from `getUserInfo` so you shouldn't expect anything from it.
You are only returning something in the success callback function. That is is run asynchronously. It doesn't return anything for `getUserInfo`.
If you want to make your ajax call a separate function you can make it return a promise... | You are not returning anything.
The `success` callback function in the `$.ajax()` call is invoked asynchronously, meaning it is executed after the HTTP request is done.
Also, it is a different `function` than `getUserInfo`. At this point you are just **returning a value for the `success` function**.
I will suggest ... |
2,917,898 | I'm trying to compute clusters on a set of points in Python, using GeoDjango.
The problem:
Given a set of points, output a set of clusters of those points.
(i'm fine specifying # of clusters/cluster size/distance in advance to simplify)
There are a few [solutions](http://www.quanative.com/2010/01/01/server-side-marke... | 2010/05/27 | [
"https://Stackoverflow.com/questions/2917898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/200578/"
] | GeoDjango does not have any built in clustering support; this operation is not typically provided by any existing Open Source GIS application that you would be using with GeoDjango that I'm aware of.
Several sites running Django/GeoDjango (like everyblock.com) have published what their method is for clustering, but t... | As Christopher Schmidt mentioned, there doesn't seem to be any out of the box support for clustering in GeoDjango. However, if someone else runs into this issue, here's what I did:
* Installed mlpy and numpy
* Used the HCluster hierarchical clustering algorithm
* Wrote a wrapper function to convert the GEOS Point obje... |
4,149,976 | I have seen this reasoning elsewhere and I am not sure wether it is correct.
I think the reasoning behind it should be as follows: Suppose that T is inconsistent.
Then $T\_2$ is inconsistent with $T\_1$ and so there is $\phi \in T\_2$ such that $T\_1 \nvDash \phi$.
But I can't find a proof of why it is the case that ... | 2021/05/24 | [
"https://math.stackexchange.com/questions/4149976",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/867078/"
] | Not necessarily. Let $T\_1=\emptyset$ and $T\_2=\{\phi,\lnot\phi\}$ where neither $\phi$ nor $\lnot \phi$ is valid. ${}{}{}{}$ | Suppose that $T=T\_1 \cup T\_2$ is inconsistent, and $T, T\_1, T\_2 \neq \emptyset$ then by compactness, it is not the case that every finite subset of T is consistent.
As $T\_1, T\_2 \subseteq T$, w.l.o.g suppose that there is M such that $M \models T\_1$, then $M \nvDash T\_2$ so there is some $\phi \in T\_2$ such t... |
45,780,145 | I have a class Foo, which is a base class for a lot other classes such as Bar and Baz, and I want to do some calculation within Foo using the static members in Bar and Baz, as shown below:
```
public class Foo{
public result1 {
get{
return field1;
}
}
}
public class Bar : Foo{
... | 2017/08/20 | [
"https://Stackoverflow.com/questions/45780145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3908301/"
] | **Edit**
What you are asking for, i.e. accessing a `static` or `const` value in a subclass from a base class is technically possible, but doing so will violate the principals of good [SOLID OO](https://en.wikipedia.org/wiki/SOLID_(object-oriented_design)) design. Also, since you will need an instance of a specific su... | You either add constructor parameter to your `Foo` class which can be passed from inheritors, thus you don't need extra classes also you'll have less coupling
```
public class Foo
{
private readonly int _field1;
public Foo(int field1)
{
_field1 = field1;
}
}
```
or you can use it exactly fro... |
7,447,927 | If I have the following variable in javascript
```
var myString = "Test3";
```
what is the fastest way to parse out the "3" from this string **that works in all browsers (back to IE6**) | 2011/09/16 | [
"https://Stackoverflow.com/questions/7447927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653/"
] | Since in Javascript a string is a char array, you can access the last character by the length of the string.
```
var lastChar = myString[myString.length -1];
``` | Use the `charAt` method. This function accepts one argument: The index of the character.
```
var lastCHar = myString.charAt(myString.length-1);
``` |
3,886,484 | I have SQL Server stored procedures which have several inputs. I want to save time from manually creating C# ADO.NET sqlParameter arrays as in
```
sqlParameter[] sqlParameters =
{ new SqlParameter("customerID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, string.Empty, DataRowVersion.Defa... | 2010/10/07 | [
"https://Stackoverflow.com/questions/3886484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129001/"
] | ```
#!/bin/bash
echo show databases\; | mysql -u root | (while read x; do
echo "$x"
y="$x"
done
echo "$y"
)
``` | ```
local count=$(mysql -u root --disable-column-names --batch --execute "SELECT COUNT(*) FROM mysql.user WHERE user = '$DstDbName'")
if [[ "$count" > 0 ]]
then
fi
```
--batch - do clear output w/o borders
--disable-column-names - prints only row with value
no creasy AWK used :) |
28,063,866 | Hello friends i want to add 10% of shipping price in magento shipping method during checkout :-
i follow this tutorial but it's not work for me :-
<http://www.blog.magepsycho.com/change-shipping-price-handling-fee-fly-magento/>
and my code is here :-
Config.xml :-
```
<?xml version="1.0"?>
<config>
<modules>
... | 2015/01/21 | [
"https://Stackoverflow.com/questions/28063866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4469145/"
] | Make sure that you put module configuration file under app/etc/modules folder. | Your config.xml code should be :-
```
<?xml version="1.0"?>
<config>
<modules>
<Ab_Extrashipcost>
<version>0.1.0</version>
</Ab_Extrashipcost>
</modules>
<global>
<models>
<extrashipcost>
<class>Ab_Extrashipcost_Model</class>
</extrashipcost>
</models>
... |
1,066,589 | What's the best way to iterate over the items in a [`HashMap`](https://docs.oracle.com/javase/10/docs/api/java/util/HashMap.html)? | 2009/06/30 | [
"https://Stackoverflow.com/questions/1066589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84916/"
] | Extracted from the reference *[How to Iterate Over a Map in Java](http://www.sergiy.ca/how-to-iterate-over-a-map-in-java)*:
There are several ways of iterating over a `Map` in Java. Let's go over the most common methods and review their advantages and disadvantages. Since all maps in Java implement the Map interface, ... | You can iterate through the entries in a [`Map`](http://java.sun.com/javase/6/docs/api/java/util/Map.html) in several ways. Get each key and value like this:
```
Map<?,?> map = new HashMap<Object, Object>();
for(Entry<?, ?> e: map.entrySet()){
System.out.println("Key " + e.getKey());
System.out.println("Value ... |
36,771,685 | I am working on my final project in my final grade.
I'm currently working on a site linked with mysql for a dance school.
I want to check if a checkbox returns a value or not.
It gives a "undefined index"-error at the "if($\_POST['dansstijl'.$i.''])" and I don't know what i'm doing wrong.
Sorry if there are parts in d... | 2016/04/21 | [
"https://Stackoverflow.com/questions/36771685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6236013/"
] | This is expected behavior. Parent project (your phoenix app) is not using configuration from deps. If dependencies require configuration you need to specify it in the parent app, so you would need to copy:
```
config :wikix, http_client: Wikix.HTTPClient
config :wikix, user_agent: [{"User-agent", "tugorez tugorez@gmai... | I can't completely decipher your question but I think the answer to [this question](https://stackoverflow.com/questions/23897199/how-to-read-config-files-on-elixir-mix-project) might be what you're looking for. Specifically this part:
>
> You can read keyword lists stored in a \*.exs file, using
> Mix.Config.read(pa... |
18,628,074 | I have found this crazy javascript code.
Can someone elaborate the exact steps this code is going through and why?
```
(function a(a){
return a;
})
(function b(b){
return b;
})
(function c(c){
return c;
})
(true);
``` | 2013/09/05 | [
"https://Stackoverflow.com/questions/18628074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/692528/"
] | * This will self-invoke `a` which is given `function` `b` as argument (since `a` is defined as a *variable* inside `a`'s local scope that will take presence over the *function* `a` which is declared in parent scope.).
* Then it will self-invoke `b` which is given `c` as as argument.
* Finally function `c` is self-invok... | I'll take a stab at it.
```
(function a(a){
return a;
})
(function b(b){
return b;
})
(function c(c){
return c;
})
(true);
```
These are all self-invoking functions.
But the last one:
```
(function c(c){
return c;
})
(true);
```
Gets the value true passed in. So, when it returns "c" - you ge... |
14,632,178 | First of all, please be patient, because I don't speak english very well and I don't know if I will manage to explain the solution very well. So...
I have this HTML
```
<div id='container'>
<div class='picture'>
<img src='...'>
</div>
<div class='description'>
<div id='attrb1' class='cle... | 2013/01/31 | [
"https://Stackoverflow.com/questions/14632178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162049/"
] | <http://jsfiddle.net/UQngw/>
When I disable css
```
.clearfix {
#display: inline-block;
}
```
Look like `display: line-block;` let the div as width as it can.
**UPDATE**
Well, I just find that my code have some problem when the text so long...
<http://jsfiddle.net/HbCaK/3/>
I have disabled the followi... | Use min-width for .picture instead:
```
.picture { float: left; min-width: 100px; }
.picture img { width: auto height: auto; }
.description { float: right; width: 815px; }
```
When the img tag is removed from the picture div the layout should collapse like what I think you are asking for. |
2,164,558 | Let $N\_t$ be a Poisson process of rate $\lambda$.
1)What is $P(N\_s = 1|N\_t =1)$ for $0<s<t$?
2) Find the distribution of the time of the first point of the process, conditional on the event that exactly one point occurs in the interval [0,t]?
I know $P(N\_t = 1)=e^{-\lambda t}(\lambda t)$. I was wondering based... | 2017/02/27 | [
"https://math.stackexchange.com/questions/2164558",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | Those steps are correct, but there's one final step required:
6. When $x=1$, the left-hand side is $2$ and the right-hand side is $2$; when $x=6$, the left-hand side is $3$ and the right-hand side is $-3$. So only the first "solution" is a solution. (Er. When I did this the first time, I wrongly thought that the RHS i... | It's only **valid** to square the equation when both sides are **positive**.
In your second line you **need** to have a condition $3-x\geq 0 $ which simplifies to $x\leq 3$.Also you must have your square root defined i.e $x+3\geq 0$ or $x\geq -3$.
Now that we've done that we can see that $x=6$ is *not* a solution to ... |
233,042 | [In this question](https://softwareengineering.stackexchange.com/questions/232969/how-much-effort-should-i-invest-in-creating-loosely-coupled-designs) I asked: Is the cost of designing more levels of abstraction to allow loose coupling worth the benefits, or not?
People said that it's often worth the cost, but one sho... | 2014/03/20 | [
"https://softwareengineering.stackexchange.com/questions/233042",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/121368/"
] | I'd advise against approach 1. Writing code is a process of discovery - just like no plan survives contact with the enemy, every design will have flaws that are only caught once you start implementing it. Besides, you can abstract anything in an arbitrary number of directions and levels. If you design for too many "wha... | The Python community has this wonderful artifact: "Guido's Time Machine". That is, many marvel at Guido Van Rossum's foresight in setting up syntax and mechanisms in Python that just proved to work very cleanly and intuitively over time.
Not everyone has a time machine, though, and anticipating requirements can be tri... |
12,197,191 | Is there a way to avoid merge conflicts in version tag in `pom.xml` when merging master into a branch? I have quite a few pom files, 80, and all of them have same version which is different from one in master. It's laborious and time-consuming to execute `git mergetool` for 80 pom files just for a version tag. | 2012/08/30 | [
"https://Stackoverflow.com/questions/12197191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/411709/"
] | You could also use a custom merge driver, as in [pom-merge-driver](https://github.com/agusmba/pom-merge-driver).
Depending on your workflow you might want to merge pom as a normal file, except treating the project version differently: always take the merging branch version, or make an exception when merging to the deve... | I had the same problem and all solutions that i found didn't do it, imo, correct. Finally i wrote a merge driver which only takes care of the project/parent version and only them. No dependency version is changed nor the format of the xml file.
I released it a few minutes ago @ <https://github.com/cecom/pomutils>. If... |
1,253,430 | I'm writing a custom log4j appender, and I want to rely on another configured appender as a fallback, in case my (Database) appender fails.
How can I guarantee order of construction of the appenders? My appender's `activateOptions()` method tries to access another appender and fails because it's not constructed/regist... | 2009/08/10 | [
"https://Stackoverflow.com/questions/1253430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11236/"
] | I suggest to move/copy the config options for the second appender into the config of your custom appender and then create the second appender yourself inside of your custom appender. | If you are using a configration file in XML, then you can take advantage of the fact that the order of declaration of appenders in an XML file matters. The appender which is declared first will be configured first. If you are using a configuration file in .properties format, then their order of configuration depends on... |
54,566 | Assuming I have a form with a drop-down list and an "Advanced" button. The last button should be enabled only if certain options are selected in the drop-down list.

Now I'm wondering whether to disable the "Advanced" button when the other options are... | 2014/03/25 | [
"https://ux.stackexchange.com/questions/54566",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/45218/"
] | Generally speaking, disabling the button can be better for aesthetics as well as users recognizing that some options in the list will have more settings. Windows does this in the audio settings (the Advanced button is disabled if the device has no advanced options.)

![E... | Is it important for the user to know there is an advanced option for some cases? If not it's always better to get rid of things which you're not using in your interface and show them only when it's needed. |
72,660,620 | I would like to delete (`$pull`) nested array elements where one of the element's properties is null and where the array has more than one element.
Here is an example. In the following collection, I would like to delete those elements of the `Orders` array that have `Amount` = `null` and where the `Orders` array has m... | 2022/06/17 | [
"https://Stackoverflow.com/questions/72660620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2274701/"
] | You can check these conditions in the update query, check 2 conditions
* Amount is null
* check the expression `$expr` condition for the size of the `Orders` array is greater than 1
```
db.TestProducts.updateMany({
"Orders.Amount": null,
"$expr": {
"$gt": [{ "$size": "$Orders" }, 1]
}
},
{
"$pull": {
... | an example
an example might help:
```
let feed = await Feed.findOneAndUpdate(
{
_id: req.params.id,
feeds: {
$elemMatch: {
type: FeedType.Location,
locations: {
$size: 0,
},
},
},
},
{
$pull: {
... |
15,062,641 | I have a php object that is working fine. I'm now trying to get one public function to call a private one and I can't get it working...
```
// Join - Headline & About Me
public function updateHeadlineAboutMe($joinHeadline, $joinAboutMe) {
// Profanity Audit Member Text
$prof_headline = profanityAudit($joi... | 2013/02/25 | [
"https://Stackoverflow.com/questions/15062641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/880413/"
] | If the functions are inside an object, you will need to use `$this`.
```
$prof_headline = $this->profanityAudit($joinHeadline);
``` | If both functions are in the same class, you missed $this.
```
$prof_headline = $this->profanityAudit($joinHeadline);
```
The other line as well.
If they are not in the same class, you won't be able to call a private function, because it is the idea of private functions: not to be called from outside. |
2,971 | If you fit a non linear function to a set of points (assuming there is only one ordinate for each abscissa) the result can either be:
1. a very complex function with small residuals
2. a very simple function with large residuals
Cross validation is commonly used to find the "best" compromise between these two extrem... | 2010/09/22 | [
"https://stats.stackexchange.com/questions/2971",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/1134/"
] | A lot of people have excellent answers, here is my $0.02.
There are two ways to look at "best model", or "model selection", speaking statistically:
1 An explanation that is as simple as
possible, but no simpler (Attrib.
Einstein)
```
- This is also called Occam's Razor, as explanation applies here.
- Have a conce... | From an optimization point of view, the problem (with $(p,q)\geq 1,\;\lambda>0$),
$(1)\;\underset{\beta|\lambda,x,y}{Arg\min.}||y-m(x,\beta)||\_p+\lambda||\beta||\_q$
is equivalent to
$(2)\;\underset{\beta|\lambda,x,y}{Arg\min.}||y-m(x,\beta)||\_p$
$s.t.$ $||\beta||\_q\leq\lambda$
Which simply incorporates unt... |
10,453,300 | I have this:
```
<span id="social">
Facebook:
<input id="id_connected_to_facebook" type="checkbox" name="connected_to_facebook">
<br>
Twitter:
<input id="id_connected_to_twitter" type="checkbox" name="connected_to_twitter">
<br>
</span>
```
and with jQuery I would like to call a different URL... | 2012/05/04 | [
"https://Stackoverflow.com/questions/10453300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1075374/"
] | I am not sure what you are going for. If you want to redirect to a page on clicking on the check box you can do this
Specify what url you want to call in your checkbox element using data attribute
```
<input type="checkbox" data-target="http://www.facebook.com" />
```
Script is
```
$(function(){
$("input[type='... | ```
$('#id_connected_to_facebook, #id_connected_to_twitter').click(function(){
$.post('http://target.url', {this.id:this.checked});
});
```
now you'll get in $\_POST either id\_connected\_to\_facebook or id\_connected\_to\_twitter and as a value it would be 1 or 0 |
11,215,440 | Basically, given a base URL like
```
file:///path/to/some/file.html
```
And a relative URL like
```
another_file.php?id=5
```
I want to get out
```
file:///path/to/some/another_file.php?id=5
```
I found [this script](http://publicmind.in/blog/urltoabsolute/) (which is the same as [this one](http://nadeausoftwa... | 2012/06/26 | [
"https://Stackoverflow.com/questions/11215440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65387/"
] | You can use [parse\_url()](http://php.net/manual/en/function.parse-url.php) to get the URL broken into parts, and then split the 'path' portion on the forward-slash character. That should allow you to re-assemble them and replace the last portion.
Something like this (psuedo-code, untested, not sure it's even valid PH... | ```
$ab="file:///path/to/some/file.html";
$rel="another_file.php?id=5";
$exab=explode("/",$ab);
$exab[count($exab)-1]=$rel;
$newab=implode("/",$exab);
```
Probably not the most elegant solution, but it works. |
3,462,236 | Suppose $f$ and $g$ are continuous on $[a,b]$ and $\int\_{a}^{b}f(x)dx=\int\_{a}^{b}g(x)dx$. Prove that there is $c\in [a,b]$ such that $f(c)=g(c)$.
So, I've had a tough time with this problem. I've looked at trying to prove by contradiction, or by contrapositive, and even directly. Graphically, we understand this can... | 2019/12/04 | [
"https://math.stackexchange.com/questions/3462236",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/713269/"
] | Integral Mean Value Theorem applied to
\begin{align\*}
(f-g)(c)=\dfrac{1}{b-a}\int\_{a}^{b}(f-g)(x)dx=0.
\end{align\*} | Suppose one of the antiderivatives of f(x) is F(x), and one of the antiderivatives of g(x) is G(x). Then F(b)-F(a)=G(b)-G(a) with F and G continuous on [a,b] and differentiable on (a,b). By Cauchy's mean value theorem, $$1=\frac{F(b)-F(a)}{G(b)-G(a)}=\frac{F'(\xi)}{G'(\xi)}=\frac{f(\xi)}{g(\xi)}$$ for some $\xi\in(a,b)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.