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 |
|---|---|---|---|---|---|
3,336,726 | I have the sequence $a\_n=(n^3)\big(\frac{3}{4}\big)^n$
and I need to find whether it converges or not and the limit.
I took the common ratio which is $\frac{3 (n+1)^3}{4 n^3}$ and since $\big|\frac{3}{4}\big|<1$ it converges.
I don't know how to find the limit from here. | 2019/08/28 | [
"https://math.stackexchange.com/questions/3336726",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/680718/"
] | There are a number of ways to approach this problem. As others have mentioned, the convergence of $\displaystyle \sum^\infty n^3(3/4)^n$ implies $n^3(3/4)^n \to 0$ as $n \to \infty$, and it looks like this is what you're trying to exploit.
>
> **Exercise**: If $\displaystyle \lim\_{n \to \infty} a\_n \neq 0$, prove t... | >
> I can see that he proves how the sequence converges but i can't understand how he finds the limit.
>
>
>
You seem to mix (the convergence of) sequence and series.
>
> I took the common ratio which is $\frac{3}{4}$ and since $|\frac{3}{4}|<1$ it converges.
>
>
>
If by *"it converges"* you mean that the s... |
42,854,365 | Here i am tryning to add a new row but it's crashing and giving the error "attempt to insert row 3 into section 2, but there are only 3 rows in section 2 after the update". Intially the emerCount is 2 and i am trying to add 3rd row.
```
var index = NSIndexPath()
if (emerCount<3){
emerCount += 1
i... | 2017/03/17 | [
"https://Stackoverflow.com/questions/42854365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4263791/"
] | Try connecting to the instance via the serial console: <https://cloud.google.com/compute/docs/instances/interacting-with-serial-console>. From there you should be able to repair the firewall rules. | pjhsea I tried your steps and it is connecting to serial port but it asks passphrase. I was not sure where I have given this passphrase. If you try to access serial port on **gcloud** console then it always asks for passphrase.
So I tried below steps and I was able to connect to serial port to change firewall setting ... |
59,296,801 | When I run the following command, I expect the exit code to be 0 since my `combined` container runs a test that successfully exits with an exit code of 0.
```
docker-compose up --build --exit-code-from combined
```
Unfortunately, I consistently receive an exit code of 137 even when the tests in my `combined` contain... | 2019/12/12 | [
"https://Stackoverflow.com/questions/59296801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7489488/"
] | Docker exit code 137 implies Docker doesn't have enough RAM to finish the work.
Unfortunately Docker consumes a lot of RAM.
Go to Docker Desktop app > Preferences > Resources > Advanced
and increase the MEMORY - best to double it. | The error message strikes me as: `Aborting on container exit...`
From [docker-compose docs](https://docs.docker.com/compose/reference/up/):
>
> **--abort-on-container-exit** Stops all containers if any container was stopped.
>
>
>
Are you running docker-compose with this flag? If that is the case, think about wh... |
54,120 | I am looking for the way to get the similarity between two item names using integer encoding or one-hot encoding.
For example, "lane connector" vs. "a truck crane".
I have 100,000 item names consisting of 2~3 words as above.
also, items have its size(36mm, 12M, 2400\*1200...) and unit(ea, m2, m3, hr...)
I wanna... | 2019/06/20 | [
"https://datascience.stackexchange.com/questions/54120",
"https://datascience.stackexchange.com",
"https://datascience.stackexchange.com/users/76321/"
] | I'm not sure, if it's possible with this data set. Word2Vec is used to generate word embedding, which works on the principle of "words association" in a sentence.
So I dont think you can apply Word2Vec on this dataset which looks like doesn't have any association, except on some places where you can match(perform clus... | Okay, so what I understand is you just have a list of words and want to get word vectors for those. You are correct that you cannot train a word2vec model as it requires a corpus. But what you can do is use a pre-trained model (word2vec or glove). I suggest you use word2vec as gensim has a pretty simple implementation.... |
13,137,463 | I have tried:
```
const ascii = "abcdefghijklmnopqrstuvwxyz"
const letter_goodness []float32 = { .0817,.0149,.0278,.0425,.1270,.0223,.0202, .0609,.0697,.0015,.0077,.0402,.0241,.0675, .0751,.0193,.0009,.0599,.0633,.0906,.0276, .0098,.0236,.0015,.0197,.0007 }
const letter_goodness = { .0817,.0149,.0278,.0425,.1270,.02... | 2012/10/30 | [
"https://Stackoverflow.com/questions/13137463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205270/"
] | An array isn't immutable by nature; you can't make it constant.
The nearest you can get is:
```
var letter_goodness = [...]float32 {.0817, .0149, .0278, .0425, .1270, .0223, .0202, .0609, .0697, .0015, .0077, .0402, .0241, .0675, .0751, .0193, .0009, .0599, .0633, .0906, .0276, .0098, .0236, .0015, .0197, .0007 }
``... | From [Effective Go](https://golang.org/doc/effective_go.html#constants):
>
> Constants in Go are just that—constant. They are created at compile time, even when defined as locals in functions, and can only be numbers, characters (runes), strings or booleans. Because of the compile-time restriction, the expressions th... |
23,349,855 | For a lab we are required to read in from binary files using low level io (open/lseek/close not fopen/fseek/fclose) and manipulate the data. My question is how do I read or write structs using these methods.
The struct is as follows
```
typedef struct Entry {
char title[33];
char artist[17];
int val;
... | 2014/04/28 | [
"https://Stackoverflow.com/questions/23349855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2929589/"
] | The low-level functions might be OS specific. However they are generally these:
```
fopen() -> open()
fread() -> read()
fwrite() -> write()
fclose() -> close()
```
Note that while the 'fopen()' set of functions use a 'FILE \*' as a token to represent the file, the 'open()' set of functions use an integer (int).
U... | Here you go:
```
Entry_T t;
int fd = open("file_name", _O_RDONLY, _S_IREAD);
if (fd == -1) //error
{
}
read(fd, &t, sizeof(t));
close(fd);
``` |
33,217,241 | I got a linear layout that I want to move up when a Snackbar appears.
I saw many examples how to do this with FloatingButton, but what about a regular view? | 2015/10/19 | [
"https://Stackoverflow.com/questions/33217241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1129332/"
] | Based on @Travis Castillo answer. Fixed problems such as:
* Moving entire layout up and cause the objects on top of view disappear.
* Doesnt push the layout up when showing SnackBars immediately after eachother.
So here is fixed code for `MoveUpwardBehavior` Class :
```java
import android.content.Context;
import an... | @Markymark propose great solution, but on the first frame of snackbar there is translationY==0, on second translationY==full height and start decreasing correctly, so dependent layout janks on the first frame. This can be fixed by skipping first frame + restoring original padding as good side effect.
```
class MoveUpw... |
177,007 | I was wondering if I can use the aac codec in my commercial app for free (through lgpl ffmpeg). It says on the wiki:
>
> No licenses or payments are required to be able to stream or distribute content in AAC format.[36] This reason alone makes AAC a much more attractive format to distribute content than MP3, particul... | 2012/11/24 | [
"https://softwareengineering.stackexchange.com/questions/177007",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/72932/"
] | **(This answer is not legal advice. You should speak to an experienced patent attorney.)**
### What to do about AAC
If I needed to encode or decode AAC, I would rely on operating system APIs where the OS or hardware vendor has licensed the AAC patents AND the patents for similar audio technologies:
* **Windows**: [M... | Android apps like TuneIn radio use the FFMPEG decoder and I cannot believe that such a popular app is paying a per download licence fee for that.
I note the the BBCs rather nifty iPlayer Radio app uses HLS to deliver the audio directly to the media player. This is how it should be done. |
51,664,591 | In my application, I am using third party authentication to log a user in and then set a token in his localstorage. I'm writing a service to cache the profile information, which takes that user's auth token and calls a `getUser()` backend method to give me back the user profile information.
The issue is that there is ... | 2018/08/03 | [
"https://Stackoverflow.com/questions/51664591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4059156/"
] | As stated in my comment, your problem of wanting to wait for `this._authService.getUser()` to complete doesn't make sense, because if `this._authService.getUser()` is synchronous (as stated by you), then it will always complete before the next line of code is executed.
Anyways, after reading your code I think I know ... | My implementation:
```
setUserProfile() {
this.userProfile$ = this._authService.isLoggedIn(this.activatedRoute.snapshot).pipe(
concatMap(() => {
return this._adService.getUser(this._authService.getUser()).pipe(
map(result => result[0]),
publishReplay(1),
refCount()
... |
1,319,603 | Is it possible to view the PHP code of a live website ? | 2009/08/23 | [
"https://Stackoverflow.com/questions/1319603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/123663/"
] | You can't do that.
Because the server side script (here PHP scripts) execute on the web server and its output is embedded inside HTML which is then thrown back to your browser.
So all you can view is the HTML.
Just imagine, if what you asked was possible, then evryone would have the source code of facebook, flipkart in... | check out `php://input` and `php://filter/convert.base64-encode/resource=<filepath>`, eg. <http://level11.tasteless.eu/index.php?file=php://filter/convert.base64-encode/resource=config.easy.inc.php> |
11,034,322 | You have the `EntityManager.find(Class entityClass, Object primaryKey)` method to find a specific row with a primary key.
But how do I find a value in a column that just have unique values and is not a primary key? | 2012/06/14 | [
"https://Stackoverflow.com/questions/11034322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1008572/"
] | You can use a Query, either JPQL, Criteria, or SQL.
Not sure if your concern is in obtaining cache hits similar to find(). In EclipseLink 2.4 cache indexes were added to allow you to index non-primary key fields and obtain cache hits from JPQL or Criteria.
See,
<http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic... | TL;DR
With in DSL level - [JPA](https://docs.oracle.com/javaee/7/api/javax/persistence/package-summary.html) no practice mentioned in previous answers
>
> How do I find a value in a column that just have unique values and is not a primary key?
>
>
>
There isn't specification for query with custom field with in r... |
45,793,451 | I have backend that return me some json.
I parse it to my class:
```
class SomeData(
@SerializedName("user_name") val name: String,
@SerializedName("user_city") val city: String,
var notNullableValue: String
)
```
Use gson converter factory:
```
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(ENDPOINT)... | 2017/08/21 | [
"https://Stackoverflow.com/questions/45793451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5417224/"
] | Yes, that is because you're giving it a default value. Ofcourse it will never be null. That's the whole point of a default value.
Remove `=""` from constructor and you will get an error.
Edit: Found the issue. GSON uses the magic `sun.misc.Unsafe` class which has an `allocateInstance` method which is obviously cons... | Try to override constructor like this:
```
class SomeData(
@SerializedName("user_name") val name: String,
@SerializedName("user_city") val city: String,
var notNullableValue: String = "") {
constructor() : this("","","")
}
```
Now after server response you can check the **notNullableValue... |
39,790,281 | I want to generate running serial no like 0001, 0999, 1100, 19300 with leading padded zeros until four characters. I have written below query to generate that number.
```
Select Right(Power(10, 4) + 02, 4)
Select Right(Power(10, 4) + 102, 4)
Select Right(Power(10, 4) + 10002, 4)
```
**Actual Result:-**
0002
0102... | 2016/09/30 | [
"https://Stackoverflow.com/questions/39790281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1875682/"
] | The generator solution you are looking for would be
```
function* range(i, end=Infinity) {
while (i <= end) {
yield i++;
}
}
// if (this.props.total > 1) - implicitly done by `range`
for (let page of range(1, this.props.total) {
active = page === +this.props.current;
}
``` | For generating any range of sequential integers of length `k` starting at `n` in JavaScript the following should work:
```
Array.apply(null, Array(k)).map((x, i) => i + n);
```
While not *quite* the same as the coffeescript range functionality, its probably close enough for most uses. Also despite being significantl... |
31,074,739 | In order to insert GA code (and pretty much any other JS library), the code snippet is:
```
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.paren... | 2015/06/26 | [
"https://Stackoverflow.com/questions/31074739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1620081/"
] | Google knows that the script they have is not dependent on any other script in the page, therefore they are enforcing that the script is executed as 'non-blocking' meaning that the script content is executed ASAP, outside of the usual tag ordering within the document (it does not have any dependencies).
The [implement... | According to Google's [docs](https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced), they do recommend the simpler `<script src>` version but **only** if you're targeting modern browsers (excluding IE 9). |
128,952 | i currently have a client that will be adding replicated data from satellite locations in the number of approximately 80TB per year. with this said in year 2 we will have 160TB and so on year after year. i want to do some sort of raid 10 or raid 6 setup. i want to keep the servers to approximately 4u high and rack moun... | 2010/04/02 | [
"https://serverfault.com/questions/128952",
"https://serverfault.com",
"https://serverfault.com/users/90428/"
] | We are using CORAID shelves for some of our stuff. The last shelf we are setting up is a 24 port filled up with 2tb drives <http://www.coraid.com/PRODUCTS/SR-Series/SR2421-EtherDrive-Storage-Appliance_2> . We got 4 shelves so far. It takes up 4u, is certified with vmware and has linux & windows drivers available (I use... | Are you willing to build your own? Or are you looking at a vendor solution? Do you need to access the data as a single volume, or, will your system handle figuring out which server your data is on? Are you concerned with having at least two copies of your data on disparate systems or are you handling backups in additio... |
55,674,130 | ```swift
var input = [readLine() ?? ""]
```
If I just entered, input has `[""]`
If I do not input anything, I want to make the input an empty list.
How can I do it?
This is because I want the count of the input to be zero when the input is empty. | 2019/04/14 | [
"https://Stackoverflow.com/questions/55674130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11211656/"
] | To add a sort of combination between GhostCat's answer and Dr Phil's answer, you could have a text file that contains the server IP that is simply read by your Java class at class-initialization time. The text file would be a *resource* (i.e. it's bundled inside in your JAR file).
```
public class Main {
public s... | Include that file in your project with the original package. While compiling your class will be detected first instead of that client.jar. For this, in the compilation path, your class files should be in first instead of that client.jar. |
30,959 | What are the proper assumptions of Multinomial Logistic Regression? And what are the best tests to satisfy these assumptions using SPSS 18? | 2012/06/22 | [
"https://stats.stackexchange.com/questions/30959",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/12161/"
] | The key assumption in the MNL is that the errors are independently and identically distributed with a Gumbel extreme value distribution. The problem with *testing* this assumption is that it is made *a priori*. In standard regression you fit the least-squares curve, and measure the residual error. In a logit model, you... | gmacfarlane has been very clear. But to be more precise, and I assume you perform a cross section analysis, the core assumption is the IIA (independence of irrelevant alternatives).
You can not force your data fit into the IIA assumption, you should test it and hope for it to be satisfied. SPSS could not handle the ... |
41,500,569 | I have a file with too many data objects in JSON of the following form:
```
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-37.880859375,
... | 2017/01/06 | [
"https://Stackoverflow.com/questions/41500569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5329401/"
] | Here's a solution requiring just one invocation of `jq` and one of `awk`, assuming the input is in a file (input.json) and that the N-th component should be written to a file /tmp/file$N.json beginning with N=1:
```
jq -c '.features = (.features[] | [.]) ' input.json |
awk '{ print > "/tmp/file" NR ".json"}'
```
A... | I haven't tested this code properly. But should provide you some idea on how you can solve the problem mentioned above
```js
var json = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"t... |
21,768,186 | From this link I would like to display a MessageBox like the one
[UI](https://msdn.microsoft.com/en-us/library/windows/desktop/dn742478.aspx)
>
> Formatting will erase all the data on this disk.
>
>
>
On that the named the button Format
I am not finding that as a MessageBox.
How is that done?
Is this jus... | 2014/02/13 | [
"https://Stackoverflow.com/questions/21768186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/607314/"
] | This seems close:
<http://www.codeproject.com/Articles/201894/A-Customizable-WPF-MessageBox>
01234567890123456789 | There are some overloads on MessageBox.Show that can make that message:
```
MessageBox.Show("Formatting will erase all data on this disk. \nTo format the disk, click OK. To quit, click Cancel.",
"Format Local Disk (F:)",
MessageBoxButton.OKCancel,
MessageBoxImage.Exclamation);
```
The `MessageBoxBu... |
323,781 | How do I easily open my current vim buffers/arguments in a separate window/tab each?
I know about:
```
$ vim one.txt two.txt three.txt -O
```
However if I simply start vim with:
```
$ vim one.txt two.txt three.txt
```
How can I replicate this behaviour once I've already started vim? | 2011/08/16 | [
"https://superuser.com/questions/323781",
"https://superuser.com",
"https://superuser.com/users/41606/"
] | To split all buffers use `:sba` or `:vert sba` | How to convert buffers to windows/tabs:
* buffers > horizontal windows: `:ba` (buffer all)
* buffers > vertical windows: `:vert ba` (vertical buffer all)
* buffers > tabs: `:tab ba` (tab buffer all)
How to convert window/tabs to buffers:
* windows > buffers: `:on`, `:only` (current window only)
* tabs > buffers: `:t... |
64,155,219 | I have the following array:
```
a =['1','2']
```
I want to convert this array into the below format :
```
a=[1,2]
```
How can I do that? | 2020/10/01 | [
"https://Stackoverflow.com/questions/64155219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14207921/"
] | You could collect the data from both input arrays/lists into a set of pairs and then recollect the pairs back to two new lists (or clear and reuse existing `names`/`IDs` lists):
```java
List<String> names = Arrays.asList("ben","david","jerry","tom","ben");
List<String> IDs = Arrays.asList("123","23456","34567","123"... | You could add your names one by one to a set as long as `Set.add` returns true and if it returns false store the index of that element in a list (indices to remove). Then sort the indices list in reverse order and use `List.remove(int n)` on both your names list and id list:
```
List<String> names = ...
List<String> i... |
29,067,033 | I've got a string with some **HTML** in it.
I'd like to get the first two paragraphs
```
<p>content</p><p>content 2</p>
```
What would be the easiest way to do this? | 2015/03/15 | [
"https://Stackoverflow.com/questions/29067033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446835/"
] | Two examples:
```
var string = "<p>content</p><p>content 2</p>";
// EXAMPLE 1
var parser = new DOMParser().parseFromString(string, "text/html");
var paragraphs = parser.getElementsByTagName('p');
for(var i=0; i<paragraphs.length; i++){
console.log( paragraphs[i].innerHTML ); // or use `outerHTML`
}
// "content"
//... | Create a DOM element and put your html in it, like so:
```
var element = document.createElement('div');
element.innerHTML = "<html><p>content</p></html>"
```
You can then get the desired parts as a NodeList:
```
element.getElementsByTagName('p');
``` |
1,892,181 | It is states that ,Infinity is the notation used to denote greatest number.
And $\infty + \infty = \ infinity$
When my brother and i has discussed about it we have the following argument.
1. I say "infinity is not a real number".but my brother arguree with me
And my proof is like the one which follows
$$\infty + \in... | 2016/08/14 | [
"https://math.stackexchange.com/questions/1892181",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/355833/"
] | Good that you raised this question: What is infinity? The fact that the symbol $\infty$ appears so frequently in calculus textbooks in the notations like $x \to \infty$ and $n \to \infty$ seems to suggests that it is to be treated on the same footing as $1,2, 3, \pi$ etc (i.e. treated as a real number like we use the n... | If you add $\pm\infty$ to the real numbers it is no longer what we call a "field" and therefore the cancellation law no longer necessarily holds. You can extend the real numers to what we call the extended real numbers but you cannot extend all algebraic operations as you might like. That's the root of all such contrad... |
33,365,805 | I would like to have a Date Picker with only one wheel, filled with days as on the Date and Time mode.
[](https://i.stack.imgur.com/lzxkP.jpg)
If I choose the Date mode, I have 3 wheels and I loose the name of the day.
In fact I would like something ... | 2015/10/27 | [
"https://Stackoverflow.com/questions/33365805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5392802/"
] | You can also use **UIDatePicker**'s **pickerMode** property to do that.
```
datePicker.pickerMode = .Date
```
Look into header file, you will see that there are few other Options that you can play with. Other values are;
```
Time
Date
DateAndTime
CountDownTimer
``` | As you only need to show the contents that you have marked in the green box. You can use this <https://github.com/attias/AADatePicker> and modify it a bit and you can get it as per your requirement.
The changes you will need to make are within the AADatePickerView Class
1) In viewForRow method comment the following t... |
50,638,913 | I am using [jscolor](http://jscolor.com/) to pick a color with an input.
I wanted to style it but I can't get rid of the hex value of the color choosen and I didn't find any documentation about options.
**What I've tried :**
```
//It shows nothing
display: none
//It works but then the dot isn't properly aligned
fo... | 2018/06/01 | [
"https://Stackoverflow.com/questions/50638913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9114752/"
] | You're going to have to multiply each element, but something like this will ease the need to std::get on each element manually and multiply, and give the compiler a good chance to optimize.
```
#include <iostream>
#include <type_traits>
#include <tuple>
#include <iomanip>
template <typename T,typename Tuple, size_t..... | >
> How can I do this more efficiently?
>
>
>
In sense of execution performance: You cannot... Every multiplication will involve the FPU of your CPU, and every multiplication needs to be done separately *there*.
If you want to get simpler code (that, once compiled, still does the multiplications separately...), y... |
5,388 | I am a mom who has made two changes to my children's education so far. I was not satisfied with the level of education of school at the first school so we switched to a more rigorous academic environment. Unfortunately, the fit was horrible at the second school, including the teachers, admin and most importantly friend... | 2012/06/26 | [
"https://parenting.stackexchange.com/questions/5388",
"https://parenting.stackexchange.com",
"https://parenting.stackexchange.com/users/2869/"
] | From moving various schools myself when I was younger I would say that changing schools is a very big upset to learning - the child takes time to make new friends, settle in, understand the new curriculum etc.
If you can supplement their learning at home I would recommend doing that - being a teacher you will probably... | You are obviously getting a lot of answers, this is a tough one. I taught preschool for two years and middle school (in what were supposedly highly rated, academically rigorous schools) for eight. I also taught twice exceptional kids for three (these are the ones that are often the targets of school "socialization" and... |
7,240,698 | I'd like to test the value of an enumeration attribute of a DOORs object. How can this be done? And where can I find a DXL documentation describing basic features like this?
```
if (o."Progress" == 0) // This does NOT work
{
// do something
}
``` | 2011/08/30 | [
"https://Stackoverflow.com/questions/7240698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/89004/"
] | For multi-valued enumerations, the best way is `if (isMember(o."Progress", "0")) {`. The possible enumerations for single and multi-enumeration variables are considered strings, so Steve's solution is the best dxl way for the single enumeration. | If you're talking about the "related number" that is assignable from the Edit Types box, then you'll need to start by getting the position of the enumeration string within the enum and then retrieve `EnumName[k].value` .
I'm no expert at DXL, so the only way to find the index that I know of off the top of my head is t... |
34,978,260 | I've been trying for the last three days (yeah) to make a image/short video tagging system for my own use but this has proven a challenge beyond me.
These are the strings:
```
d:\images\tagging 1\GIFs\kung fu panda, fight.webm
d:\images\tagging 1\GIFs\kung fu panda, fight (2).webm
d:\images\tagging 1\GIFs\kung fu pan... | 2016/01/24 | [
"https://Stackoverflow.com/questions/34978260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5833369/"
] | Your question isn't very clear, but I *think* you want to parse filenames. If that's the case, I wouldn't recommend using `re` as your primary tool.
Instead, have a look at [`os.path`](https://docs.python.org/3/library/os.path.html#module-os.path):
```
import os.path # Or `import ntpath` for Windows paths on non-Win... | Get the basename, substitute integers in parentheses and the extension with the empty string and strip off the whitespace.
```
from ntpath import basename
import re
map(str.strip, re.sub('\(\d+\)|\.\w+$', '', basename(s)).split(','))
```
Demo:
```
>>> s = 'd:\images\tagging 1\GIFs\kung fu panda, fight.webm'
>>> map... |
12,849,717 | I'm trying to expand this div across with width of the browser. I've read from
[here](https://stackoverflow.com/questions/5590214/make-child-div-stretch-across-width-of-page "here")
that you can use `{position:absolute; left: 0; right:0;}` to achieve that as in the jsfiddle here:
<http://jsfiddle.net/bJbgJ/3/>
But th... | 2012/10/11 | [
"https://Stackoverflow.com/questions/12849717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1411027/"
] | You can try adding `overflow:visible` to the parent `div`, then making the child wider than the parent. | None of the answers above mention the best way of doing this, using `position:relative` on the full width container and `position:absolute;left:0;width:100%;` on div inside that is inside any centralised/offset div, as long as no other containers have declared position:relative, this will work. |
31,738,762 | I have a div which have 3 inputs:
```
<div class="excelPreview">
<a href="#" id="getContent" class="btn btn-primary">get</a>
<a href="#" id="calculate" class="btn btn-primary">calculate</a>
<div class="getThis">
Title
<div>ID</div>
<div>Name</div>
<p>Content here....</p>
<input type="text" id... | 2015/07/31 | [
"https://Stackoverflow.com/questions/31738762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4298298/"
] | You can use `clone`. `clone` will copy the whole div with all the events also.
```
$('#getContent').on('click', function() {
var cont = $('.getThis').clone(true);
$(".excelPreview").append(cont);
})
```
[Fiddle](https://jsfiddle.net/j61t7qww/) | ```
var sum=$('#num2).val()+$('#num2).val();
$('#total).val(sum);
``` |
72,814,362 | ```
pragma solidity >=0.5.0 <0.6.0;
contract ZombieFactory {
uint dnaDigits = 16;
uint dnaModulus = 10 ** dnaDigits;
struct Zombie {
string name;
uint dna;
}
Zombie[] public zombies;
function createZombie (string memory _name, uint _dna) public {
// start here
}
... | 2022/06/30 | [
"https://Stackoverflow.com/questions/72814362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15906729/"
] | IIUC for get all negative values use [`boolean indexing`](http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#boolean-indexing):
```
out = s[s.lt(0)]
```
If need absolute values use [`Series.abs`](http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.abs.html):
```
out = s.abs()
... | put array indexes according to your code
```
df.index.get_level_values(0).drop_duplicates()[-2:]
``` |
27,487,972 | How do I make a .jar file out of the [Volley project](https://developer.android.com/training/volley/index.html) ([git repository](https://android.googlesource.com/platform/frameworks/volley))?
I have tried to follow the instructions in [this answer](https://stackoverflow.com/a/16721116/1274911), however running `andro... | 2014/12/15 | [
"https://Stackoverflow.com/questions/27487972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1274911/"
] | The build process for Volley has changed to Gradle. If you just want to use the library without building it, you can get the Jar from Maven or scroll down to the instructions to building it yourself lower in this answer.
**Maven**
An easier way to obtain the Jar file is to download it directly from Maven Central. You... | @Sateesh G answer is the better answer. Here are the steps I used to build volley as an aar on OS X. (Assuming you already have git, gradle, and android dev tools setup and working)
```
export ANDROID_HOME=~/.android-sdk/android-sdk-macosx
git clone https://android.googlesource.com/platform/frameworks/volley
cd volley... |
10,621,749 | I am trying to populate a drop down list
I have the following:
```
$('#dd_deg ').append($('<option></option>').val('hello').html('va1'));
```
What is the purpose of .val and .html. I see that val1 is what shows in the drop down but what is the purpose of .val | 2012/05/16 | [
"https://Stackoverflow.com/questions/10621749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996431/"
] | According to the docs, [.val(value)](http://api.jquery.com/val/)
>
> Set the value of each element in the set of matched elements.
>
>
>
And [.html(htmlString)](http://api.jquery.com/html/)
>
> Set the HTML contents of each element in the set of matched elements.
>
>
>
You typically use val to get/set the v... | `val()` sets the `value` attribute of the element, as opposed to `html(val)` which sets the inner-HTML of the element and, frankly, should be replaced with `text()` since it's a purely textual change/setting.
Incidentally, this question could have been easily enough answered by a visit to the jQuery API site, to use (... |
3,692,042 | I have been asked this question by a colleague that should we always include a default constructor in a class? If so, why? If no, why not?
***Example***
```
public class Foo {
Foo() { }
Foo(int x, int y) {
...
}
}
```
I am also interested to get some lights on this from experts. | 2010/09/11 | [
"https://Stackoverflow.com/questions/3692042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/309343/"
] | You have to keep in mind that if you don't provide an overloaded constructor, the compiler will generate a default constructor for you. That means, if you just have
```
public class Foo
{
}
```
The compiler will generate this as:
```
public class Foo
{
public Foo() { }
}
```
However, as soon as you add ... | A generic type can only be instantiated with C# means (without reflection) if it has a default constructor. Also, the `new()` generic type constraint has to be specified:
```
void Construct<T>()
where T : new()
{
var t = new T();
...
}
```
Calling this method using a type as generic type argument that ha... |
30,113,663 | I have a rather simple question with an inkling as to what the answer is.
My generalized question:
What is actually going on when you declare a member variable, be it public or private, and for all permutations of variable types, e.g. static vs const vs regular variables?
```
class some_class
{
private:
static co... | 2015/05/08 | [
"https://Stackoverflow.com/questions/30113663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1033323/"
] | Tricky question -- it's ambiguous depending on perspective.
From a pseudo-machine perspective, normally adding a non-static plain old data type to a class makes that class type bigger. The compiler also figures out how to align it and relative memory offsets to address it relative to the object in the resulting machin... | Yes and no.
A variable of class type in Java is *really* a pointer. Unlike C and C++ pointers, it doesn't support pointer arithmetic (but that's not essential to being a pointer--for example, pointers in Pascal didn't support arithmetic either).
So, when you define a variable of class type in Java: `String str;`, it... |
3,972,240 | The subject of this question speaks for itself. I am wondering if Fluent NHibernate is ready for production code. I am especially wondering in light of some seemingly simple problems that I am having with it that I haven't yet found fully satisfactory solutions for (and the community doesn't have a solution for?)
[Why... | 2010/10/19 | [
"https://Stackoverflow.com/questions/3972240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45914/"
] | By what metric do you measure "production ready"? How is production any more stringent than other environments? Only you can decide if it meets your needs.
Your first question you have a work around for. Fluent NHibernate is open source, if people aren't dying because of a bug (aka, there's a work around available), i... | This kind of question really should be asked over on their google group page: <http://groups.google.com/group/fluent-nhibernate>. Being an open source project that is constantly evolving with NHibernate itself, it will almost always be in a semi-flux state, especially with NH3 coming soon. |
21,375,148 | I have strings like those for example:
'1 hour'
'5 mins'
'1 day'
'30 secs'
'4 hours'
this strings represent the time past since something.
I want to convert them to the time (DateTime) that it happends
I tried to insert it to a timespan.parse but it throw an exception...
What is the best way to do something like tha... | 2014/01/27 | [
"https://Stackoverflow.com/questions/21375148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1612018/"
] | You may try using *Dictionary* for all the *names* are used:
```
public static TimeSpan ParseTimeSpan(String value) {
// Expand dictionary with values you're using, e.g.
// "second", "minute", "week" etc.
Dictionary<String, long> seconds = new Dictionary<String, long>() {
{"days", 86400},
{"day", 86400... | The second part in the string is *units*.
Dunno about format what you will have, but all those listead can be split and parsed like this:
```
// text is "1 hour" or "5 mins" or "1 day" or "30 secs" or "4 hours"
var item = text.Split(new char[] {' '});
var value = int.Parse(item[0]);
var unit = item[1];
// get lowest ... |
299,249 | I am struggling with testing a method that uploads documents to Amazon S3, but I think this question applies to any non-trivial API/external dependecy. I've only come up with three potential solutions but none seem satisfactory:
1. Do run the code, actually upload the document, check with AWS's API that it has been up... | 2015/10/07 | [
"https://softwareengineering.stackexchange.com/questions/299249",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/199400/"
] | You need to do both.
Running, uploading and deleting is an integration test. It interfaces with an external system and can therefore be expected to run slow. It should probably not be part of every single build you do locally, but it should be part of a CI build or nightly build. That offsets the slowness of those tes... | Adding to the previous answers, the main question is whether (and how) you want to mock the S3 API for your tests.
Instead of manually mocking individual S3 responses, you can take advantage of some very sophisticated existing mocking frameworks. For instance [moto](https://github.com/spulec/moto) provides functionali... |
2,205,455 | In solaris how to detect broken socket in send() call? i dont want to use signal.
i tried SO\_NOSIGPIPE and MSG\_NOSIGNAL but both are not available in Solaris and my program is getting killed with "broken pipe" error.
Is there any way to detect broken pipe?
Thanks! | 2010/02/05 | [
"https://Stackoverflow.com/questions/2205455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/258479/"
] | Heading are what their name suggests, they should be used for **headings** or **titles**. Heading make them bold as well as different sizes based on their level. For other piece of text, you have to decide whether you want to make it bold or not.
Also, heading tags are good for **search-engine-optimization**, the SEOs... | Unfortunately there is no definitive formula for whether some piece of text should be a heading or not. If you don't understand what your client is looking for, I suggest you ask the client. We have even less idea since we haven't seen the data. |
50,821,414 | I thought that part of the appeal of `table-layout:fixed` was that you could set your cell widths to be whatever you want and the browser would blindly accept them.
I have a situation where I have a containing div set to 900px width.
In it is a table, with 4 columns, each set to 300px width.
The div has a background... | 2018/06/12 | [
"https://Stackoverflow.com/questions/50821414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1058739/"
] | tl;dr
=====
* Do not use `DateUtil` whatever that is. (Perhaps Apache DateUtils library?)
* Do not use terrible old date-time classes such as `java.util.Date`.
* Use the modern industry-leading *java.time* classes.
Code for parsing a string lacking an offset, then assigning an offset of zero for UTC itself.
```
Loc... | You should use the latest classes [`java.time`](https://docs.oracle.com/javase/10/docs/api/java/time/package-summary.html) provided from Java8.
Steps are as follows:
**Step-1.** Parse `String` to `LocalDateTime`
**Step-2.** Convert `LocalDateTime` to the `ZonedDateTime` and then we can convert between different `tim... |
4,511,266 | **Problem**
Differentiate the following inverse trig. function for $x\in (-1, 1)$:
$$f(x) = \sec^{-1}\left(\sqrt{1+x^2}\right)$$
**Attempting to solve**
Putting $x = \tan(\theta)$ so that $\theta \in \left(\dfrac{-\pi}{4}, \dfrac{\pi}{4}\right)$
$$\begin{align}\implies f(x) & = \sec^{-1}\left(\sqrt{1+\tan^2\thet... | 2022/08/13 | [
"https://math.stackexchange.com/questions/4511266",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | The easiest way is through implicit differentiation.
Suppose that $y=\sec^{-1}{\sqrt{1+x^{2}}}$
This implies that $\sec{y}=\sqrt{1+x^{2}}$
Taking the derivative with respect to $x$, you get:
$\sec{y}\tan{y}\frac{dy}{dx}=\frac{x}{\sqrt{1+x^{2}}}$, by the product rule.
Isolating $\frac{dy}{dx}$, you get
$\frac{dy}{... | We can recognize six $ \theta$ related inverse function in six ways by drawing the originating triangle in trigonometry:
$$\theta=\sec^{-1}\sqrt{1+x^2} = \tan^{-1}x =\cos^{-1}\frac{1}{\sqrt{1+x^2} }=\sin^{-1}\frac{x}{\sqrt{1+x^2} } \text{ &..}$$
So we then can recognize to have a directly more common derivative of ar... |
5,875,464 | I currently have a Magento store where I'm using a CMS page as the homepage. I want to integrate my wordpress blog (hosted on the same server) into this CMS page. It would show the latest blog post and preferably have the comment function available on the front page. The first thing I considered was using the Wordpress... | 2011/05/03 | [
"https://Stackoverflow.com/questions/5875464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337903/"
] | The FishPig extension now supports this functionality so you achieve this by following these steps:
* Upgrade to the latest version of FishPig's WordPress Integration
* Login to your Magento Admin and go to WordPress > Settings Blog / Plugins
* Find the Layout option and set 'Blog as Magento Homepage' to Yes
* Save th... | You will be wanting the Fishpig integration:
<http://www.magentocommerce.com/magento-connect/fishpig/extension/3958/fishpig_wordpress_integration>
Not only is it free, it is also actively maintained.
You can also do an Apache redirect for the root/home page to a wordpress page of your choosing. In that way you don't... |
16,339,585 | There are 4 tables.
* items ( item\_id, item\_name, item\_owner)
* groups ( grp\_id, grp\_name, grp\_owner)
* users (grp\_id, usr\_ref)
* share (item\_id, grp\_id)
My objective is to get a list of all those items where item\_owner = user\_id ( say 123 ) or user\_id belongs to a group with which the item is shared.
A... | 2013/05/02 | [
"https://Stackoverflow.com/questions/16339585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2148105/"
] | You need `INNER JOIN` in this case because you need to get an item that has connection on all tables. Your current query uses `LEFT JOIN` that is why even an item that has not associated on any user will be shown on the list. Give this a try,
```
SELECT DISTINCT a.*
FROM items a
INNER JOIN `share` b
... | Perhaps I'm not understanding your question, but can you not just use `OR` with your first query:
```
select i.item_id from items i
left outer join share on share.item_id = i.item_id
left outer join users on users.grp_id = share.grp_id
left outer join groups on groups.grp_id = share.grp_id
where i.item_owner... |
18,033,419 | Recently I decided to start my third pygame game.In that game the player should fire at airplanes from the cannon in the bottom of the screen,by pointing to the airplane with the mouse.I putted the code in more modules(more.py files) for easier understanding.I started by trying to get cannon barel rotate towards mouse ... | 2013/08/03 | [
"https://Stackoverflow.com/questions/18033419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2564921/"
] | C++ is a language that puts the correctness of the code in the hand of the programmer. Trying to alter that via some convoluted methods typically leads to code that is hard to use or that doesn't work very well. Forcing the hand of the programmer so that (s)he has to create an object on the heap even if that's not "rig... | The answer by [Mats](https://stackoverflow.com/a/18033580/725021) is indeed wrong. The `make_shared` needs a public constructor.
However, the following is valid:
```cpp
class X
{
private:
int x;
X() : x( 42 ) {};
public:
static std::shared_ptr<X> makeX()
{
return std::shared_ptr<X>( new X() )... |
28,172 | I'd like some way to get notices of comments people make to my (questions, answers, comments), as well as changes to my reputation. Any chance that this could be added?
I'm sure I could script something up to scrape the webpage, but that's a lot less friendly than having it built in :) | 2009/11/02 | [
"https://meta.stackexchange.com/questions/28172",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/127120/"
] | Well, you can now mark this as complete. I have written a small app that does exactly this.
[Stack2RSS](https://stackapps.com/questions/1599/stack2rss-a-json-to-rss-conversion-service)
--------------------------------------------------------------------------------------------
Stack2RSS takes an API request and conve... | Native RSS feed for comments:
* `https://meta.stackexchange.com/feeds/user/`user-id`/responses`
* `https://stackoverflow.com/feeds/user/`user-id`/responses`
* Replace `user-id` with your own id. You can find your id in the URL of your own profile.
To get the feed for any domain:
1. Go to your account profile
2. Chec... |
34,616,727 | I have a blog system where user inputs the image url in the post content like
```
hey how are you <img src="example.com/image.png">
```
if the user has written like this
```
hello how are you <img src="example.com/image.png">
```
Then I want to find this `img` `src` line and use it as featured image
here is wh... | 2016/01/05 | [
"https://Stackoverflow.com/questions/34616727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | `strpos` returns the index of where the needle starts in the haystack. Look at combining the returned value with `substr` and `haystack` to get the substring you want. | This is most probably way easier with using a [Regular Expression (RegEx)](http://php.net/manual/en/book.pcre.php).
Here is an simple example:
```
$string = 'hey how are you <img src="example.com/image.png"> blah blah';
preg_match('/<img src=".*">/', $string, $matches);
print_r($matches);
```
Which would give you a... |
104,735 | I understand that similar questions like this one have been asked before on this site, listed below. However, I am confused about the answers. If I explain what I think I understand, can somebody please point out where i'm wrong?
* [why-more-bandwidth-means-more-bit-rate-per-second](https://electronics.stackexchange.c... | 2014/03/30 | [
"https://electronics.stackexchange.com/questions/104735",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/35366/"
] | It's a subtle point, but your thinking is going astray when you think of a 330-Hz tone as somehow conveying 660 bits/second of information. It doesn't — and in fact, a pure tone conveys no information at all other than its presence or absence.
In order transmit *information* through a channel, you need to be able to s... | This is only a partial answer, but hopefully it gets at the main points you're misunderstanding.
>
> My problem is that I'm having a hard time understanding why bandwidth relates to bit rate at all.
> ...
>
>
> If a zero is expressed as a 30 Hz carrier frequency, a one is expressed as a 330 Hz carrier frequency, a... |
50,798,329 | When you have a big POJO with loads of variables (Booleans, Int, Strings) and you want to use the new Work Manager to start a job. You then create a Data file which gets added to the one time work request object.
What would be the best practices to build this data file? (*It feels wrong to be writing 100 lines of code... | 2018/06/11 | [
"https://Stackoverflow.com/questions/50798329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2959931/"
] | This solution works without using JSON, and serializes directly to byte array.
```
package com.andevapps.ontv.extension
import android.os.Parcel
import android.os.Parcelable
import androidx.work.Data
import java.io.*
fun Data.Builder.putParcelable(key: String, parcelable: Parcelable): Data.Builder {
val parcel =... | In Kotlin, thats how I do it
Object to Json
```
inline fun Any.convertToJsonString():String{
return Gson().toJson(this)?:""
}
```
To Convert back to model,
```
inline fun <reified T> JSONObject.toModel(): T? = this.run {
try {
Gson().fromJson<T>(this.toString(), T::class.java)
}
catch (e:java.lang.Exc... |
3,748,648 | Let $X=(C[0,1],||\cdot||\_\infty)$ and $(Ax)(t)=x(t)+\int\_0^1 t^2s x(s)ds$, and $A:X\to X$, how to find $A^{-1}$
If it were not definite integral I could have changed it to the differential equation but I cannot do anything
I found the following link but cannot apply because again it is not indefinite integral in th... | 2020/07/07 | [
"https://math.stackexchange.com/questions/3748648",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/342943/"
] | If we multiply this by $t$ and integrate from $0$ to $1$, we get
$$\int\_0^1tTx(t)dt=\int\_0^1tx(t)dt+\left(\int\_0^1t^3dt\right)\left(\int\_0^1sx(s)ds\right)=\frac{5}{4}\int\_0^1sx(s)ds$$
We change the integration variable from $t\mapsto s$ on the left and then multiply by $4t^2/5$ and get
$$\frac{4}{5}t^2\int\_0^1... | Hint: try to find the operator $T^{-1}$ such that $T^{-1}Tx(t) = TT^{-1}x(t) = x(t),$ for all $x(t).$ |
63,942,902 | I had a task where I needed to compare and filter two `JSON` arrays based on the same values using one column of each array. So I used [this](https://stackoverflow.com/a/62187694/6621346) answer of [this](https://stackoverflow.com/questions/62180696/compare-2-json-arrays-to-get-matching-and-un-matching-outputs) questio... | 2020/09/17 | [
"https://Stackoverflow.com/questions/63942902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6621346/"
] | See if this works for you
```
%dw 2.0
output application/json
var file = [
{
"IDENTITY": "D40000",
"NM": "Delta",
"CODE": "D12"
},
{
"IDENTITY": "C30000",
"NM": "Charlie",
"CODE": "C11"
}
]
var db = [
{
"CODE": "A11",
"NAME": "Alpha",
... | You can make use of `filter` directly and using `contains`
```
db filter(value) -> file contains {IDENTITY: value.ID, NM: value.NAME, CODE: value.CODE}
```
This tells you to filter the db array based on if the file contains the object `{IDENTITY: value.ID, NM: value.NAME, CODE: value.CODE}`. However, this will not w... |
5,041,499 | I know, this question was asked before, but I haven't seen a working answer for it.
Is there any way to hide some items in a `ListView` without changing source data?
I tried to set visibility of the item view to gone, it won't be displayed anymore, but the place reserved for this item is still there.
I also set:
``... | 2011/02/18 | [
"https://Stackoverflow.com/questions/5041499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/408780/"
] | I tried several solutions including `setVisibitlity(View.GONE)` and inflating a default `null` view but all of them have a common problem and that's the dividers between hidden items are stacked up and make a bad visible gray space in large lists.
If your `ListView` is backed by a `CursorAdapter` then the best solutio... | For me a simple solution was to create my own adapter with a custom row layout, containing a wrapper of all content (e.g. LinearLayout), and set this wrapper visibility to View.GONE in the adapter's getView() method, when I did not want that item shown. No need to modify the data set or maintain two lists. When creatin... |
10,687 | I know correlation does not imply causation but instead the strength and direction of the relationship. Does simple linear regression imply causation? Or is an inferential (t-test, etc.) statistical test required for that? | 2011/05/11 | [
"https://stats.stackexchange.com/questions/10687",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/4572/"
] | There is nothing explicit in the mathematics of regression that state causal relationships, and hence one need not explicitly interpret the slope (strength and direction) nor the p-values (i.e. the probability a relation as strong as or stronger would have been observed if the relationship were zero in the population) ... | From a semantic perspective, an alternative goal is to build evidence for a good predictive model instead of proving causation. A simple procedure for building evidence for the predictive value of a regression model is to divide your data in 2 parts and fit your regression with one part of the data and with the other p... |
55,829,349 | I have an interface an enum and a type :
```
export interface Filters {
cat: Array<string>;
statuses: Array<Status | TopStatus>;
}
export enum Status {
ARCHIVED,
IN_PROGRESS,
COMING
}
export type TopStatus = Status.ARCHIVED | Status.IN_PROGRESS;
```
And in the method:
```
handleStatuses(myFilters: Fil... | 2019/04/24 | [
"https://Stackoverflow.com/questions/55829349",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7951032/"
] | U can try to put ur ajax code in a setInterval function
```
setInterval(function(){
//Here
}, 3000);
```
Edit: i meant setInterval | Try this then:
JS
```
$(document).ready(function () {
$.ajax({
url: "http://localhost/mycharts/api/data.php",
method: "GET",
success: function (data) {
console.log(data);
var subholding = [];
var TotalAccounts = [];
... |
33,089,808 | Hey everyone so I am trying to build a small sample printing app on android and can't seem to print an existing pdf. There is plenty of documentation on creating a custom document with the canvas but I already have the document. Basically I just want to be a able to read in a pdf document and send it as a file output s... | 2015/10/12 | [
"https://Stackoverflow.com/questions/33089808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4935793/"
] | We can simply achieve this by creating a custom `PrintDocumentAdapter`
PdfDocumentAdapter.java
```
public class PdfDocumentAdapter extends PrintDocumentAdapter {
Context context = null;
String pathName = "";
public PdfDocumentAdapter(Context ctxt, String pathName) {
context = ctxt;
this.pathName = pathName;
... | For those interested in the kotlin version of the [Karthik Bollisetti](https://stackoverflow.com/a/49298355/7680523) answer here is it.
The `PdfDocumentAdapter` is re-written as this
```
class PdfDocumentAdapter(private val pathName: String) : PrintDocumentAdapter() {
override fun onLayout(
oldAttributes: PrintA... |
45,822 | According to wikipedia a statement is either (a) a meaningful declarative sentence that is either true or false, or (b) that which a true or false declarative sentence asserts.
Is the sentence God exists a statement?
Me and some friend were discussing about the above sentence whether it is a statement or not. My answer... | 2017/09/04 | [
"https://philosophy.stackexchange.com/questions/45822",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/28528/"
] | The statement *God exists* is logical. But it is not necessarily true. You are confusing logic with truth.
Logic is like mathematics: it is just a set of rules. It doesn't presuppose a truth value for *x* or *y*. *x=3* could be true or false. It does not depend on logic.
Logic is just a method of reasoning regarding ... | According to your theory of truth, the truth value of some propositions are determined by subjective conditions. In your opinion, the proposition "God exists" falls into that category, but in my opinion it doesn't. Therefore, which propositions fall into that category is itself a matter of opinion.
Now, if we apply yo... |
40,751,254 | I'm programming a game(on a very basic level) for a school project in java using BlueJ, and I'm trying to split one constructor, containing a lot of information, into two or three separate constructors. The initial code, before my changes looks as follows:
```
public class Game
//fields omitted..
{
public Game(... | 2016/11/22 | [
"https://Stackoverflow.com/questions/40751254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7196504/"
] | In your code, `bedRoom` is a *local variable* not an attribute, hence you need to assign a value to it when you declare it. Currently, it's uninitialized and it won't even compile, because if it did, it would raise a `NullPointerException` as soon as your code is executed.
If you want to initialize variables inside th... | Variables `bedRoom` and `kitchen` have local scope, they don't exist outside the methods. You should declare them as class members. And `player` as well.
Now, you should think twice when you put class member initialization code into a private method. Why? Because that method can be called after construction, and it's ... |
3,752,519 | In the ribbon, I want to insert a picture or a link into a content page, but the "From Sharepoint" button is grayed out and I can only upload an image or insert a link "From Address". My field is rich text. I'm using SharePoint 2010.
How can I make the link available?
Thanks | 2010/09/20 | [
"https://Stackoverflow.com/questions/3752519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/437852/"
] | Do not muck with the ribbon to make this work!
Totally depends on how you want to use it.
First of all, the Publishing feature must be active on Site Collection level and on the site where you want to add your rich content.
Then, if you activate the Wiki Home page feature you will have the SharePoint option availabe... | Usually ribbon button is grayed out if you didn't add CommandUIHandler element for it in your CustomAction XML.
For more details, you can see this MSDN article:
<http://msdn.microsoft.com/en-us/library/ff458385.aspx>
Also, you can find useful this article (with sample code and screenshot):
<http://blogs.msdn.com/b/... |
47,510,689 | I have an array based MySql database.
This is the array.
```
[
0 => [
'id' => '1997'
'lokasi_terakhir' => 'YA4121'
]
1 => [
'id' => '1998'
'lokasi_terakhir' => 'PL2115'
]
2 => [
'id' => '1999'
'lokasi_terakhir' => 'PL4111'
]
]
```
How can I get the element `lokasi_terakhir` that g... | 2017/11/27 | [
"https://Stackoverflow.com/questions/47510689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4452417/"
] | Here are two refined methods. Which one you choose will come down to your personal preference (you won't find better methods).
In the first, I am iterating the array, declaring the first character of the `lokasi_terakhir` value as the key in the `$result` declaration. If the key doesn't yet exist in the output array t... | You can group those items like this:
```
$array = [
0 => [
'id' => '1997',
'lokasi_terakhir' => 'YA4121'
],
1 => [
'id' => '1998',
'lokasi_terakhir' => 'PL2115'
],
2 => [
'id' => '1999',
'lokasi_terakhir' => 'PL4111'
]
];
$res... |
6,840,367 | When I make a SQL query, for example, in database where there's a table named "employees", which is the best practice of writing?
```
SELECT 'name', 'surname', 'phone' WHERE 'city'='ny' FROM 'employees' ORDER BY 'name'
SELECT name, surname, phone, WHERE city=ny FROM employees ORDER BY name
```
or
```
SELECT employ... | 2011/07/27 | [
"https://Stackoverflow.com/questions/6840367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/864788/"
] | ```
SELECT `name`, `surname`, `phone` WHERE `city`='ny' ORDER BY `name`.
```
Note there's a difference between ` and '
(the first is used for the name of fields, and the other one is for strings).
Although the ` symbol is only strictly [necessary](https://stackoverflow.com/questions/261455/using-backticks-around-fiel... | Though it's mostly a matter of personal style, some forms have their advantages. My preference:
```
SELECT e.`name`, e.`surname`, e.`phone`
FROM `employees` e
WHERE e.`city`= 'ny'
OR e.`city` = 'wa'
ORDER BY e.`name`
```
1. Keywords in uppercase, tablenames in lowercase (if you create your tables lowercase or hav... |
3,263,832 | I have often the case where I want to return an `Enumerable<T>` from a method or a property. To build the returning `Enumerable<T>`, I use a `List<T>`-instance. After filling the list, I return the list.
I always thought that this is enough. But it exists the possibility that the caller casts the resulting `Enumerable... | 2010/07/16 | [
"https://Stackoverflow.com/questions/3263832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/340628/"
] | I think that your problem is farfetched because if someone improperly using your methods (making assumption about internal implementation), then actually that is not your problem.
But you if you using .net 3.5, then you can use [AsEnumerable](http://msdn.microsoft.com/en-us/library/bb335435.aspx) to completely hide in... | If you change your implementation later on, and return something other than a `List<T>`, the caller code will indeed break. But the author of the caller code should know better than just casting to `List<T>` without checking that the return value actually *is* a list - you have promised nothing of the sort.
As for mys... |
2,922,783 | I have a folder called notes, naturally they will be categorized into folders, and within those folders there will also be sub-folders for sub categories. Now my problem is I have a function that walks through 3 levels of sub directories:
```
def obtainFiles(path):
list_of_files = {}
for element in os.list... | 2010/05/27 | [
"https://Stackoverflow.com/questions/2922783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/154688/"
] | Based on your short descriptions, something like this should work:
```
list_of_files = {}
for (dirpath, dirnames, filenames) in os.walk(path):
for filename in filenames:
if filename.endswith('.html'):
list_of_files[filename] = os.sep.join([dirpath, filename])
``` | an alternative is to use generator, building on @ig0774's code
```
import os
def walk_through_files(path, file_extension='.html'):
for (dirpath, dirnames, filenames) in os.walk(path):
for filename in filenames:
if filename.endswith(file_extension):
yield os.path.join(dirpath, filename)
... |
5,526,983 | Recently upgrading to PHP 5.3 has resulted in a slew of depreciation errors being shown on my pages. In php.ini I have display\_errors off and error\_reporting = E\_ALL ^ E\_DEPRECATED, but the errors still show. Ideas? | 2011/04/03 | [
"https://Stackoverflow.com/questions/5526983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/566179/"
] | Your script could be setting the error reporting level differently. Preferably at the end of the page that's having problems run:
```
phpinfo();
```
It will give you the global, and local values for display\_errors. It's likely been turned on at some point.
If you establish that it's being turned back on, you'll n... | restart PHP and execute script like this:
```
<?php
phpinfo();
?>
```
to confirm changes |
1,995,292 | I'm just writing a SQLite powered android applications however I keep getting a NullPointerException when I call my DatabaseHelper class. The code which appears to be causing the error is below:
```
public Cursor GetAllRows() {
try {
return db.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_PHRA... | 2010/01/03 | [
"https://Stackoverflow.com/questions/1995292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122547/"
] | Genericity has the advantage of being reusable. However, write things generic, only if:
1. It doesn't take much more time to do that, than do it non-generic
2. It doesn't complicate the code more than a non-generic solution
3. You know will benefit from it later
However, **know your standard library**. The case you p... | There are disadvantages to using templates all the time. It (can) greatly increase the compilation time of your program and can make compilation errors more difficult to understand.
As taldor said, don't make your functions more generic than they need to be. |
141,498 | It’s bit lengthy but I think I need to do an introduction:
Two years ago I took a job and got a contract with a certain salary that at the time seemed ok. I wasn’t sure about how much I should ask at the time (plus I was moving from my home country, which has different salary expectations) and, overall, I wanted the j... | 2019/08/02 | [
"https://workplace.stackexchange.com/questions/141498",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/102880/"
] | In my experience, it is always harder (if not impossible) to adjust your low starting salary by getting raises, than it is to start with a higher salary from the beginning. The biggest salary increases I managed to obtain in my career so far were exclusively by switching to another company, and starting there with a (m... | Sure! Just ask for it! If you have a realistic estimation of the worth of your job, then it will not be difficult to find someone that pays for it (in your current company or otherwise)
Address whoever is responsible in a calm tone, explaining your perspective on the issue, but focusing on them rather than on yourself... |
2,800,710 | **Problem**
Prove $$\lim\_{n \to \infty}\frac{\ln (n+1)}{(n+1)[\ln^2 (n+1)-\ln^2 n]}=\frac{1}{2},$$where $n=1,2,\cdots.$
**My Proof**
Consider the function $f(x)=\ln^2 x.$ Notice that $f'(x)=2\cdot \dfrac{\ln x}{x}.$ By Lagrange's Mean Value Theorem, we have $$\ln^2(n+1)-\ln^2 n=f(n+1)-f(n)=f'(\xi)(n+1-n)=f'(\xi)=2\... | 2018/05/29 | [
"https://math.stackexchange.com/questions/2800710",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/560634/"
] | You can use this
$$
\lim\_{n \to \infty}\dfrac{\ln (n+1)}{(n+1)[\ln^2 (n+1)-\ln^2 n]} =
$$
$$
=\lim\_{n \to \infty}\dfrac{\ln (n+1)}{(n+1)[\ln (n+1)-\ln n][\ln (n+1)+\ln n]} =
$$
$$
=\lim\_{n \to \infty}\dfrac{\ln (n+1)}{\ln\left[\left(1 +\frac{1}{n}\right)^{n+1}\right][\ln (n+1)+\ln n]} =
$$
$$
=\lim\_{n \to \infty... | There exists an appplication in both solutions of @Virtuoz's and mine. That is
>
> $$\lim\_{n \to \infty}\frac{\ln(n+1)}{\ln n}=1.$$
>
>
>
Now, I give its proof for complement.
**Proof 1**
By L'Hospital's Rule, we have $$\lim\_{n \to \infty}\frac{\ln(n+1)}{\ln n}=\lim\_{n \to \infty}\frac{\dfrac{1}{n+1}}{\dfr... |
85,064 | I am trying to get sObject fields name in 2nd pick list on the basis of selected object name in 1st pick list.
Here is my class..
```
public with sharing class ExtractSobject{
public list<SelectOption> fields { get; set; }
public String objectName { get; set; }
public List<SelectOption> getSelected... | 2015/07/28 | [
"https://salesforce.stackexchange.com/questions/85064",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/20643/"
] | In this line
```
SObjectType objTyp = Schema.getGlobalDescribe().get('Selectedobjnames');
DescribeSObjectResult objDef = objTyp.getDescribe();
```
You are giving 'Selectedobjnames' as a string. you need to pass it without single quote. I think it will solve your problem. | Seems time-consuming for us to read through the code and locate the issue. So instead, I will provide you some info on how to debug this one.
For VF page, enable development mode for your current user: [How to enable development mode](https://help.salesforce.com/HTViewHelpDoc?id=pages_dev_mode.htm&language=en_US). Re... |
154,225 | I am trying to figure out the best way to publish my elderly father's life work. He says he would be considered a "*fringe*" scientist or an independent researcher. Should we self-publish? The subject matter would be of great interest to those interested in earth-moon systems, and the Egyptian Pyramids. How should we p... | 2020/08/21 | [
"https://academia.stackexchange.com/questions/154225",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/-1/"
] | There are precedents for this.
J.S. Bach assumed that his music would be forgotten after he died. It would have been it if weren't for the efforts of Mendelsohn, Schuman and others. Nowadays Bach is considered by many to be the greatest composer whoever lived. His work is to be heard ubiquitously.
>
> For about 50 y... | A few years back I was in a position when I had to submit a paper but could not use any affiliation. You could say I was between jobs or maybe in a job where I could not use my affiliation for independent research.
I spent a few 100 dollars and registered a company. I registered with IEEE to get an email address. This... |
21,670,988 | I am using a **colorbox** plugin with iframe. The `iframe` source is another HTML page which has a image courosal. Where i need to write a click event to get the id of the clicked image.
The ordinary click event on the HTML page in document ready is not working, i tried with live as well. Also i tried having a click ... | 2014/02/10 | [
"https://Stackoverflow.com/questions/21670988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1191918/"
] | `DataView` can be use to make *filter* from your data as:
```
public DataTable Filter(DataTable table)
{
DataView view = new DataView(table);
view.RowFilter = "Camp IS NULL";
table = view.ToTable();
return table;
}
``` | Use `DataView` to get filtered result from your `DataTable`.
```
public DataTable Filter(DataTable table)
{
return table;
}
``` |
15,708 | I have two networks at work and when I have to use my Wireless settings I need IE to use one set of Proxy LAN Settings, and when I am plugged in I need a different set.
I have been looking for a way to script in the Proxy Settings:
HTTP, FTP and Secure
I also need the "exemptions"
I can't buy anything....my compan... | 2009/07/30 | [
"https://superuser.com/questions/15708",
"https://superuser.com",
"https://superuser.com/users/1315/"
] | Absolutely!
Almost all programs these days keep their settings within the registry somewhere. So if it is in the registry and you want to automate it you are in luck.
The first step is to find the registry keys that contain the specific configuration that you are going to automate. Once you have the registry keys id... | Now I really hate network settings, so I can't guarantee [it works.](http://nscsysop.hypermart.net/setproxy.html)
**Push the Browser Settings in the Login Script (for Internet Explorer)**
Internet Explorer stores proxy settings in the registry. This makes it particularly easy to update, using a variety of methods. Ev... |
1,826,705 | I have an embedded system that currently keeps track of seconds until an event is supposed to occur using a real-time clock driven by a watch crystal.
Now it needs to keep track of the actual date and time. So, I need to be able to calculate the day, month, year, hour, minute and second from a start date/time and off... | 2009/12/01 | [
"https://Stackoverflow.com/questions/1826705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1491/"
] | I'm bored, couldn't resist trying a solution. Here's a prototype in ruby - should be clear enough to translate to C.
Given `offset` and a start date stored as: `Baseyear, Baseday, Basesec` where day 0 = Jan1,
you can calculate the date as
```
#initialize outputs
year= Baseyear
day = Baseday
sec = Basesec+offset
#day... | The following function determines whether a given year is a leap year:
```
bool is_leap_year(int year)
{
return ((0 == year % 400) || ((0 == year % 4) && (0 != year % 100)));
}
``` |
411,552 | I'm looking for a solution for using rsync between 2 remote servers. It seems like its not possible. Does any one know why its not possible? I ask that because I think if I know the reason, maybe I could use another tool to make it possible.
Update: I have a hypervisor on my primary site with n vm's running on. I have... | 2012/07/26 | [
"https://serverfault.com/questions/411552",
"https://serverfault.com",
"https://serverfault.com/users/79147/"
] | If server1 and server2 can connect to each other, the above solutions will work. Otherwise I don't have a solution for rsync, but an old `tar` trick will work. I'm doing it now.
Prep: create an ssh key with no passphrase and install it into the `authorized_keys` file of the account at each server. Then do this:
```
$... | ```
gw_en_2_segmentos# ssh cuenta@ip_origen 'cd /carpeta_origen;star \
-acl -artype=exustar -z \
-c -f=- *' | ssh cuenta@ip_destino \
'cd /carpeta_destino;star \
-acl -artype=exustar -z... |
1,184,459 | I have being trying to install Ubuntu to run alongside (or instead of) Windows without success.
Sure, I download the .iso file, run Rufus to install Ubuntu onto my 29 MB USB stick. Indeed Rufus does just that, however, when I try to boot from the USB everything hangs.
I did install Ubuntu onto my Mac using VBox; sure... | 2019/10/28 | [
"https://askubuntu.com/questions/1184459",
"https://askubuntu.com",
"https://askubuntu.com/users/1010176/"
] | Obviously it has been removed for security reasons.
It popped up first in Debian Community: [#916310 - 4.6 should not be shipped in a stable release - Debian Bug report logs](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916310)
Then in [Launchpad](https://bugs.launchpad.net/ubuntu/+source/phpmyadmin/+bug/1837775... | Ubuntu "focal" 20.04 has now phpMyAdmin 4.9.2
<https://launchpad.net/ubuntu/focal/+package/phpmyadmin>
Track progress for 19.10 (if some can be done) in <https://github.com/phpmyadmin/phpmyadmin/issues/15515> |
29,710 | "Pixel" always confuses me whenever I do web banner work.
I use CorelDraw x5 for my work. I usually prefer to use inches rather than pixels as inches are much intuitive for me. But when I do an "Inch to Pixel" conversion, i get confused.
* In CorelDraw: `1 inch = 300px`.
* At [AuctionRepair.com](http://auctionrepair... | 2014/04/16 | [
"https://graphicdesign.stackexchange.com/questions/29710",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/22097/"
] | One more confusion to complete the discussion:
In website design and layout, [one "CSS pixel" is *always* equal to 1/96th of a "CSS inch"](http://docs.webplatform.org/wiki/css/data_types/length), regardless of screen resolution. This was done because so many early websites used pixel-based measurements for layout ass... | Pixel is the smallest form to display design for a display unit.
Ex: An Display monitor consists of several pixels which form a display on your screen. |
11,285,923 | I have a tablix with lots of rows that span over multiple pages. I have set the Tablix property Repeat header rows on each page but this does not work. I read somewhere that this is a known bug in Report Builder 3.0. Is this true? If not, is there something else that needs to be done? | 2012/07/01 | [
"https://Stackoverflow.com/questions/11285923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/804503/"
] | It depends on the tablix structure you are using. In a table, for example, you do not have column groups, so Reporting Services does not recognize which textboxes are the column headers and setting RepeatColumnHeaders property to True doesn't work.
Instead, you need to:
1. Open Advanced Mode in the Groupings pane. (C... | Open `Advanced Mode` in the Groupings pane. (Click the arrow to the right of the Column Groups and select Advanced Mode.)
In the Row Groups area (not Column Groups), click on a Static group, which highlights the corresponding textbox in the tablix.
Click through each Static group until it highlights the leftmost col... |
1,301,568 | How do I execute a SP and get the return value. The below code always returns null object. The storedprocedure has been tested in the database using the same parameters as in code, but the SubSonic sp always returns null. When executed in the db via sql, it returns the correct values.
This is using SubSonic 3.0.0.3.
... | 2009/08/19 | [
"https://Stackoverflow.com/questions/1301568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/158638/"
] | I copied your sproc and stepped through the SubSonic code and .Output is never set anywhere. A work around would be using an output parameter and referring to it after executing: sproc.OutputValues[0]; | Here's a simple way to do it:
In the stored procedure, instead of using RETURN, use SELECT like this:
```
SELECT @@ROWCOUNT
```
or
```
SELECT @TheIntegerIWantToReturn
```
Then in the code use:
```
StoredProcName.ExecuteScalar()
```
This will return the single integer you SELECTED in your stored procedure. |
55,310,734 | How to add more indentation in a file tree structure? It has a little bit indentation I want to increase more just like NetBeans.
check the image
 | 2019/03/23 | [
"https://Stackoverflow.com/questions/55310734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11195843/"
] | If you just want to change the indentation you can set these options:
Press Ctrl+Shift+P -> Go to Preferences: Open Settings (JSON)
```
"workbench.tree.indent": 18,
```
You can add guidelines as well with:
```
"workbench.tree.renderIndentGuides": "always",
```
You can also change their color using:
```
"workb... | ```
{
"workbench.tree.indent": 20, // just paste this line of code in setting.json file
"editor.mouseWheelZoom": true // for zoom in & out font size with Ctrl+ mouse scroll
}
``` |
35,844,791 | I want to test function calls with optional arguments.
Here is my code:
```
list_get()
list_get(key, "city", 0)
list_get(key, 'contact_no', 2, {}, policy)
list_get(key, "contact_no", 0)
list_get(key, "contact_no", 1, {}, policy, "")
list_get(key, "contact_no", 0, 888)
```
I am not able to parametrize it due to opti... | 2016/03/07 | [
"https://Stackoverflow.com/questions/35844791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2710873/"
] | In addition to the answers @forge and @ezequiel-muns I suggest using some sugar from [`pyhamcrest`](https://github.com/hamcrest/PyHamcrest):
```
import pytest
from hamcrest import assert_that, calling, is_not, raises
@pytest.mark.parametrize('func, args, kwargs', [
[list_get, (), {}],
[list_get, (key, "city",... | For future readers who come to this question trying to set up `@parameterize`d tests to generate a Cartesian set of parameters AND sometimes do not want to pass a given parameter at all (if optional), then using a filter on `None` values will help
```
def function_under_test(foo="foo-default", bar="bar-default"):
... |
26,935,983 | I have the Thinking Sphinx gem, and I am using it to replace my current advanced search setup.
I am storing the Users dob, and then converting it into a age in the User model.
User.rb:
```
def age
now = Time.now.utc.to_date
now.year - birthday.year - ((now.month > birthday.month || (now.month == birthday.month &... | 2014/11/14 | [
"https://Stackoverflow.com/questions/26935983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2687095/"
] | One way to accomplish it would be to add an age column along side the DOB entered by users and have a trigger that updates all ages once per day. You could index that easily and query using BETWEEN. | I would store the date of birth as a timestamp attribute, and then filter the Sphinx search results by a range of the first and last dates that are valid for the the age/ages you're after.
This avoids having your User model save the age (which will need to be updated regularly, both in the database and in Sphinx). |
387 | Sometimes when I am not at practice, I will visualize playing scales or a particular piece on my instrument.
I know that visualization is often used by athletes, but is it often used among musicians? If so, is there advice on how it can be done most effectively? | 2011/05/03 | [
"https://music.stackexchange.com/questions/387",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/22/"
] | I would consider "visualization," as such, to be more a method of dealing with performance anxiety issues.
However, there is plenty of concrete, actual, musical practice you can do inside your head. It's no replacement for real time with the physical instrument, but time spent score studying, audiating, and practicing... | Visualisation and Imagination are absolutely important.
In my case, it is rare for me these days to watch my fingers on the fretboard as I've trained myself to not look. Sometimes, in mid performance, I can close my eyes and "see the fretboard and see my hands go to certain chords/scales/shapes" well in advance of the... |
10,326,831 | Does the reference consider as pointer in c++ ?
```
int &x = y;
```
Does x have an space in the memory ? | 2012/04/26 | [
"https://Stackoverflow.com/questions/10326831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/423903/"
] | It's quite common for a reference to be implemented as a pointer under the hood. The Itanium C++ ABI specifies pointers for parameters:
>
> **3.1.2 Reference Parameters**
>
>
> Reference parameters are handled by passing a pointer to the actual parameter.
>
>
>
Yes, a reference uses some memory. If its implemen... | *Passing* a reference as a function argument probably works by passing a pointer. Declaring a reference to an existing variable in the same scope, like in your example, probably just makes both names refer to the same place in memory. But this is implementation-dependent; different compilers may do it differently. |
26,469,040 | What is difference between `tabActivity` and `tabhost` and `tabLayout` in Android?
My layout will have five tabs. Which one is best for this? | 2014/10/20 | [
"https://Stackoverflow.com/questions/26469040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3143460/"
] | `TabActivity` is deprecated. You should use Fragments and FragmentManager instead. `TabHost` and `TabWidget` simply define a portion of the screen for tabs and tab content. There are ways to use them with a `TabActivity`, but it is not compulsory to do so. Note that there is now a [`FragmentTabHost`](https://developer.... | Documentation about making swipe views / tabs:
<http://developer.android.com/design/building-blocks/tabs.html>
<http://developer.android.com/training/implementing-navigation/lateral.html>
TabActivity:
deprecated in API level 13
<http://developer.android.com/reference/android/app/TabActivity.html>
TabHost:
<htt... |
44,399,136 | im developing a delivery app. So I have productos and popular products in firebase this way:
* Products
[](https://i.stack.imgur.com/5WJ5O.png)
* PopularProducts(ID of the product as key and true as value)
[](htt... | 2017/06/06 | [
"https://Stackoverflow.com/questions/44399136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7868100/"
] | Your xticks are completely out of the range where your data lives. Remove the line which sets the xticks and your plot is fine
```
import matplotlib.pyplot as plt
plt.plot([1.95E-06, 9.75E-06, 1.95E-05, 9.75E-05, 1.95E-04, 9.75E-04, 1.95E-03],
[0.2,0.4,0.6,0.8,1.0,1.2,1.4])
plt.title('Red')
plt.ylabel('Absor... | The first argument to `plt.xticks` should be x-coords (not tick indexes). |
30,768,362 | This code is provided as an example in for use with devise and OmniAuth, it works in [my project](https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview).
```
class User < ActiveRecord::Base
def self.new_with_session(params, session)
super.tap do |user|
if data = session["devise.facebook_data"] &&... | 2015/06/10 | [
"https://Stackoverflow.com/questions/30768362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2877322/"
] | A assignment operator (`=`) returns the assigned value, which is then evaluated by the `if`. In ruby, only `false` and `nil` are considered as `false`. Everything else evaluates to `true` in a boolean context (like an `if`). | Ruby doesn't care about types in conditionals, unlike Java. As long as the value is neither nil or false then it will pass.
In your example you actually discriminate against nil: the if conditionnal ensures that data actually exists and isn't nil, so we can use it, assuming it's a hash. This is a common pattern in Rub... |
250,820 | I tried to install teXlive on my laptop running Windows 8.1.
After unpacking, I ran "install-tl-windows.bat". It seemed OK for most of the installation, but then I got this in the terminal (the log file is the same):
```
Installing [2321/3058, time/total: 01:06:55/01:24:53]: qsymbols [136k]
Installing [2322/3058, time... | 2015/06/17 | [
"https://tex.stackexchange.com/questions/250820",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/79308/"
] | I've been facing the same problem since TeX Live 2015 was released last month (I have Windows 7 Pro 64-bit OS). I've tried installing it every week (in the hopes that there is a bug, which will be fixed in the weekly updates) but no luck. I tried installing it from different mirrors but again no luck. Finally, I was ab... | The problem turned out to be very simple - the error is generated when the computer gets locked after being idle for some time during the long installation.
Staying on the computer solved it. |
1,039 | I am surprised by how many people automatically put on a cheesy smile when I point a camera in their direction.
How can I encourage them to act more naturally, and what can I do to get better, more natural-looking portraits? | 2010/07/22 | [
"https://photo.stackexchange.com/questions/1039",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/191/"
] | I always tell people to make the ugliest frowning face possible and make them hold it for a while. After about 30 seconds I say "ok, now you can smile" and the smiles that come out are usually great. But you have to be quick, the smiles will revert back to the fake smiles within seconds. This works on almost anyone, it... | I agree with Rowland. When people feel uncomfortable they try to put on a happy face or "cheesy smile". When I am doing portraits, especially with kids is I say something funny but something to break the ice. If you continue to talk and have a conversation that always helps.
Also, if you you are in an open environmen... |
1,584,314 | Summary of the problem:
For some decimal values, when we convert the type from decimal to double, a small fraction is added to the result.
What makes it worse, is that there can be two "equal" decimal values that result in different double values when converted.
Code sample:
```
decimal dcm = 8224055000.0000000000m... | 2009/10/18 | [
"https://Stackoverflow.com/questions/1584314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/187996/"
] | Interesting - although I generally don't trust normal ways of writing out floating point values when you're interested in the exact results.
Here's a slightly simpler demonstration, using [`DoubleConverter.cs`](http://pobox.com/~skeet/csharp/DoubleConverter.cs) which I've used a few times before.
```
using System;
c... | The answer lies in the fact that `decimal` attempts to preserve the number of significant digits. Thus, `8224055000.0000000000m` has 20 significant digits and is stored as `82240550000000000000E-10`, while `8224055000m` has only 10 and is stored as `8224055000E+0`. `double`'s mantissa is (logically) 53 bits, i.e. at mo... |
736,816 | I have a question about Asymptotics involving big Omega...
How do I need to approach this equation in order to prove it?
$$n \cdotΩ(f(n)) = Ω(n\cdot f(n))$$
Thank you very much for your answers! | 2014/04/02 | [
"https://math.stackexchange.com/questions/736816",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/139840/"
] | Using the definition of Big-Omega:
By definition, $f(n) \in \Omega(f(n))$, so $f(n) \leq 1 \* f(n)$, for all $n$. Now multiply both sides by $n$, to get $n f(n) \leq 1 \* n f(n)$. Again, we set our constant $C = 1$ and the inequality holds for all $n$. In fact, it's really equality. So $n \Omega(f(n)) = \Omega(n f(n))... | $g(n) = \Omega ( f(n))$ means that $\dfrac{g(n)}{f(n)}$ is bounded in a suitable sense. Formally you have also that $\dfrac{\Omega(f(n))}{f(n)}$ is bounded. What you've written just states that $$ \frac{n \Omega(f(n))}{n f(n)} = \frac{\Omega (f(n))}{f(n)}$$ is bounded. |
25,486,033 | I have a templatized class like so :
```
template<typename T>
class A
{
protected:
std::vector<T> myVector;
public:
/*
constructors + a bunch of member functions here
*/
}
```
I would like to add just ONE member function that would work only for 1 given type of T. Is it possible to do that a... | 2014/08/25 | [
"https://Stackoverflow.com/questions/25486033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3975337/"
] | Yes, it's possible in C++03 with CRTP ([Curiously recurring template pattern](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern)):
```
#include <numeric>
#include <vector>
template<typename Derived, typename T>
struct Base
{
};
template<typename Derived>
struct Base<Derived, int>
{
int Sum() con... | One approach not given yet in the answers is using the standard library `std::enable_if` to perform [SFINAE](http://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error) on a base class that you inherit to the main class that defines appropriate member functions.
Example code:
```
template<typename T, class Ena... |
10,391,866 | Does the .NET framework have any classes which allow you to run (compile, interpret or whatever) an external script file containing C# code?
For instance, if I have a file `Hello.cs` containing this:
```
class Hello
//This program displays Hello World
{
static public void Main()
{
System.Console.Write... | 2012/04/30 | [
"https://Stackoverflow.com/questions/10391866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1327073/"
] | Check out the following article: [C#: Writing extendable applications using on-the-fly compilation](http://blogs.msdn.com/b/abhinaba/archive/2006/02/09/528416.aspx). | I would check the Roslyn APIs. You can do what ever you want as long as you provide valid C# o VB.NET code. |
1,955,644 | I am trying to understand why grep built by me is much slower than the one that comes with the system and trying to find what compiler options are used by grep that comes with the system.
OS Version: CentOS release 5.3 (Final)
grep on system:
```
Version: grep (GNU grep) 2.5.1
Size: 88896 bytes
ldd output:
... | 2009/12/23 | [
"https://Stackoverflow.com/questions/1955644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/237938/"
] | Why don't you just get CentOS's SRPM for the grep binary and compare their compile options to yours? I would guess that this is much more efficient than having the entire StackOverflow community blindly poke around in the dark until they hit something.
EDIT: Are you using a locale with a multibyte encoding? (Note: if ... | Another think to note besides the -O options is it looks like you are building with debugging symbols "-g".
Debug usually increases binary size and can reduce performance of said binary, I would image grep is pretty stable and you don't really need debug symbols for it. |
46,268,087 | I have a problem with SQL Server 2008 R2, when I try to connect to server it gives me the following message:
>
> TITLE: Connect to Server
>
>
> Cannot connect to (local).
>
>
> ADDITIONAL INFORMATION:
>
>
> A network-related or instance-specific error occurred while establishing a connection to SQL Server. The ... | 2017/09/17 | [
"https://Stackoverflow.com/questions/46268087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8623435/"
] | Check the output of below command and whether the apache is running under \_www user
```
sudo lsof -i:80
```
Stop the built-in Apache server in Mac OS X is by using this command:
```
sudo apachectl -k stop
```
Enter administrator password.
Next run this launchctl unload command
```
sudo launchctl unload -w /Sy... | `sudo apachectl start` to make sure it is running
go to <http://localhost:80> to ensure you see "It Works!" or something comes up to confirm it is running.
```
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
```
`cat /private/var/db/com.apple.xpc.launchd/disabled.plist` should produce ... |
71,497,533 | Like in title, i want to postion my absolute element at the middle of the relative div border, here is the picture of thing that i want to achive:
[picture](https://i.stack.imgur.com/6igbL.png)
here is what i did for this moment. Parent div must have % width and child div must have static width in px or some diffrent ... | 2022/03/16 | [
"https://Stackoverflow.com/questions/71497533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15165740/"
] | You can use ZIO.collectAll to convert List[Task] to Task[List], I thought it was ZIO.sequence..., maybe I'm getting confused with cats...
Following example works with Zio2
```scala
package sample
import zio._
object App extends ZIOAppDefault {
case class Result(value: Int) extends AnyVal
val data: List[Task[L... | So, here is an alternative solution based on @jgoday answer
```
def getBaselinesForRequestIds(baseLineReqIds: Set[String]): Task[List[RelevantReadingRow]] =
for {
values <- ZIO.foreachPar(baseLineReqIds.grouped(25).toList) {
reqIds =>
dynamoConnection
.run(
table.g... |
446,843 | I am unable to connect to on my ubuntu installation a remote tcp/ip which contains a mysql installation:
```
viggy@ubuntu:~$ mysql -u user.name -p -h xxx.xxx.xxx.xxx -P 3306
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (111)
```
I commented out the line below using vim in /... | 2012/11/08 | [
"https://serverfault.com/questions/446843",
"https://serverfault.com",
"https://serverfault.com/users/57634/"
] | This could be a user permissions problem. What did you use for your CREATE\_USER?
Try making a new user with
```
CREATE USER 'testuser' IDENTIFIED BY 'somepass';
```
leave out the normal @'locahost' part so it isn't restricted.
also have a look at /var/log/mysql and see if there are clues... | Try with
mysql -u username -h xxxx.xxxx.xxx.xxxx -P
portnumber -D mysql -p
Enter password: \*\*\*\*\*\*\*\*\*\*\*
Note -P "P" capital lettre and -D "D" capital also |
462,791 | Here's an interesting one that I can't figure out. I was about to call MS, but figured I'd check here first.
**Scenario:**
Two Exchange 2010 forests federated with GAL Sync.
User Bob@domain.com had a mailbox on Exchange 2010 server.
Bob now has a new mailbox on a different Exchange forest (Bob@Awesome.com).
Bob wa... | 2013/01/03 | [
"https://serverfault.com/questions/462791",
"https://serverfault.com",
"https://serverfault.com/users/7861/"
] | The solution is to set up SMTP namespace sharing between the two Exchange servers. | Since Bob is actually part of a different Exchange forest, Sally can't see Bob's free/busy information at all in the other Exchange org (and vice versa). If I am reading what you did correctly, you essentially created an external contact for Bob for his new Exchange org(Bob@awesome.com) and hid his existing mailbox (Bo... |
12,031,947 | I have a java project that includes Spring 3.0.2 and XmlSchema.jar 1.4.7
The project's pom.xml contains as a dependency:
```
<dependency>
<groupId>org.apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>
<version>1.4.7</version>
</dependency>
```
The project compile... | 2012/08/20 | [
"https://Stackoverflow.com/questions/12031947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1481505/"
] | >
> Please change your dependency to 2.0.1 or 2.0.2
>
>
>
*legacy 1.4.7 don't have the method defined*
```
public XmlSchema read(Source source) {
if (source instanceof SAXSource) {
return read(((SAXSource)source).getInputSource());
}
```
check the [1.4.x javadoc](http://ws.apache.org/commons/Xml... | These steps won't necessarily work in WebLogic as it has its own implementation classes. After updating your dependency as shown by Anshul, you will also need to tell WebLogic to prefer that package in the weblogic-application.xml
```
<wls:prefer-application-packages>
<wls:package-name>org.apache.ws.commons.schema... |
5,051,688 | I have a crawler that gathers articles from the web and stores the title and the body to a database. Until now the programmer has to come up with a set of rules per source (usually XPath and sometimes regular expressions) to point to the article title and body sections of the web page. Now I'm trying to go one step ahe... | 2011/02/19 | [
"https://Stackoverflow.com/questions/5051688",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/624475/"
] | Your `<uses-permission>` element needs to be an immediate child of the `<manifest>` element, and your code listing above suggests that it is not.
[Here is a sample project](https://github.com/commonsguy/cw-advandroid/tree/master/SystemEvents/OnBoot) demonstrating the use of `BOOT_COMPLETED`. | on adding `<category android:name="android.intent.category.HOME" />` this to my manifest file solve my problem and works.
```
<receiver android:name=".BroadCastRecieverClass">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<category android:name="android.... |
17,725,927 | I have some questions about [boxplots](http://matplotlib.org/examples/pylab_examples/boxplot_demo.html) in matplotlib:
**Question A**. What do the markers that I highlighted below with **Q1**, **Q2**, and **Q3** represent? I believe **Q1** is maximum and **Q3** are outliers, but what is **Q2**?
... | 2013/07/18 | [
"https://Stackoverflow.com/questions/17725927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/283296/"
] | Here's a graphic that illustrates the components of the box from a [stats.stackexchange answer](https://stats.stackexchange.com/a/149178). Note that k=1.5 if you don't supply the `whis` keyword in Pandas.
[](https://i.stack.imgur.com/ty5wN.png)
The box... | Just in case this can benefit anyone else, I needed to put a legend on one of my box plot graphs so I made this little .png in Inkscape and thought I'd share it.
edit: to clarify a bit more, The whiskers end at the farthest data point within the 1.5 \* IQR interval.
[/([0-9]+).html$ folder.php?id=$123 |
12,531,348 | In my controller.js I've function:
```
$(MyModel.addMyButtonTag).live("click", function () {
MyModel.addRecord();
});
```
and in my model.js I've:
```
var MyModel = {
addMyButtonTag: "#AddButton",
addRecord: function () {
//Show modal
$(MyModel.addMyButtonTag).modal();
$('#sim... | 2012/09/21 | [
"https://Stackoverflow.com/questions/12531348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1468830/"
] | jQuery .live() is deprecated Use .on() instead
for more info take a look here <http://api.jquery.com/live/> | Make sure your class "MyModel" defined before your live function.Include your class defination js first.
Its worked for me :
```
<input type="button" id="AddButton" />
<script type="text/javascript">
var MyModel = {
addMyButtonTag: "#AddButton",
addRecord: function () {
... |
5,655,454 | I am trying to create an ExpandableListView inside my activity that shows shows types of wines on the top level, and individual bottles of wine on the second level. I am reading all of my data from a CSV file that I have created and filled with 8 specific bottles of wine which are all under one category for now. I am h... | 2011/04/13 | [
"https://Stackoverflow.com/questions/5655454",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/507810/"
] | You assign the same object (`current`) to all cells of `chrd`, this is why you end up with the last value. You should initialize `current` inside the loop to fix this.
```
while ((line = reader.readLine()) != null) {
current = new Chardonnay();
String[] RowData = line.split("... | In my experience, this is how I have had to format data for ExpandableListAdapter Groups:
```
ArrayList<HashMap<String, String>> alist = new ArrayList<HashMap<String, String>>();
...
//provided there are entries in the database, iterate through them all. create a hashmap using "company" as the key and
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.