qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
38,348,530 | I receive this error when I try to rebuild app with proguard: (I tried all the solutions suggested for the error MSB6006: "java.exe" exited with code 1, but in my case, it seems have some conflicts with GCM )
>
> 19>PROGUARD : warning :
> com.google.android.gms.common.GooglePlayServicesUtil: can't find
> referenced... | 2016/07/13 | [
"https://Stackoverflow.com/questions/38348530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5261808/"
] | The Google GMS libraries sometimes try to access library methods that are not available for a given target SDK version and gracefully handle errors at runtime. So it is usually required and safe to add something like this to ignore such warnings:
```
-dontwarn com.google.android.gms.**
-dontnote com.google.android.gms... | I solved it with this solution from Xamarin forum:
Create file named proguard.cfg inside Android project in the solution. Right click and set Build Action to ProguardConfig.
Add the following lines:
```
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
```
Amend the above according to... |
1,573,706 | I have a crystal report that is based on an XSD schema file.
Within the report definition, I can modify the datasource location, specifically, the file path. This is where I can set the file path to where the XSD schema file resides on my machine.
At this point, everything works correctly.
Here is the problem:
If t... | 2009/10/15 | [
"https://Stackoverflow.com/questions/1573706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83760/"
] | The easiest way would be to set the datasource location to be the same as the report file location. When you open up the Set Datasource Location dialog, expand the Properties plus-box, then right-click on the file path name and and choose "Same as Report". | use below sample code for setting dynamically xml or xsd
```
ReportDocument crReportDoc.DataSourceConnections[0].SetConnection(p_XMLDocument + " " + tdgDoc_XSD, "", null, "");
// crReportDoc.DataSourceConnections[0].SetConnection(p_XMLDocument + " " + tdgDoc_XSD, "", null, "");
NameValuePairs2 logon = new NameValuePai... |
3,951,255 | How can I prove that there is $c>0$ such that starting from a specific $n$ the following is true:
$$
\log\_2(n+1) - \log\_3(2n+1) \le c
$$ | 2020/12/16 | [
"https://math.stackexchange.com/questions/3951255",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/863126/"
] | **HINT**
$$
\log\_2(n+1) -\log\_3(2n+1) \le \log\_2(n+1)
$$
so suffices to prove that $\log\_2(n+1) \le cn$ for some $c \in \mathbb{R}^+$, which is equivalent to proving
$$
n+1 = 2^{\log\_2(n+1)} \le 2^{cn} = \left(2^c\right)^n = k^n
$$
for $k=2^c \in \mathbb{R}^+$.
Can you finish?
---
**UPDATE**
Now that you updat... | $\log\_2(n+1)-\log\_3(2n+1)=\dfrac{\log\_3(n+1)}{\log\_32}-\log\_3(2n+1)=$
$=\log\_23\cdot\log\_3(n+1)-\log\_3(2n+1)=$
$=\left[\log\_2\left(\dfrac32\right)+1\right]\cdot\log\_3(n+1)-\log\_3(2n+1)=$
$=\log\_2\left(\dfrac32\right)\cdot\log\_3(n+1)+\log\_3(n+1)-\log\_3(2n+1)=$
$=\log\_2\left(\dfrac32\right)\cdot\log\_... |
26,534,111 | I've recently installed ArrayFire 2.1 on my Ubuntu 12.04. I want to use it with Python, is it possible? I tried [ArrayFire\_Python](https://github.com/arrayfire-community/arrayfire_python) but it is incomplete, and it does not include functions such as `rotate`. I have exported the `AF_PATH=/opt/arrayfire`.
ArrayFire... | 2014/10/23 | [
"https://Stackoverflow.com/questions/26534111",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1596786/"
] | The Python bindings of arrayfire are now part of PyPi so you can install them with `pip install arrayfire`. | To get the bindings to work, you first need ArrayFire installed and working (you have), but then you need to move the arrayfire directory from the github into your python library directory.
On my Ubuntu 14.04 server, I moved it into the /usr/lib/python2.7/ directory.
From ipython, 'import arrayfire' will now import t... |
49,030,238 | I'm trying to use Angular Material stepper, gone through the documentation but when i paste the HTML Material stepper tag inside my Angular app it tells me that it's not a known element.
HTML:
```
<mat-horizontal-stepper [linear]="isLinear"
#stepper="matHorizontalStepper">
<mat-step [stepControl]="firstFormGroup">
<... | 2018/02/28 | [
"https://Stackoverflow.com/questions/49030238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9122537/"
] | You have to import **`{ MatFormFieldModule }`** from '@angular/material';
**`import { MatInputModule }`** from '@angular/material'; in **`app.ts`** | import this all and check
import {
MatAutocompleteModule, MatButtonModule, MatButtonToggleModule, MatPaginatorModule,
MatCardModule, MatCheckboxModule, MatChipsModule, MatDatepickerModule,
MatDialogModule, MatDividerModule, MatGridListModule, MatIconModule, MatInputModule,
MatListModule, MatMenuModule, MatProgre... |
49,030,238 | I'm trying to use Angular Material stepper, gone through the documentation but when i paste the HTML Material stepper tag inside my Angular app it tells me that it's not a known element.
HTML:
```
<mat-horizontal-stepper [linear]="isLinear"
#stepper="matHorizontalStepper">
<mat-step [stepControl]="firstFormGroup">
<... | 2018/02/28 | [
"https://Stackoverflow.com/questions/49030238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9122537/"
] | You have to import **`{ MatFormFieldModule }`** from '@angular/material';
**`import { MatInputModule }`** from '@angular/material'; in **`app.ts`** | Please take note that modules (such as `MatButtonModule`, `BrowserModule`, etc.) should be imported in your app's module and **not** your component(s).
Please read the [Angular documentation](https://angular.io) before getting started with Angular. You can also check out the API tab for the import statement that you n... |
49,030,238 | I'm trying to use Angular Material stepper, gone through the documentation but when i paste the HTML Material stepper tag inside my Angular app it tells me that it's not a known element.
HTML:
```
<mat-horizontal-stepper [linear]="isLinear"
#stepper="matHorizontalStepper">
<mat-step [stepControl]="firstFormGroup">
<... | 2018/02/28 | [
"https://Stackoverflow.com/questions/49030238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9122537/"
] | The issue was that i used Angular bootstrap with Angular material, they doesn't work with each other, this is why it never worked with me.
I hope that helps anyone. | import this all and check
import {
MatAutocompleteModule, MatButtonModule, MatButtonToggleModule, MatPaginatorModule,
MatCardModule, MatCheckboxModule, MatChipsModule, MatDatepickerModule,
MatDialogModule, MatDividerModule, MatGridListModule, MatIconModule, MatInputModule,
MatListModule, MatMenuModule, MatProgre... |
49,030,238 | I'm trying to use Angular Material stepper, gone through the documentation but when i paste the HTML Material stepper tag inside my Angular app it tells me that it's not a known element.
HTML:
```
<mat-horizontal-stepper [linear]="isLinear"
#stepper="matHorizontalStepper">
<mat-step [stepControl]="firstFormGroup">
<... | 2018/02/28 | [
"https://Stackoverflow.com/questions/49030238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9122537/"
] | The issue was that i used Angular bootstrap with Angular material, they doesn't work with each other, this is why it never worked with me.
I hope that helps anyone. | Please take note that modules (such as `MatButtonModule`, `BrowserModule`, etc.) should be imported in your app's module and **not** your component(s).
Please read the [Angular documentation](https://angular.io) before getting started with Angular. You can also check out the API tab for the import statement that you n... |
28,179,076 | I'm doing my first Android app. When I run my application on my Galaxy S4 which is connected with an USB cable it crashes. Before adding the second Activity it doesn't crashes.
My Code including logcat: <http://pastebin.com/JMKpY859>
I also added this code to the AndroidManifest.xml
```
<activity
android:nam... | 2015/01/27 | [
"https://Stackoverflow.com/questions/28179076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3414355/"
] | The `hadoop:*` EL functions are only available for Oozie MapReduce actions, so you won't be able to use them for your Java action even though it presumably ran a MapReduce job.
Instead, you can use the `<capture-output/>` tag in your Java action to pass output into the Oozie workflow context. In your driver class you ... | Given an oozie job ID and a counter name, the following shell script may work for you:
```sh
#!/bin/bash
if [ $# != 2 ]; then
echo "Usage: get-job-counter-for-oozie.sh OOZIE_JOB COUNTER"
exit 1
fi
OOZIE_JOB=$1
COUNTER=$2
OOZIE_URL=http://${JOBTRACKER}:11000/oozie
JOBS=`oozie job -oozie $OOZIE_URL -info $OOZ... |
34,618,825 | I have this:
```
entity_key = 'pid'
data = [ { ... }, { ... } ]
entities = list(set([ row[entity_key] for row in data ]))
parsed = []
total_keys = ['a','b','c']
for entity_id in entities:
entity_rows = [ row for row in data if row[entity_key] == entity_id ]
totals = { key: sum(filter(None, [ row.get(key) for r... | 2016/01/05 | [
"https://Stackoverflow.com/questions/34618825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/160511/"
] | You've got an `O(n^2)` algorithm because of your membership test inside the loop. If you create an indexed data structure, you can improve performance a lot.
```
entity_key = 'pid'
data = [ { ... }, { ... } ]
totals_keys = ['a','b','c']
parsed = []
indexed = {}
for row in data: # construct a map of data rows, indexed... | Did you try Pandas?
If you have pid as a column, looks like a good match for
```
import pandas as pd
df = pd.DataFrame(your dictionary)
df.groupby(['pid']).sum()
``` |
34,618,825 | I have this:
```
entity_key = 'pid'
data = [ { ... }, { ... } ]
entities = list(set([ row[entity_key] for row in data ]))
parsed = []
total_keys = ['a','b','c']
for entity_id in entities:
entity_rows = [ row for row in data if row[entity_key] == entity_id ]
totals = { key: sum(filter(None, [ row.get(key) for r... | 2016/01/05 | [
"https://Stackoverflow.com/questions/34618825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/160511/"
] | make a single dict using pids as the outer keys:
```
entity_key = 'pid'
data = [ { 'pid': 5011, 'a': 3, 'b': 20, 'c': 33 },{ 'pid': 5012, 'a': 3, 'b': 20, 'c': 33 },
{ 'pid': 5011, 'a': 3, 'b': 20, 'c': 33 },{ 'pid': 5012, 'a': 3, 'b': 20, 'c': 33 }]
from collections import defaultdict
totals = ["a", "b", "c"]
df... | Did you try Pandas?
If you have pid as a column, looks like a good match for
```
import pandas as pd
df = pd.DataFrame(your dictionary)
df.groupby(['pid']).sum()
``` |
34,618,825 | I have this:
```
entity_key = 'pid'
data = [ { ... }, { ... } ]
entities = list(set([ row[entity_key] for row in data ]))
parsed = []
total_keys = ['a','b','c']
for entity_id in entities:
entity_rows = [ row for row in data if row[entity_key] == entity_id ]
totals = { key: sum(filter(None, [ row.get(key) for r... | 2016/01/05 | [
"https://Stackoverflow.com/questions/34618825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/160511/"
] | make a single dict using pids as the outer keys:
```
entity_key = 'pid'
data = [ { 'pid': 5011, 'a': 3, 'b': 20, 'c': 33 },{ 'pid': 5012, 'a': 3, 'b': 20, 'c': 33 },
{ 'pid': 5011, 'a': 3, 'b': 20, 'c': 33 },{ 'pid': 5012, 'a': 3, 'b': 20, 'c': 33 }]
from collections import defaultdict
totals = ["a", "b", "c"]
df... | You've got an `O(n^2)` algorithm because of your membership test inside the loop. If you create an indexed data structure, you can improve performance a lot.
```
entity_key = 'pid'
data = [ { ... }, { ... } ]
totals_keys = ['a','b','c']
parsed = []
indexed = {}
for row in data: # construct a map of data rows, indexed... |
59,655,519 | According to the documentation when deleting a cluster the persistent disk will still exist(<https://cloud.google.com/kubernetes-engine/docs/how-to/deleting-a-cluster>). I wanna delete all the associate persistent disks when deleting cluster but I don't know the name/id of persistent disk.
Cluster get API doesn't have... | 2020/01/09 | [
"https://Stackoverflow.com/questions/59655519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11506883/"
] | [Cloud SDK](https://cloud.google.com/sdk/gcloud/reference/compute/disks/list) can be used to identify the disks if the proper filter and format are parse
i.e.
To list all the disks being used by a GKE (you can change [the filter](https://cloud.google.com/sdk/gcloud/reference/topic/filters) at your convenience)
```
g... | To get the node name run , then the disk name is the same as the node name. You can delete the disk after the cluster but you need to run kubectl get nodes before the deletion.
Also to get the disk id, you can use gcloud command: gcloud compute disks describe --zone < ZONE> | grep "id"
Follow this link for Google best ... |
59,655,519 | According to the documentation when deleting a cluster the persistent disk will still exist(<https://cloud.google.com/kubernetes-engine/docs/how-to/deleting-a-cluster>). I wanna delete all the associate persistent disks when deleting cluster but I don't know the name/id of persistent disk.
Cluster get API doesn't have... | 2020/01/09 | [
"https://Stackoverflow.com/questions/59655519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11506883/"
] | [Cloud SDK](https://cloud.google.com/sdk/gcloud/reference/compute/disks/list) can be used to identify the disks if the proper filter and format are parse
i.e.
To list all the disks being used by a GKE (you can change [the filter](https://cloud.google.com/sdk/gcloud/reference/topic/filters) at your convenience)
```
g... | In order to achieve what you are looking for the following google docs will be helpful to get the node name through Go API using two methods[1](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools/get)<[nodeget](https://cloud.google.com/kubernetes-engine/docs/reference... |
59,655,519 | According to the documentation when deleting a cluster the persistent disk will still exist(<https://cloud.google.com/kubernetes-engine/docs/how-to/deleting-a-cluster>). I wanna delete all the associate persistent disks when deleting cluster but I don't know the name/id of persistent disk.
Cluster get API doesn't have... | 2020/01/09 | [
"https://Stackoverflow.com/questions/59655519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11506883/"
] | [Cloud SDK](https://cloud.google.com/sdk/gcloud/reference/compute/disks/list) can be used to identify the disks if the proper filter and format are parse
i.e.
To list all the disks being used by a GKE (you can change [the filter](https://cloud.google.com/sdk/gcloud/reference/topic/filters) at your convenience)
```
g... | For stateteful sets, a disk in the following format will be created
gke-standard-cluster-3-pvc-8586b7f8-37fd-11ea-beff-42010a80012a
Where standard-cluster-3 will be the name of your cluster
and pvc-8586b7f8-37fd-11ea-beff-42010a80012a will be the name of your volume
That said you can use this [method](https://cloud.... |
6,605,605 | I'm using VS2008 (.NET 3.5) and Entity Framework over SQL Server. I'm hoping to get the value of a foreign key column without using the `Include()` method to link up the table.
For example, the simple Author has many Books sample.
```
var book = context.Books.First();
int authorId = book.Author.AuthorId;
```
In thi... | 2011/07/07 | [
"https://Stackoverflow.com/questions/6605605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111266/"
] | `PIVOT`ing is neither easy (nor nice) to do. I prefer using `CASE`:
```
SELECT d.data_timestamp
, SUM( CASE WHEN data_id = 1 THEN data_value ELSE 0 END ) AS 'input_1'
, SUM( CASE WHEN data_id = 2 THEN data_value ELSE 0 END ) AS 'input_2'
...
, SUM( CASE WHEN data_id = 20 THEN data_value ELSE 0 EN... | Just join the table to itself!
```
SELECT dt1.data_timestamp, dt1.input_1, dt2.input_2
FROM data_timestamp dt1
JOIN data_timestamp dt2
on dt1.data_timestamp = dt2.data_timestamp
and dt2.input_1 is null
WHERE dt1.input_2 is null;
```
Note that this query assumes input\_2's value are present for every input\... |
18,565,906 | I am writing an article for my blog on the menu.
I am trying to create a Circular drop down menu. It works fine when there are two or more Submenus on all browsers. But if there is only one sub-menu to a parent menu it is displayed way below its intended position.
Here is working copy of the following code in jsfidd... | 2013/09/02 | [
"https://Stackoverflow.com/questions/18565906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1460732/"
] | Just some changes to css and you are done:-
```
#menucontainer ul li > ul {
display : none;
overflow: hidden;
position: absolute; //implement absolute
border-bottom: solid 1px;
border: 0px;
height: 0px;
width: 100%;
top:90px; //add top
}
#menucontainer ul li:hover > ul {
z-index: 10... | It has nothing to do with the fact that you only have 1 item in that dropdown menu. You can try and add more and see it's still happening. The real reason is that the "Contact Us" button is taking two rows instead of one like the other buttons.
The problem is solved by setting a fixed height for the `anchors`.
[jsFi... |
10,064,044 | Is there a way to synchronize the entry values of a hashmap with a JComboBox. This means that as i add put more items to the hash map, the JComboBox is automatically aware that new items can be selected. | 2012/04/08 | [
"https://Stackoverflow.com/questions/10064044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931037/"
] | You could create your own combobox model by extending `AbstractListModel<E>`, implementing `ComboBoxModel<E>`, `ListModel<E>`, `MutableComboBoxModel<E>`, and using a `TreeMap<T, E>` as the nucleus of the model class (TreeMap instead of HashMap since the combobox model's data must be maintained in a certain order). Just... | extends HashMap to implement Observable interface just put Observor update function in
add method of HashMap and listen for update in your jComboBox |
157,640 | Imagine a CPT, let us call it "News". This News Post type is mainly used for displaying short News inline on the front page. But some of those News will be longer, mandating to only display an excerpt on the front page and having a single view. The rule would probably be that I put the text used on the front page in th... | 2014/08/13 | [
"https://wordpress.stackexchange.com/questions/157640",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/47733/"
] | My idea is simple: **register the CPT using `'publicly_queryable' => TRUE`** and then conditionally makes the post type not publicly queryable when a single news that has no content is queried.
This implies that we have to change `'publicly_queryable'` argument after the post type is registered. Something easy: all po... | >
> Just filtering those without content probably wouldn't suffice
>
>
>
Why not? That would seem to be the simplest solution.
Unless I am misunderstanding your intent, it seems that checking to see if the post have content and only showing a link if it does will get you where you want to be.
On the single templ... |
148,764 | I have a 10W SMPS circuit powering a home appliance like this:

I need to extract a zero-crossing pulse from this circuit which would then be fed to a micro-controller. To this end, I am considering the following modification to the circuit:
 and the time when the rectified voltage is close to zero is maybe 2 degrees of one cycle. At a 20ms period of AC, a couple of degrees is about 100us. It's getting to close to not working is my impression.
Looking at the frequency response graph on... | Andy aka is correct, but if you still want to give it a try I'd suggest the following modification

[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2f3nRcg.png) – Schematic created using [CircuitLab](https://www.circuitlab.com/)
ETA - ... |
148,764 | I have a 10W SMPS circuit powering a home appliance like this:

I need to extract a zero-crossing pulse from this circuit which would then be fed to a micro-controller. To this end, I am considering the following modification to the circuit:
 +/-10V then you need to supply sufficient current to the LED to make that... | The rise/fall time of the opto is about 20 microseconds (1000 ohm load) and the time when the rectified voltage is close to zero is maybe 2 degrees of one cycle. At a 20ms period of AC, a couple of degrees is about 100us. It's getting to close to not working is my impression.
Looking at the frequency response graph on... |
148,764 | I have a 10W SMPS circuit powering a home appliance like this:

I need to extract a zero-crossing pulse from this circuit which would then be fed to a micro-controller. To this end, I am considering the following modification to the circuit:
 +/-10V then you need to supply sufficient current to the LED to make that... | Andy aka is correct, but if you still want to give it a try I'd suggest the following modification

[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2f3nRcg.png) – Schematic created using [CircuitLab](https://www.circuitlab.com/)
ETA - ... |
38,445,862 | I know I can just copy the function by reference, but I want to understand what's going on in the following code that produces a segfault.
```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int return0()
{
return 0;
}
int main()
{
int (*r0c)(void) = malloc(100);
memcpy(r0c, return0, 100);
... | 2016/07/18 | [
"https://Stackoverflow.com/questions/38445862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3602516/"
] | The memory pages used by `malloc` to allocate memory are not marked as executable. You can't copy code to the heap and expect it to run.
If you want to do something like that you have to go deeper into the operating system, and allocate pages yourself. Then you need to mark those as executable. You would most likely n... | Malloc returns a pointer to an allocated memory (100 bytes in your case). This memory area is uninitialized; assuming that memory could be executed by the CPU, for your code to work, you would have to fill those 100 bytes with the executable instructions that the function implements (if indeed it can be held in 100 byt... |
38,445,862 | I know I can just copy the function by reference, but I want to understand what's going on in the following code that produces a segfault.
```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int return0()
{
return 0;
}
int main()
{
int (*r0c)(void) = malloc(100);
memcpy(r0c, return0, 100);
... | 2016/07/18 | [
"https://Stackoverflow.com/questions/38445862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3602516/"
] | The memory pages used by `malloc` to allocate memory are not marked as executable. You can't copy code to the heap and expect it to run.
If you want to do something like that you have to go deeper into the operating system, and allocate pages yourself. Then you need to mark those as executable. You would most likely n... | The standard says:
>
> The `memcpy` function copies `n` characters from the ***object*** pointed to by `s2` into the object pointed to by `s1`.
>
>
>
[C2011, 7.24.2.1/2; emphasis added]
In the standard's terminology, functions are not "objects". The standard does not define behavior for the case where the source... |
38,445,862 | I know I can just copy the function by reference, but I want to understand what's going on in the following code that produces a segfault.
```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int return0()
{
return 0;
}
int main()
{
int (*r0c)(void) = malloc(100);
memcpy(r0c, return0, 100);
... | 2016/07/18 | [
"https://Stackoverflow.com/questions/38445862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3602516/"
] | The memory pages used by `malloc` to allocate memory are not marked as executable. You can't copy code to the heap and expect it to run.
If you want to do something like that you have to go deeper into the operating system, and allocate pages yourself. Then you need to mark those as executable. You would most likely n... | As was said in some comments, you need to make the data executable. This requires communicating with the OS to change protections on the data. On Linux, this is the system call `int mprotect(void* addr, size_t len, int prot)` (see <http://man7.org/linux/man-pages/man2/mprotect.2.html>).
Here is a Windows solution usin... |
38,445,862 | I know I can just copy the function by reference, but I want to understand what's going on in the following code that produces a segfault.
```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int return0()
{
return 0;
}
int main()
{
int (*r0c)(void) = malloc(100);
memcpy(r0c, return0, 100);
... | 2016/07/18 | [
"https://Stackoverflow.com/questions/38445862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3602516/"
] | The standard says:
>
> The `memcpy` function copies `n` characters from the ***object*** pointed to by `s2` into the object pointed to by `s1`.
>
>
>
[C2011, 7.24.2.1/2; emphasis added]
In the standard's terminology, functions are not "objects". The standard does not define behavior for the case where the source... | Malloc returns a pointer to an allocated memory (100 bytes in your case). This memory area is uninitialized; assuming that memory could be executed by the CPU, for your code to work, you would have to fill those 100 bytes with the executable instructions that the function implements (if indeed it can be held in 100 byt... |
38,445,862 | I know I can just copy the function by reference, but I want to understand what's going on in the following code that produces a segfault.
```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int return0()
{
return 0;
}
int main()
{
int (*r0c)(void) = malloc(100);
memcpy(r0c, return0, 100);
... | 2016/07/18 | [
"https://Stackoverflow.com/questions/38445862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3602516/"
] | As was said in some comments, you need to make the data executable. This requires communicating with the OS to change protections on the data. On Linux, this is the system call `int mprotect(void* addr, size_t len, int prot)` (see <http://man7.org/linux/man-pages/man2/mprotect.2.html>).
Here is a Windows solution usin... | Malloc returns a pointer to an allocated memory (100 bytes in your case). This memory area is uninitialized; assuming that memory could be executed by the CPU, for your code to work, you would have to fill those 100 bytes with the executable instructions that the function implements (if indeed it can be held in 100 byt... |
38,445,862 | I know I can just copy the function by reference, but I want to understand what's going on in the following code that produces a segfault.
```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int return0()
{
return 0;
}
int main()
{
int (*r0c)(void) = malloc(100);
memcpy(r0c, return0, 100);
... | 2016/07/18 | [
"https://Stackoverflow.com/questions/38445862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3602516/"
] | The standard says:
>
> The `memcpy` function copies `n` characters from the ***object*** pointed to by `s2` into the object pointed to by `s1`.
>
>
>
[C2011, 7.24.2.1/2; emphasis added]
In the standard's terminology, functions are not "objects". The standard does not define behavior for the case where the source... | As was said in some comments, you need to make the data executable. This requires communicating with the OS to change protections on the data. On Linux, this is the system call `int mprotect(void* addr, size_t len, int prot)` (see <http://man7.org/linux/man-pages/man2/mprotect.2.html>).
Here is a Windows solution usin... |
2,996,417 | I am trying to write XML data using Stax where the content itself is HTML
If I try
```
xtw.writeStartElement("contents");
xtw.writeCharacters("<b>here</b>");
xtw.writeEndElement();
```
I get this
```
<contents><b>here</b></contents>
```
Then I notice the CDATA method and change my code to:
```
xtw.w... | 2010/06/08 | [
"https://Stackoverflow.com/questions/2996417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60593/"
] | The issue is that is not raw text it is an element so you should be writing
```
xtw.writeStartElement("contents");
xtw.writeStartElement("b");
xtw.writeCData("here");
xtw.writeEndElement();
xtw.writeEndElement();
``` | If your XML and HTML are not too big, you could make a workaround:
```
xtw.writeStartElement("contents");
xtw.writeCharacters("anUniqueIdentifierForReplace"); // <--
xtw.writeEndElement();
```
When you have your XML as a String:
```
xmlAsString.replace("anUniqueIdentifierForReplace", yourHtmlAsString);
```
I know... |
2,996,417 | I am trying to write XML data using Stax where the content itself is HTML
If I try
```
xtw.writeStartElement("contents");
xtw.writeCharacters("<b>here</b>");
xtw.writeEndElement();
```
I get this
```
<contents><b>here</b></contents>
```
Then I notice the CDATA method and change my code to:
```
xtw.w... | 2010/06/08 | [
"https://Stackoverflow.com/questions/2996417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60593/"
] | The issue is that is not raw text it is an element so you should be writing
```
xtw.writeStartElement("contents");
xtw.writeStartElement("b");
xtw.writeCData("here");
xtw.writeEndElement();
xtw.writeEndElement();
``` | If the blob of html is actually xhtml then I'd suggest doing something like (in pseudo-code):
```
xtw.writeStartElement("contents")
XMLReader xtr=new XMLReader();
xtr.read(blob);
Dom dom=xtr.getDom();
for(element e:dom){
xtw.writeElement(e);
}
xtw.writeEndElement();
```
or something like that. I had to do somet... |
2,996,417 | I am trying to write XML data using Stax where the content itself is HTML
If I try
```
xtw.writeStartElement("contents");
xtw.writeCharacters("<b>here</b>");
xtw.writeEndElement();
```
I get this
```
<contents><b>here</b></contents>
```
Then I notice the CDATA method and change my code to:
```
xtw.w... | 2010/06/08 | [
"https://Stackoverflow.com/questions/2996417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60593/"
] | If you want the XML to be included AS XML and not as character data, then it has to be parsed at some point. If you don't want to manually do the parsing yourself, you have two alternatives:
(1) Use external parsed entities -- in this case the external file will be pulled in and parsed by the XML parser. When the out... | If the blob of html is actually xhtml then I'd suggest doing something like (in pseudo-code):
```
xtw.writeStartElement("contents")
XMLReader xtr=new XMLReader();
xtr.read(blob);
Dom dom=xtr.getDom();
for(element e:dom){
xtw.writeElement(e);
}
xtw.writeEndElement();
```
or something like that. I had to do somet... |
2,996,417 | I am trying to write XML data using Stax where the content itself is HTML
If I try
```
xtw.writeStartElement("contents");
xtw.writeCharacters("<b>here</b>");
xtw.writeEndElement();
```
I get this
```
<contents><b>here</b></contents>
```
Then I notice the CDATA method and change my code to:
```
xtw.w... | 2010/06/08 | [
"https://Stackoverflow.com/questions/2996417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60593/"
] | The issue is that is not raw text it is an element so you should be writing
```
xtw.writeStartElement("contents");
xtw.writeStartElement("b");
xtw.writeCData("here");
xtw.writeEndElement();
xtw.writeEndElement();
``` | If you want to embed a large HTML document in an XML document then CDATA imho is the way to go. That way you don't have to understand or process the internal structure and you can later change the document type from HTML to something else without much hassle. Also *I think* you can't embed e.g. DOCTYPE instructions dir... |
2,996,417 | I am trying to write XML data using Stax where the content itself is HTML
If I try
```
xtw.writeStartElement("contents");
xtw.writeCharacters("<b>here</b>");
xtw.writeEndElement();
```
I get this
```
<contents><b>here</b></contents>
```
Then I notice the CDATA method and change my code to:
```
xtw.w... | 2010/06/08 | [
"https://Stackoverflow.com/questions/2996417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60593/"
] | If you want the XML to be included AS XML and not as character data, then it has to be parsed at some point. If you don't want to manually do the parsing yourself, you have two alternatives:
(1) Use external parsed entities -- in this case the external file will be pulled in and parsed by the XML parser. When the out... | If your XML and HTML are not too big, you could make a workaround:
```
xtw.writeStartElement("contents");
xtw.writeCharacters("anUniqueIdentifierForReplace"); // <--
xtw.writeEndElement();
```
When you have your XML as a String:
```
xmlAsString.replace("anUniqueIdentifierForReplace", yourHtmlAsString);
```
I know... |
2,996,417 | I am trying to write XML data using Stax where the content itself is HTML
If I try
```
xtw.writeStartElement("contents");
xtw.writeCharacters("<b>here</b>");
xtw.writeEndElement();
```
I get this
```
<contents><b>here</b></contents>
```
Then I notice the CDATA method and change my code to:
```
xtw.w... | 2010/06/08 | [
"https://Stackoverflow.com/questions/2996417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60593/"
] | The issue is that is not raw text it is an element so you should be writing
```
xtw.writeStartElement("contents");
xtw.writeStartElement("b");
xtw.writeCData("here");
xtw.writeEndElement();
xtw.writeEndElement();
``` | I don't see what the problem is with parsing the large block of XML you want to insert into your output. Use a StAX parser to parse it, and just write code to forward all of the events to your existing serializer (variable "xtw"). |
2,996,417 | I am trying to write XML data using Stax where the content itself is HTML
If I try
```
xtw.writeStartElement("contents");
xtw.writeCharacters("<b>here</b>");
xtw.writeEndElement();
```
I get this
```
<contents><b>here</b></contents>
```
Then I notice the CDATA method and change my code to:
```
xtw.w... | 2010/06/08 | [
"https://Stackoverflow.com/questions/2996417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60593/"
] | If you want the XML to be included AS XML and not as character data, then it has to be parsed at some point. If you don't want to manually do the parsing yourself, you have two alternatives:
(1) Use external parsed entities -- in this case the external file will be pulled in and parsed by the XML parser. When the out... | I don't see what the problem is with parsing the large block of XML you want to insert into your output. Use a StAX parser to parse it, and just write code to forward all of the events to your existing serializer (variable "xtw"). |
2,996,417 | I am trying to write XML data using Stax where the content itself is HTML
If I try
```
xtw.writeStartElement("contents");
xtw.writeCharacters("<b>here</b>");
xtw.writeEndElement();
```
I get this
```
<contents><b>here</b></contents>
```
Then I notice the CDATA method and change my code to:
```
xtw.w... | 2010/06/08 | [
"https://Stackoverflow.com/questions/2996417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60593/"
] | The issue is that is not raw text it is an element so you should be writing
```
xtw.writeStartElement("contents");
xtw.writeStartElement("b");
xtw.writeCData("here");
xtw.writeEndElement();
xtw.writeEndElement();
``` | The problem is not "here", it's `<b></b>`.
Add the `<b>` element as a child of contents and you'll be able to do it. Any library like JDOM or DOM4J will allow you to do this. The general case is to parse the content into an XML DOM and add the root element as a child of `<contents>`.
You can't add escaped values outs... |
2,996,417 | I am trying to write XML data using Stax where the content itself is HTML
If I try
```
xtw.writeStartElement("contents");
xtw.writeCharacters("<b>here</b>");
xtw.writeEndElement();
```
I get this
```
<contents><b>here</b></contents>
```
Then I notice the CDATA method and change my code to:
```
xtw.w... | 2010/06/08 | [
"https://Stackoverflow.com/questions/2996417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60593/"
] | If you want the XML to be included AS XML and not as character data, then it has to be parsed at some point. If you don't want to manually do the parsing yourself, you have two alternatives:
(1) Use external parsed entities -- in this case the external file will be pulled in and parsed by the XML parser. When the out... | If you want to embed a large HTML document in an XML document then CDATA imho is the way to go. That way you don't have to understand or process the internal structure and you can later change the document type from HTML to something else without much hassle. Also *I think* you can't embed e.g. DOCTYPE instructions dir... |
2,996,417 | I am trying to write XML data using Stax where the content itself is HTML
If I try
```
xtw.writeStartElement("contents");
xtw.writeCharacters("<b>here</b>");
xtw.writeEndElement();
```
I get this
```
<contents><b>here</b></contents>
```
Then I notice the CDATA method and change my code to:
```
xtw.w... | 2010/06/08 | [
"https://Stackoverflow.com/questions/2996417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60593/"
] | The issue is that is not raw text it is an element so you should be writing
```
xtw.writeStartElement("contents");
xtw.writeStartElement("b");
xtw.writeCData("here");
xtw.writeEndElement();
xtw.writeEndElement();
``` | If you want the XML to be included AS XML and not as character data, then it has to be parsed at some point. If you don't want to manually do the parsing yourself, you have two alternatives:
(1) Use external parsed entities -- in this case the external file will be pulled in and parsed by the XML parser. When the out... |
148,585 | Question:
Prove that there exists an algorithm that can decide using at most n-1 comparisons whether a n-element array contains only equal numbers.
We use an algorithm that loops through all the elements in the array, comparing Ai with Ai+1 to check if both are equal, where 0 <= i < n. If there exists some i, such th... | 2022/01/22 | [
"https://cs.stackexchange.com/questions/148585",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/134808/"
] | How about considering [proof by induction](https://en.wikipedia.org/wiki/Mathematical_induction).
1. Given an array with 2 elements we make one comparison of those two elements, they are either the same or they aren't.
2. We assume that there exists an algorithm that that needs at most n-1 comparisons to check if n el... | Let a sequence of $n$ elements. If all pairs of consecutive elements are equal, then by transitivity all elements are equal. By contradiction, if they are not all equal, then there is certainly a pair of consecutive elements that differ.
Hence
$$\bigwedge\_{i=0}^{n-1} (A\_i=A\_{i+1})$$ settles the query, in $n-1$ com... |
58,318,488 | I've been playing around with YouTube API to display playlist on a side bar as explained in the [thread](https://stackoverflow.com/questions/57459015/how-to-embed-a-youtube-playlist-with-a-sidebar). I have given the full code as well in the [codepen link](https://codepen.io/skyrocker/pen/jONrvwO).
However, IE failing ... | 2019/10/10 | [
"https://Stackoverflow.com/questions/58318488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12160249/"
] | If you want to have the most recent item first but the rest in ascending order, then you can just sort normally in ascending order. Since the last element would be the most recent, you can then rotate it to the front of the array with [`Array#pop`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Globa... | Let's assume that is your data:
```
var result = [{
name: "Mango",
modifiedDate: "Mon Oct 10 2019 00:00:00 GMT-0700 (PDT)"
}, {
name: "Banana",
modifiedDate: "Sun Oct 9 2019 00:00:00 GMT-0700 (PDT)"
}, {
name: "Kivi",
modifiedDate: "Sat Oct 8 2019 00:00:00 GMT-0700 (PDT)"
... |
58,318,488 | I've been playing around with YouTube API to display playlist on a side bar as explained in the [thread](https://stackoverflow.com/questions/57459015/how-to-embed-a-youtube-playlist-with-a-sidebar). I have given the full code as well in the [codepen link](https://codepen.io/skyrocker/pen/jONrvwO).
However, IE failing ... | 2019/10/10 | [
"https://Stackoverflow.com/questions/58318488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12160249/"
] | If you want to have the most recent item first but the rest in ascending order, then you can just sort normally in ascending order. Since the last element would be the most recent, you can then rotate it to the front of the array with [`Array#pop`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Globa... | ```js
let notesInfo = []
if (_.isArray(result)) {
console.log(result, '-----------');
notesInfo = _.sortBy(result, ['modifiedDate']).reverse();
} else {
notesInfo = result;
}
console.log(notesInfo)
```
This works as expected. Thanks |
94,181 | [Source](http://www.imdb.com/title/tt1371111/synopsis?ref_=tt_stry_pl)
>
> she meets a man named Hae-Joo Im, who it is revealed was behind her friend, and then her.
>
>
>
What does this mean behind her friend, and then her? | 2016/06/19 | [
"https://ell.stackexchange.com/questions/94181",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/36149/"
] | I like to think of it as the difference between "weather" and "climate".
Weather is what's going on right now. Being "cheerful" means that, right now, you're upbeat and feeling good. - Like if the weather is sunny.
Climate is what the overall weather is like for a region. While it may be sunny today, if the general c... | The definitions can be confusing since it would lead one to believe that to being happy is a condition of being cheerful.
Robbins is referring to "happy" as a general contented state of being. We all know the feeling when things are going our way, the sun is to our back, and everything is going smoothly and well.
Bei... |
94,181 | [Source](http://www.imdb.com/title/tt1371111/synopsis?ref_=tt_stry_pl)
>
> she meets a man named Hae-Joo Im, who it is revealed was behind her friend, and then her.
>
>
>
What does this mean behind her friend, and then her? | 2016/06/19 | [
"https://ell.stackexchange.com/questions/94181",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/36149/"
] | The definitions can be confusing since it would lead one to believe that to being happy is a condition of being cheerful.
Robbins is referring to "happy" as a general contented state of being. We all know the feeling when things are going our way, the sun is to our back, and everything is going smoothly and well.
Bei... | Be cheerful no matter what happens... |
94,181 | [Source](http://www.imdb.com/title/tt1371111/synopsis?ref_=tt_stry_pl)
>
> she meets a man named Hae-Joo Im, who it is revealed was behind her friend, and then her.
>
>
>
What does this mean behind her friend, and then her? | 2016/06/19 | [
"https://ell.stackexchange.com/questions/94181",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/36149/"
] | I like to think of it as the difference between "weather" and "climate".
Weather is what's going on right now. Being "cheerful" means that, right now, you're upbeat and feeling good. - Like if the weather is sunny.
Climate is what the overall weather is like for a region. While it may be sunny today, if the general c... | Be cheerful no matter what happens... |
21,651,567 | I'm using LoopBack ver. 1.6 and have a local mongoDB server running for development using he following datasource configuration:
```
"mongodb": {
"defaultForType": "mongodb",
"connector": "loopback-connector-mongodb",
"database": "xxxdbname",
"host": "localhost",
"port": "27017"
},
```
Now I ... | 2014/02/08 | [
"https://Stackoverflow.com/questions/21651567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2808320/"
] | This is a TODO for LoopBack to support configuration of datasources/models from environment variables and other sources. One idea is to use a template engine to load datasources.json so that it can have variables to be resolved at runtime.
Related to your question, LoopBack allows you to configure the datasource using... | This has now (as of June 27 2014) been [addressed](https://github.com/strongloop/loopback/issues/174#issuecomment-47375714): create a file `datasources.local.js` with the following content (where `mongodb` is your data source name):
```
var mongoUri = process.env.MONGOLAB_URI ||
process.env.MONGOHQ_URL ||
'mongodb... |
127,754 | When using **Notes** I often find myself changing the color of the text (usually to blue or red) as an additional way to indicate emphasis (alongside *italics* and **bold**).
The shortcut for displaying the available colors is **Command-Shift-C** but that still requires the user to use the mouse to click on a particu... | 2014/04/16 | [
"https://apple.stackexchange.com/questions/127754",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/74154/"
] | This isn't **exactly** what you were asking for, but perhaps it is close enough.
Just below the menu place where you bring up the color picker (Format->Font->Show Colors) are two other menu items: Copy Style and Paste Style. This is what worked for me:
1. Select some text in your note
2. Manually set the color, like ... | In TextEdit you can do something like:
```
tell application "System Events" to tell window 1 of process "TextEdit"
set {x, y} to value of attribute "AXSelectedTextRange" of text area 1 of scroll area 1
end tell
tell application "TextEdit"
set color of characters x thru y of document 1 to {65535, 0, 0}
end tell... |
127,754 | When using **Notes** I often find myself changing the color of the text (usually to blue or red) as an additional way to indicate emphasis (alongside *italics* and **bold**).
The shortcut for displaying the available colors is **Command-Shift-C** but that still requires the user to use the mouse to click on a particu... | 2014/04/16 | [
"https://apple.stackexchange.com/questions/127754",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/74154/"
] | This isn't **exactly** what you were asking for, but perhaps it is close enough.
Just below the menu place where you bring up the color picker (Format->Font->Show Colors) are two other menu items: Copy Style and Paste Style. This is what worked for me:
1. Select some text in your note
2. Manually set the color, like ... | You are right -- there's no shortcut (yet) to change the color in Notes (source:<https://support.apple.com/en-au/HT201236>).
The closest shortcut would be command + T which opens the Font window where you can change font color. |
127,754 | When using **Notes** I often find myself changing the color of the text (usually to blue or red) as an additional way to indicate emphasis (alongside *italics* and **bold**).
The shortcut for displaying the available colors is **Command-Shift-C** but that still requires the user to use the mouse to click on a particu... | 2014/04/16 | [
"https://apple.stackexchange.com/questions/127754",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/74154/"
] | This isn't **exactly** what you were asking for, but perhaps it is close enough.
Just below the menu place where you bring up the color picker (Format->Font->Show Colors) are two other menu items: Copy Style and Paste Style. This is what worked for me:
1. Select some text in your note
2. Manually set the color, like ... | Here's how to change text colour in Notes.app with a single hotkey:
Setup:
------
Use this AppleScript code which performs the whole thing (this example is for red text):
```
set noteBody to "<body><p style=\"color:#FF0000;\" >styletext</p></body>"
tell application "Notes"
activate
tell default account to t... |
127,754 | When using **Notes** I often find myself changing the color of the text (usually to blue or red) as an additional way to indicate emphasis (alongside *italics* and **bold**).
The shortcut for displaying the available colors is **Command-Shift-C** but that still requires the user to use the mouse to click on a particu... | 2014/04/16 | [
"https://apple.stackexchange.com/questions/127754",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/74154/"
] | Here's how to change text colour in Notes.app with a single hotkey:
Setup:
------
Use this AppleScript code which performs the whole thing (this example is for red text):
```
set noteBody to "<body><p style=\"color:#FF0000;\" >styletext</p></body>"
tell application "Notes"
activate
tell default account to t... | In TextEdit you can do something like:
```
tell application "System Events" to tell window 1 of process "TextEdit"
set {x, y} to value of attribute "AXSelectedTextRange" of text area 1 of scroll area 1
end tell
tell application "TextEdit"
set color of characters x thru y of document 1 to {65535, 0, 0}
end tell... |
127,754 | When using **Notes** I often find myself changing the color of the text (usually to blue or red) as an additional way to indicate emphasis (alongside *italics* and **bold**).
The shortcut for displaying the available colors is **Command-Shift-C** but that still requires the user to use the mouse to click on a particu... | 2014/04/16 | [
"https://apple.stackexchange.com/questions/127754",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/74154/"
] | Here's how to change text colour in Notes.app with a single hotkey:
Setup:
------
Use this AppleScript code which performs the whole thing (this example is for red text):
```
set noteBody to "<body><p style=\"color:#FF0000;\" >styletext</p></body>"
tell application "Notes"
activate
tell default account to t... | You are right -- there's no shortcut (yet) to change the color in Notes (source:<https://support.apple.com/en-au/HT201236>).
The closest shortcut would be command + T which opens the Font window where you can change font color. |
244,868 | I am new to physics and I understand *gravity* is a pulling force.
Let's assume a *ball* has been placed on the ground. Does *gravity* has any role after I placed an object (e.g. ball) on ground?
Sorry, if I asked something silly or the question was wrong. | 2016/03/22 | [
"https://physics.stackexchange.com/questions/244868",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/111520/"
] | yes: the gravity maintain the ball on the floor. And if the ball is soft, it is maintained squeezed. | The force of gravity never stops acting on the object. However, the gravity is balanced out by an equal and opposite normal force. Gravity simply keeps the object stuck to the floor. It does not stop existing; it is merely balanced and therefore has no overall impact on the object's motion. Hope this helps! -Alm. |
244,868 | I am new to physics and I understand *gravity* is a pulling force.
Let's assume a *ball* has been placed on the ground. Does *gravity* has any role after I placed an object (e.g. ball) on ground?
Sorry, if I asked something silly or the question was wrong. | 2016/03/22 | [
"https://physics.stackexchange.com/questions/244868",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/111520/"
] | All object with mass has gravity. mass is the amount of matter in that object.
That's why the weight of an object feels less on moon even if the mass is same. Earth's gravity is that force that attracts every objects towards its centre. Due to this gravity we could land on the earth surface even after we jump on it. w... | The force of gravity never stops acting on the object. However, the gravity is balanced out by an equal and opposite normal force. Gravity simply keeps the object stuck to the floor. It does not stop existing; it is merely balanced and therefore has no overall impact on the object's motion. Hope this helps! -Alm. |
244,868 | I am new to physics and I understand *gravity* is a pulling force.
Let's assume a *ball* has been placed on the ground. Does *gravity* has any role after I placed an object (e.g. ball) on ground?
Sorry, if I asked something silly or the question was wrong. | 2016/03/22 | [
"https://physics.stackexchange.com/questions/244868",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/111520/"
] | The ball is in an equillibrium of two forces: the gravity and the pressing force from the ground.
You can say, that the two cancel out. But there is, in practice a difference, if you have no forces acting or some forces that cancel out. Because usually the forces change, if you change the system. In your example, the... | The force of gravity never stops acting on the object. However, the gravity is balanced out by an equal and opposite normal force. Gravity simply keeps the object stuck to the floor. It does not stop existing; it is merely balanced and therefore has no overall impact on the object's motion. Hope this helps! -Alm. |
1,085,486 | Can I embed an XML file in HTML without using iFrames?
I want to show XSL-transformed XML(which, is HTML as a result of transformation) as a part of my HTML document. Hope this makes it clearer.
If my description of problem is unclear, please tell me and I will try to explain it more. | 2009/07/06 | [
"https://Stackoverflow.com/questions/1085486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6613/"
] | While it doesn't address your question of reasonable design, here's a query that gets you both counts at once:
```
select
sum(case when score = 1 then 1 else 0 end) 'positive'
, sum(case when score = -1 then 1 else 0 end) 'negative'
, objectId
from
ratings
where
objectId = @objectId ...
group by
ob... | ```
select object_id,
sum(case when score = 1 then 1 else 0) upvotes,
sum(case when score = -1 then -1 else 0) downvotes,
sum(score)
from ratings
group by object_id
```
Perhaps something like that. |
1,085,486 | Can I embed an XML file in HTML without using iFrames?
I want to show XSL-transformed XML(which, is HTML as a result of transformation) as a part of my HTML document. Hope this makes it clearer.
If my description of problem is unclear, please tell me and I will try to explain it more. | 2009/07/06 | [
"https://Stackoverflow.com/questions/1085486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6613/"
] | While it doesn't address your question of reasonable design, here's a query that gets you both counts at once:
```
select
sum(case when score = 1 then 1 else 0 end) 'positive'
, sum(case when score = -1 then 1 else 0 end) 'negative'
, objectId
from
ratings
where
objectId = @objectId ...
group by
ob... | This should do it:
```
SELECT
UserID, ObjectID,
SUM(CASE WHEN score=1 Then 1 Else 0 End) as UpVotes,
SUM(CASE WHEN score=-1 Then 1 Else 0 End) as DownVotes,
FROM YourTable
GROUP BY UserID, ObjectID
``` |
36,196,094 | I try to upload file using Yii2 file upload and the file path was successful saved to the database but the file was not saved to the directory I specify.. below is my code..
```
<?php
namespace backend\models;
use yii\base\Model;
use yii\web\UploadedFile;
use yii\Validators\FileValidator;
use Yii;
class UploadForm ex... | 2016/03/24 | [
"https://Stackoverflow.com/questions/36196094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1977250/"
] | ```
<!-- http://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
```
note to
>
> javax.servlet-api
>
>
>
instead of
>
> servlet-api
>
>
> | include maven dependency for javax.servlet api, something like this
```
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0</version>
<scope>provided</scope>
```
Refer [this](https://stackoverflow.com/questions/1979957/maven-dependency-for-servlet-3-0-api) for more |
36,196,094 | I try to upload file using Yii2 file upload and the file path was successful saved to the database but the file was not saved to the directory I specify.. below is my code..
```
<?php
namespace backend\models;
use yii\base\Model;
use yii\web\UploadedFile;
use yii\Validators\FileValidator;
use Yii;
class UploadForm ex... | 2016/03/24 | [
"https://Stackoverflow.com/questions/36196094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1977250/"
] | ```
<!-- http://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
```
note to
>
> javax.servlet-api
>
>
>
instead of
>
> servlet-api
>
>
> | After spending 4 hours on this thing, finally found the solution.
The thing is since Servlet API 5.0, the API moved from the package **javax.servlet** to **jakarta.servlet**
So instead of adding dependency of javax , add dependency of jakarta in pom of the project
```
<dependency>
<groupId>jakarta.servlet</gr... |
14,935,350 | I am using this `std::bind` to bind function outside the class and gives a strange behavior.
It somewhat controls the value of private member variables.
```
//MClass.h
typedef std::function<void(void)> Action;
class MClass {
public:
Action OnLeftClick;
//some other functions here
private:
int totalContents;
... | 2013/02/18 | [
"https://Stackoverflow.com/questions/14935350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1833197/"
] | In general plotBands doesn't have any tooltip or legend options, however it is possible to add some custom events to plotBand, for example mouseover. See: <http://api.highcharts.com/highcharts#xAxis.plotBands.events>
So you can create your own tooltip for this. | Since it's *(for instance)* not possible, you can place a `subtitle` below the chart (in my case, a gauge). For example:
```
subtitle: {
text: '<span style="background-color: #55BF3B; border-radius: 2px; padding: 1px 2px;">' +
'0-10' +
'</span>' +
'<span style="background-color: #... |
14,935,350 | I am using this `std::bind` to bind function outside the class and gives a strange behavior.
It somewhat controls the value of private member variables.
```
//MClass.h
typedef std::function<void(void)> Action;
class MClass {
public:
Action OnLeftClick;
//some other functions here
private:
int totalContents;
... | 2013/02/18 | [
"https://Stackoverflow.com/questions/14935350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1833197/"
] | In general plotBands doesn't have any tooltip or legend options, however it is possible to add some custom events to plotBand, for example mouseover. See: <http://api.highcharts.com/highcharts#xAxis.plotBands.events>
So you can create your own tooltip for this. | It is actually possible to make quite elegant labels for gauge plotbands by attaching text to the svg path elements that are generated by Highcharts. By doing this, you can get text that actually follows the curve of the plotband. Specifically look at the code in the annonymous function that triggers after the gauge ha... |
14,935,350 | I am using this `std::bind` to bind function outside the class and gives a strange behavior.
It somewhat controls the value of private member variables.
```
//MClass.h
typedef std::function<void(void)> Action;
class MClass {
public:
Action OnLeftClick;
//some other functions here
private:
int totalContents;
... | 2013/02/18 | [
"https://Stackoverflow.com/questions/14935350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1833197/"
] | Since it's *(for instance)* not possible, you can place a `subtitle` below the chart (in my case, a gauge). For example:
```
subtitle: {
text: '<span style="background-color: #55BF3B; border-radius: 2px; padding: 1px 2px;">' +
'0-10' +
'</span>' +
'<span style="background-color: #... | It is actually possible to make quite elegant labels for gauge plotbands by attaching text to the svg path elements that are generated by Highcharts. By doing this, you can get text that actually follows the curve of the plotband. Specifically look at the code in the annonymous function that triggers after the gauge ha... |
67,120 | In *Tractatus Logico-Philosophicus* Ludwig Wittgenstein says that every elementary proposition is a picture. It is clear that we must make a distinction between elementary propositions and other propositions, because we cannot consider a negation of an elementary proposition to be a picture.
For example the propositi... | 2019/09/16 | [
"https://philosophy.stackexchange.com/questions/67120",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/42315/"
] | Propositions associated with facts or states of affair are pictures of those facts or states of affairs. In contrast to tautologies and contradictions they have sense and because of that they have true-false poles. Anat Biletzki and Anat Matar provide this description:
>
> Tautologies and contradictions, the proposit... | >
> In Tractatus Logico-Philosophicus Ludwig Wittgenstein says that every elementary proposition is a picture.
>
>
>
Clearly, propositions are not visual pictures.
Dictionaries provide apt definitions of the meaning of the word "picture" as it was used by Wittgenstein:
>
> Picture
>
>
> 6. The main circumstan... |
27,916,600 | I've been trying to use a Single JavaScript object in multiple files. For that I chose singleton design pattern in JavaScript.
**mySingleton.js**
```
var mySingleton = (function () {
var instance;
function init() {
function privateMethod(){
console.log( "I am private" );
}
var privateVariable = "Im also private";... | 2015/01/13 | [
"https://Stackoverflow.com/questions/27916600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2549668/"
] | Looking at the issue Dateofbirth is probably a datetime column.
A datetime column has both a date part and time part.So, your query with date alone will translate as
```
SELECT * FROM student
WHERE Dateofbirth >= '2014-10-03 00:00:00.000'
AND Dateofbirth <= '2014-10-03 00:00:00.000'
```
So, to get the entire day t... | ```
SELECT * FROM student
WHERE Dateofbirth >= '2014-10-03'
AND Dateofbirth <= '2014-10-03'
```
This means show only data which have only `2014-10-03` value. There is hour is also in your date, and your date string is without hour,minute, second. So in compare it will not get.
The problem will solved by type castin... |
27,916,600 | I've been trying to use a Single JavaScript object in multiple files. For that I chose singleton design pattern in JavaScript.
**mySingleton.js**
```
var mySingleton = (function () {
var instance;
function init() {
function privateMethod(){
console.log( "I am private" );
}
var privateVariable = "Im also private";... | 2015/01/13 | [
"https://Stackoverflow.com/questions/27916600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2549668/"
] | ```
SELECT * FROM student
WHERE Dateofbirth >= '2014-10-03'
AND Dateofbirth <= '2014-10-03'
```
This means show only data which have only `2014-10-03` value. There is hour is also in your date, and your date string is without hour,minute, second. So in compare it will not get.
The problem will solved by type castin... | As already mentioned, the time-part of your column (hour/minute etc) is the reason for that behavior.
In T-SQL, you can also use [DATEDIFF](http://msdn.microsoft.com/library/ms189794.aspx) to get the data for one specific date:
```
SELECT * FROM student
WHERE DATEDIFF(d, Dateofbirth, '2014-10-03') = 0
``` |
27,916,600 | I've been trying to use a Single JavaScript object in multiple files. For that I chose singleton design pattern in JavaScript.
**mySingleton.js**
```
var mySingleton = (function () {
var instance;
function init() {
function privateMethod(){
console.log( "I am private" );
}
var privateVariable = "Im also private";... | 2015/01/13 | [
"https://Stackoverflow.com/questions/27916600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2549668/"
] | Looking at the issue Dateofbirth is probably a datetime column.
A datetime column has both a date part and time part.So, your query with date alone will translate as
```
SELECT * FROM student
WHERE Dateofbirth >= '2014-10-03 00:00:00.000'
AND Dateofbirth <= '2014-10-03 00:00:00.000'
```
So, to get the entire day t... | As already mentioned, the time-part of your column (hour/minute etc) is the reason for that behavior.
In T-SQL, you can also use [DATEDIFF](http://msdn.microsoft.com/library/ms189794.aspx) to get the data for one specific date:
```
SELECT * FROM student
WHERE DATEDIFF(d, Dateofbirth, '2014-10-03') = 0
``` |
27,916,600 | I've been trying to use a Single JavaScript object in multiple files. For that I chose singleton design pattern in JavaScript.
**mySingleton.js**
```
var mySingleton = (function () {
var instance;
function init() {
function privateMethod(){
console.log( "I am private" );
}
var privateVariable = "Im also private";... | 2015/01/13 | [
"https://Stackoverflow.com/questions/27916600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2549668/"
] | Looking at the issue Dateofbirth is probably a datetime column.
A datetime column has both a date part and time part.So, your query with date alone will translate as
```
SELECT * FROM student
WHERE Dateofbirth >= '2014-10-03 00:00:00.000'
AND Dateofbirth <= '2014-10-03 00:00:00.000'
```
So, to get the entire day t... | The query should work if you stored only dates in `Dateofbirth`. If you try the following script you'll get the expected results, `AAA`, `BBB`:
```
create table students(
ID int primary key identity,
Name varchar(50),
Dateofbirth datetime)
insert into students (Name,Dateofbirth)
values ('AAA','2014-10-03'... |
27,916,600 | I've been trying to use a Single JavaScript object in multiple files. For that I chose singleton design pattern in JavaScript.
**mySingleton.js**
```
var mySingleton = (function () {
var instance;
function init() {
function privateMethod(){
console.log( "I am private" );
}
var privateVariable = "Im also private";... | 2015/01/13 | [
"https://Stackoverflow.com/questions/27916600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2549668/"
] | The query should work if you stored only dates in `Dateofbirth`. If you try the following script you'll get the expected results, `AAA`, `BBB`:
```
create table students(
ID int primary key identity,
Name varchar(50),
Dateofbirth datetime)
insert into students (Name,Dateofbirth)
values ('AAA','2014-10-03'... | As already mentioned, the time-part of your column (hour/minute etc) is the reason for that behavior.
In T-SQL, you can also use [DATEDIFF](http://msdn.microsoft.com/library/ms189794.aspx) to get the data for one specific date:
```
SELECT * FROM student
WHERE DATEDIFF(d, Dateofbirth, '2014-10-03') = 0
``` |
66,533,146 | I am using MariaDB and I would like to generate a dummy result set of a number range. The following works well:
```
select 0.0 as x
union select 0.1
union select 0.2
union select 0.3
union select 0.4
union select 0.5
union select 0.6
union select 0.7
union select 0.8
union select 0.9
union select 1.0
from dual
```
B... | 2021/03/08 | [
"https://Stackoverflow.com/questions/66533146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1062189/"
] | Using `VALUES`:
```
VALUES (0.0),(0.1),(0.2),(0.3),(0.4),(0.5),(0.6),(0.7),(0.8),(0.9),(1.0)
```
It makes sense when the list is static.
**[db<>fiddle demo](https://dbfiddle.uk/?rdbms=mariadb_10.5&fiddle=bb0ef7b2ef72b9b6b45dcea64779217b)**
---
MySQL version will require adding `ROW`
```
VALUES ROW(0.0), ROW(0.1)... | You could use a recursive CTE here:
```sql
WITH RECURSIVE cte (n) AS (
SELECT 0.0
UNION ALL
SELECT n + 0.1 FROM cte WHERE n < 1.0
)
SELECT * FROM cte;
```
[](https://i.stack.imgur.com/Is7MH.png)
[Demo
----](https://dbfiddle.uk/?... |
66,533,146 | I am using MariaDB and I would like to generate a dummy result set of a number range. The following works well:
```
select 0.0 as x
union select 0.1
union select 0.2
union select 0.3
union select 0.4
union select 0.5
union select 0.6
union select 0.7
union select 0.8
union select 0.9
union select 1.0
from dual
```
B... | 2021/03/08 | [
"https://Stackoverflow.com/questions/66533146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1062189/"
] | For MariaDB 10.1+ you can use a [Sequence table](https://mariadb.com/kb/en/sequence-storage-engine/):
```
SELECT 0.1 * seq AS col
FROM seq_0_to_10
```
See the [demo](https://dbfiddle.uk/?rdbms=mariadb_10.3&fiddle=b0cbd3ed4da4d3204df1a7f9d2978c38). | You could use a recursive CTE here:
```sql
WITH RECURSIVE cte (n) AS (
SELECT 0.0
UNION ALL
SELECT n + 0.1 FROM cte WHERE n < 1.0
)
SELECT * FROM cte;
```
[](https://i.stack.imgur.com/Is7MH.png)
[Demo
----](https://dbfiddle.uk/?... |
66,533,146 | I am using MariaDB and I would like to generate a dummy result set of a number range. The following works well:
```
select 0.0 as x
union select 0.1
union select 0.2
union select 0.3
union select 0.4
union select 0.5
union select 0.6
union select 0.7
union select 0.8
union select 0.9
union select 1.0
from dual
```
B... | 2021/03/08 | [
"https://Stackoverflow.com/questions/66533146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1062189/"
] | For MariaDB 10.1+ you can use a [Sequence table](https://mariadb.com/kb/en/sequence-storage-engine/):
```
SELECT 0.1 * seq AS col
FROM seq_0_to_10
```
See the [demo](https://dbfiddle.uk/?rdbms=mariadb_10.3&fiddle=b0cbd3ed4da4d3204df1a7f9d2978c38). | Using `VALUES`:
```
VALUES (0.0),(0.1),(0.2),(0.3),(0.4),(0.5),(0.6),(0.7),(0.8),(0.9),(1.0)
```
It makes sense when the list is static.
**[db<>fiddle demo](https://dbfiddle.uk/?rdbms=mariadb_10.5&fiddle=bb0ef7b2ef72b9b6b45dcea64779217b)**
---
MySQL version will require adding `ROW`
```
VALUES ROW(0.0), ROW(0.1)... |
6,512,589 | I need to get the value of a hidden input field using JS,
```
var credoff = parseInt($(this).children('input.credoff:hidden').val());
```
which works fine in FF but does not work in IE, the input im talking of is the following...
```
<input type='hidden' value='$row->coff' class='credoff' name='credoff'/>
``` | 2011/06/28 | [
"https://Stackoverflow.com/questions/6512589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766532/"
] | Could you try `input[type='hidden']`? | This might work:
```
var credoff = parseInt($(this).children('input[name="credoff"]').val());
```
Although I don't know what 'this' is. More code would be helpful. |
6,512,589 | I need to get the value of a hidden input field using JS,
```
var credoff = parseInt($(this).children('input.credoff:hidden').val());
```
which works fine in FF but does not work in IE, the input im talking of is the following...
```
<input type='hidden' value='$row->coff' class='credoff' name='credoff'/>
``` | 2011/06/28 | [
"https://Stackoverflow.com/questions/6512589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766532/"
] | Could you try `input[type='hidden']`? | Or this:
```
var credoff = parseInt($(':input[type:"hidden"][name:"credoff"]').val());
``` |
6,512,589 | I need to get the value of a hidden input field using JS,
```
var credoff = parseInt($(this).children('input.credoff:hidden').val());
```
which works fine in FF but does not work in IE, the input im talking of is the following...
```
<input type='hidden' value='$row->coff' class='credoff' name='credoff'/>
``` | 2011/06/28 | [
"https://Stackoverflow.com/questions/6512589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766532/"
] | Could you try `input[type='hidden']`? | Are there many other elements with the 'credoff' class?
There are comments in the jQuery documentation for the :hidden selector related to this.
<http://api.jquery.com/hidden-selector/>
Apparently in IE, the :hidden selector also selects elements, so it's possible that you're not getting back the right element. You... |
6,512,589 | I need to get the value of a hidden input field using JS,
```
var credoff = parseInt($(this).children('input.credoff:hidden').val());
```
which works fine in FF but does not work in IE, the input im talking of is the following...
```
<input type='hidden' value='$row->coff' class='credoff' name='credoff'/>
``` | 2011/06/28 | [
"https://Stackoverflow.com/questions/6512589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766532/"
] | Could you try `input[type='hidden']`? | This must work:
var credoff = parseInt($(this).children('input[name="credoff"][type="hidden"]').val()); |
6,512,589 | I need to get the value of a hidden input field using JS,
```
var credoff = parseInt($(this).children('input.credoff:hidden').val());
```
which works fine in FF but does not work in IE, the input im talking of is the following...
```
<input type='hidden' value='$row->coff' class='credoff' name='credoff'/>
``` | 2011/06/28 | [
"https://Stackoverflow.com/questions/6512589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766532/"
] | This might work:
```
var credoff = parseInt($(this).children('input[name="credoff"]').val());
```
Although I don't know what 'this' is. More code would be helpful. | Or this:
```
var credoff = parseInt($(':input[type:"hidden"][name:"credoff"]').val());
``` |
6,512,589 | I need to get the value of a hidden input field using JS,
```
var credoff = parseInt($(this).children('input.credoff:hidden').val());
```
which works fine in FF but does not work in IE, the input im talking of is the following...
```
<input type='hidden' value='$row->coff' class='credoff' name='credoff'/>
``` | 2011/06/28 | [
"https://Stackoverflow.com/questions/6512589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766532/"
] | This might work:
```
var credoff = parseInt($(this).children('input[name="credoff"]').val());
```
Although I don't know what 'this' is. More code would be helpful. | This must work:
var credoff = parseInt($(this).children('input[name="credoff"][type="hidden"]').val()); |
6,512,589 | I need to get the value of a hidden input field using JS,
```
var credoff = parseInt($(this).children('input.credoff:hidden').val());
```
which works fine in FF but does not work in IE, the input im talking of is the following...
```
<input type='hidden' value='$row->coff' class='credoff' name='credoff'/>
``` | 2011/06/28 | [
"https://Stackoverflow.com/questions/6512589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766532/"
] | Are there many other elements with the 'credoff' class?
There are comments in the jQuery documentation for the :hidden selector related to this.
<http://api.jquery.com/hidden-selector/>
Apparently in IE, the :hidden selector also selects elements, so it's possible that you're not getting back the right element. You... | Or this:
```
var credoff = parseInt($(':input[type:"hidden"][name:"credoff"]').val());
``` |
6,512,589 | I need to get the value of a hidden input field using JS,
```
var credoff = parseInt($(this).children('input.credoff:hidden').val());
```
which works fine in FF but does not work in IE, the input im talking of is the following...
```
<input type='hidden' value='$row->coff' class='credoff' name='credoff'/>
``` | 2011/06/28 | [
"https://Stackoverflow.com/questions/6512589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766532/"
] | Are there many other elements with the 'credoff' class?
There are comments in the jQuery documentation for the :hidden selector related to this.
<http://api.jquery.com/hidden-selector/>
Apparently in IE, the :hidden selector also selects elements, so it's possible that you're not getting back the right element. You... | This must work:
var credoff = parseInt($(this).children('input[name="credoff"][type="hidden"]').val()); |
15,728,356 | I am trying to implement wild cards in Java.
Here is the code I have :
```
public class Assign {
public boolean compare(String s1, String s2)
{
char [] s3 = s1.toCharArray();
char [] s4 = s2.toCharArray();
int i,j;
int k = 0;
for(i=0;i<s3.length;i++)
{
for(j=0;j<s4.length;j++)
... | 2013/03/31 | [
"https://Stackoverflow.com/questions/15728356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2195499/"
] | Use regular expressions. Don't reinvent the wheel. | As i said, you can do this extracting simple sub string's.Here I checked
for one case, do same thing for other cases.
```
public class Assign {
public boolean compare(String s1, String s2)
{ String s="";
try
{
s=s1.substring(s1.indexOf('a')+2,s1.indexOf('b')-1);
}
catch(IndexOutOfBoundsException... |
15,728,356 | I am trying to implement wild cards in Java.
Here is the code I have :
```
public class Assign {
public boolean compare(String s1, String s2)
{
char [] s3 = s1.toCharArray();
char [] s4 = s2.toCharArray();
int i,j;
int k = 0;
for(i=0;i<s3.length;i++)
{
for(j=0;j<s4.length;j++)
... | 2013/03/31 | [
"https://Stackoverflow.com/questions/15728356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2195499/"
] | Use regular expressions. Don't reinvent the wheel. | >
> Assuming that the regex will only contain either `*` or `?` at any
> instance of time
>
>
>
I have written a simple program using `substring()` & `indexOf()`, which tires to evaluate the `regex` against the string to compare.
```
package problems;
public class WildCardCompare {
public boolean compare(S... |
15,728,356 | I am trying to implement wild cards in Java.
Here is the code I have :
```
public class Assign {
public boolean compare(String s1, String s2)
{
char [] s3 = s1.toCharArray();
char [] s4 = s2.toCharArray();
int i,j;
int k = 0;
for(i=0;i<s3.length;i++)
{
for(j=0;j<s4.length;j++)
... | 2013/03/31 | [
"https://Stackoverflow.com/questions/15728356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2195499/"
] | >
> Assuming that the regex will only contain either `*` or `?` at any
> instance of time
>
>
>
I have written a simple program using `substring()` & `indexOf()`, which tires to evaluate the `regex` against the string to compare.
```
package problems;
public class WildCardCompare {
public boolean compare(S... | As i said, you can do this extracting simple sub string's.Here I checked
for one case, do same thing for other cases.
```
public class Assign {
public boolean compare(String s1, String s2)
{ String s="";
try
{
s=s1.substring(s1.indexOf('a')+2,s1.indexOf('b')-1);
}
catch(IndexOutOfBoundsException... |
37,295,373 | I seem to have problem with installing LAPACK library to my Visual Studio 2015 (C++, Windows 10).
I have downloaded precompiled libraries from here: <https://icl.cs.utk.edu/lapack-for-windows/lapack/#libraries>
I have also written "liblapack.lib" and "libblas.lib" to **Project properties -> Linker -> Input -> Additio... | 2016/05/18 | [
"https://Stackoverflow.com/questions/37295373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6349994/"
] | According to the docs, 12 is the limit. I don't think there is an easy way to change that. I think you just have to reduce the number of arguments e.g. by using some constants or passing functions as arguments:
instead of this function with 4 arguments:
```
gnuplot> f(a1,a2,a3,a4)=(a1*a2)/(a3*a4)
gnuplot> plot f(x,1,... | If some arguments correspond to a column in a data file with a know column number, your function can use `column` to access them without passing them as parameters.
E.g., instead of
```
f(x,y,z,a)=x*y/z**a
plot for [a=1:2] "f.gdat" using 1:(f($1,$2,$3,a)) title "a=".a
```
you can do:
```
COL_X=1
COL_Y=2
COL_Z=3
f(... |
63,020,420 | First question here, so please forgive me if I don't ask it correctly.
I have the following code:
```
function getMapPlaces() {
var key =
"_961jkjpPEKGMX6YlEZm8awCLH1avefv5RUIhm6ciV_8kfRRr-gRay5GIICt9Ih-ggqoKNJdnSD7rBuIwmcbiaHSLUFWeJmOaHmzO5t4UwYvJCfX7hy38gy4IhUWX3Yx;";
var settings = {
async: true,
c... | 2020/07/21 | [
"https://Stackoverflow.com/questions/63020420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13793407/"
] | You could use the Authorisation Code Flow with PKCE instead so the client is only exposed to the code which is then exchanged server-side using the token endpoint for cognito user pool / id token, access token and refresh token. You can return the user pool token to the client as that will expire after an hour while ke... | I've found a workable solution that does not involve fetching the Access Token server side. We use AppSync for GraphQL - the access token is passed with each GraphQL request as an authorization header, and it can be accessed in the request template as follows:
```
#set( $myMap = {
"field": "${field}",
"user_id... |
412,236 | When recording a video, sometimes it's preferable to blur the background, especially when working from home or outside the typical office environment.
I didn't figure out [how to blur the background of a photo booth video recording](https://apple.stackexchange.com/q/412180/290197), so I record without blurring the bac... | 2021/01/28 | [
"https://apple.stackexchange.com/questions/412236",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/290197/"
] | The easiest approach to attain your goal is to use a video calling application in combination with screen recording.
For the video calling application I suggest [Jitsi](https://jitsi.org/) as it works in your browser, but you can also look into any other popular application like Teams, Zoom or Skype.
1. Go to [meet.j... | There is an app for Mac and Windows called ChromaCam.
It has minimum requirements such as MacOs 10.14 but it can accomplish this as well. |
18,206,578 | I have following pointcut and the given advice in AspectJ
```
@Pointcut("(call(* org.openqa.selenium.WebElement.sendKeys(..)))")
public void onWebElementAction() {
}
@After("onWebElementAction() && target(webelement)")
public void afterWebElementAction(JoinPoint joinPoint, WebElement webelement) {
System.out.... | 2013/08/13 | [
"https://Stackoverflow.com/questions/18206578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188936/"
] | While the answer flagged as correct does point out the issue, it doesn't explain the issue nor suggests a solution which does actually exist. Let me begin with giving a bit more of detail around the underlying issue here which is the way the `WebElement` could have been instantiated.
On one hand, when a `WebElement` g... | This is a wild guess since I don't see a case where it actually worked. From the exception it seems that the WebElement that is being passed to `afterWebElementAction` is initialized via `PageFactory`. My guess is that if you pass WebElement derived from driver.findElement(), to `afterWebElementAction`, you wouldn't ge... |
57,391,050 | Testing mobile application using appium. When I run to test, my application opens, I can do some action, and then when I login, app takes me to browser to login to the cloud which is OK, but my problem is in the emulator. I have a question that pops-up, Open with Chrome or other app (JUST ONCE / ALWAYS). How can I avoi... | 2019/08/07 | [
"https://Stackoverflow.com/questions/57391050",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1637053/"
] | If you really use an XSLT 2 processor and that way you can use XPath 2 at the expression level of the `select` attribute then you can solve it with `select="'test d''un apostrophe'"` (see <https://www.w3.org/TR/xpath20/#prod-xpath-StringLiteral> on the rules for string literals) but it seems easier to just use
```
<xs... | This is a common situation about delimiters when you have a hosted language: in this case, XSLT as XML vocabulary and XPath as string in some attribute. Such common that it was foreseen in the [specification](https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Introduction):
>
> XPath expressions often occur in XM... |
32,303,812 | ```
create table EmployeeStatistics
(
EmployeeIdNo int,
Name varchar(30),
Salary integer,
Benefits integer,
Position varchar(25),
Allowance integer,
DateOfBirth integer,
Telephone integer,
primary key (EmployeeIdNo)
);
```
I want `Position` to acc... | 2015/08/31 | [
"https://Stackoverflow.com/questions/32303812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5283294/"
] | You can use a check constraint where you compare the value with the [upper case](https://msdn.microsoft.com/en-us/library/ms180055.aspx) value using a binary collation or a case sensitive collation.
```
alter table dbo.EmployeeStatistics
add constraint CK_EmployeeStatistics_Position
check (upper(Position) = Posit... | Actually, rather than adding a constraint to only *accept* uppercase, I would be looking into a simple trigger to *force* it to uppercase.
There's little point in annoying a user of your database when they enter lowercase when it can be fixed quite easily without loss of information. Some people dislike silent changes... |
24,886,162 | I have 4 tables
```
- User
- UserId
- UserName
- Device
- DeviceId
- DeviceTypeId (FK DeviceType)
- DeviceType
- DeviceTypeId
- UserDevice
- UserId (FK User)
- DeviceId (FK Device)
```
I would like to get list of devices that 1 user ha... | 2014/07/22 | [
"https://Stackoverflow.com/questions/24886162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1458128/"
] | You must add this permission in your AndroidManifest.xml
```
<uses-permission android:name="android.permission.SEND_SMS">
```
Did you? | Use `Log.i("phonenumber",textphoneNo.getText().toString())` to see phoneNumber Value. I think it's value is `null`. |
24,886,162 | I have 4 tables
```
- User
- UserId
- UserName
- Device
- DeviceId
- DeviceTypeId (FK DeviceType)
- DeviceType
- DeviceTypeId
- UserDevice
- UserId (FK User)
- DeviceId (FK Device)
```
I would like to get list of devices that 1 user ha... | 2014/07/22 | [
"https://Stackoverflow.com/questions/24886162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1458128/"
] | You must add this permission in your AndroidManifest.xml
```
<uses-permission android:name="android.permission.SEND_SMS">
```
Did you? | Make sure that u added sms send permission in the Manifest.xml file |
8,927,478 | I'm using a jQuery slider to adjust the padding of a DIV containing paragraph text. As I increase the padding on all sides equally, it should force the enclosed paragraphs into an ever-narrower column, in the center of the page.
This works in Firefox, but in Chrome the paragraph widths remain constant (i.e. they don't... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8927478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/671114/"
] | >
> I know there are ways to force (or trick) Chrome to
> refresh/redraw/recalcuate the page elements, but don't know how to do
> it. Any ideas?
>
>
>
Taken from here: [How can I force WebKit to redraw/repaint to propagate style changes?](https://stackoverflow.com/questions/3485365/how-can-i-force-webkit-to-redr... | You can add the overflow and float properties:
```
#preview > div {
padding: 5%;
overflow: auto;
float: left;
}
``` |
8,927,478 | I'm using a jQuery slider to adjust the padding of a DIV containing paragraph text. As I increase the padding on all sides equally, it should force the enclosed paragraphs into an ever-narrower column, in the center of the page.
This works in Firefox, but in Chrome the paragraph widths remain constant (i.e. they don't... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8927478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/671114/"
] | I'm using `fadeTo` to force chrome to refresh.
Not sure but I guess it's the animate on `fadeTo` that does the trick
try that line on **jsfiddle**.
```
$('#preview > div').css('padding', ui.value + '%' ).children('p').fadeTo(1, .99).fadeTo(1, 1);
``` | You can add the overflow and float properties:
```
#preview > div {
padding: 5%;
overflow: auto;
float: left;
}
``` |
8,927,478 | I'm using a jQuery slider to adjust the padding of a DIV containing paragraph text. As I increase the padding on all sides equally, it should force the enclosed paragraphs into an ever-narrower column, in the center of the page.
This works in Firefox, but in Chrome the paragraph widths remain constant (i.e. they don't... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8927478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/671114/"
] | >
> I know there are ways to force (or trick) Chrome to
> refresh/redraw/recalcuate the page elements, but don't know how to do
> it. Any ideas?
>
>
>
Taken from here: [How can I force WebKit to redraw/repaint to propagate style changes?](https://stackoverflow.com/questions/3485365/how-can-i-force-webkit-to-redr... | I'm using `fadeTo` to force chrome to refresh.
Not sure but I guess it's the animate on `fadeTo` that does the trick
try that line on **jsfiddle**.
```
$('#preview > div').css('padding', ui.value + '%' ).children('p').fadeTo(1, .99).fadeTo(1, 1);
``` |
23 | On iOS devices you can take a screenshot by pressing the home & sleep buttons at the same time. Is there a similar way to take a screenshot with Windows Phone? | 2012/04/24 | [
"https://windowsphone.stackexchange.com/questions/23",
"https://windowsphone.stackexchange.com",
"https://windowsphone.stackexchange.com/users/13/"
] | There are a few ways to take screenshots:
1. If you're just a developer and just want to take screenshots for marketing your app, you can use the [emulator's screenshot tool](http://msdn.microsoft.com/en-us/library/gg442300%28v=VS.92%29.aspx).
2. If you have a developer-unlocked phone ([$99 a year from Microsoft](http... | In Windows Phone 8 you are able to save a screenshot by holding both the power button (often on the side of the phone, between the volume buttons and the camera button) and the home button (the middle button under the screen, with the Windows logo on it) for some time. Such screenshots are saved in the Screenshot album... |
23 | On iOS devices you can take a screenshot by pressing the home & sleep buttons at the same time. Is there a similar way to take a screenshot with Windows Phone? | 2012/04/24 | [
"https://windowsphone.stackexchange.com/questions/23",
"https://windowsphone.stackexchange.com",
"https://windowsphone.stackexchange.com/users/13/"
] | For devices still running Windows Phone 8, hold the power button and then press the Windows key. The screenshot will then be stored in a "Screenshots" album in the photos.
For those updated to Windows Phone 8.1, press and hold `power`+`volume up` simultaneously.
There is a video [guide from Microsoft on YouTube](http... | There are a few ways to take screenshots:
1. If you're just a developer and just want to take screenshots for marketing your app, you can use the [emulator's screenshot tool](http://msdn.microsoft.com/en-us/library/gg442300%28v=VS.92%29.aspx).
2. If you have a developer-unlocked phone ([$99 a year from Microsoft](http... |
23 | On iOS devices you can take a screenshot by pressing the home & sleep buttons at the same time. Is there a similar way to take a screenshot with Windows Phone? | 2012/04/24 | [
"https://windowsphone.stackexchange.com/questions/23",
"https://windowsphone.stackexchange.com",
"https://windowsphone.stackexchange.com/users/13/"
] | There are a few ways to take screenshots:
1. If you're just a developer and just want to take screenshots for marketing your app, you can use the [emulator's screenshot tool](http://msdn.microsoft.com/en-us/library/gg442300%28v=VS.92%29.aspx).
2. If you have a developer-unlocked phone ([$99 a year from Microsoft](http... | Windows Phone 8
---------------
Press and hold Start button and Power icon at the same time to take a picture of your screen.
Windows Phone 8.1
-----------------
Press the Power icon and Volume Up buttons at the same time to take a picture of your screen.
Windows Phone 7, 7.5
--------------------
It do not provide... |
23 | On iOS devices you can take a screenshot by pressing the home & sleep buttons at the same time. Is there a similar way to take a screenshot with Windows Phone? | 2012/04/24 | [
"https://windowsphone.stackexchange.com/questions/23",
"https://windowsphone.stackexchange.com",
"https://windowsphone.stackexchange.com/users/13/"
] | For devices still running Windows Phone 8, hold the power button and then press the Windows key. The screenshot will then be stored in a "Screenshots" album in the photos.
For those updated to Windows Phone 8.1, press and hold `power`+`volume up` simultaneously.
There is a video [guide from Microsoft on YouTube](http... | In Windows Phone 8 you are able to save a screenshot by holding both the power button (often on the side of the phone, between the volume buttons and the camera button) and the home button (the middle button under the screen, with the Windows logo on it) for some time. Such screenshots are saved in the Screenshot album... |
23 | On iOS devices you can take a screenshot by pressing the home & sleep buttons at the same time. Is there a similar way to take a screenshot with Windows Phone? | 2012/04/24 | [
"https://windowsphone.stackexchange.com/questions/23",
"https://windowsphone.stackexchange.com",
"https://windowsphone.stackexchange.com/users/13/"
] | In Windows Phone 8 you are able to save a screenshot by holding both the power button (often on the side of the phone, between the volume buttons and the camera button) and the home button (the middle button under the screen, with the Windows logo on it) for some time. Such screenshots are saved in the Screenshot album... | Windows Phone 8
---------------
Press and hold Start button and Power icon at the same time to take a picture of your screen.
Windows Phone 8.1
-----------------
Press the Power icon and Volume Up buttons at the same time to take a picture of your screen.
Windows Phone 7, 7.5
--------------------
It do not provide... |
23 | On iOS devices you can take a screenshot by pressing the home & sleep buttons at the same time. Is there a similar way to take a screenshot with Windows Phone? | 2012/04/24 | [
"https://windowsphone.stackexchange.com/questions/23",
"https://windowsphone.stackexchange.com",
"https://windowsphone.stackexchange.com/users/13/"
] | For devices still running Windows Phone 8, hold the power button and then press the Windows key. The screenshot will then be stored in a "Screenshots" album in the photos.
For those updated to Windows Phone 8.1, press and hold `power`+`volume up` simultaneously.
There is a video [guide from Microsoft on YouTube](http... | Windows Phone 8
---------------
Press and hold Start button and Power icon at the same time to take a picture of your screen.
Windows Phone 8.1
-----------------
Press the Power icon and Volume Up buttons at the same time to take a picture of your screen.
Windows Phone 7, 7.5
--------------------
It do not provide... |
27,609,074 | **i used devexpress component**
i set data for **ItemSource** property of **GridControl** in code behhind like this :
```
grid.ItemsSource = query ;
```
query is List
when i filtered or searched in gridcontrol , display rows changed
now i want to get the changed itemsource like this :
```
DataSource = ((IEnumera... | 2014/12/22 | [
"https://Stackoverflow.com/questions/27609074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386406/"
] | `mapM_` is useful for executing something only for its side effects. For example, printing a string to standard output doesn't return anything useful - it returns `()`. If we have a list of three strings, we would end up accumulating a list`[(), (), ()]`. Building this list has a runtime cost, both in terms of speed an... | mapM\_ ignores the result. This means, that no return value will be returned. You can see this in interactive mode:
```
Prelude> mapM (putStrLn . show) [1,2]
1
2
[(),()]
Prelude> mapM_ (putStrLn . show) [1,2]
1
2
``` |
27,609,074 | **i used devexpress component**
i set data for **ItemSource** property of **GridControl** in code behhind like this :
```
grid.ItemsSource = query ;
```
query is List
when i filtered or searched in gridcontrol , display rows changed
now i want to get the changed itemsource like this :
```
DataSource = ((IEnumera... | 2014/12/22 | [
"https://Stackoverflow.com/questions/27609074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386406/"
] | `mapM_` is useful for executing something only for its side effects. For example, printing a string to standard output doesn't return anything useful - it returns `()`. If we have a list of three strings, we would end up accumulating a list`[(), (), ()]`. Building this list has a runtime cost, both in terms of speed an... | The core idea is that `mapM` maps an "action" (ie function of type `a -> m b`) over a list and gives you all the results as a `m [b]`. `mapM_` does the same thing, but never collects the results, returning a `m ()`.
If you care about the results of your `a -> m b` function (ie the `b`s), use `mapM`. If you only care a... |
27,609,074 | **i used devexpress component**
i set data for **ItemSource** property of **GridControl** in code behhind like this :
```
grid.ItemsSource = query ;
```
query is List
when i filtered or searched in gridcontrol , display rows changed
now i want to get the changed itemsource like this :
```
DataSource = ((IEnumera... | 2014/12/22 | [
"https://Stackoverflow.com/questions/27609074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386406/"
] | `mapM_` is useful for executing something only for its side effects. For example, printing a string to standard output doesn't return anything useful - it returns `()`. If we have a list of three strings, we would end up accumulating a list`[(), (), ()]`. Building this list has a runtime cost, both in terms of speed an... | In more general terms, the difference is that `mapM_` only needs to ["consume"](http://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Foldable.html#t:Foldable) all elements of the input, whereas `mapM` also needs to "re-build" the data structure, with new values. That's pretty much trivial for lists: you only need ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.