qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
6,712,244 | How can the last two lines of one function be
```
printf("disk_free_blocks returning %llu\n",item_int3);
return (item_int3);
```
and out put
disk\_free\_blocks returning 233012428800
returning to calling function as
```
part_avail=disk_free_blocks(DiskParts[part_index].part_name,DISK_AVAIL);
if (DEBUG) printf("D... | 2011/07/15 | [
"https://Stackoverflow.com/questions/6712244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/847061/"
] | The two output numbers are:
```
0x00000036409F8000
```
and
```
0x409F8000
```
It appears that the return type (which you haven't shown) isn't large enough to accomodate a 64-bit value, so the compiler simply truncates (which is the behavior required by the standard, for narrowing conversions on unsigned i... | RESOLVED
`disk_free_blocks()` resided in a different file than `process_copy_out()`, the function making the call to `disk_free_blocks`.
The fix was adding a function prototype to inform the compiler.
Thank you everyone for your help. |
121,565 | I have the independent and identically distributed random variables $X\_1,X\_2,\ldots$ with a finite expectation $\mu$. I also have defined $S\_n = X\_1 + \cdots + X\_n$.
According to the law of large numbers, I already know that
$S\_n/n \to \mu$ almost surely as $n\to\infty$.
However, my question is: **How** does t... | 2012/03/18 | [
"https://math.stackexchange.com/questions/121565",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | Sometimes a *weak* law of large numbers gives you better quantitative information.
As a very simple example, suppose that the $X\_i$ have finite variance $\sigma^2$. Then it is easy to see that $\operatorname{Var}(\frac{S\_n}{n}) = \frac{\sigma^2}{n}$, and Chebyshev's inequality gives that for any $\epsilon > 0$, we h... | I consider this a "strong law" type version of Nate's answer. Probably it's a bit crude (it's also a bit late so hopefully this is error-free). Assume finite fourth *central* moment $\mu\_4$ and variacne $\sigma^2$. For fixed $m$ suppose we want to approximate $$P\left(\left|\frac{S\_n}{n} - \mu \right| > \epsilon, \mb... |
24,732,743 | I want to transfer first field of a csv file, but with a certain delay e.g. 1 second after every element. I am using awk to pull the first field and then send it using netcat. I am using the following command but it has no delay.
```
awk -F, '{print $1}' sample.csv | netcat -lk 9999
```
Any hints would be much appr... | 2014/07/14 | [
"https://Stackoverflow.com/questions/24732743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3771345/"
] | You can use system within awk to execute shell commands such as sleep.
```
awk -F, '{system("sleep 1");print $1}' sample.csv | netcat -lk 9999
```
A word of warning though, using system can sometimes make it difficult to cancel a command half way through with `^C` as it cancels the system call but not awk. | You could use `bash` instead of `awk` in this case :
```
while IFS="," read -ra array; do echo "${array[0]}"; sleep 1; done < sample.csv|netcat -lk 9999
``` |
1,115,219 | I've created a user in Ubuntu and given them password auth access so they can login with ssh but i want to restrict their usage to a custom home folder located in:
```
/var/www/daniel (is a root folder with correct permissions)
/var/www/daniel/home (which is owned by daniel:daniel and 755 permissions)
```
In
```
/... | 2022/11/09 | [
"https://serverfault.com/questions/1115219",
"https://serverfault.com",
"https://serverfault.com/users/991934/"
] | No this is not possible. Since it's only a single page, this is all that is retrieved from the server. Everything else happens purely in the client, no further request is sent to the server.
You would need to send an AJAX request with every click to be able to log it. | `nginx` is a server-side piece of the puzzle. With a single page application, the user hits your server (ideally) at most once to download the bundle, and then never again, until the application makes requests of its own accord, for instance to load some data or submit a form.
You say you want to log "every user actio... |
30,162 | My 8-year-old son has just started his classes in the 2nd Grade and within a month I have received guardian calls from his teachers three times. After meeting with them, I got to know that he talks a lot during classes, disturbs the other children, doesn't listen to his teachers and even shouts at the top of his voice ... | 2017/05/18 | [
"https://parenting.stackexchange.com/questions/30162",
"https://parenting.stackexchange.com",
"https://parenting.stackexchange.com/users/27933/"
] | Have you asked him what is different between this year and last year? I think the comments above about having him checked physically are absolutely right on, but the fact that he had trouble two years ago, but didn't last year, and is now having trouble again suggests that something worked well for him last year. If he... | Difficulties in more than one of the three major areas of functioning - home, school, peers - is indicative of a mental health concern.
The cyclical nature of problems-normalcy-problems is another indication of a mental health issue, as opposed to defiance.
The evaluation, treatment options, and goals of cyclical beh... |
35,270,168 | I understand why cyclic inheritance of classes is not allowed in Java but I did not understand why cyclic inheritance of interfaces is not allowed. To illustrate:
```
interface Foo extends Bar {/*methods and constants*/}
interface Bar extends Foo {/*methods and constants*/}
```
Interfaces do not need instantiation,... | 2016/02/08 | [
"https://Stackoverflow.com/questions/35270168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4354754/"
] | No, but extension of an interface is a way of splitting up the agreement. Remember, an interface is an agreement to provide an implementation of a set of methods.
```
public interface A extends B {
public void myMethod();
public void myOtherMethod();
}
```
You're saying interface `A` is defined by these met... | Probably there are no theoretical difficulties, but this would create unnecessary complications. A few to name:
* Currently traversal of class interfaces (via recursive calls of `Class.getInterfaces()`) is guaranteed to produce finite result, probably with repeats, but nevertheless. For example, such code is valid:
`... |
35,270,168 | I understand why cyclic inheritance of classes is not allowed in Java but I did not understand why cyclic inheritance of interfaces is not allowed. To illustrate:
```
interface Foo extends Bar {/*methods and constants*/}
interface Bar extends Foo {/*methods and constants*/}
```
Interfaces do not need instantiation,... | 2016/02/08 | [
"https://Stackoverflow.com/questions/35270168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4354754/"
] | No, but extension of an interface is a way of splitting up the agreement. Remember, an interface is an agreement to provide an implementation of a set of methods.
```
public interface A extends B {
public void myMethod();
public void myOtherMethod();
}
```
You're saying interface `A` is defined by these met... | See Java Language Specification [9.1.3 Superinterfaces and Subinterfaces](https://docs.oracle.com/javase/specs/jls/se8/html/jls-9.html#jls-9.1.3) :
>
> An interface I *depends* on a reference type T if any of the following is true:
>
>
> * I directly depends on T.
> * I directly depends on a class C that depends on... |
3,610,225 | I need help from you, I need to display all the text, labels , strings and what ever text is showing to user in the iphone application with respective selected language in settings of iphone.
for example user selects German or French in settings of iPhone language, then my application should provide or view the detail... | 2010/08/31 | [
"https://Stackoverflow.com/questions/3610225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/249634/"
] | See here: <http://www.icanlocalize.com/site/tutorials/iphone-applications-localization-guide/> | I think the previous link gives a pretty good idea of how to do I18N on the iPhone, but if you feel you need more info, you can try this article <http://blog.federicomestrone.com/2010/05/18/internationalise-your-iphone-apps-with-xcode/> which is just slightly more code-orientated.
The point though is always the same -... |
99,366 | This is the second time this has happened with my Toshiba Mini Netbook. When I restart it, it will shut down but then not come back up. It seems like it's running but the screen is blank and the power button is lit. The first time it happened I shut it down via the power button, then turned it back on while pressing F2... | 2010/01/22 | [
"https://superuser.com/questions/99366",
"https://superuser.com",
"https://superuser.com/users/8802/"
] | Drain the 'flea power':
disconnect the AC power adapter, remove the battery and press the power button for a few seconds.
*I'm not familiar with the Toshiba, but ASUS Eee PC do have a reset button (a small hole at the bottom of the case, accessible with a pin).* | This happened to me too a few times on my TOSHIBA netbook. I unplugged it, pulled the battery for about 10 secs, and then put it back in. Hasn't happened since. I am running Windows 7 Starter. |
17,974,585 | I am trying to set up automatic JSLint tests that will grab js files from a target website, and then using Selenium run it against a Test site that will perform JSLint tests using the url of the Js file.
I am running into problems trying to test this locally, with two different localhost websites.
```
$(function () ... | 2013/07/31 | [
"https://Stackoverflow.com/questions/17974585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/896631/"
] | Python dictionaries are implemented internally with a hash table. This means that key order is not preserved. Is this an issue? | keys in a dictionary are never in the same order, if you want them consistently in the same order for your code, you could do
```
sorted(jsonpost.keys())
``` |
17,974,585 | I am trying to set up automatic JSLint tests that will grab js files from a target website, and then using Selenium run it against a Test site that will perform JSLint tests using the url of the Js file.
I am running into problems trying to test this locally, with two different localhost websites.
```
$(function () ... | 2013/07/31 | [
"https://Stackoverflow.com/questions/17974585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/896631/"
] | keys in a dictionary are never in the same order, if you want them consistently in the same order for your code, you could do
```
sorted(jsonpost.keys())
``` | Python dictionaries are inherently unordered, so when you print them out, the keys can be out of order.
If order is important, you can use an `OrderedDict`:
```
import collections
jsonpost = collections.OrderedDict(sorted(jsonpost.items()))
```
Or you can change to for loop to:
```
for key in sorted(jsonpost.keys(... |
17,974,585 | I am trying to set up automatic JSLint tests that will grab js files from a target website, and then using Selenium run it against a Test site that will perform JSLint tests using the url of the Js file.
I am running into problems trying to test this locally, with two different localhost websites.
```
$(function () ... | 2013/07/31 | [
"https://Stackoverflow.com/questions/17974585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/896631/"
] | keys in a dictionary are never in the same order, if you want them consistently in the same order for your code, you could do
```
sorted(jsonpost.keys())
``` | Dictionary ordering is specified as being unspecified, you could `sort(whatever.keys())` or you could use and ordered dictionary, i.e. `collections.OrderedDict` if you are running python 2.7 or later. |
17,974,585 | I am trying to set up automatic JSLint tests that will grab js files from a target website, and then using Selenium run it against a Test site that will perform JSLint tests using the url of the Js file.
I am running into problems trying to test this locally, with two different localhost websites.
```
$(function () ... | 2013/07/31 | [
"https://Stackoverflow.com/questions/17974585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/896631/"
] | Python dictionaries are implemented internally with a hash table. This means that key order is not preserved. Is this an issue? | Either JavaScript's `JSON` nor Python's `dict` have the concept of ordering. You can use `collections.OrderedDict` in Python to get away with it, but JavaScript does not have such an alternative. |
17,974,585 | I am trying to set up automatic JSLint tests that will grab js files from a target website, and then using Selenium run it against a Test site that will perform JSLint tests using the url of the Js file.
I am running into problems trying to test this locally, with two different localhost websites.
```
$(function () ... | 2013/07/31 | [
"https://Stackoverflow.com/questions/17974585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/896631/"
] | Python dictionaries are implemented internally with a hash table. This means that key order is not preserved. Is this an issue? | Python dictionaries are inherently unordered, so when you print them out, the keys can be out of order.
If order is important, you can use an `OrderedDict`:
```
import collections
jsonpost = collections.OrderedDict(sorted(jsonpost.items()))
```
Or you can change to for loop to:
```
for key in sorted(jsonpost.keys(... |
17,974,585 | I am trying to set up automatic JSLint tests that will grab js files from a target website, and then using Selenium run it against a Test site that will perform JSLint tests using the url of the Js file.
I am running into problems trying to test this locally, with two different localhost websites.
```
$(function () ... | 2013/07/31 | [
"https://Stackoverflow.com/questions/17974585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/896631/"
] | Python dictionaries are implemented internally with a hash table. This means that key order is not preserved. Is this an issue? | Dictionary ordering is specified as being unspecified, you could `sort(whatever.keys())` or you could use and ordered dictionary, i.e. `collections.OrderedDict` if you are running python 2.7 or later. |
17,974,585 | I am trying to set up automatic JSLint tests that will grab js files from a target website, and then using Selenium run it against a Test site that will perform JSLint tests using the url of the Js file.
I am running into problems trying to test this locally, with two different localhost websites.
```
$(function () ... | 2013/07/31 | [
"https://Stackoverflow.com/questions/17974585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/896631/"
] | Either JavaScript's `JSON` nor Python's `dict` have the concept of ordering. You can use `collections.OrderedDict` in Python to get away with it, but JavaScript does not have such an alternative. | Python dictionaries are inherently unordered, so when you print them out, the keys can be out of order.
If order is important, you can use an `OrderedDict`:
```
import collections
jsonpost = collections.OrderedDict(sorted(jsonpost.items()))
```
Or you can change to for loop to:
```
for key in sorted(jsonpost.keys(... |
17,974,585 | I am trying to set up automatic JSLint tests that will grab js files from a target website, and then using Selenium run it against a Test site that will perform JSLint tests using the url of the Js file.
I am running into problems trying to test this locally, with two different localhost websites.
```
$(function () ... | 2013/07/31 | [
"https://Stackoverflow.com/questions/17974585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/896631/"
] | Either JavaScript's `JSON` nor Python's `dict` have the concept of ordering. You can use `collections.OrderedDict` in Python to get away with it, but JavaScript does not have such an alternative. | Dictionary ordering is specified as being unspecified, you could `sort(whatever.keys())` or you could use and ordered dictionary, i.e. `collections.OrderedDict` if you are running python 2.7 or later. |
45,889,666 | I have an app completed using Android and react-native and I am starting to work on the ios version with react-native. Are there going to be any new road blocks with this change? And is it most likely that I should be able to reuse most - if not all of my react-native code while working on the ios version, Cheers. | 2017/08/25 | [
"https://Stackoverflow.com/questions/45889666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7954571/"
] | i have changed the parameter type of my function. and i have separated the code for core-data from appdelegate file.so no need to use this
"let managedContext = appDelegate.managedObjectContext
let OBJECT\_Remove = self.ARRAY[Object\_TO\_Remove]"
statement each time.
change in ViewController.swift for deletePerson f... | **try this code:**`
```
let managedContext = appDelegate.managedObjectContext
let OBJECT_Remove = self.ARRAY[Object_TO_Remove]
managedContext.delete(watchList)
do {
try managedContext.save()
} catch let error as NSError {
... |
53,026,380 | I'm facing an issue in Cloud Foundry with this scenario:
* A device connects to a WebSocket Instance in Cloud foundry
* Then, only one instance in CF holds the socket connection
* The Angular UI sends a request to the REST instance
* The REST instance has to perform an action on the device
Question:
How do I call th... | 2018/10/27 | [
"https://Stackoverflow.com/questions/53026380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7799449/"
] | It's a bit involved but it's possible. First take a look at getting the [stats for a process](https://v3-apidocs.cloudfoundry.org/version/3.60.0/index.html#get-stats-for-a-process). You can use this with `X-CF-APP-INSTANCE` header to reach out to each instance and see which one has the websocket connection you are look... | >
> How an HTTP Instance knows with WebSocket Instance to call?
>
>
>
My answer is: they shouldn't.
Managing an internal pool of instance information and user connectivity data can add complexity and become a scalability (and maintainability) frustration.
>
> How do I call the right WebSocket instance to get to... |
53,026,380 | I'm facing an issue in Cloud Foundry with this scenario:
* A device connects to a WebSocket Instance in Cloud foundry
* Then, only one instance in CF holds the socket connection
* The Angular UI sends a request to the REST instance
* The REST instance has to perform an action on the device
Question:
How do I call th... | 2018/10/27 | [
"https://Stackoverflow.com/questions/53026380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7799449/"
] | As I wrote, I didn't want to setup a messaging system like RabbitMQ just to send a simple command to a device via a Web Socket. Overkilling!
After searching I finally found out a solution to target the right instance.
1\ When the device opens a web socket toward the WebSocket server, I save the CF App ID + the CF Ins... | >
> How an HTTP Instance knows with WebSocket Instance to call?
>
>
>
My answer is: they shouldn't.
Managing an internal pool of instance information and user connectivity data can add complexity and become a scalability (and maintainability) frustration.
>
> How do I call the right WebSocket instance to get to... |
65,845,694 | I have a python script that reads in a parquet file using pyarrow. I'm trying to loop through the table to update values in it. If I try this:
```
for col_name in table2.column_names:
if col_name in my_columns:
print('updating values in column ' + col_name)
col_data = pa.Table.column(table2, col_... | 2021/01/22 | [
"https://Stackoverflow.com/questions/65845694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1827764/"
] | Arrow tables (and arrays) are immutable. So you won't be able to update your table in place.
The way to achieve this is to create copy of the data when modifying it. Arrow supports some basic operation to [modify strings](https://arrow.apache.org/docs/cpp/compute.html#string-transforms), but they are very limited.
An... | The native way to update the array data in pyarrow is [pyarrow compute functions](https://arrow.apache.org/docs/python/compute.html). Converting to pandas, which you described, is also a valid way to achieve this so you might want to figure that out. However, the API is not going to be match the approach you have.
You... |
65,845,694 | I have a python script that reads in a parquet file using pyarrow. I'm trying to loop through the table to update values in it. If I try this:
```
for col_name in table2.column_names:
if col_name in my_columns:
print('updating values in column ' + col_name)
col_data = pa.Table.column(table2, col_... | 2021/01/22 | [
"https://Stackoverflow.com/questions/65845694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1827764/"
] | The native way to update the array data in pyarrow is [pyarrow compute functions](https://arrow.apache.org/docs/python/compute.html). Converting to pandas, which you described, is also a valid way to achieve this so you might want to figure that out. However, the API is not going to be match the approach you have.
You... | I was able to get it working using these references:
<http://arrow.apache.org/docs/python/generated/pyarrow.Table.html>
<http://arrow.apache.org/docs/python/generated/pyarrow.Field.html>
<https://github.com/apache/arrow/blob/master/python/pyarrow/tests/test_table.py>
Basically it loops through the original table an... |
65,845,694 | I have a python script that reads in a parquet file using pyarrow. I'm trying to loop through the table to update values in it. If I try this:
```
for col_name in table2.column_names:
if col_name in my_columns:
print('updating values in column ' + col_name)
col_data = pa.Table.column(table2, col_... | 2021/01/22 | [
"https://Stackoverflow.com/questions/65845694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1827764/"
] | The native way to update the array data in pyarrow is [pyarrow compute functions](https://arrow.apache.org/docs/python/compute.html). Converting to pandas, which you described, is also a valid way to achieve this so you might want to figure that out. However, the API is not going to be match the approach you have.
You... | In order to update data using DatasetDict or any arrow table I can recommend:
1. Create a new variable with the same type of the data that you want to update
2. Insert (append() method in python) your new data into a list or numpy array
3. Insert this list into the variable that you create in the first point
Below ho... |
65,845,694 | I have a python script that reads in a parquet file using pyarrow. I'm trying to loop through the table to update values in it. If I try this:
```
for col_name in table2.column_names:
if col_name in my_columns:
print('updating values in column ' + col_name)
col_data = pa.Table.column(table2, col_... | 2021/01/22 | [
"https://Stackoverflow.com/questions/65845694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1827764/"
] | The native way to update the array data in pyarrow is [pyarrow compute functions](https://arrow.apache.org/docs/python/compute.html). Converting to pandas, which you described, is also a valid way to achieve this so you might want to figure that out. However, the API is not going to be match the approach you have.
You... | For a no pandas solution (pyarrow native), try replacing your column with updated values using table.set\_column().
In the following example I update the float column 'c' using compute to add 2 to all of the values. I'm just using the to\_pandas in the print for a nicer output display.
<https://arrow.apache.org/docs/p... |
65,845,694 | I have a python script that reads in a parquet file using pyarrow. I'm trying to loop through the table to update values in it. If I try this:
```
for col_name in table2.column_names:
if col_name in my_columns:
print('updating values in column ' + col_name)
col_data = pa.Table.column(table2, col_... | 2021/01/22 | [
"https://Stackoverflow.com/questions/65845694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1827764/"
] | Arrow tables (and arrays) are immutable. So you won't be able to update your table in place.
The way to achieve this is to create copy of the data when modifying it. Arrow supports some basic operation to [modify strings](https://arrow.apache.org/docs/cpp/compute.html#string-transforms), but they are very limited.
An... | I was able to get it working using these references:
<http://arrow.apache.org/docs/python/generated/pyarrow.Table.html>
<http://arrow.apache.org/docs/python/generated/pyarrow.Field.html>
<https://github.com/apache/arrow/blob/master/python/pyarrow/tests/test_table.py>
Basically it loops through the original table an... |
65,845,694 | I have a python script that reads in a parquet file using pyarrow. I'm trying to loop through the table to update values in it. If I try this:
```
for col_name in table2.column_names:
if col_name in my_columns:
print('updating values in column ' + col_name)
col_data = pa.Table.column(table2, col_... | 2021/01/22 | [
"https://Stackoverflow.com/questions/65845694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1827764/"
] | Arrow tables (and arrays) are immutable. So you won't be able to update your table in place.
The way to achieve this is to create copy of the data when modifying it. Arrow supports some basic operation to [modify strings](https://arrow.apache.org/docs/cpp/compute.html#string-transforms), but they are very limited.
An... | In order to update data using DatasetDict or any arrow table I can recommend:
1. Create a new variable with the same type of the data that you want to update
2. Insert (append() method in python) your new data into a list or numpy array
3. Insert this list into the variable that you create in the first point
Below ho... |
65,845,694 | I have a python script that reads in a parquet file using pyarrow. I'm trying to loop through the table to update values in it. If I try this:
```
for col_name in table2.column_names:
if col_name in my_columns:
print('updating values in column ' + col_name)
col_data = pa.Table.column(table2, col_... | 2021/01/22 | [
"https://Stackoverflow.com/questions/65845694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1827764/"
] | Arrow tables (and arrays) are immutable. So you won't be able to update your table in place.
The way to achieve this is to create copy of the data when modifying it. Arrow supports some basic operation to [modify strings](https://arrow.apache.org/docs/cpp/compute.html#string-transforms), but they are very limited.
An... | For a no pandas solution (pyarrow native), try replacing your column with updated values using table.set\_column().
In the following example I update the float column 'c' using compute to add 2 to all of the values. I'm just using the to\_pandas in the print for a nicer output display.
<https://arrow.apache.org/docs/p... |
65,845,694 | I have a python script that reads in a parquet file using pyarrow. I'm trying to loop through the table to update values in it. If I try this:
```
for col_name in table2.column_names:
if col_name in my_columns:
print('updating values in column ' + col_name)
col_data = pa.Table.column(table2, col_... | 2021/01/22 | [
"https://Stackoverflow.com/questions/65845694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1827764/"
] | I was able to get it working using these references:
<http://arrow.apache.org/docs/python/generated/pyarrow.Table.html>
<http://arrow.apache.org/docs/python/generated/pyarrow.Field.html>
<https://github.com/apache/arrow/blob/master/python/pyarrow/tests/test_table.py>
Basically it loops through the original table an... | In order to update data using DatasetDict or any arrow table I can recommend:
1. Create a new variable with the same type of the data that you want to update
2. Insert (append() method in python) your new data into a list or numpy array
3. Insert this list into the variable that you create in the first point
Below ho... |
65,845,694 | I have a python script that reads in a parquet file using pyarrow. I'm trying to loop through the table to update values in it. If I try this:
```
for col_name in table2.column_names:
if col_name in my_columns:
print('updating values in column ' + col_name)
col_data = pa.Table.column(table2, col_... | 2021/01/22 | [
"https://Stackoverflow.com/questions/65845694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1827764/"
] | I was able to get it working using these references:
<http://arrow.apache.org/docs/python/generated/pyarrow.Table.html>
<http://arrow.apache.org/docs/python/generated/pyarrow.Field.html>
<https://github.com/apache/arrow/blob/master/python/pyarrow/tests/test_table.py>
Basically it loops through the original table an... | For a no pandas solution (pyarrow native), try replacing your column with updated values using table.set\_column().
In the following example I update the float column 'c' using compute to add 2 to all of the values. I'm just using the to\_pandas in the print for a nicer output display.
<https://arrow.apache.org/docs/p... |
282,531 | I'm looking for a .NET library that will allow creation of a Word document. I need to export HTML based content to a Word doc (97-2003 format, not docx).
I know that there are the Microsoft Office Automation libraries and Office interop, but as far as I can tell, they require that you have office actually installed an... | 2008/11/11 | [
"https://Stackoverflow.com/questions/282531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] | I use Aspose for working with Word, makes everything a breeze: <http://www.aspose.com/> | Using Word Automation from ASP.NET is not a good idea (see the MSKB - <http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2>)
If you are not using WinForms your best option IMHO is to generate RTF, which ms word will happily open. (see the link in the already referenced article).
Good Luck! |
282,531 | I'm looking for a .NET library that will allow creation of a Word document. I need to export HTML based content to a Word doc (97-2003 format, not docx).
I know that there are the Microsoft Office Automation libraries and Office interop, but as far as I can tell, they require that you have office actually installed an... | 2008/11/11 | [
"https://Stackoverflow.com/questions/282531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] | I have found that a document output to HTML but called .doc will open properly formated in Word. I tested with Word 2000 and a file with an internal style sheet. | There's a tool called JODConverter which hooks into open office to expose it's file format converters, there's versions available as a webapp (sits in tomcat) which you post to and a command line tool. I've been firing html at it and converting to .doc and pdf succesfully it's in a fairly big project, haven't gone live... |
282,531 | I'm looking for a .NET library that will allow creation of a Word document. I need to export HTML based content to a Word doc (97-2003 format, not docx).
I know that there are the Microsoft Office Automation libraries and Office interop, but as far as I can tell, they require that you have office actually installed an... | 2008/11/11 | [
"https://Stackoverflow.com/questions/282531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] | I use Aspose for working with Word, makes everything a breeze: <http://www.aspose.com/> | I tried just opening the html directly in word, which technically works except for one thing... My html doc *also* contains CSS, and when opening in Word, it completely ignores the CSS so I no longer have any of the formatting. I realize that I wouldn't get everything out of the CSS but I would at least like to still h... |
282,531 | I'm looking for a .NET library that will allow creation of a Word document. I need to export HTML based content to a Word doc (97-2003 format, not docx).
I know that there are the Microsoft Office Automation libraries and Office interop, but as far as I can tell, they require that you have office actually installed an... | 2008/11/11 | [
"https://Stackoverflow.com/questions/282531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] | *Would it work if I somehow converted the CSS to be embedded in the HTML??*
Yes. I use an internal style sheet, as I mentioned.
Document Example:
```
<html>
<head>
<STYLE type="text/css">
h1 {text-align:center; font-size:12.0pt; font-family:Arial; font-weight:bold;}
p {margin:0in; margin-bottom:0pt; font-si... | Using Word Automation from ASP.NET is not a good idea (see the MSKB - <http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2>)
If you are not using WinForms your best option IMHO is to generate RTF, which ms word will happily open. (see the link in the already referenced article).
Good Luck! |
282,531 | I'm looking for a .NET library that will allow creation of a Word document. I need to export HTML based content to a Word doc (97-2003 format, not docx).
I know that there are the Microsoft Office Automation libraries and Office interop, but as far as I can tell, they require that you have office actually installed an... | 2008/11/11 | [
"https://Stackoverflow.com/questions/282531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] | Using Word Automation from ASP.NET is not a good idea (see the MSKB - <http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2>)
If you are not using WinForms your best option IMHO is to generate RTF, which ms word will happily open. (see the link in the already referenced article).
Good Luck! | Since the doc format specification is not open, and the interop assemblies are the Microsoft solution, I fear that they are your primary (or even only) option.
They do indeed require office to be installed, and they open Word (although showing a window is optional).
I think Word can open HTML documents; is that an op... |
282,531 | I'm looking for a .NET library that will allow creation of a Word document. I need to export HTML based content to a Word doc (97-2003 format, not docx).
I know that there are the Microsoft Office Automation libraries and Office interop, but as far as I can tell, they require that you have office actually installed an... | 2008/11/11 | [
"https://Stackoverflow.com/questions/282531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] | *Would it work if I somehow converted the CSS to be embedded in the HTML??*
Yes. I use an internal style sheet, as I mentioned.
Document Example:
```
<html>
<head>
<STYLE type="text/css">
h1 {text-align:center; font-size:12.0pt; font-family:Arial; font-weight:bold;}
p {margin:0in; margin-bottom:0pt; font-si... | I tried just opening the html directly in word, which technically works except for one thing... My html doc *also* contains CSS, and when opening in Word, it completely ignores the CSS so I no longer have any of the formatting. I realize that I wouldn't get everything out of the CSS but I would at least like to still h... |
282,531 | I'm looking for a .NET library that will allow creation of a Word document. I need to export HTML based content to a Word doc (97-2003 format, not docx).
I know that there are the Microsoft Office Automation libraries and Office interop, but as far as I can tell, they require that you have office actually installed an... | 2008/11/11 | [
"https://Stackoverflow.com/questions/282531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] | Using Word Automation from ASP.NET is not a good idea (see the MSKB - <http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2>)
If you are not using WinForms your best option IMHO is to generate RTF, which ms word will happily open. (see the link in the already referenced article).
Good Luck! | There's a tool called JODConverter which hooks into open office to expose it's file format converters, there's versions available as a webapp (sits in tomcat) which you post to and a command line tool. I've been firing html at it and converting to .doc and pdf succesfully it's in a fairly big project, haven't gone live... |
282,531 | I'm looking for a .NET library that will allow creation of a Word document. I need to export HTML based content to a Word doc (97-2003 format, not docx).
I know that there are the Microsoft Office Automation libraries and Office interop, but as far as I can tell, they require that you have office actually installed an... | 2008/11/11 | [
"https://Stackoverflow.com/questions/282531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] | Using Word Automation from ASP.NET is not a good idea (see the MSKB - <http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2>)
If you are not using WinForms your best option IMHO is to generate RTF, which ms word will happily open. (see the link in the already referenced article).
Good Luck! | I tried just opening the html directly in word, which technically works except for one thing... My html doc *also* contains CSS, and when opening in Word, it completely ignores the CSS so I no longer have any of the formatting. I realize that I wouldn't get everything out of the CSS but I would at least like to still h... |
282,531 | I'm looking for a .NET library that will allow creation of a Word document. I need to export HTML based content to a Word doc (97-2003 format, not docx).
I know that there are the Microsoft Office Automation libraries and Office interop, but as far as I can tell, they require that you have office actually installed an... | 2008/11/11 | [
"https://Stackoverflow.com/questions/282531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] | I use Aspose for working with Word, makes everything a breeze: <http://www.aspose.com/> | There's a tool called JODConverter which hooks into open office to expose it's file format converters, there's versions available as a webapp (sits in tomcat) which you post to and a command line tool. I've been firing html at it and converting to .doc and pdf succesfully it's in a fairly big project, haven't gone live... |
282,531 | I'm looking for a .NET library that will allow creation of a Word document. I need to export HTML based content to a Word doc (97-2003 format, not docx).
I know that there are the Microsoft Office Automation libraries and Office interop, but as far as I can tell, they require that you have office actually installed an... | 2008/11/11 | [
"https://Stackoverflow.com/questions/282531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] | *Would it work if I somehow converted the CSS to be embedded in the HTML??*
Yes. I use an internal style sheet, as I mentioned.
Document Example:
```
<html>
<head>
<STYLE type="text/css">
h1 {text-align:center; font-size:12.0pt; font-family:Arial; font-weight:bold;}
p {margin:0in; margin-bottom:0pt; font-si... | Since the doc format specification is not open, and the interop assemblies are the Microsoft solution, I fear that they are your primary (or even only) option.
They do indeed require office to be installed, and they open Word (although showing a window is optional).
I think Word can open HTML documents; is that an op... |
63,725,856 | I'm new to python and I have a pandas dataframe that I want to iterate row by row (like for example a 2d array in other languages).
The goal is something like this as a logic: (if df was a like 2d array)
```
for row in df:
if df[row,2] == '' AND df[row,1] !='':
df[row-1,1] = df[row,1]
df[row,1] = ''
... | 2020/09/03 | [
"https://Stackoverflow.com/questions/63725856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4276391/"
] | Assuming your table is called table\_1, you can do this with the following:
```
SELECT * FROM [table_1]
ORDER BY (CASE WHEN [Type] = 'BUL' THEN 2 ELSE 1 END),
[Type]
```
Alternatively, you could add a new column for order priority and use that if you want something more scalable. | Use a `CASE` expression:
```sql
...
ORDER BY CASE [Type] WHEN 'AUY' THEN 1
WHEN 'NGD' THEN 2
WHEN 'BUL' THEN 3
ELSE 4
END;
``` |
130,974 | In spite of [the good advice I was given previously](https://gaming.stackexchange.com/q/130266/12937), I've followed a few too many Opportunities that have resulted in rather... troublesome, memories, and now my nightmares are approaching level 5.
Every once in a while, I encounter an Opportunity or Storylet that redu... | 2013/09/15 | [
"https://gaming.stackexchange.com/questions/130974",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/12937/"
] | Action ineffecient and chancy but drink the warm drink in refreshment tent at the carnival, when your scandal gets too high go to your lodge and attend church. May take several tries with the warm drink as it is chancy. | Go to the Carnival and drink the spiced wine. ^\_^
It has a good chance of reducing nightmares. That’s what my Fallen London OC does. |
130,974 | In spite of [the good advice I was given previously](https://gaming.stackexchange.com/q/130266/12937), I've followed a few too many Opportunities that have resulted in rather... troublesome, memories, and now my nightmares are approaching level 5.
Every once in a while, I encounter an Opportunity or Storylet that redu... | 2013/09/15 | [
"https://gaming.stackexchange.com/questions/130974",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/12937/"
] | In addition to Paul Marshall's excellent advice:
The Mirror Marches are *infinitely* better than the State of Some Confusion. The State of Some Confusion almost always damages your stats when you make use of its opportunities, or else applies another Menace, and when you escape from it you lose change points in all of... | Go to the Carnival and drink the spiced wine. ^\_^
It has a good chance of reducing nightmares. That’s what my Fallen London OC does. |
130,974 | In spite of [the good advice I was given previously](https://gaming.stackexchange.com/q/130266/12937), I've followed a few too many Opportunities that have resulted in rather... troublesome, memories, and now my nightmares are approaching level 5.
Every once in a while, I encounter an Opportunity or Storylet that redu... | 2013/09/15 | [
"https://gaming.stackexchange.com/questions/130974",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/12937/"
] | One option is to consult a friend:

This allows you to spend a sudden insight and invite a friend over to confess all of your fears too (though they suffer a small increase nightmares themselves).
Of course, this option is only available if your nig... | Go to the Carnival and drink the spiced wine. ^\_^
It has a good chance of reducing nightmares. That’s what my Fallen London OC does. |
130,974 | In spite of [the good advice I was given previously](https://gaming.stackexchange.com/q/130266/12937), I've followed a few too many Opportunities that have resulted in rather... troublesome, memories, and now my nightmares are approaching level 5.
Every once in a while, I encounter an Opportunity or Storylet that redu... | 2013/09/15 | [
"https://gaming.stackexchange.com/questions/130974",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/12937/"
] | I'd just like to add that if you go to the [State of Some Confusion](http://fallenlondon.wikia.com/wiki/Category:A_state_of_some_confusion), you lose a lot of dreams and four [Memories of Light](http://fallenlondon.wikia.com/wiki/Memory_of_Light) anyways, so it's better to just stay in the Mirror-Marshes and lose one u... | In The Shuttered Palace, the commission to paint a portrait of the royal children has two options: Arrange a sitting, and Consult your Bohemian Friends. The Bohemians cost prisoner's honey, is a bit more difficult than the sitting, but reduces your Nightmares by one change point on success. If your Persuasive is high e... |
130,974 | In spite of [the good advice I was given previously](https://gaming.stackexchange.com/q/130266/12937), I've followed a few too many Opportunities that have resulted in rather... troublesome, memories, and now my nightmares are approaching level 5.
Every once in a while, I encounter an Opportunity or Storylet that redu... | 2013/09/15 | [
"https://gaming.stackexchange.com/questions/130974",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/12937/"
] | Sometimes completing story lines will reset your nightmares, so it might be worthwhile to continue as normal until your nightmares get to 7 when you are in danger of going insane. | Go to the Carnival and drink the spiced wine. ^\_^
It has a good chance of reducing nightmares. That’s what my Fallen London OC does. |
130,974 | In spite of [the good advice I was given previously](https://gaming.stackexchange.com/q/130266/12937), I've followed a few too many Opportunities that have resulted in rather... troublesome, memories, and now my nightmares are approaching level 5.
Every once in a while, I encounter an Opportunity or Storylet that redu... | 2013/09/15 | [
"https://gaming.stackexchange.com/questions/130974",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/12937/"
] | One option is to consult a friend:

This allows you to spend a sudden insight and invite a friend over to confess all of your fears too (though they suffer a small increase nightmares themselves).
Of course, this option is only available if your nig... | Sometimes completing story lines will reset your nightmares, so it might be worthwhile to continue as normal until your nightmares get to 7 when you are in danger of going insane. |
130,974 | In spite of [the good advice I was given previously](https://gaming.stackexchange.com/q/130266/12937), I've followed a few too many Opportunities that have resulted in rather... troublesome, memories, and now my nightmares are approaching level 5.
Every once in a while, I encounter an Opportunity or Storylet that redu... | 2013/09/15 | [
"https://gaming.stackexchange.com/questions/130974",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/12937/"
] | In addition to Paul Marshall's excellent advice:
The Mirror Marches are *infinitely* better than the State of Some Confusion. The State of Some Confusion almost always damages your stats when you make use of its opportunities, or else applies another Menace, and when you escape from it you lose change points in all of... | I'd just like to add that if you go to the [State of Some Confusion](http://fallenlondon.wikia.com/wiki/Category:A_state_of_some_confusion), you lose a lot of dreams and four [Memories of Light](http://fallenlondon.wikia.com/wiki/Memory_of_Light) anyways, so it's better to just stay in the Mirror-Marshes and lose one u... |
130,974 | In spite of [the good advice I was given previously](https://gaming.stackexchange.com/q/130266/12937), I've followed a few too many Opportunities that have resulted in rather... troublesome, memories, and now my nightmares are approaching level 5.
Every once in a while, I encounter an Opportunity or Storylet that redu... | 2013/09/15 | [
"https://gaming.stackexchange.com/questions/130974",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/12937/"
] | I'd just like to add that if you go to the [State of Some Confusion](http://fallenlondon.wikia.com/wiki/Category:A_state_of_some_confusion), you lose a lot of dreams and four [Memories of Light](http://fallenlondon.wikia.com/wiki/Memory_of_Light) anyways, so it's better to just stay in the Mirror-Marshes and lose one u... | Go to the Carnival and drink the spiced wine. ^\_^
It has a good chance of reducing nightmares. That’s what my Fallen London OC does. |
130,974 | In spite of [the good advice I was given previously](https://gaming.stackexchange.com/q/130266/12937), I've followed a few too many Opportunities that have resulted in rather... troublesome, memories, and now my nightmares are approaching level 5.
Every once in a while, I encounter an Opportunity or Storylet that redu... | 2013/09/15 | [
"https://gaming.stackexchange.com/questions/130974",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/12937/"
] | In The Shuttered Palace, the commission to paint a portrait of the royal children has two options: Arrange a sitting, and Consult your Bohemian Friends. The Bohemians cost prisoner's honey, is a bit more difficult than the sitting, but reduces your Nightmares by one change point on success. If your Persuasive is high e... | Go to the Carnival and drink the spiced wine. ^\_^
It has a good chance of reducing nightmares. That’s what my Fallen London OC does. |
130,974 | In spite of [the good advice I was given previously](https://gaming.stackexchange.com/q/130266/12937), I've followed a few too many Opportunities that have resulted in rather... troublesome, memories, and now my nightmares are approaching level 5.
Every once in a while, I encounter an Opportunity or Storylet that redu... | 2013/09/15 | [
"https://gaming.stackexchange.com/questions/130974",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/12937/"
] | In addition to Paul Marshall's excellent advice:
The Mirror Marches are *infinitely* better than the State of Some Confusion. The State of Some Confusion almost always damages your stats when you make use of its opportunities, or else applies another Menace, and when you escape from it you lose change points in all of... | Action ineffecient and chancy but drink the warm drink in refreshment tent at the carnival, when your scandal gets too high go to your lodge and attend church. May take several tries with the warm drink as it is chancy. |
56,980,110 | I am working on a slideshow for the homepage of my website. It works, automatically shifting throughout 1-3, but the onclick functions are having some troubles. Every single one of the buttons bring me to my first slide, not the second or the third, just the first. Any help is appreciated, please and thanks!
```js
doc... | 2019/07/11 | [
"https://Stackoverflow.com/questions/56980110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10470669/"
] | You are using links `<a>` tags, to handle your clicks, the page is reloading every time you click on one of them, on page reload, it will display the first slide. That is the expected behavior of `href=""`.
The easiest solution is to change your `<a>` tags for `<button>` tags, though you could also catch the `event` a... | The `setInterval` at each select function are not necessary.
According to the `changeSlide` function, change the `currentSlide` as follow.
```
function firstSlide() {
currentSlide = 3;
}
function secondSlide() {
currentSlide = 1;
}
function thirdSlide() {
currentSlide = 2;
}
``` |
56,980,110 | I am working on a slideshow for the homepage of my website. It works, automatically shifting throughout 1-3, but the onclick functions are having some troubles. Every single one of the buttons bring me to my first slide, not the second or the third, just the first. Any help is appreciated, please and thanks!
```js
doc... | 2019/07/11 | [
"https://Stackoverflow.com/questions/56980110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10470669/"
] | You are using links `<a>` tags, to handle your clicks, the page is reloading every time you click on one of them, on page reload, it will display the first slide. That is the expected behavior of `href=""`.
The easiest solution is to change your `<a>` tags for `<button>` tags, though you could also catch the `event` a... | check this (run the snippet below ) i fixed some syntax errors :
```js
document.getElementById("left").style.opacity =1;
var currentSlide = 1;
var myVar = setInterval(function(){
return changeSlide()
}
,1000);
function changeSlide() {
if (currentSlide == 1) {
currentSlide++;
document.getEl... |
23,874,657 | I have code like this:
```
function Food(type) {
this.type = type;
this.timesEaten = 0;
}
Food.prototype.eat = function() { // Dependent function
this.timesEaten++;
}
Food.prototype.pasta = function() { // In-dependent function
return new Food("pasta")
}
```
So, I want to be able to use the pasta function ... | 2014/05/26 | [
"https://Stackoverflow.com/questions/23874657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
function Food(type) {
this.type = type;
this.timesEaten = 0;
}
Food.prototype.eat = function() { // Dependent function
this.timesEaten++;
}
Food.pasta = function() { // In-dependent function
return new Food("pasta")
}
```
`Food.prototype` functions are only available for objects of `Food`, while for `Fo... | A method like your `.pasta()` method that does not operate on any instance data is called a static method. You don't want it on the prototype because the prototype will only be in the lookup chain on an instantiated object (after creating an actual `Food` object by doing `new Food()`).
Instead, for a static method you... |
32,110,748 | As far as I know, this initialization will be complemented before the function body of the constructor.
If the initialization of data members is the part of constructor, then it should be inlined when the contructor is inlined, otherwise on the contrary.
By the way, how about the constructor list? And is the destroy ... | 2015/08/20 | [
"https://Stackoverflow.com/questions/32110748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1546088/"
] | Try this code:
```
JSONObject userDetails = new JSONObject();
try {
userDetails.put("Emailid", emailid.getText().toString());
userDetails.put("Password", password.getText().toString());
userDetails.put("DeviceID", DEVICEID);
userDetails.put("PlatformID", WebUrl.p... | solution for my problem :
changed the serviceclient code like this.
```
public interface ServiceClient {
String SERVICE_ENDPOINT = "https://eload.in/Service/AppServices.asmx";
@FormUrlEncoded
@POST("/Validateuser_v2")
void getUserInfo(
@Field("Emailid") String email,
@Field("... |
48,478 | I have a 22" external monitor connected to my MacBook Pro (late 2011) via Thunderbolt to VGA. When I boot into Windows 7 x64, the screen seems to work and is mirrored during the boot screens, then it goes blank at the login screen. It stays blank after I log in to Windows. The built-in screen on the laptop works fine.
... | 2012/04/13 | [
"https://apple.stackexchange.com/questions/48478",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/17385/"
] | Note that it appears the Thunderbolt may work a bit differently on Windows in Bootcamp than it does on the same computer when running OS X. As noted below on [Thunderbolt ports and displays: Frequently asked questions (FAQ)](http://support.apple.com/kb/HT5219?viewlocale=en_US#13)
>
> 1. Why isn't my device recognized... | I just disabled DisplayPort 1.2 on the screens and it started working on My bootcamp partition.
3 screens.
Hope it helps.
Tiago |
48,478 | I have a 22" external monitor connected to my MacBook Pro (late 2011) via Thunderbolt to VGA. When I boot into Windows 7 x64, the screen seems to work and is mirrored during the boot screens, then it goes blank at the login screen. It stays blank after I log in to Windows. The built-in screen on the laptop works fine.
... | 2012/04/13 | [
"https://apple.stackexchange.com/questions/48478",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/17385/"
] | Note that it appears the Thunderbolt may work a bit differently on Windows in Bootcamp than it does on the same computer when running OS X. As noted below on [Thunderbolt ports and displays: Frequently asked questions (FAQ)](http://support.apple.com/kb/HT5219?viewlocale=en_US#13)
>
> 1. Why isn't my device recognized... | FIXED
I have a MacBook Pro and Windows 8 installed using Bootcamp.
I could not get my second monitor to work (connected using the Thunderbolt port to DVI connector on the monitor)
Here is what I did:
* identified graphics card by booting into Mac OS, click on the apple icon (top left) >about this mac >more info. Her... |
3,209,740 | I'm trying to discover how to change the default set of Client Spec options and submit-options.
```
set P4CLIENT=my_new_client_1
p4 client
```
Gives me the following spec default-spec:
```
Client: my_new_client_1
...
Options: noallwrite noclobber nocompress unlocked nomodtime normdir
SubmitOptions: submituncha... | 2010/07/09 | [
"https://Stackoverflow.com/questions/3209740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/384507/"
] | You can't change the default client spec template (unless you're the Perforce system administrator) but you can set up and use your own template. You would first create a dummy client with a client spec that has the values that you want:
```
Client: my_template_client
...
Options: noallwrite noclobber nocompress un... | The first response here was incorrect:
You CAN create a default clientspec in Perforce using triggers.
Essentially, you create a script that runs on the server and runs whenever someone does a form-out on the form client. This script would have to check to see if the clientspec already exists, and then substitute a s... |
3,209,740 | I'm trying to discover how to change the default set of Client Spec options and submit-options.
```
set P4CLIENT=my_new_client_1
p4 client
```
Gives me the following spec default-spec:
```
Client: my_new_client_1
...
Options: noallwrite noclobber nocompress unlocked nomodtime normdir
SubmitOptions: submituncha... | 2010/07/09 | [
"https://Stackoverflow.com/questions/3209740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/384507/"
] | You can't change the default client spec template (unless you're the Perforce system administrator) but you can set up and use your own template. You would first create a dummy client with a client spec that has the values that you want:
```
Client: my_template_client
...
Options: noallwrite noclobber nocompress un... | The Perforce Server Deployment Package (SDP), a reference implementation with best practices for operating a Perforce Helix Core server, includes sample triggers for exactly this purpose. See:
* SetWsOptions.py - <https://swarm.workshop.perforce.com/projects/perforce-software-sdp/files/main/Server/Unix/p4/common/bin/t... |
3,209,740 | I'm trying to discover how to change the default set of Client Spec options and submit-options.
```
set P4CLIENT=my_new_client_1
p4 client
```
Gives me the following spec default-spec:
```
Client: my_new_client_1
...
Options: noallwrite noclobber nocompress unlocked nomodtime normdir
SubmitOptions: submituncha... | 2010/07/09 | [
"https://Stackoverflow.com/questions/3209740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/384507/"
] | The first response here was incorrect:
You CAN create a default clientspec in Perforce using triggers.
Essentially, you create a script that runs on the server and runs whenever someone does a form-out on the form client. This script would have to check to see if the clientspec already exists, and then substitute a s... | The Perforce Server Deployment Package (SDP), a reference implementation with best practices for operating a Perforce Helix Core server, includes sample triggers for exactly this purpose. See:
* SetWsOptions.py - <https://swarm.workshop.perforce.com/projects/perforce-software-sdp/files/main/Server/Unix/p4/common/bin/t... |
37,598,994 | I have a starting hour given in string.
```
let opens = '08:00';
```
I want to measure the difference in minutes for various dates.
```
let date1 = moment('1945.10.20 17:30');
let date2 = moment('1970.01.08 12:00');
// should result 570 (9.5h) and 240 (4h)
```
I was naive enough to try
```
moment(opens, 'HH:mm')... | 2016/06/02 | [
"https://Stackoverflow.com/questions/37598994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3568719/"
] | Get a moment object on the same day, but with the hours you want. From there do the comparison. If you know the format of opens will always be `HH:mm` then you can do this:
```
let opens = '08:00';
let opensTime = moment(opens, 'HH:mm');
let date1 = moment('1945.10.20 17:30', 'YYYY.MM.DD HH:mm');
let openDate1 = date1... | If I am reading this correctly, you want to compare the hours on your date object to 8AM.
Javascript has getHours() and getMinutes() from date object.
```
Hence you can do date.getHours() - 8, and date1.getMinutes()
``` |
37,598,994 | I have a starting hour given in string.
```
let opens = '08:00';
```
I want to measure the difference in minutes for various dates.
```
let date1 = moment('1945.10.20 17:30');
let date2 = moment('1970.01.08 12:00');
// should result 570 (9.5h) and 240 (4h)
```
I was naive enough to try
```
moment(opens, 'HH:mm')... | 2016/06/02 | [
"https://Stackoverflow.com/questions/37598994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3568719/"
] | Get a moment object on the same day, but with the hours you want. From there do the comparison. If you know the format of opens will always be `HH:mm` then you can do this:
```
let opens = '08:00';
let opensTime = moment(opens, 'HH:mm');
let date1 = moment('1945.10.20 17:30', 'YYYY.MM.DD HH:mm');
let openDate1 = date1... | Can you modify the `opens` variable?
```js
let date1 = moment(new Date('1945.10.20 17:30'));
let date2 = moment(new Date('1970.01.08 12:00'));
function timeDifference(end, opensHour, opensMinute) {
var start = end.clone().set({
"hour": opensHour,
"minute": opensMinute
});
return {
"start": ... |
1,036,980 | >
> Show the subset $$A = \{(x\_1, . . . , x\_n) ∈ \mathbb{R}^n| −1 ≤ x\_1 ≤ x\_2 ≤ · · · ≤ x\_n ≤ 1\} \subset \mathbb{R}^n $$ is compact, and show the function
> $$\left\{\begin{array}{}f : A → \mathbb{R}\\
> f(x\_1, . . . , x\_n) = \sum\_{i=1}^n x\_i \cos x\_i\end{array}\right.$$
> attains its maximum and minimu... | 2014/11/24 | [
"https://math.stackexchange.com/questions/1036980",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/191386/"
] | Let $\{a\_i\}$ be a sequence in $A$ which converges in $\mathbb{R}^n$. Let $a$ be the limit of this sequence. If we can show that $a \in A$, then we have shown that $A$ is closed (in fact sequentially closed, but this is enough as we are in a metric space). Letting $a\_i = (a\_i^1, \dots, a\_i^n)$ and $a = (a^1, \dots,... | The set $A$ is compact in $\mathbb{R}^n$ since it is closed and bounded. It is bounded since it is contained in the ball $B[0,\sqrt{n}].$ Indeed: $$ \sum\_{i=1}^n x\_i^2\le \sum\_{i=1}^n1=n \implies (x\_1,\cdots,x\_n)\in B[0,\sqrt{n}].$$ To show that it is closed we will show that its complement is open. Let $(x\_1,\cd... |
1,036,980 | >
> Show the subset $$A = \{(x\_1, . . . , x\_n) ∈ \mathbb{R}^n| −1 ≤ x\_1 ≤ x\_2 ≤ · · · ≤ x\_n ≤ 1\} \subset \mathbb{R}^n $$ is compact, and show the function
> $$\left\{\begin{array}{}f : A → \mathbb{R}\\
> f(x\_1, . . . , x\_n) = \sum\_{i=1}^n x\_i \cos x\_i\end{array}\right.$$
> attains its maximum and minimu... | 2014/11/24 | [
"https://math.stackexchange.com/questions/1036980",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/191386/"
] | Let $\{a\_i\}$ be a sequence in $A$ which converges in $\mathbb{R}^n$. Let $a$ be the limit of this sequence. If we can show that $a \in A$, then we have shown that $A$ is closed (in fact sequentially closed, but this is enough as we are in a metric space). Letting $a\_i = (a\_i^1, \dots, a\_i^n)$ and $a = (a^1, \dots,... | Let $\big(x^i\_1,\cdots,x^i\_n\big)\_{i\in\mathbb{N}}$ be a sequence of members $A$ which converges to $(l\_1,\cdots,l\_n)$. It's equivalent to this fact that for each $j$, we have : $x^i\_j\rightarrow l\_j$, as $i$ tends to $\infty$.
Obviously, for each $j$ we have : $-1\le l\_j\le1$ .
So It's sufficient to prove $l... |
1,036,980 | >
> Show the subset $$A = \{(x\_1, . . . , x\_n) ∈ \mathbb{R}^n| −1 ≤ x\_1 ≤ x\_2 ≤ · · · ≤ x\_n ≤ 1\} \subset \mathbb{R}^n $$ is compact, and show the function
> $$\left\{\begin{array}{}f : A → \mathbb{R}\\
> f(x\_1, . . . , x\_n) = \sum\_{i=1}^n x\_i \cos x\_i\end{array}\right.$$
> attains its maximum and minimu... | 2014/11/24 | [
"https://math.stackexchange.com/questions/1036980",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/191386/"
] | Let $\{a\_i\}$ be a sequence in $A$ which converges in $\mathbb{R}^n$. Let $a$ be the limit of this sequence. If we can show that $a \in A$, then we have shown that $A$ is closed (in fact sequentially closed, but this is enough as we are in a metric space). Letting $a\_i = (a\_i^1, \dots, a\_i^n)$ and $a = (a^1, \dots,... | Clearly $A$ is bounded. Let $g : \mathbb{R}^n \to \mathbb{R}^{n+1}$ be given by
$$g(x\_1, \ldots, x\_n) = (x\_1, x\_2 - x\_1, x\_3 - x\_2, \ldots, x\_n - x\_{n-1}, x\_n)$$
Then $g$ is continuous, so the inverse image of the closed set
$$[-1,1] \times [0,2] \times [0,2] \times \cdots \times [0,2] \times [-1,1]$$
is clos... |
4,646,139 | Could someone please show me a sample code snippet where you use two buttons; one to turn off and one to turn on the screen. I cant get it to work. Thanks! | 2011/01/10 | [
"https://Stackoverflow.com/questions/4646139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/557187/"
] | Never use `remove` on an `ArrayList`, it's O(size()). Also, your count variable gets wrapped and unwrapped each time you increment it. Make its type `int` and wrap it into `Integer` only at the very end.
Without knowing anything about the type of Objects you store, I assume the methods `equals` and `hashCode` are rede... | Sort them, and then count reoccurances with a loop after that. That will bring it down to O(n log n)
or use a hashtable to do your counting instead. That should be a linear time calculation. |
68,721,263 | ```
File "bot.py", line 17, in on_member_join
await channel.send('{.member} has joined the server')
AttributeError: 'NoneType' object has no attribute 'send'
```
How can I fix?
PS. I already have intents on
code is here:
```
async def on_member_join(member):
channel = bot.get_channel(xxxxxxx)
await cha... | 2021/08/10 | [
"https://Stackoverflow.com/questions/68721263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Instead of `idxmax`, use `max` and then negate the result:
```
~df.Item.isin(End).groupby(df.Item.eq('Start').cumsum()).transform('max')
0 True
1 True
2 True
3 True
4 True
5 False
6 False
7 False
8 False
9 False
10 False
11 True
12 True
13 True
Name: Item, d... | Group the boolean mask `m2` by `Seq` and `transform` with `any` then negate the output
```
~(m2.groupby(df['Seq']).transform('any'))
```
---
```
0 True
1 True
2 True
3 True
4 True
5 False
6 False
7 False
8 False
9 False
10 False
11 True
12 True
13 True
Nam... |
2,131 | Does anyone have a reference implementation (ideally 3rd party certified, or [government approved](http://en.wikipedia.org/wiki/FIPS_140)) way one-way hash a password for C# and or Java?
Ideally,I'd like to see something that includes a "salt and pepper" technique as mentioned [here](https://security.stackexchange.com... | 2011/02/12 | [
"https://security.stackexchange.com/questions/2131",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/396/"
] | Given your new "government approved" requirement, my guess is that one good solution would be PBKDF2 from [RFC 2898](https://www.rfc-editor.org/rfc/rfc2898). It is implemented for .NET in [Rfc2898DeriveBytes Class (System.Security.Cryptography)](http://msdn.microsoft.com/en-us/library/system.security.cryptography.rfc28... | ### The basics
The basic approach is `Hash(secret | salt)`, which is stored along with the salt. Obviously it's important to use a modern hash algorithm like one of the SHA2 variants (though currently SHA1 is not totally broken like MD5 is). Note that if you are storing challenge questions this way, you probably want ... |
2,131 | Does anyone have a reference implementation (ideally 3rd party certified, or [government approved](http://en.wikipedia.org/wiki/FIPS_140)) way one-way hash a password for C# and or Java?
Ideally,I'd like to see something that includes a "salt and pepper" technique as mentioned [here](https://security.stackexchange.com... | 2011/02/12 | [
"https://security.stackexchange.com/questions/2131",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/396/"
] | ### The basics
The basic approach is `Hash(secret | salt)`, which is stored along with the salt. Obviously it's important to use a modern hash algorithm like one of the SHA2 variants (though currently SHA1 is not totally broken like MD5 is). Note that if you are storing challenge questions this way, you probably want ... | **.Net answer**:
According to [this post](http://geeklyeverafter.blogspot.com/2010/12/net-encryption-part-2.html) all **-Cng** and **-CryptoServiceProvider** postfixed implementations from the [**.Net Cryptography** Namespace](https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography?view=netframework... |
2,131 | Does anyone have a reference implementation (ideally 3rd party certified, or [government approved](http://en.wikipedia.org/wiki/FIPS_140)) way one-way hash a password for C# and or Java?
Ideally,I'd like to see something that includes a "salt and pepper" technique as mentioned [here](https://security.stackexchange.com... | 2011/02/12 | [
"https://security.stackexchange.com/questions/2131",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/396/"
] | Given your new "government approved" requirement, my guess is that one good solution would be PBKDF2 from [RFC 2898](https://www.rfc-editor.org/rfc/rfc2898). It is implemented for .NET in [Rfc2898DeriveBytes Class (System.Security.Cryptography)](http://msdn.microsoft.com/en-us/library/system.security.cryptography.rfc28... | **.Net answer**:
According to [this post](http://geeklyeverafter.blogspot.com/2010/12/net-encryption-part-2.html) all **-Cng** and **-CryptoServiceProvider** postfixed implementations from the [**.Net Cryptography** Namespace](https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography?view=netframework... |
66,516,990 | To be clear, I wish to create rows that each have columns totaling more than 12 in such a way that the columns become a scrollable row. To illustrate what I have tried, here is an example. The html is:
```
<div class="container-fluid">
<div class="row">
<div class="col-3">
This is
</div>
... | 2021/03/07 | [
"https://Stackoverflow.com/questions/66516990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2158960/"
] | I have found that if I had flex-nowrap to the row(s) I wish to have scroll that takes care of the issue. | Try this:
```
<div class="container-fluid">
<div class="row">
<div class="col-3">
This is
</div>
<div class="col-9">
the first row
</div>
</div>
<div class="row">
<div class="col-6">
This is
</div>
<div class="col-6">
the second row
... |
8,620,303 | I am working on a system, written in C++, running on a Xeon on Linux, that needs to run as fast as possible. There is a large data structure (basically an array of structs) held in RAM, over 10 GB, and elements of it need to be accessed periodically. I want to revise the data structure to work with the system's caching... | 2011/12/23 | [
"https://Stackoverflow.com/questions/8620303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974063/"
] | Today’s CPUs fetch memory in chunks of (typically) 64 bytes, called cache lines. When you read a particular memory location, the entire cache line is fetched from the main memory into the cache.
More here : <http://igoro.com/archive/gallery-of-processor-cache-effects/> | Old SO question that has some info that might be of use to you (in particular the first answer where to look for Linux CPU info - responder doesn't mention line size proper, but 'other info' on top of associativity etc). Question is for x86, but answers are more general. Worth a look.
[Where is the L1 memory cache of ... |
8,620,303 | I am working on a system, written in C++, running on a Xeon on Linux, that needs to run as fast as possible. There is a large data structure (basically an array of structs) held in RAM, over 10 GB, and elements of it need to be accessed periodically. I want to revise the data structure to work with the system's caching... | 2011/12/23 | [
"https://Stackoverflow.com/questions/8620303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974063/"
] | Today’s CPUs fetch memory in chunks of (typically) 64 bytes, called cache lines. When you read a particular memory location, the entire cache line is fetched from the main memory into the cache.
More here : <http://igoro.com/archive/gallery-of-processor-cache-effects/> | A cache line for any current Xeon processor is 64 bytes. One other thing that you might want to think about is the TLB. If you are really doing random accesses across 10GB of memory then you are likely to have a lot of TLB misses which can potentially be as costly as cache misses. You can get work around with with larg... |
8,620,303 | I am working on a system, written in C++, running on a Xeon on Linux, that needs to run as fast as possible. There is a large data structure (basically an array of structs) held in RAM, over 10 GB, and elements of it need to be accessed periodically. I want to revise the data structure to work with the system's caching... | 2011/12/23 | [
"https://Stackoverflow.com/questions/8620303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974063/"
] | Today’s CPUs fetch memory in chunks of (typically) 64 bytes, called cache lines. When you read a particular memory location, the entire cache line is fetched from the main memory into the cache.
More here : <http://igoro.com/archive/gallery-of-processor-cache-effects/> | You might want to head over to <http://agner.org/optimize/> and grab the optimization PDFs available there - there's a lot of good (low-level) information in there. Pretty focused on assembly language level, but there's lessons to be learned for C/C++ programmers as well.
Volume 3, "The microarchitecture of Intel, AMD... |
8,620,303 | I am working on a system, written in C++, running on a Xeon on Linux, that needs to run as fast as possible. There is a large data structure (basically an array of structs) held in RAM, over 10 GB, and elements of it need to be accessed periodically. I want to revise the data structure to work with the system's caching... | 2011/12/23 | [
"https://Stackoverflow.com/questions/8620303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974063/"
] | Today’s CPUs fetch memory in chunks of (typically) 64 bytes, called cache lines. When you read a particular memory location, the entire cache line is fetched from the main memory into the cache.
More here : <http://igoro.com/archive/gallery-of-processor-cache-effects/> | Good (long) article about organizing data structures to take cache and RAM hierarchy into account from GNU's libc maintainer: <https://lwn.net/Articles/250967/> (full PDF here: <http://www.akkadia.org/drepper/cpumemory.pdf>) |
8,620,303 | I am working on a system, written in C++, running on a Xeon on Linux, that needs to run as fast as possible. There is a large data structure (basically an array of structs) held in RAM, over 10 GB, and elements of it need to be accessed periodically. I want to revise the data structure to work with the system's caching... | 2011/12/23 | [
"https://Stackoverflow.com/questions/8620303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974063/"
] | Old SO question that has some info that might be of use to you (in particular the first answer where to look for Linux CPU info - responder doesn't mention line size proper, but 'other info' on top of associativity etc). Question is for x86, but answers are more general. Worth a look.
[Where is the L1 memory cache of ... | You might want to head over to <http://agner.org/optimize/> and grab the optimization PDFs available there - there's a lot of good (low-level) information in there. Pretty focused on assembly language level, but there's lessons to be learned for C/C++ programmers as well.
Volume 3, "The microarchitecture of Intel, AMD... |
8,620,303 | I am working on a system, written in C++, running on a Xeon on Linux, that needs to run as fast as possible. There is a large data structure (basically an array of structs) held in RAM, over 10 GB, and elements of it need to be accessed periodically. I want to revise the data structure to work with the system's caching... | 2011/12/23 | [
"https://Stackoverflow.com/questions/8620303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974063/"
] | Old SO question that has some info that might be of use to you (in particular the first answer where to look for Linux CPU info - responder doesn't mention line size proper, but 'other info' on top of associativity etc). Question is for x86, but answers are more general. Worth a look.
[Where is the L1 memory cache of ... | Good (long) article about organizing data structures to take cache and RAM hierarchy into account from GNU's libc maintainer: <https://lwn.net/Articles/250967/> (full PDF here: <http://www.akkadia.org/drepper/cpumemory.pdf>) |
8,620,303 | I am working on a system, written in C++, running on a Xeon on Linux, that needs to run as fast as possible. There is a large data structure (basically an array of structs) held in RAM, over 10 GB, and elements of it need to be accessed periodically. I want to revise the data structure to work with the system's caching... | 2011/12/23 | [
"https://Stackoverflow.com/questions/8620303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974063/"
] | A cache line for any current Xeon processor is 64 bytes. One other thing that you might want to think about is the TLB. If you are really doing random accesses across 10GB of memory then you are likely to have a lot of TLB misses which can potentially be as costly as cache misses. You can get work around with with larg... | You might want to head over to <http://agner.org/optimize/> and grab the optimization PDFs available there - there's a lot of good (low-level) information in there. Pretty focused on assembly language level, but there's lessons to be learned for C/C++ programmers as well.
Volume 3, "The microarchitecture of Intel, AMD... |
8,620,303 | I am working on a system, written in C++, running on a Xeon on Linux, that needs to run as fast as possible. There is a large data structure (basically an array of structs) held in RAM, over 10 GB, and elements of it need to be accessed periodically. I want to revise the data structure to work with the system's caching... | 2011/12/23 | [
"https://Stackoverflow.com/questions/8620303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974063/"
] | A cache line for any current Xeon processor is 64 bytes. One other thing that you might want to think about is the TLB. If you are really doing random accesses across 10GB of memory then you are likely to have a lot of TLB misses which can potentially be as costly as cache misses. You can get work around with with larg... | Good (long) article about organizing data structures to take cache and RAM hierarchy into account from GNU's libc maintainer: <https://lwn.net/Articles/250967/> (full PDF here: <http://www.akkadia.org/drepper/cpumemory.pdf>) |
17,461,042 | I have just had a really good use for multithreading. As such.... I have to learn multithreading. I have a very simple program:
```
void *listenloop(void *arg){
while (1){
Sleep(2000);
puts("testing 123\n");
}
return NULL;
}
int main(){
pthread_t listener;
pthread_create(&listener,NULL,liste... | 2013/07/04 | [
"https://Stackoverflow.com/questions/17461042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1833028/"
] | $(this) creates a jQuery object from the context at the time it is called. `this` changes according to which click handler has been fired, so caching it at the top of the code won't give you the result you want.
If you need to access `$(this)` more than once or twice in a handler, cache it in the handler.
```
$this =... | Try using
```
listItem.click(function(data)
```
instead of
```
listItem.click(function()
``` |
17,461,042 | I have just had a really good use for multithreading. As such.... I have to learn multithreading. I have a very simple program:
```
void *listenloop(void *arg){
while (1){
Sleep(2000);
puts("testing 123\n");
}
return NULL;
}
int main(){
pthread_t listener;
pthread_create(&listener,NULL,liste... | 2013/07/04 | [
"https://Stackoverflow.com/questions/17461042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1833028/"
] | How do you init it?
if you do something like
$this = $(this);
It MUST not work, becouse in the list `this` contains scope of you function, but not eventual `clicks` scope
you do something like
```
var that; // - without initing it
```
and then do
```
but.click = function(){
that = $(this);
}
``` | Try using
```
listItem.click(function(data)
```
instead of
```
listItem.click(function()
``` |
17,461,042 | I have just had a really good use for multithreading. As such.... I have to learn multithreading. I have a very simple program:
```
void *listenloop(void *arg){
while (1){
Sleep(2000);
puts("testing 123\n");
}
return NULL;
}
int main(){
pthread_t listener;
pthread_create(&listener,NULL,liste... | 2013/07/04 | [
"https://Stackoverflow.com/questions/17461042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1833028/"
] | $(this) creates a jQuery object from the context at the time it is called. `this` changes according to which click handler has been fired, so caching it at the top of the code won't give you the result you want.
If you need to access `$(this)` more than once or twice in a handler, cache it in the handler.
```
$this =... | How do you init it?
if you do something like
$this = $(this);
It MUST not work, becouse in the list `this` contains scope of you function, but not eventual `clicks` scope
you do something like
```
var that; // - without initing it
```
and then do
```
but.click = function(){
that = $(this);
}
``` |
28,502,540 | EDIT: In an attempt to clarify my question, here's what I'm trying to understand.
If a web page embeds an image like so:
```
`<img src="...">`
```
**How do browser handle receiving different HTTP error status codes from the image url? Is it very consistent across browser, and basically treated the same as if the i... | 2015/02/13 | [
"https://Stackoverflow.com/questions/28502540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26510/"
] | Without actually testing it, I would say the memory allocation using new could cost more than copying the whole MyObject. Of course it depends on how MyObject is implemented.
Another thing to consider is that storing object itself may give you some higher cache hit rates, assuming boost::lock\_free stores data in a co... | Agreed that storing a pointer has to be cheaper than storing something larger than a pointer, in almost every circumstance.
In each case, there appears to be a copy construction of a MyObject. By letting the caller be responsible for the lifetime of the object, there is the opportunity to remove this construction:
1.... |
28,502,540 | EDIT: In an attempt to clarify my question, here's what I'm trying to understand.
If a web page embeds an image like so:
```
`<img src="...">`
```
**How do browser handle receiving different HTTP error status codes from the image url? Is it very consistent across browser, and basically treated the same as if the i... | 2015/02/13 | [
"https://Stackoverflow.com/questions/28502540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26510/"
] | Without actually testing it, I would say the memory allocation using new could cost more than copying the whole MyObject. Of course it depends on how MyObject is implemented.
Another thing to consider is that storing object itself may give you some higher cache hit rates, assuming boost::lock\_free stores data in a co... | If speed is the ultimate goal look at using some sort in intrusive pattern. By intrusive, I mean, add linking pointers to each of your objects and use these pointers to construct your queues. The big advantage is that there is zero memory allocation when adding an object to the queue. And if you allocate all your objec... |
28,502,540 | EDIT: In an attempt to clarify my question, here's what I'm trying to understand.
If a web page embeds an image like so:
```
`<img src="...">`
```
**How do browser handle receiving different HTTP error status codes from the image url? Is it very consistent across browser, and basically treated the same as if the i... | 2015/02/13 | [
"https://Stackoverflow.com/questions/28502540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26510/"
] | If speed is the ultimate goal look at using some sort in intrusive pattern. By intrusive, I mean, add linking pointers to each of your objects and use these pointers to construct your queues. The big advantage is that there is zero memory allocation when adding an object to the queue. And if you allocate all your objec... | Agreed that storing a pointer has to be cheaper than storing something larger than a pointer, in almost every circumstance.
In each case, there appears to be a copy construction of a MyObject. By letting the caller be responsible for the lifetime of the object, there is the opportunity to remove this construction:
1.... |
28,502,540 | EDIT: In an attempt to clarify my question, here's what I'm trying to understand.
If a web page embeds an image like so:
```
`<img src="...">`
```
**How do browser handle receiving different HTTP error status codes from the image url? Is it very consistent across browser, and basically treated the same as if the i... | 2015/02/13 | [
"https://Stackoverflow.com/questions/28502540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26510/"
] | Given that the only real way to figure out what is going on is to measure, I used a crude way to figure out what my execution times (for both implementations were).
The following are results from a run of 2500 insertions into the queue. Times are in seconds based on a boost::timer surrounding the function call. Note t... | Agreed that storing a pointer has to be cheaper than storing something larger than a pointer, in almost every circumstance.
In each case, there appears to be a copy construction of a MyObject. By letting the caller be responsible for the lifetime of the object, there is the opportunity to remove this construction:
1.... |
28,502,540 | EDIT: In an attempt to clarify my question, here's what I'm trying to understand.
If a web page embeds an image like so:
```
`<img src="...">`
```
**How do browser handle receiving different HTTP error status codes from the image url? Is it very consistent across browser, and basically treated the same as if the i... | 2015/02/13 | [
"https://Stackoverflow.com/questions/28502540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26510/"
] | Given that the only real way to figure out what is going on is to measure, I used a crude way to figure out what my execution times (for both implementations were).
The following are results from a run of 2500 insertions into the queue. Times are in seconds based on a boost::timer surrounding the function call. Note t... | If speed is the ultimate goal look at using some sort in intrusive pattern. By intrusive, I mean, add linking pointers to each of your objects and use these pointers to construct your queues. The big advantage is that there is zero memory allocation when adding an object to the queue. And if you allocate all your objec... |
26,733,594 | I am trying to use Facebook's ads-api to get data about advertising accounts/campaigns/etc within a specified time range.
Up until now I managed to get overall information (added below) using the official python sdk ,
but I can't figure out how to insert the time filter condition.
The answer is probably here under "... | 2014/11/04 | [
"https://Stackoverflow.com/questions/26733594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4213666/"
] | The `get_stats()` method has an additional parameter named `params` where you can pass in `start_time` and/or `end_time`.
```
params_data = {
'start_time': 1415134405,
}
stats = campaign.get_stats(
params=params_data,
fields=[
'impressions',
'clicks',
...
]
)
for stat in stats... | The "get\_stats" method is deprecated in the V2.4 version of the API.
Instead, "get\_insights" method should be used. The parameters for that method are liste on the page below:
<https://developers.facebook.com/docs/marketing-api/insights/v2.5>
From the page above, the replacement for the "start\_time" and "end\_time... |
57,445,130 | Below is my query to get some data for dashboard screen.
```
SELECT COUNT(*) as occupied_rooms FROM rooms where available='N' ;
SELECT COUNT(*) as checkedIn_guests FROM booking where checkout_time='' ;
SELECT COUNT(*) as available_rooms FROM rooms where available='Y' ;
SELECT COUNT(*) as total_guest FROM booking;
SE... | 2019/08/10 | [
"https://Stackoverflow.com/questions/57445130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9406763/"
] | Use `union all`
```
SELECT 'occupied_rooms' as which, COUNT(*) as cnt FROM rooms where available = 'N'
UNION ALL
SELECT 'checkedIn_guests', COUNT(*) FROM booking where checkout_time = ''
UNION ALL
SELECT 'available_rooms', COUNT(*) FROM rooms where available = 'Y' ;
UNION ALL
SELECT 'total_guest', COUNT(*) FROM bookin... | You could use a UNION for build single table result with each result in a row
```
SELECT 'occupied_rooms', COUNT(*) count
FROM rooms
where available='N'
UNION
SELECT 'checkedIn_guests', COUNT(*)
FROM booking
where checkout_time=''
UNION
SELECT 'available_rooms', COUNT(*)
FROM rooms
where available='Y'
UN... |
44,778,938 | I'm learning C language following Youtube video and I've got couple of questions.
I typed these below in Xcode
```
#include<stdio.h>
int main() // 1. why do we have to use this line?
{
char food[] = "tuna";
printf("the best food is %s",food);
strcpy(food,"bacon"); // error here
return 0;
}
```
2. When ... | 2017/06/27 | [
"https://Stackoverflow.com/questions/44778938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8220170/"
] | C is a super great language to learn but because of how low level it is in comparison to python, javascript, etc. There are many manual tasks you need to do including memory management.
But before we get into that, your initial problem is not including the `string.h` header. Once you include that header, you'll actual... | 1. We have to use `main()`,this is the function through which execution of C program starts.
2. For using `strcpy()`(A predefined function) you need to declare it first. and its declaration is present in `string.h` so just `#include<string.h>`
This will resolve your problem.`implicit declaring library function 'strcpy'... |
44,778,938 | I'm learning C language following Youtube video and I've got couple of questions.
I typed these below in Xcode
```
#include<stdio.h>
int main() // 1. why do we have to use this line?
{
char food[] = "tuna";
printf("the best food is %s",food);
strcpy(food,"bacon"); // error here
return 0;
}
```
2. When ... | 2017/06/27 | [
"https://Stackoverflow.com/questions/44778938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8220170/"
] | C is a super great language to learn but because of how low level it is in comparison to python, javascript, etc. There are many manual tasks you need to do including memory management.
But before we get into that, your initial problem is not including the `string.h` header. Once you include that header, you'll actual... | I suggest you as exercise to explain me the behavior of this code. You have to understand how "strings" are managed by the C language into the memory.
The code I post below is not right, contains a violation of the space allocated for the variable `food`. In this case this code doesn't generate a Segmentation Fault, b... |
40,317,560 | I know many topics on this subject already exist (eg [How do I return the response from an asynchronous call?](https://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call)) but currently I'm in a state of information overload and I can't seem to get it done. Many topics say to us... | 2016/10/29 | [
"https://Stackoverflow.com/questions/40317560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6873546/"
] | Wrap the Ajax call in function and have it call itself in recursion in success.
In success simply push the results from server in the newList array.
If the result from the server is empty, then continue with the execution. | try with `async: false` by default $.ajax method is async: true with async: true any variable outside the callback function cannot be change.
```
var list=['a','b','c','d'];
var newlist=[];
for(element in list)
{
var item=list[element];
$.ajax({
url: "process.php",
type:"get",
data:{content:item},
a... |
40,317,560 | I know many topics on this subject already exist (eg [How do I return the response from an asynchronous call?](https://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call)) but currently I'm in a state of information overload and I can't seem to get it done. Many topics say to us... | 2016/10/29 | [
"https://Stackoverflow.com/questions/40317560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6873546/"
] | Actually, you're having a closure problem (there are hundreds of posts in SO that address it). You can check this [post](https://stackoverflow.com/questions/111102/how-do-javascript-closures-work) in order to get a full explanation (or find a good article on the internet).
In essence, the problem stems from the fact t... | try with `async: false` by default $.ajax method is async: true with async: true any variable outside the callback function cannot be change.
```
var list=['a','b','c','d'];
var newlist=[];
for(element in list)
{
var item=list[element];
$.ajax({
url: "process.php",
type:"get",
data:{content:item},
a... |
33,058,684 | I am getting this PSQLException:
```
org.postgresql.util.PSQLException: ERROR: syntax error at or near "$1"
Position: 37
```
When I run the following code:
```
ps = connection.prepareStatement("SELECT current_timestamp + INTERVAL ?;");
ps.setString(1, "30 minutes");
System.out.println(ps);
rs = ps.executeQuery();... | 2015/10/10 | [
"https://Stackoverflow.com/questions/33058684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/903185/"
] | Although the syntax `INTERVAL '30 minutes'` is valid when you write SQL directly in a console, it is actually considered to be an **interval literal** and won't work where the string that follows the word `INTERVAL` is not a literal string.
Prepared statements in PostgreSQL are implemented on the server side using [`P... | I believe this is a Postgres bug and so I thought of a dirty hack to get around this...
```
ps = connection.prepareStatement("SELECT current_timestamp + INTERVAL ?;");
ps.setString(1, "30 minutes");
ps = connection.prepareStatement(ps.toString());
rs = ps.executeQuery();
```
I wonder if this will ever get fixed? |
22,312,188 | I am trying to setup a frozen column and the only problem left I have to solve is the heights of the other td's on the same row do not expand to match the height of the absolute positioned td. Since the text in the frozen header is arbitrary, it could span multiple lines. **If it weren't absolute positioned then this w... | 2014/03/10 | [
"https://Stackoverflow.com/questions/22312188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84206/"
] | You want the other rows to have the same `height` as the cells in the first column, right? If I understood correctly, you will need to establish the `width` of the whole table using jQuery, so that the `height` will change to what you want too.
If you want, for instance, that all rows be no taller than `26px` (the hei... | The solution I found was to repeat the content from the absolutely positioned td into the last td of the relative td's. Since I can generate the columns server side, it was easy to repeat the content in another column. I then used css to set `visibility:hidden' on that last td. As long as the width of both that hidden ... |
70,611,059 | I have a need to output a google sheets QUERY function in two halves, each half on a different sheet (these get exported into other software). I need to preserve the original ordering, which is prepared on a third sheet which is the source of the data for the query. This preservation of order is the part I'm hung up on... | 2022/01/06 | [
"https://Stackoverflow.com/questions/70611059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17852819/"
] | Following on what Barmar commented, try this code.
```
fruits = ['apple','pine','grape','mango','orange']
fruits[1:3] = [input('Enter a fruit:')]
print(fruits)
```
It will effectively replace second and third element in array (what I assume you wanted to achieve) | Convert your input to a list explicitly and then assign to your original list. |
70,611,059 | I have a need to output a google sheets QUERY function in two halves, each half on a different sheet (these get exported into other software). I need to preserve the original ordering, which is prepared on a third sheet which is the source of the data for the query. This preservation of order is the part I'm hung up on... | 2022/01/06 | [
"https://Stackoverflow.com/questions/70611059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17852819/"
] | Since you're doing slice assignment, the source will be treated as a sequence. The slice `[1:3]` will be replaced by each element of the source sequence separately.
When a string is used as a sequence, each character is a separate element, so it gets split up and inserted into the list.
If you want to replace the sli... | Convert your input to a list explicitly and then assign to your original list. |
70,611,059 | I have a need to output a google sheets QUERY function in two halves, each half on a different sheet (these get exported into other software). I need to preserve the original ordering, which is prepared on a third sheet which is the source of the data for the query. This preservation of order is the part I'm hung up on... | 2022/01/06 | [
"https://Stackoverflow.com/questions/70611059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17852819/"
] | As the comments state, when executing fruits[1:3], you're creating a slice assignment which slices the word which was input and stores it in the 1 and 2 indexes (3 is excluded).
If you were just trying to add another fruit to the array of fruits,
```
fruits = ['apple','pine','grape','mango','orange']
fruit = input('E... | Convert your input to a list explicitly and then assign to your original list. |
70,611,059 | I have a need to output a google sheets QUERY function in two halves, each half on a different sheet (these get exported into other software). I need to preserve the original ordering, which is prepared on a third sheet which is the source of the data for the query. This preservation of order is the part I'm hung up on... | 2022/01/06 | [
"https://Stackoverflow.com/questions/70611059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17852819/"
] | Since you're doing slice assignment, the source will be treated as a sequence. The slice `[1:3]` will be replaced by each element of the source sequence separately.
When a string is used as a sequence, each character is a separate element, so it gets split up and inserted into the list.
If you want to replace the sli... | Following on what Barmar commented, try this code.
```
fruits = ['apple','pine','grape','mango','orange']
fruits[1:3] = [input('Enter a fruit:')]
print(fruits)
```
It will effectively replace second and third element in array (what I assume you wanted to achieve) |
70,611,059 | I have a need to output a google sheets QUERY function in two halves, each half on a different sheet (these get exported into other software). I need to preserve the original ordering, which is prepared on a third sheet which is the source of the data for the query. This preservation of order is the part I'm hung up on... | 2022/01/06 | [
"https://Stackoverflow.com/questions/70611059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17852819/"
] | As the comments state, when executing fruits[1:3], you're creating a slice assignment which slices the word which was input and stores it in the 1 and 2 indexes (3 is excluded).
If you were just trying to add another fruit to the array of fruits,
```
fruits = ['apple','pine','grape','mango','orange']
fruit = input('E... | Following on what Barmar commented, try this code.
```
fruits = ['apple','pine','grape','mango','orange']
fruits[1:3] = [input('Enter a fruit:')]
print(fruits)
```
It will effectively replace second and third element in array (what I assume you wanted to achieve) |
64,348,283 | I am trying to call an API from the output of a query , the output of the query is int , but when I call the query it returns something like `[(12345,)],` but I want only `12345` how to reconstruct the output
i am using import re regular expression to remove the unwanted characters but it is not working as expected.
... | 2020/10/14 | [
"https://Stackoverflow.com/questions/64348283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11241234/"
] | [(12345,)]
it is just a tuple inside a list
you can take the element out by using
```
data = contact[0][0]
print(data)
```
will give you the required results | * `fetchall()` returns a list.
<https://docs.python.org/3/library/sqlite3.html#sqlite3.Cursor.fetchall>
* List of rows. Each row is represented by a tuple.
Best way to confirm these kind of 'visual' problems is to find out 'type' of return values.
```
contact = cursor.fetchall()
print( type(contact) )
print(type(con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.