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 |
|---|---|---|---|---|---|
34,366,605 | I previously relied on the following definition of how to detect a generator:
```
function isGenerator(func) {
return func instanceof Function && func.constructor.name === 'GeneratorFunction';
}
```
Since then however I came across various other verifications, including checks for `next` and `throw` functions on... | 2015/12/19 | [
"https://Stackoverflow.com/questions/34366605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1102051/"
] | >
> I previously relied on the following definition of how to detect a generator […]
>
>
>
That doesn't detect generators, it detects generator functions. And you should not *rely* on such a thing, as every function can return a generator.
>
> Is there a way to implement `isGeneratorFunction` to be considered co... | [ES 6](http://www.ecma-international.org/ecma-262/6.0/#sec-generatorfunctioncreate) says
>
> 9.2.6 GeneratorFunctionCreate (kind, ParameterList, Body, Scope, Strict)
> ========================================================================
>
>
> The abstract operation GeneratorFunctionCreate requires the arguments... |
14,070,481 | I have inherited a web spider application, with all source code. It appears that for normal brochure style websites (say under 15 pages), the software runs perfectly fine.
For others, (over 20ish pages), the software throws the StackOverflowException on the line marked in the code below.
It does not appear to be util... | 2012/12/28 | [
"https://Stackoverflow.com/questions/14070481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1934588/"
] | (I needed more space otherwise I would have added this as a comment to @Jakub Konecki's post.)
I've built several spiders over the years and the only big performance gain for parallelism is the actual downloading of URLs. You might shave a couple of hundred milliseconds of HTML parsing on large documents but the gain ... | I would start by removing all the parallelism - it's probably to excessive anyway and the overhead of creating multiple threads is bigger than the performance gain.
Once you do that, just debug the code and wait for the exception. You can than check the call stack and all the collections.
Stack overflow usually happe... |
97,533 | >
> **Possible Duplicate:**
>
> [How do the tenses in English correspond temporally to one another?](https://english.stackexchange.com/questions/21846/how-do-the-tenses-in-english-correspond-temporally-to-one-another)
>
> [Differences between ways to express future actions](https://english.stackexchange.com/ques... | 2013/01/11 | [
"https://english.stackexchange.com/questions/97533",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/31280/"
] | When you are not sure about a certain usage of a phrase, it is good to use corpora such as
[Corpus of Contemporary American English (COCA)](https://www.english-corpora.org/coca/) to find out how the phrase is being used in novels, magazine articles, etc.
In this scenario, it is not wrong to use *make up my mind* since... | Yes, both seem to be correct in this context. Though "make up my mind" would suggest you had conflicting opinions within yourself and you had to spend quite some time deciding on which.
"Resolve" seems to suggest a decision without having spent much time with different sides of the matter. |
39,302,691 | Can anyone please work out why the background colour for my text-links appear on my image-links despite my every effort to disable it?
I made a [Fiddle](https://jsfiddle.net/25wqoxn0/)
```
<div class="pink">
<p>
The <a href="#" target="blank">link</a>
</p>
<a class="imagelink nohover" href="#" target="_blank... | 2016/09/03 | [
"https://Stackoverflow.com/questions/39302691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2347076/"
] | I find the new systemjs.config from angular to be a bit more messy. This is what i use and it works great:
```
(function(global) {
var map = {
'app': 'src/app',
'@angular': 'node_modules/@angular',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
... | To load modules in `NodeJS`, install `SystemJS` with:
`npm install systemjs`
If transpiling ES modules, install the transpiler plugin following the instructions from the transpiler project page. |
2,797 | **WHAT I WANT**
Call an action and see it succeed at the first execution.
**WHAT IS NOT WORKING**
The function, which I am executing, the first time fails with error:
>
> Error 3080006: Transaction took too long
>
>
> Error Details:
> deadline exceeded
>
>
> pending console output:
>
>
>
**WHAT IS WORKING*... | 2018/10/16 | [
"https://eosio.stackexchange.com/questions/2797",
"https://eosio.stackexchange.com",
"https://eosio.stackexchange.com/users/2159/"
] | The execution time is based on many factors in each execution.
It could be the cache missing or process management could blocks the nodeos process and makes the execution time exceeds the `max-transaction-time`.
The `max-transaction-time` set by nodeos on startup or in the config file controls the time to throw the ... | Due to its subjective nature, transaction execution time is likely to vary each time it is executed. It would take longer time to execute on a slower machine while short time to execute on a faster machine. However, the maximum time a transaction is allowed to execute is 30ms. So if a node can't execute your transactio... |
2,797 | **WHAT I WANT**
Call an action and see it succeed at the first execution.
**WHAT IS NOT WORKING**
The function, which I am executing, the first time fails with error:
>
> Error 3080006: Transaction took too long
>
>
> Error Details:
> deadline exceeded
>
>
> pending console output:
>
>
>
**WHAT IS WORKING*... | 2018/10/16 | [
"https://eosio.stackexchange.com/questions/2797",
"https://eosio.stackexchange.com",
"https://eosio.stackexchange.com/users/2159/"
] | The execution time is based on many factors in each execution.
It could be the cache missing or process management could blocks the nodeos process and makes the execution time exceeds the `max-transaction-time`.
The `max-transaction-time` set by nodeos on startup or in the config file controls the time to throw the ... | I think, it may related with cache (as twksos commented).
<https://github.com/EOSIO/eos/blob/11c25394b6dd05cc3c97f0b7471a84f3d7cfbca3/libraries/chain/include/eosio/chain/wasm_interface_private.hpp#L58>
```
auto it = instantiation_cache.find(code_id);
if(it == instantiation_cache.end()) {
auto timer_pause = fc::... |
2,797 | **WHAT I WANT**
Call an action and see it succeed at the first execution.
**WHAT IS NOT WORKING**
The function, which I am executing, the first time fails with error:
>
> Error 3080006: Transaction took too long
>
>
> Error Details:
> deadline exceeded
>
>
> pending console output:
>
>
>
**WHAT IS WORKING*... | 2018/10/16 | [
"https://eosio.stackexchange.com/questions/2797",
"https://eosio.stackexchange.com",
"https://eosio.stackexchange.com/users/2159/"
] | I think, it may related with cache (as twksos commented).
<https://github.com/EOSIO/eos/blob/11c25394b6dd05cc3c97f0b7471a84f3d7cfbca3/libraries/chain/include/eosio/chain/wasm_interface_private.hpp#L58>
```
auto it = instantiation_cache.find(code_id);
if(it == instantiation_cache.end()) {
auto timer_pause = fc::... | Due to its subjective nature, transaction execution time is likely to vary each time it is executed. It would take longer time to execute on a slower machine while short time to execute on a faster machine. However, the maximum time a transaction is allowed to execute is 30ms. So if a node can't execute your transactio... |
311,199 | 
Just as the capture shows, when you type something using the keyboard, a big label appears at the bottom of the screen showing the keys you typed.
I use Windows & Linux, so I just want to know if there is a similar software to do that? | 2011/07/16 | [
"https://superuser.com/questions/311199",
"https://superuser.com",
"https://superuser.com/users/153029/"
] | For Linux check Screenkey: <https://launchpad.net/screenkey> | There is [Key Jedi](http://osherove.com/blog/2007/6/3/train-to-be-a-keyboard-master-with-keyboard-jedi.html)
>
> Key Jedi allows learning and training to use keyboard shortcuts. **It can be used in presentations, screencasts and videos**, as well as when working with someone else on the same machine to teach new shor... |
311,199 | 
Just as the capture shows, when you type something using the keyboard, a big label appears at the bottom of the screen showing the keys you typed.
I use Windows & Linux, so I just want to know if there is a similar software to do that? | 2011/07/16 | [
"https://superuser.com/questions/311199",
"https://superuser.com",
"https://superuser.com/users/153029/"
] | On Windows there is [Carnac the Magnificent](http://carnackeys.com/).
>
> A keyboard logging and presentation utility for presentations, screencasts, and to help you become a better keyboard user.
>
>
>
Install via Chocolatey:
```
choco install carnac
```
Or Scoop:
```
scoop install carnac
```
Source on Git... | There is [Key Jedi](http://osherove.com/blog/2007/6/3/train-to-be-a-keyboard-master-with-keyboard-jedi.html)
>
> Key Jedi allows learning and training to use keyboard shortcuts. **It can be used in presentations, screencasts and videos**, as well as when working with someone else on the same machine to teach new shor... |
311,199 | 
Just as the capture shows, when you type something using the keyboard, a big label appears at the bottom of the screen showing the keys you typed.
I use Windows & Linux, so I just want to know if there is a similar software to do that? | 2011/07/16 | [
"https://superuser.com/questions/311199",
"https://superuser.com",
"https://superuser.com/users/153029/"
] | For Linux check Screenkey: <https://launchpad.net/screenkey> | On Windows there is [Carnac the Magnificent](http://carnackeys.com/).
>
> A keyboard logging and presentation utility for presentations, screencasts, and to help you become a better keyboard user.
>
>
>
Install via Chocolatey:
```
choco install carnac
```
Or Scoop:
```
scoop install carnac
```
Source on Git... |
29,940,309 | I am trying to extract a string in this format **"[\r\n \"MG480612230220150018\"\r\n]"** using regex, i am trying to match number and alphabet with a min length of 5 character but it is not working, therefore i can guarantee i will extract this data (**MG480612230220150018**)
```
Regex regex = new Regex(@"^[0-... | 2015/04/29 | [
"https://Stackoverflow.com/questions/29940309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4816704/"
] | This is used to define a variable if it is not set.
You can do this to ensure there is a value set!
for example:
```
function iHaveParameters(param1, param2) {
param1 = param1 || {} //empty object
param2 = param2 || "This should be a string"
}
```
And of course as noted, it will only invoke the second value w... | It means: if the object before `||` is null, use a new empty object `{}` instead.
Read more about the operator here: [Is there a "null coalescing" operator in JavaScript?](https://stackoverflow.com/questions/476436/is-there-a-null-coalescing-operator-in-javascript) |
29,940,309 | I am trying to extract a string in this format **"[\r\n \"MG480612230220150018\"\r\n]"** using regex, i am trying to match number and alphabet with a min length of 5 character but it is not working, therefore i can guarantee i will extract this data (**MG480612230220150018**)
```
Regex regex = new Regex(@"^[0-... | 2015/04/29 | [
"https://Stackoverflow.com/questions/29940309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4816704/"
] | As has been said, it's an empty JavaScript object.
What's not so obvious I guess is *why* you would do that. A common reason is to make your code safe if the object happens to be `null` or `undefined`. Consider the example where you are passed an object and want to access an attribute of it:
```
function myFunc(obj) ... | It means: if the object before `||` is null, use a new empty object `{}` instead.
Read more about the operator here: [Is there a "null coalescing" operator in JavaScript?](https://stackoverflow.com/questions/476436/is-there-a-null-coalescing-operator-in-javascript) |
29,940,309 | I am trying to extract a string in this format **"[\r\n \"MG480612230220150018\"\r\n]"** using regex, i am trying to match number and alphabet with a min length of 5 character but it is not working, therefore i can guarantee i will extract this data (**MG480612230220150018**)
```
Regex regex = new Regex(@"^[0-... | 2015/04/29 | [
"https://Stackoverflow.com/questions/29940309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4816704/"
] | This is used to define a variable if it is not set.
You can do this to ensure there is a value set!
for example:
```
function iHaveParameters(param1, param2) {
param1 = param1 || {} //empty object
param2 = param2 || "This should be a string"
}
```
And of course as noted, it will only invoke the second value w... | {} is a short way of declaring an empty object, the same way as using [] do declare an empty array.
`var my = parent.ajax = parent.ajax || {};` means that if the object `parent.ajax` exist then set it as the value. If not, set an empty object instead. |
29,940,309 | I am trying to extract a string in this format **"[\r\n \"MG480612230220150018\"\r\n]"** using regex, i am trying to match number and alphabet with a min length of 5 character but it is not working, therefore i can guarantee i will extract this data (**MG480612230220150018**)
```
Regex regex = new Regex(@"^[0-... | 2015/04/29 | [
"https://Stackoverflow.com/questions/29940309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4816704/"
] | This is used to define a variable if it is not set.
You can do this to ensure there is a value set!
for example:
```
function iHaveParameters(param1, param2) {
param1 = param1 || {} //empty object
param2 = param2 || "This should be a string"
}
```
And of course as noted, it will only invoke the second value w... | As has been said, it's an empty JavaScript object.
What's not so obvious I guess is *why* you would do that. A common reason is to make your code safe if the object happens to be `null` or `undefined`. Consider the example where you are passed an object and want to access an attribute of it:
```
function myFunc(obj) ... |
29,940,309 | I am trying to extract a string in this format **"[\r\n \"MG480612230220150018\"\r\n]"** using regex, i am trying to match number and alphabet with a min length of 5 character but it is not working, therefore i can guarantee i will extract this data (**MG480612230220150018**)
```
Regex regex = new Regex(@"^[0-... | 2015/04/29 | [
"https://Stackoverflow.com/questions/29940309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4816704/"
] | As has been said, it's an empty JavaScript object.
What's not so obvious I guess is *why* you would do that. A common reason is to make your code safe if the object happens to be `null` or `undefined`. Consider the example where you are passed an object and want to access an attribute of it:
```
function myFunc(obj) ... | {} is a short way of declaring an empty object, the same way as using [] do declare an empty array.
`var my = parent.ajax = parent.ajax || {};` means that if the object `parent.ajax` exist then set it as the value. If not, set an empty object instead. |
56,781,783 | a list of ["A","A","A","B","B","B"]
to dictionary of
{'A': 3,
'B': 3}
I've done something like below but i feel like there is a faster/shorter way of doing it?
```
frequencyMap = dict()
letters = ["A","A","A","B","B","B"]
for letter in letters:
if letter not in frequencyMap:
frequencyMap[letter] = 0
... | 2019/06/26 | [
"https://Stackoverflow.com/questions/56781783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1686628/"
] | I've discovered the answer after tracing through CloudTrail. There were two permissions missing from the CodePipeline deployment role which I can't find documented, they are `ecs:RegisterTaskDefinition` and `iam:PassRole` for the ECS Container role. CodeDeploy assumes a different role during deployment that also needs ... | To maybe help here, having had the same issue/error:
Using Cloud-formation, I have a pipeline in account a, with an ecs bluegreen action in account b (TestingAccount):
```
- Name: !Sub BlueGreenDeploy
Actions:
- Name: BlueGreenDeploy
InputArtifacts:
# - Name: ... |
27,337,331 | I have this code:
```
def quiz():
print("Here is a quiz to test your knowledge!")
print()
print("Question 1")
print("How tall is the Eiffel Tower?")
print("a. 350m")
print("b. 342m")
print("c. 324m")
print("d. 1000ft")
answer = input("Make your choice : ")
if answer == "c" :
... | 2014/12/06 | [
"https://Stackoverflow.com/questions/27337331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4332992/"
] | I know this is not part of the question, but conside using a dictionary or list to store the questions, options and answer and just loop over:
```
questions = {
"How tall is the Eiffel Tower?":['a. 350m', 'b. 342m', 'c. 324m', 'd. 1000ft','a'],
"How loud is a sonic boom?":['a. 160dB', 'b. 175dB', 'c. 157dB', '... | You are part way there with:
```
if answer == "a" :
print ("Correct!")
score + 1
```
However, you need to assign the new value to `score`:
```
if answer == "a" :
print ("Correct!")
score = score + 1
```
And you need to start your function with:
```
score = 0
``` |
10,222,568 | I want to use the iPhones's accelerometer to detect motions while driving. I'm a bit confused what the accelerometer actually measures, especially when driving a curve.

As you can see in the picture, a car driving a curve causes two forces. One is the centri... | 2012/04/19 | [
"https://Stackoverflow.com/questions/10222568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996137/"
] | I think it will measure both. But don't forget that the sensor will measure gravity as well. So when your car is not moving, you will still get accelerometer readings. A nice talk on sensors in smartphones <http://www.youtube.com/watch?v=C7JQ7Rpwn2k&feature=results_main&playnext=1&list=PL29AD66D8C4372129> (it's on andr... | Unless you are in free fall **the g-force (gravity) is always measured.** If I understand your setup correctly, the g-force will appear on the z axis, the axis that is vertical in the Earth frame of reference. I cannot tell whether it will be +z or -z, it is partly convention so you will have to check it for yourself.
... |
10,222,568 | I want to use the iPhones's accelerometer to detect motions while driving. I'm a bit confused what the accelerometer actually measures, especially when driving a curve.

As you can see in the picture, a car driving a curve causes two forces. One is the centri... | 2012/04/19 | [
"https://Stackoverflow.com/questions/10222568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996137/"
] | I think it will measure both. But don't forget that the sensor will measure gravity as well. So when your car is not moving, you will still get accelerometer readings. A nice talk on sensors in smartphones <http://www.youtube.com/watch?v=C7JQ7Rpwn2k&feature=results_main&playnext=1&list=PL29AD66D8C4372129> (it's on andr... | Accelerometer measures acceleration of resultant force applied to it (velocity is not a force by the way). In this case force is `F = g + w + c` i.e. vector sum of gravity, centrifugal force (reaction to steering centripetal force, points from the center of the turn) and car acceleration force (a force changing absolut... |
10,222,568 | I want to use the iPhones's accelerometer to detect motions while driving. I'm a bit confused what the accelerometer actually measures, especially when driving a curve.

As you can see in the picture, a car driving a curve causes two forces. One is the centri... | 2012/04/19 | [
"https://Stackoverflow.com/questions/10222568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996137/"
] | Accelerometer measures acceleration of resultant force applied to it (velocity is not a force by the way). In this case force is `F = g + w + c` i.e. vector sum of gravity, centrifugal force (reaction to steering centripetal force, points from the center of the turn) and car acceleration force (a force changing absolut... | Unless you are in free fall **the g-force (gravity) is always measured.** If I understand your setup correctly, the g-force will appear on the z axis, the axis that is vertical in the Earth frame of reference. I cannot tell whether it will be +z or -z, it is partly convention so you will have to check it for yourself.
... |
6,969,584 | Suppose I have function
>
> foo(double \* pa)
>
>
>
where `pa` is either populated from [0] to [100]
OR
`pa` is populated for [0] only.
My function does the following:
>
> foo(double \* pa)
>
>
> {
>
>
> IF (pa is an array of 100) THEN x[0 to 100] = pa[0 to 100]
>
>
> ELSE x[0 to 100] = pa[0]
>
>
> ... | 2011/08/06 | [
"https://Stackoverflow.com/questions/6969584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/882269/"
] | That's not possible. `pa` isn't *populated*, because it is not an array. It is a pointer which, by convention, points to the first element of an array. But its type is simply `pointer to double`, and it has no information about whether it points to a single double, or an array of 1, 10, 100 or 1000 elements.
The "trad... | Given the information in the `foo()` function parameters, it is not possible to find out:
* the number of elements that are "filled in"
* the total number of elements in the array pointed to by `pa`
In order to accomplish this, you will need to pass additional parameters to the `foo()` function that state how big the... |
6,969,584 | Suppose I have function
>
> foo(double \* pa)
>
>
>
where `pa` is either populated from [0] to [100]
OR
`pa` is populated for [0] only.
My function does the following:
>
> foo(double \* pa)
>
>
> {
>
>
> IF (pa is an array of 100) THEN x[0 to 100] = pa[0 to 100]
>
>
> ELSE x[0 to 100] = pa[0]
>
>
> ... | 2011/08/06 | [
"https://Stackoverflow.com/questions/6969584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/882269/"
] | Given the information in the `foo()` function parameters, it is not possible to find out:
* the number of elements that are "filled in"
* the total number of elements in the array pointed to by `pa`
In order to accomplish this, you will need to pass additional parameters to the `foo()` function that state how big the... | You can't. The only thing `foo()` knows `pa` is that it's a pointer, whether it's a null pointer or not, and if it's non-null, what it points to. It can't tell whether it points to a single object or to the first element of an array.
If possible, you should probably `foo()` so the caller has to pass in additional info... |
6,969,584 | Suppose I have function
>
> foo(double \* pa)
>
>
>
where `pa` is either populated from [0] to [100]
OR
`pa` is populated for [0] only.
My function does the following:
>
> foo(double \* pa)
>
>
> {
>
>
> IF (pa is an array of 100) THEN x[0 to 100] = pa[0 to 100]
>
>
> ELSE x[0 to 100] = pa[0]
>
>
> ... | 2011/08/06 | [
"https://Stackoverflow.com/questions/6969584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/882269/"
] | Q: How is foo() going to know whether pa[] is an array of 100?
In general, you have to TELL it. For example:
```
void
foo (double *pa, int len)
{
if (len == 100)
...
else
...
```
If you were coding in C++, however, you could use an STL container such as a vector:
```
void foo (vector<double> & pa)
{
... | Given the information in the `foo()` function parameters, it is not possible to find out:
* the number of elements that are "filled in"
* the total number of elements in the array pointed to by `pa`
In order to accomplish this, you will need to pass additional parameters to the `foo()` function that state how big the... |
6,969,584 | Suppose I have function
>
> foo(double \* pa)
>
>
>
where `pa` is either populated from [0] to [100]
OR
`pa` is populated for [0] only.
My function does the following:
>
> foo(double \* pa)
>
>
> {
>
>
> IF (pa is an array of 100) THEN x[0 to 100] = pa[0 to 100]
>
>
> ELSE x[0 to 100] = pa[0]
>
>
> ... | 2011/08/06 | [
"https://Stackoverflow.com/questions/6969584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/882269/"
] | That's not possible. `pa` isn't *populated*, because it is not an array. It is a pointer which, by convention, points to the first element of an array. But its type is simply `pointer to double`, and it has no information about whether it points to a single double, or an array of 1, 10, 100 or 1000 elements.
The "trad... | You can't. The only thing `foo()` knows `pa` is that it's a pointer, whether it's a null pointer or not, and if it's non-null, what it points to. It can't tell whether it points to a single object or to the first element of an array.
If possible, you should probably `foo()` so the caller has to pass in additional info... |
6,969,584 | Suppose I have function
>
> foo(double \* pa)
>
>
>
where `pa` is either populated from [0] to [100]
OR
`pa` is populated for [0] only.
My function does the following:
>
> foo(double \* pa)
>
>
> {
>
>
> IF (pa is an array of 100) THEN x[0 to 100] = pa[0 to 100]
>
>
> ELSE x[0 to 100] = pa[0]
>
>
> ... | 2011/08/06 | [
"https://Stackoverflow.com/questions/6969584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/882269/"
] | That's not possible. `pa` isn't *populated*, because it is not an array. It is a pointer which, by convention, points to the first element of an array. But its type is simply `pointer to double`, and it has no information about whether it points to a single double, or an array of 1, 10, 100 or 1000 elements.
The "trad... | Based on your [previous question](https://stackoverflow.com/questions/6969465/can-we-create-an-if-statement-that-determines-if-a-variable-has-been-declared-as), combined with this question, I think what you may want is simply an overload, see here:
```
void foo_impl(double * x)
{
// common functionality here
}
vo... |
6,969,584 | Suppose I have function
>
> foo(double \* pa)
>
>
>
where `pa` is either populated from [0] to [100]
OR
`pa` is populated for [0] only.
My function does the following:
>
> foo(double \* pa)
>
>
> {
>
>
> IF (pa is an array of 100) THEN x[0 to 100] = pa[0 to 100]
>
>
> ELSE x[0 to 100] = pa[0]
>
>
> ... | 2011/08/06 | [
"https://Stackoverflow.com/questions/6969584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/882269/"
] | Q: How is foo() going to know whether pa[] is an array of 100?
In general, you have to TELL it. For example:
```
void
foo (double *pa, int len)
{
if (len == 100)
...
else
...
```
If you were coding in C++, however, you could use an STL container such as a vector:
```
void foo (vector<double> & pa)
{
... | You can't. The only thing `foo()` knows `pa` is that it's a pointer, whether it's a null pointer or not, and if it's non-null, what it points to. It can't tell whether it points to a single object or to the first element of an array.
If possible, you should probably `foo()` so the caller has to pass in additional info... |
6,969,584 | Suppose I have function
>
> foo(double \* pa)
>
>
>
where `pa` is either populated from [0] to [100]
OR
`pa` is populated for [0] only.
My function does the following:
>
> foo(double \* pa)
>
>
> {
>
>
> IF (pa is an array of 100) THEN x[0 to 100] = pa[0 to 100]
>
>
> ELSE x[0 to 100] = pa[0]
>
>
> ... | 2011/08/06 | [
"https://Stackoverflow.com/questions/6969584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/882269/"
] | Based on your [previous question](https://stackoverflow.com/questions/6969465/can-we-create-an-if-statement-that-determines-if-a-variable-has-been-declared-as), combined with this question, I think what you may want is simply an overload, see here:
```
void foo_impl(double * x)
{
// common functionality here
}
vo... | You can't. The only thing `foo()` knows `pa` is that it's a pointer, whether it's a null pointer or not, and if it's non-null, what it points to. It can't tell whether it points to a single object or to the first element of an array.
If possible, you should probably `foo()` so the caller has to pass in additional info... |
6,969,584 | Suppose I have function
>
> foo(double \* pa)
>
>
>
where `pa` is either populated from [0] to [100]
OR
`pa` is populated for [0] only.
My function does the following:
>
> foo(double \* pa)
>
>
> {
>
>
> IF (pa is an array of 100) THEN x[0 to 100] = pa[0 to 100]
>
>
> ELSE x[0 to 100] = pa[0]
>
>
> ... | 2011/08/06 | [
"https://Stackoverflow.com/questions/6969584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/882269/"
] | Q: How is foo() going to know whether pa[] is an array of 100?
In general, you have to TELL it. For example:
```
void
foo (double *pa, int len)
{
if (len == 100)
...
else
...
```
If you were coding in C++, however, you could use an STL container such as a vector:
```
void foo (vector<double> & pa)
{
... | Based on your [previous question](https://stackoverflow.com/questions/6969465/can-we-create-an-if-statement-that-determines-if-a-variable-has-been-declared-as), combined with this question, I think what you may want is simply an overload, see here:
```
void foo_impl(double * x)
{
// common functionality here
}
vo... |
60,527,050 | Below is my code. On clicking imageview camera will open and we will capture image. In the below onActivityResult the image size come as the size of thumbnail. I want the actual image size. How to do?
```
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQU... | 2020/03/04 | [
"https://Stackoverflow.com/questions/60527050",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4482409/"
] | -You need to get the full image path , not only the data from the intent extra , and then get your file from that path , only then you can get the real size of the picture .
-you can use some picker library or you can just check this link
[Dialog to pick image from gallery or from camera](https://stackoverflow.com/qu... | Try this ([how do I get file size of temp file in android?](https://stackoverflow.com/questions/10202805/how-do-i-get-file-size-of-temp-file-in-android))
```
File file = new File(selectedPath);
int file_size = Integer.parseInt(String.valueOf(file.length()/1024));
``` |
4,084,373 | I was reading Lie algebra text. In that, I came across the following.
If $A$ and $B \in \mathbb{C}^{d \times d},$ and $A B=B A,$ then
$$
\exp (A) \exp (B)=\exp (B) \exp (A)=\exp (A+B).
$$
But this fails when $A B \neq B A .$
Still we have, $$
\lim \_{k \rightarrow \infty}(\exp (A / k) \exp (B / k))^{k}=\exp (A+B) \qu... | 2021/03/31 | [
"https://math.stackexchange.com/questions/4084373",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/415928/"
] | here are a couple of applications I like.
**1.)** The Lie Product Formula makes it obvious that the infinitessimal generator for a markov process behaves like a standard markov matrix under the image of the exponential map. I.e. $G:= Q+D$ with $Q$ having real non-negative entries (and only zeros on the diagonal) and $... | I'm not sure if this is the kind of thing you're looking for, but here are two examples where the result can be applied.
* Proving that the Lie algebra of a matrix group is closed under addition (where $X$ is defined to be an element of the Lie algebra of $G$ iff $e^{tX} \in G$ for all $t \in \Bbb R$)
* Proving that a... |
39,764,621 | My basic JSON data structure is this:
```
[
{
"data1":"contents of data1",
"data2":"contents of data 2"
},
{
"data1":"contents of data1",
"data2":"contents of data 2"
}
]
```
I tried using `JSONArray myJson = new JSONArray(json);`
but it gives me:
>
> org.json.JSONException: Not a primit... | 2016/09/29 | [
"https://Stackoverflow.com/questions/39764621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1299645/"
] | Iterate your json without key as follows
```
try {
JSONArray jsonArray = new JSONArray("[{\"data1\":\"contents of data1\",\"data2\":\"contents of data 2\"},{\"data1\":\"contents of data1\",\"data2\":\"contents of data 2\"}]");
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = json... | **The reason of that error might be invalid json.**
This is how your data2 key - value pair is
```
"data2":contents of data 2"
```
Put the quotes **"** before **contents** and use this
```
"data2":"contents of data 2"
```
Change all occurences of this error and it should work. Do let me know if it changes any... |
39,764,621 | My basic JSON data structure is this:
```
[
{
"data1":"contents of data1",
"data2":"contents of data 2"
},
{
"data1":"contents of data1",
"data2":"contents of data 2"
}
]
```
I tried using `JSONArray myJson = new JSONArray(json);`
but it gives me:
>
> org.json.JSONException: Not a primit... | 2016/09/29 | [
"https://Stackoverflow.com/questions/39764621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1299645/"
] | Iterate your json without key as follows
```
try {
JSONArray jsonArray = new JSONArray("[{\"data1\":\"contents of data1\",\"data2\":\"contents of data 2\"},{\"data1\":\"contents of data1\",\"data2\":\"contents of data 2\"}]");
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = json... | In python, If u have json data as
**data**=[{
"data1":"contents of data1",
"data2":"contents of data 2"
},
{
"data1":"contents of data1",
"data2":"contents of data 2"
}
]
you can access it using:
print "data1:",**data[0]["data1"]** |
15,684 | Does the existence of evil impinge on atheist philosophy, such that it could be seen as a "problem" with, and not just within, these philosophies in a similar way too theism?
Could e.g. Marxism be seen as a response to that kind of dilemma? | 2014/09/05 | [
"https://philosophy.stackexchange.com/questions/15684",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/-1/"
] | A couple of references might be apposite here:
1. Both Arendts *Totalitarianism* and *Eichman in Jerusalem* where she examines the nature of Stalins Soviet Union & The Nazi Regime, and also the trial of Eichmann, the Nazi war criminal in Jerusalem; the second book is where she coined the phrase 'banality of evil'. Are... | No, the concept of evil does not impinge on atheist philosophy. In a non-religious context evil can be regarded as originating from, for example, psychopathy, sadism, pathological narcissism. Furthermore, where leadership is psychopathic and/or paranoid conformity and authoritarianism can cause evil - or pathological d... |
15,684 | Does the existence of evil impinge on atheist philosophy, such that it could be seen as a "problem" with, and not just within, these philosophies in a similar way too theism?
Could e.g. Marxism be seen as a response to that kind of dilemma? | 2014/09/05 | [
"https://philosophy.stackexchange.com/questions/15684",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/-1/"
] | The Problem of Evil exists in theism because theists need to provide an explanation for how evil can exist in a world created by an infinitely benevolent deity. Since atheists deny claims about the existence of said deity, the problem simply does not exist. The existence of evil does not by itself present a problem to ... | No, the concept of evil does not impinge on atheist philosophy. In a non-religious context evil can be regarded as originating from, for example, psychopathy, sadism, pathological narcissism. Furthermore, where leadership is psychopathic and/or paranoid conformity and authoritarianism can cause evil - or pathological d... |
15,684 | Does the existence of evil impinge on atheist philosophy, such that it could be seen as a "problem" with, and not just within, these philosophies in a similar way too theism?
Could e.g. Marxism be seen as a response to that kind of dilemma? | 2014/09/05 | [
"https://philosophy.stackexchange.com/questions/15684",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/-1/"
] | A couple of references might be apposite here:
1. Both Arendts *Totalitarianism* and *Eichman in Jerusalem* where she examines the nature of Stalins Soviet Union & The Nazi Regime, and also the trial of Eichmann, the Nazi war criminal in Jerusalem; the second book is where she coined the phrase 'banality of evil'. Are... | There are many philosophies for which the existence of error, including moral error, is a problem. These philosophies are justificationist philosophies that claim it is possible and desirable to show ideas are true or probably true. The problem is that if such a method exists then it is possible for people to learn whe... |
15,684 | Does the existence of evil impinge on atheist philosophy, such that it could be seen as a "problem" with, and not just within, these philosophies in a similar way too theism?
Could e.g. Marxism be seen as a response to that kind of dilemma? | 2014/09/05 | [
"https://philosophy.stackexchange.com/questions/15684",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/-1/"
] | The Problem of Evil exists in theism because theists need to provide an explanation for how evil can exist in a world created by an infinitely benevolent deity. Since atheists deny claims about the existence of said deity, the problem simply does not exist. The existence of evil does not by itself present a problem to ... | There are many philosophies for which the existence of error, including moral error, is a problem. These philosophies are justificationist philosophies that claim it is possible and desirable to show ideas are true or probably true. The problem is that if such a method exists then it is possible for people to learn whe... |
15,684 | Does the existence of evil impinge on atheist philosophy, such that it could be seen as a "problem" with, and not just within, these philosophies in a similar way too theism?
Could e.g. Marxism be seen as a response to that kind of dilemma? | 2014/09/05 | [
"https://philosophy.stackexchange.com/questions/15684",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/-1/"
] | A couple of references might be apposite here:
1. Both Arendts *Totalitarianism* and *Eichman in Jerusalem* where she examines the nature of Stalins Soviet Union & The Nazi Regime, and also the trial of Eichmann, the Nazi war criminal in Jerusalem; the second book is where she coined the phrase 'banality of evil'. Are... | The Problem of Evil exists in theism because theists need to provide an explanation for how evil can exist in a world created by an infinitely benevolent deity. Since atheists deny claims about the existence of said deity, the problem simply does not exist. The existence of evil does not by itself present a problem to ... |
15,684 | Does the existence of evil impinge on atheist philosophy, such that it could be seen as a "problem" with, and not just within, these philosophies in a similar way too theism?
Could e.g. Marxism be seen as a response to that kind of dilemma? | 2014/09/05 | [
"https://philosophy.stackexchange.com/questions/15684",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/-1/"
] | A couple of references might be apposite here:
1. Both Arendts *Totalitarianism* and *Eichman in Jerusalem* where she examines the nature of Stalins Soviet Union & The Nazi Regime, and also the trial of Eichmann, the Nazi war criminal in Jerusalem; the second book is where she coined the phrase 'banality of evil'. Are... | The problem of evil does not just arise in theism and deism, but also in e.g. Hegel's absolute idealism.
Whether or not the left Hegelians have the same problem. |
15,684 | Does the existence of evil impinge on atheist philosophy, such that it could be seen as a "problem" with, and not just within, these philosophies in a similar way too theism?
Could e.g. Marxism be seen as a response to that kind of dilemma? | 2014/09/05 | [
"https://philosophy.stackexchange.com/questions/15684",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/-1/"
] | A couple of references might be apposite here:
1. Both Arendts *Totalitarianism* and *Eichman in Jerusalem* where she examines the nature of Stalins Soviet Union & The Nazi Regime, and also the trial of Eichmann, the Nazi war criminal in Jerusalem; the second book is where she coined the phrase 'banality of evil'. Are... | You could argue and this has been the case with some theist that atheism has a big problem with explaining the problem of goodness. In other words how does the atheist explain how any apparent goodness in some people?
On what basis does the human animal decide post coitus cannibalism is abnormal when the black widow s... |
15,684 | Does the existence of evil impinge on atheist philosophy, such that it could be seen as a "problem" with, and not just within, these philosophies in a similar way too theism?
Could e.g. Marxism be seen as a response to that kind of dilemma? | 2014/09/05 | [
"https://philosophy.stackexchange.com/questions/15684",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/-1/"
] | The Problem of Evil exists in theism because theists need to provide an explanation for how evil can exist in a world created by an infinitely benevolent deity. Since atheists deny claims about the existence of said deity, the problem simply does not exist. The existence of evil does not by itself present a problem to ... | The problem of evil does not just arise in theism and deism, but also in e.g. Hegel's absolute idealism.
Whether or not the left Hegelians have the same problem. |
15,684 | Does the existence of evil impinge on atheist philosophy, such that it could be seen as a "problem" with, and not just within, these philosophies in a similar way too theism?
Could e.g. Marxism be seen as a response to that kind of dilemma? | 2014/09/05 | [
"https://philosophy.stackexchange.com/questions/15684",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/-1/"
] | The Problem of Evil exists in theism because theists need to provide an explanation for how evil can exist in a world created by an infinitely benevolent deity. Since atheists deny claims about the existence of said deity, the problem simply does not exist. The existence of evil does not by itself present a problem to ... | You could argue and this has been the case with some theist that atheism has a big problem with explaining the problem of goodness. In other words how does the atheist explain how any apparent goodness in some people?
On what basis does the human animal decide post coitus cannibalism is abnormal when the black widow s... |
21,303,412 | I have functions of this type:
```
type uniRndtype()
{
return typeValue;
}
```
and now I'm trying to wrap them inside another template function like this:
```
template<typename T>
T(* uniRndType(void))()
{
if (is_same<T, bool>::value)
{
return uniRndBool;
} else if (is_same<T, char>::value)
... | 2014/01/23 | [
"https://Stackoverflow.com/questions/21303412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/620029/"
] | ```
template <typename T> T (*uniRndType())()
{
//else
...
}
template <> bool (*uniRndType())()
{
return uniRndBool;
}
template <> char (*uniRndType())()
{
return uniRndChar;
}
```
That's all.
edit: In principle, we must do like @Angew. but it's little troublesome | This won't work because when the compiler expands the template method for a given type the method has to be valid. Your type, T, needs to be compatible with all the return types listed, eg `bool`, `char`, etc. As I mentioned in the comments, if you passed in a `std::string` you wouldn't expect the method to work, would... |
21,303,412 | I have functions of this type:
```
type uniRndtype()
{
return typeValue;
}
```
and now I'm trying to wrap them inside another template function like this:
```
template<typename T>
T(* uniRndType(void))()
{
if (is_same<T, bool>::value)
{
return uniRndBool;
} else if (is_same<T, char>::value)
... | 2014/01/23 | [
"https://Stackoverflow.com/questions/21303412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/620029/"
] | ```
template <typename T> T (*uniRndType())()
{
//else
...
}
template <> bool (*uniRndType())()
{
return uniRndBool;
}
template <> char (*uniRndType())()
{
return uniRndChar;
}
```
That's all.
edit: In principle, we must do like @Angew. but it's little troublesome | Compiler needs to know what types will be used by functions/methods at compile time. At this point you must instantiate this template function with types which it may receive as template parameter, like @ikh wrote here.
But, if you are using template class with template methods, you have 2 ways:
1) Simply write reali... |
21,303,412 | I have functions of this type:
```
type uniRndtype()
{
return typeValue;
}
```
and now I'm trying to wrap them inside another template function like this:
```
template<typename T>
T(* uniRndType(void))()
{
if (is_same<T, bool>::value)
{
return uniRndBool;
} else if (is_same<T, char>::value)
... | 2014/01/23 | [
"https://Stackoverflow.com/questions/21303412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/620029/"
] | The problem is that while the optimiser can eliminate dead code branches, the front-end (lexical, syntactic & semantic analysis) can't. Which means all code in a template instantiation must be valid. That is, even though in this:
```
if (is_same<T, bool>::value)
{
return uniRndBool;
}
```
the body will never be ... | ```
template <typename T> T (*uniRndType())()
{
//else
...
}
template <> bool (*uniRndType())()
{
return uniRndBool;
}
template <> char (*uniRndType())()
{
return uniRndChar;
}
```
That's all.
edit: In principle, we must do like @Angew. but it's little troublesome |
21,303,412 | I have functions of this type:
```
type uniRndtype()
{
return typeValue;
}
```
and now I'm trying to wrap them inside another template function like this:
```
template<typename T>
T(* uniRndType(void))()
{
if (is_same<T, bool>::value)
{
return uniRndBool;
} else if (is_same<T, char>::value)
... | 2014/01/23 | [
"https://Stackoverflow.com/questions/21303412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/620029/"
] | The problem is that while the optimiser can eliminate dead code branches, the front-end (lexical, syntactic & semantic analysis) can't. Which means all code in a template instantiation must be valid. That is, even though in this:
```
if (is_same<T, bool>::value)
{
return uniRndBool;
}
```
the body will never be ... | This won't work because when the compiler expands the template method for a given type the method has to be valid. Your type, T, needs to be compatible with all the return types listed, eg `bool`, `char`, etc. As I mentioned in the comments, if you passed in a `std::string` you wouldn't expect the method to work, would... |
21,303,412 | I have functions of this type:
```
type uniRndtype()
{
return typeValue;
}
```
and now I'm trying to wrap them inside another template function like this:
```
template<typename T>
T(* uniRndType(void))()
{
if (is_same<T, bool>::value)
{
return uniRndBool;
} else if (is_same<T, char>::value)
... | 2014/01/23 | [
"https://Stackoverflow.com/questions/21303412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/620029/"
] | The problem is that while the optimiser can eliminate dead code branches, the front-end (lexical, syntactic & semantic analysis) can't. Which means all code in a template instantiation must be valid. That is, even though in this:
```
if (is_same<T, bool>::value)
{
return uniRndBool;
}
```
the body will never be ... | Compiler needs to know what types will be used by functions/methods at compile time. At this point you must instantiate this template function with types which it may receive as template parameter, like @ikh wrote here.
But, if you are using template class with template methods, you have 2 ways:
1) Simply write reali... |
7,240,254 | I m working on an app in which i have 5 buttons(having .png images included in resources) m hiding them in viewDidload and showing them after choosing the image from UIImagepickerView.
All is going well in simulator but when i launch the app on device i cant find those buttons.
anyone have any idea of this situation?... | 2011/08/30 | [
"https://Stackoverflow.com/questions/7240254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843881/"
] | A big difference between the simulator and an actual device is that Mac OS (thus, also the simulator) is case insensitive, while the device is not.
The images are most probably not showing because you did not type them with the correct capitalization.
If you are sure that is not the problem, it would help to see your ... | it may be the problem with images , for testing try with only buttons (roundrect) and try in device without images. and if it work fine then there may be problem with images. |
7,240,254 | I m working on an app in which i have 5 buttons(having .png images included in resources) m hiding them in viewDidload and showing them after choosing the image from UIImagepickerView.
All is going well in simulator but when i launch the app on device i cant find those buttons.
anyone have any idea of this situation?... | 2011/08/30 | [
"https://Stackoverflow.com/questions/7240254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843881/"
] | A big difference between the simulator and an actual device is that Mac OS (thus, also the simulator) is case insensitive, while the device is not.
The images are most probably not showing because you did not type them with the correct capitalization.
If you are sure that is not the problem, it would help to see your ... | Can you please debug it on device if you know about it then it would be very easy to trace out the crase where it is crasing. As @antalkerekes said, if there is no issues regarding the case sensitivity then the app should work, but for your know do device testing. |
7,240,254 | I m working on an app in which i have 5 buttons(having .png images included in resources) m hiding them in viewDidload and showing them after choosing the image from UIImagepickerView.
All is going well in simulator but when i launch the app on device i cant find those buttons.
anyone have any idea of this situation?... | 2011/08/30 | [
"https://Stackoverflow.com/questions/7240254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843881/"
] | A big difference between the simulator and an actual device is that Mac OS (thus, also the simulator) is case insensitive, while the device is not.
The images are most probably not showing because you did not type them with the correct capitalization.
If you are sure that is not the problem, it would help to see your ... | Have the same behavior: UIImage \*image = [info objectForKey:UIImagePickerControllerOriginalImage]; returns nothing (0x0) on iOS5.0 simulator, so buttons show up empty and, in this case, it has nothing to do with spelling/caps/lowercase etc. On the device everything is fine though. |
19,139,538 | My challenge is to create a WPF application which allows the user to add / place a set of controls (gauges, charts, etc.) dynamically on a canvas at runtime and save the view (control coordinates etc.) they have designed. Those controls will display real time information from connected machines.
I'd like to know if the... | 2013/10/02 | [
"https://Stackoverflow.com/questions/19139538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/310764/"
] | This is pretty simple stuff. If you use a Canvas and bind it to a list of items (x, y, rotation, z order, data source etc), then use ItemTemplates to style the individual control styles, then serialize the whole lot for saving/loading.
Edit: this post might give you some pointers [Is it possible to bind a Canvas's Chi... | You could also try the SharpDevelop WPF Designer <https://github.com/icsharpcode/WpfDesigner> |
7,871 | I have installed Ubuntu 10.10 32-bit on my PC with my USB Flash disk. I then installed an NVIDIA driver through **Additional Drivers**. Unfortunately, I forgot the driver's version, but I think it's nvidia-185.
And I rebooted my PC an ugly splash screen appeared, and I can't pass the login screen or log in.
How can ... | 2010/10/17 | [
"https://askubuntu.com/questions/7871",
"https://askubuntu.com",
"https://askubuntu.com/users/-1/"
] | As mentioned in [this article](http://www.socialblogr.com/2010/10/how-to-install-nvidia-graphic-card-driver-on-ubuntu-10-10.html), I needed to disable nouveau before installing the driver. | You need to reconfigure xorg. See [this thread on Ubuntu Forums](http://ubuntuforums.org/showthread.php?t=690760) |
7,871 | I have installed Ubuntu 10.10 32-bit on my PC with my USB Flash disk. I then installed an NVIDIA driver through **Additional Drivers**. Unfortunately, I forgot the driver's version, but I think it's nvidia-185.
And I rebooted my PC an ugly splash screen appeared, and I can't pass the login screen or log in.
How can ... | 2010/10/17 | [
"https://askubuntu.com/questions/7871",
"https://askubuntu.com",
"https://askubuntu.com/users/-1/"
] | As mentioned in [this article](http://www.socialblogr.com/2010/10/how-to-install-nvidia-graphic-card-driver-on-ubuntu-10-10.html), I needed to disable nouveau before installing the driver. | Do you have an Ubuntu live CD? If yes, then boot from the CD, start Nautilus with root privileges:
```
gksudo nautilus
```
Then browse the root directory of your system partition (not the root of the live CD user), find `/etc/X11/xorg.conf` and delete it.
Close the root file browser.
Reboot and check if you can lo... |
24,145,535 | Weird issue when using 'no-repeat', 'repeat-x' or 'repeat-y' when creating a pattern using an image.
Consider the following:
```
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
</head>
<body>
<canvas id="myCanvas" width="578" height="200"... | 2014/06/10 | [
"https://Stackoverflow.com/questions/24145535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3726711/"
] | `context.translate` applies to the starting point to draw on the canvas. Instead you want to fill a certain portion of the rectangle.
```
imageObj.onload = function() {
var width = 600;
var height = 400;
var patOffsetX = 50;
var patOffsetY = 50;
context.rect(0, 0, width, height);
var pattern = context.cr... | You can accomplish your task using clipping
* Save the context state.
* Draw a boundary rectangle.
* Clip future drawing to inside the boundary rectangle.
* Draw another offset rectangle inside the boundary rectangle using your image as a pattern.
* Restore the context to its unclipped state.
A Demo: <http://jsfiddl... |
47,547,832 | I am stuck with this problem. There is a simple filter and it works not exactly the way I need it: <http://jsfiddle.net/qyy810xx/>
CSS here:
```
.categorya, .categoryb, .categoryrko {
width: 30px;
height: 20px;
line-height:20px;
text-align:center;
background: red;
margin: 10px;
float: left... | 2017/11/29 | [
"https://Stackoverflow.com/questions/47547832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8986873/"
] | You need not make a regular expression, **just formulate a selector** using the same logic
```
$("#filters :checkbox").click(function() {
var selector = $("#filters :checkbox:checked").map(function() {
return "." + this.value;
}).get().join(",");
$("div").hide().filte... | I know what you're trying to do. But be honest your code was really hard for other to read. So I decided to come up with a better solution and easy for everyone to know what I'm trying to do when they're reading code.
The idea is: Every times you check a checkbox.
1. You map through all checkboxes and push the value... |
1,462,637 | I currently run several Wordpress MU installations.
My users are asking for the ability to post video (not just Youtube, but from our own Flash Media Server).
By default, Wordpress strips out `<embed>` tags.
Now, I would never allow users to include PHP or JavaScript in their posts, do I have to worry about Flash vu... | 2009/09/22 | [
"https://Stackoverflow.com/questions/1462637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28351/"
] | Generally speaking, Flash has come a long way in terms of preventing exploits like key trapping, etc.
The safest thing you could do would be to obfuscate the embedding code and have them only supply a SWF URL, that way they couldn't pull anything fancy in the embed object like allowing cross scripting, etc...
In part... | I would suggest that Flash is only as secure as the content it is presenting; and that including a Youtube video is no more or less dangerous than going to visit the same video on Youtube's website. |
1,462,637 | I currently run several Wordpress MU installations.
My users are asking for the ability to post video (not just Youtube, but from our own Flash Media Server).
By default, Wordpress strips out `<embed>` tags.
Now, I would never allow users to include PHP or JavaScript in their posts, do I have to worry about Flash vu... | 2009/09/22 | [
"https://Stackoverflow.com/questions/1462637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28351/"
] | Generally speaking, Flash has come a long way in terms of preventing exploits like key trapping, etc.
The safest thing you could do would be to obfuscate the embedding code and have them only supply a SWF URL, that way they couldn't pull anything fancy in the embed object like allowing cross scripting, etc...
In part... | Flash is pretty secure. A lot of websites big and small are using it for 10 years now. Of course exploits are found, as in every piece of software. No web system is 100% secure. A lot of people are using flash and a lot of developers are working to make it secure. If you really sensitive information don't put them on w... |
1,462,637 | I currently run several Wordpress MU installations.
My users are asking for the ability to post video (not just Youtube, but from our own Flash Media Server).
By default, Wordpress strips out `<embed>` tags.
Now, I would never allow users to include PHP or JavaScript in their posts, do I have to worry about Flash vu... | 2009/09/22 | [
"https://Stackoverflow.com/questions/1462637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28351/"
] | Generally speaking, Flash has come a long way in terms of preventing exploits like key trapping, etc.
The safest thing you could do would be to obfuscate the embedding code and have them only supply a SWF URL, that way they couldn't pull anything fancy in the embed object like allowing cross scripting, etc...
In part... | Make sure you set `allowScriptAccess="never"` in the object/embed tag to deny [scripting powers](http://kb2.adobe.com/cps/164/tn_16494.html) to third party SWFs. |
1,462,637 | I currently run several Wordpress MU installations.
My users are asking for the ability to post video (not just Youtube, but from our own Flash Media Server).
By default, Wordpress strips out `<embed>` tags.
Now, I would never allow users to include PHP or JavaScript in their posts, do I have to worry about Flash vu... | 2009/09/22 | [
"https://Stackoverflow.com/questions/1462637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28351/"
] | Make sure you set `allowScriptAccess="never"` in the object/embed tag to deny [scripting powers](http://kb2.adobe.com/cps/164/tn_16494.html) to third party SWFs. | I would suggest that Flash is only as secure as the content it is presenting; and that including a Youtube video is no more or less dangerous than going to visit the same video on Youtube's website. |
1,462,637 | I currently run several Wordpress MU installations.
My users are asking for the ability to post video (not just Youtube, but from our own Flash Media Server).
By default, Wordpress strips out `<embed>` tags.
Now, I would never allow users to include PHP or JavaScript in their posts, do I have to worry about Flash vu... | 2009/09/22 | [
"https://Stackoverflow.com/questions/1462637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28351/"
] | Make sure you set `allowScriptAccess="never"` in the object/embed tag to deny [scripting powers](http://kb2.adobe.com/cps/164/tn_16494.html) to third party SWFs. | Flash is pretty secure. A lot of websites big and small are using it for 10 years now. Of course exploits are found, as in every piece of software. No web system is 100% secure. A lot of people are using flash and a lot of developers are working to make it secure. If you really sensitive information don't put them on w... |
1,707,058 | Suppose I have a string "AAA BBB CCC DDD EEE FFF".
How can I split the string and retrieve the nth substring, in a batch file?
The equivalent in C# would be
```
"AAA BBB CCC DDD EEE FFF".Split()[n]
``` | 2009/11/10 | [
"https://Stackoverflow.com/questions/1707058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48082/"
] | Three possible solutions to iterate through the words of the string:
Version 1:
```
@echo off & setlocal
set s=AAA BBB CCC DDD EEE FFF
for %%a in (%s%) do echo %%a
```
Version 2:
```
@echo off & setlocal
set s=AAA BBB CCC DDD EEE FFF
set t=%s%
:loop
for /f "tokens=1*" %%a in ("%t%") do (
echo %%a
set t=%%b
... | The following code will split a string with an arbitrary number of substrings:
```
@echo off
setlocal ENABLEDELAYEDEXPANSION
REM Set a string with an arbitrary number of substrings separated by semi colons
set teststring=The;rain;in;spain
REM Do something with each substring
:stringLOOP
REM Stop when the string ... |
1,707,058 | Suppose I have a string "AAA BBB CCC DDD EEE FFF".
How can I split the string and retrieve the nth substring, in a batch file?
The equivalent in C# would be
```
"AAA BBB CCC DDD EEE FFF".Split()[n]
``` | 2009/11/10 | [
"https://Stackoverflow.com/questions/1707058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48082/"
] | Here is a solution based on a "[function](http://ss64.com/nt/syntax-functions.html)" which processes each character until it finds the delimiter character.
It is relatively slow, but it is at least not a brain teaser (except for the function part).
```
:: Example #1:
set data=aa bb cc
echo Splitting off from "%data%"... | **UPDATE:**
Well, initially I posted the solution to a more difficult problem, to get a complete split of any string with any delimiter (just changing *delims*). I read more the accepted solutions than what the OP wanted, sorry. I think this time I comply with the original requirements:
```
@echo off
IF [%1] EQU [] ... |
1,707,058 | Suppose I have a string "AAA BBB CCC DDD EEE FFF".
How can I split the string and retrieve the nth substring, in a batch file?
The equivalent in C# would be
```
"AAA BBB CCC DDD EEE FFF".Split()[n]
``` | 2009/11/10 | [
"https://Stackoverflow.com/questions/1707058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48082/"
] | Three possible solutions to iterate through the words of the string:
Version 1:
```
@echo off & setlocal
set s=AAA BBB CCC DDD EEE FFF
for %%a in (%s%) do echo %%a
```
Version 2:
```
@echo off & setlocal
set s=AAA BBB CCC DDD EEE FFF
set t=%s%
:loop
for /f "tokens=1*" %%a in ("%t%") do (
echo %%a
set t=%%b
... | you can use vbscript instead of batch(cmd.exe)
```
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
str1 = objArgs(0)
s=Split(str1," ")
For i=LBound(s) To UBound(s)
WScript.Echo s(i)
WScript.Echo s(9) ' get the 10th element
Next
```
usage:
```
c:\test> cscript /nologo t... |
1,707,058 | Suppose I have a string "AAA BBB CCC DDD EEE FFF".
How can I split the string and retrieve the nth substring, in a batch file?
The equivalent in C# would be
```
"AAA BBB CCC DDD EEE FFF".Split()[n]
``` | 2009/11/10 | [
"https://Stackoverflow.com/questions/1707058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48082/"
] | This is the only code that worked for me:
```
for /f "tokens=4" %%G IN ("aaa bbb ccc ddd eee fff") DO echo %%G
```
output:
```
ddd
``` | you can use vbscript instead of batch(cmd.exe)
```
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
str1 = objArgs(0)
s=Split(str1," ")
For i=LBound(s) To UBound(s)
WScript.Echo s(i)
WScript.Echo s(9) ' get the 10th element
Next
```
usage:
```
c:\test> cscript /nologo t... |
1,707,058 | Suppose I have a string "AAA BBB CCC DDD EEE FFF".
How can I split the string and retrieve the nth substring, in a batch file?
The equivalent in C# would be
```
"AAA BBB CCC DDD EEE FFF".Split()[n]
``` | 2009/11/10 | [
"https://Stackoverflow.com/questions/1707058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48082/"
] | This is the only code that worked for me:
```
for /f "tokens=4" %%G IN ("aaa bbb ccc ddd eee fff") DO echo %%G
```
output:
```
ddd
``` | The following code will split a string with an arbitrary number of substrings:
```
@echo off
setlocal ENABLEDELAYEDEXPANSION
REM Set a string with an arbitrary number of substrings separated by semi colons
set teststring=The;rain;in;spain
REM Do something with each substring
:stringLOOP
REM Stop when the string ... |
1,707,058 | Suppose I have a string "AAA BBB CCC DDD EEE FFF".
How can I split the string and retrieve the nth substring, in a batch file?
The equivalent in C# would be
```
"AAA BBB CCC DDD EEE FFF".Split()[n]
``` | 2009/11/10 | [
"https://Stackoverflow.com/questions/1707058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48082/"
] | I ended up with the following:
```
set input=AAA BBB CCC DDD EEE FFF
set nth=4
for /F "tokens=%nth% delims= " %%a in ("%input%") do set nthstring=%%a
echo %nthstring%
```
With this you can parameterize the input and index. Make sure to put this code in a bat file. | or Powershell for a 0 indexed array.
```
PS C:\> "AAA BBB CCC DDD EEE FFF".Split()
AAA
BBB
CCC
DDD
EEE
FFF
PS C:\> ("AAA BBB CCC DDD EEE FFF".Split())[0]
AAA
``` |
1,707,058 | Suppose I have a string "AAA BBB CCC DDD EEE FFF".
How can I split the string and retrieve the nth substring, in a batch file?
The equivalent in C# would be
```
"AAA BBB CCC DDD EEE FFF".Split()[n]
``` | 2009/11/10 | [
"https://Stackoverflow.com/questions/1707058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48082/"
] | ```
set a=AAA BBB CCC DDD EEE FFF
set a=%a:~6,1%
```
This code finds the 5th character in the string.
If I wanted to find the 9th string, I would replace the 6 with 10 (add one). | you can use vbscript instead of batch(cmd.exe)
```
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
str1 = objArgs(0)
s=Split(str1," ")
For i=LBound(s) To UBound(s)
WScript.Echo s(i)
WScript.Echo s(9) ' get the 10th element
Next
```
usage:
```
c:\test> cscript /nologo t... |
1,707,058 | Suppose I have a string "AAA BBB CCC DDD EEE FFF".
How can I split the string and retrieve the nth substring, in a batch file?
The equivalent in C# would be
```
"AAA BBB CCC DDD EEE FFF".Split()[n]
``` | 2009/11/10 | [
"https://Stackoverflow.com/questions/1707058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48082/"
] | If someone need to split a string with any delimiter and store values in separate variables, here is the script I built,
```
FOR /F "tokens=1,2 delims=x" %i in ("1920x1080") do (
set w=%i
set h=%j
)
echo %w%
echo %h%
```
Explanation: 'tokens' defines what elements you need to pass to the body of FOR, with token ... | one more variation - this looks for the program "cmd.exe" in the current path and reports the first match:
```
@echo off
setlocal
setlocal enableextensions
setlocal enabledelayedexpansion
set P=%PATH%
:pathloop
for /F "delims=; tokens=1*" %%f in ("!P!") do (
set F=%%f
if exist %%f\cmd.exe goto found
set P... |
1,707,058 | Suppose I have a string "AAA BBB CCC DDD EEE FFF".
How can I split the string and retrieve the nth substring, in a batch file?
The equivalent in C# would be
```
"AAA BBB CCC DDD EEE FFF".Split()[n]
``` | 2009/11/10 | [
"https://Stackoverflow.com/questions/1707058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48082/"
] | see `HELP FOR` and see the examples
or quick try this
```
for /F %%a in ("AAA BBB CCC DDD EEE FFF") do echo %%a
``` | The following code will split a string with an arbitrary number of substrings:
```
@echo off
setlocal ENABLEDELAYEDEXPANSION
REM Set a string with an arbitrary number of substrings separated by semi colons
set teststring=The;rain;in;spain
REM Do something with each substring
:stringLOOP
REM Stop when the string ... |
1,707,058 | Suppose I have a string "AAA BBB CCC DDD EEE FFF".
How can I split the string and retrieve the nth substring, in a batch file?
The equivalent in C# would be
```
"AAA BBB CCC DDD EEE FFF".Split()[n]
``` | 2009/11/10 | [
"https://Stackoverflow.com/questions/1707058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48082/"
] | Three possible solutions to iterate through the words of the string:
Version 1:
```
@echo off & setlocal
set s=AAA BBB CCC DDD EEE FFF
for %%a in (%s%) do echo %%a
```
Version 2:
```
@echo off & setlocal
set s=AAA BBB CCC DDD EEE FFF
set t=%s%
:loop
for /f "tokens=1*" %%a in ("%t%") do (
echo %%a
set t=%%b
... | ```
@echo off
:: read a file line by line
for /F %%i in ('type data.csv') do (
echo %%i
:: and we extract four tokens, ; is the delimiter.
for /f "tokens=1,2,3,4 delims=;" %%a in ("%%i") do (
set first=%%a&set second=%%b&set third=%%c&set fourth=%%d
echo %first% and %second% and %third% an... |
1,531,374 | Hi there I am having a bit of a simple task problems.
We have pretty simple configured MS server 2012 in our school.
The thing is we want to deny access few PCs from ONE user so our students can only access library PC with their OWN account as we want to monitor their actions.
I have one user (library\_user) and this ... | 2020/03/09 | [
"https://superuser.com/questions/1531374",
"https://superuser.com",
"https://superuser.com/users/1145589/"
] | So finally my issue has been resolved.
I have found another laptop with the same model, I replaced SSD and copied my data.
Thank you guys for your time and suggestions. | When Googleing "Orico M.2 NGFF Enclosure" all I can find are devices that are M.2 NVME drive enclosures.
In many cases, M.2 NVME (PCi) and M.2 SATA are not compatible.
The information page on amazon for the above enclosure state the following:
>
> This NVMe SSD enclosure leverages most of M.2 PCIe NVMe drives to a... |
1,531,374 | Hi there I am having a bit of a simple task problems.
We have pretty simple configured MS server 2012 in our school.
The thing is we want to deny access few PCs from ONE user so our students can only access library PC with their OWN account as we want to monitor their actions.
I have one user (library\_user) and this ... | 2020/03/09 | [
"https://superuser.com/questions/1531374",
"https://superuser.com",
"https://superuser.com/users/1145589/"
] | When Googleing "Orico M.2 NGFF Enclosure" all I can find are devices that are M.2 NVME drive enclosures.
In many cases, M.2 NVME (PCi) and M.2 SATA are not compatible.
The information page on amazon for the above enclosure state the following:
>
> This NVMe SSD enclosure leverages most of M.2 PCIe NVMe drives to a... | I know this is old but ,will leave this here for anyone who has this problem, under windows 7, I thought the enclosure was faulty at first, the problem is the new ssd comes with gpt partition table, which win 7 can't read, the solution was I borrowed another laptop with win10 under disk management changed format to MBR... |
1,531,374 | Hi there I am having a bit of a simple task problems.
We have pretty simple configured MS server 2012 in our school.
The thing is we want to deny access few PCs from ONE user so our students can only access library PC with their OWN account as we want to monitor their actions.
I have one user (library\_user) and this ... | 2020/03/09 | [
"https://superuser.com/questions/1531374",
"https://superuser.com",
"https://superuser.com/users/1145589/"
] | So finally my issue has been resolved.
I have found another laptop with the same model, I replaced SSD and copied my data.
Thank you guys for your time and suggestions. | I know this is old but ,will leave this here for anyone who has this problem, under windows 7, I thought the enclosure was faulty at first, the problem is the new ssd comes with gpt partition table, which win 7 can't read, the solution was I borrowed another laptop with win10 under disk management changed format to MBR... |
60,561,995 | How to convert array of `Int8` to array of `Float` again revert it.
I have function to filter float data, so i need to first convert it to `[Float]` and process it and again convert it to `[Int8]` and feed it | 2020/03/06 | [
"https://Stackoverflow.com/questions/60561995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6630644/"
] | `map` is your friend. You have 2 approaches using this function:
1.
```swift
let myArray: [UInt8] = [1, 2, 3, 4, 5]
let processedArray = myArray.map { element in
let floatElement = Float(element)
// process float
return Int8(floatElement)
}
```
2.
```swift
let myArray: [UIn... | Ok I Got it thanks @ Martin R
```
let rr: [Int8] = [ 18, 21, 41, 42, 48, 50, 55, 90]
var float = [Float](repeating: 0, count: rr.count)
vDSP_vflt8(rr, 1, &float, 1, vDSP_Length(rr.count))
var ints = [Int8](repeating: 0, count: rr.count)
vDSP_vfix8(float, 1, &ints, 1, vDSP_Length(float.count))
print(ints)
``` |
60,561,995 | How to convert array of `Int8` to array of `Float` again revert it.
I have function to filter float data, so i need to first convert it to `[Float]` and process it and again convert it to `[Int8]` and feed it | 2020/03/06 | [
"https://Stackoverflow.com/questions/60561995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6630644/"
] | ```
extension Array where Iterator.Element == Int8 {
var toFloatArray: [Float] {
return self.map({Float($0)})
}
}
extension Array where Iterator.Element == Float {
var toIntArray: [Int8] {
return self.map({Int8($0)})
}
}
let myIntArr: [Int8] = [1,2,4]
let myFloatArr: [Float] = myIntArr... | Ok I Got it thanks @ Martin R
```
let rr: [Int8] = [ 18, 21, 41, 42, 48, 50, 55, 90]
var float = [Float](repeating: 0, count: rr.count)
vDSP_vflt8(rr, 1, &float, 1, vDSP_Length(rr.count))
var ints = [Int8](repeating: 0, count: rr.count)
vDSP_vfix8(float, 1, &ints, 1, vDSP_Length(float.count))
print(ints)
``` |
12,746 | ```
<?php echo get_the_term_list( $post->ID, 'people', 'People: ', ' ', '' ); ?>
```
returns something like this:
```
People: <a href="person1">Person1</a>, <a href="person2">Person2</a>, ...
```
How can I make it return the same thing without links like this:
```
People: Person1, Person2
``` | 2011/03/22 | [
"https://wordpress.stackexchange.com/questions/12746",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2107/"
] | It may be easier to just write the list manually, something like:
```
<?php
$terms = wp_get_post_tags( $post->ID );
//For custom taxonomy use this line below
//$terms = wp_get_object_terms( $post->ID, 'people' );
foreach( $terms as $term )
$term_names[] = $term->name;
echo implode( ', ', $term_names );
``` | I found another method that more directly answers my question:
```
<?php $terms_as_text = get_the_term_list( $post->ID,'people', 'People: ', ', ');
if (!empty($terms_as_text)) echo '<p>', strip_tags($terms_as_text) ,'</p>'; ?>
```
Credit: [CSS Tricks](http://css-tricks.com/forums/discussion/11225/display-wordpress-c... |
12,746 | ```
<?php echo get_the_term_list( $post->ID, 'people', 'People: ', ' ', '' ); ?>
```
returns something like this:
```
People: <a href="person1">Person1</a>, <a href="person2">Person2</a>, ...
```
How can I make it return the same thing without links like this:
```
People: Person1, Person2
``` | 2011/03/22 | [
"https://wordpress.stackexchange.com/questions/12746",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2107/"
] | It may be easier to just write the list manually, something like:
```
<?php
$terms = wp_get_post_tags( $post->ID );
//For custom taxonomy use this line below
//$terms = wp_get_object_terms( $post->ID, 'people' );
foreach( $terms as $term )
$term_names[] = $term->name;
echo implode( ', ', $term_names );
``` | Alternatively you can also use
```
<?php
echo strip_tags (
get_the_term_list( get_the_ID(), 'tax_name', "Text Before Value ",", " )
);
?>
``` |
12,746 | ```
<?php echo get_the_term_list( $post->ID, 'people', 'People: ', ' ', '' ); ?>
```
returns something like this:
```
People: <a href="person1">Person1</a>, <a href="person2">Person2</a>, ...
```
How can I make it return the same thing without links like this:
```
People: Person1, Person2
``` | 2011/03/22 | [
"https://wordpress.stackexchange.com/questions/12746",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2107/"
] | It may be easier to just write the list manually, something like:
```
<?php
$terms = wp_get_post_tags( $post->ID );
//For custom taxonomy use this line below
//$terms = wp_get_object_terms( $post->ID, 'people' );
foreach( $terms as $term )
$term_names[] = $term->name;
echo implode( ', ', $term_names );
``` | Using strip\_tags() Can get complicated if you want to show your terms as an HTML list.
Here, there's something for you. $raw set to true (or anything that's not empty) will just create an inline list with the $separator of your choice, if not, it will generate an HTML list without links. If you want your list to have ... |
12,746 | ```
<?php echo get_the_term_list( $post->ID, 'people', 'People: ', ' ', '' ); ?>
```
returns something like this:
```
People: <a href="person1">Person1</a>, <a href="person2">Person2</a>, ...
```
How can I make it return the same thing without links like this:
```
People: Person1, Person2
``` | 2011/03/22 | [
"https://wordpress.stackexchange.com/questions/12746",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2107/"
] | Alternatively you can also use
```
<?php
echo strip_tags (
get_the_term_list( get_the_ID(), 'tax_name', "Text Before Value ",", " )
);
?>
``` | I found another method that more directly answers my question:
```
<?php $terms_as_text = get_the_term_list( $post->ID,'people', 'People: ', ', ');
if (!empty($terms_as_text)) echo '<p>', strip_tags($terms_as_text) ,'</p>'; ?>
```
Credit: [CSS Tricks](http://css-tricks.com/forums/discussion/11225/display-wordpress-c... |
12,746 | ```
<?php echo get_the_term_list( $post->ID, 'people', 'People: ', ' ', '' ); ?>
```
returns something like this:
```
People: <a href="person1">Person1</a>, <a href="person2">Person2</a>, ...
```
How can I make it return the same thing without links like this:
```
People: Person1, Person2
``` | 2011/03/22 | [
"https://wordpress.stackexchange.com/questions/12746",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2107/"
] | Alternatively you can also use
```
<?php
echo strip_tags (
get_the_term_list( get_the_ID(), 'tax_name', "Text Before Value ",", " )
);
?>
``` | Using strip\_tags() Can get complicated if you want to show your terms as an HTML list.
Here, there's something for you. $raw set to true (or anything that's not empty) will just create an inline list with the $separator of your choice, if not, it will generate an HTML list without links. If you want your list to have ... |
37,130,430 | This is the SQL line I'm using to create the table:
```
CREATE TABLE users (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(255),
surname VARCHAR(255),
email VARCHAR(255) UNIQUE,
username VARCHAR(255) UNIQUE,
passwordHash CHAR(60),
admin BIT
)
```
Should be pretty g... | 2016/05/10 | [
"https://Stackoverflow.com/questions/37130430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4049658/"
] | It depends on your server default encoding. For instance, in UTF-8 you use three bytes for each character.
The issue comes from 'UNIQUE' constraint on VARCHAR(255) columns. | Here Try This out:-
```
CREATE TABLE users (
id INT NOT NULL AUTO_INCREMENT,
firstname VARCHAR(255),
surname VARCHAR(255),
email VARCHAR(255) UNIQUE,
username VARCHAR(255) UNIQUE,
passwordHash CHAR(60),
admin BIT,
PRIMARY KEY (id),
CONSTRAINT user_info UNIQUE(email,username)
);
```
i think this will work |
19,387 | What is the reason for the difference between German *dass*-Sätze (which are in the indicative mood) and French *que*-sentences (which are in the subjunctive mood)?
My German understanding is far better than the French one. As far as I understand, it is usual in French to put a verb in subjunctive mood after *que.* In... | 2016/08/17 | [
"https://linguistics.stackexchange.com/questions/19387",
"https://linguistics.stackexchange.com",
"https://linguistics.stackexchange.com/users/13863/"
] | French **subjunctive** is usually triggered by certain kinds of verbs that require their complement to be in subjunctive but also by certain conjunctions; one could establish four classes of triggers:
* "verbes de **volonté**": verbs expressing wishes, e.g. (*Je veux que tu m'ENTENDES* (= *I want you to LISTEN to me*)... | >
> What is the reason for the difference […]?
>
>
>
Using the subjunctive for indirect speech in German is dying out. Conservative grammar books will probably still require that the subjunctive be used for all indirect speech (“Ich denke, dass du da **seist**.”), while modern ones loosen the criteria in cases whe... |
12,153,773 | What I wish to do on top of exporting to xml as in this thread [SQL DB to XML](https://stackoverflow.com/questions/3952469/export-xml-from-sql-server) is that for every row that is a foreign key, I also want to include the xml represenation of that reference, too.
For example a table Employee:
```
EID(PK) Name Sup... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12153773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196906/"
] | Try this code, [also on SQL Fiddle](http://sqlfiddle.com/#!3/e0730/8). By specifying the optional `XSINIL` parameter on the `ELEMENTS` directive, you can request that an element also be created for the `NULL` value. In this case, an element that has the xsi:nil attribute set to TRUE is returned for each `NULL` column v... | I build a table that combines the KEY\_COLUMN\_USAGE and REFERENTIAL\_CONSTRAINTS to trace from a foreign key (dependent column) to a primary key (principal column), and then when I want to trace the reference, I use this table for look up.
I cannot share the code, but this is a simple query. |
4,277,359 | I'm currently working on a migration project, to migrate data from the old db to the new one (please do not ask why I'm going through a Java application for this, it's what the customer requires).
There was some, initial, code which I'm updating now. One of the things I'm changing is using Spring's `JdbcTemplate` rath... | 2010/11/25 | [
"https://Stackoverflow.com/questions/4277359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/466761/"
] | I think the natural choice for such an Application is [Spring Batch](https://web.archive.org/web/20100703074945/http://static.springsource.org/spring-batch/) (read the impressive [Features page](https://web.archive.org/web/20101130113812/http://static.springsource.org/spring-batch/features.html))
Here are the sections... | Do you mean sth. like this?
```
SimpleJdbcTemplate template = new SimpleJdbcTemplate(dataSource);
List<String> result = template.query("SELECT name FROM people WHERE id > ?",
new RowMapper<String>() {
public String mapRow(ResultSet rs, int rowNum) throws SQLException {
return rs.getString("na... |
67,110,445 | I am trying to use Google apps script to create a filter across row 1 on 'Data' sheet tab. The filter is taken from a data validation list on 'Dashboard' sheet - cell 'I7', this is where the user changes the filter options.
e.g. if user selects 'Shopfloor' on drop down menu on Dashboard sheet. then this will change th... | 2021/04/15 | [
"https://Stackoverflow.com/questions/67110445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15241161/"
] | Your `filterBA` function should look like this:
```
function filterBA(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var selBA = ss.getSheetByName(dropSS).getRange('I7').getValue();
var sheet = ss.getSheetByName('Data');
// Check if filter already exists and remove filter if true
if(sheet.getFilter() !=... | This can be done without any script using Data Validation and the QUERY() function. Take a look at the Dropdown tab on this sample sheet, A2 has the Data Validation based on a table. B2 has the QUERY() function based on the value in A1.
<https://docs.google.com/spreadsheets/d/1qbLOjTdzISICTKyUp_jK6gZbQCt-OwtDYYy3HNJyg... |
30,079,754 | Running this snippet
```
var path1 = @"C:\Temp\SomeFolder";
var path2 = @"C:\Temp\SomeFolder\";
Console.WriteLine(Directory.GetParent(path1));
Console.WriteLine(Directory.GetParent(path2));
```
Output
>
> C:\Temp
>
>
> C:\Temp\SomeFolder
>
>
>
Same story with `Path.GetDirectoryName()`, which also can be used... | 2015/05/06 | [
"https://Stackoverflow.com/questions/30079754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1997232/"
] | >
> Question: how to properly handle possible slash at the end of given
> path when I need get one of the parent directories?
>
>
>
Just trim it from the input string. Use `TrimEnd`:
```
Console.WriteLine(Directory.GetParent(path1.TrimEnd('\\')));
```
However returning the complete path when the string is term... | Some Path theory:
A file system contains Containers (Folders, Directories) and Elements (Files).
A "Path" Contains a set of (hierarchical) Containers and probably an "Element" as last element, all separated by slashes.
In theory, if the "Element" is missing, there is a trailing slash to indicate that the last item i... |
101,916 | Can I be the transaction processor and take in transaction fees as income without mining a Bitcoin? Would the fees be so low that it is not practical?
Or is it true that I have to be a miner in order to process any transaction? However, after year 2140, when all Bitcoins have been mined, then will people only use the ... | 2021/01/27 | [
"https://bitcoin.stackexchange.com/questions/101916",
"https://bitcoin.stackexchange.com",
"https://bitcoin.stackexchange.com/users/114595/"
] | It's a combination of the low trade volume, and also because the traders on Bisq know that some people will pay a premium in order to avoid having to complete KYC requirements to do their trades.
If you signed up for an centralized exchange, you'll be able to buy at the market rate (minus a fee), but the trade-off is ... | Post your own offer at a reasonable rate and wait. You'll likely pay less than fees you'd incur from coinbase or such. |
30,903,866 | I am currently using Swift and Parse and have run into an issue which I haven't been able resolve for the past several hours.
On a button click, I am attempting to add an Employee object to an Event object's eventAttendee's array.
```
@IBAction func joinEvent(sender: AnyObject) {
var employee = Employee.currentUs... | 2015/06/17 | [
"https://Stackoverflow.com/questions/30903866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4044442/"
] | ```
./script one '' oops
```
`[ $2 ]` will be false when `$2` is the empty string.
And as [that other guy](https://stackoverflow.com/users/1899640/that-other-guy) points out in a comment, bash will split both strings, opening up a range of issues, including potential security holes. | This is clearer:
```
if [ $# != 1 ] ; then
echo "Usage: only one var."; exit 1
fi
``` |
30,903,866 | I am currently using Swift and Parse and have run into an issue which I haven't been able resolve for the past several hours.
On a button click, I am attempting to add an Employee object to an Event object's eventAttendee's array.
```
@IBAction func joinEvent(sender: AnyObject) {
var employee = Employee.currentUs... | 2015/06/17 | [
"https://Stackoverflow.com/questions/30903866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4044442/"
] | ```
./script one '' oops
```
`[ $2 ]` will be false when `$2` is the empty string.
And as [that other guy](https://stackoverflow.com/users/1899640/that-other-guy) points out in a comment, bash will split both strings, opening up a range of issues, including potential security holes. | Things that will break your test:
* The first parameter is empty (`""`)
* The second parameter is empty (`""`)
* The first or second parameter has more words (`"bla bla"`)
* The parameters contain something that will be interpreted by `test` (e.g.: `-z`)
It is simply less clearer than using `$#`. Also the mere fact t... |
29,413,397 | I am using tableview to list my products. In "cellForRowAtIndexPath", with the help of "dequeueReusableCellWithIdentifier", we can access property of UITableViewCell. For Example,
```
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell1 = product_tablevie... | 2015/04/02 | [
"https://Stackoverflow.com/questions/29413397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4384775/"
] | UIImage -> NSData
```
NSData *imageData = UIImagePNGRepresentation(image); or UIImageJpegRepresentation(image)
```
NSData -> UIImage
```
UIImage *image=[UIImage imageWithData:data];
``` | Convert `UIImage` into `NSData` and save as the entity's attribute with the type `Binary Data` |
29,413,397 | I am using tableview to list my products. In "cellForRowAtIndexPath", with the help of "dequeueReusableCellWithIdentifier", we can access property of UITableViewCell. For Example,
```
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell1 = product_tablevie... | 2015/04/02 | [
"https://Stackoverflow.com/questions/29413397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4384775/"
] | Convert `UIImage` into `NSData` and save as the entity's attribute with the type `Binary Data` | this question is already answered by stack-overflow refer this
[How to store an image in core data](https://stackoverflow.com/questions/16685812/how-to-store-an-image-in-core-data) |
29,413,397 | I am using tableview to list my products. In "cellForRowAtIndexPath", with the help of "dequeueReusableCellWithIdentifier", we can access property of UITableViewCell. For Example,
```
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell1 = product_tablevie... | 2015/04/02 | [
"https://Stackoverflow.com/questions/29413397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4384775/"
] | UIImage -> NSData
```
NSData *imageData = UIImagePNGRepresentation(image); or UIImageJpegRepresentation(image)
```
NSData -> UIImage
```
UIImage *image=[UIImage imageWithData:data];
``` | this question is already answered by stack-overflow refer this
[How to store an image in core data](https://stackoverflow.com/questions/16685812/how-to-store-an-image-in-core-data) |
14,333,161 | I am developing an application which uses `ListView` to display questions and it's options from different tables from `DataBase`.
I have assign `PageSize="1"` in `DataPager` so that only one question should display at a time, after choosing option user clicks on Next button which shows the other question but if user... | 2013/01/15 | [
"https://Stackoverflow.com/questions/14333161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/273518/"
] | Since you have only a single service that needs to access this cache and it isn;t that big a deal if the cache gets reset every couple hours, you can keep things really simple.
The simplest solution is to use the in-process memory cache. Its basically a dictionary in memory that you can store whatever values in, but i... | As caching is happening on your own server, you would be using deserialized xml into some class object. I think the best thing would be to use post sharp in your case.
See this: <http://www.sharpcrafters.com/postsharp/download> |
102,338 | I try to write a setcounter command to a file (using the `newfile` package) by something like the following
```
\addtostream{mystream}{\protect\setcounter{mycounter}{\myvariable}}
```
However, since the whole thing is protected, `\myvariable` isn't expanded and since it's value changes later in the document, the wro... | 2013/03/13 | [
"https://tex.stackexchange.com/questions/102338",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/23949/"
] | If `othercounter` and `mycounter` are LaTeX counters, you *can't* say
```
\setcounter{othercounter}{mycounter}
```
but, in general, you should say
```
\setcounter{othercounter}{\value{mycounter}}
```
However, for your application you need a different way, because you need the actual value of `mycounter`, not refe... | `\protect` only protects the next token, not the arguments of the next token.
If `\myvariable` is not expanded, then it is perhaps not expandable (e.g. defined
by `\newcount\myvariable`. Then `\number` helps:
```
\addtostream{mystream}{%
\protect\setcounter{mycounter}{\number\myvariable}%
}%
``` |
3,597,014 | All I knew about partial derivatives before thinking about all this (the paragraphs below) was that you keep one variable constant and differentiate with respect to the other variable. I got to know about this from youtube videos where it is mentioned a lot; I do not have any sort of formal education in multivariable c... | 2020/03/27 | [
"https://math.stackexchange.com/questions/3597014",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/757979/"
] | Again, your first experience with partial derivatives is sound and should be stuck with. Suppose you have a function dependent on more than one quantity. If we consider all but one of those quantities to be unchanging, then we just have in effect a function of one variable, as usual, and the usual derivative with respe... | On your first question, it depends, but you often want to solve for the gradient of a function, which is a vector whose components are the partial derivatives of the function wrt each variable. The gradient is the direction of fastest increase of the function and its magnitude is that rate—this is more general than the... |
48,865,416 | I need to use sqlite version 3.8 or higher with python in Amazon Linux.
I updated my sqlite installation to the latest version:
```
$ sqlite3 -version
3.22.0 2018-01-22 18:45:57 0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e86726f2171d
```
I also updated my pysqlite version
```
pip install --upgrade pysqli... | 2018/02/19 | [
"https://Stackoverflow.com/questions/48865416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6903522/"
] | **Option 1:** Use the binary version of pysqlite3 from here (which already comes with a newer version of sqlite3 lib precompiled and linked):
<https://github.com/coleifer/pysqlite3>.
Basically install with
```
pip install pysqlite3-binary
```
and in python code, use pysqlite3 instead of sqlite3 like:
```py
import p... | Two ideas...
1. Use [pyenv](https://github.com/pyenv/pyenv) to install a separate interpreter, and provide the path to the newer sqlite when creating it. eg:
```
PYTHON_CONFIGURE_OPTS="LD_RUN_PATH=/usr/local/opt/sqlite/lib LDFLAGS=-L/usr/local/opt/sqlite/lib CPPFLAGS=-I/usr/local/include" pyenv install 3.4.3
```
[T... |
48,865,416 | I need to use sqlite version 3.8 or higher with python in Amazon Linux.
I updated my sqlite installation to the latest version:
```
$ sqlite3 -version
3.22.0 2018-01-22 18:45:57 0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e86726f2171d
```
I also updated my pysqlite version
```
pip install --upgrade pysqli... | 2018/02/19 | [
"https://Stackoverflow.com/questions/48865416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6903522/"
] | Two ideas...
1. Use [pyenv](https://github.com/pyenv/pyenv) to install a separate interpreter, and provide the path to the newer sqlite when creating it. eg:
```
PYTHON_CONFIGURE_OPTS="LD_RUN_PATH=/usr/local/opt/sqlite/lib LDFLAGS=-L/usr/local/opt/sqlite/lib CPPFLAGS=-I/usr/local/include" pyenv install 3.4.3
```
[T... | There's unofficial Python wheel distribution of [APSW](https://github.com/rogerbinns/apsw) which itself [doesn't release on PyPI](https://rogerbinns.github.io/apsw/download.html#easy-install-pip-pypi):
>
> APSW is not available at the Python Package Index (pypi) and hence cannot be installed from it. (A random person... |
48,865,416 | I need to use sqlite version 3.8 or higher with python in Amazon Linux.
I updated my sqlite installation to the latest version:
```
$ sqlite3 -version
3.22.0 2018-01-22 18:45:57 0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e86726f2171d
```
I also updated my pysqlite version
```
pip install --upgrade pysqli... | 2018/02/19 | [
"https://Stackoverflow.com/questions/48865416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6903522/"
] | **Option 1:** Use the binary version of pysqlite3 from here (which already comes with a newer version of sqlite3 lib precompiled and linked):
<https://github.com/coleifer/pysqlite3>.
Basically install with
```
pip install pysqlite3-binary
```
and in python code, use pysqlite3 instead of sqlite3 like:
```py
import p... | There's unofficial Python wheel distribution of [APSW](https://github.com/rogerbinns/apsw) which itself [doesn't release on PyPI](https://rogerbinns.github.io/apsw/download.html#easy-install-pip-pypi):
>
> APSW is not available at the Python Package Index (pypi) and hence cannot be installed from it. (A random person... |
23,851,394 | is there an official Bower package for Breeze (that also includes the Breeze Angular Service)? I am not using Visual Studio / Hot Towel for my front end development. I have decided that I want to try using Yeoman to create my project and am using Adobe Brackets for the front end. I am using VS2013 and Web API for the b... | 2014/05/25 | [
"https://Stackoverflow.com/questions/23851394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1870738/"
] | ***Updated Feb 10, 2015 to reflect the now current packages***
There are OFFICIAL Breeze bower packages available.
```
bower install breeze-client
bower install breeze-client-labs
```
The `breeze-client` package delivers the core Breeze libraries including all adapters.
>
> ***breeze.bridge.angular.js*** (FKA, "b... | There is now an **official breezejs bower package** for *client* assets. Install from a terminal/command window with
`bower install breezejs`
>
> Case matters! Be sure to spell "breezejs" in all lowercase.
>
>
>
This package contains the core JavaScript distribution files PLUS
* adapters - the officially suppor... |
23,851,394 | is there an official Bower package for Breeze (that also includes the Breeze Angular Service)? I am not using Visual Studio / Hot Towel for my front end development. I have decided that I want to try using Yeoman to create my project and am using Adobe Brackets for the front end. I am using VS2013 and Web API for the b... | 2014/05/25 | [
"https://Stackoverflow.com/questions/23851394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1870738/"
] | ***Updated Feb 10, 2015 to reflect the now current packages***
There are OFFICIAL Breeze bower packages available.
```
bower install breeze-client
bower install breeze-client-labs
```
The `breeze-client` package delivers the core Breeze libraries including all adapters.
>
> ***breeze.bridge.angular.js*** (FKA, "b... | The former "breeze.js" bower and npm packages have been retired as of January 20, 2014. They are frozen at breeze release v.1.5.2. This repo will be retained indefinitely.
We've separated the breeze core and breeze labs content into their own packages:
```
breeze-client
breeze-client-labs
```
You'll get almost the ... |
23,851,394 | is there an official Bower package for Breeze (that also includes the Breeze Angular Service)? I am not using Visual Studio / Hot Towel for my front end development. I have decided that I want to try using Yeoman to create my project and am using Adobe Brackets for the front end. I am using VS2013 and Web API for the b... | 2014/05/25 | [
"https://Stackoverflow.com/questions/23851394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1870738/"
] | There is now an **official breezejs bower package** for *client* assets. Install from a terminal/command window with
`bower install breezejs`
>
> Case matters! Be sure to spell "breezejs" in all lowercase.
>
>
>
This package contains the core JavaScript distribution files PLUS
* adapters - the officially suppor... | The former "breeze.js" bower and npm packages have been retired as of January 20, 2014. They are frozen at breeze release v.1.5.2. This repo will be retained indefinitely.
We've separated the breeze core and breeze labs content into their own packages:
```
breeze-client
breeze-client-labs
```
You'll get almost the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.